rougail-output-doc/tests/docs/base/04_5validators_in_network.md

54 lines
6.3 KiB
Markdown
Raw Normal View History

2024-07-10 21:27:48 +02:00
---
gitea: none
include_toc: true
---
# dictionaries/rougail/00-base.yml
```yaml
---
version: '1.1'
network_address_eth0:
description: Network address
type: network
netmask_address_eth0:
description: Network address
type: netmask
ip_address:
description: an IP
type: ip
validators:
- type: jinja
jinja: |
{% if not _.ip_address | valid_in_network(_.network_address_eth0, _.netmask_address_eth0) %}
{{ _.ip_address }} is not in network {{ _.network_address_eth0 }}/{{ _.netmask_address_eth0 }}
{% endif %}
description: check if IP in the previous network
```
# Variables for "rougail"
| Variable                                                                                            | Description                                                                                         |
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **rougail.network_address_eth0**<br/>[`network`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `basic` `mandatory` | Network address. |
| **rougail.netmask_address_eth0**<br/>[`netmask`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `basic` `mandatory` | Network address. |
| **rougail.ip_address**<br/>[`IP`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `basic` `mandatory` | An IP.<br/>**Validators**:<br/>- reserved IP are allowed<br/>- check if IP in the previous network. |
# Example with mandatory variables not filled in
```yaml
---
rougail:
network_address_eth0: 1.1.1.0
netmask_address_eth0: 255.255.255.0
ip_address: 1.1.1.1
```
# Example with all variables modifiable
```yaml
---
rougail:
network_address_eth0: 1.1.1.0
netmask_address_eth0: 255.255.255.0
ip_address: 1.1.1.1
```