tests: Get the MAC from the epairs.

This removes knowledge of the implementation of if_epair.
Makes it easier to modify if_epair in future commits.

Reviewed by:	kp
Differential Revision:	https://reviews.freebsd.org/D51205
This commit is contained in:
Ronald Klop
2025-07-09 10:00:19 +02:00
committed by Kristof Provost
parent 4f822ad285
commit 9c95fcb7cd
3 changed files with 22 additions and 19 deletions
+6 -2
View File
@@ -61,6 +61,7 @@ def __init__(self, iface_alias: str, iface_name: str):
self.iftype = self.IFT_LOOP
else:
self.iftype = self.IFT_ETHER
self.ether = ToolsHelper.get_output("/sbin/ifconfig %s ether | awk '/ether/ { print $2; }'" % iface_name).rstrip()
@property
def ifindex(self):
@@ -99,9 +100,12 @@ def create_iface(cls, alias_name: str, iface_name: str) -> List["VnetInterface"]
name = run_cmd("/sbin/ifconfig {} create".format(iface_name)).rstrip()
if not name:
raise Exception("Unable to create iface {}".format(iface_name))
ret = [cls(alias_name, name)]
if1 = cls(alias_name, name)
ret = [if1]
if name.startswith("epair"):
ret.append(cls(alias_name, name[:-1] + "b"))
if2 = cls(alias_name, name[:-1] + "b")
if1.epairb = if2
ret.append(if2);
return ret
def setup_addr(self, _addr: str):