diff -Nru neutron-18.0.0+git2021061405.f042d690be/debian/changelog neutron-18.0.0+git2021061405.f042d690be/debian/changelog --- neutron-18.0.0+git2021061405.f042d690be/debian/changelog 2021-06-28 14:09:37.000000000 +0530 +++ neutron-18.0.0+git2021061405.f042d690be/debian/changelog 2021-07-07 17:07:56.000000000 +0530 @@ -1,3 +1,10 @@ +neutron (2:18.0.0+git2021061405.f042d690be-0ubuntu3~cloud0ubuntu1) focal-xena; urgency=medium + + * d/p/0001-Update-arp-entry-of-snat-port-on-qrouter-ns.patch: Fix to + update arp entry of snat port on qrouter ns (LP: #1933092) + + -- Hemanth Nakkina Wed, 07 Jul 2021 17:07:56 +0530 + neutron (2:18.0.0+git2021061405.f042d690be-0ubuntu3~cloud0) focal-xena; urgency=medium * New update for the Ubuntu Cloud Archive. diff -Nru neutron-18.0.0+git2021061405.f042d690be/debian/patches/0001-Update-arp-entry-of-snat-port-on-qrouter-ns.patch neutron-18.0.0+git2021061405.f042d690be/debian/patches/0001-Update-arp-entry-of-snat-port-on-qrouter-ns.patch --- neutron-18.0.0+git2021061405.f042d690be/debian/patches/0001-Update-arp-entry-of-snat-port-on-qrouter-ns.patch 1970-01-01 05:30:00.000000000 +0530 +++ neutron-18.0.0+git2021061405.f042d690be/debian/patches/0001-Update-arp-entry-of-snat-port-on-qrouter-ns.patch 2021-07-07 17:07:14.000000000 +0530 @@ -0,0 +1,90 @@ +From 85a668dd1629d71f52ff20da3d848e2cbb397e43 Mon Sep 17 00:00:00 2001 +From: Hemanth Nakkina +Date: Fri, 2 Jul 2021 17:01:55 +0530 +Subject: [PATCH] Update arp entry of snat port on qrouter ns + +In some cases, the arp entry of snat port is not updated +in qrouter namespace. l3-agent calls get_ports_by_subnet() +while setting arps for the subnet. And the snat port is +not returned if it is still unbound. One of the scenario +this is observed is when router is created, external +gateway set and internal subnet attached to router in +quick succession. + +This patch retrieves snat port details from router info +as well and updates arp entry for snat port. + +Closes-Bug: #1933092 +Change-Id: I7ee797b4b930306cf6360922d855f8b24f1b813d +(cherry picked from commit be7d0bb6abc893e53dfc864c52506928b1d38fa3) +--- + neutron/agent/l3/dvr_local_router.py | 13 +++++++++++++ + neutron/tests/unit/agent/l3/test_agent.py | 1 + + .../tests/unit/agent/l3/test_dvr_local_router.py | 8 +++++++- + 3 files changed, 21 insertions(+), 1 deletion(-) + +diff --git a/neutron/agent/l3/dvr_local_router.py b/neutron/agent/l3/dvr_local_router.py +index d8cd3483e9..e318c6ccad 100644 +--- a/neutron/agent/l3/dvr_local_router.py ++++ b/neutron/agent/l3/dvr_local_router.py +@@ -335,6 +335,19 @@ class DvrLocalRouter(dvr_router_base.DvrRouterBase): + 'add', + device=device, + device_exists=device_exists) ++ ++ # subnet_ports does not have snat port if the port is still unbound ++ # by the time this function is called. So ensure to add arp entry ++ # for snat port if port details are updated in router info. ++ for p in self.get_snat_interfaces(): ++ for fixed_ip in p['fixed_ips']: ++ if fixed_ip['subnet_id'] == subnet_id: ++ self._update_arp_entry(fixed_ip['ip_address'], ++ p['mac_address'], ++ subnet_id, ++ 'add', ++ device=device, ++ device_exists=device_exists) + self._process_arp_cache_for_internal_port(subnet_id) + + @staticmethod +diff --git a/neutron/tests/unit/agent/l3/test_agent.py b/neutron/tests/unit/agent/l3/test_agent.py +index 6b011a62f6..ae6c9f1f4a 100644 +--- a/neutron/tests/unit/agent/l3/test_agent.py ++++ b/neutron/tests/unit/agent/l3/test_agent.py +@@ -1271,6 +1271,7 @@ class TestBasicRouterOperations(BasicRouterOperationsFramework): + router[lib_constants.INTERFACE_KEY][0]) + ri.router['distributed'] = True + ri.router['_snat_router_interfaces'] = [{ ++ 'mac_address': 'fa:16:3e:80:8d:80', + 'fixed_ips': [{'subnet_id': subnet_id, + 'ip_address': '1.2.3.4'}]}] + ri.router['gw_port_host'] = None +diff --git a/neutron/tests/unit/agent/l3/test_dvr_local_router.py b/neutron/tests/unit/agent/l3/test_dvr_local_router.py +index 4c913815bb..d30e5ced38 100644 +--- a/neutron/tests/unit/agent/l3/test_dvr_local_router.py ++++ b/neutron/tests/unit/agent/l3/test_dvr_local_router.py +@@ -545,6 +545,11 @@ class TestDvrRouterOperations(base.BaseTestCase): + ri = dvr_router.DvrLocalRouter(HOSTNAME, **self.ri_kwargs) + ports = ri.router.get(lib_constants.INTERFACE_KEY, []) + subnet_id = l3_test_common.get_subnet_id(ports[0]) ++ ri.router['_snat_router_interfaces'] = [{ ++ 'mac_address': 'fa:16:3e:80:8d:80', ++ 'fixed_ips': [{'subnet_id': subnet_id, ++ 'ip_address': '1.2.3.10'}]}] ++ + test_ports = [{'mac_address': '00:11:22:33:44:55', + 'device_owner': lib_constants.DEVICE_OWNER_DHCP, + 'fixed_ips': [{'ip_address': '1.2.3.4', +@@ -576,7 +581,8 @@ class TestDvrRouterOperations(base.BaseTestCase): + self.assertEqual(1, parp.call_count) + self.mock_ip_dev.neigh.add.assert_has_calls([ + mock.call('1.2.3.4', '00:11:22:33:44:55'), +- mock.call('10.20.30.40', '00:11:22:33:44:55')]) ++ mock.call('10.20.30.40', '00:11:22:33:44:55'), ++ mock.call('1.2.3.10', 'fa:16:3e:80:8d:80')]) + + # Test negative case + router['distributed'] = False +-- +2.25.1 + diff -Nru neutron-18.0.0+git2021061405.f042d690be/debian/patches/series neutron-18.0.0+git2021061405.f042d690be/debian/patches/series --- neutron-18.0.0+git2021061405.f042d690be/debian/patches/series 2021-06-28 13:40:24.000000000 +0530 +++ neutron-18.0.0+git2021061405.f042d690be/debian/patches/series 2021-07-07 17:07:14.000000000 +0530 @@ -1,3 +1,4 @@ revert-sqlalchemy-upgrade.patch skip-iptest.patch revert-rely-on-worker-count-for-hashring-caching.patch +0001-Update-arp-entry-of-snat-port-on-qrouter-ns.patch