summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--op-mode-definitions/show-interfaces-pppoe.xml2
-rw-r--r--schema/op-mode-definition.rnc4
-rw-r--r--schema/op-mode-definition.rng5
-rwxr-xr-xsrc/conf_mode/interfaces-l2tpv3.py5
-rwxr-xr-xsrc/op_mode/show_interfaces.py37
5 files changed, 48 insertions, 5 deletions
diff --git a/op-mode-definitions/show-interfaces-pppoe.xml b/op-mode-definitions/show-interfaces-pppoe.xml
index e68d05da9..211ad9808 100644
--- a/op-mode-definitions/show-interfaces-pppoe.xml
+++ b/op-mode-definitions/show-interfaces-pppoe.xml
@@ -11,7 +11,7 @@
<script>${vyos_completion_dir}/list_pppoe_peers.sh</script>
</completionHelp>
</properties>
- <command>${vyos_op_scripts_dir}/show_interfaces.py pppoe --intf="$4"</command>
+ <command>${vyos_op_scripts_dir}/show_interfaces.py --intf="$4"</command>
<children>
<node name="log">
<properties>
diff --git a/schema/op-mode-definition.rnc b/schema/op-mode-definition.rnc
index 9c84de0e4..cbe51e6dc 100644
--- a/schema/op-mode-definition.rnc
+++ b/schema/op-mode-definition.rnc
@@ -24,7 +24,7 @@
# Interface definition starts with interfaceDefinition tag that may contain node tags
start = element interfaceDefinition
{
- node*
+ (node | tagNode)*
}
# node tag may contain node, leafNode, or tagNode tags
@@ -43,7 +43,7 @@ node = element node
tagNode = element tagNode
{
nodeNameAttr,
- (properties? & children & command?)
+ (properties? & children? & command?)
}
# Leaf nodes are terminal configuration nodes that can't have children,
diff --git a/schema/op-mode-definition.rng b/schema/op-mode-definition.rng
index e9e7887cf..900f41e27 100644
--- a/schema/op-mode-definition.rng
+++ b/schema/op-mode-definition.rng
@@ -29,7 +29,10 @@
<start>
<element name="interfaceDefinition">
<zeroOrMore>
- <ref name="node"/>
+ <choice>
+ <ref name="node"/>
+ <ref name="tagNode"/>
+ </choice>
</zeroOrMore>
</element>
</start>
diff --git a/src/conf_mode/interfaces-l2tpv3.py b/src/conf_mode/interfaces-l2tpv3.py
index 8c3a8279e..33cf62f70 100755
--- a/src/conf_mode/interfaces-l2tpv3.py
+++ b/src/conf_mode/interfaces-l2tpv3.py
@@ -24,7 +24,7 @@ from vyos.config import Config
from vyos.ifconfig import L2TPv3If, Interface
from vyos import ConfigError
from vyos.util import call
-from vyos.validate import is_bridge_member
+from vyos.validate import is_bridge_member, is_addr_assigned
default_config_data = {
'address': [],
@@ -175,6 +175,9 @@ def verify(l2tpv3):
if not l2tpv3['local_address']:
raise ConfigError(f'Must configure the l2tpv3 local-ip for {interface}')
+ if not is_addr_assigned(l2tpv3['local_address']):
+ raise ConfigError(f'Must use a configured IP on l2tpv3 local-ip for {interface}')
+
if not l2tpv3['remote_address']:
raise ConfigError(f'Must configure the l2tpv3 remote-ip for {interface}')
diff --git a/src/op_mode/show_interfaces.py b/src/op_mode/show_interfaces.py
index 8b6690b7d..7041c7e16 100755
--- a/src/op_mode/show_interfaces.py
+++ b/src/op_mode/show_interfaces.py
@@ -18,6 +18,7 @@
import os
import re
import sys
+import glob
import datetime
import argparse
import netifaces
@@ -146,9 +147,20 @@ def run_allowed(**kwarg):
sys.stdout.write(' '.join(Section.interfaces()))
+def pppoe(ifname):
+ out = cmd(f'ps -C pppd -f')
+ if ifname in out:
+ return 'C'
+ elif ifname in [_.split('/')[-1] for _ in glob.glob('/etc/ppp/peers/pppoe*')]:
+ return 'D'
+ return ''
+
+
@register('show')
def run_show_intf(ifnames, iftypes, vif, vrrp):
+ handled = []
for interface in filtered_interfaces(ifnames, iftypes, vif, vrrp):
+ handled.append(interface.ifname)
cache = interface.operational.load_counters()
out = cmd(f'ip addr show {interface.ifname}')
@@ -173,6 +185,17 @@ def run_show_intf(ifnames, iftypes, vif, vrrp):
print()
print(interface.operational.formated_stats())
+ for ifname in ifnames:
+ if ifname not in handled and ifname.startswith('pppoe'):
+ state = pppoe(ifname)
+ if not state:
+ continue
+ string = {
+ 'C': 'Coming up',
+ 'D': 'Link down',
+ }[state]
+ print('{}: {}'.format(ifname, string))
+
@register('show-brief')
def run_show_intf_brief(ifnames, iftypes, vif, vrrp):
@@ -183,7 +206,10 @@ def run_show_intf_brief(ifnames, iftypes, vif, vrrp):
print(format1 % ("Interface", "IP Address", "S/L", "Description"))
print(format1 % ("---------", "----------", "---", "-----------"))
+ handled = []
for interface in filtered_interfaces(ifnames, iftypes, vif, vrrp):
+ handled.append(interface.ifname)
+
oper_state = interface.operational.get_state()
admin_state = interface.get_admin_state()
@@ -206,6 +232,17 @@ def run_show_intf_brief(ifnames, iftypes, vif, vrrp):
print(format2 % (i, a))
print(format1 % ('', '', '/'.join(s+l), d))
+ for ifname in ifnames:
+ if ifname not in handled and ifname.startswith('pppoe'):
+ state = pppoe(ifname)
+ if not state:
+ continue
+ string = {
+ 'C': 'u/D',
+ 'D': 'A/D',
+ }[state]
+ print(format1 % (ifname, '', string, ''))
+
@register('show-count')
def run_show_counters(ifnames, iftypes, vif, vrrp):