Skip to content

Commit

Permalink
[GCU] Marking fields under MIRROR_SESSION as create-only (#2104)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
wen587 authored Mar 18, 2022
1 parent 1cf1d03 commit a2e68a0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions generic_config_updater/patch_sorter.py
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,7 @@ def __init__(self, path_addressing):
["BGP_MONITORS", "*", "local_addr"],
["BGP_MONITORS", "*", "nhopself"],
["BGP_MONITORS", "*", "rrclient"],
["MIRROR_SESSION", "*", "*"],
],
path_addressing)

Expand Down
14 changes: 14 additions & 0 deletions tests/generic_config_updater/patch_sorter_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand All @@ -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)
Expand Down

0 comments on commit a2e68a0

Please sign in to comment.