From d4831e427eff47ab086af3c0707fde6e0ff0c7ee Mon Sep 17 00:00:00 2001 From: Marek Isalski Date: Tue, 21 Jun 2022 19:21:09 +0100 Subject: [PATCH] refactor --- .../macros.j2 => junos-macros.j2} | 0 junos-v21-core-router.j2 | 3 ++- macros.j2 | 16 ---------------- 3 files changed, 2 insertions(+), 17 deletions(-) rename includes/{junos-v21-core-router/macros.j2 => junos-macros.j2} (100%) delete mode 100644 macros.j2 diff --git a/includes/junos-v21-core-router/macros.j2 b/includes/junos-macros.j2 similarity index 100% rename from includes/junos-v21-core-router/macros.j2 rename to includes/junos-macros.j2 diff --git a/junos-v21-core-router.j2 b/junos-v21-core-router.j2 index d30c911..cb440ae 100644 --- a/junos-v21-core-router.j2 +++ b/junos-v21-core-router.j2 @@ -1,5 +1,6 @@ /* generated by bgprtrmgr using junos-v21-core-router.j2 at XXX */ -{% import "macros.j2" as macros %} + +{% import "includes/junos-macros.j2" as macros %} version 21.3R1.9; diff --git a/macros.j2 b/macros.j2 deleted file mode 100644 index 3abe969..0000000 --- a/macros.j2 +++ /dev/null @@ -1,16 +0,0 @@ -{%- macro interface_description(interface, interface_context) %} - description "{% if interface.label %}{{ interface.label|replace('"','\\"') or "-" }}: {% endif %}{{ interface.description|replace('"','\\"') or "-" }}{% if interface.connected_endpoint %} ({{ interface.connected_endpoint.name|replace('"','\\"')|replace('.voneus.net','') }}{% if interface.connected_endpoint.device.name %} @ {{ interface.connected_endpoint.device.name|replace('.voneus.net','')|replace('"','\\"') }}{% endif %}){% endif %}{% if interface.cable %} via [{{ interface.cable.label.split("/")[-1] }}]{% endif %}{% if interface.link_peer %} to [{{ interface.link_peer.label or interface.link_peer.name }}{% if interface.link_peer.device %} @ {{ interface.link_peer.device.name.split("/")[-1]|replace('"','\\"')|replace('.voneus.net','') }}]{% endif %}{% endif %}" -{%- endmacro %} - -{%- macro interface_addresses(interface, interface_context) %} - family inet { - {%- for address in interface|get_addresses %}{% if address|ipv4 %} - address {{ address.address }} - {%- endif %}{%- endfor %} - } - family inet6 { - {%- for address in interface|get_addresses %}{% if address|ipv6 %} - address {{ address.address }} - {%- endif %}{%- endfor %} - } -{%- endmacro %}