05-08-2020 01:01 AM - edited 05-08-2020 08:09 PM
I just want to use Navu api to call device_sync_from action in a service rather than in action, following is my code and logs.
The NavuAction syncFrom is correct but syncFrom.call() seems resulting nso said "Aborted: application timeout".
Call device sync-from should be easy, but I made a mistake somewhere probably.
I'm sorry to ask such a stupid question o(╥﹏╥)o , but can someone help me??
Appreciate for your help!
@ServiceCallback(servicePoint = "servicepoint", callType = ServiceCBType.PRE_MODIFICATION) public Properties preModification(ServiceContext context, ServiceOperationType operation, ConfPath path, Properties opaque) throws ConfException{ NavuNode ncsRoot = context.getRootNode(); NavuNode service = context.getServiceNode(); NavuList policies = service.list("policy"); for(NavuContainer policy : policies.elements()) { String deviceName = policy.leaf("device").valueAsString(); NavuContainer device = (NavuContainer)ncsRoot.getNavuNode(new ConfPath("/ncs:devices/device{%s}", deviceName)); NavuAction syncFrom = device.action("sync-from"); ConfXMLParam[] response = syncFrom.call(); // ncsRoot.container("devices").list("device").elem(deviceName).action("sync-from").call(); } return opaque; }
<DEBUG> 8-May-2020::16:16:03.806 ubuntu ncs[9594]: devel-c trans_lock request daemon id: 5 session id: 309 <DEBUG> 8-May-2020::16:16:03.806 ubuntu ncs[9594]: devel-c trans_lock succeeded daemon id: 5 session id: 309 <DEBUG> 8-May-2020::16:16:03.807 ubuntu ncs[9594]: ncs commit progress db=running usid=116 thandle=309: validate: grabbing transaction lock ok <DEBUG> 8-May-2020::16:16:03.807 ubuntu ncs[9594]: ncs commit progress db=running usid=116 thandle=309: validate: run transforms and transaction hooks... <INFO> 8-May-2020::16:16:03.809 ubuntu ncs[9594]: ncs service /security-policy-request{8}: pre_modification: service pre-modification... <DEBUG> 8-May-2020::16:16:03.809 ubuntu ncs[9594]: ncs commit progress db=running usid=116 thandle=309: ncs: service /security-policy-requests/security-policy-request[request-id='8']: pre-modification: service pre-modification... <DEBUG> 8-May-2020::16:16:03.810 ubuntu ncs[9594]: devel-c new_usess db request daemon id: 64 <DEBUG> 8-May-2020::16:16:03.811 ubuntu ncs[9594]: devel-c db reply daemon id: 64 <DEBUG> 8-May-2020::16:16:03.811 ubuntu ncs[9594]: devel-c new_trans request daemon id: 64 thandle: 309 <DEBUG> 8-May-2020::16:16:03.825 ubuntu ncs[9594]: devel-c New worker connected (daemon id: 64 worker id: 2) <DEBUG> 8-May-2020::16:16:03.826 ubuntu ncs[9594]: devel-c new_trans succeeded daemon id: 64 session id: 2 worker id: 2 <DEBUG> 8-May-2020::16:16:03.826 ubuntu ncs[9594]: devel-c service_pre_modification(create) request for callpoint 'security-policy-servicepoint' path /security-policy-request{8} <INFO> 8-May-2020::16:16:03.866 ubuntu ncs[9594]: ncs locked <DEBUG> 8-May-2020::16:16:03.868 ubuntu ncs[9594]: ncs Requestor {'sync-from',116,<0.11379.0>} tries to acquire lock for device <<"fw-0">> <INFO> 8-May-2020::16:16:03.874 ubuntu ncs[9594]: ncs device fw-0: sync-from... <INFO> 8-May-2020::16:16:03.882 ubuntu ncs[9594]: ncs device fw-0: connect: device connect... <INFO> 8-May-2020::16:16:03.949 ubuntu ncs[9594]: ncs device fw-0: connect: device connect ok <INFO> 8-May-2020::16:16:04.505 ubuntu ncs[9594]: ncs device fw-0: show: device show... <INFO> 8-May-2020::16:16:05.135 ubuntu ncs[9594]: ncs device fw-0: show: device show ok <INFO> 8-May-2020::16:16:05.135 ubuntu ncs[9594]: ncs device fw-0: get_trans_id: device get-trans-id... <INFO> 8-May-2020::16:16:05.141 ubuntu ncs[9594]: ncs device fw-0: get_trans_id: device get-trans-id ok <DEBUG> 8-May-2020::16:16:05.141 ubuntu ncs[9594]: ncs commit progress db=running usid=116 thandle=315: entering validate phase for running... <DEBUG> 8-May-2020::16:16:05.142 ubuntu ncs[9594]: ncs commit progress db=running usid=116 thandle=315: validate: run pre-trans-lock service callbacks... <DEBUG> 8-May-2020::16:16:05.145 ubuntu ncs[9594]: ncs commit progress db=running usid=116 thandle=315: validate: run transforms and transaction hooks... <DEBUG> 8-May-2020::16:16:05.146 ubuntu ncs[9594]: ncs commit progress db=running usid=116 thandle=315: validate: run transforms and transaction hooks done <DEBUG> 8-May-2020::16:16:05.147 ubuntu ncs[9594]: ncs commit progress db=running usid=116 thandle=315: validate: pre-trans-lock service callbacks done <DEBUG> 8-May-2020::16:16:05.147 ubuntu ncs[9594]: ncs commit progress db=running usid=116 thandle=315: validate: grabbing transaction lock... <INFO> 8-May-2020::16:16:36.925 ubuntu ncs[9594]: ncs device fw-0: close: device close... <INFO> 8-May-2020::16:16:36.926 ubuntu ncs[9594]: ncs device fw-0: close: device close ok <ERR> 8-May-2020::16:18:05.552 ubuntu ncs[9594]: devel-c Worker socket query timed out daemon 'CreateSecurityPolicyService' id 64 <ERR> 8-May-2020::16:18:05.554 ubuntu ncs[9594]: devel-c service_pre_modification(create) error {external_timeout, ""} for callpoint 'security-policy-servicepoint' path /security-policy-request{8} <INFO> 8-May-2020::16:18:05.555 ubuntu ncs[9594]: ncs service /security-policy-request{8}: pre_modification: service pre-modification error <DEBUG> 8-May-2020::16:18:05.557 ubuntu ncs[9594]: ncs commit progress db=running usid=116 thandle=309: ncs: service /security-policy-requests/security-policy-request[request-id='8']: pre-modification: service pre-modification error <DEBUG> 8-May-2020::16:18:05.558 ubuntu ncs[9594]: ncs commit progress db=undefined usid=122 thandle=321: entering write-start phase for operational... <DEBUG> 8-May-2020::16:18:05.558 ubuntu ncs[9594]: ncs commit progress db=undefined usid=122 thandle=321: cdb: write-start <DEBUG> 8-May-2020::16:18:05.559 ubuntu ncs[9594]: ncs commit progress db=running usid=116 thandle=309: validate: run transforms and transaction hooks done <DEBUG> 8-May-2020::16:18:05.560 ubuntu ncs[9594]: devel-c trans_unlock request daemon id: 5 session id: 309 <DEBUG> 8-May-2020::16:18:05.560 ubuntu ncs[9594]: devel-c new_trans request daemon id: 5 thandle: 315 <DEBUG> 8-May-2020::16:18:05.560 ubuntu ncs[9594]: devel-c trans_unlock succeeded daemon id: 5 session id: 309 <DEBUG> 8-May-2020::16:18:05.560 ubuntu ncs[9594]: devel-c new_trans succeeded daemon id: 5 session id: 315 worker id: 1 <DEBUG> 8-May-2020::16:18:05.561 ubuntu ncs[9594]: devel-c new_trans request daemon id: 1 thandle: 315 <DEBUG> 8-May-2020::16:18:05.561 ubuntu ncs[9594]: devel-c new_trans succeeded daemon id: 1 session id: 315 worker id: 1 <DEBUG> 8-May-2020::16:18:05.561 ubuntu ncs[9594]: devel-c trans_lock request daemon id: 5 session id: 315 <DEBUG> 8-May-2020::16:18:05.562 ubuntu ncs[9594]: devel-c trans_lock succeeded daemon id: 5 session id: 315 <DEBUG> 8-May-2020::16:18:05.562 ubuntu ncs[9594]: ncs commit progress db=running usid=116 thandle=315: validate: grabbing transaction lock ok <DEBUG> 8-May-2020::16:18:05.567 ubuntu ncs[9594]: ncs commit progress db=running usid=116 thandle=315: validate: creating rollback file...
Solved! Go to Solution.
05-09-2020 08:17 AM
You cannot call sync-from from inside your service code because you already have the database locked.
There is a previous thread on a similar topic here: https://community.cisco.com/t5/nso-developer-hub-discussions/call-partial-sync-from-function-in-cb-create/td-p/3895272
05-09-2020 08:17 AM
You cannot call sync-from from inside your service code because you already have the database locked.
There is a previous thread on a similar topic here: https://community.cisco.com/t5/nso-developer-hub-discussions/call-partial-sync-from-function-in-cb-create/td-p/3895272
05-09-2020 08:06 PM
Thanks vleijon ! understand now.
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