Package: avalon-generator
Avalonis a extendable scalable high-performance streaming data
generator that can be used to simulate the real-time input for various
systems.InstallationTo installavalonwith all of its dependencies yon can usepip:pipinstallavalon-generator[all]Avalon supports a lot of command-line arguments, so you probably want to
enable itsargcompletesupport for tab completion of arguments. Just run the following command
for a single use or add it to your~/.bashrcto preserve it for the
future uses:eval"$(avalon--completion-script=bash)"Also if you install Avalon on Ubuntu using PPA the command line auto
completion will be enabled automatically.Installation on UbuntuThere is aPPAfor
Avalon which you may prefer to use if you are using Ubuntu. You can
install Avalon using the PPA with the following commands:sudoadd-apt-repositoryppa:mrazavi/avalonsudoaptupdatesudoaptinstallavalonUsageAt the most simple from you can name amodelas the command line
argument ofavalonand it will produce data for the specified model
on the standard output. The following command uses the--textlogshortcut to generate logs similar tosnortIDS:avalonsnort--textlogMultiple models could be used at the same time. You can also see the
available models by the following command:avalon--list-modelsThe default output format (without--textlog) isjson-lineswhich output a JSON document on each line. Other formats likecsvis
also supported. To see the supported formats you can use the--helpargument and checkout the options for--output-format, or just
enable auto-complete and press <tab> key to see the available options.Besides--output-format, the output media could also be specified
via--output-media. A lot of output mediums likefile,http,grpc,kafka, direct insert onsqldatabases are also
supported out of the box.Also, the number and the rate of the outputs could be controlled via--numberand--ratearguments.For high rates, you might want to utilize your multiple CPU cores. To do
so, just prefix your model name with the number of instances you want to
run at the same time, e.g.10snortto run 10snortinstances
(with 10 Python processes that could utilize up to 10 CPU cores).You can utilize multiple models at the same time. You can also provide a
ratio for the output of each model, e.g.10snort1000 5asa20. That
means 10 instances ofsnortmodel and 5 instances ofasamodel
with the ratio 1000 output forsnortproducers to 20 forasaproducers.The other important parameter to archived high resource utilization is
by increasing the batch size by--batch-sizeargument.Also,--output-writersargument determines the simultaneous writes
to the output media. So if your sink is afileor ahttpserver
or any other forms of mediums that supports concurrent writes it is
possible to provide--output-writersto tune the parallelism.Here is an example that use multiple processes to write to a CSV file,
10000 items per second.# You don't need to enter --output-media=file because
# Avalon will automatically infer it after you enter an
# argument such as --file-name
#avalon20snort5asa\--batch-size=1000--rate=10000--number=1000000--output-writers=25\--output-format=headered-csv--file-name=test.csvAvalon command line supports many more options that you could explore
them via--helpargument or auto-complete by pressing <tab> key in
the command line.ArchitectureAvalon architecture consists of several abstractions that give it great
flexibility:ModelEach model is responsible to generate a specific kind of data. For
example a model might generate data similar to logs of a specific
application or appliance while another model might generate network
flows or packets.Model output is usually an unlimited iteration of Python
dictionaries.MappingMappings could transform data model for a different purpose. For
example one might want to use different key names in a JSON or
different column names in CSV or SQL database. You can specify a
chain of multiple mappings to achieve your goal.FormatEach format (or formatter) is responsible for converting a batch of
model data to a specific format, e.g. JSON or CSV.Format output is usually a string or bytes array, although other
types could also be used according to the output media.MediaEach media is responsible for transferring the batched formatted data
to a specific data sink. For example it could write data to a file or
send it to a remote server via network.Generic ExtensionGenerics, currently in Beta stage, are a brand new type of extensions
that gives the user ultimate flexibility to modify input arguments or
execute any tasks according to them.ExtensionAvalon supports third-party extensions. So, you can develop your own
models, formats, etc. to generate data for your specific use cases or
send them to a sink that Avalon does not support out of the box.You can also publish your developed extensions publicly if you think
they could benefit other users.More information is available atEXTENSIONS.org.MappingsAlthough developing and running an Avalon extension is as trivial as
creating a specific directory structure and runningavaloncommand
with a specificPYTHONPATHenvironment variable, there is an even
simpler method that might comes handy when you want to use a
user-defined mapping.A mapping could modify the model output dictionary before being used by
the formatter. Avalon supports a couple of useful mappings out of the
box, but new mappings could also be defined in a simple Python script
and passing the file path as a URL in theavaloncommand line.For example, the following script if put in amymap.pyfile could be
used as a mapping:# Any valid name for the class is acceptable.classMyMap:defmap(self,item):# Item is the dictionary generated by the models# Rename "foo" key to "bar"item["bar"]=item.pop("foo",None)item["new"]="a whole new key value"# Don't forget to reutrn the itemreturnitemNOTE: Despite normal extension mappings which has to inherit from a
specific base class, the mappings passed asfile://URLs toavalondoes not have such obligations.Now, the mapping could be passed to Avalon with--mapas a URL:avalon--map=file:///path/to/mymap.pyAvalon also supports passing multiple--maparguments and all the
provided mappings will be applied in the specified order. One particular
useful use-case is to define many simple mappings and combine them do
achieve the desired goal.Also using curly braces you can pass a mapping to only a specific model
when combining multiple models. Here is an example:# mymap.py will applied to the first snort, the internal jsoncolumn# mapping will be applied to asa and the last snort will be used# without any mappings.avalon"snort{file:///path/to/mymap.py} asa{jsoncolumn}snort"EtymologyTheAvalanname is based on the name of a legendary island featured
in the Arthurian legend and it has nothing to do with the proprietarySpirent
Avalanchetraffic generator.AuthorsMohammad RazaviMohammad Reza Moghaddas