diff --git a/generic_config_updater/gu_common.py b/generic_config_updater/gu_common.py index c824407564..6ed9699f26 100644 --- a/generic_config_updater/gu_common.py +++ b/generic_config_updater/gu_common.py @@ -423,6 +423,7 @@ def _find_leafref_paths(self, path, config): ref_paths.append(ref_path) ref_paths_set.add(ref_path) + ref_paths.sort() return ref_paths def _get_inner_leaf_xpaths(self, xpath, sy): diff --git a/tests/generic_config_updater/gu_common_test.py b/tests/generic_config_updater/gu_common_test.py index dbc93fcf07..ff3b504dfb 100644 --- a/tests/generic_config_updater/gu_common_test.py +++ b/tests/generic_config_updater/gu_common_test.py @@ -639,13 +639,13 @@ def test_find_ref_paths__path_is_table__returns_ref_paths(self): # Arrange path = "/PORT" expected = [ - "/ACL_TABLE/NO-NSW-PACL-V4/ports/0", - "/VLAN_MEMBER/Vlan1000|Ethernet0", "/ACL_TABLE/DATAACL/ports/0", - "/ACL_TABLE/EVERFLOWV6/ports/0", - "/VLAN_MEMBER/Vlan1000|Ethernet4", "/ACL_TABLE/EVERFLOW/ports/0", + "/ACL_TABLE/EVERFLOWV6/ports/0", "/ACL_TABLE/EVERFLOWV6/ports/1", + "/ACL_TABLE/NO-NSW-PACL-V4/ports/0", + "/VLAN_MEMBER/Vlan1000|Ethernet0", + "/VLAN_MEMBER/Vlan1000|Ethernet4", "/VLAN_MEMBER/Vlan1000|Ethernet8" ] @@ -659,14 +659,14 @@ def test_find_ref_paths__whole_config_path__returns_all_refs(self): # Arrange path = "" expected = [ - "/VLAN_MEMBER/Vlan1000|Ethernet0", - "/VLAN_MEMBER/Vlan1000|Ethernet4", - "/VLAN_MEMBER/Vlan1000|Ethernet8", - "/ACL_TABLE/NO-NSW-PACL-V4/ports/0", "/ACL_TABLE/DATAACL/ports/0", - "/ACL_TABLE/EVERFLOWV6/ports/0", "/ACL_TABLE/EVERFLOW/ports/0", + "/ACL_TABLE/EVERFLOWV6/ports/0", "/ACL_TABLE/EVERFLOWV6/ports/1", + "/ACL_TABLE/NO-NSW-PACL-V4/ports/0", + "/VLAN_MEMBER/Vlan1000|Ethernet0", + "/VLAN_MEMBER/Vlan1000|Ethernet4", + "/VLAN_MEMBER/Vlan1000|Ethernet8", ] # Act