diff options
author | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2020-11-18 14:28:32 -0600 |
---|---|---|
committer | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2020-11-18 14:28:32 -0600 |
commit | d1ef363d806a2d67ab0ed0c99ee20e8028c11f75 (patch) | |
tree | 7f7ba0560e75e7b1103cea38c5b053bb468997d6 /ncserver/module/interfaces.py | |
parent | 557adae9056c81247e713ad4fb133c24db6e8b7f (diff) | |
download | netconfapk-d1ef363d806a2d67ab0ed0c99ee20e8028c11f75.tar.gz netconfapk-d1ef363d806a2d67ab0ed0c99ee20e8028c11f75.tar.bz2 netconfapk-d1ef363d806a2d67ab0ed0c99ee20e8028c11f75.tar.xz netconfapk-d1ef363d806a2d67ab0ed0c99ee20e8028c11f75.zip |
ncserver: Style improvements
Diffstat (limited to 'ncserver/module/interfaces.py')
-rw-r--r-- | ncserver/module/interfaces.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/ncserver/module/interfaces.py b/ncserver/module/interfaces.py index 959436c..b8f9ad1 100644 --- a/ncserver/module/interfaces.py +++ b/ncserver/module/interfaces.py @@ -93,11 +93,12 @@ def _add_running_contents(ifaces): type_file.close() type_num = type_num.strip() if type_num in types.keys(): + iana_xmlns = "urn:ietf:params:xml:ns:yang:iana-if-type" iface.append(util.leaf_elm('if:type', 'ianaift:'+types[type_num], - nsmap={'ianaift': "urn:ietf:params:xml:ns:yang:iana-if-type"})) + nsmap={'ianaift': iana_xmlns})) else: LOGGER.warning(_('unknown Linux hwtype for %s: %s'), - ifname.name, type_num) + ifname.name, type_num) def running(node): @@ -119,14 +120,15 @@ def _add_stats_to(iface, name: str): stats = util.subelm(iface, 'if:statistics') # XXX BAD vvv - stats.append(util.leaf_elm('if:discontinuity-time', '2020-01-01T01:01:01.011Z')) + stats.append(util.leaf_elm('if:discontinuity-time', + '2020-01-01T01:01:01.011Z')) # XXX BAD ^^^ result = subprocess.run(['/sbin/ifupdown', 'ifctrstat', name], stdout=subprocess.PIPE, check=False) if result.returncode != 0: LOGGER.error(_('ifctrstat failed for %s: %s'), - name, result.returncode) + name, result.returncode) return counters = result.stdout.decode('utf-8').split('\n') @@ -134,7 +136,7 @@ def _add_stats_to(iface, name: str): for counter, value in [data.split(': ') for data in counters]: if counter not in counter_tags.keys(): LOGGER.warning(_('unhandled ifctrstat counter for %s: %s'), - name, counter) + name, counter) continue stats.append(util.leaf_elm(counter_tags[counter], value)) |