Skip to content

Commit

Permalink
Minor formatting fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentbernat committed May 15, 2021
1 parent d191613 commit 9307d1c
Show file tree
Hide file tree
Showing 13 changed files with 19 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def run(self, tmp=None, task_vars=None):
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]) + ".")
Expand Down
2 changes: 1 addition & 1 deletion data/os/opengear/topology.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
addresses:
main: "~{{ lookup('topology','interfaces').wan.address }}"
main: "~{{ lookup('topology', 'interfaces').wan.address }}"
2 changes: 1 addition & 1 deletion searchpaths.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
2 changes: 1 addition & 1 deletion templates/junos/edge-bgp.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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) %}
Expand Down
2 changes: 1 addition & 1 deletion templates/junos/edge-fabric.j2
Original file line number Diff line number Diff line change
@@ -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 %}
Expand Down
2 changes: 1 addition & 1 deletion templates/junos/edge-interfaces.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
Expand Down
6 changes: 3 additions & 3 deletions templates/junos/edge-sampling.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 }}{
Expand Down Expand Up @@ -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 %}
Expand Down
2 changes: 1 addition & 1 deletion templates/junos/firewall.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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 }} {
Expand Down
2 changes: 1 addition & 1 deletion templates/linux/adm-gateway/nftables-rules.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion templates/linux/conserver.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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] %}
Expand Down
2 changes: 1 addition & 1 deletion templates/none/dns.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
Expand Down
10 changes: 5 additions & 5 deletions templates/opengear/config.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}

Expand All @@ -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
Expand Down Expand Up @@ -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 [email protected]
config.services.snmp.syslocation {{ lookup("system", "datacenter") }}, {{ lookup("system", "country") }}
Expand All @@ -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
2 changes: 1 addition & 1 deletion templates/opengear/motd.j2
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{{ lookup("system","motd") }}
{{ lookup("system", "motd") }}

0 comments on commit 9307d1c

Please sign in to comment.