summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--interface-definitions/container.xml.in20
-rw-r--r--op-mode-definitions/monitor-log.xml.in136
-rw-r--r--op-mode-definitions/show-log.xml.in29
-rwxr-xr-xsrc/conf_mode/container.py16
4 files changed, 198 insertions, 3 deletions
diff --git a/interface-definitions/container.xml.in b/interface-definitions/container.xml.in
index 4bac305d1..b61664125 100644
--- a/interface-definitions/container.xml.in
+++ b/interface-definitions/container.xml.in
@@ -274,6 +274,26 @@
</valueHelp>
</properties>
</leafNode>
+ <leafNode name="mode">
+ <properties>
+ <help>Volume access mode ro/rw</help>
+ <completionHelp>
+ <list>ro rw</list>
+ </completionHelp>
+ <valueHelp>
+ <format>ro</format>
+ <description>Volume mounted into the container as read-only</description>
+ </valueHelp>
+ <valueHelp>
+ <format>rw</format>
+ <description>Volume mounted into the container as read-write</description>
+ </valueHelp>
+ <constraint>
+ <regex>(ro|rw)</regex>
+ </constraint>
+ </properties>
+ <defaultValue>rw</defaultValue>
+ </leafNode>
</children>
</tagNode>
</children>
diff --git a/op-mode-definitions/monitor-log.xml.in b/op-mode-definitions/monitor-log.xml.in
index 352c84ff1..7af9f9431 100644
--- a/op-mode-definitions/monitor-log.xml.in
+++ b/op-mode-definitions/monitor-log.xml.in
@@ -14,6 +14,142 @@
</properties>
<command>grc tail --follow=name /var/log/messages</command>
</node>
+ <node name="dhcp">
+ <properties>
+ <help>Show log for Dynamic Host Control Protocol (DHCP)</help>
+ </properties>
+ <children>
+ <node name="server">
+ <properties>
+ <help>Show log for DHCP server</help>
+ </properties>
+ <command>journalctl --no-hostname --boot --follow --unit isc-dhcp-server.service</command>
+ </node>
+ <node name="client">
+ <properties>
+ <help>Show DHCP client logs</help>
+ </properties>
+ <command>journalctl --no-hostname --boot --follow --unit "dhclient@*.service"</command>
+ <children>
+ <tagNode name="interface">
+ <properties>
+ <help>Show DHCP client log on specific interface</help>
+ <completionHelp>
+ <script>${vyos_completion_dir}/list_interfaces.py --broadcast</script>
+ </completionHelp>
+ </properties>
+ <command>journalctl --no-hostname --boot --follow --unit "dhclient@$6.service"</command>
+ </tagNode>
+ </children>
+ </node>
+ </children>
+ </node>
+ <node name="dhcpv6">
+ <properties>
+ <help>Show log for Dynamic Host Control Protocol IPv6 (DHCPv6)</help>
+ </properties>
+ <children>
+ <node name="server">
+ <properties>
+ <help>Show log for DHCPv6 server</help>
+ </properties>
+ <command>journalctl --no-hostname --boot --follow --unit isc-dhcp-server6.service</command>
+ </node>
+ <node name="client">
+ <properties>
+ <help>Show DHCPv6 client logs</help>
+ </properties>
+ <command>journalctl --no-hostname --boot --follow --unit "dhcp6c@*.service"</command>
+ <children>
+ <tagNode name="interface">
+ <properties>
+ <help>Show DHCPv6 client log on specific interface</help>
+ <completionHelp>
+ <script>${vyos_completion_dir}/list_interfaces.py</script>
+ </completionHelp>
+ </properties>
+ <command>journalctl --no-hostname --boot --follow --unit "dhcp6c@$6.service"</command>
+ </tagNode>
+ </children>
+ </node>
+ </children>
+ </node>
+ <leafNode name="https">
+ <properties>
+ <help>Show log for HTTPs</help>
+ </properties>
+ <command>journalctl --no-hostname --boot --follow --unit nginx.service</command>
+ </leafNode>
+ <leafNode name="ipoe-server">
+ <properties>
+ <help>Monitor last lines of IPoE server log</help>
+ </properties>
+ <command>journalctl --no-hostname --boot --follow --unit accel-ppp@ipoe.service</command>
+ </leafNode>
+ <leafNode name="lldp">
+ <properties>
+ <help>Show log for LLDP</help>
+ </properties>
+ <command>journalctl --no-hostname --boot --follow --unit lldpd.service</command>
+ </leafNode>
+ <node name="openvpn">
+ <properties>
+ <help>Show log for OpenVPN</help>
+ </properties>
+ <command>journalctl --no-hostname --boot --follow --unit openvpn@*.service</command>
+ <children>
+ <tagNode name="interface">
+ <properties>
+ <help>Show OpenVPN log on specific interface</help>
+ <completionHelp>
+ <path>interfaces openvpn</path>
+ </completionHelp>
+ </properties>
+ <command>journalctl --no-hostname --boot --follow --unit openvpn@$5.service</command>
+ </tagNode>
+ </children>
+ </node>
+ <node name="pppoe">
+ <properties>
+ <help>Monitor last lines of PPPoE interface log</help>
+ </properties>
+ <command>journalctl --no-hostname --boot --follow --unit "ppp@pppoe*.service"</command>
+ <children>
+ <tagNode name="interface">
+ <properties>
+ <help>Monitor last lines of PPPoE log for specific interface</help>
+ <completionHelp>
+ <path>interfaces pppoe</path>
+ </completionHelp>
+ </properties>
+ <command>journalctl --no-hostname --boot --follow --unit "ppp@$5.service"</command>
+ </tagNode>
+ </children>
+ </node>
+ <leafNode name="pppoe-server">
+ <properties>
+ <help>Monitor last lines of PPPoE server log</help>
+ </properties>
+ <command>journalctl --no-hostname --boot --follow --unit accel-ppp@pppoe.service</command>
+ </leafNode>
+ <leafNode name="snmp">
+ <properties>
+ <help>Show log for Simple Network Monitoring Protocol (SNMP)</help>
+ </properties>
+ <command>journalctl --no-hostname --boot --follow --unit snmpd.service</command>
+ </leafNode>
+ <leafNode name="vrrp">
+ <properties>
+ <help>Show log for Virtual Router Redundancy Protocol (VRRP)</help>
+ </properties>
+ <command>journalctl --no-hostname --boot --follow --unit keepalived.service</command>
+ </leafNode>
+ <leafNode name="webproxy">
+ <properties>
+ <help>Show log for Webproxy</help>
+ </properties>
+ <command>journalctl --no-hostname --boot --follow --unit squid.service</command>
+ </leafNode>
</children>
</node>
</children>
diff --git a/op-mode-definitions/show-log.xml.in b/op-mode-definitions/show-log.xml.in
index 4c0a7913b..9a8145f10 100644
--- a/op-mode-definitions/show-log.xml.in
+++ b/op-mode-definitions/show-log.xml.in
@@ -177,6 +177,12 @@
</tagNode>
</children>
</tagNode>
+ <leafNode name="ipoe-server">
+ <properties>
+ <help>Show log for IPoE server</help>
+ </properties>
+ <command>journalctl --no-hostname --boot --unit accel-ppp@ipoe.service</command>
+ </leafNode>
<leafNode name="kernel">
<properties>
<help>Show messages in kernel ring buffer</help>
@@ -212,6 +218,29 @@
</tagNode>
</children>
</node>
+ <node name="pppoe">
+ <properties>
+ <help>Show log for PPPoE interface</help>
+ </properties>
+ <command>journalctl --no-hostname --boot --unit "ppp@pppoe*.service"</command>
+ <children>
+ <tagNode name="interface">
+ <properties>
+ <help>Show PPPoE log on specific interface</help>
+ <completionHelp>
+ <path>interfaces pppoe</path>
+ </completionHelp>
+ </properties>
+ <command>journalctl --no-hostname --boot --unit "ppp@$5.service"</command>
+ </tagNode>
+ </children>
+ </node>
+ <leafNode name="pppoe-server">
+ <properties>
+ <help>Show log for PPPoE server</help>
+ </properties>
+ <command>journalctl --no-hostname --boot --unit accel-ppp@pppoe.service</command>
+ </leafNode>
<leafNode name="snmp">
<properties>
<help>Show log for Simple Network Monitoring Protocol (SNMP)</help>
diff --git a/src/conf_mode/container.py b/src/conf_mode/container.py
index 7567444db..08861053d 100755
--- a/src/conf_mode/container.py
+++ b/src/conf_mode/container.py
@@ -75,6 +75,8 @@ def get_config(config=None):
default_values = defaults(base + ['name'])
if 'port' in default_values:
del default_values['port']
+ if 'volume' in default_values:
+ del default_values['volume']
for name in container['name']:
container['name'][name] = dict_merge(default_values, container['name'][name])
@@ -85,6 +87,13 @@ def get_config(config=None):
default_values = defaults(base + ['name', 'port'])
container['name'][name]['port'][port] = dict_merge(
default_values, container['name'][name]['port'][port])
+ # XXX: T2665: we can not safely rely on the defaults() when there are
+ # tagNodes in place, it is better to blend in the defaults manually.
+ if 'volume' in container['name'][name]:
+ for volume in container['name'][name]['volume']:
+ default_values = defaults(base + ['name', 'volume'])
+ container['name'][name]['volume'][volume] = dict_merge(
+ default_values, container['name'][name]['volume'][volume])
# Delete container network, delete containers
tmp = node_changed(conf, base + ['network'])
@@ -245,7 +254,7 @@ def generate_run_arguments(name, container_config):
env_opt = ''
if 'environment' in container_config:
for k, v in container_config['environment'].items():
- env_opt += f" -e \"{k}={v['value']}\""
+ env_opt += f" --env \"{k}={v['value']}\""
# Publish ports
port = ''
@@ -255,7 +264,7 @@ def generate_run_arguments(name, container_config):
protocol = container_config['port'][portmap]['protocol']
sport = container_config['port'][portmap]['source']
dport = container_config['port'][portmap]['destination']
- port += f' -p {sport}:{dport}/{protocol}'
+ port += f' --publish {sport}:{dport}/{protocol}'
# Bind volume
volume = ''
@@ -263,7 +272,8 @@ def generate_run_arguments(name, container_config):
for vol, vol_config in container_config['volume'].items():
svol = vol_config['source']
dvol = vol_config['destination']
- volume += f' -v {svol}:{dvol}'
+ mode = vol_config['mode']
+ volume += f' --volume {svol}:{dvol}:{mode}'
container_base_cmd = f'--detach --interactive --tty --replace {cap_add} ' \
f'--memory {memory}m --shm-size {shared_memory}m --memory-swap 0 --restart {restart} ' \