@@ -1130,7 +1130,7 @@ def _test_set_port_status_down(self, is_compute_port=False):
1130
1130
resources .PORT ,
1131
1131
provisioning_blocks .L2_AGENT_ENTITY
1132
1132
)
1133
- ude .assert_called_once_with (port1 ['port' ]['id' ], False )
1133
+ ude .assert_called_once_with (port1 ['port' ]['id' ])
1134
1134
1135
1135
# If the port does NOT bellong to compute, do not notify Nova
1136
1136
# about it's status changes
@@ -1175,7 +1175,7 @@ def test_set_port_status_concurrent_delete(self):
1175
1175
side_effect = exc ) as apc , \
1176
1176
mock .patch .object (self .mech_driver ,
1177
1177
'_update_dnat_entry_if_needed' ) as ude :
1178
- self .mech_driver .set_port_status_down (port1 ['port' ]['id' ], False )
1178
+ self .mech_driver .set_port_status_down (port1 ['port' ]['id' ])
1179
1179
apc .assert_called_once_with (
1180
1180
mock .ANY ,
1181
1181
port1 ['port' ]['id' ],
@@ -2376,32 +2376,40 @@ def test_agent_with_nb_cfg_timestamp_not_timeout(self):
2376
2376
self .assertTrue (agent .alive , "Agent of type %s alive=%s" % (
2377
2377
agent .agent_type , agent .alive ))
2378
2378
2379
- def _test__update_dnat_entry_if_needed (self , up = True ):
2380
- ovn_conf .cfg .CONF .set_override (
2381
- 'enable_distributed_floating_ip' , True , group = 'ovn' )
2379
+ def _test__update_dnat_entry_if_needed (self , dvr = True ):
2380
+ if dvr :
2381
+ ovn_conf .cfg .CONF .set_override (
2382
+ 'enable_distributed_floating_ip' , True , group = 'ovn' )
2382
2383
port_id = 'fake-port-id'
2383
2384
fake_ext_mac_key = 'fake-ext-mac-key'
2384
2385
fake_nat_uuid = uuidutils .generate_uuid ()
2385
2386
nat_row = fakes .FakeOvsdbRow .create_one_ovsdb_row (
2386
2387
attrs = {'_uuid' : fake_nat_uuid , 'external_ids' : {
2387
2388
ovn_const .OVN_FIP_EXT_MAC_KEY : fake_ext_mac_key },
2388
2389
'external_mac' : 'aa:aa:aa:aa:aa:aa' })
2390
+
2389
2391
fake_db_find = mock .Mock ()
2390
2392
fake_db_find .execute .return_value = [nat_row ]
2391
2393
self .nb_ovn .db_find .return_value = fake_db_find
2392
- self .mech_driver ._update_dnat_entry_if_needed (port_id , up = up )
2393
- if up :
2394
+
2395
+ self .mech_driver ._update_dnat_entry_if_needed (port_id )
2396
+
2397
+ if dvr :
2394
2398
# Assert that we are setting the external_mac in the NAT table
2395
2399
self .nb_ovn .db_set .assert_called_once_with (
2396
2400
'NAT' , fake_nat_uuid , ('external_mac' , fake_ext_mac_key ))
2401
+ self .nb_ovn .db_clear .assert_not_called ()
2397
2402
else :
2403
+ self .nb_ovn .db_set .assert_not_called ()
2398
2404
# Assert that we are cleaning the external_mac from the NAT table
2399
2405
self .nb_ovn .db_clear .assert_called_once_with (
2400
2406
'NAT' , fake_nat_uuid , 'external_mac' )
2401
- def test__update_dnat_entry_if_needed_up (self ):
2407
+
2408
+ def test__update_dnat_entry_if_needed_dvr (self ):
2402
2409
self ._test__update_dnat_entry_if_needed ()
2403
- def test__update_dnat_entry_if_needed_down (self ):
2404
- self ._test__update_dnat_entry_if_needed (up = False )
2410
+
2411
+ def test__update_dnat_entry_if_needed_no_dvr (self ):
2412
+ self ._test__update_dnat_entry_if_needed (dvr = False )
2405
2413
2406
2414
@mock .patch ('neutron.plugins.ml2.drivers.ovn.mech_driver.ovsdb.'
2407
2415
'ovn_client.OVNClient._get_router_ports' )
0 commit comments