Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add verification IPv4 address on LLDP conf Jinja2 Template #5699

Merged
merged 9 commits into from
Nov 7, 2020
19 changes: 13 additions & 6 deletions dockers/docker-lldp/lldpd.conf.j2
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
{% set mgmt_if = {} %}
{% if MGMT_INTERFACE %}
{% for (mgmt_name, mgmt_prefix) in MGMT_INTERFACE|pfx_filter %}
{% if mgmt_prefix|ipv4 %}
{% if mgmt_if.update({'port_name' : mgmt_name}) %} {% endif %}
{% if mgmt_if.update({'ipv4' : mgmt_prefix|ip}) %} {% endif %}
{% endif %}
{% endfor %}
{% endif %}
{% if mgmt_if %}
{# If MGMT port alias is available, use it for port ID subtype, otherwise use port name #}
{% set mgmt_port_name = (MGMT_INTERFACE.keys()|list)[0][0] %}
{% set ipv4 = (MGMT_INTERFACE.keys()|list)[0][1].split('/')[0] %}
{% if MGMT_PORT and MGMT_PORT[mgmt_port_name] and MGMT_PORT[mgmt_port_name].alias %}
configure ports eth0 lldp portidsubtype local {{ MGMT_PORT[mgmt_port_name].alias }}
{% if MGMT_PORT and MGMT_PORT[mgmt_if.port_name] and MGMT_PORT[mgmt_if.port_name].alias %}
configure ports eth0 lldp portidsubtype local {{ MGMT_PORT[mgmt_if.port_name].alias }}
{% else %}
configure ports eth0 lldp portidsubtype local {{ mgmt_port_name }}
configure ports eth0 lldp portidsubtype local {{ mgmt_if.port_name }}
{% endif %}
configure system ip management pattern {{ ipv4 }}
configure system ip management pattern {{ mgmt_if.ipv4 }}
{% endif %}
configure system hostname {{ DEVICE_METADATA['localhost']['hostname'] }}
{# pause lldpd operations until all interfaces are well configured, resume command will run in lldpmgrd #}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
configure system hostname switch-t0
pause
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
configure system hostname switch-t0
pause
Loading