Skip to content

Commit 72edfcd

Browse files
authored
Merge pull request #1257 from kernelkit/test-netconf
Fix NETCONF backend in Infamy to propagate RPC errors [skip ci]
2 parents 51d3023 + 47f0917 commit 72edfcd

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

test/infamy/netconf.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,14 +297,21 @@ def put_config(self, edit):
297297
xml = xml.replace(f"yang:operation=\"{src}\"",
298298
f"nc:operation=\"{dst}\"" if dst else "")
299299

300+
last_error = None
300301
for _ in range(0, 3):
301302
try:
302303
self.ncc.edit_config(xml, default_operation='merge')
304+
last_error = None
305+
break
303306
except RpcError as _e:
307+
last_error = _e
304308
print(f"Failed sending edit-config RPC: {_e} Retrying ...")
305309
time.sleep(1)
306310
continue
307-
break
311+
312+
# If we exhausted all retries, raise the last error
313+
if last_error is not None:
314+
raise last_error
308315

309316
def put_config_dicts(self, models):
310317
"""PUT full configuration of all models to running-config"""

0 commit comments

Comments
 (0)