test: simplify interfaces/veth_delete

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg
2026-06-26 16:04:25 +02:00
parent 20350fa52c
commit 2ae1a70bac
2 changed files with 10 additions and 19 deletions
+2 -3
View File
@@ -23,8 +23,7 @@ image::topology.svg[Verify that VETH Pairs Can Be Deleted topology, align=center
. Verify interfaces 'veth0a' and 'veth0b' exist
. Set IP address on target:data1 (dummy op)
. Set IP address on target:data2 (dummy op)
. Reset configuration
. Verify target:data1 and target:data2 still exist
. Verify VETH pair have been removed
. Delete VETH pair
. Verify VETH pair has been removed
+8 -16
View File
@@ -86,23 +86,15 @@ with infamy.Test() as test:
}
}})
# TODO: need target.del_config_dict() or similar for VETH _pairs_,
# because both interfaces must be removed at the same time.
# with test.step("Delete VETH pair"):
# xpath = f"/ietf-interfaces:interfaces/interface[name='{veth0a}']"
# target.delete_xpath(xpath)
# XXX: temporary workaround
with test.step("Reset configuration"):
# Calls target.test_reset() to apply safe-config
target = env.attach("target", "mgmt")
with test.step("Delete VETH pair"):
# Both ends are mutually mandatory leafrefs, so they must be
# removed in a single transaction.
target.delete_xpaths([
f"/ietf-interfaces:interfaces/interface[name='{veth0a}']",
f"/ietf-interfaces:interfaces/interface[name='{veth0b}']",
])
with test.step("Verify target:data1 and target:data2 still exist"):
assert iface.exist(target, data1), \
f"Interface {data1} missing!"
assert iface.exist(target, data2), \
f"Interface {data2} missing!"
with test.step("Verify VETH pair have been removed"):
with test.step("Verify VETH pair has been removed"):
assert not iface.exist(target, veth0a), \
f"Interface <{veth0a}> still exists!"
assert not iface.exist(target, veth0b), \