From eac2d087fddc5cb720a05e97f78e80737e422de5 Mon Sep 17 00:00:00 2001 From: dgsudharsan Date: Tue, 7 May 2024 03:35:24 +0000 Subject: [PATCH] [VRF]Fixing vrf orch to update state_db when evpn nvo arrives late --- orchagent/vrforch.cpp | 1 + tests/test_evpn_l3_vxlan.py | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/orchagent/vrforch.cpp b/orchagent/vrforch.cpp index 776cf1eb0f..a47661412f 100644 --- a/orchagent/vrforch.cpp +++ b/orchagent/vrforch.cpp @@ -147,6 +147,7 @@ bool VRFOrch::addOperation(const Request& request) return false; } + m_stateVrfObjectTable.hset(vrf_name, "state", "ok"); SWSS_LOG_NOTICE("VRF '%s' was updated", vrf_name.c_str()); } diff --git a/tests/test_evpn_l3_vxlan.py b/tests/test_evpn_l3_vxlan.py index 3f424f3830..8820f484e6 100644 --- a/tests/test_evpn_l3_vxlan.py +++ b/tests/test_evpn_l3_vxlan.py @@ -17,6 +17,7 @@ def setup_db(self, dvs): self.pdb = swsscommon.DBConnector(0, dvs.redis_sock, 0) self.adb = swsscommon.DBConnector(1, dvs.redis_sock, 0) self.cdb = swsscommon.DBConnector(4, dvs.redis_sock, 0) + self.sdb = swsscommon.DBConnector(6, dvs.redis_sock, 0) # Test 1 - Create and Delete SIP Tunnel and VRF VNI Map entries # @pytest.mark.skip(reason="Starting Route Orch, VRF Orch to be merged") @@ -597,6 +598,34 @@ def test_tunnel_ipv6_routes(self, dvs, testlog): vxlan_obj.remove_vlan(dvs, "100") + def test_vrf_state_db_update(self, dvs, testlog): + vxlan_obj = self.get_vxlan_obj() + helper = self.get_vxlan_helper() + + self.setup_db(dvs) + tunnel_name = 'tunnel_2' + map_name = 'map_1000_100' + vrf_map_name = 'evpn_map_1000_Vrf-RED' + + vxlan_obj.fetch_exist_entries(dvs) + + + vxlan_obj.create_vrf(dvs, "Vrf-RED") + vxlan_obj.create_vxlan_vrf_tunnel_map(dvs, 'Vrf-RED', '1000') + + time.sleep(2) + #adding nvo after + vxlan_obj.create_vxlan_tunnel(dvs, tunnel_name, '6.6.6.6') + vxlan_obj.create_evpn_nvo(dvs, 'nvo1', tunnel_name) + exp_attr = [ + ("state", "ok"), + ] + helper.check_object(self.sdb, "VRF_OBJECT_TABLE", 'Vrf-RED', exp_attr) + vxlan_obj.remove_vxlan_vrf_tunnel_map(dvs, 'Vrf-RED') + vxlan_obj.remove_vrf(dvs, "Vrf-RED") + vxlan_obj.remove_vxlan_tunnel(dvs, tunnel_name) + vxlan_obj.remove_evpn_nvo(dvs, 'nvo1') + # Add Dummy always-pass test at end as workaroud # for issue when Flaky fail on final test it invokes module tear-down before retrying def test_nonflaky_dummy():