From a2e68a05a8e6ab296978a59bf107971beb899546 Mon Sep 17 00:00:00 2001 From: jingwenxie Date: Thu, 17 Mar 2022 18:14:50 -0700 Subject: [PATCH] [GCU] Marking fields under MIRROR_SESSION as create-only (#2104) What I did Fix #2068 Changes to fields under MIRROR_SESSION using GCU are not reflected and removal will result in orchagent crash unless each key is deleted and added back. This means the fields are create-only. How I did it Mark the fields under MIRROR_SESSION as create-only How to verify it unit-test --- generic_config_updater/patch_sorter.py | 1 + tests/generic_config_updater/patch_sorter_test.py | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/generic_config_updater/patch_sorter.py b/generic_config_updater/patch_sorter.py index 2943c5fea7..e89c542e73 100644 --- a/generic_config_updater/patch_sorter.py +++ b/generic_config_updater/patch_sorter.py @@ -589,6 +589,7 @@ def __init__(self, path_addressing): ["BGP_MONITORS", "*", "local_addr"], ["BGP_MONITORS", "*", "nhopself"], ["BGP_MONITORS", "*", "rrclient"], + ["MIRROR_SESSION", "*", "*"], ], path_addressing) diff --git a/tests/generic_config_updater/patch_sorter_test.py b/tests/generic_config_updater/patch_sorter_test.py index 406d07cbe8..12d76c5283 100644 --- a/tests/generic_config_updater/patch_sorter_test.py +++ b/tests/generic_config_updater/patch_sorter_test.py @@ -1033,6 +1033,15 @@ def test_hard_coded_create_only_paths(self): "nhopself": "0", "rrclient": "0" } + }, + "MIRROR_SESSION": { + "mirror_session_dscp": { + "dscp": "5", + "dst_ip": "2.2.2.2", + "src_ip": "1.1.1.1", + "ttl": "32", + "type": "ERSPAN" + } } } expected = [ @@ -1058,6 +1067,11 @@ def test_hard_coded_create_only_paths(self): "/BGP_MONITORS/5.6.7.8/name", "/BGP_MONITORS/5.6.7.8/nhopself", "/BGP_MONITORS/5.6.7.8/rrclient", + "/MIRROR_SESSION/mirror_session_dscp/dscp", + "/MIRROR_SESSION/mirror_session_dscp/dst_ip", + "/MIRROR_SESSION/mirror_session_dscp/src_ip", + "/MIRROR_SESSION/mirror_session_dscp/ttl", + "/MIRROR_SESSION/mirror_session_dscp/type", ] actual = self.validator._get_create_only_paths(config)