Class FlowConfig
- java.lang.Object
-
- org.opennms.nephron.testing.flowgen.FlowConfig
-
- All Implemented Interfaces:
Serializable
public class FlowConfig extends Object implements Serializable
Parameterizes the generation of flows.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description org.apache.beam.sdk.transforms.SerializableFunction<Integer,org.joda.time.Duration>clockSkewA function that given a nodeId returns the clockSkew for that node.static org.apache.beam.sdk.transforms.SerializableBiFunction<Long,FlowDocuments.FlowData,org.joda.time.Instant>CURRENT_TIME_LAST_SWITCHED_POLICYReturns a function that always return the current time instant.doubleflowDurationLambdaFlow durations are calculated using an exponential distribution.org.apache.beam.sdk.transforms.SerializableBiFunction<Long,FlowDocuments.FlowData,org.joda.time.Instant>lastSwitchedA function that given the index of a generated flow returns its lastSwitched timestamp.org.joda.time.DurationlastSwitchedSigmaLastSwitched timestamps are randomized by a normal distribution with the given sigma.intminExporterExporter numbers are generated uniformly starting at minExporter.intminInterfaceInterface numbers are generated uniformly starting at minInterface.intnumApplicationsintnumDscpsintnumEcnsintnumExportersintnumHostsintnumInterfacesintnumProtocols
-
Constructor Summary
Constructors Constructor Description FlowConfig(int minExporter, int numExporters, int minInterface, int numInterfaces, int numProtocols, int numApplications, int numHosts, int numEcns, int numDscps, org.apache.beam.sdk.transforms.SerializableBiFunction<Long,FlowDocuments.FlowData,org.joda.time.Instant> lastSwitched, org.apache.beam.sdk.transforms.SerializableFunction<Integer,org.joda.time.Duration> clockSkew, org.joda.time.Duration lastSwitchedSigma, double flowDurationLambda)FlowConfig(FlowGenOptions opts, org.apache.beam.sdk.transforms.SerializableBiFunction<Long,FlowDocuments.FlowData,org.joda.time.Instant> lastSwitched, org.apache.beam.sdk.transforms.SerializableFunction<Integer,org.joda.time.Duration> clockSkew)
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.apache.beam.sdk.transforms.SerializableFunction<Integer,org.joda.time.Duration>groupClockSkewPolicy(FlowGenOptions options)A clock skew policy that calculates for each nodeId a clock skew group number between 0 andFlowGenOptions.getNumClockSkewGroups()and uses that group number as a factor for multiplying theFlowGenOptions.getClockSkewMs().static org.apache.beam.sdk.transforms.SerializableBiFunction<Long,FlowDocuments.FlowData,org.joda.time.Instant>linearIncreasingLastSwitchedPolicy(org.joda.time.Instant start, org.joda.time.Duration step)Calculates thelastSwitchedtimestamp linearly starting atstartand increasing bystepfor each index.static org.apache.beam.sdk.transforms.SerializableBiFunction<Long,FlowDocuments.FlowData,org.joda.time.Instant>uniformInWindowLastSwitchedPolicy(FlowGenOptions opts)Calculates thelastSwitchedtimestamp uniformly distributed according to the configured start, window size, and number of flows per window.
-
-
-
Field Detail
-
CURRENT_TIME_LAST_SWITCHED_POLICY
public static org.apache.beam.sdk.transforms.SerializableBiFunction<Long,FlowDocuments.FlowData,org.joda.time.Instant> CURRENT_TIME_LAST_SWITCHED_POLICY
Returns a function that always return the current time instant.
-
minExporter
public final int minExporter
Exporter numbers are generated uniformly starting at minExporter.
-
numExporters
public final int numExporters
-
minInterface
public final int minInterface
Interface numbers are generated uniformly starting at minInterface.
-
numInterfaces
public final int numInterfaces
-
numProtocols
public final int numProtocols
-
numApplications
public final int numApplications
-
numHosts
public final int numHosts
-
numEcns
public final int numEcns
-
numDscps
public final int numDscps
-
lastSwitched
public final org.apache.beam.sdk.transforms.SerializableBiFunction<Long,FlowDocuments.FlowData,org.joda.time.Instant> lastSwitched
A function that given the index of a generated flow returns its lastSwitched timestamp. The returned lastSwitched time instant is additionally randomized by a normal distribution. Note: Function implementations must not be referentially transparent. Function implementations may ignore the function parameter and simply return the current time instant.
-
clockSkew
public final org.apache.beam.sdk.transforms.SerializableFunction<Integer,org.joda.time.Duration> clockSkew
A function that given a nodeId returns the clockSkew for that node.
-
lastSwitchedSigma
public final org.joda.time.Duration lastSwitchedSigma
LastSwitched timestamps are randomized by a normal distribution with the given sigma.
-
flowDurationLambda
public final double flowDurationLambda
Flow durations are calculated using an exponential distribution. The random value returned by the exponential distribution is the flow length in seconds.
-
-
Constructor Detail
-
FlowConfig
public FlowConfig(int minExporter, int numExporters, int minInterface, int numInterfaces, int numProtocols, int numApplications, int numHosts, int numEcns, int numDscps, org.apache.beam.sdk.transforms.SerializableBiFunction<Long,FlowDocuments.FlowData,org.joda.time.Instant> lastSwitched, org.apache.beam.sdk.transforms.SerializableFunction<Integer,org.joda.time.Duration> clockSkew, org.joda.time.Duration lastSwitchedSigma, double flowDurationLambda)
-
FlowConfig
public FlowConfig(FlowGenOptions opts, org.apache.beam.sdk.transforms.SerializableBiFunction<Long,FlowDocuments.FlowData,org.joda.time.Instant> lastSwitched, org.apache.beam.sdk.transforms.SerializableFunction<Integer,org.joda.time.Duration> clockSkew)
-
-
Method Detail
-
linearIncreasingLastSwitchedPolicy
public static org.apache.beam.sdk.transforms.SerializableBiFunction<Long,FlowDocuments.FlowData,org.joda.time.Instant> linearIncreasingLastSwitchedPolicy(org.joda.time.Instant start, org.joda.time.Duration step)
Calculates thelastSwitchedtimestamp linearly starting atstartand increasing bystepfor each index.
-
uniformInWindowLastSwitchedPolicy
public static org.apache.beam.sdk.transforms.SerializableBiFunction<Long,FlowDocuments.FlowData,org.joda.time.Instant> uniformInWindowLastSwitchedPolicy(FlowGenOptions opts)
Calculates thelastSwitchedtimestamp uniformly distributed according to the configured start, window size, and number of flows per window.
-
groupClockSkewPolicy
public static org.apache.beam.sdk.transforms.SerializableFunction<Integer,org.joda.time.Duration> groupClockSkewPolicy(FlowGenOptions options)
A clock skew policy that calculates for each nodeId a clock skew group number between 0 andFlowGenOptions.getNumClockSkewGroups()and uses that group number as a factor for multiplying theFlowGenOptions.getClockSkewMs().
-
-