Closed nowaits closed 3 years ago
Fixed by patch above. Please verify
Hi,olof ~ This is a similar bug with restconf
The same YANG file
startup_db is
<configuration>
<a xmlns="http://example">
<b/>
</a>
<restconf xmlns="http://clicon.org/restconf">
<enable>true</enable>
<auth-type>none</auth-type>
<pretty>true</pretty>
<fcgi-socket>/home/dev/code/net-base/dist/www/fastcgi_restconf.sock</fcgi-socket>
</restconf>
</configuration>
and in cli
curl -X PATCH -H "Content-Type: application/yang-data+json" -d '{
"example:a":{
"b":"aa"
}
}' http://localhost/restconf/data/example:a
Curl has no error, but in runing_db, the value b unchanged.
I cannot recreate it. Please double-check, if it still remains, please add more info on how you triggered the error.
olof@alarik> curl -X GET -H "Content-Type: application/yang-data+json" http://localhost/restconf/data/example:a
{"example:a":{"b":""}}
olof@alarik> sudo cat /usr/local/var/example/running_db
<config>
<a xmlns="urn:example:clixon">
<b></b>
</a>
</config>
olof@alarik> curl -X PATCH -H "Content-Type: application/yang-data+json" http://localhost/restconf/data/example:a -d '{"example:a":{"b":"aa"}}'
olof@alarik> curl -X GET -H "Content-Type: application/yang-data+json" http://localhost/restconf/data/example:a
{"example:a":{"b":"aa"}}
olof@alarik> sudo cat /usr/local/var/example/running_db
<config>
<a xmlns="urn:example:clixon">
<b>aa</b>
</a>
</config>
In my running_db, it's not
<b></b>
it's
<b/>
[root@localhost mgmt]# curl -X GET -H "Content-Type: application/yang-data+json" http://localhost/restconf/data/example:a
{
"example:a": {
"b": ""
}
}
[root@localhost mgmt]# head -n 4 running_db
<configuration>
<a xmlns="http://example">
<b/>
</a>
[root@localhost mgmt]# curl -X PATCH -H "Content-Type: application/yang-data+json" http://localhost/restconf/data/example:a -d '{"example:a":{"b":"aa"}}' [root@localhost mgmt]# head -n 4 running_db
<configuration>
<a xmlns="http://example">
<b/>
</a>
hi olof, Issule with Changing value from empty to none empty still exist. Config is:
<configuration>
<a xmlns="http://example">
<b/>
</a>
<restconf xmlns="http://clicon.org/restconf">
<enable>true</enable>
<auth-type>none</auth-type>
<pretty>true</pretty>
<fcgi-socket>/home/dev/code/net-base/dist/www/fastcgi_restconf.sock</fcgi-socket>
</restconf>
</configuration>
Below is the test output:
[dev@localhost net-base]$ sudo cat /home/dev/var/mgmt/running_db
<configuration>
<a xmlns="http://example">
<b/>
</a>
<restconf xmlns="http://clicon.org/restconf">
<enable>true</enable>
<auth-type>none</auth-type>
<pretty>true</pretty>
<fcgi-socket>/home/dev/code/net-base/dist/www/fastcgi_restconf.sock</fcgi-socket>
</restconf>
</configuration>
[dev@localhost net-base]$ curl -X GET -H "Content-Type: application/yang-data+json" http://localhost/restconf/data/example:a
{
"example:a": {
"b": ""
}
}
[dev@localhost net-base]$ curl -X PATCH -H "Content-Type: application/yang-data+json" http://localhost/restconf/data/example:a -d '{"example:a":{"b":"aa"}}'
[dev@localhost net-base]$ curl -X GET -H "Content-Type: application/yang-data+json" http://localhost/restconf/data/example:a
{
"example:a": {
"b": ""
}
}
[dev@localhost net-base]$ sudo cat /home/dev/var/mgmt/running_db <configuration>
<a xmlns="http://example">
<b/>
</a>
<restconf xmlns="http://clicon.org/restconf">
<enable>true</enable>
<auth-type>none</auth-type>
<pretty>true</pretty>
<fcgi-socket>/home/dev/code/net-base/dist/www/fastcgi_restconf.sock</fcgi-socket>
</restconf>
</configuration>
[dev@localhost net-base]$
hi olof here is an bug with
restcon patch method
my yang is:startup_db is
and in cli
Curl has no error, but in runing_db, the value
b
unchanged.