From a55d8546753d6876f837735df512100d9d20c812 Mon Sep 17 00:00:00 2001 From: Xin Wang Date: Wed, 24 Sep 2025 10:34:51 +0800 Subject: [PATCH] Fix filter not found issue for ansible >= 2.14 (#20771) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit What is the motivation for this PR? Ansible 2.14+ enforces FQCN (with a few exceptions for “very core” filters like default, to_json, dictsort that are still built into Jinja2/Ansible). Directly using filters like ipaddr, ipv6 will fail with filter not found issue. How did you do it? This change fixed the issue by adding ansible.utils. to the ipaddr and ipv6 filters used in the templates. How did you verify/test it? Tested using ansible 2.13 and ansible 2.19. --- ansible/roles/eos/templates/dpu-tor.j2 | 4 ++-- ansible/roles/eos/templates/m0-mx.j2 | 4 ++-- ansible/roles/eos/templates/t0-8-lag-leaf.j2 | 4 ++-- ansible/roles/eos/templates/t0-backend-leaf.j2 | 4 ++-- ansible/roles/eos/templates/t0-leaf-lag-2.j2 | 4 ++-- ansible/roles/eos/templates/t0-leaf.j2 | 4 ++-- ansible/roles/eos/templates/t0-mclag-leaf.j2 | 4 ++-- ansible/roles/eos/templates/t1-28-lag-spine.j2 | 4 ++-- ansible/roles/eos/templates/t1-28-lag-tor.j2 | 4 ++-- ansible/roles/eos/templates/t1-56-lag-tor.j2 | 4 ++-- ansible/roles/eos/templates/t1-64-lag-tor.j2 | 4 ++-- ansible/roles/eos/templates/t1-8-lag-spine.j2 | 4 ++-- ansible/roles/eos/templates/t1-8-lag-tor.j2 | 4 ++-- ansible/roles/eos/templates/t1-backend-tor.j2 | 4 ++-- ansible/roles/eos/templates/t1-lag-spine.j2 | 4 ++-- ansible/roles/eos/templates/t1-lag-tor.j2 | 4 ++-- ansible/roles/eos/templates/t2-core.j2 | 4 ++-- ansible/roles/eos/templates/t2-leaf.j2 | 4 ++-- ansible/roles/eos/templates/t2-vs-core.j2 | 4 ++-- ansible/roles/eos/templates/t2-vs-leaf.j2 | 4 ++-- ansible/roles/sonicv2/templates/quagga/bgpd.conf.j2 | 4 ++-- ansible/roles/sonicv2/templates/quagga/zebra.conf.j2 | 2 +- .../roles/test/tasks/everflow_testbed/get_session_info.yml | 4 ++-- ansible/roles/test/templates/bgp_no_export.j2 | 4 ++-- ansible/roles/test/templates/bgp_plain.j2 | 4 ++-- ansible/roles/vm_set/tasks/start_sid.yml | 4 ++-- ansible/templates/minigraph_dpg.j2 | 4 ++-- 27 files changed, 53 insertions(+), 53 deletions(-) diff --git a/ansible/roles/eos/templates/dpu-tor.j2 b/ansible/roles/eos/templates/dpu-tor.j2 index 0b6ec97538b..87c2a39640a 100644 --- a/ansible/roles/eos/templates/dpu-tor.j2 +++ b/ansible/roles/eos/templates/dpu-tor.j2 @@ -100,13 +100,13 @@ interface {{ bp_ifname }} no shutdown ! router bgp {{ host['bgp']['asn'] }} - router-id {{ host['interfaces']['Loopback0']['ipv4'] | ipaddr('address') }} + router-id {{ host['interfaces']['Loopback0']['ipv4'] | ansible.utils.ipaddr('address') }} ! {% for asn, remote_ips in host['bgp']['peers'].items() %} {% for remote_ip in remote_ips %} neighbor {{ remote_ip }} remote-as {{ asn }} neighbor {{ remote_ip }} description {{ asn }} -{% if remote_ip | ipv6 %} +{% if remote_ip | ansible.utils.ipv6 %} address-family ipv6 neighbor {{ remote_ip }} activate exit diff --git a/ansible/roles/eos/templates/m0-mx.j2 b/ansible/roles/eos/templates/m0-mx.j2 index 641059da5d7..ef91152a62d 100644 --- a/ansible/roles/eos/templates/m0-mx.j2 +++ b/ansible/roles/eos/templates/m0-mx.j2 @@ -93,7 +93,7 @@ interface {{ bp_ifname }} no shutdown ! router bgp {{ host['bgp']['asn'] }} - router-id {{ host['interfaces']['Loopback0']['ipv4'] | ipaddr('address') }} + router-id {{ host['interfaces']['Loopback0']['ipv4'] | ansible.utils.ipaddr('address') }} ! graceful-restart restart-time {{ bgp_gr_timer }} graceful-restart @@ -102,7 +102,7 @@ router bgp {{ host['bgp']['asn'] }} {% for remote_ip in remote_ips %} neighbor {{ remote_ip }} remote-as {{ asn }} neighbor {{ remote_ip }} description {{ asn }} -{% if remote_ip | ipv6 %} +{% if remote_ip | ansible.utils.ipv6 %} address-family ipv6 neighbor {{ remote_ip }} activate exit diff --git a/ansible/roles/eos/templates/t0-8-lag-leaf.j2 b/ansible/roles/eos/templates/t0-8-lag-leaf.j2 index 3e1d0f62d61..8b745871d47 100644 --- a/ansible/roles/eos/templates/t0-8-lag-leaf.j2 +++ b/ansible/roles/eos/templates/t0-8-lag-leaf.j2 @@ -100,13 +100,13 @@ interface {{ bp_ifname }} no shutdown ! router bgp {{ host['bgp']['asn'] }} - router-id {{ host['interfaces']['Loopback0']['ipv4'] | ipaddr('address') }} + router-id {{ host['interfaces']['Loopback0']['ipv4'] | ansible.utils.ipaddr('address') }} ! {% for asn, remote_ips in host['bgp']['peers'].items() %} {% for remote_ip in remote_ips %} neighbor {{ remote_ip }} remote-as {{ asn }} neighbor {{ remote_ip }} description {{ asn }} -{% if remote_ip | ipv6 %} +{% if remote_ip | ansible.utils.ipv6 %} address-family ipv6 neighbor {{ remote_ip }} activate exit diff --git a/ansible/roles/eos/templates/t0-backend-leaf.j2 b/ansible/roles/eos/templates/t0-backend-leaf.j2 index 7f5b0e9e8dc..bc6768f13f6 100644 --- a/ansible/roles/eos/templates/t0-backend-leaf.j2 +++ b/ansible/roles/eos/templates/t0-backend-leaf.j2 @@ -127,7 +127,7 @@ interface {{ bp_ifname }} no shutdown ! router bgp {{ host['bgp']['asn'] }} - router-id {{ host['interfaces']['Loopback0']['ipv4'] | ipaddr('address') }} + router-id {{ host['interfaces']['Loopback0']['ipv4'] | ansible.utils.ipaddr('address') }} ! graceful-restart restart-time {{ bgp_gr_timer }} graceful-restart @@ -136,7 +136,7 @@ router bgp {{ host['bgp']['asn'] }} {% for remote_ip in remote_ips %} neighbor {{ remote_ip }} remote-as {{ asn }} neighbor {{ remote_ip }} description {{ asn }} -{% if remote_ip | ipv6 %} +{% if remote_ip | ansible.utils.ipv6 %} address-family ipv6 neighbor {{ remote_ip }} activate exit diff --git a/ansible/roles/eos/templates/t0-leaf-lag-2.j2 b/ansible/roles/eos/templates/t0-leaf-lag-2.j2 index 3e1d0f62d61..8b745871d47 100644 --- a/ansible/roles/eos/templates/t0-leaf-lag-2.j2 +++ b/ansible/roles/eos/templates/t0-leaf-lag-2.j2 @@ -100,13 +100,13 @@ interface {{ bp_ifname }} no shutdown ! router bgp {{ host['bgp']['asn'] }} - router-id {{ host['interfaces']['Loopback0']['ipv4'] | ipaddr('address') }} + router-id {{ host['interfaces']['Loopback0']['ipv4'] | ansible.utils.ipaddr('address') }} ! {% for asn, remote_ips in host['bgp']['peers'].items() %} {% for remote_ip in remote_ips %} neighbor {{ remote_ip }} remote-as {{ asn }} neighbor {{ remote_ip }} description {{ asn }} -{% if remote_ip | ipv6 %} +{% if remote_ip | ansible.utils.ipv6 %} address-family ipv6 neighbor {{ remote_ip }} activate exit diff --git a/ansible/roles/eos/templates/t0-leaf.j2 b/ansible/roles/eos/templates/t0-leaf.j2 index 0b6ec97538b..969bdf761fd 100644 --- a/ansible/roles/eos/templates/t0-leaf.j2 +++ b/ansible/roles/eos/templates/t0-leaf.j2 @@ -100,13 +100,13 @@ interface {{ bp_ifname }} no shutdown ! router bgp {{ host['bgp']['asn'] }} - router-id {{ host['interfaces']['Loopback0']['ipv4'] | ipaddr('address') }} + router-id {{ host['bgp']['router-id'] if host['bgp']['router-id'] is defined else host['interfaces']['Loopback0']['ipv4'] | ansible.utils.ipaddr('address') }} ! {% for asn, remote_ips in host['bgp']['peers'].items() %} {% for remote_ip in remote_ips %} neighbor {{ remote_ip }} remote-as {{ asn }} neighbor {{ remote_ip }} description {{ asn }} -{% if remote_ip | ipv6 %} +{% if remote_ip | ansible.utils.ipv6 %} address-family ipv6 neighbor {{ remote_ip }} activate exit diff --git a/ansible/roles/eos/templates/t0-mclag-leaf.j2 b/ansible/roles/eos/templates/t0-mclag-leaf.j2 index 0b6ec97538b..87c2a39640a 100644 --- a/ansible/roles/eos/templates/t0-mclag-leaf.j2 +++ b/ansible/roles/eos/templates/t0-mclag-leaf.j2 @@ -100,13 +100,13 @@ interface {{ bp_ifname }} no shutdown ! router bgp {{ host['bgp']['asn'] }} - router-id {{ host['interfaces']['Loopback0']['ipv4'] | ipaddr('address') }} + router-id {{ host['interfaces']['Loopback0']['ipv4'] | ansible.utils.ipaddr('address') }} ! {% for asn, remote_ips in host['bgp']['peers'].items() %} {% for remote_ip in remote_ips %} neighbor {{ remote_ip }} remote-as {{ asn }} neighbor {{ remote_ip }} description {{ asn }} -{% if remote_ip | ipv6 %} +{% if remote_ip | ansible.utils.ipv6 %} address-family ipv6 neighbor {{ remote_ip }} activate exit diff --git a/ansible/roles/eos/templates/t1-28-lag-spine.j2 b/ansible/roles/eos/templates/t1-28-lag-spine.j2 index 3e1d0f62d61..8b745871d47 100644 --- a/ansible/roles/eos/templates/t1-28-lag-spine.j2 +++ b/ansible/roles/eos/templates/t1-28-lag-spine.j2 @@ -100,13 +100,13 @@ interface {{ bp_ifname }} no shutdown ! router bgp {{ host['bgp']['asn'] }} - router-id {{ host['interfaces']['Loopback0']['ipv4'] | ipaddr('address') }} + router-id {{ host['interfaces']['Loopback0']['ipv4'] | ansible.utils.ipaddr('address') }} ! {% for asn, remote_ips in host['bgp']['peers'].items() %} {% for remote_ip in remote_ips %} neighbor {{ remote_ip }} remote-as {{ asn }} neighbor {{ remote_ip }} description {{ asn }} -{% if remote_ip | ipv6 %} +{% if remote_ip | ansible.utils.ipv6 %} address-family ipv6 neighbor {{ remote_ip }} activate exit diff --git a/ansible/roles/eos/templates/t1-28-lag-tor.j2 b/ansible/roles/eos/templates/t1-28-lag-tor.j2 index 5424ca361dc..c9f2a4684a8 100644 --- a/ansible/roles/eos/templates/t1-28-lag-tor.j2 +++ b/ansible/roles/eos/templates/t1-28-lag-tor.j2 @@ -101,7 +101,7 @@ interface {{ bp_ifname }} no shutdown ! router bgp {{ host['bgp']['asn'] }} - router-id {{ host['interfaces']['Loopback0']['ipv4'] | ipaddr('address') }} + router-id {{ host['interfaces']['Loopback0']['ipv4'] | ansible.utils.ipaddr('address') }} ! graceful-restart restart-time {{ bgp_gr_timer }} graceful-restart @@ -110,7 +110,7 @@ router bgp {{ host['bgp']['asn'] }} {% for remote_ip in remote_ips %} neighbor {{ remote_ip }} remote-as {{ asn }} neighbor {{ remote_ip }} description {{ asn }} -{% if remote_ip | ipv6 %} +{% if remote_ip | ansible.utils.ipv6 %} address-family ipv6 neighbor {{ remote_ip }} activate exit diff --git a/ansible/roles/eos/templates/t1-56-lag-tor.j2 b/ansible/roles/eos/templates/t1-56-lag-tor.j2 index be3dcc64397..4230d169a32 100644 --- a/ansible/roles/eos/templates/t1-56-lag-tor.j2 +++ b/ansible/roles/eos/templates/t1-56-lag-tor.j2 @@ -101,7 +101,7 @@ interface {{ bp_ifname }} no shutdown ! router bgp {{ host['bgp']['asn'] }} - router-id {{ host['interfaces']['Loopback0']['ipv4'] | ipaddr('address') }} + router-id {{ host['interfaces']['Loopback0']['ipv4'] | ansible.utils.ipaddr('address') }} ! graceful-restart restart-time {{ bgp_gr_timer }} graceful-restart @@ -110,7 +110,7 @@ router bgp {{ host['bgp']['asn'] }} {% for remote_ip in remote_ips %} neighbor {{ remote_ip }} remote-as {{ asn }} neighbor {{ remote_ip }} description {{ asn }} -{% if remote_ip | ipv6 %} +{% if remote_ip | ansible.utils.ipv6 %} address-family ipv6 neighbor {{ remote_ip }} activate exit diff --git a/ansible/roles/eos/templates/t1-64-lag-tor.j2 b/ansible/roles/eos/templates/t1-64-lag-tor.j2 index be3dcc64397..4230d169a32 100644 --- a/ansible/roles/eos/templates/t1-64-lag-tor.j2 +++ b/ansible/roles/eos/templates/t1-64-lag-tor.j2 @@ -101,7 +101,7 @@ interface {{ bp_ifname }} no shutdown ! router bgp {{ host['bgp']['asn'] }} - router-id {{ host['interfaces']['Loopback0']['ipv4'] | ipaddr('address') }} + router-id {{ host['interfaces']['Loopback0']['ipv4'] | ansible.utils.ipaddr('address') }} ! graceful-restart restart-time {{ bgp_gr_timer }} graceful-restart @@ -110,7 +110,7 @@ router bgp {{ host['bgp']['asn'] }} {% for remote_ip in remote_ips %} neighbor {{ remote_ip }} remote-as {{ asn }} neighbor {{ remote_ip }} description {{ asn }} -{% if remote_ip | ipv6 %} +{% if remote_ip | ansible.utils.ipv6 %} address-family ipv6 neighbor {{ remote_ip }} activate exit diff --git a/ansible/roles/eos/templates/t1-8-lag-spine.j2 b/ansible/roles/eos/templates/t1-8-lag-spine.j2 index b156e6d51d6..ce6aa1b4970 100644 --- a/ansible/roles/eos/templates/t1-8-lag-spine.j2 +++ b/ansible/roles/eos/templates/t1-8-lag-spine.j2 @@ -98,13 +98,13 @@ interface {{ bp_ifname }} no shutdown ! router bgp {{ host['bgp']['asn'] }} - router-id {{ host['interfaces']['Loopback0']['ipv4'] | ipaddr('address') }} + router-id {{ host['interfaces']['Loopback0']['ipv4'] | ansible.utils.ipaddr('address') }} ! {% for asn, remote_ips in host['bgp']['peers'].items() %} {% for remote_ip in remote_ips %} neighbor {{ remote_ip }} remote-as {{ asn }} neighbor {{ remote_ip }} description {{ asn }} -{% if remote_ip | ipv6 %} +{% if remote_ip | ansible.utils.ipv6 %} address-family ipv6 neighbor {{ remote_ip }} activate exit diff --git a/ansible/roles/eos/templates/t1-8-lag-tor.j2 b/ansible/roles/eos/templates/t1-8-lag-tor.j2 index 0becdfa2221..d2455f30c5a 100644 --- a/ansible/roles/eos/templates/t1-8-lag-tor.j2 +++ b/ansible/roles/eos/templates/t1-8-lag-tor.j2 @@ -99,7 +99,7 @@ interface {{ bp_ifname }} no shutdown ! router bgp {{ host['bgp']['asn'] }} - router-id {{ host['interfaces']['Loopback0']['ipv4'] | ipaddr('address') }} + router-id {{ host['interfaces']['Loopback0']['ipv4'] | ansible.utils.ipaddr('address') }} ! graceful-restart restart-time {{ bgp_gr_timer }} graceful-restart @@ -108,7 +108,7 @@ router bgp {{ host['bgp']['asn'] }} {% for remote_ip in remote_ips %} neighbor {{ remote_ip }} remote-as {{ asn }} neighbor {{ remote_ip }} description {{ asn }} -{% if remote_ip | ipv6 %} +{% if remote_ip | ansible.utils.ipv6 %} address-family ipv6 neighbor {{ remote_ip }} activate exit diff --git a/ansible/roles/eos/templates/t1-backend-tor.j2 b/ansible/roles/eos/templates/t1-backend-tor.j2 index 7f5b0e9e8dc..bc6768f13f6 100644 --- a/ansible/roles/eos/templates/t1-backend-tor.j2 +++ b/ansible/roles/eos/templates/t1-backend-tor.j2 @@ -127,7 +127,7 @@ interface {{ bp_ifname }} no shutdown ! router bgp {{ host['bgp']['asn'] }} - router-id {{ host['interfaces']['Loopback0']['ipv4'] | ipaddr('address') }} + router-id {{ host['interfaces']['Loopback0']['ipv4'] | ansible.utils.ipaddr('address') }} ! graceful-restart restart-time {{ bgp_gr_timer }} graceful-restart @@ -136,7 +136,7 @@ router bgp {{ host['bgp']['asn'] }} {% for remote_ip in remote_ips %} neighbor {{ remote_ip }} remote-as {{ asn }} neighbor {{ remote_ip }} description {{ asn }} -{% if remote_ip | ipv6 %} +{% if remote_ip | ansible.utils.ipv6 %} address-family ipv6 neighbor {{ remote_ip }} activate exit diff --git a/ansible/roles/eos/templates/t1-lag-spine.j2 b/ansible/roles/eos/templates/t1-lag-spine.j2 index 3e1d0f62d61..ed6f6a0eedc 100644 --- a/ansible/roles/eos/templates/t1-lag-spine.j2 +++ b/ansible/roles/eos/templates/t1-lag-spine.j2 @@ -100,13 +100,13 @@ interface {{ bp_ifname }} no shutdown ! router bgp {{ host['bgp']['asn'] }} - router-id {{ host['interfaces']['Loopback0']['ipv4'] | ipaddr('address') }} + router-id {{ host['bgp']['router-id'] if host['bgp']['router-id'] is defined else host['interfaces']['Loopback0']['ipv4'] | ansible.utils.ipaddr('address') }} ! {% for asn, remote_ips in host['bgp']['peers'].items() %} {% for remote_ip in remote_ips %} neighbor {{ remote_ip }} remote-as {{ asn }} neighbor {{ remote_ip }} description {{ asn }} -{% if remote_ip | ipv6 %} +{% if remote_ip | ansible.utils.ipv6 %} address-family ipv6 neighbor {{ remote_ip }} activate exit diff --git a/ansible/roles/eos/templates/t1-lag-tor.j2 b/ansible/roles/eos/templates/t1-lag-tor.j2 index 641059da5d7..e8671ab9e42 100644 --- a/ansible/roles/eos/templates/t1-lag-tor.j2 +++ b/ansible/roles/eos/templates/t1-lag-tor.j2 @@ -93,7 +93,7 @@ interface {{ bp_ifname }} no shutdown ! router bgp {{ host['bgp']['asn'] }} - router-id {{ host['interfaces']['Loopback0']['ipv4'] | ipaddr('address') }} + router-id {{ host['bgp']['router-id'] if host['bgp']['router-id'] is defined else host['interfaces']['Loopback0']['ipv4'] | ansible.utils.ipaddr('address') }} ! graceful-restart restart-time {{ bgp_gr_timer }} graceful-restart @@ -102,7 +102,7 @@ router bgp {{ host['bgp']['asn'] }} {% for remote_ip in remote_ips %} neighbor {{ remote_ip }} remote-as {{ asn }} neighbor {{ remote_ip }} description {{ asn }} -{% if remote_ip | ipv6 %} +{% if remote_ip | ansible.utils.ipv6 %} address-family ipv6 neighbor {{ remote_ip }} activate exit diff --git a/ansible/roles/eos/templates/t2-core.j2 b/ansible/roles/eos/templates/t2-core.j2 index 50f44386872..8327d5a6743 100644 --- a/ansible/roles/eos/templates/t2-core.j2 +++ b/ansible/roles/eos/templates/t2-core.j2 @@ -106,14 +106,14 @@ interface {{ bp_ifname }} no shutdown ! router bgp {{ host['bgp']['asn'] }} - router-id {{ host['interfaces']['Loopback0']['ipv4'] | ipaddr('address') }} + router-id {{ host['interfaces']['Loopback0']['ipv4'] | ansible.utils.ipaddr('address') }} ! {% for asn, remote_ips in host['bgp']['peers'].items() %} {% for remote_ip in remote_ips %} neighbor {{ remote_ip }} remote-as {{ asn }} neighbor {{ remote_ip }} maximum-routes 0 neighbor {{ remote_ip }} description {{ asn }} -{% if remote_ip | ipv6 %} +{% if remote_ip | ansible.utils.ipv6 %} address-family ipv6 neighbor {{ remote_ip }} activate exit diff --git a/ansible/roles/eos/templates/t2-leaf.j2 b/ansible/roles/eos/templates/t2-leaf.j2 index 37da63bb634..7e9ab9d81ce 100644 --- a/ansible/roles/eos/templates/t2-leaf.j2 +++ b/ansible/roles/eos/templates/t2-leaf.j2 @@ -106,7 +106,7 @@ interface {{ bp_ifname }} no shutdown ! router bgp {{ host['bgp']['asn'] }} - router-id {{ host['interfaces']['Loopback0']['ipv4'] | ipaddr('address') }} + router-id {{ host['interfaces']['Loopback0']['ipv4'] | ansible.utils.ipaddr('address') }} ! {% for asn, remote_ips in host['bgp']['peers'].items() %} {% for remote_ip in remote_ips %} @@ -114,7 +114,7 @@ router bgp {{ host['bgp']['asn'] }} neighbor {{ remote_ip }} maximum-routes 0 neighbor {{ remote_ip }} description {{ asn }} neighbor {{ remote_ip }} allowas-in -{% if remote_ip | ipv6 %} +{% if remote_ip | ansible.utils.ipv6 %} address-family ipv6 neighbor {{ remote_ip }} activate exit diff --git a/ansible/roles/eos/templates/t2-vs-core.j2 b/ansible/roles/eos/templates/t2-vs-core.j2 index 76b6ee32fba..56b611810f5 100644 --- a/ansible/roles/eos/templates/t2-vs-core.j2 +++ b/ansible/roles/eos/templates/t2-vs-core.j2 @@ -106,14 +106,14 @@ interface {{ bp_ifname }} no shutdown ! router bgp {{ host['bgp']['asn'] }} - router-id {{ host['interfaces']['Loopback0']['ipv4'] | ipaddr('address') }} + router-id {{ host['interfaces']['Loopback0']['ipv4'] | ansible.utils.ipaddr('address') }} ! {% for asn, remote_ips in host['bgp']['peers'].items() %} {% for remote_ip in remote_ips %} neighbor {{ remote_ip }} remote-as {{ asn }} neighbor {{ remote_ip }} maximum-routes 0 neighbor {{ remote_ip }} description {{ asn }} -{% if remote_ip | ipv6 %} +{% if remote_ip | ansible.utils.ipv6 %} address-family ipv6 neighbor {{ remote_ip }} activate exit diff --git a/ansible/roles/eos/templates/t2-vs-leaf.j2 b/ansible/roles/eos/templates/t2-vs-leaf.j2 index 76b6ee32fba..56b611810f5 100644 --- a/ansible/roles/eos/templates/t2-vs-leaf.j2 +++ b/ansible/roles/eos/templates/t2-vs-leaf.j2 @@ -106,14 +106,14 @@ interface {{ bp_ifname }} no shutdown ! router bgp {{ host['bgp']['asn'] }} - router-id {{ host['interfaces']['Loopback0']['ipv4'] | ipaddr('address') }} + router-id {{ host['interfaces']['Loopback0']['ipv4'] | ansible.utils.ipaddr('address') }} ! {% for asn, remote_ips in host['bgp']['peers'].items() %} {% for remote_ip in remote_ips %} neighbor {{ remote_ip }} remote-as {{ asn }} neighbor {{ remote_ip }} maximum-routes 0 neighbor {{ remote_ip }} description {{ asn }} -{% if remote_ip | ipv6 %} +{% if remote_ip | ansible.utils.ipv6 %} address-family ipv6 neighbor {{ remote_ip }} activate exit diff --git a/ansible/roles/sonicv2/templates/quagga/bgpd.conf.j2 b/ansible/roles/sonicv2/templates/quagga/bgpd.conf.j2 index 9773dbad984..21ee4892e65 100644 --- a/ansible/roles/sonicv2/templates/quagga/bgpd.conf.j2 +++ b/ansible/roles/sonicv2/templates/quagga/bgpd.conf.j2 @@ -27,7 +27,7 @@ router bgp {{ minigraph_bgp_asn }} {% for lo in minigraph_lo_interfaces %} {% if lo['addr'] | ipv4 %} network {{ lo['addr'] }}/32 -{% elif lo['addr'] | ipv6 %} +{% elif lo['addr'] | ansible.utils.ipv6 %} address-family ipv6 network {{ lo['addr'] }}/128 exit-address-family @@ -44,7 +44,7 @@ router bgp {{ minigraph_bgp_asn }} {% if bgp_session['asn'] != 0 %} neighbor {{ bgp_session['addr'] }} remote-as {{ bgp_session['asn'] }} neighbor {{ bgp_session['addr'] }} description {{ bgp_session['name'] }} -{% if bgp_session['addr'] | ipv6 %} +{% if bgp_session['addr'] | ansible.utils.ipv6 %} address-family ipv6 neighbor {{ bgp_session['addr'] }} activate maximum-paths 64 diff --git a/ansible/roles/sonicv2/templates/quagga/zebra.conf.j2 b/ansible/roles/sonicv2/templates/quagga/zebra.conf.j2 index 880e1537c00..81f6d28c397 100644 --- a/ansible/roles/sonicv2/templates/quagga/zebra.conf.j2 +++ b/ansible/roles/sonicv2/templates/quagga/zebra.conf.j2 @@ -34,7 +34,7 @@ route-map RM_SET_SRC permit 10 {% set lo_ipv6_addrs = [] %} {% if minigraph_lo_interfaces is defined %} {% for interface in minigraph_lo_interfaces %} -{% if interface['addr'] is defined and interface['addr']|ipv6 %} +{% if interface['addr'] is defined and interface['addr']| ansible.utils.ipv6 %} {% if lo_ipv6_addrs.append(interface['addr']) %} {% endif %} {% endif %} diff --git a/ansible/roles/test/tasks/everflow_testbed/get_session_info.yml b/ansible/roles/test/tasks/everflow_testbed/get_session_info.yml index 692909f2db0..dd90c67718f 100644 --- a/ansible/roles/test/tasks/everflow_testbed/get_session_info.yml +++ b/ansible/roles/test/tasks/everflow_testbed/get_session_info.yml @@ -26,5 +26,5 @@ - name: Initialize session prefixes. set_fact: - session_prefix_1: "{{ addr_1|ipaddr('network') }}/{{ addr_1|ipaddr('prefix') }}" - session_prefix_2: "{{ addr_2|ipaddr('network') }}/{{ addr_2|ipaddr('prefix') }}" + session_prefix_1: "{{ addr_1|ansible.utils.ipaddr('network') }}/{{ addr_1|ansible.utils.ipaddr('prefix') }}" + session_prefix_2: "{{ addr_2|ansible.utils.ipaddr('network') }}/{{ addr_2|ansible.utils.ipaddr('prefix') }}" diff --git a/ansible/roles/test/templates/bgp_no_export.j2 b/ansible/roles/test/templates/bgp_no_export.j2 index d9c00ba6f8f..138bf7b725e 100644 --- a/ansible/roles/test/templates/bgp_no_export.j2 +++ b/ansible/roles/test/templates/bgp_no_export.j2 @@ -57,7 +57,7 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} {% for (name, prefix) in VLAN_INTERFACE %} {% if prefix | ipv4 %} network {{ prefix }} -{% elif prefix | ipv6 %} +{% elif prefix | ansible.utils.ipv6 %} address-family ipv6 network {{ prefix }} exit-address-family @@ -88,7 +88,7 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} exit-address-family {% endif %} {% endif %} -{% if neighbor_addr | ipv6 %} +{% if neighbor_addr | ansible.utils.ipv6 %} address-family ipv6 neighbor {{ neighbor_addr }} activate maximum-paths 64 diff --git a/ansible/roles/test/templates/bgp_plain.j2 b/ansible/roles/test/templates/bgp_plain.j2 index 2a58b657272..784900d7f9e 100644 --- a/ansible/roles/test/templates/bgp_plain.j2 +++ b/ansible/roles/test/templates/bgp_plain.j2 @@ -52,7 +52,7 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} {% for (name, prefix) in VLAN_INTERFACE %} {% if prefix | ipv4 %} network {{ prefix }} -{% elif prefix | ipv6 %} +{% elif prefix | ansible.utils.ipv6 %} address-family ipv6 network {{ prefix }} exit-address-family @@ -76,7 +76,7 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} maximum-paths 64 exit-address-family {% endif %} -{% if neighbor_addr | ipv6 %} +{% if neighbor_addr | ansible.utils.ipv6 %} address-family ipv6 {% if DEVICE_METADATA['localhost']['type'] == 'ToRRouter' %} neighbor {{ neighbor_addr }} allowas-in 1 diff --git a/ansible/roles/vm_set/tasks/start_sid.yml b/ansible/roles/vm_set/tasks/start_sid.yml index 6148676c5db..4765518b09e 100644 --- a/ansible/roles/vm_set/tasks/start_sid.yml +++ b/ansible/roles/vm_set/tasks/start_sid.yml @@ -36,8 +36,8 @@ "MAC": "{{ '52:54:00' | random_mac }}", "CHIPTYPE": "{{ chip }}", "HOSTNAME": "{{ dut_name }}-0", - "IP": "{{ mgmt_ip_address | ipaddr('address') }}", - "MASK": "{{ mgmt_ip_address | ipaddr('netmask') }}", + "IP": "{{ mgmt_ip_address | ansible.utils.ipaddr('address') }}", + "MASK": "{{ mgmt_ip_address | ansible.utils.ipaddr('netmask') }}", "GATEWAY": "{{ vm_mgmt_gw }}", "SRVC_PORT": "12000" } diff --git a/ansible/templates/minigraph_dpg.j2 b/ansible/templates/minigraph_dpg.j2 index 0acb81833ff..c5e9c220a6c 100644 --- a/ansible/templates/minigraph_dpg.j2 +++ b/ansible/templates/minigraph_dpg.j2 @@ -169,9 +169,9 @@ {% endif %} {{ vlan_param['id'] }} {{ vlan_param['tag'] }} - {{ vlan_param['prefix'] | ipaddr('network') }}/{{ vlan_param['prefix'] | ipaddr('prefix') }} + {{ vlan_param['prefix'] | ansible.utils.ipaddr('network') }}/{{ vlan_param['prefix'] | ansible.utils.ipaddr('prefix') }} {% if 'secondary_subnet' in vlan_param %} - {{ vlan_param['secondary_subnet'] | ipaddr('network') }}/{{ vlan_param['secondary_subnet'] | ipaddr('prefix') }} + {{ vlan_param['secondary_subnet'] | ansible.utils.ipaddr('network') }}/{{ vlan_param['secondary_subnet'] | ansible.utils.ipaddr('prefix') }} {% endif %} {% if 'mac' in vlan_param %} {{ vlan_param['mac'] }}