summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2019-12-22 22:12:42 +0100
committerChristian Poessinger <christian@poessinger.com>2019-12-22 22:12:42 +0100
commit7158bc3cc82e1a66473ef6c65e95e00f64d42b92 (patch)
tree316b86017e368e3b7bb975e016a59463eaf1dab4
parent246c72b2ae948d1721320abb16a10aa6e0c8eadc (diff)
downloadvyos-1x-7158bc3cc82e1a66473ef6c65e95e00f64d42b92.tar.gz
vyos-1x-7158bc3cc82e1a66473ef6c65e95e00f64d42b92.zip
lldp: T393: support both ELIN and ccordinate based location service in MED
-rwxr-xr-xsrc/conf_mode/lldp.py19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/conf_mode/lldp.py b/src/conf_mode/lldp.py
index 8c57eacd3..da01de56f 100755
--- a/src/conf_mode/lldp.py
+++ b/src/conf_mode/lldp.py
@@ -47,6 +47,11 @@ configure system ip management pattern "{{ options.addr }}"
{%- if loc.elin %}
configure ports {{ loc.name }} med location elin "{{ loc.elin }}"
{%- endif %}
+{%- if loc.coordinate_based %}
+configure ports {{ loc.name }} med location coordinate {% if loc.coordinate_based.latitude %}latitude {{ loc.coordinate_based.latitude }}{% endif %} {% if loc.coordinate_based.longitude %}longitude {{ loc.coordinate_based.longitude }}{% endif %} {% if loc.coordinate_based.altitude %}altitude {{ loc.coordinate_based.altitude }} m{% endif %} {% if loc.coordinate_based.datum %}datum {{ loc.coordinate_based.datum }}{% endif %}
+{%- endif %}
+
+
{% endfor %}
"""
@@ -122,16 +127,22 @@ def get_location_intf(config, name):
}
civic_based['ca_type'].append(ca_type)
- elif config.exists('elin'):
+ if config.exists('elin'):
elin = config.return_value('elin')
- elif config.exists('coordinate-based'):
+ if config.exists('coordinate-based'):
config.set_level('{} location coordinate-based'.format(path))
- coordinate_based['altitude'] = config.return_value('altitude')
coordinate_based['latitude'] = config.return_value('latitude')
coordinate_based['longitude'] = config.return_value('longitude')
- coordinate_based['datum'] = config.return_value('datum')
+
+ coordinate_based['altitude'] = '0'
+ if config.exists('altitude'):
+ coordinate_based['altitude'] = config.return_value('altitude')
+
+ coordinate_based['datum'] = 'WGS84'
+ if config.exists('datum'):
+ coordinate_based['datum'] = config.return_value('datum')
intf = {
'name': name,