Changing the value of a key in a YANG list element creates a new node rather than replacing it
The title may be over-generalizing, but I suspect not.
I experienced this issue with option-data for kea-dhcp4.
The issue manifests in master and 2.4.1 with sysrepo v2, but also in 2.2.1 with sysrepo v1.
The issue may become more prevalent if issue 3198 gets merged as it was written at the time this issue was created. It makes data
a key and that makes it more likely to have entries with only code, space and data (all keys), which is also why this issue became obvious there.
Replication:
- Start kea-dhcp4 with a control-socket configured.
- Start kea-netconf with the same control-socket configured under the
"dhcp4"
server. - Do a
sysrepocfg --edit=kea-dhcp4-config.xml
wherekea-dhcp4-config.xml
has this content:
<config xmlns="urn:ietf:params:xml:ns:yang:kea-dhcp4-server">
<control-socket>
<socket-name>/tmp/kea-dhcp4-ctrl.sock</socket-name>
<socket-type>unix</socket-type>
</control-socket>
<option-data>
<code>100</code>
<space>dhcp4</space>
<data>1234</data>
</option-data>
</config>
- Run the command again with
<code>100</code>
changed to<code>101</code>
. Only one option was expected as specified in the XML, but there are two options as indicated by the kea-netconf logs:
DEBUG [kea-netconf.netconf] NETCONF_UPDATE_CONFIG updating configuration with dhcp4 server: {
"Dhcp4": {
"control-socket": {
"socket-name": "/tmp/kea-dhcp4-ctrl.sock",
"socket-type": "unix"
},
"option-data": [
{
"code": 100,
"data": "1234",
"space": "dhcp4"
},
{
"code": 101,
"data": "1234",
"space": "dhcp4"
}
]
}
}
INFO [kea-netconf.netconf] NETCONF_UPDATE_CONFIG_COMPLETED completed updating configuration for dhcp4 server
and by the response to a subsequent config-get
command which contains:
"option-data": [
{
"always-send": false,
"code": 100,
"csv-format": true,
"data": "1234",
"name": "tcode",
"space": "dhcp4"
},
{
"always-send": false,
"code": 101,
"csv-format": true,
"data": "1234",
"name": "pcode",
"space": "dhcp4"
}
],