summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsrc/conf_mode/lldp.py23
1 files changed, 22 insertions, 1 deletions
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: