From 21626c4600a187b4119984d67fd3bcfc00a69744 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Tue, 17 Aug 2021 12:11:54 +0200 Subject: op-mode: T1513: bgp: xml: provide exact-match building block (cherry picked from commit 0f498d782c8fc3645355184cc59e88a16d1b230d) --- op-mode-definitions/include/bgp/afi-common.xml.i | 7 +------ op-mode-definitions/include/bgp/afi-ipv4-ipv6-common.xml.i | 14 ++------------ op-mode-definitions/include/bgp/exact-match.xml.i | 8 ++++++++ 3 files changed, 11 insertions(+), 18 deletions(-) create mode 100644 op-mode-definitions/include/bgp/exact-match.xml.i (limited to 'op-mode-definitions') diff --git a/op-mode-definitions/include/bgp/afi-common.xml.i b/op-mode-definitions/include/bgp/afi-common.xml.i index 7fc59f3b0..0edeb9f81 100644 --- a/op-mode-definitions/include/bgp/afi-common.xml.i +++ b/op-mode-definitions/include/bgp/afi-common.xml.i @@ -7,12 +7,7 @@ - - - Exact match of the communities - - ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ - + #include ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ diff --git a/op-mode-definitions/include/bgp/afi-ipv4-ipv6-common.xml.i b/op-mode-definitions/include/bgp/afi-ipv4-ipv6-common.xml.i index f1b699347..a51595b7f 100644 --- a/op-mode-definitions/include/bgp/afi-ipv4-ipv6-common.xml.i +++ b/op-mode-definitions/include/bgp/afi-ipv4-ipv6-common.xml.i @@ -22,12 +22,7 @@ ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ - - - Exact match of the communities - - ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ - + #include Graceful shutdown (well-known community) @@ -105,12 +100,7 @@ - - - Show BGP routes exactly matching specified community list - - ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ - + #include ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ diff --git a/op-mode-definitions/include/bgp/exact-match.xml.i b/op-mode-definitions/include/bgp/exact-match.xml.i new file mode 100644 index 000000000..49026db9b --- /dev/null +++ b/op-mode-definitions/include/bgp/exact-match.xml.i @@ -0,0 +1,8 @@ + + + + Exact match of the communities + + ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ + + -- cgit v1.2.3 From 77a00e3653a6e2a6653f8ba42fb7953b47ff0a03 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Tue, 17 Aug 2021 12:13:04 +0200 Subject: op-mode: T1513: bgp: add "show bgp large-community AA:BB:CC exat-match" (cherry picked from commit 6c0044d12ecf762d9d362d6b09cdaa4c8227db58) --- op-mode-definitions/include/bgp/afi-common.xml.i | 3 +++ 1 file changed, 3 insertions(+) (limited to 'op-mode-definitions') diff --git a/op-mode-definitions/include/bgp/afi-common.xml.i b/op-mode-definitions/include/bgp/afi-common.xml.i index 0edeb9f81..ef6709ae8 100644 --- a/op-mode-definitions/include/bgp/afi-common.xml.i +++ b/op-mode-definitions/include/bgp/afi-common.xml.i @@ -19,6 +19,9 @@ ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ + + #include + -- cgit v1.2.3 From 4da7d0a721aeb15af115a05bc0934d73957f56ef Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Tue, 17 Aug 2021 13:31:39 +0200 Subject: op-mode: xml: bgp: fix large-community help string (cherry picked from commit 6bb2f6e22706bb1c5874a58e74585160164011f6) --- op-mode-definitions/include/bgp/afi-common.xml.i | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'op-mode-definitions') diff --git a/op-mode-definitions/include/bgp/afi-common.xml.i b/op-mode-definitions/include/bgp/afi-common.xml.i index ef6709ae8..e28dfe5d7 100644 --- a/op-mode-definitions/include/bgp/afi-common.xml.i +++ b/op-mode-definitions/include/bgp/afi-common.xml.i @@ -13,7 +13,7 @@ - List of large-community numbers + Display routes matching the large-communities AA:BB:CC -- cgit v1.2.3 From 6fa44eaf1f4525ee7dc95df6ba6d3d4474b26d71 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Tue, 17 Aug 2021 13:32:21 +0200 Subject: op-mode: T1513: bgp: add "show bgp large-community-list" commnad (cherry picked from commit 90f778fc04b322867f6fec023328330adc3fd85f) --- op-mode-definitions/include/bgp/afi-common.xml.i | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'op-mode-definitions') diff --git a/op-mode-definitions/include/bgp/afi-common.xml.i b/op-mode-definitions/include/bgp/afi-common.xml.i index e28dfe5d7..4d5f56656 100644 --- a/op-mode-definitions/include/bgp/afi-common.xml.i +++ b/op-mode-definitions/include/bgp/afi-common.xml.i @@ -23,6 +23,18 @@ #include + + + Display routes matching the large-community-list + + policy large-community-list + + + ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ + + #include + + RIB advertisement statistics -- cgit v1.2.3 From 28f22431441f37985dfd7ec699bfc61aafd82732 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sun, 22 Aug 2021 20:41:11 +0200 Subject: xml: op-mode: remove multiple "Reset a service" help definitions That nasty workaround to always specify the same value for the node.def file as the help text is no longer necessary after commit 17b5ac14 ("T3165: op-mode: prevent override of populated node.def file with empty content". The redundant definitions are no longer necessary. (cherry picked from commit 536991d0c6f305256ce6ab5975d15116f027b7b6) --- op-mode-definitions/dns-forwarding.xml.in | 3 --- op-mode-definitions/ipv4-route.xml.in | 6 ------ op-mode-definitions/ipv6-route.xml.in | 6 ------ op-mode-definitions/openvpn.xml.in | 3 --- op-mode-definitions/pppoe-server.xml.in | 3 --- op-mode-definitions/reset-conntrack.xml.in | 3 --- op-mode-definitions/reset-vpn.xml.in | 3 --- op-mode-definitions/terminal.xml.in | 8 -------- 8 files changed, 35 deletions(-) (limited to 'op-mode-definitions') diff --git a/op-mode-definitions/dns-forwarding.xml.in b/op-mode-definitions/dns-forwarding.xml.in index 36fe6b5ef..6574f2319 100644 --- a/op-mode-definitions/dns-forwarding.xml.in +++ b/op-mode-definitions/dns-forwarding.xml.in @@ -59,9 +59,6 @@ - - Reset a service - diff --git a/op-mode-definitions/ipv4-route.xml.in b/op-mode-definitions/ipv4-route.xml.in index aab3df0f1..8f001d5bb 100644 --- a/op-mode-definitions/ipv4-route.xml.in +++ b/op-mode-definitions/ipv4-route.xml.in @@ -20,11 +20,7 @@ - - - Reset a service - @@ -56,7 +52,6 @@ - Reset IP route @@ -68,7 +63,6 @@ sudo ip route flush cache - Flush the kernel route cache for a given route diff --git a/op-mode-definitions/ipv6-route.xml.in b/op-mode-definitions/ipv6-route.xml.in index 28f5b1aad..1c238e1f3 100644 --- a/op-mode-definitions/ipv6-route.xml.in +++ b/op-mode-definitions/ipv6-route.xml.in @@ -28,11 +28,7 @@ - - - Reset a service - @@ -64,7 +60,6 @@ - Reset IPv6 route @@ -76,7 +71,6 @@ sudo ip -f inet6 route flush cache - Flush the kernel IPv6 route cache for a given route diff --git a/op-mode-definitions/openvpn.xml.in b/op-mode-definitions/openvpn.xml.in index f8dc0cff0..bc02d05b3 100644 --- a/op-mode-definitions/openvpn.xml.in +++ b/op-mode-definitions/openvpn.xml.in @@ -45,9 +45,6 @@ - - Reset a service - diff --git a/op-mode-definitions/pppoe-server.xml.in b/op-mode-definitions/pppoe-server.xml.in index 6d89b3e77..3d0df44a3 100644 --- a/op-mode-definitions/pppoe-server.xml.in +++ b/op-mode-definitions/pppoe-server.xml.in @@ -40,9 +40,6 @@ - - Reset a service - diff --git a/op-mode-definitions/reset-conntrack.xml.in b/op-mode-definitions/reset-conntrack.xml.in index 827ba4af4..9c8265f77 100644 --- a/op-mode-definitions/reset-conntrack.xml.in +++ b/op-mode-definitions/reset-conntrack.xml.in @@ -1,9 +1,6 @@ - - Reset a service - diff --git a/op-mode-definitions/reset-vpn.xml.in b/op-mode-definitions/reset-vpn.xml.in index 71dbb4ed9..94ee1c7df 100644 --- a/op-mode-definitions/reset-vpn.xml.in +++ b/op-mode-definitions/reset-vpn.xml.in @@ -1,9 +1,6 @@ - - Reset a service - diff --git a/op-mode-definitions/terminal.xml.in b/op-mode-definitions/terminal.xml.in index 9c4e629cb..2a76de146 100644 --- a/op-mode-definitions/terminal.xml.in +++ b/op-mode-definitions/terminal.xml.in @@ -40,7 +40,6 @@ builtin $3 - Control console behaviors @@ -54,13 +53,11 @@ - Control terminal behaviors - Set key behaviors @@ -77,7 +74,6 @@ - Set terminal pager to default (less) @@ -93,7 +89,6 @@ VYATTA_PAGER=$4 - Set terminal to given number of rows (0 disables paging) @@ -103,7 +98,6 @@ if [ "$4" -eq 0 ]; then VYATTA_PAGER=cat; else VYATTA_PAGER=${_vyatta_default_pager}; stty rows $4; fi - Set terminal to given number of columns @@ -117,6 +111,4 @@ - - -- cgit v1.2.3 From e81c690802a8ff6a54db8c2ae88548f7a82f7bbd Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sun, 22 Aug 2021 20:42:21 +0200 Subject: xml: op-mode: add missing help test for "monitor protocol ospf" commands (cherry picked from commit d225f938b2250229621c7013c47ce52b839ae169) --- op-mode-definitions/monitor-protocol.xml.in | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'op-mode-definitions') diff --git a/op-mode-definitions/monitor-protocol.xml.in b/op-mode-definitions/monitor-protocol.xml.in index 6a6bd50f3..f3af3575c 100644 --- a/op-mode-definitions/monitor-protocol.xml.in +++ b/op-mode-definitions/monitor-protocol.xml.in @@ -263,13 +263,14 @@ - Monitor the Open Shortest Path First (OSPF) protocol + Monitor Open Shortest Path First (OSPF) protocol #include - - + + Disable Open Shortest Path First (OSPF) debugging + @@ -458,6 +459,9 @@ + + Enable Open Shortest Path First (OSPF) debugging + -- cgit v1.2.3 From 7c172523d632bc2b0683aa9000fb25b682453e74 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sun, 22 Aug 2021 20:42:56 +0200 Subject: xml: op-mode: add missing help test for "reset openvpn" command (cherry picked from commit 68567d60626aa7ee5f990af792eb63f6887d93de) --- op-mode-definitions/openvpn.xml.in | 3 +++ 1 file changed, 3 insertions(+) (limited to 'op-mode-definitions') diff --git a/op-mode-definitions/openvpn.xml.in b/op-mode-definitions/openvpn.xml.in index bc02d05b3..0a8cf64d7 100644 --- a/op-mode-definitions/openvpn.xml.in +++ b/op-mode-definitions/openvpn.xml.in @@ -47,6 +47,9 @@ + + Reset OpenVPN client/server connections + -- cgit v1.2.3 From 8ad8b0d51bf21c583e6d687576cb1a61195e7215 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Wed, 25 Aug 2021 14:44:21 +0200 Subject: op-mode: T3776: drop "frr" level from "restart frr ospfd|bgpd|staticd" commands The current command to restart any of the FRR processes is: vyos@vyos:~$ restart frr Possible completions: Execute the current command bfdd Restart Bidirectional Forwarding Detection daemon bgpd Restart Border Gateway Protocol daemon ospf6d Restart OSPFv3 daemon ospfd Restart OSPFv2 daemon ripd Restart Routing Information Protocol daemon ripngd Restart RIPng daemon staticd Restart Static Route daemon zebra Restart IP routing manager daemon From a real-life example: Two engineers needed 5 minutes to figure it is under "restart frr" - that is why this commit drops the artificial "frr" level on the op-mode commands to restart routing protocol daemons. It's less intuitive to have "restart frr ospfd" or "restart frr bgpd" compared to "restart ospf" and "restart bgp" - we have the same for "restart ssh" or "restart snmp" and not "restart openssh sshd". This commit also drops the d (daemon) suffix of the op-mode comamands so the commands align with the VyOS CLI, else there would be a miss-understanding from ospf6d to ospfv3. --- op-mode-definitions/restart-frr.xml.in | 104 ++++++++++++++++----------------- 1 file changed, 51 insertions(+), 53 deletions(-) (limited to 'op-mode-definitions') diff --git a/op-mode-definitions/restart-frr.xml.in b/op-mode-definitions/restart-frr.xml.in index 96ad1a650..a5ba5b11f 100644 --- a/op-mode-definitions/restart-frr.xml.in +++ b/op-mode-definitions/restart-frr.xml.in @@ -2,62 +2,60 @@ - + - Restart FRRouting daemons + Restart all routing daemons sudo ${vyos_op_scripts_dir}/restart_frr.py --action restart - - - - Restart Bidirectional Forwarding Detection daemon - - sudo ${vyos_op_scripts_dir}/restart_frr.py --action restart --daemon bfdd - - - - Restart Border Gateway Protocol daemon - - sudo ${vyos_op_scripts_dir}/restart_frr.py --action restart --daemon bgpd - - - - Restart OSPFv2 daemon - - sudo ${vyos_op_scripts_dir}/restart_frr.py --action restart --daemon ospfd - - - - Restart OSPFv3 daemon - - sudo ${vyos_op_scripts_dir}/restart_frr.py --action restart --daemon ospf6d - - - - Restart Routing Information Protocol daemon - - sudo ${vyos_op_scripts_dir}/restart_frr.py --action restart --daemon ripd - - - - Restart RIPng daemon - - sudo ${vyos_op_scripts_dir}/restart_frr.py --action restart --daemon ripngd - - - - Restart Static Route daemon - - sudo ${vyos_op_scripts_dir}/restart_frr.py --action restart --daemon staticd - - - - Restart IP routing manager daemon - - sudo ${vyos_op_scripts_dir}/restart_frr.py --action restart --daemon zebra - - - + + + + Restart Bidirectional Forwarding Detection (BFD) daemon + + sudo ${vyos_op_scripts_dir}/restart_frr.py --action restart --daemon bfdd + + + + Restart Border Gateway Protocol (BGP) routing daemon + + sudo ${vyos_op_scripts_dir}/restart_frr.py --action restart --daemon bgpd + + + + Restart Open Shortest Path First (OSPF) routing daemon + + sudo ${vyos_op_scripts_dir}/restart_frr.py --action restart --daemon ospfd + + + + Restart IPv6 Open Shortest Path First (OSPFv3) routing daemon + + sudo ${vyos_op_scripts_dir}/restart_frr.py --action restart --daemon ospf6d + + + + Restart Routing Information Protocol (RIP) routing daemon + + sudo ${vyos_op_scripts_dir}/restart_frr.py --action restart --daemon ripd + + + + Restart Routing Information Protocol NG (RIPng) routing daemon + + sudo ${vyos_op_scripts_dir}/restart_frr.py --action restart --daemon ripngd + + + + Restart static routing daemon + + sudo ${vyos_op_scripts_dir}/restart_frr.py --action restart --daemon staticd + + + + Restart Routing Information Base (RIB) manager daemon + + sudo ${vyos_op_scripts_dir}/restart_frr.py --action restart --daemon zebra + -- cgit v1.2.3 From b4b2c91127289c7b62afb24304054d57357a48c5 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Wed, 25 Aug 2021 14:55:10 +0200 Subject: op-mode: frr: T1514: add possibility to restart isis daemon --- op-mode-definitions/restart-frr.xml.in | 6 ++++++ src/op_mode/restart_frr.py | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'op-mode-definitions') diff --git a/op-mode-definitions/restart-frr.xml.in b/op-mode-definitions/restart-frr.xml.in index a5ba5b11f..475bd1ee8 100644 --- a/op-mode-definitions/restart-frr.xml.in +++ b/op-mode-definitions/restart-frr.xml.in @@ -20,6 +20,12 @@ sudo ${vyos_op_scripts_dir}/restart_frr.py --action restart --daemon bgpd + + + Restart Intermediate System to Intermediate System (IS-IS) routing daemon + + sudo ${vyos_op_scripts_dir}/restart_frr.py --action restart --daemon isisd + Restart Open Shortest Path First (OSPF) routing daemon diff --git a/src/op_mode/restart_frr.py b/src/op_mode/restart_frr.py index d1b66b33f..0b2322478 100755 --- a/src/op_mode/restart_frr.py +++ b/src/op_mode/restart_frr.py @@ -155,7 +155,7 @@ def _check_args_daemon(daemons): # define program arguments cmd_args_parser = argparse.ArgumentParser(description='restart frr daemons') cmd_args_parser.add_argument('--action', choices=['restart'], required=True, help='action to frr daemons') -cmd_args_parser.add_argument('--daemon', choices=['bfdd', 'bgpd', 'ospfd', 'ospf6d', 'ripd', 'ripngd', 'staticd', 'zebra'], required=False, nargs='*', help='select single or multiple daemons') +cmd_args_parser.add_argument('--daemon', choices=['bfdd', 'bgpd', 'ospfd', 'ospf6d', 'isisd', 'ripd', 'ripngd', 'staticd', 'zebra'], required=False, nargs='*', help='select single or multiple daemons') # parse arguments cmd_args = cmd_args_parser.parse_args() -- cgit v1.2.3 From 2d5199e75d02c29ce924f932de5c9b012d2b11fd Mon Sep 17 00:00:00 2001 From: Daniil Baturin Date: Tue, 24 Aug 2021 09:17:58 -0500 Subject: T3773: delete the original "show system integrity" command (cherry picked from commit 059307f924c604eb2bdeab19a2db8ce6d8e09f90) --- op-mode-definitions/show-system.xml.in | 6 --- src/op_mode/show_system_integrity.py | 70 ---------------------------------- 2 files changed, 76 deletions(-) delete mode 100755 src/op_mode/show_system_integrity.py (limited to 'op-mode-definitions') diff --git a/op-mode-definitions/show-system.xml.in b/op-mode-definitions/show-system.xml.in index 5e9bf719e..18a28868d 100644 --- a/op-mode-definitions/show-system.xml.in +++ b/op-mode-definitions/show-system.xml.in @@ -55,12 +55,6 @@ ${vyos_op_scripts_dir}/show_cpu.py - - - Checks overall system integrity - - sudo ${vyos_op_scripts_dir}/show_system_integrity.py - Show messages in kernel ring buffer diff --git a/src/op_mode/show_system_integrity.py b/src/op_mode/show_system_integrity.py deleted file mode 100755 index c34d41e80..000000000 --- a/src/op_mode/show_system_integrity.py +++ /dev/null @@ -1,70 +0,0 @@ -#!/usr/bin/env python3 -# -# Copyright (C) 2020 VyOS maintainers and contributors -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 2 or later as -# published by the Free Software Foundation. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# -# - -import sys -import os -import re -import json -from datetime import datetime, timedelta - -version_file = r'/usr/share/vyos/version.json' - - -def _get_sys_build_version(): - if not os.path.exists(version_file): - return None - buf = open(version_file, 'r').read() - j = json.loads(buf) - if not 'built_on' in j: - return None - return datetime.strptime(j['built_on'], '%a %d %b %Y %H:%M %Z') - - -def _check_pkgs(build_stamp): - pkg_diffs = { - 'buildtime': str(build_stamp), - 'pkg': {} - } - - pkg_info = os.listdir('/var/lib/dpkg/info/') - for file in pkg_info: - if re.search('\.list$', file): - fts = os.stat('/var/lib/dpkg/info/' + file).st_mtime - dt_str = (datetime.utcfromtimestamp( - fts).strftime('%Y-%m-%d %H:%M:%S')) - fdt = datetime.strptime(dt_str, '%Y-%m-%d %H:%M:%S') - if fdt > build_stamp: - pkg_diffs['pkg'].update( - {str(re.sub('\.list', '', file)): str(fdt)}) - - if len(pkg_diffs['pkg']) != 0: - return pkg_diffs - else: - return None - - -if __name__ == '__main__': - built_date = _get_sys_build_version() - if not built_date: - sys.exit(1) - pkgs = _check_pkgs(built_date) - if pkgs: - print ( - "The following packages don\'t fit the image creation time\nbuild time:\t" + pkgs['buildtime']) - for k, v in pkgs['pkg'].items(): - print ("installed: " + v + '\t' + k) -- cgit v1.2.3 From 862e6e96bfc557974dbbe374d0aefe654b76e664 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Tue, 31 Aug 2021 12:22:36 +0200 Subject: vyos.ethtool: T3163: use long option names when calling the ethtool binray This makes understanding the code easier what is "really" called without opening the man page. (cherry picked from commit a086dc2c429aea9614ac7a9c735c6475c2d6da59) --- op-mode-definitions/show-interfaces-ethernet.xml.in | 10 +++++----- python/vyos/ethtool.py | 2 +- python/vyos/ifconfig/ethernet.py | 7 +------ 3 files changed, 7 insertions(+), 12 deletions(-) (limited to 'op-mode-definitions') diff --git a/op-mode-definitions/show-interfaces-ethernet.xml.in b/op-mode-definitions/show-interfaces-ethernet.xml.in index bdcfa55f1..897412295 100644 --- a/op-mode-definitions/show-interfaces-ethernet.xml.in +++ b/op-mode-definitions/show-interfaces-ethernet.xml.in @@ -23,19 +23,19 @@ Visually identify specified ethernet interface - echo "Blinking interface $4 for 30 seconds."; /sbin/ethtool --identify "$4" 30 + echo "Blinking interface $4 for 30 seconds."; ethtool --identify "$4" 30 Show physical device information for specified ethernet interface - /sbin/ethtool "$4"; /sbin/ethtool -i "$4" + ethtool "$4"; ethtool --driver "$4" Show physical device offloading capabilities - /sbin/ethtool -k "$4" | sed -e 1d -e '/fixed/d' -e 's/^\t*//g' -e 's/://' | column -t -s' ' + ethtool --show-features "$4" | sed -e 1d -e '/fixed/d' -e 's/^\t*//g' -e 's/://' | column -t -s' ' @@ -43,13 +43,13 @@ Show physical device statistics for specified ethernet interface - /sbin/ethtool -S "$4" + ethtool --statistics "$4" Show transceiver information from modules (e.g SFP+, QSFP) - /sbin/ethtool -m "$4" + ethtool --module-info "$4" diff --git a/python/vyos/ethtool.py b/python/vyos/ethtool.py index 397be6bb2..55b7b776f 100644 --- a/python/vyos/ethtool.py +++ b/python/vyos/ethtool.py @@ -65,7 +65,7 @@ class Ethtool: self._speed_duplex[speed].update({ duplex : ''}) # Now populate features dictionaty - out, err = popen(f'ethtool -k {ifname}') + out, err = popen(f'ethtool --show-features {ifname}') # skip the first line, it only says: "Features for eth0": for line in out.splitlines()[1:]: if ":" in line: diff --git a/python/vyos/ifconfig/ethernet.py b/python/vyos/ifconfig/ethernet.py index a6c7f5f25..2c9d99b91 100644 --- a/python/vyos/ifconfig/ethernet.py +++ b/python/vyos/ifconfig/ethernet.py @@ -43,34 +43,29 @@ class EthernetIf(Interface): @staticmethod def feature(ifname, option, value): - run(f'ethtool -K {ifname} {option} {value}') + run(f'ethtool --features {ifname} {option} {value}') return False _command_set = {**Interface._command_set, **{ 'gro': { 'validate': lambda v: assert_list(v, ['on', 'off']), 'possible': lambda i, v: EthernetIf.feature(i, 'gro', v), - # 'shellcmd': 'ethtool -K {ifname} gro {value}', }, 'gso': { 'validate': lambda v: assert_list(v, ['on', 'off']), 'possible': lambda i, v: EthernetIf.feature(i, 'gso', v), - # 'shellcmd': 'ethtool -K {ifname} gso {value}', }, 'lro': { 'validate': lambda v: assert_list(v, ['on', 'off']), 'possible': lambda i, v: EthernetIf.feature(i, 'lro', v), - # 'shellcmd': 'ethtool -K {ifname} lro {value}', }, 'sg': { 'validate': lambda v: assert_list(v, ['on', 'off']), 'possible': lambda i, v: EthernetIf.feature(i, 'sg', v), - # 'shellcmd': 'ethtool -K {ifname} sg {value}', }, 'tso': { 'validate': lambda v: assert_list(v, ['on', 'off']), 'possible': lambda i, v: EthernetIf.feature(i, 'tso', v), - # 'shellcmd': 'ethtool -K {ifname} tso {value}', }, }} -- cgit v1.2.3 From 56fa0d4baaeb7624918d77172fa7e1500d694b93 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Tue, 31 Aug 2021 22:00:27 +0200 Subject: op-mode: "show interfaces ethernet eth0 physical" should display ring-buffers (cherry picked from commit 8834c22dc3f5758c1d2364579acc428cfc0fe650) --- op-mode-definitions/show-interfaces-ethernet.xml.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'op-mode-definitions') diff --git a/op-mode-definitions/show-interfaces-ethernet.xml.in b/op-mode-definitions/show-interfaces-ethernet.xml.in index 897412295..df9e304a7 100644 --- a/op-mode-definitions/show-interfaces-ethernet.xml.in +++ b/op-mode-definitions/show-interfaces-ethernet.xml.in @@ -29,7 +29,7 @@ Show physical device information for specified ethernet interface - ethtool "$4"; ethtool --driver "$4" + ethtool "$4"; ethtool --show-ring "$4"; ethtool --driver "$4" -- cgit v1.2.3 From 3834f62915830af92dd006a8606b3cce75cbb483 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Thu, 2 Sep 2021 14:05:33 +0200 Subject: op-mode: T1376: speed up tab-completion for DHCP pool listing Commit 9f20bee81c ("T1376: improve show_dhcp and show_dhcpv6") added the tab completion helper to list the availbale IP pools to query. This was done by calling a python script which then called cli-shell-api which resulted in a penalty by the Python interpreter startup. This can be solved by directly using the cli-shell-api wrapper available as in op-mode - as also seen for DHCPv6. (cherry picked from commit b1ff7baaf3c52c8c364955632fcece2da7033b10) --- op-mode-definitions/dhcp.xml.in | 4 ++-- src/op_mode/show_dhcp.py | 8 ++------ 2 files changed, 4 insertions(+), 8 deletions(-) (limited to 'op-mode-definitions') diff --git a/op-mode-definitions/dhcp.xml.in b/op-mode-definitions/dhcp.xml.in index 1dacbd5ba..6f0c25110 100644 --- a/op-mode-definitions/dhcp.xml.in +++ b/op-mode-definitions/dhcp.xml.in @@ -22,7 +22,7 @@ Show DHCP server leases for a specific pool - + service dhcp-server shared-network-name sudo ${vyos_op_scripts_dir}/show_dhcp.py --leases --pool $6 @@ -57,7 +57,7 @@ Show DHCP server statistics for a specific pool - + service dhcp-server shared-network-name sudo ${vyos_op_scripts_dir}/show_dhcp.py --statistics --pool $6 diff --git a/src/op_mode/show_dhcp.py b/src/op_mode/show_dhcp.py index ff1e3cc56..9f65b1bd6 100755 --- a/src/op_mode/show_dhcp.py +++ b/src/op_mode/show_dhcp.py @@ -178,7 +178,7 @@ if __name__ == '__main__': group = parser.add_mutually_exclusive_group() group.add_argument("-l", "--leases", action="store_true", help="Show DHCP leases") group.add_argument("-s", "--statistics", action="store_true", help="Show DHCP statistics") - group.add_argument("--allowed", type=str, choices=["pool", "sort", "state"], help="Show allowed values for argument") + group.add_argument("--allowed", type=str, choices=["sort", "state"], help="Show allowed values for argument") parser.add_argument("-p", "--pool", type=str, help="Show lease for specific pool") parser.add_argument("-S", "--sort", type=str, default='ip', help="Sort by") @@ -189,11 +189,7 @@ if __name__ == '__main__': conf = Config() - if args.allowed == 'pool': - if conf.exists_effective('service dhcp-server'): - print(' '.join(conf.list_effective_nodes("service dhcp-server shared-network-name"))) - exit(0) - elif args.allowed == 'sort': + if args.allowed == 'sort': print(' '.join(lease_display_fields.keys())) exit(0) elif args.allowed == 'state': -- cgit v1.2.3 From c14bb9ab38112837c3e1e0cafcb3b8f19cfba1c0 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Mon, 6 Sep 2021 08:23:24 +0200 Subject: wwan: T3620: op-mode: not all commands supported by all modems - add info message (cherry picked from commit 10814c4d3360598262e991e4b20768dfcde91d75) --- op-mode-definitions/show-interfaces-wwan.xml.in | 4 ++-- src/op_mode/show_wwan.py | 18 +++++++++++------- 2 files changed, 13 insertions(+), 9 deletions(-) (limited to 'op-mode-definitions') diff --git a/op-mode-definitions/show-interfaces-wwan.xml.in b/op-mode-definitions/show-interfaces-wwan.xml.in index d57e17a13..7e5f49ba6 100644 --- a/op-mode-definitions/show-interfaces-wwan.xml.in +++ b/op-mode-definitions/show-interfaces-wwan.xml.in @@ -68,9 +68,9 @@ sudo ${vyos_op_scripts_dir}/show_wwan.py --interface=$4 --sim - + - Show WWAN module information summary + Show WWAN module detailed information summary mmcli --modem ${4#wwan} diff --git a/src/op_mode/show_wwan.py b/src/op_mode/show_wwan.py index 249dda2a5..529b5bd0f 100755 --- a/src/op_mode/show_wwan.py +++ b/src/op_mode/show_wwan.py @@ -34,13 +34,17 @@ required = parser.add_argument_group('Required arguments') required.add_argument("--interface", help="WWAN interface name, e.g. wwan0", required=True) def qmi_cmd(device, command, silent=False): - tmp = cmd(f'qmicli --device={device} --device-open-proxy {command}') - tmp = tmp.replace(f'[{cdc}] ', '') - if not silent: - # skip first line as this only holds the info headline - for line in tmp.splitlines()[1:]: - print(line.lstrip()) - return tmp + try: + tmp = cmd(f'qmicli --device={device} --device-open-proxy {command}') + tmp = tmp.replace(f'[{cdc}] ', '') + if not silent: + # skip first line as this only holds the info headline + for line in tmp.splitlines()[1:]: + print(line.lstrip()) + return tmp + except: + print('Command not supported by Modem') + exit(1) if __name__ == '__main__': args = parser.parse_args() -- cgit v1.2.3 From ff25cb35c93e464acb7c18d329323ba841311abe Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Tue, 7 Sep 2021 11:26:42 +0200 Subject: op-mode: xml: improve "show interfaces " help text (cherry picked from commit bd2c79ebb8abbd844f4b0568110c7bcea0d8f4f1) --- op-mode-definitions/show-interfaces-bonding.xml.in | 4 +- op-mode-definitions/show-interfaces-bridge.xml.in | 4 +- op-mode-definitions/show-interfaces-dummy.xml.in | 4 +- .../show-interfaces-ethernet.xml.in | 4 +- op-mode-definitions/show-interfaces-input.xml.in | 4 +- op-mode-definitions/show-interfaces-l2tpv3.xml.in | 2 +- .../show-interfaces-loopback.xml.in | 4 +- op-mode-definitions/show-interfaces-pppoe.xml.in | 2 +- .../show-interfaces-pseudo-ethernet.xml.in | 4 +- op-mode-definitions/show-interfaces-tunnel.xml.in | 4 +- op-mode-definitions/show-interfaces-vti.xml.in | 4 +- op-mode-definitions/show-interfaces-vxlan.xml.in | 2 +- .../show-interfaces-wireguard.xml.in | 66 +++++++++++++++++ .../show-interfaces-wireless.xml.in | 82 ++++++++++++++++++++++ op-mode-definitions/show-interfaces-wwan.xml.in | 2 +- op-mode-definitions/wireguard.xml.in | 53 -------------- op-mode-definitions/wireless.xml.in | 79 --------------------- 17 files changed, 170 insertions(+), 154 deletions(-) create mode 100644 op-mode-definitions/show-interfaces-wireguard.xml.in create mode 100644 op-mode-definitions/show-interfaces-wireless.xml.in (limited to 'op-mode-definitions') diff --git a/op-mode-definitions/show-interfaces-bonding.xml.in b/op-mode-definitions/show-interfaces-bonding.xml.in index c1c76b059..d4e737d5b 100644 --- a/op-mode-definitions/show-interfaces-bonding.xml.in +++ b/op-mode-definitions/show-interfaces-bonding.xml.in @@ -6,7 +6,7 @@ - Show bonding interface information + Show specified Bonding interface information interfaces bonding @@ -46,7 +46,7 @@ - Show bonding interface information + Show Bonding interface information ${vyos_op_scripts_dir}/show_interfaces.py --intf-type=bonding --action=show-brief diff --git a/op-mode-definitions/show-interfaces-bridge.xml.in b/op-mode-definitions/show-interfaces-bridge.xml.in index cc4b248b6..d4908b341 100644 --- a/op-mode-definitions/show-interfaces-bridge.xml.in +++ b/op-mode-definitions/show-interfaces-bridge.xml.in @@ -6,7 +6,7 @@ - Show bridge interface information + Show specified Bridge interface information interfaces bridge @@ -23,7 +23,7 @@ - Show bridge interface information + Show Bridge interface information ${vyos_op_scripts_dir}/show_interfaces.py --intf-type=bridge --action=show-brief diff --git a/op-mode-definitions/show-interfaces-dummy.xml.in b/op-mode-definitions/show-interfaces-dummy.xml.in index 7c24c6921..52d2cc7ee 100644 --- a/op-mode-definitions/show-interfaces-dummy.xml.in +++ b/op-mode-definitions/show-interfaces-dummy.xml.in @@ -6,7 +6,7 @@ - Show dummy interface information + Show specified Dummy interface information interfaces dummy @@ -23,7 +23,7 @@ - Show dummy interface information + Show Dummy interface information ${vyos_op_scripts_dir}/show_interfaces.py --intf-type=dummy --action=show-brief diff --git a/op-mode-definitions/show-interfaces-ethernet.xml.in b/op-mode-definitions/show-interfaces-ethernet.xml.in index df9e304a7..e414291d1 100644 --- a/op-mode-definitions/show-interfaces-ethernet.xml.in +++ b/op-mode-definitions/show-interfaces-ethernet.xml.in @@ -6,7 +6,7 @@ - Show ethernet interface information + Show specified Ethernet interface information interfaces ethernet @@ -72,7 +72,7 @@ - Show ethernet interface information + Show Ethernet interface information ${vyos_op_scripts_dir}/show_interfaces.py --intf-type=ethernet --action=show-brief diff --git a/op-mode-definitions/show-interfaces-input.xml.in b/op-mode-definitions/show-interfaces-input.xml.in index 15e8203e5..9ae3828c8 100644 --- a/op-mode-definitions/show-interfaces-input.xml.in +++ b/op-mode-definitions/show-interfaces-input.xml.in @@ -6,7 +6,7 @@ - Show input interface information + Show specified Input interface information interfaces input @@ -23,7 +23,7 @@ - Show input interface information + Show Input (ifb) interface information ${vyos_op_scripts_dir}/show_interfaces.py --intf-type=input --action=show-brief diff --git a/op-mode-definitions/show-interfaces-l2tpv3.xml.in b/op-mode-definitions/show-interfaces-l2tpv3.xml.in index 60fee34a1..2a1d6a1c6 100644 --- a/op-mode-definitions/show-interfaces-l2tpv3.xml.in +++ b/op-mode-definitions/show-interfaces-l2tpv3.xml.in @@ -6,7 +6,7 @@ - Show L2TPv3 interface information + Show specified L2TPv3 interface information interfaces l2tpv3 diff --git a/op-mode-definitions/show-interfaces-loopback.xml.in b/op-mode-definitions/show-interfaces-loopback.xml.in index b30b57909..25a75ffff 100644 --- a/op-mode-definitions/show-interfaces-loopback.xml.in +++ b/op-mode-definitions/show-interfaces-loopback.xml.in @@ -6,7 +6,7 @@ - Show loopback interface information + Show specified Loopback interface information interfaces loopback @@ -23,7 +23,7 @@ - Show loopback interface information + Show Loopback interface information ${vyos_op_scripts_dir}/show_interfaces.py --intf-type=loopback --action=show-brief diff --git a/op-mode-definitions/show-interfaces-pppoe.xml.in b/op-mode-definitions/show-interfaces-pppoe.xml.in index 18697a275..767836abf 100644 --- a/op-mode-definitions/show-interfaces-pppoe.xml.in +++ b/op-mode-definitions/show-interfaces-pppoe.xml.in @@ -6,7 +6,7 @@ - Show PPPoE interface information + Show specified PPPoE interface information interfaces pppoe diff --git a/op-mode-definitions/show-interfaces-pseudo-ethernet.xml.in b/op-mode-definitions/show-interfaces-pseudo-ethernet.xml.in index 195944745..2ae4b5a9e 100644 --- a/op-mode-definitions/show-interfaces-pseudo-ethernet.xml.in +++ b/op-mode-definitions/show-interfaces-pseudo-ethernet.xml.in @@ -6,7 +6,7 @@ - Show pseudo-ethernet/MACvlan interface information + Show specified Pseudo-Ethernet/MACvlan interface information interfaces pseudo-ethernet @@ -23,7 +23,7 @@ - Show pseudo-ethernet/MACvlan interface information + Show Pseudo-Ethernet/MACvlan interface information ${vyos_op_scripts_dir}/show_interfaces.py --intf-type=pseudo-ethernet --action=show-brief diff --git a/op-mode-definitions/show-interfaces-tunnel.xml.in b/op-mode-definitions/show-interfaces-tunnel.xml.in index 416de0299..51b25efd9 100644 --- a/op-mode-definitions/show-interfaces-tunnel.xml.in +++ b/op-mode-definitions/show-interfaces-tunnel.xml.in @@ -6,7 +6,7 @@ - Show tunnel interface information + Show specified Tunnel interface information interfaces tunnel @@ -23,7 +23,7 @@ - Show tunnel interface information + Show Tunnel interface information ${vyos_op_scripts_dir}/show_interfaces.py --intf-type=tunnel --action=show-brief diff --git a/op-mode-definitions/show-interfaces-vti.xml.in b/op-mode-definitions/show-interfaces-vti.xml.in index f51be2d19..b436b8414 100644 --- a/op-mode-definitions/show-interfaces-vti.xml.in +++ b/op-mode-definitions/show-interfaces-vti.xml.in @@ -6,7 +6,7 @@ - Show vti interface information + Show specified VTI interface information interfaces vti @@ -23,7 +23,7 @@ - Show vti interface information + Show VTI interface information ${vyos_op_scripts_dir}/show_interfaces.py --intf-type=vti --action=show-brief diff --git a/op-mode-definitions/show-interfaces-vxlan.xml.in b/op-mode-definitions/show-interfaces-vxlan.xml.in index 4e3cb93cd..1befd428c 100644 --- a/op-mode-definitions/show-interfaces-vxlan.xml.in +++ b/op-mode-definitions/show-interfaces-vxlan.xml.in @@ -6,7 +6,7 @@ - Show VXLAN interface information + Show specified VXLAN interface information interfaces vxlan diff --git a/op-mode-definitions/show-interfaces-wireguard.xml.in b/op-mode-definitions/show-interfaces-wireguard.xml.in new file mode 100644 index 000000000..c9b754dcd --- /dev/null +++ b/op-mode-definitions/show-interfaces-wireguard.xml.in @@ -0,0 +1,66 @@ + + + + + + + + + Show specified WireGuard interface information + + + + + ${vyos_op_scripts_dir}/show_interfaces.py --intf="$4" + + + + Show all IP addresses allowed for the specified interface + + sudo wg show "$4" allowed-ips + + + + Show all endpoints for the specified interface + + sudo wg show "$4" endpoints + + + + Show all peer IDs for the specified interface + + sudo wg show "$4" peers + + + + Show interface public-key + + sudo wg show "$4" public-key + + + + Shows current configuration and device information + + sudo wg show "$4" + + + + + + Show WireGuard interface information + + ${vyos_op_scripts_dir}/show_interfaces.py --intf-type=wireguard --action=show-brief + + + + Show detailed Wireguard interface information + + ${vyos_op_scripts_dir}/show_interfaces.py --intf-type=wireguard --action=show + + + + + + + + diff --git a/op-mode-definitions/show-interfaces-wireless.xml.in b/op-mode-definitions/show-interfaces-wireless.xml.in new file mode 100644 index 000000000..4a37417aa --- /dev/null +++ b/op-mode-definitions/show-interfaces-wireless.xml.in @@ -0,0 +1,82 @@ + + + + + + + + + Show Wireless (WLAN) interface information + + ${vyos_op_scripts_dir}/show_interfaces.py --intf-type=wireless --action=show-brief + + + + Show detailed wireless interface information + + ${vyos_op_scripts_dir}/show_interfaces.py --intf-type=wireless --action=show + + + + Show wireless interface configuration + + ${vyos_op_scripts_dir}/show_wireless.py --brief + + + + + + Show specified wireless interface information + + + + + ${vyos_op_scripts_dir}/show_interfaces.py --intf="$4" + + + + Show summary of the specified wireless interface information + + ${vyos_op_scripts_dir}/show_interfaces.py --intf="$4" --action=show-brief + + + + Show summary of the specified wireless interface information + + sudo ${vyos_op_scripts_dir}/show_wireless.py --scan "$4" + + + + Show detailed scan results + + sudo /sbin/iw dev "$4" scan ap-force + + + + + + Show specified Wireless interface information + + ${vyos_op_scripts_dir}/show_wireless.py --stations "$4" + + + + Show specified virtual network interface (vif) information + + ${vyos_op_scripts_dir}/show_interfaces.py --intf="$4.$6" + + + + Show summary of specified virtual network interface (vif) information + + ${vyos_op_scripts_dir}/show_interfaces.py --intf="$4.$6" --action=show-brief + + + + + + + + + + diff --git a/op-mode-definitions/show-interfaces-wwan.xml.in b/op-mode-definitions/show-interfaces-wwan.xml.in index 7e5f49ba6..3cd29b38a 100644 --- a/op-mode-definitions/show-interfaces-wwan.xml.in +++ b/op-mode-definitions/show-interfaces-wwan.xml.in @@ -6,7 +6,7 @@ - Show Wireless Wire Area Network (WWAN) interface information + Show specified Wireless Wire Area Network (WWAN) interface information interfaces wwan diff --git a/op-mode-definitions/wireguard.xml.in b/op-mode-definitions/wireguard.xml.in index 22b08002d..e2bc8a590 100644 --- a/op-mode-definitions/wireguard.xml.in +++ b/op-mode-definitions/wireguard.xml.in @@ -116,59 +116,6 @@ - - - - - show wireguard interface information - - - - - sudo ${vyos_op_scripts_dir}/wireguard.py --showinterface "$4" - - - - show all allowed-ips for the specified interface - - sudo wg show "$4" allowed-ips - - - - show all endpoints for the specified interface - - sudo wg show "$4" endpoints - - - - show all peer IDs for the specified interface - - sudo wg show "$4" peers - - - - Shows current configuration and device information - - sudo wg show "$4" - - - - - - Show wireguard interface information - - ${vyos_op_scripts_dir}/show_interfaces.py --intf-type=wireguard --action=show-brief - - - - Show detailed wireguard interface information - - ${vyos_op_scripts_dir}/show_interfaces.py --intf-type=wireguard --action=show - - - - - diff --git a/op-mode-definitions/wireless.xml.in b/op-mode-definitions/wireless.xml.in index a3a9d1f55..5d9db1544 100644 --- a/op-mode-definitions/wireless.xml.in +++ b/op-mode-definitions/wireless.xml.in @@ -37,83 +37,4 @@ - - - - - - - Show wireless interface information - - ${vyos_op_scripts_dir}/show_interfaces.py --intf-type=wireless --action=show-brief - - - - Show detailed wireless interface information - - ${vyos_op_scripts_dir}/show_interfaces.py --intf-type=wireless --action=show - - - - Show wireless interface configuration - - ${vyos_op_scripts_dir}/show_wireless.py --brief - - - - - - Show specified wireless interface information - - - - - ${vyos_op_scripts_dir}/show_interfaces.py --intf="$4" - - - - Show summary of the specified wireless interface information - - ${vyos_op_scripts_dir}/show_interfaces.py --intf="$4" --action=show-brief - - - - Show summary of the specified wireless interface information - - sudo ${vyos_op_scripts_dir}/show_wireless.py --scan "$4" - - - - Show detailed scan results - - sudo /sbin/iw dev "$4" scan ap-force - - - - - - Show specified wireless interface information - - ${vyos_op_scripts_dir}/show_wireless.py --stations "$4" - - - - Show specified virtual network interface (vif) information - - ${vyos_op_scripts_dir}/show_interfaces.py --intf="$4.$6" - - - - Show summary of specified virtual network interface (vif) information - - ${vyos_op_scripts_dir}/show_interfaces.py --intf="$4.$6" --action=show-brief - - - - - - - - - -- cgit v1.2.3 From 8fd42b024a79d12410ebf0e272991829e3488b88 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sun, 19 Sep 2021 09:17:00 +0200 Subject: dhcp: op-mode: xml: fix duplicate help string (cherry picked from commit 41807725cad3266bf426a9de411bb693b914395e) --- op-mode-definitions/dhcp.xml.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'op-mode-definitions') diff --git a/op-mode-definitions/dhcp.xml.in b/op-mode-definitions/dhcp.xml.in index 6f0c25110..9b21cb9af 100644 --- a/op-mode-definitions/dhcp.xml.in +++ b/op-mode-definitions/dhcp.xml.in @@ -128,13 +128,13 @@ - Restart the DHCP server process + Restart DHCP server process sudo systemctl restart isc-dhcp-server.service - Restart the DHCP server process + Restart DHCP relay agent sudo ${vyos_op_scripts_dir}/restart_dhcp_relay.py --ipv4 -- cgit v1.2.3 From 5183e9cf053e098d8d6fcb9c2ab100a576f11301 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sun, 19 Sep 2021 09:17:36 +0200 Subject: dhcp: op-mode: xml: error out if DHCP service not configured (cherry picked from commit 83f9d4b8bac6b5d401dfea19d4f9d61b7e638a47) --- op-mode-definitions/dhcp.xml.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'op-mode-definitions') diff --git a/op-mode-definitions/dhcp.xml.in b/op-mode-definitions/dhcp.xml.in index 9b21cb9af..4e7568ab6 100644 --- a/op-mode-definitions/dhcp.xml.in +++ b/op-mode-definitions/dhcp.xml.in @@ -130,7 +130,7 @@ Restart DHCP server process - sudo systemctl restart isc-dhcp-server.service + if cli-shell-api existsActive service dhcp-server; then sudo systemctl restart isc-dhcp-server.service; else echo "DHCP server not configured"; fi -- cgit v1.2.3 From 8936791ed1952f6e7a87a085ac19a3857191753b Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sun, 19 Sep 2021 09:21:00 +0200 Subject: dhcpv6: op-mode: xml: fix duplicate help strings (cherry picked from commit 5d4c75d7fdecc56a8864a3ef76ead3f6121a0cff) --- op-mode-definitions/dhcp.xml.in | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'op-mode-definitions') diff --git a/op-mode-definitions/dhcp.xml.in b/op-mode-definitions/dhcp.xml.in index 4e7568ab6..7f4bdb990 100644 --- a/op-mode-definitions/dhcp.xml.in +++ b/op-mode-definitions/dhcp.xml.in @@ -123,18 +123,18 @@ - Restart DHCP server processes + Restart DHCP processes - Restart DHCP server process + Restart DHCP server if cli-shell-api existsActive service dhcp-server; then sudo systemctl restart isc-dhcp-server.service; else echo "DHCP server not configured"; fi - Restart DHCP relay agent + Restart DHCP relay-agent sudo ${vyos_op_scripts_dir}/restart_dhcp_relay.py --ipv4 @@ -142,18 +142,18 @@ - Restart DHCPv6 server processes + Restart DHCPv6 processes - Restart the DHCPv6 server process + Restart DHCPv6 server sudo systemctl restart isc-dhcp-server6.service - Restart the DHCP server process + Restart DHCPv6 relay-agent sudo ${vyos_op_scripts_dir}/restart_dhcp_relay.py --ipv6 -- cgit v1.2.3 From c4cce047d97ffdcaf9279bfffde0b4eaa9976eab Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sun, 19 Sep 2021 09:21:25 +0200 Subject: dhcpv6: op-mode: xml: error out if DHCPv6 service not configured Restarting DHCPv6 server should not be possible when service is not configured on the CLI. (cherry picked from commit 224f0b8042f439b8dcc0eb32730da669e8b163af) --- op-mode-definitions/dhcp.xml.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'op-mode-definitions') diff --git a/op-mode-definitions/dhcp.xml.in b/op-mode-definitions/dhcp.xml.in index 7f4bdb990..241cca0ce 100644 --- a/op-mode-definitions/dhcp.xml.in +++ b/op-mode-definitions/dhcp.xml.in @@ -149,7 +149,7 @@ Restart DHCPv6 server - sudo systemctl restart isc-dhcp-server6.service + if cli-shell-api existsActive service dhcpv6-server; then sudo systemctl restart isc-dhcp-server6.service; else echo "DHCPv6 server not configured"; fi -- cgit v1.2.3 From 7a5e3fecaf532a526a8ca01f1082fc54691c10f5 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sat, 25 Sep 2021 16:34:52 +0200 Subject: op-mode: bgp: "show bgp ipv4|ipv6" should display routing table The node was missed out when adding the XML definitions. (cherry picked from commit 801123eff1bf232ca1e5202ceb0989c2fba34c86) --- op-mode-definitions/include/bgp/show-bgp-common.xml.i | 2 ++ 1 file changed, 2 insertions(+) (limited to 'op-mode-definitions') diff --git a/op-mode-definitions/include/bgp/show-bgp-common.xml.i b/op-mode-definitions/include/bgp/show-bgp-common.xml.i index 785b85963..4f112905e 100644 --- a/op-mode-definitions/include/bgp/show-bgp-common.xml.i +++ b/op-mode-definitions/include/bgp/show-bgp-common.xml.i @@ -21,6 +21,7 @@ #include #include + ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ @@ -42,5 +43,6 @@ #include #include + ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ -- cgit v1.2.3 From 3b2523b816556aa911459097c2476a2da4542151 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Mon, 4 Oct 2021 19:45:22 +0200 Subject: op-mode: T3889: migrate to journalctl when reading daemon logs --- op-mode-definitions/show-log.xml.in | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-) (limited to 'op-mode-definitions') diff --git a/op-mode-definitions/show-log.xml.in b/op-mode-definitions/show-log.xml.in index 92c1cf016..f31c85245 100644 --- a/op-mode-definitions/show-log.xml.in +++ b/op-mode-definitions/show-log.xml.in @@ -6,7 +6,7 @@ Show contents of current master log file - /bin/journalctl + journalctl --boot @@ -18,7 +18,7 @@ Show listing of authorization attempts - /bin/journalctl --quiet SYSLOG_FACILITY=10 SYSLOG_FACILITY=4 + journalctl --boot --quiet SYSLOG_FACILITY=10 SYSLOG_FACILITY=4 @@ -30,7 +30,7 @@ Show log for Conntrack-sync - cat $(printf "%s\n" /var/log/messages* | sort -nr ) | grep -e conntrackd + journalctl --boot --unit conntrackd.service @@ -89,7 +89,7 @@ Show log for HTTPs - cat $(printf "%s\n" /var/log/messages* | sort -nr) | grep -e nginx + journalctl --boot --unit nginx.service @@ -133,7 +133,7 @@ Show log for LLDP - cat $(printf "%s\n" /var/log/messages* | sort -nr) | grep -e lldpd + journalctl --boot --unit lldpd.service @@ -141,17 +141,28 @@ egrep -i "kernel:.*\[NAT-[A-Z]{3,}-[0-9]+(-MASQ)?\]" $(find /var/log -maxdepth 1 -type f -name messages\* | sort -t. -k2nr) - + Show log for OpenVPN - cat $(printf "%s\n" /var/log/messages* | sort -nr) | grep -e openvpn - + journalctl --boot --unit openvpn@*.service + + + + Show OpenVPN log on specific interface + + interfaces openvpn + + + journalctl --boot --unit openvpn@$5.service + + + Show log for Simple Network Monitoring Protocol (SNMP) - cat $(printf "%s\n" /var/log/messages* | sort -nr) | grep -e snmpd + journalctl --boot --unit snmpd.service @@ -195,13 +206,13 @@ Show log for PPTP - cat $(printf "%s\n" /var/log/messages* | sort -nr) | grep -e accel-pptp -e ppp + journalctl --boot --unit accel-ppp@pptp.service Show log for SSTP - cat $(printf "%s\n" /var/log/messages* | sort -nr) | grep -e accel-sstp -e ppp + journalctl --boot --unit accel-ppp@sstp.service @@ -209,13 +220,13 @@ Show log for Virtual Router Redundancy Protocol (VRRP) - cat $(printf "%s\n" /var/log/messages* | sort -nr) | grep -e Keepalived_vrrp + journalctl --boot --unit keepalived.service Show log for Webproxy - cat $(printf "%s\n" /var/log/messages* | sort -nr) | grep -e "squid" + journalctl --boot --unit squid.service -- cgit v1.2.3 From ffd73958e42c20f69ded64393491966e0c9230c6 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Mon, 4 Oct 2021 19:49:07 +0200 Subject: op-mode: dhcpv(v6): T3890: retrieve both server and client logfiles * rename: "show log dhcp" will become "show log dhcp server" * add: "show log dhcp client" to display logs from ALL DHCP client processes * add: "show log dhcp client interface " to display logs from individual DHCP client processes * add: "show log dhcpv6 server" to display infos about running DHCPv6 server * add: "show log dhcpv6 client" to display logs from ALL DHCPv6 client processes * add: "show log dhcpv6 client interface " to display logs from individual DHCPv6 client processes --- op-mode-definitions/show-log.xml.in | 60 +++++++++++++++++++++++++++++++++++-- 1 file changed, 57 insertions(+), 3 deletions(-) (limited to 'op-mode-definitions') diff --git a/op-mode-definitions/show-log.xml.in b/op-mode-definitions/show-log.xml.in index f31c85245..3156d822a 100644 --- a/op-mode-definitions/show-log.xml.in +++ b/op-mode-definitions/show-log.xml.in @@ -32,12 +32,66 @@ journalctl --boot --unit conntrackd.service - + Show log for Dynamic Host Control Protocol (DHCP) - cat $(printf "%s\n" /var/log/messages* | sort -nr) | grep dhcpd - + + + + Show log for DHCP server + + journalctl --boot --unit isc-dhcp-server.service + + + + Show DHCP client logs + + journalctl --boot --unit "dhclient@*.service" + + + + Show DHCP client log on specific interface + + + + + journalctl --boot --unit "dhclient@$6.service" + + + + + + + + Show log for Dynamic Host Control Protocol IPv6 (DHCPv6) + + + + + Show log for DHCPv6 server + + journalctl --boot --unit isc-dhcp-server6.service + + + + Show DHCPv6 client logs + + journalctl --boot --unit "dhcp6c@*.service" + + + + Show DHCPv6 client log on specific interface + + + + + journalctl --boot --unit "dhcp6c@$6.service" + + + + + Show log for Firewall -- cgit v1.2.3 From 30cf3bc79e2253a004fcbbf76c9f99c52e7bc216 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Tue, 5 Oct 2021 19:43:08 +0200 Subject: op-mode: T3889: do not display redundant hostname when reading logs --- op-mode-definitions/show-log.xml.in | 38 ++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'op-mode-definitions') diff --git a/op-mode-definitions/show-log.xml.in b/op-mode-definitions/show-log.xml.in index 3156d822a..4c0a7913b 100644 --- a/op-mode-definitions/show-log.xml.in +++ b/op-mode-definitions/show-log.xml.in @@ -6,7 +6,7 @@ Show contents of current master log file - journalctl --boot + journalctl --no-hostname --boot @@ -18,7 +18,7 @@ Show listing of authorization attempts - journalctl --boot --quiet SYSLOG_FACILITY=10 SYSLOG_FACILITY=4 + journalctl --no-hostname --boot --quiet SYSLOG_FACILITY=10 SYSLOG_FACILITY=4 @@ -30,7 +30,7 @@ Show log for Conntrack-sync - journalctl --boot --unit conntrackd.service + journalctl --no-hostname --boot --unit conntrackd.service @@ -41,13 +41,13 @@ Show log for DHCP server - journalctl --boot --unit isc-dhcp-server.service + journalctl --no-hostname --boot --unit isc-dhcp-server.service Show DHCP client logs - journalctl --boot --unit "dhclient@*.service" + journalctl --no-hostname --boot --unit "dhclient@*.service" @@ -56,7 +56,7 @@ - journalctl --boot --unit "dhclient@$6.service" + journalctl --no-hostname --boot --unit "dhclient@$6.service" @@ -71,13 +71,13 @@ Show log for DHCPv6 server - journalctl --boot --unit isc-dhcp-server6.service + journalctl --no-hostname --boot --unit isc-dhcp-server6.service Show DHCPv6 client logs - journalctl --boot --unit "dhcp6c@*.service" + journalctl --no-hostname --boot --unit "dhcp6c@*.service" @@ -86,7 +86,7 @@ - journalctl --boot --unit "dhcp6c@$6.service" + journalctl --no-hostname --boot --unit "dhcp6c@$6.service" @@ -143,7 +143,7 @@ Show log for HTTPs - journalctl --boot --unit nginx.service + journalctl --no-hostname --boot --unit nginx.service @@ -173,7 +173,7 @@ <NUMBER> - tail -n "$6" /lib/live/mount/persistence/boot/$4/rw/var/log/messages | ${VYATTA_PAGER:-cat} + tail -n "$6" /lib/live/mount/persistence/boot/$4/rw/var/log/messages | ${VYATTA_PAGER:-cat} @@ -187,7 +187,7 @@ Show log for LLDP - journalctl --boot --unit lldpd.service + journalctl --no-hostname --boot --unit lldpd.service @@ -199,7 +199,7 @@ Show log for OpenVPN - journalctl --boot --unit openvpn@*.service + journalctl --no-hostname --boot --unit openvpn@*.service @@ -208,7 +208,7 @@ interfaces openvpn - journalctl --boot --unit openvpn@$5.service + journalctl --no-hostname --boot --unit openvpn@$5.service @@ -216,7 +216,7 @@ Show log for Simple Network Monitoring Protocol (SNMP) - journalctl --boot --unit snmpd.service + journalctl --no-hostname --boot --unit snmpd.service @@ -260,13 +260,13 @@ Show log for PPTP - journalctl --boot --unit accel-ppp@pptp.service + journalctl --no-hostname --boot --unit accel-ppp@pptp.service Show log for SSTP - journalctl --boot --unit accel-ppp@sstp.service + journalctl --no-hostname --boot --unit accel-ppp@sstp.service @@ -274,13 +274,13 @@ Show log for Virtual Router Redundancy Protocol (VRRP) - journalctl --boot --unit keepalived.service + journalctl --no-hostname --boot --unit keepalived.service Show log for Webproxy - journalctl --boot --unit squid.service + journalctl --no-hostname --boot --unit squid.service -- cgit v1.2.3 From 0e0565b83909784abcf5858f8ea178ded98debb0 Mon Sep 17 00:00:00 2001 From: Viacheslav Date: Tue, 26 Oct 2021 20:34:48 +0000 Subject: op-mode: T3942: Add feature generate IPSec debug-archive --- .../generate-ipsec-debug-archive.xml.in | 20 ++++++++++++ src/op_mode/generate_ipsec_debug_archive.sh | 36 ++++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 op-mode-definitions/generate-ipsec-debug-archive.xml.in create mode 100755 src/op_mode/generate_ipsec_debug_archive.sh (limited to 'op-mode-definitions') diff --git a/op-mode-definitions/generate-ipsec-debug-archive.xml.in b/op-mode-definitions/generate-ipsec-debug-archive.xml.in new file mode 100644 index 000000000..ecd7108c4 --- /dev/null +++ b/op-mode-definitions/generate-ipsec-debug-archive.xml.in @@ -0,0 +1,20 @@ + + + + + + + Generate IPsec archives + + + + + Generate IPSec debug-archive + + ${vyos_op_scripts_dir}/generate_ipsec_debug_archive.sh + + + + + + diff --git a/src/op_mode/generate_ipsec_debug_archive.sh b/src/op_mode/generate_ipsec_debug_archive.sh new file mode 100755 index 000000000..53d0a6eaa --- /dev/null +++ b/src/op_mode/generate_ipsec_debug_archive.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env bash + +# Collecting IPSec Debug Information + +DATE=`date +%d-%m-%Y` + +a_CMD=( + "sudo ipsec status" + "sudo swanctl -L" + "sudo swanctl -l" + "sudo swanctl -P" + "sudo ip x sa show" + "sudo ip x policy show" + "sudo ip tunnel show" + "sudo ip address" + "sudo ip rule show" + "sudo ip route" + "sudo ip route show table 220" + ) + + +echo "DEBUG: ${DATE} on host \"$(hostname)\"" > /tmp/ipsec-status-${DATE}.txt +date >> /tmp/ipsec-status-${DATE}.txt + +# Execute all DEBUG commands and save it to file +for cmd in "${a_CMD[@]}"; do + echo -e "\n### ${cmd} ###" >> /tmp/ipsec-status-${DATE}.txt + ${cmd} >> /tmp/ipsec-status-${DATE}.txt 2>/dev/null +done + +# Collect charon logs, build .tgz archive +sudo journalctl /usr/lib/ipsec/charon > /tmp/journalctl-charon-${DATE}.txt && \ +sudo tar -zcvf /tmp/ipsec-debug-${DATE}.tgz /tmp/journalctl-charon-${DATE}.txt /tmp/ipsec-status-${DATE}.txt >& /dev/null +sudo rm -f /tmp/journalctl-charon-${DATE}.txt /tmp/ipsec-status-${DATE}.txt + +echo "Debug file is generated and located in /tmp/ipsec-debug-${DATE}.tgz" -- cgit v1.2.3 From 24d9a9261fca4a37085088761079cce9b5157c34 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Thu, 18 Nov 2021 17:53:55 +0100 Subject: xml: op-mode: improve help for "show ip route vrf" --- op-mode-definitions/show-ip-route.xml.in | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'op-mode-definitions') diff --git a/op-mode-definitions/show-ip-route.xml.in b/op-mode-definitions/show-ip-route.xml.in index 729572b4a..740993693 100644 --- a/op-mode-definitions/show-ip-route.xml.in +++ b/op-mode-definitions/show-ip-route.xml.in @@ -125,16 +125,11 @@ vtysh -c "show ip route tag $5" - - - Show IP routes in VRF - - Show IP routes in VRF - <vrf> + all vrf name -- cgit v1.2.3