Closed rgaura closed 1 year ago
I do not think I can help you, it makes no sense that an identityref is mentioned while the node is an uint16. I can only suggest trying to update everything, it may help.
Please refer to ietf-interfaces.yang for information regarding 'if:interface-ref'. 'if' is the prefix for ietf-interfaces.yang, and 'interface-ref' refers to "/if:interfaces/if:interface/if:name". This means that there is a dependency on 'interface' in o-ran-dhcp.yang with 'interfaces/interface/name' in ietf-interfaces.yang.
You need to fill out the ietf-interfaces.yang datastore before accessing o-ran-dhcp.yang.
module ietf-interfaces {
yang-version 1.1;
namespace "urn:ietf:params:xml:ns:yang:ietf-interfaces";
prefix if;
...
/*
* Typedefs
*/
typedef interface-ref {
type leafref {
path "/if:interfaces/if:interface/if:name";
}
description
"This type is used by data models that need to reference
interfaces.";
}
...
That has nothing to do with identityref
, it is just a leafref
, something completely different.
Hello James
Anyway, I have already taken care of that, I mentioned that in my msg, but forgot to paste the XML.:
"The only leafref/identityref was because of interfaces that i have already provided as shown below and I don't see any error in that case."
<interfaces
xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces"
xmlns:ianaift="urn:ietf:params:xml:ns:yang:iana-if-type">
<interface>
<name>eth0</name>
<type>ianaift:ethernetCsmacd</type>
<enabled>true</enabled>
</interface>
</interfaces>
Which function exactly generated the error with the empty identityref?
Michal By function you mean netopeer2 API or which yang object. Didn't get clear idea by "function". Please clarify more.
[ERR] Invalid empty identityref value. (Schema location /o-ran-dhcp:dhcp/interfaces/dhcpv4/netconf-clients/optional-port, data location /o-ran-dhcp:dhcp/interfaces[interface='eth0']/dhcpv4/netconf-clients[client='192.168.12.13']/optional-port.)
This error must have been generated by a function, I mean sysrepo or libyang API function, which one exactly, what parameters did you use for it?
Hello Michal
Got your point.
API Used: rc =sr_set_item(session_op,(void *)&buff, &value, 0);
session_op: session to operational datastore (since all the yang objects are RO)
buff: buffer for constructed xpath: sprintf (buff,"/o-ran-dhcp:dhcp/interfaces[interface = \"%s\"]/dhcpv4/netconf-clients[client = \"%s\"]/optional-port", IntfName, cli);
value: Since it is sr_set_item, used sr_val_t: value.type = SR_UINT16_T; value.data.uint16_val = port
I am pasting GDB output, if it helps
1843 sprintf (buff,"/o-ran-dhcp:dhcp/interfaces[interface = \"%s\"]/dhcpv4/netconf-clients[client = \"%s\"]/optional-port", IntfName, cli);
(gdb)
1844 value.type = SR_UINT16_T;
(gdb)
1845 value.data.uint16_val = port;
(gdb) p buff
$1 = "/o-ran-dhcp:dhcp/interfaces[interface = \"eth0\"]/dhcpv4/netconf-clients[client = \"192.168.12.13\"]/optional-port", '\000' <repeats 143 times>
(gdb)
$2 = "/o-ran-dhcp:dhcp/interfaces[interface = \"eth0\"]/dhcpv4/netconf-clients[client = \"192.168.12.13\"]/optional-port", '\000' <repeats 143 times>
(gdb) n
1846 rc =sr_set_item(session_op,(void *)&buff, &value, 0);
(gdb)
[ERR] Invalid empty identityref value. (Schema location /o-ran-dhcp:dhcp/interfaces/dhcpv4/netconf-clients/optional-port, data location /o-ran-dhcp:dhcp/interfaces[interface='eth0']/dhcpv4/netconf-clients[client='192.168.12.13']/optional-port.)
[ERR] Edit was discarded.
1847 if (rc != SR_ERR_OK) {
(gdb)
1848 LOGGER(ERR,"MODULE","\n ========== INSERTING data item into db failed: ==========\n\n");
========== INSERTING data item into db failed: ==========
1849 return (retval=0);
(gdb) p value
$3 = {xpath = 0x58 <Address 0x58 out of bounds>, type = SR_UINT16_T, dflt = 32767, origin = 0x4143d8 "", data = {
binary_val = 0x7ffff5b67968 <_int_malloc+2712> "\303\017\204\337\002", bits_val = 0x7ffff5b67968 <_int_malloc+2712> "\303\017\204\337\002",
bool_val = -172590744, decimal64_val = 6.9533472807192643e-310, enum_val = 0x7ffff5b67968 <_int_malloc+2712> "\303\017\204\337\002",
identityref_val = 0x7ffff5b67968 <_int_malloc+2712> "\303\017\204\337\002", instanceid_val = 0x7ffff5b67968 <_int_malloc+2712> "\303\017\204\337\002",
int8_val = 104 'h', int16_val = 31080, int32_val = -172590744, int64_val = 140737315764584,
string_val = 0x7ffff5b67968 <_int_malloc+2712> "\303\017\204\337\002", uint8_val = 104 'h', uint16_val = 31080, uint32_val = 4122376552,
uint64_val = 140737315764584, anyxml_val = 0x7ffff5b67968 <_int_malloc+2712> "\303\017\204\337\002",
anydata_val = 0x7ffff5b67968 <_int_malloc+2712> "\303\017\204\337\002"}}
(gdb) p port
$4 = 31080
(gdb)
I have failed to reproduce or understand this issue completely, please use gdb
and add breakpoint to ly_vlog
, when reached, please print the stack trace and post it here.
Hello Sir
I am using following versions of sysrepo and netopeer2-server: libsysrepo v2.1.64 (SO v7.6.6) netopeer2-server 2.1.23
While working on o-ran-dhcp.yang (standard 5G yang used for DHCP configuration - attached for your immediate reference). I got the following error:
The strange thing is I am only getting error for the two port objects (port-number and optional-port). Rest all works well. I looked into yang but yang does not have any identityref linked to both of these port object. I uninstalled and installed yang just in case if there was any corruption of fields.
The only leafref/identityref was because of interfaces that i have already provided as shown below and I don't see any error in that case.
I am trying to add the stuff like this:
Then, why this identifyref issue? I am out of clues now, so writing to you, please suggest.
Thanks rgaura
o-ran-dhcp.yang.txt