03-12-2020 03:19 AM
Hi All,
I am trying to extract a single variable within a service without success:
my curl
http://10.40.62.20:8080/api/running/services/olt-user-activation/?deep
header Accept application/vnd.yang.collection+json
example of reply:
{ "collection": { "olt-user-activation:olt-user-activation": [ { "service-id": "114MColt13", "creation-date": "Wed Mar 11 11:10:44 CET 2020", "customer": "ING", "onu-name": "ONUMultiolt13", "olt-name": "RM_00/OLT13", "cos-type": "MultiCOS", "gpon-slot": 1, "gpon-port": 2, "onu-number": 5, "s-vlan": 112, "c-vlan": 60, "user-vlan": 835, "cos": [ { "cos-class": "0", "tcont-profile": "TC_type3_300M_10M", "down-traffic-profile": "TP_P100M_C33M" }, { "cos-class": "1", "tcont-profile": "TC_type3_300M_50M", "down-traffic-profile": "TP_P1000M_C67M" }, { "cos-class": "5", "tcont-profile": "OF_cos05_128K_128K", "down-traffic-profile": "TP_P128k_C128k", "up-traffic-profile": "TP_P128k_C128k" } ], "operations": { "check-sync": "/api/running/services/olt-user-activation:olt-user-activation/114MColt13/_operations/check-sync", "deep-check-sync": "/api/running/services/olt-user-activation:olt-user-activation/114MColt13/_operations/deep-check-sync", "re-deploy": "/api/running/services/olt-user-activation:olt-user-activation/114MColt13/_operations/re-deploy", "reactive-re-deploy": "/api/running/services/olt-user-activation:olt-user-activation/114MColt13/_operations/reactive-re-deploy", "touch": "/api/running/services/olt-user-activation:olt-user-activation/114MColt13/_operations/touch", "get-modifications": "/api/running/services/olt-user-activation:olt-user-activation/114MColt13/_operations/get-modifications", "un-deploy": "/api/running/services/olt-user-activation:olt-user-activation/114MColt13/_operations/un-deploy", "self-test": "/api/running/services/olt-user-activation:olt-user-activation/114MColt13/_operations/self-test" } }, { "service-id": "AAA0052059", "creation-date": "Fri Jan 31 17:17:47 CET 2020", "customer": "OPT", "pop-name": "RM_00", "onu-name": "6622851107433438859", "olt-name": "RM_00/OLT01", "cos-type": "MonoCOS", "gpon-slot": 6, "gpon-port": 7, "onu-number": 2, "cos": [ { "cos-class": "0", "s-vlan": 647, "c-vlan": 6666, "user-vlan": 835, "tcont-profile": "TC_Type3_300M_20M", "down-traffic-profile": "TP_P1000M_C40M" }, { "cos-class": "5", "s-vlan": 820, "c-vlan": 6666, "user-vlan": 837, "tcont-profile": "TC_Type1_512k", "down-traffic-profile": "TP_P512k_C512k", "up-traffic-profile": "TP_P512k_C512k" } ], "operations": { "check-sync": "/api/running/services/olt-user-activation:olt-user-activation/AAA0052059/_operations/check-sync", "deep-check-sync": "/api/running/services/olt-user-activation:olt-user-activation/AAA0052059/_operations/deep-check-sync", "re-deploy": "/api/running/services/olt-user-activation:olt-user-activation/AAA0052059/_operations/re-deploy", "reactive-re-deploy": "/api/running/services/olt-user-activation:olt-user-activation/AAA0052059/_operations/reactive-re-deploy", "touch": "/api/running/services/olt-user-activation:olt-user-activation/AAA0052059/_operations/touch", "get-modifications": "/api/running/services/olt-user-activation:olt-user-activation/AAA0052059/_operations/get-modifications", "un-deploy": "/api/running/services/olt-user-activation:olt-user-activation/AAA0052059/_operations/un-deploy", "self-test": "/api/running/services/olt-user-activation:olt-user-activation/AAA0052059/_operations/self-test" } }, { "service-id": "FIX1", "creation-date": "Tue Feb 04 10:39:28 CET 2020", "customer": "ING", "pop-name": "RM_00", "olt-name": "RM_00/OLT01", "cos-type": "MonoCOS", "gpon-slot": 2, "gpon-port": 2, "onu-number": 2, "onu-type": "ZTE-F601", "cos": [ { "cos-class": "0", "s-vlan": 2211, "c-vlan": 6666, "user-vlan": 835, "tcont-profile": "TC_type3_100M_10M", "down-traffic-profile": "TP_P100M_C10M" }, { "cos-class": "5", "s-vlan": 2213, "c-vlan": 6666, "user-vlan": 937, "tcont-profile": "TC_type1_512k", "down-traffic-profile": "TP_P128k_C128k", "up-traffic-profile": "TP_P128k_C128k" } ], "operations": { "check-sync": "/api/running/services/olt-user-activation:olt-user-activation/FIX1/_operations/check-sync", "deep-check-sync": "/api/running/services/olt-user-activation:olt-user-activation/FIX1/_operations/deep-check-sync", "re-deploy": "/api/running/services/olt-user-activation:olt-user-activation/FIX1/_operations/re-deploy", "reactive-re-deploy": "/api/running/services/olt-user-activation:olt-user-activation/FIX1/_operations/reactive-re-deploy", "touch": "/api/running/services/olt-user-activation:olt-user-activation/FIX1/_operations/touch", "get-modifications": "/api/running/services/olt-user-activation:olt-user-activation/FIX1/_operations/get-modifications", "un-deploy": "/api/running/services/olt-user-activation:olt-user-activation/FIX1/_operations/un-deploy", "self-test": "/api/running/services/olt-user-activation:olt-user-activation/FIX1/_operations/self-test" } },
The request is to extract only a varible for example "customer".
Thanks
Matteo
Solved! Go to Solution.
04-28-2020 04:54 AM
If it is a list that is accessed, the tailf extension for collections is necessary to wrap the list elements in a root element. This functionality is missing from the RFC 8040.
Supply the following arccept header together with the query
Accept: application/vnd.yang.collection+xml
03-12-2020 07:39 AM - edited 03-12-2020 08:33 AM
Well, to get to the 'customer' tag you'll need to specify the service instance that you want to get that from.
In your example I'm assuming that "service-id = 114Colt13" is the service instance list key. In this case the curl for the get will look something like this to get the customer tag:
http://10.40.62.20:8080/api/running/services/olt-user-activation/114Colt13/customer
PSA: REST interface is deprecated in NSO and will be getting removed, please consider using RESTCONF
03-12-2020 01:31 PM
04-28-2020 03:30 AM
Thanks for the support, and sorry for the delay of my reply :)
I started studying the restconf interface,
when I try to export all the service istances i received this error:
04-28-2020 04:54 AM
If it is a list that is accessed, the tailf extension for collections is necessary to wrap the list elements in a root element. This functionality is missing from the RFC 8040.
Supply the following arccept header together with the query
Accept: application/vnd.yang.collection+xml
04-28-2020 04:56 AM
04-28-2020 05:02 AM
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide