diff --git a/src/sonic-yang-mgmt/_sonic_yang_ext.py b/src/sonic-yang-mgmt/_sonic_yang_ext.py index 8c69f56faf6b..303f920d3ec5 100644 --- a/src/sonic-yang-mgmt/_sonic_yang_ext.py +++ b/src/sonic-yang-mgmt/_sonic_yang_ext.py @@ -639,7 +639,7 @@ def delete_node(self, xpath): leaf = ly.Schema_Node_Leaf(snode) if leaf.is_key(): # try to delete parent - nodeP = self.find_parent_node(xpath) + nodeP = self.find_parent_data_node(xpath) xpathP = nodeP.path() if self._delete_node(xpath=xpathP, node=nodeP) == False: raise Exception('_delete_node failed') diff --git a/src/sonic-yang-mgmt/sonic_yang.py b/src/sonic-yang-mgmt/sonic_yang.py index 6bc330c9ed6a..03d2d106e5f4 100644 --- a/src/sonic-yang-mgmt/sonic_yang.py +++ b/src/sonic-yang-mgmt/sonic_yang.py @@ -374,7 +374,7 @@ def find_data_node_schema_xpath(self, data_xpath): """ def add_data_node(self, data_xpath, value): try: - self.new_node(xpath, value) + self.new_data_node(data_xpath, value) #check if the node added to the data tree self.find_data_node(data_xpath) except Exception as e: diff --git a/src/sonic-yang-mgmt/tests/libyang-python-tests/test_sonic_yang.py b/src/sonic-yang-mgmt/tests/libyang-python-tests/test_sonic_yang.py index 6002b4386068..8931a36c9c9f 100644 --- a/src/sonic-yang-mgmt/tests/libyang-python-tests/test_sonic_yang.py +++ b/src/sonic-yang-mgmt/tests/libyang-python-tests/test_sonic_yang.py @@ -143,7 +143,7 @@ def test_add_node(self, data, yang_s): for node in data['new_nodes']: xpath = str(node['xpath']) value = node['value'] - yang_s.add_node(xpath, str(value)) + yang_s.add_data_node(xpath, str(value)) data_node = yang_s.find_data_node(xpath) assert data_node is not None