@@ -784,6 +784,19 @@ def get(cls, bridge, namespace=None, mac=None, port_id=None,
784784 return VethPortFixture (bridge , namespace )
785785 tools .fail ('Unexpected bridge type: %s' % type (bridge ))
786786
787+ def set_port_mac_address (self ):
788+
789+ def set_mac_address ():
790+ self .port .link .set_address (self .mac )
791+ return self .port .link .address .lower () == self .mac .lower ()
792+
793+ try :
794+ common_utils .wait_until_true (set_mac_address , timeout = 10 )
795+ except common_utils .WaitTimeout :
796+ LOG .error ("MAC address of the port %s not set properly. "
797+ "Requested MAC: %s; Actual MAC: %s" ,
798+ self .port , self .mac , self .port .link .address )
799+
787800
788801class OVSBridgeFixture (fixtures .Fixture ):
789802 """Create an OVS bridge.
@@ -899,7 +912,7 @@ def hybrid_plug_port(self, port_name):
899912 bridge_port .link .set_up ()
900913 self .qbr .addif (bridge_port .name )
901914
902- self .port . link . set_address ( self . mac )
915+ self .set_port_mac_address ( )
903916 self .port .link .set_up ()
904917
905918 # NOTE(jlibosva): Methods below are taken from nova.virt.libvirt.vif
@@ -990,8 +1003,7 @@ def _setUp(self):
9901003 self .veth_fixture = self .useFixture (VethFixture ())
9911004 self .br_port , self .port = self .veth_fixture .ports
9921005
993- if self .mac :
994- self .port .link .set_address (self .mac )
1006+ self .set_port_mac_address ()
9951007
9961008 # bridge side
9971009 br_ip_wrapper = ip_lib .IPWrapper (self .bridge .namespace )
0 commit comments