@@ -220,7 +220,7 @@ def test_set_mac_for_vf_error(self, interface, mocker):
220220 with pytest .raises (VirtualizationFeatureException ):
221221 interface .virtualization .set_mac_for_vf (vf_id = vf_id , mac = mac )
222222
223- def test__get_vfs_details_pass (self , interface , mocker ):
223+ def test__get_vfs_details_link_ether_pass (self , interface , mocker ):
224224 interface ._interface_info .name = "eth1"
225225 interface .virtualization ._raise_error_if_not_supported_type = mocker .Mock ()
226226 expected_command = f"ip link show dev { interface ._interface_info .name } "
@@ -267,6 +267,53 @@ def test__get_vfs_details_pass(self, interface, mocker):
267267 command = expected_command , custom_exception = VirtualizationFeatureException
268268 )
269269
270+ def test__get_vfs_details_mac_pass (self , interface , mocker ):
271+ interface ._interface_info .name = "eth1"
272+ interface .virtualization ._raise_error_if_not_supported_type = mocker .Mock ()
273+ expected_command = f"ip link show dev { interface ._interface_info .name } "
274+ output = dedent (
275+ """
276+ 3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
277+ link/ether 00:00:00:00:00:00 brd 00:00:00:00:00:00
278+ vf 0 MAC 00:00:00:00:00:00, spoof checking on, link-state auto, trust off, query_rss off
279+ vf 1 MAC 00:00:00:00:00:00, spoof checking on, link-state enable, trust off, query_rss off
280+ vf 9 MAC 00:00:00:00:00:00, spoof checking on, link-state auto, trust off, query_rss off`
281+ """
282+ )
283+
284+ interface ._connection .execute_command .return_value = ConnectionCompletedProcess (
285+ args = "" , stdout = output , return_code = 0
286+ )
287+
288+ expected_details = [
289+ VFDetail (
290+ id = 0 ,
291+ mac_address = MACAddress ("00:00:00:00:00:00" ),
292+ spoofchk = State .ENABLED ,
293+ link_state = LinkState .AUTO ,
294+ trust = State .DISABLED ,
295+ ),
296+ VFDetail (
297+ id = 1 ,
298+ mac_address = MACAddress ("00:00:00:00:00:00" ),
299+ spoofchk = State .ENABLED ,
300+ link_state = LinkState .ENABLE ,
301+ trust = State .DISABLED ,
302+ ),
303+ VFDetail (
304+ id = 9 ,
305+ mac_address = MACAddress ("00:00:00:00:00:00" ),
306+ spoofchk = State .ENABLED ,
307+ link_state = LinkState .AUTO ,
308+ trust = State .DISABLED ,
309+ ),
310+ ]
311+
312+ assert interface .virtualization ._get_vfs_details () == expected_details
313+ interface ._connection .execute_command .assert_called_with (
314+ command = expected_command , custom_exception = VirtualizationFeatureException
315+ )
316+
270317 def test__get_vfs_details_error (self , interface , mocker ):
271318 interface .virtualization ._raise_error_if_not_supported_type = mocker .Mock ()
272319 interface ._connection .execute_command .side_effect = VirtualizationFeatureException (1 , "" , "" , "" )
0 commit comments