cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Announcements

JSON-RPC vs Restconf service creation difference

849
Views
5
Helpful
5
Comments
Swapnak
Cisco Employee

Hi All,


NSO : 5.2.2.1

Same input data when sent using restconf gives a different output vs when sent using JSONRPC

Yang model:

The contents list is ordered-by user

list ip-access-list {
key acl-name;
leaf acl-name {
tailf:info "list name (max size 64)";
type string;
tailf:cli-expose-key-name;
}
list contents {
key content;
ordered-by user;
leaf content {
tailf:info "rules";
type string;
tailf:cli-expose-key-name;
}
min-elements 1;
}
}

User input payload :

"ip-access-list": [
{
"acl-name": "45",
"contents": [
{
"content": "permit ip host 10.122.32.86 host 0.0.0.0"
},
{
"content": "permit ip host 10.122.32.88 host 0.0.0.0"
},
{
"content": "permit ip host 10.81.59.57 host 0.0.0.0"
},
{
"content": "permit ip host 10.81.59.56 host 0.0.0.0"
}
]
}
]


Service output When sent using restconf:

admin@ncs-cfs# show running-config services nx-global-conf-cfs device nx_0
services nx-global-conf-cfs device nx_0
aaa-flag false
banner motd "Robot Test WithCheck\n"
banner start-end-marker ^
snmp ip-access-list acl-name 45
contents content "permit ip host 10.122.32.86 host 0.0.0.0"
!
contents content "permit ip host 10.122.32.88 host 0.0.0.0"
!
contents content "permit ip host 10.81.59.57 host 0.0.0.0"
!
contents content "permit ip host 10.81.59.56 host 0.0.0.0"
!
!
!


Service output When sent using JSONRPC:

services nx-global-conf-cfs device nx_0
base-config domain-name boa
aaa-flag false
snmp ip-access-list acl-name 45
contents content "permit ip host 10.122.32.86 host 0.0.0.0"
!
contents content "permit ip host 10.122.32.88 host 0.0.0.0"
!
contents content "permit ip host 10.81.59.56 host 0.0.0.0"
!
contents content "permit ip host 10.81.59.57 host 0.0.0.0"
!
!
!

 

If we see the service output when sent using JSONRPC is not as per our expectation of "ordered-by user" 10.81.59.57 and 10.81.59.56 got re-ordered.

Just thinking if JSONRPC input to NSO is getting re-ordered even before it is hitting the NSO yang.

I am looking for, is this known behavior/bug with JSONRPC and the reason for this re-ordering.

How to handle this scenario ?

Thank you.

5 Comments