-
Notifications
You must be signed in to change notification settings - Fork 3
Description
Actual example:
<14>{{next(date_generator)}} {{ fake.random_element(('ABCDEFGHI01', 'ABCDEFGHI02')) }} firewall.cisco.asa: 2018-03-22T23:56:09.237067-07:00 : %ASA-123456: Teardown dynamic {{ fake.random_element(('TCP', 'UDP', 'ICMP')) }} translation from inside:{{ fake.ipv4() }}/{{ fake.int(1, 65000) }} to outside:{{ fake.ipv4() }}/{{ fake.int(1, 65000) }} duration 0:02:32
Its wrong, the new use of random_element must import OrderedDict from collections, one example can be:
`from devoutils.faker import SyslogFakeGenerator
from collections import OrderedDict
def get_choices():
return ["Failed", "Success", "Totally broken", "404", "500", "What?"]
if name == "main":
with open("orderer_dict.jinja2", 'r') as myfile:
template1 = myfile.read()
custom = {"od": OrderedDict}
f = SyslogFakeGenerator(engine=1, template=template1, simulation=True,
probability=100,
frequency=(1, 1),
providers=custom,
verbose=True)
f.start()
`
{%- set re = fake.random_element(elements=od([("a", 0.7), ("b", 0.2), ("c", 0.05), ("d", 0.05)])) -%} nabo {{ re }}