Minor formatting fixes

This commit is contained in:
Vincent Bernat
2021-05-15 16:57:21 +02:00
parent d191613ab8
commit 9307d1c067
13 changed files with 19 additions and 19 deletions
@@ -36,7 +36,7 @@ class ActionModule(ActionBase):
d = d.split(" ")[0]
d = d.split(".")
assert d[0] == "config"
if d[1] in ["ports", "ntp","users"]:
if d[1] in ["ports", "ntp", "users"]:
whitelist.append(f"config.{d[1]}.")
elif len(d) > 3:
whitelist.append(".".join(d[:3]) + ".")
+1 -1
View File
@@ -1,2 +1,2 @@
addresses:
main: "~{{ lookup('topology','interfaces').wan.address }}"
main: "~{{ lookup('topology', 'interfaces').wan.address }}"
+1 -1
View File
@@ -5,7 +5,7 @@ def searchpaths(scope):
['host/titi', 'common']
>>> searchpaths(dict(host="titi.sk1", shorthost="titi", location="sk1"))
['host/titi.sk1', 'host/sk1/titi', 'groups/sk1', 'common']
>>> searchpaths(dict(groups=["tor","tor-bgp"], location="sk1", continent="oc"))
>>> searchpaths(dict(groups=["tor", "tor-bgp"], location="sk1", continent="oc"))
['groups/tor-bgp-sk1', 'groups/tor-sk1', 'groups/tor-bgp-oc', 'groups/tor-oc', 'groups/tor-bgp', 'groups/tor', 'groups/sk1', 'common']
"""
paths = [
+1 -1
View File
@@ -241,7 +241,7 @@ policy-options {
route-filter-list DEFAULT-V6 ::0/0 exact;
route-filter-list TOO-SPECIFIC-V4 0.0.0.0/0 prefix-length-range /25-/32;
route-filter-list TOO-SPECIFIC-V6 ::/0 prefix-length-range /49-/128;
{% set supernets = lookup("bgp","supernets") or {} %}
{% set supernets = lookup("bgp", "supernets") or {} %}
{% set man = lookup("topology", "man") %}
{% for edge in devices("environment", "groups==edge") if scope(edge).location == location
or (man and lookup("topology", "man", edge) == man) %}
+1 -1
View File
@@ -1,7 +1,7 @@
routing-instances internet {
protocols {
bgp {
{% set sspines = devices("environment","location","groups==sspine-bgp") %}
{% set sspines = devices("environment", "location", "groups==sspine-bgp") %}
{% for sspine in sspines %}
{% for port, device in lookup("topology", "ports", sspine).items() if device == shorthost %}
{% for interface, infos in lookup("topology", "interfaces").items() if infos.remote is defined and "{}.{}.blade-group.net".format(infos.remote, location) == sspine %}
+1 -1
View File
@@ -96,7 +96,7 @@ routing-instances {
}
{% endif %}
{% set sspines = devices("environment","location","groups==sspine-bgp") %}
{% set sspines = devices("environment", "location", "groups==sspine-bgp") %}
{% for sspine in sspines %}
{% for port, device in lookup("topology", "ports", sspine).items() if device == shorthost %}
{% for interface, infos in lookup("topology", "interfaces").items() if infos.remote is defined and "{}.{}.blade-group.net".format(infos.remote, location) == sspine %}
+3 -3
View File
@@ -30,7 +30,7 @@ groups {
services {
flow-monitoring {
version-ipfix {
{% for version in ("ipv4","ipv6") %}
{% for version in ("ipv4", "ipv6") %}
template {{ version }} {
flow-active-timeout 10;
flow-inactive-timeout 10;
@@ -57,7 +57,7 @@ forwarding-options {
max-packets-per-second 65535;
}
{% for version in ("ipv4","ipv6") %}
{% for version in ("ipv4", "ipv6") %}
family {{ "inet" if version == "ipv4" else "inet6" }} {
output {
flow-server {{ lookup('system', 'sampling').target }}{
@@ -128,7 +128,7 @@ protocols {
{% do ifd_list.append(ifd) %}
{% endif %}
{% endfor %}
{% set sspines = devices("environment","location","groups==sspine-bgp") %}
{% set sspines = devices("environment", "location", "groups==sspine-bgp") %}
{% for sspine in sspines %}
{% for port, device in lookup("topology", "ports", sspine).items() if device == shorthost %}
{% for interface, infos in lookup("topology", "interfaces").items() if infos.remote is defined and "{}.{}.blade-group.net".format(infos.remote, location) == sspine %}
+1 -1
View File
@@ -97,7 +97,7 @@ policy-options {
{% set filter = 'accept-bgp' %}
{% do ipv4_filter_list.append("ipv4-{}".format(filter)) %}
{% do ipv6_filter_list.append("ipv6-{}".format(filter)) %}
{% for ipv in ["ipv4","ipv6"] %}
{% for ipv in ["ipv4", "ipv6"] %}
firewall {
family {{"inet" if ipv=="ipv4" else "inet6"}} {
filter {{ ipv }}-{{ filter }} {
@@ -61,7 +61,7 @@ table ip blade {
map specific-ip-tcp-map {
type ipv4_addr . inet_service : verdict
elements = {
{% for other in devices("environment", "location", "groups==adm-gateway-l3") if device != other %}
{% for other in devices("environment", "location", "groups==adm-gateway") if device != other %}
{{ lookup("topology", "addresses", other).main }} . 647 : accept,
{% endfor %}
{{ addresses.prometheus }} . 9100 : accept,
+1 -1
View File
@@ -26,7 +26,7 @@ default {{ device }} {
host {{ device }};
}
{% for port,remote in lookup("topology","ports",device).items() %}
{% for port,remote in lookup("topology", "ports",device).items() %}
console {{ remote }} { include {{ device }} ;port {{ port }}; }
{% if "." in remote and remote not in alreadyseen %} {#- Create short host in case of dual re/fpc #}
{% set remote= remote.split(".")[1] %}
+1 -1
View File
@@ -30,7 +30,7 @@ zones:
{# Collect all DNS registered through the datastore #}
entries:
{% for device, ip, interface in store("addresses") %}
{% set name = "{}.{}".format(interface|replace(".", "-")|replace("/", "-")|replace(":","-")|lower, device) %}
{% set name = "{}.{}".format(interface|replace(".", "-")|replace("/", "-")|replace(":", "-")|lower, device) %}
{% if ip|ipaddr("public") %}
{% set name = name|replace(".blade-group.net", ".shadow.guru") %}
{% endif %}
+5 -5
View File
@@ -60,7 +60,7 @@ config.{{ interface }}.services.snmp.enabled on
config.{{ interface }}.services.ssh.enabled on
config.{{ interface }}.services.ssh_ports.enabled on
config.{{ interface }}.services.tcp_ports.enabled on
{% endif %}
{% endfor %}
@@ -71,8 +71,8 @@ config.dialin.services.modified true
config.dialout.services.modified true
## console ports
{% for port,device in lookup("topology","ports").items() %}
{% set custom_param = lookup("system","console","{}.{}.blade-group.net".format(device,location)) %}
{% for port,device in lookup("topology", "ports").items() %}
{% set custom_param = lookup("system", "console", "{}.{}.blade-group.net".format(device,location)) %}
config.ports.port{{ port }}.charsize 8
config.ports.port{{ port }}.dtrmode alwayson
@@ -100,7 +100,7 @@ config.services.lldp.enabled on
config.services.snmp.enabled on
config.services.snmp.protocol UDP
config.services.snmp.roauthprotocol SHA
config.services.snmp.rocommunity {{ lookup("system","snmp")["ro-community"] }}
config.services.snmp.rocommunity {{ lookup("system", "snmp")["ro-community"] }}
config.services.snmp.roprivprotocol DES
config.services.snmp.syscontact someone@example.com
config.services.snmp.syslocation {{ lookup("system", "datacenter") }}, {{ lookup("system", "country") }}
@@ -117,5 +117,5 @@ config.system.timezone UTC
## user
config.users.user1.description Root User
config.users.user1.username root
config.users.user1.password {{ lookup("system","users").blade["opengear-password"] }}
config.users.user1.password {{ lookup("system", "users").blade["opengear-password"] }}
config.users.total 1
+1 -1
View File
@@ -1 +1 @@
{{ lookup("system","motd") }}
{{ lookup("system", "motd") }}