summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debian/control2
-rw-r--r--op-mode-definitions/monitor-log.xml.in8
-rw-r--r--python/vyos/template.py5
-rw-r--r--smoketest/configs/bgp-bfd-communities2
-rwxr-xr-xsmoketest/scripts/cli/test_interfaces_l2tpv3.py3
-rwxr-xr-xsrc/completion/list_bgp_neighbors.sh3
-rwxr-xr-xsrc/completion/list_bgp_peer_groups.sh3
-rwxr-xr-xsrc/conf_mode/protocols_bgp.py8
-rw-r--r--src/tests/test_template.py10
9 files changed, 37 insertions, 7 deletions
diff --git a/debian/control b/debian/control
index 24e43d4c8..4351bf3d9 100644
--- a/debian/control
+++ b/debian/control
@@ -49,6 +49,7 @@ Depends:
file,
frr,
frr-pythontools,
+ grc,
hostapd (>= 0.6.8),
hvinfo,
igmpproxy,
@@ -70,6 +71,7 @@ Depends:
lm-sensors,
lsscsi,
mdns-repeater,
+ minisign,
mtr-tiny,
netplug,
nftables (>= 0.9.3),
diff --git a/op-mode-definitions/monitor-log.xml.in b/op-mode-definitions/monitor-log.xml.in
index 99efe5306..352c84ff1 100644
--- a/op-mode-definitions/monitor-log.xml.in
+++ b/op-mode-definitions/monitor-log.xml.in
@@ -7,6 +7,14 @@
<help>Monitor last lines of messages file</help>
</properties>
<command>tail --follow=name /var/log/messages</command>
+ <children>
+ <node name="colored">
+ <properties>
+ <help>Output log in a colored fashion</help>
+ </properties>
+ <command>grc tail --follow=name /var/log/messages</command>
+ </node>
+ </children>
</node>
</children>
</node>
diff --git a/python/vyos/template.py b/python/vyos/template.py
index 85e4d12b3..7810f5edd 100644
--- a/python/vyos/template.py
+++ b/python/vyos/template.py
@@ -207,6 +207,11 @@ def network_from_ipv4(address):
cidr_prefix = ip_interface(f'{address}/{netmask}').network
return address_from_cidr(cidr_prefix)
+@register_filter('is_interface')
+def is_interface(interface):
+ """ Check if parameter is a valid local interface name """
+ return os.path.exists(f'/sys/class/net/{interface}')
+
@register_filter('is_ip')
def is_ip(addr):
""" Check addr if it is an IPv4 or IPv6 address """
diff --git a/smoketest/configs/bgp-bfd-communities b/smoketest/configs/bgp-bfd-communities
index 3b3056a51..1a331f9ff 100644
--- a/smoketest/configs/bgp-bfd-communities
+++ b/smoketest/configs/bgp-bfd-communities
@@ -421,8 +421,6 @@ protocols {
local 220
}
}
- graceful-restart {
- }
}
peer-group DAL13 {
address-family {
diff --git a/smoketest/scripts/cli/test_interfaces_l2tpv3.py b/smoketest/scripts/cli/test_interfaces_l2tpv3.py
index 24cb9464e..a2091ff10 100755
--- a/smoketest/scripts/cli/test_interfaces_l2tpv3.py
+++ b/smoketest/scripts/cli/test_interfaces_l2tpv3.py
@@ -58,4 +58,7 @@ class GeneveInterfaceTest(BasicInterfaceTest.TestCase):
if __name__ == '__main__':
+ # when re-running this test, cleanup loaded modules first so they are
+ # reloaded on demand - not needed but test more and more features
+ cmd('sudo rmmod l2tp_ip6 l2tp_eth l2tp_eth l2tp_netlink l2tp_core')
unittest.main(verbosity=2)
diff --git a/src/completion/list_bgp_neighbors.sh b/src/completion/list_bgp_neighbors.sh
index 77c626452..f74f102ef 100755
--- a/src/completion/list_bgp_neighbors.sh
+++ b/src/completion/list_bgp_neighbors.sh
@@ -30,8 +30,7 @@ while [[ "$#" -gt 0 ]]; do
done
declare -a vals
-eval "bgp_as=$(cli-shell-api listActiveNodes protocols bgp)"
-eval "vals=($(cli-shell-api listActiveNodes protocols bgp $bgp_as neighbor))"
+eval "vals=($(cli-shell-api listActiveNodes protocols bgp neighbor))"
if [ $ipv4 -eq 1 ] && [ $ipv6 -eq 1 ]; then
echo -n '<x.x.x.x>' '<h:h:h:h:h:h:h:h>' ${vals[@]}
diff --git a/src/completion/list_bgp_peer_groups.sh b/src/completion/list_bgp_peer_groups.sh
index 4503d608f..1684271f8 100755
--- a/src/completion/list_bgp_peer_groups.sh
+++ b/src/completion/list_bgp_peer_groups.sh
@@ -16,8 +16,7 @@
# Return BGP peer-groups from CLI
declare -a vals
-eval "bgp_as=$(cli-shell-api listNodes protocols bgp)"
-eval "vals=($(cli-shell-api listNodes protocols bgp $bgp_as peer-group))"
+eval "vals=($(cli-shell-api listNodes protocols bgp peer-group))"
echo -n ${vals[@]}
exit 0
diff --git a/src/conf_mode/protocols_bgp.py b/src/conf_mode/protocols_bgp.py
index 73cfa9b83..8304df2e5 100755
--- a/src/conf_mode/protocols_bgp.py
+++ b/src/conf_mode/protocols_bgp.py
@@ -22,6 +22,7 @@ from sys import argv
from vyos.config import Config
from vyos.configdict import dict_merge
from vyos.template import is_ip
+from vyos.template import is_interface
from vyos.template import render_to_string
from vyos.util import call
from vyos.util import dict_search
@@ -128,7 +129,12 @@ def verify(bgp):
# Only checks for ipv4 and ipv6 neighbors
# Check if neighbor address is assigned as system interface address
if is_ip(peer) and is_addr_assigned(peer):
- raise ConfigError(f'Can\'t configure local address as neighbor "{peer}"')
+ raise ConfigError(f'Can not configure a local address as neighbor "{peer}"')
+ elif is_interface(peer):
+ if 'peer_group' in peer_config:
+ raise ConfigError(f'peer-group must be set under the interface node of "{peer}"')
+ if 'remote_as' in peer_config:
+ raise ConfigError(f'remote-as must be set under the interface node of "{peer}"')
for afi in ['ipv4_unicast', 'ipv6_unicast', 'l2vpn_evpn']:
# Bail out early if address family is not configured
diff --git a/src/tests/test_template.py b/src/tests/test_template.py
index 7800d007f..67c0fe84a 100644
--- a/src/tests/test_template.py
+++ b/src/tests/test_template.py
@@ -14,13 +14,23 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+import os
import vyos.template
+
from unittest import TestCase
class TestVyOSTemplate(TestCase):
def setUp(self):
pass
+ def test_is_interface(self):
+ for interface in ['lo', 'eth0']:
+ if os.path.exists(f'/sys/class/net/{interface}'):
+ self.assertTrue(vyos.template.is_interface(interface))
+ else:
+ self.assertFalse(vyos.template.is_interface(interface))
+ self.assertFalse(vyos.template.is_interface('non-existent'))
+
def test_is_ip(self):
self.assertTrue(vyos.template.is_ip('192.0.2.1'))
self.assertTrue(vyos.template.is_ip('2001:db8::1'))