From a78982625a8a18069bd5a13744734873698fd0f9 Mon Sep 17 00:00:00 2001 From: aapostoliuk Date: Thu, 30 Mar 2023 18:28:56 +0300 Subject: ipsec: T5093: Fixed 'reset vpn ipsec profile' command Fixed 'reset vpn ipsec profile' command using vici library and new op-mode style. Added ability to use 'reset vpn ipsec profile' command with 'remote-host' option. --- op-mode-definitions/vpn-ipsec.xml.in | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'op-mode-definitions') diff --git a/op-mode-definitions/vpn-ipsec.xml.in b/op-mode-definitions/vpn-ipsec.xml.in index 5baaec7ce..5a7e6dd63 100644 --- a/op-mode-definitions/vpn-ipsec.xml.in +++ b/op-mode-definitions/vpn-ipsec.xml.in @@ -14,7 +14,7 @@ - Reset all tunnels for given DMVPN profile + Reset a specific tunnel for given DMVPN profile vpn ipsec profile @@ -23,11 +23,24 @@ Reset a specific tunnel for given DMVPN profile + + + - sudo ${vyos_op_scripts_dir}/vpn_ipsec.py --action="reset-profile" --name="$6" --tunnel="$8" + + + + Reset a specific tunnel for given DMVPN NBMA + + <x.x.x.x> <h:h:h:h:h:h:h:h> + + + sudo ${vyos_op_scripts_dir}/ipsec.py reset_profile_dst --profile="$5" --tunnel="$7" --nbma_dst="$9" + + + sudo ${vyos_op_scripts_dir}/ipsec.py reset_profile_all --profile="$5" --tunnel="$7" - sudo ${vyos_op_scripts_dir}/vpn_ipsec.py --action="reset-profile" --name="$6" --tunnel="all" -- cgit v1.2.3 From d1345fe688546082a1d8283ccb0c3b05bcd0a1d3 Mon Sep 17 00:00:00 2001 From: fett0 Date: Thu, 30 Mar 2023 22:54:16 +0000 Subject: T5131: fix op-mode show isis segment-routing prefix-sids --- op-mode-definitions/include/isis-common.xml.i | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'op-mode-definitions') diff --git a/op-mode-definitions/include/isis-common.xml.i b/op-mode-definitions/include/isis-common.xml.i index 95a171515..4a2f1e503 100644 --- a/op-mode-definitions/include/isis-common.xml.i +++ b/op-mode-definitions/include/isis-common.xml.i @@ -122,6 +122,12 @@ ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ + + + Show Prefix-SID information + + ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ + vtysh -c "show isis route" @@ -136,12 +142,6 @@ ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ - - - Show prefix segment IDs - - ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ - -- cgit v1.2.3 From 657f5c1a08351c7740ff74cc112321d8f4e2155c Mon Sep 17 00:00:00 2001 From: Viacheslav Hletenko Date: Fri, 31 Mar 2023 13:09:21 +0000 Subject: T5125: Add op-mode for sFlow based on hsflowd Add op-mode for sFlow based on hsflowd "show sflow" Add machine readable format '--raw' and formatted output --- data/templates/sflow/hsflowd.conf.j2 | 1 + op-mode-definitions/sflow.xml.in | 15 +++++ smoketest/scripts/cli/test_system_sflow.py | 1 + src/op_mode/sflow.py | 102 +++++++++++++++++++++++++++++ 4 files changed, 119 insertions(+) create mode 100644 op-mode-definitions/sflow.xml.in create mode 100755 src/op_mode/sflow.py (limited to 'op-mode-definitions') diff --git a/data/templates/sflow/hsflowd.conf.j2 b/data/templates/sflow/hsflowd.conf.j2 index 94f5939be..5000956bd 100644 --- a/data/templates/sflow/hsflowd.conf.j2 +++ b/data/templates/sflow/hsflowd.conf.j2 @@ -28,4 +28,5 @@ sflow { {% if drop_monitor_limit is vyos_defined %} dropmon { limit={{ drop_monitor_limit }} start=on sw=on hw=off } {% endif %} + dbus { } } diff --git a/op-mode-definitions/sflow.xml.in b/op-mode-definitions/sflow.xml.in new file mode 100644 index 000000000..9f02dacda --- /dev/null +++ b/op-mode-definitions/sflow.xml.in @@ -0,0 +1,15 @@ + + + + + + + + Show sFlow statistics + + + sudo ${vyos_op_scripts_dir}/sflow.py show + + + + diff --git a/smoketest/scripts/cli/test_system_sflow.py b/smoketest/scripts/cli/test_system_sflow.py index fef88b56a..1aec050a4 100755 --- a/smoketest/scripts/cli/test_system_sflow.py +++ b/smoketest/scripts/cli/test_system_sflow.py @@ -91,6 +91,7 @@ class TestSystemFlowAccounting(VyOSUnitTestSHIM.TestCase): self.assertIn(f'collector {{ ip = {server} udpport = {port} }}', hsflowd) self.assertIn(f'collector {{ ip = {local_server} udpport = {default_port} }}', hsflowd) self.assertIn(f'dropmon {{ limit={mon_limit} start=on sw=on hw=off }}', hsflowd) + self.assertIn('dbus { }', hsflowd) for interface in Section.interfaces('ethernet'): self.assertIn(f'pcap {{ dev={interface} }}', hsflowd) diff --git a/src/op_mode/sflow.py b/src/op_mode/sflow.py new file mode 100755 index 000000000..1ff006274 --- /dev/null +++ b/src/op_mode/sflow.py @@ -0,0 +1,102 @@ +#!/usr/bin/env python3 +# +# Copyright (C) 2023 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 dbus +import sys + +from tabulate import tabulate + +from vyos.configquery import ConfigTreeQuery +from vyos.util import cmd + +import vyos.opmode + + +def _get_raw_sflow(): + bus = dbus.SystemBus() + config = ConfigTreeQuery() + + interfaces = config.values('system sflow interface') + servers = config.list_nodes('system sflow server') + + sflow = bus.get_object('net.sflow.hsflowd', '/net/sflow/hsflowd') + sflow_telemetry = dbus.Interface( + sflow, dbus_interface='net.sflow.hsflowd.telemetry') + agent_address = sflow_telemetry.GetAgent() + samples_dropped = int(sflow_telemetry.Get('dropped_samples')) + samples_packet_sent = int(sflow_telemetry.Get('flow_samples')) + samples_counter_sent = int(sflow_telemetry.Get('counter_samples')) + datagrams_sent = int(sflow_telemetry.Get('datagrams')) + rtmetric_samples = int(sflow_telemetry.Get('rtmetric_samples')) + samples_suppressed = int(sflow_telemetry.Get('flow_samples_suppressed')) + counter_samples_suppressed = int( + sflow_telemetry.Get("counter_samples_suppressed")) + version = sflow_telemetry.GetVersion() + + sflow_dict = { + 'agent_address': agent_address, + 'sflow_interfaces': interfaces, + 'sflow_servers': servers, + 'counter_samples_sent': samples_counter_sent, + 'datagrams_sent': datagrams_sent, + 'packet_samples_dropped': samples_dropped, + 'packet_samples_sent': samples_packet_sent, + 'rtmetric_samples': rtmetric_samples, + 'flow_samples_suppressed': samples_suppressed, + 'counter_samples_suppressed': counter_samples_suppressed, + 'hsflowd_version': version + } + return sflow_dict + + +def _get_formatted_sflow(data): + table = [ + ['Agent address', f'{data.get("agent_address")}'], + ['sFlow interfaces', f'{data.get("sflow_interfaces", "n/a")}'], + ['sFlow servers', f'{data.get("sflow_servers", "n/a")}'], + ['Datagrams sent', f'{data.get("datagrams_sent")}'], + ['Packet samples sent', f'{data.get("packet_samples_sent")}'], + ['Packet samples dropped', f'{data.get("packet_samples_dropped")}'], + ['Counter samples sent', f'{data.get("counter_samples_sent")}'], + ['Flow samples suppressed', f'{data.get("flow_samples_suppressed")}'], + ['Counter samples suppressed', f'{data.get("counter_samples_suppressed")}'] + ] + + return tabulate(table) + + +def show(raw: bool): + + config = ConfigTreeQuery() + if not config.exists('system sflow'): + raise vyos.opmode.UnconfiguredSubsystem( + '"system sflow" is not configured!') + + sflow_data = _get_raw_sflow() + if raw: + return sflow_data + else: + return _get_formatted_sflow(sflow_data) + + +if __name__ == '__main__': + try: + res = vyos.opmode.run(sys.modules[__name__]) + if res: + print(res) + except (ValueError, vyos.opmode.Error) as e: + print(e) + sys.exit(1) -- cgit v1.2.3 From 15922541cef35956107e0b32ee952fee05928dbd Mon Sep 17 00:00:00 2001 From: Christian Breunig Date: Sat, 1 Apr 2023 12:33:21 +0200 Subject: isis: op-mode: T5132: bugfix VRF commands for route and neighbor show isis vrf neighbor|route did not call the vtysh wrapper but instead always called the commands for the default routing table. --- op-mode-definitions/include/isis-common.xml.i | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'op-mode-definitions') diff --git a/op-mode-definitions/include/isis-common.xml.i b/op-mode-definitions/include/isis-common.xml.i index 4a2f1e503..0e20861c7 100644 --- a/op-mode-definitions/include/isis-common.xml.i +++ b/op-mode-definitions/include/isis-common.xml.i @@ -94,7 +94,7 @@ ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ - vtysh -c "show isis neighbor" + ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ @@ -129,7 +129,7 @@ ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ - vtysh -c "show isis route" + ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ -- cgit v1.2.3 From f72fa135986186544b6125481bae4691ddd4dded Mon Sep 17 00:00:00 2001 From: Viacheslav Hletenko Date: Tue, 4 Apr 2023 10:36:24 +0000 Subject: T5142: Add audit tool to monitor security-relevant events --- debian/control | 2 ++ op-mode-definitions/show-log.xml.in | 6 ++++++ 2 files changed, 8 insertions(+) (limited to 'op-mode-definitions') diff --git a/debian/control b/debian/control index 8cd49f62a..856f57030 100644 --- a/debian/control +++ b/debian/control @@ -35,6 +35,7 @@ Architecture: amd64 arm64 Depends: ${python3:Depends}, accel-ppp, + auditd, avahi-daemon, beep, bmon, @@ -80,6 +81,7 @@ Depends: lcdproc, lcdproc-extra-drivers, libatomic1, + libauparse0, libbpf1 [amd64], libcharon-extra-plugins (>=5.9), libcharon-extauth-plugins (>=5.9), diff --git a/op-mode-definitions/show-log.xml.in b/op-mode-definitions/show-log.xml.in index 7f6469ca9..7663e4c00 100644 --- a/op-mode-definitions/show-log.xml.in +++ b/op-mode-definitions/show-log.xml.in @@ -8,6 +8,12 @@ journalctl --no-hostname --boot + + + Show audit logs + + cat /var/log/audit/audit.log + Show contents of all master log files -- cgit v1.2.3 From 3ffb5ff16543576e73f23125e4590fa57b02f0b7 Mon Sep 17 00:00:00 2001 From: Cheeze_It Date: Sun, 19 Mar 2023 19:24:50 -0600 Subject: T5081: ISIS and OSPF syncronization with IGP-LDP sync --- data/templates/frr/isisd.frr.j2 | 11 ++++++ data/templates/frr/ospfd.frr.j2 | 11 ++++++ .../include/isis/protocol-common-config.xml.i | 4 +- .../include/ldp-sync-interface.xml.i | 22 +++++++++++ .../include/ldp-sync-protocol.xml.i | 21 +++++++++++ .../include/ospf/protocol-common-config.xml.i | 4 +- op-mode-definitions/include/isis-common.xml.i | 26 ++++++++++++- op-mode-definitions/include/ospf-common.xml.i | 26 ++++++++++++- smoketest/scripts/cli/test_protocols_isis.py | 43 ++++++++++++++++++++++ smoketest/scripts/cli/test_protocols_ospf.py | 41 +++++++++++++++++++++ 10 files changed, 205 insertions(+), 4 deletions(-) create mode 100644 interface-definitions/include/ldp-sync-interface.xml.i create mode 100644 interface-definitions/include/ldp-sync-protocol.xml.i (limited to 'op-mode-definitions') diff --git a/data/templates/frr/isisd.frr.j2 b/data/templates/frr/isisd.frr.j2 index 8df1e9513..3c37e28b9 100644 --- a/data/templates/frr/isisd.frr.j2 +++ b/data/templates/frr/isisd.frr.j2 @@ -25,6 +25,12 @@ interface {{ iface }} {% if iface_config.hello_padding is vyos_defined %} isis hello padding {% endif %} +{% if iface_config.ldp_sync.disable is vyos_defined %} + no isis mpls ldp-sync +{% elif iface_config.ldp_sync.holddown is vyos_defined %} + isis mpls ldp-sync + isis mpls ldp-sync holddown {{ iface_config.ldp_sync.holddown }} +{% endif %} {% if iface_config.metric is vyos_defined %} isis metric {{ iface_config.metric }} {% endif %} @@ -84,6 +90,11 @@ router isis VyOS {{ 'vrf ' + vrf if vrf is vyos_defined }} {% if max_lsp_lifetime is vyos_defined %} max-lsp-lifetime {{ max_lsp_lifetime }} {% endif %} +{% if ldp_sync.holddown is vyos_defined %} + mpls ldp-sync holddown {{ ldp_sync.holddown }} +{% elif ldp_sync is vyos_defined %} + mpls ldp-sync +{% endif %} {% if spf_interval is vyos_defined %} spf-interval {{ spf_interval }} {% endif %} diff --git a/data/templates/frr/ospfd.frr.j2 b/data/templates/frr/ospfd.frr.j2 index 8c4a81c57..3f97b7325 100644 --- a/data/templates/frr/ospfd.frr.j2 +++ b/data/templates/frr/ospfd.frr.j2 @@ -44,6 +44,12 @@ interface {{ iface }} {% if iface_config.bfd.profile is vyos_defined %} ip ospf bfd profile {{ iface_config.bfd.profile }} {% endif %} +{% if iface_config.ldp_sync.disable is vyos_defined %} + no ip ospf mpls ldp-sync +{% elif iface_config.ldp_sync.holddown is vyos_defined %} + ip ospf mpls ldp-sync + ip ospf mpls ldp-sync holddown {{ iface_config.ldp_sync.holddown }} +{% endif %} {% if iface_config.mtu_ignore is vyos_defined %} ip ospf mtu-ignore {% endif %} @@ -133,6 +139,11 @@ router ospf {{ 'vrf ' ~ vrf if vrf is vyos_defined }} {% if maximum_paths is vyos_defined %} maximum-paths {{ maximum_paths }} {% endif %} +{% if ldp_sync.holddown is vyos_defined %} + mpls ldp-sync holddown {{ ldp_sync.holddown }} +{% elif ldp_sync is vyos_defined %} + mpls ldp-sync +{% endif %} {% if distance.global is vyos_defined %} distance {{ distance.global }} {% endif %} diff --git a/interface-definitions/include/isis/protocol-common-config.xml.i b/interface-definitions/include/isis/protocol-common-config.xml.i index 0e6f19480..983a085ec 100644 --- a/interface-definitions/include/isis/protocol-common-config.xml.i +++ b/interface-definitions/include/isis/protocol-common-config.xml.i @@ -152,6 +152,7 @@ +#include A Network Entity Title for this process (ISO only) @@ -172,7 +173,7 @@ - Show IS-IS neighbor adjacencies + IS-IS traffic engineering extensions @@ -631,6 +632,7 @@ #include + #include Set network type diff --git a/interface-definitions/include/ldp-sync-interface.xml.i b/interface-definitions/include/ldp-sync-interface.xml.i new file mode 100644 index 000000000..b24831bbe --- /dev/null +++ b/interface-definitions/include/ldp-sync-interface.xml.i @@ -0,0 +1,22 @@ + + + + LDP-IGP synchronization configuration for interface + + + #include + + + Hold down timer for LDP-IGP cost restoration + + u32:0-10000 + Time to wait in seconds for LDP-IGP synchronization to occur before restoring interface cost + + + + + + + + + diff --git a/interface-definitions/include/ldp-sync-protocol.xml.i b/interface-definitions/include/ldp-sync-protocol.xml.i new file mode 100644 index 000000000..c82c811f6 --- /dev/null +++ b/interface-definitions/include/ldp-sync-protocol.xml.i @@ -0,0 +1,21 @@ + + + + Protocol wide LDP-IGP synchronization configuration + + + + + Protocol wide hold down timer for LDP-IGP cost restoration + + u32:0-10000 + Time to wait in seconds for LDP-IGP synchronization to occur before restoring interface cost + + + + + + + + + diff --git a/interface-definitions/include/ospf/protocol-common-config.xml.i b/interface-definitions/include/ospf/protocol-common-config.xml.i index f39b9c5e3..425d3b01c 100644 --- a/interface-definitions/include/ospf/protocol-common-config.xml.i +++ b/interface-definitions/include/ospf/protocol-common-config.xml.i @@ -331,6 +331,7 @@ +#include Administrative distance @@ -385,6 +386,7 @@ #include #include #include + #include Interface bandwidth (Mbit/s) @@ -875,4 +877,4 @@ - + \ No newline at end of file diff --git a/op-mode-definitions/include/isis-common.xml.i b/op-mode-definitions/include/isis-common.xml.i index 0e20861c7..53e85a7ef 100644 --- a/op-mode-definitions/include/isis-common.xml.i +++ b/op-mode-definitions/include/isis-common.xml.i @@ -54,6 +54,30 @@ ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ + + + Show IS-IS MPLS specific information + + + + + Show IS-IS LDP-IGP synchronization information + + ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ + + + + Show specific IS-IS LDP-IGP synchronization for an interface + + + + + ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ + + + + + Show IS-IS MPLS traffic engineering information @@ -176,4 +200,4 @@ ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ - + \ No newline at end of file diff --git a/op-mode-definitions/include/ospf-common.xml.i b/op-mode-definitions/include/ospf-common.xml.i index 098254f4e..7d9e541cf 100644 --- a/op-mode-definitions/include/ospf-common.xml.i +++ b/op-mode-definitions/include/ospf-common.xml.i @@ -517,6 +517,30 @@ ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ + + + Show OSPF MPLS specific information + + + + + Show OSPF LDP-IGP synchronization information + + ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ + + + + Show specific OSPF LDP-IGP synchronization for an interface + + + + + ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ + + + + + Show IPv4 OSPF neighbor information @@ -547,4 +571,4 @@ ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ - + \ No newline at end of file diff --git a/smoketest/scripts/cli/test_protocols_isis.py b/smoketest/scripts/cli/test_protocols_isis.py index d11d80a1f..61e29c449 100755 --- a/smoketest/scripts/cli/test_protocols_isis.py +++ b/smoketest/scripts/cli/test_protocols_isis.py @@ -308,5 +308,48 @@ class TestProtocolsISIS(VyOSUnitTestSHIM.TestCase): self.assertIn(f' segment-routing prefix {prefix_three} absolute {prefix_three_value} explicit-null', tmp) self.assertIn(f' segment-routing prefix {prefix_four} absolute {prefix_four_value} no-php-flag', tmp) + def test_isis_08_ldp_sync(self): + holddown = "500" + interface = 'lo' + + self.cli_set(base_path + ['net', net]) + self.cli_set(base_path + ['interface', interface]) + self.cli_set(base_path + ['ldp-sync', 'holddown', holddown]) + + # Commit main ISIS changes + self.cli_commit() + + # Verify main ISIS changes + tmp = self.getFRRconfig(f'router isis {domain}', daemon='isisd') + self.assertIn(f' net {net}', tmp) + self.assertIn(f' mpls ldp-sync', tmp) + self.assertIn(f' mpls ldp-sync holddown {holddown}', tmp) + + for interface in self._interfaces: + self.cli_set(base_path + ['interface', interface, 'ldp-sync', 'holddown', holddown]) + + # Commit interface changes for holddown + self.cli_commit() + + # Verify interface changes for holddown + tmp = self.getFRRconfig(f'interface {interface}', daemon='isisd') + self.assertIn(f'interface {interface}', tmp) + self.assertIn(f' ip router isis {domain}', tmp) + self.assertIn(f' ipv6 router isis {domain}', tmp) + self.assertIn(f' isis mpls ldp-sync holddown {holddown}', tmp) + + for interface in self._interfaces: + self.cli_set(base_path + ['interface', interface, 'ldp-sync', 'disable']) + + # Commit interface changes for disable + self.cli_commit() + + # Verify interface changes for disable + tmp = self.getFRRconfig(f'interface {interface}', daemon='isisd') + self.assertIn(f'interface {interface}', tmp) + self.assertIn(f' ip router isis {domain}', tmp) + self.assertIn(f' ipv6 router isis {domain}', tmp) + self.assertIn(f' no isis mpls ldp-sync', tmp) + if __name__ == '__main__': unittest.main(verbosity=2) diff --git a/smoketest/scripts/cli/test_protocols_ospf.py b/smoketest/scripts/cli/test_protocols_ospf.py index 581959b15..d4c85f2b2 100755 --- a/smoketest/scripts/cli/test_protocols_ospf.py +++ b/smoketest/scripts/cli/test_protocols_ospf.py @@ -434,6 +434,47 @@ class TestProtocolsOSPF(VyOSUnitTestSHIM.TestCase): self.assertIn(f' segment-routing prefix {prefix_one} index {prefix_one_value} explicit-null', frrconfig) self.assertIn(f' segment-routing prefix {prefix_two} index {prefix_two_value} no-php-flag', frrconfig) + def test_ospf_15_ldp_sync(self): + holddown = "500" + interface = 'lo' + interfaces = Section.interfaces('ethernet') + + self.cli_set(base_path + ['interface', interface]) + self.cli_set(base_path + ['ldp-sync', 'holddown', holddown]) + + # Commit main OSPF changes + self.cli_commit() + + # Verify main OSPF changes + frrconfig = self.getFRRconfig('router ospf') + self.assertIn(f'router ospf', frrconfig) + self.assertIn(f' timers throttle spf 200 1000 10000', frrconfig) + self.assertIn(f' mpls ldp-sync holddown {holddown}', frrconfig) + + for interface in interfaces: + self.cli_set(base_path + ['interface', interface, 'ldp-sync', 'holddown', holddown]) + + # Commit interface changes for holddown + self.cli_commit() + + # Verify interface changes for holddown + config = self.getFRRconfig(f'interface {interface}') + self.assertIn(f'interface {interface}', config) + self.assertIn(f' ip ospf dead-interval 40', config) + self.assertIn(f' ip ospf mpls ldp-sync', config) + self.assertIn(f' ip ospf mpls ldp-sync holddown {holddown}', config) + + for interface in interfaces: + self.cli_set(base_path + ['interface', interface, 'ldp-sync', 'disable']) + + # Commit interface changes for disable + self.cli_commit() + + # Verify interface changes for disable + config = self.getFRRconfig(f'interface {interface}') + self.assertIn(f'interface {interface}', config) + self.assertIn(f' ip ospf dead-interval 40', config) + self.assertIn(f' no ip ospf mpls ldp-sync', config) if __name__ == '__main__': unittest.main(verbosity=2) -- cgit v1.2.3 From f14de93cdb1d1e366603d10d8d51994d9eb4bb8b Mon Sep 17 00:00:00 2001 From: mkorobeinikov <92354771+mkorobeinikov@users.noreply.github.com> Date: Sun, 2 Apr 2023 07:29:14 +0300 Subject: T5137: refactoring the tech-support command Refactoring the tech-support command from .sh to .py --- op-mode-definitions/show-techsupport_report.xml.in | 17 + src/op_mode/show_techsupport_report.py | 438 +++++++++++++++++++++ 2 files changed, 455 insertions(+) create mode 100644 op-mode-definitions/show-techsupport_report.xml.in create mode 100644 src/op_mode/show_techsupport_report.py (limited to 'op-mode-definitions') diff --git a/op-mode-definitions/show-techsupport_report.xml.in b/op-mode-definitions/show-techsupport_report.xml.in new file mode 100644 index 000000000..6f38105f8 --- /dev/null +++ b/op-mode-definitions/show-techsupport_report.xml.in @@ -0,0 +1,17 @@ + + + + + + + + + Show consolidated tech-support report (contains private information) + + ${vyos_op_scripts_dir}/show_techsupport_report.py + + + + + + diff --git a/src/op_mode/show_techsupport_report.py b/src/op_mode/show_techsupport_report.py new file mode 100644 index 000000000..13ed9a3c1 --- /dev/null +++ b/src/op_mode/show_techsupport_report.py @@ -0,0 +1,438 @@ +#!/usr/bin/env python3 +# +# Copyright (C) 2023 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 . + +from vyos.util import call +import os + + +def header(cmd): + print(16 * '-' + '\n' + cmd + '\n' + 16 * '-') + return + + +# get intefaces info +interfaces_list = os.popen('ls /sys/class/net/ | grep eth').read().split() +bridges_list = os.popen('ls /sys/class/net/ | grep br').read().split() + +###################### THE PART OF CONFIGURATION ###################### + +cmd_list_conf = [ + "VyOS Version and Package Changes%/opt/vyatta/bin/vyatta-op-cmd-wrapper show version all", + "Configuration File%cat /opt/vyatta/etc/config/config.boot", + "Running configuration%/opt/vyatta/bin/vyatta-op-cmd-wrapper show configuration", + "Package Repository Configuration File%cat /etc/apt/sources.list", + "User Startup Scripts%cat /etc/rc.local", + "Quagga Configuration%vtysh -c 'show run'" +] + + +def CONFIGURATION(cmd): + for command_line in cmd: + line = command_line.split('%') + head = line[0] + command = line[1] + header(head) + call(command) + return + + +###################### THE PART OF INTERFACES ###################### + +cmd_list_int = [ + "Interfaces%/opt/vyatta/bin/vyatta-op-cmd-wrapper show interfaces", + "Ethernet", + "Interface statistics%ip -s link show", + "Physical Interface statistics for%ethtool -S", + "Physical Interface Details for %/opt/vyatta/bin/vyatta-op-cmd-wrapper show interfaces ethernet%ethtool -k $eth", + "ARP Table (Total entries)%/opt/vyatta/bin/vyatta-op-cmd-wrapper show arp", + "Number of incomplete entries in ARP table%show arp | grep incomplete | wc -l", + "Bridges" +] + + +def INTERFACES(cmd): + for command_line in cmd: + line = command_line.split('%') + head = line[0] + if command_line.startswith("Ethernet"): + header(command_line) + elif command_line.startswith("Physical Interface statistics"): + for command_interface in interfaces_list: + header(f'{head} {command_interface}') + call(f'{line[1]} {command_interface}') + elif command_line.startswith("Physical Interface Details"): + for command_interface in interfaces_list: + header(f'{head} {command_interface}') + call(f'{line[1]} {command_interface} physical') + call(f'{line[2]} {command_interface}') + elif command_line.startswith("Bridges"): + header(command_line) + for command_interface in bridges_list: + header(f'Information for {command_interface}') + call(f'/sbin/brctl showstp {command_interface}') + call(f'/sbin/brctl showmacs {command_interface}') + else: + command = line[1] + header(head) + call(command) + return + + +###################### THE PART OF ROUTING ###################### + +cmd_list_route = [ + "show ip route bgp", + "show ip route cache", + "show ip route connected", + "show ip route forward", + "show ip route isis", + "show ip route kernel", + "show ip route ospf", + "show ip route rip", + "show ip route static", + "show ip route summary", + "show ip route supernets-only", + "show ip route table", + "show ip route tag", + "show ip route vrf", + "show ipv6 route bgp", + "show ipv6 route cache", + "show ipv6 route connected", + "show ipv6 route forward", + "show ipv6 route isis", + "show ipv6 route kernel", + "show ipv6 route ospf", + "show ipv6 route rip", + "show ipv6 route static", + "show ipv6 route summary", + "show ipv6 route supernets-only", + "show ipv6 route table", + "show ipv6 route tag", + "show ipv6 route vrf", +] + + +def ROUTING(cmd): + for command_line in cmd: + head = command_line + command = command_line + header(head) + call(f'/opt/vyatta/bin/vyatta-op-cmd-wrapper {command}') + return + + +###################### THE PART OF IPTABLES ###################### + +cmd_list_iptables = [ + "Filter Chain Details%sudo /sbin/iptables -L -vn", + "Nat Chain Details%sudo /sbin/iptables -t nat -L -vn", + "Mangle Chain Details%sudo /sbin/iptables -t mangle -L -vn", + "Raw Chain Details%sudo /sbin/iptables -t raw -L -vn", + "Save Iptables Rule-Set%sudo iptables-save -c" +] + + +def IPTABLES(cmd): + for command_line in cmd: + line = command_line.split('%') + head = line[0] + command = line[1] + header(head) + call(command) + return + + +###################### THE PART OF SYSTEM ###################### + +cmd_list_system = [ + "Show System Image Version%show system image version", + "Show System Image Storage%show system image storage", + "Current Time%date", + "Installed Packages%dpkg -l", + "Loaded Modules%cat /proc/modules", + "CPU", + "Installed CPU/s%lscpu", + "Cumulative CPU Time Used by Running Processes%top -n1 -b -S", + "Hardware Interrupt Counters%cat /proc/interrupts", + "Load Average%cat /proc/loadavg" +] + + +def SYSTEM(cmd): + for command_line in cmd: + line = command_line.split('%') + head = line[0] + if command_line.startswith("CPU"): + header(command_line) + elif line[1].startswith("show"): + header(head) + command = line[1] + call(f'/opt/vyatta/bin/vyatta-op-cmd-wrapper {command}') + else: + header(head) + command = line[1] + call(command) + return + + +###################### THE PART OF PROCESSES ###################### + +cmd_list_processes = [ + "Running Processes%ps -ef", + "Memory", + "Installed Memory%cat /proc/meminfo", + " Memory Usage%free", + "Storage", + "Devices%cat /proc/devices", + "Partitions%cat /proc/partitions", + "Partitioning for disks%fdisk -l /dev/" +] + + +def PROCESSES(cmd): + for command_line in cmd: + line = command_line.split('%') + head = line[0] + if command_line.startswith("Memory"): + header(command_line) + elif command_line.startswith("Storage"): + header(command_line) + elif command_line.startswith("Partitioning for disks"): + header(head) + disks = set() + with open('/proc/partitions') as partitions_file: + for line in partitions_file: + fields = line.strip().split() + if len(fields) == 4 and fields[3].isalpha() and fields[3] != 'name': + disks.add(fields[3]) + for disk in disks: + call(f'fdisk -l /dev/{disk}') + else: + header(head) + command = line[1] + call(command) + return + + +###################### THE PART OF CORE SECTION ###################### + +cmd_list_core = [ + "Mounts%cat /proc/mounts", + "Diskstats%cat /proc/diskstats", + "Hard Drive Usage%df -h -x squashfs", + # "General System", + "Boot Messages%cat /var/log/dmesg", + "Recent Kernel messages (dmesg)%dmesg", + "PCI Info%sudo lspci -vvx", + "PCI Vendor and Device Codes%sudo lspci -nn", + # "System Info%${vyatta_bindir}/vyatta-show-dmi", + "GRUB Command line%cat /proc/cmdline", + "Open Ports%sudo lsof -P -n -i", + "System Startup Files%ls -l /etc/rc?.d", + "Login History%last -ix", + "Recent Log Messages%tail -n 250 /var/log/messages", + "NTP%/opt/vyatta/bin/vyatta-op-cmd-wrapper show ntp", +] + + +def CORE(cmd): + for command_line in cmd: + line = command_line.split('%') + command = line[1] + header(line[0]) + call(command) + return + + +###################### THE PART OF VyOS INFORMATION ###################### + +cmd_list_vyos = [ + "BGP", + "header BGP Summary", + "show ip bgp summary", + "header BGP Neighbors", + "show ip bgp neighbors", + "header BGP Debugging Information", + "show monitoring protocols bgp", + "CLUSTERING", + "Cluster Status", + "show cluster status", + "DHCP Server", + "DHCP Leases", + "show dhcp server leases", + "DHCP Statistics", + "show dhcp server statistics", + "DHCP Client", + "DHCP Client Leases", + "show dhcp client leases", + "DHCPV6 Server", + "DHCPV6 Server Status", + "show dhcpv6 server status", + "DHCPV6 Server Leases", + "show dhcpv6 server leases", + "DHCPV6 Relay", + "DHCPV6 Relay Status", + "show dhcpv6 relay-agent status", + "DHCPV6 Client", + "DHCPV6 Client Leases", + "show dhcpv6 client leases", + "DNS", + "DNS Dynamic Status", + "show dns dynamic status", + "DNS Forwarding Statistics", + "show dns forwarding statistics", + "DNS Forwarding Nameservers", + "show dns forwarding nameservers", + "FIREWALL", + "Firewall Group", + "show firewall group", + "Firewall Summary", + "show firewall summary", + "Firewall Statistics", + "show firewall statistics", + "IPSec", + "IPSec Status", + "show vpn ipsec status", + "IPSec sa", + "show vpn ipsec sa", + "IPSec sa Detail", + "show vpn ipsec sa detail", + "IPSec sa Statistics", + "show vpn ipsec sa statistics", + "/etc/ipsec.conf", + "cat /etc/ipsec.conf", + "/etc/ipsec.secrets", + "cat /etc/ipsec.secrets", + "NAT", + "NAT Rules", + "show nat rules", + "NAT Statistics", + "show nat statistics", + "NAT Translations Detail", + "show nat translations detail", + "FlowAccounting", + "show flow-accounting", + "OPENVPN", + "OpenVPN Interfaces", + "show interfaces openvpn detail", + "OpenVPN Server Status", + "show openvpn status server", + "OSPF", + "OSPF Neighbor", + "show ip ospf neighbor", + "OSPF Route", + "show ip ospf route", + "OSPF Debugging Information", + "show monitoring protocols ospf", + "OSPFV3", + "OSPFV3 Debugging Information", + "show monitoring protocols ospfv3", + "Policy", + "IP Route Maps", + "show ip protocol", + "Route-Map", + "show route-map", + # header IP Access Lists + # show ip access-lists + "IP Community List", + "show ip community-list", + "Traffic Policy", + "Current Traffic Policies", + "show queueing", + "RIP", + "IP RIP", + "show ip rip", + "RIP Status", + "show ip rip status", + "RIP Debugging Information", + "show monitoring protocols rip", + "RIPNG", + "RIPNG Debugging Information", + "show monitoring protocols ripng", + "VPN-L2TP", + "VPN ike secrets", + "show vpn ike secrets", + "VPN rsa-keys", + "show vpn ike rsa-keys", + "VPN ike sa", + "show vpn ike sa", + "VPN ike Status", + "show vpn ike status", + "VPN Remote-Access", + "show vpn remote-access", + "VPN Debug Detail", + "show vpn debug detail", + "VPN-PPTP", + "VPN Remote-Access", + "show vpn remote-access", + "VRRP", + # XXX: not checking if configured, we'd have to walk all VIFs + "show vrrp detail", + "WAN LOAD BALANCING", + "Wan Load Balance", + "show wan-load-balance", + "Wan Load Balance Status", + "show wan-load-balance status", + "Wan Load Balance Connection", + "show wan-load-balance connection", + "WEBPROXY/URL-FILTERING", + "WebProxy Blacklist Categories", + "show webproxy blacklist categories", + "WebProxy Blacklist Domains", + "show webproxy blacklist domains", + "WebProxy Blacklist URLs", + "show webproxy blacklist urls", + "WebProxy Blacklist Log", + "show webproxy blacklist log summary", +] + + +def VyOS(cmd): + for command_line in cmd: + if command_line.startswith("show"): + call(f'/opt/vyatta/bin/vyatta-op-cmd-wrapper {command_line}') + elif command_line.startswith("cat"): + call(command_line) + else: + header(command_line) + return + + +###################### execute all the commands ###################### + +header('CONFIGURATION') +CONFIGURATION(cmd_list_conf) + +header('INTERFACES') +INTERFACES(cmd_list_int) + +header('ROUTING') +ROUTING(cmd_list_route) + +header('IPTABLES') +IPTABLES(cmd_list_iptables) + +header('SYSTEM') +SYSTEM(cmd_list_system) + +header('PROCESSES') +PROCESSES(cmd_list_processes) + +header('CORE') +CORE(cmd_list_core) + +header('VyOS Information') +VyOS(cmd_list_vyos) -- cgit v1.2.3 From 6efdab7cccdd697b4479c9af9f000369c3729011 Mon Sep 17 00:00:00 2001 From: Tobias Fiebig Date: Fri, 10 Mar 2023 12:48:09 +0100 Subject: T5078: Added filtered-routes BGP command --- op-mode-definitions/include/bgp/afi-ipv4-ipv6-common.xml.i | 6 ++++++ op-mode-definitions/include/bgp/show-ip-bgp-common.xml.i | 6 ++++++ 2 files changed, 12 insertions(+) (limited to 'op-mode-definitions') 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 7dbc4fde5..820d507fd 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 @@ -195,6 +195,12 @@ + + + Show filtered routes from BGP neighbor + + ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ + Show received routes from BGP neighbor diff --git a/op-mode-definitions/include/bgp/show-ip-bgp-common.xml.i b/op-mode-definitions/include/bgp/show-ip-bgp-common.xml.i index 36cc9a3fa..db9021f3e 100644 --- a/op-mode-definitions/include/bgp/show-ip-bgp-common.xml.i +++ b/op-mode-definitions/include/bgp/show-ip-bgp-common.xml.i @@ -93,6 +93,12 @@ ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ + + + Show the filtered routes from neighbor + + ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ + Show the received routes from neighbor -- cgit v1.2.3 From 9347bfa209626167f7f04856a81fc4ccab1aaccd Mon Sep 17 00:00:00 2001 From: Cheeze_It Date: Sun, 9 Apr 2023 17:38:36 -0600 Subject: T5081: ISIS and OSPF syncronization with IGP-LDP sync --- op-mode-definitions/include/isis-common.xml.i | 22 +++------------------- op-mode-definitions/include/ldp-sync.xml.i | 19 +++++++++++++++++++ op-mode-definitions/include/ospf-common.xml.i | 20 ++------------------ 3 files changed, 24 insertions(+), 37 deletions(-) create mode 100644 op-mode-definitions/include/ldp-sync.xml.i (limited to 'op-mode-definitions') diff --git a/op-mode-definitions/include/isis-common.xml.i b/op-mode-definitions/include/isis-common.xml.i index 53e85a7ef..b5b4f9b5d 100644 --- a/op-mode-definitions/include/isis-common.xml.i +++ b/op-mode-definitions/include/isis-common.xml.i @@ -56,31 +56,15 @@ - Show IS-IS MPLS specific information + Show MPLS information - - - Show IS-IS LDP-IGP synchronization information - - ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ - - - - Show specific IS-IS LDP-IGP synchronization for an interface - - - - - ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ - - - + #include - Show IS-IS MPLS traffic engineering information + Show MPLS traffic engineering information diff --git a/op-mode-definitions/include/ldp-sync.xml.i b/op-mode-definitions/include/ldp-sync.xml.i new file mode 100644 index 000000000..b3be8f503 --- /dev/null +++ b/op-mode-definitions/include/ldp-sync.xml.i @@ -0,0 +1,19 @@ + + + + Show LDP-IGP synchronization information + + ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ + + + + Show specific LDP-IGP synchronization for an interface + + + + + ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ + + + + \ No newline at end of file diff --git a/op-mode-definitions/include/ospf-common.xml.i b/op-mode-definitions/include/ospf-common.xml.i index 7d9e541cf..d1a62b690 100644 --- a/op-mode-definitions/include/ospf-common.xml.i +++ b/op-mode-definitions/include/ospf-common.xml.i @@ -519,26 +519,10 @@ - Show OSPF MPLS specific information + Show MPLS information - - - Show OSPF LDP-IGP synchronization information - - ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ - - - - Show specific OSPF LDP-IGP synchronization for an interface - - - - - ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ - - - + #include -- cgit v1.2.3 From 47bd0d8ab940bd8bb9b7c852ac80e0d9a3728a82 Mon Sep 17 00:00:00 2001 From: Christian Breunig Date: Wed, 12 Apr 2023 21:46:07 +0200 Subject: xml: op-mode: T5081: re-use vtysh-generic-detail building block --- op-mode-definitions/include/isis-common.xml.i | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) (limited to 'op-mode-definitions') diff --git a/op-mode-definitions/include/isis-common.xml.i b/op-mode-definitions/include/isis-common.xml.i index b5b4f9b5d..53be33b68 100644 --- a/op-mode-definitions/include/isis-common.xml.i +++ b/op-mode-definitions/include/isis-common.xml.i @@ -4,12 +4,7 @@ Show IS-IS link state database - - - Show detailed information - - ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ - + #include ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ @@ -36,12 +31,7 @@ - - - Show detailed information - - ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ - + #include ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ @@ -95,12 +85,7 @@ Show IS-IS neighbor adjacencies - - - Show detailed information - - ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ - + #include ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ -- cgit v1.2.3 From 23c757dae9b164cdaeba334b509b4def9c71f9b3 Mon Sep 17 00:00:00 2001 From: Christian Breunig Date: Wed, 12 Apr 2023 21:47:31 +0200 Subject: xml: op-mode: T5081: introduce new FRR tagNode interface building block --- op-mode-definitions/include/isis-common.xml.i | 20 ++------------------ op-mode-definitions/include/ldp-sync.xml.i | 10 +--------- op-mode-definitions/include/ospf-common.xml.i | 10 +--------- .../include/vtysh-generic-interface-tagNode.xml.i | 11 +++++++++++ 4 files changed, 15 insertions(+), 36 deletions(-) create mode 100644 op-mode-definitions/include/vtysh-generic-interface-tagNode.xml.i (limited to 'op-mode-definitions') diff --git a/op-mode-definitions/include/isis-common.xml.i b/op-mode-definitions/include/isis-common.xml.i index 53be33b68..e94d868e8 100644 --- a/op-mode-definitions/include/isis-common.xml.i +++ b/op-mode-definitions/include/isis-common.xml.i @@ -35,15 +35,7 @@ ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ - - - Show specific IS-IS interface - - - - - ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ - +#include Show MPLS information @@ -69,15 +61,7 @@ ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ - - - Show specific IS-IS interface - - - - - ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ - + #include diff --git a/op-mode-definitions/include/ldp-sync.xml.i b/op-mode-definitions/include/ldp-sync.xml.i index b3be8f503..b7b04e7e5 100644 --- a/op-mode-definitions/include/ldp-sync.xml.i +++ b/op-mode-definitions/include/ldp-sync.xml.i @@ -5,15 +5,7 @@ ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ - - - Show specific LDP-IGP synchronization for an interface - - - - - ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ - + #include \ No newline at end of file diff --git a/op-mode-definitions/include/ospf-common.xml.i b/op-mode-definitions/include/ospf-common.xml.i index d1a62b690..aebbae5ff 100644 --- a/op-mode-definitions/include/ospf-common.xml.i +++ b/op-mode-definitions/include/ospf-common.xml.i @@ -508,15 +508,7 @@ ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ - - - Show IPv4 OSPF information for specified interface - - - - - ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ - +#include Show MPLS information diff --git a/op-mode-definitions/include/vtysh-generic-interface-tagNode.xml.i b/op-mode-definitions/include/vtysh-generic-interface-tagNode.xml.i new file mode 100644 index 000000000..e95961177 --- /dev/null +++ b/op-mode-definitions/include/vtysh-generic-interface-tagNode.xml.i @@ -0,0 +1,11 @@ + + + + Show information about specific interface + + + + + ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ + + -- cgit v1.2.3 From 78d846824df05682f63c2dc7d894aa501ed9f63f Mon Sep 17 00:00:00 2001 From: Christian Breunig Date: Thu, 13 Apr 2023 09:08:10 +0200 Subject: xml: T5137: fix empty node.def files --- Makefile | 1 + op-mode-definitions/show-techsupport_report.xml.in | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'op-mode-definitions') diff --git a/Makefile b/Makefile index 4f49f0d27..e130bec70 100644 --- a/Makefile +++ b/Makefile @@ -67,6 +67,7 @@ op_mode_definitions: $(op_xml_obj) rm -f $(OP_TMPL_DIR)/set/node.def rm -f $(OP_TMPL_DIR)/show/node.def rm -f $(OP_TMPL_DIR)/show/system/node.def + rm -f $(OP_TMPL_DIR)/show/tech-support/node.def # XXX: ping and traceroute must be able to recursivly call itself as the # options are provided from the script itself diff --git a/op-mode-definitions/show-techsupport_report.xml.in b/op-mode-definitions/show-techsupport_report.xml.in index 6f38105f8..aa51eacd9 100644 --- a/op-mode-definitions/show-techsupport_report.xml.in +++ b/op-mode-definitions/show-techsupport_report.xml.in @@ -2,7 +2,7 @@ - + -- cgit v1.2.3 From a6499ea9d95d2b66d7977cea1d43f96d0116d4c3 Mon Sep 17 00:00:00 2001 From: Christian Breunig Date: Mon, 17 Apr 2023 22:36:04 +0200 Subject: op-mode: bgp: T1315: add VNI related commands This extends commit 3fa1092930c (op-mode: bgp: support VRF related "show bgp vrf" commands). vyos@vyos:~$ show bgp vni Possible completions: 1-16777215 VXLAN network identifier (VNI) number all vyos@vyos:~$ show bgp vni 1 type Possible completions: 1 EAD (Type-1) route 2 MAC-IP (Type-2) route 3 Multicast (Type-3) route ead EAD (Type-1) route macip MAC-IP (Type-2) route multicast Multicast (Type-3) route vyos@vyos:~$ show bgp vni 1 vtep Possible completions: Remote VTEP IP address --- op-mode-definitions/include/bgp/evpn-type-1.xml.i | 8 +++ op-mode-definitions/include/bgp/evpn-type-2.xml.i | 8 +++ op-mode-definitions/include/bgp/evpn-type-3.xml.i | 8 +++ op-mode-definitions/include/bgp/evpn-type-4.xml.i | 8 +++ op-mode-definitions/include/bgp/evpn-type-5.xml.i | 8 +++ .../include/bgp/evpn-type-ead.xml.i | 8 +++ op-mode-definitions/include/bgp/evpn-type-es.xml.i | 8 +++ .../include/bgp/evpn-type-macip.xml.i | 8 +++ .../include/bgp/evpn-type-multicast.xml.i | 8 +++ .../include/bgp/evpn-type-prefix.xml.i | 8 +++ .../include/bgp/show-bgp-common.xml.i | 70 ++++------------------ op-mode-definitions/show-bgp.xml.in | 27 +++++++++ 12 files changed, 117 insertions(+), 60 deletions(-) create mode 100644 op-mode-definitions/include/bgp/evpn-type-1.xml.i create mode 100644 op-mode-definitions/include/bgp/evpn-type-2.xml.i create mode 100644 op-mode-definitions/include/bgp/evpn-type-3.xml.i create mode 100644 op-mode-definitions/include/bgp/evpn-type-4.xml.i create mode 100644 op-mode-definitions/include/bgp/evpn-type-5.xml.i create mode 100644 op-mode-definitions/include/bgp/evpn-type-ead.xml.i create mode 100644 op-mode-definitions/include/bgp/evpn-type-es.xml.i create mode 100644 op-mode-definitions/include/bgp/evpn-type-macip.xml.i create mode 100644 op-mode-definitions/include/bgp/evpn-type-multicast.xml.i create mode 100644 op-mode-definitions/include/bgp/evpn-type-prefix.xml.i (limited to 'op-mode-definitions') diff --git a/op-mode-definitions/include/bgp/evpn-type-1.xml.i b/op-mode-definitions/include/bgp/evpn-type-1.xml.i new file mode 100644 index 000000000..b5097c8b1 --- /dev/null +++ b/op-mode-definitions/include/bgp/evpn-type-1.xml.i @@ -0,0 +1,8 @@ + + + + EAD (Type-1) route + + ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ + + diff --git a/op-mode-definitions/include/bgp/evpn-type-2.xml.i b/op-mode-definitions/include/bgp/evpn-type-2.xml.i new file mode 100644 index 000000000..827298d62 --- /dev/null +++ b/op-mode-definitions/include/bgp/evpn-type-2.xml.i @@ -0,0 +1,8 @@ + + + + MAC-IP (Type-2) route + + ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ + + diff --git a/op-mode-definitions/include/bgp/evpn-type-3.xml.i b/op-mode-definitions/include/bgp/evpn-type-3.xml.i new file mode 100644 index 000000000..ae90b2e5c --- /dev/null +++ b/op-mode-definitions/include/bgp/evpn-type-3.xml.i @@ -0,0 +1,8 @@ + + + + Multicast (Type-3) route + + ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ + + diff --git a/op-mode-definitions/include/bgp/evpn-type-4.xml.i b/op-mode-definitions/include/bgp/evpn-type-4.xml.i new file mode 100644 index 000000000..7248b4753 --- /dev/null +++ b/op-mode-definitions/include/bgp/evpn-type-4.xml.i @@ -0,0 +1,8 @@ + + + + Ethernet Segment (Type-4) route + + ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ + + diff --git a/op-mode-definitions/include/bgp/evpn-type-5.xml.i b/op-mode-definitions/include/bgp/evpn-type-5.xml.i new file mode 100644 index 000000000..e3a72168a --- /dev/null +++ b/op-mode-definitions/include/bgp/evpn-type-5.xml.i @@ -0,0 +1,8 @@ + + + + Prefix (Type-5) route + + ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ + + diff --git a/op-mode-definitions/include/bgp/evpn-type-ead.xml.i b/op-mode-definitions/include/bgp/evpn-type-ead.xml.i new file mode 100644 index 000000000..452de2f9a --- /dev/null +++ b/op-mode-definitions/include/bgp/evpn-type-ead.xml.i @@ -0,0 +1,8 @@ + + + + EAD (Type-1) route + + ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ + + diff --git a/op-mode-definitions/include/bgp/evpn-type-es.xml.i b/op-mode-definitions/include/bgp/evpn-type-es.xml.i new file mode 100644 index 000000000..50c40151a --- /dev/null +++ b/op-mode-definitions/include/bgp/evpn-type-es.xml.i @@ -0,0 +1,8 @@ + + + + Ethernet Segment (Type-4) route + + ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ + + diff --git a/op-mode-definitions/include/bgp/evpn-type-macip.xml.i b/op-mode-definitions/include/bgp/evpn-type-macip.xml.i new file mode 100644 index 000000000..6f601eb3f --- /dev/null +++ b/op-mode-definitions/include/bgp/evpn-type-macip.xml.i @@ -0,0 +1,8 @@ + + + + MAC-IP (Type-2) route + + ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ + + diff --git a/op-mode-definitions/include/bgp/evpn-type-multicast.xml.i b/op-mode-definitions/include/bgp/evpn-type-multicast.xml.i new file mode 100644 index 000000000..5194dbb56 --- /dev/null +++ b/op-mode-definitions/include/bgp/evpn-type-multicast.xml.i @@ -0,0 +1,8 @@ + + + + Multicast (Type-3) route + + ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ + + diff --git a/op-mode-definitions/include/bgp/evpn-type-prefix.xml.i b/op-mode-definitions/include/bgp/evpn-type-prefix.xml.i new file mode 100644 index 000000000..d5054d86b --- /dev/null +++ b/op-mode-definitions/include/bgp/evpn-type-prefix.xml.i @@ -0,0 +1,8 @@ + + + + Prefix (Type-5) route + + ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ + + 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 c9a112fca..de794a879 100644 --- a/op-mode-definitions/include/bgp/show-bgp-common.xml.i +++ b/op-mode-definitions/include/bgp/show-bgp-common.xml.i @@ -171,66 +171,16 @@ Specify Route type - - - EAD (Type-1) route - - ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ - - - - MAC-IP (Type-2) route - - ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ - - - - Multicast (Type-3) route - - ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ - - - - Ethernet Segment (Type-4) route - - ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ - - - - Prefix (Type-5) route - - ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ - - - - EAD (Type-1) route - - ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ - - - - Ethernet Segment (Type-4) route - - ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ - - - - MAC-IP (Type-2) route - - ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ - - - - Multicast (Type-3) route - - ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ - - - - Prefix (Type-5) route - - ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ - + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include #include diff --git a/op-mode-definitions/show-bgp.xml.in b/op-mode-definitions/show-bgp.xml.in index 974147621..3c212614c 100644 --- a/op-mode-definitions/show-bgp.xml.in +++ b/op-mode-definitions/show-bgp.xml.in @@ -51,6 +51,33 @@ ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ + #include + + + + + Remote VTEP IP address + + <x.x.x.x> + + + ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ + + + + Display number of prefixes for all afi/safi + + + #include + #include + #include + #include + #include + #include + + + + Show BGP VRF information -- cgit v1.2.3