diff options
-rw-r--r-- | interface-definitions/load-balancing_reverse-proxy.xml.in | 1 | ||||
-rw-r--r-- | interface-definitions/load-balancing_wan.xml.in | 2 | ||||
-rw-r--r-- | interface-definitions/protocols_static_arp.xml.in | 1 | ||||
-rw-r--r-- | interface-definitions/protocols_static_multicast.xml.in | 1 | ||||
-rw-r--r-- | interface-definitions/protocols_static_neighbor-proxy.xml.in | 1 | ||||
-rw-r--r-- | interface-definitions/service_config-sync.xml.in | 1 | ||||
-rw-r--r-- | interface-definitions/service_console-server.xml.in | 1 | ||||
-rw-r--r-- | interface-definitions/service_event-handler.xml.in | 1 | ||||
-rw-r--r-- | interface-definitions/service_monitoring_telegraf.xml.in | 2 | ||||
-rw-r--r-- | interface-definitions/service_monitoring_zabbix-agent.xml.in | 1 | ||||
-rw-r--r-- | interface-definitions/service_sla.xml.in | 1 | ||||
-rw-r--r-- | interface-definitions/system_login_banner.xml.in | 1 | ||||
-rw-r--r-- | interface-definitions/system_proxy.xml.in | 1 | ||||
-rw-r--r-- | python/vyos/ifconfig/vxlan.py | 7 | ||||
-rw-r--r-- | python/vyos/system/grub.py | 2 | ||||
-rwxr-xr-x | scripts/build-command-templates | 12 | ||||
-rwxr-xr-x | src/op_mode/dhcp.py | 3 |
17 files changed, 32 insertions, 7 deletions
diff --git a/interface-definitions/load-balancing_reverse-proxy.xml.in b/interface-definitions/load-balancing_reverse-proxy.xml.in index ce757a5d6..1a432be6d 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_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/python/vyos/ifconfig/vxlan.py b/python/vyos/ifconfig/vxlan.py index bdb48e303..918aea202 100644 --- a/python/vyos/ifconfig/vxlan.py +++ b/python/vyos/ifconfig/vxlan.py @@ -138,10 +138,13 @@ class VXLANIf(Interface): raise ValueError('Value out of range') if 'vlan_to_vni_removed' in self.config: - cur_vni_filter = get_vxlan_vni_filter(self.ifname) + cur_vni_filter = None + if dict_search('parameters.vni_filter', self.config) != None: + cur_vni_filter = get_vxlan_vni_filter(self.ifname) + for vlan, vlan_config in self.config['vlan_to_vni_removed'].items(): # If VNI filtering is enabled, remove matching VNI filter - if dict_search('parameters.vni_filter', self.config) != None: + if cur_vni_filter != None: vni = vlan_config['vni'] if vni in cur_vni_filter: self._cmd(f'bridge vni delete dev {self.ifname} vni {vni}') diff --git a/python/vyos/system/grub.py b/python/vyos/system/grub.py index 0d9c1340b..6f3bbdaf6 100644 --- a/python/vyos/system/grub.py +++ b/python/vyos/system/grub.py @@ -49,7 +49,7 @@ TMPL_GRUB_COMMON: str = 'grub/grub_common.j2' BOOT_OPTS_STEM: str = 'boot=live rootdelay=5 noautologin net.ifnames=0 biosdevname=0 vyos-union=/boot/' # prepare regexes -REGEX_GRUB_VARS: str = r'^set (?P<variable_name>.+)=[\'"]?(?P<variable_value>.*)(?<![\'"])[\'"]?$' +REGEX_GRUB_VARS: str = r'^set (?P<variable_name>\w+)=[\'"]?(?P<variable_value>.*)(?<![\'"])[\'"]?$' REGEX_GRUB_MODULES: str = r'^insmod (?P<module_name>.+)$' REGEX_KERNEL_CMDLINE: str = r'^BOOT_IMAGE=/(?P<boot_type>boot|live)/((?P<image_version>.+)/)?vmlinuz.*$' REGEX_GRUB_BOOT_OPTS: str = r'^\s*set boot_opts="(?P<boot_opts>[^$]+)"$' 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) diff --git a/src/op_mode/dhcp.py b/src/op_mode/dhcp.py index 54d492cda..3229da4ad 100755 --- a/src/op_mode/dhcp.py +++ b/src/op_mode/dhcp.py @@ -47,7 +47,8 @@ def _utc_to_local(utc_dt): return datetime.fromtimestamp((datetime.fromtimestamp(utc_dt) - datetime(1970, 1, 1)).total_seconds()) -def _format_hex_string(in_str): +def _format_hex_string(in_bytes): + in_str = bytes(in_bytes).hex() out_str = "" # if input is divisible by 2, add : every 2 chars if len(in_str) > 0 and len(in_str) % 2 == 0: |