WIP: Aruba switches #103
3 changed files with 19 additions and 1 deletions
11
filter_plugins/validators.py
Normal file
11
filter_plugins/validators.py
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
class FilterModule:
|
||||||
|
def filters(self):
|
||||||
|
return {
|
||||||
|
"choices": choices,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def choices(value, choices):
|
||||||
|
if value not in choices:
|
||||||
|
raise ValueError(f"{value} not in {choices}")
|
||||||
|
return value
|
|
@ -59,7 +59,8 @@
|
||||||
4:
|
4:
|
||||||
name: "Client 2"
|
name: "Client 2"
|
||||||
untagged: 1002
|
untagged: 1002
|
||||||
speed: 100fdx
|
speed: 1000
|
||||||
|
duplex: half
|
||||||
loop_protect: true
|
loop_protect: true
|
||||||
5:
|
5:
|
||||||
name: "Client 3"
|
name: "Client 3"
|
||||||
|
|
|
@ -148,6 +148,12 @@ interface {{ id | int }}
|
||||||
enable
|
enable
|
||||||
{% else %}
|
{% else %}
|
||||||
no enable
|
no enable
|
||||||
|
{% endif %}
|
||||||
|
{% if iface.speed is defined %}
|
||||||
|
speed {{ iface.speed | int | choices([10, 100, 1000]) }}
|
||||||
|
{% endif %}
|
||||||
|
{% if iface.duplex is defined %}
|
||||||
|
duplex {{ iface.duplex | choices(["full", "half", "auto"]) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
exit
|
exit
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue