From 2cac6f3ce09ddb5140e364e86476feba4a8ed285 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sun, 22 Dec 2019 19:36:00 +0100 Subject: lldp: T393: add config options to /etc/lldpd.d --- src/conf_mode/lldp.py | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/conf_mode/lldp.py b/src/conf_mode/lldp.py index 88a4a57a4..16bb329c4 100755 --- a/src/conf_mode/lldp.py +++ b/src/conf_mode/lldp.py @@ -27,7 +27,16 @@ from vyos import ConfigError config_file = "/etc/default/lldpd" lldp_tmpl = """ ### Autogenerated by lldp.py ### -DAEMON_ARGS="{% if snmp %}-x {% endif %}{% if addr %}-m {{ addr }} {% endif %}{% if cdp %}-c {% endif %}{% if edp %}-e {% endif %}{% if fdp %}-f {% endif %}{% if sonmp %}-s{% endif %}" +DAEMON_ARGS="-M4{% if snmp %} -x{% endif %}{% if addr %} -m {{ addr }}{% endif %}{% if cdp %} -c{% endif %}{% if edp %} -e{% endif %}{% if fdp %} -f{% endif %}{% if sonmp %} -s{% endif %}" + +""" + +vyos_config_file = "/etc/lldpd.d/01-vyos.conf" +vyos_tmpl = """ +### Autogenerated by lldp.py ### + +configure system platform VyOS +configure system description "VyOS {{ description }}" """ @@ -234,11 +243,23 @@ def generate(lldp): if lldp is None: return + version = 'unknown' + with open('/opt/vyatta/etc/version', 'r') as f: + tmp = f.read() + version = tmp.split()[1] + + lldp['options']['description'] = version + tmpl = jinja2.Template(lldp_tmpl) config_text = tmpl.render(lldp['options']) with open(config_file, 'w') as f: f.write(config_text) + tmpl = jinja2.Template(vyos_tmpl) + config_text = tmpl.render(lldp['options']) + with open(vyos_config_file, 'w') as f: + f.write(config_text) + def apply(lldp): if lldp: -- cgit v1.2.3