summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNataliia Solomko <natalirs1985@gmail.com>2024-06-06 13:55:25 +0300
committerNataliia Solomko <natalirs1985@gmail.com>2024-06-06 18:39:50 +0300
commit61f8250184e927de9ab6bddc207b917bef7da42b (patch)
tree9ac7eb51bf728a3fa5b5ce07d95d162e9a287917
parentea477ed0cec87041cb94c0eb2bc2ce9523a92a0a (diff)
downloadvyos-1x-61f8250184e927de9ab6bddc207b917bef7da42b.tar.gz
vyos-1x-61f8250184e927de9ab6bddc207b917bef7da42b.zip
xml: T6423: enforce priority on nodes having an owner
-rw-r--r--interface-definitions/load-balancing_reverse-proxy.xml.in1
-rw-r--r--interface-definitions/load-balancing_wan.xml.in2
-rw-r--r--interface-definitions/protocols_static_arp.xml.in1
-rw-r--r--interface-definitions/protocols_static_multicast.xml.in1
-rw-r--r--interface-definitions/protocols_static_neighbor-proxy.xml.in1
-rw-r--r--interface-definitions/service_aws_glb.xml.in2
-rw-r--r--interface-definitions/service_config-sync.xml.in1
-rw-r--r--interface-definitions/service_console-server.xml.in1
-rw-r--r--interface-definitions/service_event-handler.xml.in1
-rw-r--r--interface-definitions/service_monitoring_telegraf.xml.in2
-rw-r--r--interface-definitions/service_monitoring_zabbix-agent.xml.in1
-rw-r--r--interface-definitions/service_sla.xml.in1
-rw-r--r--interface-definitions/system_login_banner.xml.in1
-rw-r--r--interface-definitions/system_proxy.xml.in1
-rwxr-xr-xscripts/build-command-templates12
15 files changed, 25 insertions, 4 deletions
diff --git a/interface-definitions/load-balancing_reverse-proxy.xml.in b/interface-definitions/load-balancing_reverse-proxy.xml.in
index e50e6e579..09fa9eb29 100644
--- a/interface-definitions/load-balancing_reverse-proxy.xml.in
+++ b/interface-definitions/load-balancing_reverse-proxy.xml.in
@@ -5,6 +5,7 @@
<node name="reverse-proxy" owner="${vyos_conf_scripts_dir}/load-balancing_reverse-proxy.py">
<properties>
<help>Configure reverse-proxy</help>
+ <priority>900</priority>
</properties>
<children>
<tagNode name="service">
diff --git a/interface-definitions/load-balancing_wan.xml.in b/interface-definitions/load-balancing_wan.xml.in
index e117fd1b2..310aa0343 100644
--- a/interface-definitions/load-balancing_wan.xml.in
+++ b/interface-definitions/load-balancing_wan.xml.in
@@ -3,12 +3,12 @@
<node name="load-balancing">
<properties>
<help>Configure load-balancing</help>
- <priority>900</priority>
</properties>
<children>
<node name="wan" owner="${vyos_conf_scripts_dir}/load-balancing_wan.py">
<properties>
<help>Configure Wide Area Network (WAN) load-balancing</help>
+ <priority>900</priority>
</properties>
<children>
<leafNode name="disable-source-nat">
diff --git a/interface-definitions/protocols_static_arp.xml.in b/interface-definitions/protocols_static_arp.xml.in
index 05c69f1ed..0c5d6e4ed 100644
--- a/interface-definitions/protocols_static_arp.xml.in
+++ b/interface-definitions/protocols_static_arp.xml.in
@@ -7,6 +7,7 @@
<node name="arp" owner="${vyos_conf_scripts_dir}/protocols_static_arp.py">
<properties>
<help>Static ARP translation</help>
+ <priority>481</priority>
</properties>
<children>
<tagNode name="interface">
diff --git a/interface-definitions/protocols_static_multicast.xml.in b/interface-definitions/protocols_static_multicast.xml.in
index c8e28ed35..caf95ed7c 100644
--- a/interface-definitions/protocols_static_multicast.xml.in
+++ b/interface-definitions/protocols_static_multicast.xml.in
@@ -7,6 +7,7 @@
<node name="multicast" owner="${vyos_conf_scripts_dir}/protocols_static_multicast.py">
<properties>
<help>Multicast static route</help>
+ <priority>481</priority>
</properties>
<children>
<tagNode name="route">
diff --git a/interface-definitions/protocols_static_neighbor-proxy.xml.in b/interface-definitions/protocols_static_neighbor-proxy.xml.in
index 1c8433a39..7347976f9 100644
--- a/interface-definitions/protocols_static_neighbor-proxy.xml.in
+++ b/interface-definitions/protocols_static_neighbor-proxy.xml.in
@@ -7,6 +7,7 @@
<node name="neighbor-proxy" owner="${vyos_conf_scripts_dir}/protocols_static_neighbor-proxy.py">
<properties>
<help>Neighbor proxy parameters</help>
+ <priority>481</priority>
</properties>
<children>
<tagNode name="arp">
diff --git a/interface-definitions/service_aws_glb.xml.in b/interface-definitions/service_aws_glb.xml.in
index c749fd04e..71de1f03a 100644
--- a/interface-definitions/service_aws_glb.xml.in
+++ b/interface-definitions/service_aws_glb.xml.in
@@ -5,12 +5,12 @@
<node name="aws">
<properties>
<help>Amazon Web Service</help>
- <priority>1280</priority>
</properties>
<children>
<node name="glb" owner="${vyos_conf_scripts_dir}/service_aws_glb.py">
<properties>
<help>Gateway load-balancer tunnel handler</help>
+ <priority>1280</priority>
</properties>
<children>
<node name="script">
diff --git a/interface-definitions/service_config-sync.xml.in b/interface-definitions/service_config-sync.xml.in
index 648c14aee..af4e8ed51 100644
--- a/interface-definitions/service_config-sync.xml.in
+++ b/interface-definitions/service_config-sync.xml.in
@@ -5,6 +5,7 @@
<node name="config-sync" owner="${vyos_conf_scripts_dir}/service_config-sync.py">
<properties>
<help>Configuration synchronization</help>
+ <priority>10000</priority>
</properties>
<children>
<node name="secondary">
diff --git a/interface-definitions/service_console-server.xml.in b/interface-definitions/service_console-server.xml.in
index fc6dbe954..68835dafd 100644
--- a/interface-definitions/service_console-server.xml.in
+++ b/interface-definitions/service_console-server.xml.in
@@ -5,6 +5,7 @@
<node name="console-server" owner="${vyos_conf_scripts_dir}/service_console-server.py">
<properties>
<help>Serial Console Server</help>
+ <priority>2</priority>
</properties>
<children>
<tagNode name="device">
diff --git a/interface-definitions/service_event-handler.xml.in b/interface-definitions/service_event-handler.xml.in
index 2cee4f595..41540816b 100644
--- a/interface-definitions/service_event-handler.xml.in
+++ b/interface-definitions/service_event-handler.xml.in
@@ -5,6 +5,7 @@
<node name="event-handler" owner="${vyos_conf_scripts_dir}/service_event-handler.py">
<properties>
<help>Service event handler</help>
+ <priority>2</priority>
</properties>
<children>
<tagNode name="event">
diff --git a/interface-definitions/service_monitoring_telegraf.xml.in b/interface-definitions/service_monitoring_telegraf.xml.in
index 4d694114a..2624023ea 100644
--- a/interface-definitions/service_monitoring_telegraf.xml.in
+++ b/interface-definitions/service_monitoring_telegraf.xml.in
@@ -5,12 +5,12 @@
<node name="monitoring">
<properties>
<help>Monitoring services</help>
- <priority>1280</priority>
</properties>
<children>
<node name="telegraf" owner="${vyos_conf_scripts_dir}/service_monitoring_telegraf.py">
<properties>
<help>Telegraf metric collector</help>
+ <priority>1280</priority>
</properties>
<children>
<node name="influxdb">
diff --git a/interface-definitions/service_monitoring_zabbix-agent.xml.in b/interface-definitions/service_monitoring_zabbix-agent.xml.in
index 40f2df642..3754e9145 100644
--- a/interface-definitions/service_monitoring_zabbix-agent.xml.in
+++ b/interface-definitions/service_monitoring_zabbix-agent.xml.in
@@ -7,6 +7,7 @@
<node name="zabbix-agent" owner="${vyos_conf_scripts_dir}/service_monitoring_zabbix-agent.py">
<properties>
<help>Zabbix-agent settings</help>
+ <priority>1280</priority>
</properties>
<children>
<leafNode name="directory">
diff --git a/interface-definitions/service_sla.xml.in b/interface-definitions/service_sla.xml.in
index 0c4f8a591..2cd68195a 100644
--- a/interface-definitions/service_sla.xml.in
+++ b/interface-definitions/service_sla.xml.in
@@ -5,6 +5,7 @@
<node name="sla" owner="${vyos_conf_scripts_dir}/service_sla.py">
<properties>
<help>Service level agreement (SLA)</help>
+ <priority>2</priority>
</properties>
<children>
<node name="owamp-server">
diff --git a/interface-definitions/system_login_banner.xml.in b/interface-definitions/system_login_banner.xml.in
index 211505ae4..c90e38c3c 100644
--- a/interface-definitions/system_login_banner.xml.in
+++ b/interface-definitions/system_login_banner.xml.in
@@ -11,6 +11,7 @@
<node name="banner" owner="${vyos_conf_scripts_dir}/system_login_banner.py">
<properties>
<help>System login banners</help>
+ <priority>410</priority>
</properties>
<children>
<leafNode name="post-login">
diff --git a/interface-definitions/system_proxy.xml.in b/interface-definitions/system_proxy.xml.in
index 214534dbb..5b0df5c70 100644
--- a/interface-definitions/system_proxy.xml.in
+++ b/interface-definitions/system_proxy.xml.in
@@ -5,6 +5,7 @@
<node name="proxy" owner="${vyos_conf_scripts_dir}/system_proxy.py">
<properties>
<help>Sets a proxy for system wide use</help>
+ <priority>100</priority>
</properties>
<children>
<leafNode name="url">
diff --git a/scripts/build-command-templates b/scripts/build-command-templates
index 2e7f8b994..36929abb2 100755
--- a/scripts/build-command-templates
+++ b/scripts/build-command-templates
@@ -287,6 +287,12 @@ def process_node(n, tmpl_dir):
props = get_properties(props_elem, n.find("defaultValue"))
if owner:
props["owner"] = owner
+ # <priority> tag is mandatory if the parent node has an owner
+ if "priority" not in props:
+ raise ValueError(
+ f"<priority> tag should be set for the node <{name}> path '{' '.join(my_tmpl_dir[1:])}'"
+ )
+
# Type should not be set for non-tag, non-leaf nodes
# For non-valueless leaf nodes, set the type to txt: to make them have some type,
# actual value validation is handled by constraints translated to syntax:expression:
@@ -335,4 +341,8 @@ nodes = root.iterfind("*")
for n in nodes:
if n.tag == "syntaxVersion":
continue
- process_node(n, [output_dir])
+ try:
+ process_node(n, [output_dir])
+ except ValueError as e:
+ print(e)
+ sys.exit(1)