weightedRandomFramesize
weightedRandomFramesize - configure weighted random frame sizes
SYNOPSIS
weightedRandomFramesize sub-command options
DESCRIPTION
The weightedRandomFramesize command is used to configure possible different modes of generating random frame sizes for a particular stream. This command is used for ports which support this feature and where the port has been programmed for random stream generation with:
stream config -frameSizeType sizeRandom
The availability of this feature on a given port may be tested with the port isValidFeature... portFeatureRandomFrameSizeWeightedPair.
Four basic types of random streams are available, and are set in the randomType option:
- Uniform: identical to previous implementations of the random framesize feature. A uniform set of random values between a minimum and maximum value are generated. The min/max values are set in the stream command's frameSizeMIN and frameSizeMAX options.
- Pre-programmed: a number of pre-programmed distributions are available, corresponding to standard traffic models found in various applications. See the randomType option description below.
- Custom: a distribution may be custom programmed for a stream. Pairs of frame size-weights are added to a list. Frame sizes may be any value valid for the port. Weights may be any value, such that the total of all of the weights is less than 2048. Pairs are added to the list using the addPair sub-command.
- Gaussian: up to four gaussian curves may be summed up to generate a random distribution. Each curve is specified in the center, and widthAtHalf options and set by the updateQuadGaussianCurve sub-command. The weight option controls the distribution of values among the four curves.
For the pre-programmed and custom choices, the weights for all of the frame sizes are added up. Each frame size is then given a proportion of the total number of frames as dictated by its weight value. For example, one of the pre-programmed distributions is (64:7, 594:4, 1518:1). In this case, the total of the weights is 12 (7+4+1). Frames are randomly generated such that 64-byte frames are 7/12 of the total, 594-byte frames are 4/12 of the total and 1518-byte frames are 1/12 of the total.
Note that stream get must be called before this command's get sub-command.
STANDARD OPTIONS
center
If randomType is set to randomQuadGaussian, then this is used to indicate the center value of the curve, expressed in framesize. Fractional values are permitted. This and the weight and widthAtHalf options are associated with one of the four available curves by the updateQuadGaussianCurve sub-command. (default = 200.0)
pairList
Read-only. After a set operation, this option holds a TCL list with the frame size-weight pairs.
randomType
The type of random weighted frames sizes to be generated.
Option |
Value |
Usage |
---|---|---|
randomUniform |
0 |
(default) A uniform distribution between the min/max values found in the frameSizeMIN and frameSizeMAX options in the stream command. |
randomWeightedair |
1 |
Custom weighted pairs are used for the distribution. Pairs are added to the list using the addPair sub-command. The sum of all of the weights must be less than 2048. |
randomQuadGaussian |
3 |
Up to four gaussian curves may be specified in the center, weight and widthAtHalf options. |
randomCisco |
4 |
A pre-programmed distribution is used: 64:7, 594:4 and 1518:1. |
randomIMIX |
5 |
A pre-programmed distribution is used: 64:7, 570:4 and 1518:1. |
randomTolly |
7 |
A pre-programmed distribution is used: 64:55, 78:5, 576:17, and 1518: 23. |
randomRPRTrimodal |
8 |
A pre-programmed distribution is used: 64:60, 512:20, and 1518:20. |
randomRPRQuadmodal |
9 |
A pre-programmed distribution is used: 64:60, 512:20, 1518:20 and 9000:20. |
weight
If randomType is set to randomQuadGaussian, then this is used to indicate the relative weight of the values from this curve with respect to the other three curves. This and the widthAtHalf and center options are associated with one of the four available curves by the updateQuadGaussianCurve sub-command. (default = 1)
widthAtHalf
If randomType is set to randomQuadGaussian, then this is used to indicate the width of the curve at its half-value height, expressed in framesize. Fractional values are permitted. This and the weight and center options are associated with one of the four available curves by the updateQuadGaussianCurve sub-command. The valid range is .01 to 30000. (default = 100.0)
COMMANDS
The weightedRandomFramesize command is invoked with the following sub-commands. If no sub-command is specified, returns a list of all sub-commands available.
weightedRandomFramesize addPair framesize weight
Adds the framesize-weight pair to the pairList. Multiple pairs which use te same framesize have their weights effectively added together. Specific errors include:
- The value of randomType is not randomWeightedPair
- Memory exceeded
weightedRandomFramesize cget option
Returns the current value of the configuration option given by option. Option may have any of the values accepted by the weightedRandomFramesize command.
weightedRandomFramesize config option value
Modify the weightedRandomFramesize configuration options of the port. If no option is specified, returns a list describing all of the available weightedRandomFramesize options (see STANDARD OPTIONS) for port.
weightedRandomFramesize delPair framesize weight
Deletes the first framesize-weight pair in the pairList. Specific errors include:
- The value of randomType is not randomWeightedPair
- The pair could not be found
weightedRandomFramesize get chasID cardID portID
Gets the current configuration of the port with id portID on card cardID, chassis chasID. Note that stream get must be called before this command's get sub-command. Call this command before calling weightedRandomFramesize cget option to get the value of the configuration option.
weightedRandomFramesize retrieveQuadGaussianCurve curveId
Retrieves the values associated with the Gaussian curve specified in curveId and sets them into the center, widthAtHalf and weight options of this command.
weightedRandomFramesize set chasID cardID portID
Sets the weightedRandomFramesize configuration of the port with id portID on card cardID, chassis chasID by reading the configuration option values set by the weightedRandomFramesize config option value command.
weightedRandomFramesize setDefault
Sets to IxTclHal default values for all configuration options.
weightedRandomFramesize updateQuadGaussianCurve curveId
Sets the values associated with the Gaussian curve specified in curveId using the values in the center, widthAtHalf and weight options of this command.
EXAMPLES
package req IxTclHal
set hostname loopback
set username user
# Check if we're running on UNIX - connect to the TCL Server
# which must be running on the chassis
if [isUNIX] {
if [ixConnectToTclServer $host] {
ixPuts "Could not connect to $host"
return 1
}
}
# Now connect to the chassis
if [ixConnectToChassis $host] {
ixPuts $::ixErrorInfoF
return 1
}
# Get the chassis ID to use in port lists
set ch [ixGetChassisID $host]
set cd 22
set prt 1
set portList [list [list $ch $cd $prt]]
# Login before taking ownership
if [ixLogin $username] {
ixPuts $::ixErrorInfo
return 1
}
# Take ownership of the ports we'll use
if [ixTakeOwnership $portList] {
ixPuts $::ixErrorInfo
return 1
}
stream config -frameSizeType sizeRandom
weightedRandomFramesize setDefault
weightedRandomFramesize config -randomType randomWeightedPair
weightedRandomFramesize addPair 100 5
weightedRandomFramesize addPair 200 10
if [weightedRandomFramesize set $ch $cd $prt] {
errorMsg " Error setting weighted 1 on port $ch $cd $prt "
return $ ::TCL_ERROR
}
if [stream set $ch $cd $prt 1] {
errorMsg " Error setting stream 1 on port $ch $cd $prt "
return $ ::TCL_ERROR
}
# weightedRandomFramesize cget -pairList will return
# "{100 5} {200 10}"
weightedRandomFramesize setDefault
weightedRandomFramesize config -randomType randomUniform
if [weightedRandomFramesize set $ch $cd $prt] {
errorMsg " Error setting weighted 1 on port $ch $cd $prt "
return $ ::TCL_ERROR
}
stream config -frameSizeType sizeRandom
stream config -frameSizeMIN 100
stream config -frameSizeMAX 1000
if [stream set $ch $cd $prt 2] {
errorMsg " Error setting stream 2 on port $ch $cd $prt "
return $ ::TCL_ERROR
}
weightedRandomFramesize setDefault
weightedRandomFramesize config -randomType randomCisco
if [weightedRandomFramesize set $ch $cd $prt] {
errorMsg " Error setting weighted 1 on port $ch $cd $prt "
return $ ::TCL_ERROR
}
if [stream set $ch $cd $prt 3] {
errorMsg " Error setting stream on port $ch $cd $prt "
return $::TCL_ERROR
}
# weightedRandomFramesize cget -pairList will return
# "{ 64 7 } { 594 4 } { 1518 1 }"
weightedRandomFramesize setDefault
weightedRandomFramesize config -randomType randomQuadGaussian
weightedRandomFramesize config -center 256.0
weightedRandomFramesize config -widthAtHalf 128.0
weightedRandomFramesize config -weight 1
if [weightedRandomFramesize updateQuadGaussianCurve 1] {
ixPuts $::ixErrorInfo
return $ ::TCL_ERROR
}
weightedRandomFramesize config -center 512.0
weightedRandomFramesize config -widthAtHalf 256.0
weightedRandomFramesize config -weight 4
if [weightedRandomFramesize updateQuadGaussianCurve 2] {
ixPuts $::ixErrorInfo
return $ ::TCL_ERROR
}
weightedRandomFramesize config -center 1024.0
weightedRandomFramesize config -widthAtHalf 450.0
weightedRandomFramesize config -weight 8
if [weightedRandomFramesize updateQuadGaussianCurve 3] {
ixPuts $::ixErrorInfo
return $ ::TCL_ERROR
}
weightedRandomFramesize config -center 1500.0
weightedRandomFramesize config -widthAtHalf 12.0
weightedRandomFramesize config -weight 1
if [weightedRandomFramesize updateQuadGaussianCurve 4] {
ixPuts $::ixErrorInfo
return $ ::TCL_ERROR
}
if [weightedRandomFramesize set $ch $cd $prt] {
ixPuts $::ixErrorInfo
return $ ::TCL_ERROR
}
if [stream set $ch $cd $prt 4] {
errorMsg " Error setting stream on port $ch $cd $prt "
return $::TCL_ERROR
}
ixWriteConfigToHardware portList
# Let go of the ports that we reserved
ixClearOwnership $portList
# Disconnect from the chassis we're using
ixDisconnectFromChassis $host
# If we're running on UNIX, disconnect from the TCL Server
if [isUNIX] {
ixDisconnectTclServer $host
}