From f1eae1ba095319aca3e8e2ccbcd81758d7e1a638 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sun, 22 Dec 2019 20:11:35 +0100 Subject: lldp: T393: support parsing MED values --- src/conf_mode/lldp.py | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/src/conf_mode/lldp.py b/src/conf_mode/lldp.py index 1b7676274..15c0f7812 100755 --- a/src/conf_mode/lldp.py +++ b/src/conf_mode/lldp.py @@ -96,8 +96,6 @@ def get_interface_list(config): def get_location_intf(config, name): path = 'service lldp interface {0}'.format(name) config.set_level(path) - if config.exists('location'): - return 0 config.set_level('{} location'.format(path)) civic_based = {} @@ -106,19 +104,16 @@ def get_location_intf(config, name): if config.exists('civic-based'): config.set_level('{} location civic-based'.format(path)) - cc = config.return_value('country-code') - civic_based['country_code'] = cc + civic_based['country_code'] = config.return_value('country-code') civic_based['ca_type'] = [] - ca_types_names = config.list_nodes('ca-type') - if ca_types_names: - for ca_types_name in ca_types_names: - config.set_level('{0} location civic-based ca-type {1}'.format(path, ca_types_name)) - ca_val = config.return_value('ca-value') - ca_type = { - 'name': ca_types_name, - 'ca_val': ca_val - } - civic_based['ca_type'].append(ca_type) + for ca_types_name in config.list_nodes('ca-type'): + config.set_level('{} location civic-based ca-type {}'.format(path, ca_types_name)) + ca_val = config.return_value('ca-value') + ca_type = { + 'name': ca_types_name, + 'ca_val': ca_val + } + civic_based['ca_type'].append(ca_type) elif config.exists('elin'): elin = config.return_value('elin') -- cgit v1.2.3