summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNataliia Solomko <natalirs1985@gmail.com>2025-05-27 14:27:50 +0300
committerNataliia Solomko <natalirs1985@gmail.com>2025-05-28 14:48:07 +0300
commit31beaf550786502f5b62034c6e4b2e0e52508f8c (patch)
tree02a72bd361dfc92d25f15d3e8f8e92d6aa367e5f /src
parent151afffe15ce89755f3c3f81a9d2c647e487f647 (diff)
downloadvyos-1x-31beaf550786502f5b62034c6e4b2e0e52508f8c.tar.gz
vyos-1x-31beaf550786502f5b62034c6e4b2e0e52508f8c.zip
T7488: Make VPP restartable
Diffstat (limited to 'src')
-rw-r--r--src/conf_mode/vpp_acl.py9
-rw-r--r--src/conf_mode/vpp_interfaces_bonding.py10
-rw-r--r--src/conf_mode/vpp_interfaces_bridge.py9
-rw-r--r--src/conf_mode/vpp_interfaces_geneve.py11
-rw-r--r--src/conf_mode/vpp_interfaces_gre.py11
-rw-r--r--src/conf_mode/vpp_interfaces_ipip.py11
-rw-r--r--src/conf_mode/vpp_interfaces_loopback.py11
-rw-r--r--src/conf_mode/vpp_interfaces_vxlan.py11
-rw-r--r--src/conf_mode/vpp_interfaces_xconnect.py9
-rw-r--r--src/conf_mode/vpp_kernel-interfaces.py9
-rw-r--r--src/conf_mode/vpp_nat.py9
-rw-r--r--src/conf_mode/vpp_nat_cgnat.py9
-rw-r--r--src/systemd/vpp-failure-handler.service9
13 files changed, 122 insertions, 6 deletions
diff --git a/src/conf_mode/vpp_acl.py b/src/conf_mode/vpp_acl.py
index 28eae485b..d6a9150d1 100644
--- a/src/conf_mode/vpp_acl.py
+++ b/src/conf_mode/vpp_acl.py
@@ -147,6 +147,10 @@ def get_config(config=None) -> dict:
with_recursive_defaults=True,
)
+ if not conf.exists(['vpp']):
+ config['remove_vpp'] = True
+ return config
+
# Get effective config as we need full dictionary for deletion
effective_config = conf.get_config_dict(
base,
@@ -190,7 +194,7 @@ def get_config(config=None) -> dict:
def verify(config):
- if 'remove' in config:
+ if 'remove' in config or 'remove_vpp' in config:
return None
for acl_type in ['ip', 'macip']:
@@ -319,6 +323,9 @@ def generate(config):
def apply(config):
+ if 'remove_vpp' in config:
+ return None
+
acl = Acl()
if 'effective' in config:
diff --git a/src/conf_mode/vpp_interfaces_bonding.py b/src/conf_mode/vpp_interfaces_bonding.py
index 2b17acb24..c9aa6276c 100644
--- a/src/conf_mode/vpp_interfaces_bonding.py
+++ b/src/conf_mode/vpp_interfaces_bonding.py
@@ -86,6 +86,10 @@ def get_config(config=None) -> dict:
with_recursive_defaults=True,
)
+ if not conf.exists(['vpp']):
+ config['remove_vpp'] = True
+ return config
+
# Get effective config as we need full dicitonary per interface delete
effective_config = conf.get_config_dict(
base + [ifname],
@@ -155,6 +159,9 @@ def get_config(config=None) -> dict:
def verify(config):
+ if 'remove_vpp' in config:
+ return None
+
verify_vpp_remove_kernel_interface(config)
verify_vpp_remove_xconnect_interface(config)
@@ -175,6 +182,9 @@ def generate(config):
def apply(config):
+ if 'remove_vpp' in config:
+ return None
+
ifname = config.get('ifname')
# remove old members
if 'effective' in config:
diff --git a/src/conf_mode/vpp_interfaces_bridge.py b/src/conf_mode/vpp_interfaces_bridge.py
index dd5b49599..4272db616 100644
--- a/src/conf_mode/vpp_interfaces_bridge.py
+++ b/src/conf_mode/vpp_interfaces_bridge.py
@@ -53,6 +53,10 @@ def get_config(config=None) -> dict:
with_recursive_defaults=True,
)
+ if not conf.exists(['vpp']):
+ config['remove_vpp'] = True
+ return config
+
# Get effective config as we need full dicitonary per interface delete
effective_config = conf.get_config_dict(
base + [ifname],
@@ -87,7 +91,7 @@ def get_config(config=None) -> dict:
def verify(config):
- if 'remove' in config:
+ if 'remove' in config or 'remove_vpp' in config:
return None
# Check if interface exists in vpp before adding to bridge-domain
@@ -122,6 +126,9 @@ def generate(config):
def apply(config):
+ if 'remove_vpp' in config:
+ return None
+
ifname = config.get('ifname')
# vxlan10 in the vpp is vxlan_tunnel10
interface_transform_filter = ('geneve', 'vxlan')
diff --git a/src/conf_mode/vpp_interfaces_geneve.py b/src/conf_mode/vpp_interfaces_geneve.py
index a7e7ae8e5..12fac83fb 100644
--- a/src/conf_mode/vpp_interfaces_geneve.py
+++ b/src/conf_mode/vpp_interfaces_geneve.py
@@ -65,6 +65,10 @@ def get_config(config=None) -> dict:
with_recursive_defaults=True,
)
+ if not conf.exists(['vpp']):
+ config['remove_vpp'] = True
+ return config
+
# Get effective config as we need full dicitonary per interface delete
effective_config = conf.get_config_dict(
base + [ifname],
@@ -112,6 +116,10 @@ def get_config(config=None) -> dict:
def verify(config):
+ # No need to verify anything if vpp is removed
+ if 'remove_vpp' in config:
+ return None
+
# Verify that removed kernel interface is not used in 'vpp kernel-interfaces'.
# vpp interfaces geneve geneveX kernel-interface vpp-tunX
# vpp kernel-interface vpp-tunX
@@ -141,6 +149,9 @@ def generate(config):
def apply(config):
+ if 'remove_vpp' in config:
+ return None
+
ifname = config.get('ifname')
# Delete interface
if 'effective' in config:
diff --git a/src/conf_mode/vpp_interfaces_gre.py b/src/conf_mode/vpp_interfaces_gre.py
index f6da2d55d..5ec6feeb0 100644
--- a/src/conf_mode/vpp_interfaces_gre.py
+++ b/src/conf_mode/vpp_interfaces_gre.py
@@ -65,6 +65,10 @@ def get_config(config=None) -> dict:
with_recursive_defaults=True,
)
+ if not conf.exists(['vpp']):
+ config['remove_vpp'] = True
+ return config
+
# Get effective config as we need full dicitonary per interface delete
effective_config = conf.get_config_dict(
base + [ifname],
@@ -125,6 +129,10 @@ def get_config(config=None) -> dict:
def verify(config):
+ # No need to verify anything if vpp is removed
+ if 'remove_vpp' in config:
+ return None
+
# Verify that removed kernel interface is not used in 'vpp kernel-interfaces'.
# vpp interfaces gre greX kernel-interface vpp-tunX
# vpp kernel-interface vpp-tunX
@@ -167,6 +175,9 @@ def generate(config):
def apply(config):
+ if 'remove_vpp' in config:
+ return None
+
ifname = config.get('ifname')
# Delete interface
if 'effective' in config:
diff --git a/src/conf_mode/vpp_interfaces_ipip.py b/src/conf_mode/vpp_interfaces_ipip.py
index f40a4e243..430b7b334 100644
--- a/src/conf_mode/vpp_interfaces_ipip.py
+++ b/src/conf_mode/vpp_interfaces_ipip.py
@@ -64,6 +64,10 @@ def get_config(config=None) -> dict:
with_recursive_defaults=True,
)
+ if not conf.exists(['vpp']):
+ config['remove_vpp'] = True
+ return config
+
# Get effective config as we need full dicitonary per interface delete
effective_config = conf.get_config_dict(
base + [ifname],
@@ -125,6 +129,10 @@ def get_config(config=None) -> dict:
def verify(config):
+ # No need to verify anything if vpp is removed
+ if 'remove_vpp' in config:
+ return None
+
# Verify that removed kernel interface is not used in 'vpp kernel-interfaces'.
# vpp interfaces ipip ipipX kernel-interface vpp-tunX
# vpp kernel-interface vpp-tunX
@@ -161,6 +169,9 @@ def generate(config):
def apply(config):
+ if 'remove_vpp' in config:
+ return None
+
ifname = config.get('ifname')
# Delete interface
if 'effective' in config:
diff --git a/src/conf_mode/vpp_interfaces_loopback.py b/src/conf_mode/vpp_interfaces_loopback.py
index 2b37b5e1c..92ba110f1 100644
--- a/src/conf_mode/vpp_interfaces_loopback.py
+++ b/src/conf_mode/vpp_interfaces_loopback.py
@@ -62,6 +62,10 @@ def get_config(config=None) -> dict:
with_recursive_defaults=True,
)
+ if not conf.exists(['vpp']):
+ config['remove_vpp'] = True
+ return config
+
# Get effective config as we need full dicitonary per interface delete
effective_config = conf.get_config_dict(
base + [ifname],
@@ -114,6 +118,10 @@ def get_config(config=None) -> dict:
def verify(config):
+ # No need to verify anything if vpp is removed
+ if 'remove_vpp' in config:
+ return None
+
verify_vpp_remove_kernel_interface(config)
if 'remove' in config:
@@ -128,6 +136,9 @@ def generate(config):
def apply(config):
+ if 'remove_vpp' in config:
+ return None
+
ifname = config.get('ifname')
# Delete interface
if 'effective' in config:
diff --git a/src/conf_mode/vpp_interfaces_vxlan.py b/src/conf_mode/vpp_interfaces_vxlan.py
index 065a8eafb..c4068818e 100644
--- a/src/conf_mode/vpp_interfaces_vxlan.py
+++ b/src/conf_mode/vpp_interfaces_vxlan.py
@@ -66,6 +66,10 @@ def get_config(config=None) -> dict:
with_recursive_defaults=True,
)
+ if not conf.exists(['vpp']):
+ config['remove_vpp'] = True
+ return config
+
# Get effective config as we need full dicitonary per interface delete
effective_config = conf.get_config_dict(
base + [ifname],
@@ -131,6 +135,10 @@ def get_config(config=None) -> dict:
def verify(config):
+ # No need to verify anything if vpp is removed
+ if 'remove_vpp' in config:
+ return None
+
# Verify that removed kernel interface is not used in 'vpp kernel-interfaces'.
# vpp interfaces vxlan vxlanX kernel-interface vpp-tunX
# vpp kernel-interface vpp-tunX
@@ -165,6 +173,9 @@ def generate(config):
def apply(config):
+ if 'remove_vpp' in config:
+ return None
+
ifname = config.get('ifname')
# Delete interface
if 'effective' in config:
diff --git a/src/conf_mode/vpp_interfaces_xconnect.py b/src/conf_mode/vpp_interfaces_xconnect.py
index c323684a3..220c1d44e 100644
--- a/src/conf_mode/vpp_interfaces_xconnect.py
+++ b/src/conf_mode/vpp_interfaces_xconnect.py
@@ -53,6 +53,10 @@ def get_config(config=None) -> dict:
with_recursive_defaults=True,
)
+ if not conf.exists(['vpp']):
+ config['remove_vpp'] = True
+ return config
+
# Get effective config as we need full dicitonary per interface delete
effective_config = conf.get_config_dict(
base + [ifname],
@@ -85,7 +89,7 @@ def get_config(config=None) -> dict:
def verify(config):
- if 'remove' in config:
+ if 'remove' in config or 'remove_vpp' in config:
return None
# Xconnect requires 2 members
@@ -110,6 +114,9 @@ def generate(config):
def apply(config):
+ if 'remove_vpp' in config:
+ return None
+
ifname = config.get('ifname')
# Delete xconnect
diff --git a/src/conf_mode/vpp_kernel-interfaces.py b/src/conf_mode/vpp_kernel-interfaces.py
index 4e4ecb442..f9354c964 100644
--- a/src/conf_mode/vpp_kernel-interfaces.py
+++ b/src/conf_mode/vpp_kernel-interfaces.py
@@ -47,6 +47,10 @@ def get_config(config=None) -> dict:
with_defaults=True,
)
+ if not conf.exists(['vpp']):
+ config['remove_vpp'] = True
+ return config
+
# Get effective config as we need full dicitonary per interface delete
if __name__ == '__main__':
effective_config = conf.get_config_dict(
@@ -81,7 +85,7 @@ def get_config(config=None) -> dict:
def verify(config):
- if 'remove' in config:
+ if 'remove' in config or 'remove_vpp' in config:
return None
# Interface must exists before it is configured
@@ -96,6 +100,9 @@ def generate(config):
def apply(config):
+ if 'remove_vpp' in config:
+ return None
+
ifname = config.get('ifname')
i = Interface(ifname)
# update/remove addresses
diff --git a/src/conf_mode/vpp_nat.py b/src/conf_mode/vpp_nat.py
index a6bc70032..f8ac4f0e3 100644
--- a/src/conf_mode/vpp_nat.py
+++ b/src/conf_mode/vpp_nat.py
@@ -55,6 +55,10 @@ def get_config(config=None) -> dict:
with_recursive_defaults=True,
)
+ if not conf.exists(['vpp']):
+ config['remove_vpp'] = True
+ return config
+
# Get effective config as we need full dictionary for deletion
effective_config = conf.get_config_dict(
base,
@@ -131,7 +135,7 @@ def convert_range_to_list_ips(address_range) -> list:
def verify(config):
- if 'remove' in config:
+ if 'remove' in config or 'remove_vpp' in config:
return None
if 'interface' not in config:
@@ -329,6 +333,9 @@ def generate(config):
def apply(config):
+ if 'remove_vpp' in config:
+ return None
+
n = Nat44()
if 'remove' in config:
diff --git a/src/conf_mode/vpp_nat_cgnat.py b/src/conf_mode/vpp_nat_cgnat.py
index 05260c476..68695b78e 100644
--- a/src/conf_mode/vpp_nat_cgnat.py
+++ b/src/conf_mode/vpp_nat_cgnat.py
@@ -41,6 +41,10 @@ def get_config(config=None) -> dict:
no_tag_node_value_mangle=True,
)
+ if not conf.exists(['vpp']):
+ config['remove_vpp'] = True
+ return config
+
# Get effective config as we need full dictionary to delete
effective_config = conf.get_config_dict(
base,
@@ -91,7 +95,7 @@ def get_config(config=None) -> dict:
def verify(config):
- if 'remove' in config:
+ if 'remove' in config or 'remove_vpp' in config:
return None
if 'interface' not in config:
@@ -142,6 +146,9 @@ def generate(config):
def apply(config):
+ if 'remove_vpp' in config:
+ return None
+
cgnat = Det44()
if 'remove' in config:
diff --git a/src/systemd/vpp-failure-handler.service b/src/systemd/vpp-failure-handler.service
new file mode 100644
index 000000000..3a75f9519
--- /dev/null
+++ b/src/systemd/vpp-failure-handler.service
@@ -0,0 +1,9 @@
+[Unit]
+Description=Restart VPP on failure
+
+[Service]
+Type=oneshot
+User=root
+Group=vyattacfg
+UMask=0002
+ExecStart=/usr/bin/python3 /usr/libexec/vyos/reset_section.py vpp --reload