diff options
author | Christian Poessinger <christian@poessinger.com> | 2022-08-25 19:01:21 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2022-08-27 08:03:45 +0200 |
commit | 8a3bc80ca7a3209b045f3e3defc47efe4dc8d1e0 (patch) | |
tree | 532de60c71a6e5f1aa07bf805dbc58ee0bac899d /src/etc/telegraf/custom_scripts | |
parent | 4eb4a823ffca7c9ccc5aa437209447efa626b168 (diff) | |
download | vyos-1x-8a3bc80ca7a3209b045f3e3defc47efe4dc8d1e0.tar.gz vyos-1x-8a3bc80ca7a3209b045f3e3defc47efe4dc8d1e0.zip |
telegraf: T3872: replace local get_interfaces() function with Section.interface()
Commit cfde4b49 ("ifconfig: T2223: add vlan switch for Section.interfaces()")
added the functionality of the local get_interfaces() function to the base
class so all other parts in the system can query for interface names of a given
type including or excluding their vlan sub-interfaces.
Diffstat (limited to 'src/etc/telegraf/custom_scripts')
-rwxr-xr-x | src/etc/telegraf/custom_scripts/show_interfaces_input_filter.py | 16 |
1 files changed, 1 insertions, 15 deletions
diff --git a/src/etc/telegraf/custom_scripts/show_interfaces_input_filter.py b/src/etc/telegraf/custom_scripts/show_interfaces_input_filter.py index 0c7474156..6f14d6a8e 100755 --- a/src/etc/telegraf/custom_scripts/show_interfaces_input_filter.py +++ b/src/etc/telegraf/custom_scripts/show_interfaces_input_filter.py @@ -5,20 +5,6 @@ from vyos.ifconfig import Interface import time -def get_interfaces(type='', vlan=True): - """ - Get interfaces: - ['dum0', 'eth0', 'eth1', 'eth1.5', 'lo', 'tun0'] - """ - interfaces = [] - ifaces = Section.interfaces(type) - for iface in ifaces: - if vlan == False and '.' in iface: - continue - interfaces.append(iface) - - return interfaces - def get_interface_addresses(iface, link_local_v6=False): """ Get IP and IPv6 addresses from interface in one string @@ -77,7 +63,7 @@ def get_interface_oper_state(iface): return oper_state -interfaces = get_interfaces() +interfaces = Section.interfaces('') for iface in interfaces: print(f'show_interfaces,interface={iface} ' |