Skip to content
This repository was archived by the owner on Aug 15, 2025. It is now read-only.

Commit aab8c6f

Browse files
authored
Merge pull request #34 from natali-rs1985/T7488
T7488: Make VPP restartable
2 parents c5462ac + 31beaf5 commit aab8c6f

14 files changed

+124
-8
lines changed

data/templates/vpp/override.conf.j2

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ After=
33
After=vyos-router.service
44
ConditionPathExists=
55
ConditionPathExists=/run/vpp/vpp.conf
6+
OnFailure=vpp-failure-handler.service
67

78
[Service]
89
EnvironmentFile=
910
ExecStart=
1011
ExecStart=/usr/bin/vpp -c /run/vpp/vpp.conf
1112
WorkingDirectory=
1213
WorkingDirectory=/run/vpp
13-
Restart=always
14-
RestartSec=10
14+
Restart=no

src/conf_mode/vpp_acl.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,10 @@ def get_config(config=None) -> dict:
147147
with_recursive_defaults=True,
148148
)
149149

150+
if not conf.exists(['vpp']):
151+
config['remove_vpp'] = True
152+
return config
153+
150154
# Get effective config as we need full dictionary for deletion
151155
effective_config = conf.get_config_dict(
152156
base,
@@ -190,7 +194,7 @@ def get_config(config=None) -> dict:
190194

191195

192196
def verify(config):
193-
if 'remove' in config:
197+
if 'remove' in config or 'remove_vpp' in config:
194198
return None
195199

196200
for acl_type in ['ip', 'macip']:
@@ -319,6 +323,9 @@ def generate(config):
319323

320324

321325
def apply(config):
326+
if 'remove_vpp' in config:
327+
return None
328+
322329
acl = Acl()
323330

324331
if 'effective' in config:

src/conf_mode/vpp_interfaces_bonding.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ def get_config(config=None) -> dict:
8686
with_recursive_defaults=True,
8787
)
8888

89+
if not conf.exists(['vpp']):
90+
config['remove_vpp'] = True
91+
return config
92+
8993
# Get effective config as we need full dicitonary per interface delete
9094
effective_config = conf.get_config_dict(
9195
base + [ifname],
@@ -155,6 +159,9 @@ def get_config(config=None) -> dict:
155159

156160

157161
def verify(config):
162+
if 'remove_vpp' in config:
163+
return None
164+
158165
verify_vpp_remove_kernel_interface(config)
159166
verify_vpp_remove_xconnect_interface(config)
160167

@@ -175,6 +182,9 @@ def generate(config):
175182

176183

177184
def apply(config):
185+
if 'remove_vpp' in config:
186+
return None
187+
178188
ifname = config.get('ifname')
179189
# remove old members
180190
if 'effective' in config:

src/conf_mode/vpp_interfaces_bridge.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ def get_config(config=None) -> dict:
5353
with_recursive_defaults=True,
5454
)
5555

56+
if not conf.exists(['vpp']):
57+
config['remove_vpp'] = True
58+
return config
59+
5660
# Get effective config as we need full dicitonary per interface delete
5761
effective_config = conf.get_config_dict(
5862
base + [ifname],
@@ -87,7 +91,7 @@ def get_config(config=None) -> dict:
8791

8892

8993
def verify(config):
90-
if 'remove' in config:
94+
if 'remove' in config or 'remove_vpp' in config:
9195
return None
9296

9397
# Check if interface exists in vpp before adding to bridge-domain
@@ -122,6 +126,9 @@ def generate(config):
122126

123127

124128
def apply(config):
129+
if 'remove_vpp' in config:
130+
return None
131+
125132
ifname = config.get('ifname')
126133
# vxlan10 in the vpp is vxlan_tunnel10
127134
interface_transform_filter = ('geneve', 'vxlan')

src/conf_mode/vpp_interfaces_geneve.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ def get_config(config=None) -> dict:
6565
with_recursive_defaults=True,
6666
)
6767

68+
if not conf.exists(['vpp']):
69+
config['remove_vpp'] = True
70+
return config
71+
6872
# Get effective config as we need full dicitonary per interface delete
6973
effective_config = conf.get_config_dict(
7074
base + [ifname],
@@ -112,6 +116,10 @@ def get_config(config=None) -> dict:
112116

113117

114118
def verify(config):
119+
# No need to verify anything if vpp is removed
120+
if 'remove_vpp' in config:
121+
return None
122+
115123
# Verify that removed kernel interface is not used in 'vpp kernel-interfaces'.
116124
# vpp interfaces geneve geneveX kernel-interface vpp-tunX
117125
# vpp kernel-interface vpp-tunX
@@ -141,6 +149,9 @@ def generate(config):
141149

142150

143151
def apply(config):
152+
if 'remove_vpp' in config:
153+
return None
154+
144155
ifname = config.get('ifname')
145156
# Delete interface
146157
if 'effective' in config:

src/conf_mode/vpp_interfaces_gre.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ def get_config(config=None) -> dict:
6565
with_recursive_defaults=True,
6666
)
6767

68+
if not conf.exists(['vpp']):
69+
config['remove_vpp'] = True
70+
return config
71+
6872
# Get effective config as we need full dicitonary per interface delete
6973
effective_config = conf.get_config_dict(
7074
base + [ifname],
@@ -125,6 +129,10 @@ def get_config(config=None) -> dict:
125129

126130

127131
def verify(config):
132+
# No need to verify anything if vpp is removed
133+
if 'remove_vpp' in config:
134+
return None
135+
128136
# Verify that removed kernel interface is not used in 'vpp kernel-interfaces'.
129137
# vpp interfaces gre greX kernel-interface vpp-tunX
130138
# vpp kernel-interface vpp-tunX
@@ -167,6 +175,9 @@ def generate(config):
167175

168176

169177
def apply(config):
178+
if 'remove_vpp' in config:
179+
return None
180+
170181
ifname = config.get('ifname')
171182
# Delete interface
172183
if 'effective' in config:

src/conf_mode/vpp_interfaces_ipip.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ def get_config(config=None) -> dict:
6464
with_recursive_defaults=True,
6565
)
6666

67+
if not conf.exists(['vpp']):
68+
config['remove_vpp'] = True
69+
return config
70+
6771
# Get effective config as we need full dicitonary per interface delete
6872
effective_config = conf.get_config_dict(
6973
base + [ifname],
@@ -125,6 +129,10 @@ def get_config(config=None) -> dict:
125129

126130

127131
def verify(config):
132+
# No need to verify anything if vpp is removed
133+
if 'remove_vpp' in config:
134+
return None
135+
128136
# Verify that removed kernel interface is not used in 'vpp kernel-interfaces'.
129137
# vpp interfaces ipip ipipX kernel-interface vpp-tunX
130138
# vpp kernel-interface vpp-tunX
@@ -161,6 +169,9 @@ def generate(config):
161169

162170

163171
def apply(config):
172+
if 'remove_vpp' in config:
173+
return None
174+
164175
ifname = config.get('ifname')
165176
# Delete interface
166177
if 'effective' in config:

src/conf_mode/vpp_interfaces_loopback.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ def get_config(config=None) -> dict:
6262
with_recursive_defaults=True,
6363
)
6464

65+
if not conf.exists(['vpp']):
66+
config['remove_vpp'] = True
67+
return config
68+
6569
# Get effective config as we need full dicitonary per interface delete
6670
effective_config = conf.get_config_dict(
6771
base + [ifname],
@@ -114,6 +118,10 @@ def get_config(config=None) -> dict:
114118

115119

116120
def verify(config):
121+
# No need to verify anything if vpp is removed
122+
if 'remove_vpp' in config:
123+
return None
124+
117125
verify_vpp_remove_kernel_interface(config)
118126

119127
if 'remove' in config:
@@ -128,6 +136,9 @@ def generate(config):
128136

129137

130138
def apply(config):
139+
if 'remove_vpp' in config:
140+
return None
141+
131142
ifname = config.get('ifname')
132143
# Delete interface
133144
if 'effective' in config:

src/conf_mode/vpp_interfaces_vxlan.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ def get_config(config=None) -> dict:
6666
with_recursive_defaults=True,
6767
)
6868

69+
if not conf.exists(['vpp']):
70+
config['remove_vpp'] = True
71+
return config
72+
6973
# Get effective config as we need full dicitonary per interface delete
7074
effective_config = conf.get_config_dict(
7175
base + [ifname],
@@ -131,6 +135,10 @@ def get_config(config=None) -> dict:
131135

132136

133137
def verify(config):
138+
# No need to verify anything if vpp is removed
139+
if 'remove_vpp' in config:
140+
return None
141+
134142
# Verify that removed kernel interface is not used in 'vpp kernel-interfaces'.
135143
# vpp interfaces vxlan vxlanX kernel-interface vpp-tunX
136144
# vpp kernel-interface vpp-tunX
@@ -165,6 +173,9 @@ def generate(config):
165173

166174

167175
def apply(config):
176+
if 'remove_vpp' in config:
177+
return None
178+
168179
ifname = config.get('ifname')
169180
# Delete interface
170181
if 'effective' in config:

src/conf_mode/vpp_interfaces_xconnect.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ def get_config(config=None) -> dict:
5353
with_recursive_defaults=True,
5454
)
5555

56+
if not conf.exists(['vpp']):
57+
config['remove_vpp'] = True
58+
return config
59+
5660
# Get effective config as we need full dicitonary per interface delete
5761
effective_config = conf.get_config_dict(
5862
base + [ifname],
@@ -85,7 +89,7 @@ def get_config(config=None) -> dict:
8589

8690

8791
def verify(config):
88-
if 'remove' in config:
92+
if 'remove' in config or 'remove_vpp' in config:
8993
return None
9094

9195
# Xconnect requires 2 members
@@ -110,6 +114,9 @@ def generate(config):
110114

111115

112116
def apply(config):
117+
if 'remove_vpp' in config:
118+
return None
119+
113120
ifname = config.get('ifname')
114121

115122
# Delete xconnect

0 commit comments

Comments
 (0)