@@ -975,38 +975,29 @@ def test_generic_driver_bridge(self):
975
975
@mock .patch .object (pci_utils , 'get_vf_num_by_pci_address' , return_value = 1 )
976
976
@mock .patch ('nova.privsep.linux_net.set_device_macaddr' )
977
977
@mock .patch ('nova.privsep.linux_net.set_device_macaddr_and_vlan' )
978
- def _test_hw_veb_op (self , op , vlan , mock_set_macaddr_and_vlan ,
979
- mock_set_macaddr , mock_get_vf_num ,
980
- mock_get_ifname ):
978
+ def test_unplug_hw_veb (self , mock_set_macaddr_and_vlan ,
979
+ mock_set_macaddr , mock_get_vf_num ,
980
+ mock_get_ifname ):
981
+ d = vif .LibvirtGenericVIFDriver ()
981
982
mock_get_ifname .side_effect = ['eth1' , 'eth13' ]
982
- port_state = 'up' if vlan > 0 else 'down'
983
- mac = ('00:00:00:00:00:00' if op .__name__ == 'unplug'
984
- else self .vif_hw_veb_macvtap ['address' ])
985
983
calls = {
986
984
'get_ifname' :
987
985
[mock .call (self .vif_hw_veb_macvtap ['profile' ]['pci_slot' ],
988
986
pf_interface = True ),
989
987
mock .call (self .vif_hw_veb_macvtap ['profile' ]['pci_slot' ])],
990
988
'get_vf_num' :
991
989
[mock .call (self .vif_hw_veb_macvtap ['profile' ]['pci_slot' ])],
992
- 'set_macaddr' : [mock .call ('eth13' , mac , port_state = port_state )]
990
+ 'set_macaddr' : [mock .call (
991
+ 'eth13' , '00:00:00:00:00:00' , port_state = 'down' )]
993
992
}
994
- op (self .instance , self .vif_hw_veb_macvtap )
993
+
994
+ d .unplug (self .instance , self .vif_hw_veb_macvtap )
995
+
995
996
mock_get_ifname .assert_has_calls (calls ['get_ifname' ])
996
997
mock_get_vf_num .assert_has_calls (calls ['get_vf_num' ])
997
998
mock_set_macaddr .assert_has_calls (calls ['set_macaddr' ])
998
999
mock_set_macaddr_and_vlan .assert_called_once_with (
999
- 'eth1' , 1 , mock .ANY , vlan )
1000
-
1001
- def test_plug_hw_veb (self ):
1002
- d = vif .LibvirtGenericVIFDriver ()
1003
- self ._test_hw_veb_op (
1004
- d .plug ,
1005
- self .vif_hw_veb_macvtap ['details' ][network_model .VIF_DETAILS_VLAN ])
1006
-
1007
- def test_unplug_hw_veb (self ):
1008
- d = vif .LibvirtGenericVIFDriver ()
1009
- self ._test_hw_veb_op (d .unplug , 0 )
1000
+ 'eth1' , 1 , mock .ANY , 0 )
1010
1001
1011
1002
@mock .patch ('nova.network.linux_net.set_vf_trusted' )
1012
1003
def test_plug_hw_veb_trusted (self , mset_vf_trusted ):
0 commit comments