rougail/tests/dictionaries/04_5validators_ipnetmask/tiramisu/base.py

12 lines
1.4 KiB
Python

from tiramisu import *
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
from rougail.tiramisu import func, dict_env, load_functions, ConvertDynOptionDescription
load_functions('tests/dictionaries/../eosfunc/test.py')
ALLOWED_LEADER_PROPERTIES.add("basic")
ALLOWED_LEADER_PROPERTIES.add("standard")
ALLOWED_LEADER_PROPERTIES.add("advanced")
dict_env['validators_rougail.netmask_address_eth0'] = "{% if not _.netmask_address_eth0 | valid_in_network(_.network_address_eth0) %}\n{{ _.netmask_address_eth0 }} is not a netmask for network {{ _.network_address_eth0 }}\n{% endif %}\n"
option_2 = NetworkOption(name="network_address_eth0", doc="Network address", properties=frozenset({"basic", "mandatory"}))
option_3 = NetmaskOption(name="netmask_address_eth0", doc="Netmask address", validators=[Calculation(func['valid_with_jinja'], Params((), kwargs={'__internal_jinja': ParamValue("validators_rougail.netmask_address_eth0"), '__internal_type': ParamValue("string"), '__internal_multi': ParamValue(False), '_.netmask_address_eth0': ParamSelfOption(whole=False), '_.network_address_eth0': ParamOption(option_2)}))], properties=frozenset({"basic", "mandatory"}))
optiondescription_1 = OptionDescription(name="rougail", doc="Rougail", children=[option_2, option_3], properties=frozenset({"basic"}))
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1])