Skip to content

Commit

Permalink
Fixes for with-defaults processing
Browse files Browse the repository at this point in the history
In _merge_gnode_nodes, don't continue when the child1 node has no
children. This is to allow the recursive call which, while it will have
no effect in the loop over node1's children, may have an effect in the
loop over node2's children.

Change schemas to allow the new tests in apteryx-netconf. The test5 schema
is meant to mimic the structure of the interfaces/ethernet/poe models
in openconfig.
  • Loading branch information
tony-vanderpeet committed Nov 27, 2024
1 parent 7a7f845 commit 9b53371
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 4 deletions.
2 changes: 1 addition & 1 deletion models/test.xml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
<REFRESH>Sample REFRESH node</REFRESH>
</NODE>
<NODE name="config" >
<NODE name="type" mode="rw">
<NODE name="type" mode="rw" default="big">
<VALUE name="big" value="1"/>
<VALUE name="little" value="2"/>
</NODE>
Expand Down
32 changes: 32 additions & 0 deletions models/test5:test5.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version='1.0' encoding='UTF-8'?>
<MODULE xmlns="http://test.com/ns/yang/testing-5"
xmlns:t5="http://test.com/ns/yang/testing-5"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://github.com/alliedtelesis/apteryx-xml https://github.com/alliedtelesis/apteryx-xml/releases/download/v1.2/apteryx.xsd"
model="testing-5" organization="Test 5 Ltd" version="2024-11-27">
<NODE name="test5" help="This is a test node">
<NODE name="objects" help="A generic object">
<NODE name="object" mode="rw" help="One object in a list">
<NODE name="*" help="The object's key - the name variable below">
<NODE name="name" mode="rw" help="This is the name of the object"/>
<NODE name="top-container" mode="rw" help="The top container in the object">
<NODE name="conf" mode="rw" help="The config for the top container">
<NODE name="enabled" mode="rw" help="Whether the top container is enabled" default="true">
<VALUE name="true" value="1"/>
<VALUE name="false" value="2"/>
</NODE>
</NODE>
<NODE name="inner-container" mode="rw" help="The inner container in the object">
<NODE name="conf" mode="rw" help="The config for the top container">
<NODE name="enabled" mode="rw" help="Whether the top container is enabled" default="false">
<VALUE name="true" value="1"/>
<VALUE name="false" value="2"/>
</NODE>
</NODE>
</NODE>
</NODE>
</NODE>
</NODE>
</NODE>
</NODE>
</MODULE>
3 changes: 0 additions & 3 deletions schema.c
Original file line number Diff line number Diff line change
Expand Up @@ -3517,9 +3517,6 @@ _merge_gnode_nodes (GNode *node1, GNode *node2)

for (child1 = node1->children; child1; child1 = child1->next)
{
if (!child1->children)
continue;

/* Match child1 to a child of node2. If matched descend down the tree. */
for (child2 = node2->children; child2; child2 = child2->next)
{
Expand Down

0 comments on commit 9b53371

Please sign in to comment.