@@ -2738,7 +2738,9 @@ def _test_segments_helper(self):
2738
2738
segment_id = self .seg_2 ['id' ]) as subnet :
2739
2739
self .sub_2 = subnet
2740
2740
2741
- def test_create_segments_subnet_metadata_ip_allocation (self ):
2741
+ @mock .patch .object (ovn_client .OVNClient , 'get_virtual_port_parents' ,
2742
+ return_value = [])
2743
+ def test_create_segments_subnet_metadata_ip_allocation (self , * args ):
2742
2744
self ._test_segments_helper ()
2743
2745
ovn_nb_api = self .mech_driver .nb_ovn
2744
2746
@@ -3810,7 +3812,9 @@ def test_metadata_port_not_created_if_exists(self):
3810
3812
with self .network ():
3811
3813
self .assertEqual (0 , self .nb_ovn .create_lswitch_port .call_count )
3812
3814
3813
- def test_metadata_ip_on_subnet_create (self ):
3815
+ @mock .patch .object (ovn_client .OVNClient , 'get_virtual_port_parents' ,
3816
+ return_value = [])
3817
+ def test_metadata_ip_on_subnet_create (self , * args ):
3814
3818
"""Check metadata port update.
3815
3819
3816
3820
Check that the metadata port is updated with a new IP address when a
@@ -3980,26 +3984,24 @@ def test_create_port_with_virtual_type_and_options(
3980
3984
self , mock_get_parents , mock_determine_bind_host ):
3981
3985
fake_parents = ['parent-0' , 'parent-1' ]
3982
3986
mock_get_parents .return_value = fake_parents
3983
- port = {'id' : 'virt-port' ,
3984
- 'mac_address' : '00:00:00:00:00:00' ,
3985
- 'device_owner' : '' ,
3986
- 'network_id' : self .net ['id' ],
3987
- 'fixed_ips' : [{'subnet_id' : self .subnet ['id' ],
3988
- 'ip_address' : '10.0.0.55' }]}
3989
- port_info = self .mech_driver ._ovn_client ._get_port_options (
3990
- port )
3991
- self .assertEqual (ovn_const .LSP_TYPE_VIRTUAL , port_info .type )
3992
- self .assertEqual (
3993
- '10.0.0.55' ,
3994
- port_info .options [ovn_const .LSP_OPTIONS_VIRTUAL_IP_KEY ])
3995
- self .assertIn (
3996
- 'parent-0' ,
3997
- port_info .options [
3998
- ovn_const .LSP_OPTIONS_VIRTUAL_PARENTS_KEY ])
3999
- self .assertIn (
4000
- 'parent-1' ,
4001
- port_info .options [
4002
- ovn_const .LSP_OPTIONS_VIRTUAL_PARENTS_KEY ])
3987
+ for device_owner in ('' , 'myVIPowner' ):
3988
+ port = {'id' : 'virt-port' ,
3989
+ 'mac_address' : '00:00:00:00:00:00' ,
3990
+ 'device_owner' : device_owner ,
3991
+ 'network_id' : self .net ['id' ],
3992
+ 'fixed_ips' : [{'subnet_id' : self .subnet ['id' ],
3993
+ 'ip_address' : '10.0.0.55' }]}
3994
+ port_info = self .mech_driver ._ovn_client ._get_port_options (port )
3995
+ self .assertEqual (ovn_const .LSP_TYPE_VIRTUAL , port_info .type )
3996
+ self .assertEqual (
3997
+ '10.0.0.55' ,
3998
+ port_info .options [ovn_const .LSP_OPTIONS_VIRTUAL_IP_KEY ])
3999
+ self .assertIn (
4000
+ 'parent-0' ,
4001
+ port_info .options [ovn_const .LSP_OPTIONS_VIRTUAL_PARENTS_KEY ])
4002
+ self .assertIn (
4003
+ 'parent-1' ,
4004
+ port_info .options [ovn_const .LSP_OPTIONS_VIRTUAL_PARENTS_KEY ])
4003
4005
4004
4006
@mock .patch .object (db_base_plugin_v2 .NeutronDbPluginV2 , 'get_ports' )
4005
4007
def _test_set_unset_virtual_port_type (self , mock_get_ports , unset = False ):
0 commit comments