@@ -1112,7 +1112,7 @@ def _test_set_port_status_down(self, is_compute_port=False):
1112
1112
resources .PORT ,
1113
1113
provisioning_blocks .L2_AGENT_ENTITY
1114
1114
)
1115
- ude .assert_called_once_with (port1 ['port' ]['id' ], False )
1115
+ ude .assert_called_once_with (port1 ['port' ]['id' ])
1116
1116
1117
1117
# If the port does NOT bellong to compute, do not notify Nova
1118
1118
# about it's status changes
@@ -1157,7 +1157,7 @@ def test_set_port_status_concurrent_delete(self):
1157
1157
side_effect = exc ) as apc , \
1158
1158
mock .patch .object (self .mech_driver ,
1159
1159
'_update_dnat_entry_if_needed' ) as ude :
1160
- self .mech_driver .set_port_status_down (port1 ['port' ]['id' ], False )
1160
+ self .mech_driver .set_port_status_down (port1 ['port' ]['id' ])
1161
1161
apc .assert_called_once_with (
1162
1162
mock .ANY ,
1163
1163
port1 ['port' ]['id' ],
@@ -2358,32 +2358,40 @@ def test_agent_with_nb_cfg_timestamp_not_timeout(self):
2358
2358
self .assertTrue (agent .alive , "Agent of type %s alive=%s" % (
2359
2359
agent .agent_type , agent .alive ))
2360
2360
2361
- def _test__update_dnat_entry_if_needed (self , up = True ):
2362
- ovn_conf .cfg .CONF .set_override (
2363
- 'enable_distributed_floating_ip' , True , group = 'ovn' )
2361
+ def _test__update_dnat_entry_if_needed (self , dvr = True ):
2362
+ if dvr :
2363
+ ovn_conf .cfg .CONF .set_override (
2364
+ 'enable_distributed_floating_ip' , True , group = 'ovn' )
2364
2365
port_id = 'fake-port-id'
2365
2366
fake_ext_mac_key = 'fake-ext-mac-key'
2366
2367
fake_nat_uuid = uuidutils .generate_uuid ()
2367
2368
nat_row = fakes .FakeOvsdbRow .create_one_ovsdb_row (
2368
2369
attrs = {'_uuid' : fake_nat_uuid , 'external_ids' : {
2369
2370
ovn_const .OVN_FIP_EXT_MAC_KEY : fake_ext_mac_key },
2370
2371
'external_mac' : 'aa:aa:aa:aa:aa:aa' })
2372
+
2371
2373
fake_db_find = mock .Mock ()
2372
2374
fake_db_find .execute .return_value = [nat_row ]
2373
2375
self .nb_ovn .db_find .return_value = fake_db_find
2374
- self .mech_driver ._update_dnat_entry_if_needed (port_id , up = up )
2375
- if up :
2376
+
2377
+ self .mech_driver ._update_dnat_entry_if_needed (port_id )
2378
+
2379
+ if dvr :
2376
2380
# Assert that we are setting the external_mac in the NAT table
2377
2381
self .nb_ovn .db_set .assert_called_once_with (
2378
2382
'NAT' , fake_nat_uuid , ('external_mac' , fake_ext_mac_key ))
2383
+ self .nb_ovn .db_clear .assert_not_called ()
2379
2384
else :
2385
+ self .nb_ovn .db_set .assert_not_called ()
2380
2386
# Assert that we are cleaning the external_mac from the NAT table
2381
2387
self .nb_ovn .db_clear .assert_called_once_with (
2382
2388
'NAT' , fake_nat_uuid , 'external_mac' )
2383
- def test__update_dnat_entry_if_needed_up (self ):
2389
+
2390
+ def test__update_dnat_entry_if_needed_dvr (self ):
2384
2391
self ._test__update_dnat_entry_if_needed ()
2385
- def test__update_dnat_entry_if_needed_down (self ):
2386
- self ._test__update_dnat_entry_if_needed (up = False )
2392
+
2393
+ def test__update_dnat_entry_if_needed_no_dvr (self ):
2394
+ self ._test__update_dnat_entry_if_needed (dvr = False )
2387
2395
2388
2396
@mock .patch ('neutron.plugins.ml2.drivers.ovn.mech_driver.ovsdb.'
2389
2397
'ovn_client.OVNClient._get_router_ports' )
0 commit comments