2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.onap.so.bpmn.infrastructure.scripts
23 import org.json.JSONObject
26 import static org.apache.commons.lang3.StringUtils.*
27 import groovy.xml.XmlUtil
29 import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
30 import org.onap.so.bpmn.common.scripts.ExceptionUtil
31 import org.onap.so.bpmn.common.scripts.ExternalAPIUtil
32 import org.onap.so.bpmn.common.scripts.AaiUtil
33 import org.onap.so.bpmn.common.scripts.MsoUtils
34 import org.onap.so.bpmn.common.recipe.ResourceInput
35 import org.onap.so.bpmn.common.resource.ResourceRequestBuilder
36 import org.onap.so.bpmn.core.WorkflowException
37 import org.onap.so.bpmn.core.json.JsonUtils
38 import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.builder.AbstractBuilder
39 import org.onap.so.rest.APIResponse
40 import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils
41 import org.onap.so.bpmn.infrastructure.workflow.service.ServicePluginFactory
43 import org.onap.so.logger.MsoLogger
45 import org.camunda.bpm.engine.runtime.Execution
46 import org.camunda.bpm.engine.delegate.BpmnError
47 import org.camunda.bpm.engine.delegate.DelegateExecution
48 import org.apache.commons.lang3.*
49 import org.apache.commons.codec.binary.Base64
50 import org.springframework.web.util.UriUtils
51 import org.onap.so.rest.RESTClient
52 import org.onap.so.rest.RESTConfig
55 * This groovy class supports the <class>Delete3rdONAPE2EServiceInstance.bpmn</class> process.
56 * flow for Delete 3rdONAPE2EServiceInstance in 3rdONAP
58 public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcessor {
60 String Prefix = "CRE3rdONAPESI_"
62 ExceptionUtil exceptionUtil = new ExceptionUtil()
64 JsonUtils jsonUtil = new JsonUtils()
66 private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, Delete3rdONAPE2EServiceInstance.class)
68 public void checkSPPartnerInfoFromAAI (DelegateExecution execution) {
69 msoLogger.info(" ***** Started checkSPPartnerInfo *****")
71 //get bpmn inputs from resource request.
72 String requestId = execution.getVariable("mso-request-id")
73 String requestAction = execution.getVariable("requestAction")
74 msoLogger.info("The requestAction is: " + requestAction)
75 String recipeParamsFromRequest = execution.getVariable("recipeParams")
76 msoLogger.info("The recipeParams is: " + recipeParamsFromRequest)
77 String resourceInput = execution.getVariable("resourceInput")
78 msoLogger.info("The resourceInput is: " + resourceInput)
79 //Get ResourceInput Object
80 ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class)
81 // set local resourceInput
82 execution.setVariable(Prefix + "ResourceInput", resourceInputObj)
84 String resourceInstanceId = resourceInputObj.getResourceInstancenUuid()
86 // Get Sppartner from AAI
87 AaiUtil aaiUriUtil = new AaiUtil(this)
88 String aai_uri = aaiUriUtil.getBusinessSPPartnerUri(execution)
89 String namespace = aaiUriUtil.getNamespaceFromUri(aai_uri)
90 String aai_endpoint = execution.getVariable("URN_aai_endpoint")
91 String serviceAaiPath = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(sppartnerId,"UTF-8")
92 execution.setVariable(Prefix + "serviceAaiPath", serviceAaiPath)
94 getSPPartnerInAAI(execution)
96 String callSource = "UUI"
97 String sppartnerUrl = ""
98 if(execution.getVariable(Prefix + "SuccessIndicator")) {
99 callSource = execution.getVariable(Prefix + "CallSource")
102 boolean is3rdONAPExist = false
103 if(!isBlank(sppartnerUrl)) {
104 is3rdONAPExist = true
107 execution.setVariable("Is3rdONAPExist", is3rdONAPExist)
108 execution.setVariable(Prefix + "ServiceInstanceId", resourceInputObj.getServiceInstanceId())
109 execution.setVariable("mso-request-id", requestId)
110 execution.setVariable("mso-service-instance-id", resourceInputObj.getServiceInstanceId())
112 } catch (BpmnError e) {
114 } catch (Exception ex){
115 String msg = "Exception in checkSPPartnerInfoFromAAI " + ex.getMessage()
117 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
121 public void checkLocallCall (DelegateExecution execution) {
122 msoLogger.info(" ***** Started checkLocallCall *****")
124 boolean isLocalCall = true
125 String callSource = execution.getVariable(Prefix + "CallSource")
126 if("ExternalAPI".equalsIgnoreCase(callSource)) {
129 execution.setVariable("IsLocalCall", isLocalCall)
132 public void preProcessRequest(DelegateExecution execution){
133 msoLogger.info(" ***** Started preProcessRequest *****")
135 ResourceInput resourceInputObj = execution.getVariable(Prefix + "resourceInput")
138 String globalSubscriberId = resourceInputObj.getGlobalSubscriberId()
139 if (isBlank(globalSubscriberId)) {
140 msg = "Input globalSubscriberId is null"
142 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
145 execution.setVariable("globalSubscriberId", globalSubscriberId)
146 msoLogger.info( "globalSubscriberId:" + globalSubscriberId)
148 String serviceType = resourceInputObj.getServiceType()
149 if (isBlank(serviceType)) {
150 msg = "Input serviceType is null"
152 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
154 execution.setVariable("serviceType", serviceType)
155 msoLogger.info( "serviceType:" + serviceType)
157 String operationId = resourceInputObj.getOperationId()
158 if (isBlank(operationId)) {
159 msg = "Input operationId is null"
161 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
163 execution.setVariable("operationId", operationId)
164 msoLogger.info( "operationId:" + operationId)
166 String resourceName = resourceInputObj.getResourceInstanceName()
167 if (isBlank(resourceName)) {
168 msg = "Input resourceName is null"
170 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
172 execution.setVariable("resourceName", resourceName)
173 msoLogger.info( "resourceInstanceId:" + resourceName)
175 String resourceTemplateId = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid()
176 if (isBlank(resourceTemplateId)) {
177 msg = "Input resourceTemplateId is null"
179 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
181 execution.setVariable("resourceTemplateId", resourceTemplateId)
182 msoLogger.info( "resourceTemplateId:" + resourceTemplateId)
184 } catch (BpmnError e) {
186 } catch (Exception ex){
187 String msg = "Exception in preProcessRequest " + ex.getMessage()
189 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
193 public void prepareUpdateProgress(DelegateExecution execution) {
194 msoLogger.info(" ***** Started prepareUpdateProgress *****")
195 ResourceInput resourceInputObj = execution.getVariable(Prefix + "ResourceInput")
196 String operType = resourceInputObj.getOperationType()
197 String resourceCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid()
198 String ServiceInstanceId = resourceInputObj.getServiceInstanceId()
199 String modelName = resourceInputObj.getResourceModelInfo().getModelName()
200 String operationId = resourceInputObj.getOperationId()
201 String progress = execution.getVariable("progress")
202 String status = execution.getVariable("status")
203 String statusDescription = execution.getVariable("statusDescription")
206 <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
207 xmlns:ns="http://org.openecomp.mso/requestsdb">
210 <ns:updateResourceOperationStatus>
211 <operType>${operType}</operType>
212 <operationId>${operationId}</operationId>
213 <progress>${progress}</progress>
214 <resourceTemplateUUID>${resourceCustomizationUuid}</resourceTemplateUUID>
215 <serviceId>${ServiceInstanceId}</serviceId>
216 <status>${status}</status>
217 <statusDescription>${statusDescription}</statusDescription>
218 </ns:updateResourceOperationStatus>
220 </soapenv:Envelope>"""
222 setProgressUpdateVariables(execution, body)
223 msoLogger.info(" ***** End prepareUpdateProgress *****")
226 public void prepare3rdONAPRequest(DelegateExecution execution) {
227 msoLogger.info(" ***** Started prepare3rdONAPRequest *****")
229 String sppartnerUrl = execution.getVariable(Prefix + "SppartnerUrl")
230 String extAPIPath = sppartnerUrl + 'serviceOrder'
231 execution.setVariable("ExternalAPIURL", extAPIPath)
233 // ExternalAPI message format
234 String externalId = execution.getVariable("resourceName")
235 String category = "E2E Service"
236 String description = "Service Order from SPPartner"
237 String requestedStartDate = utils.generateCurrentTimeInUtc()
238 String requestedCompletionDate = utils.generateCurrentTimeInUtc()
239 String priority = "1" // 0-4 0:highest
240 String subscriberId = execution.getVariable("globalSubscriberId")
241 String customerRole = ""
242 String subscriberName = ""
243 String referredType = "Consumer"
244 String orderItemId = "1"
245 String action = "delete" //for delete
246 String serviceState = "active"
247 String serviceName = ""
248 String serviceType = execution.getVariable("serviceType")
249 String serviceId = execution.getVariable(Prefix + "SppartnerId")
251 queryServicefrom3rdONAP(execution)
252 String serviceUuId = execution.getVariable(Prefix + "serviceSpecificationId")
254 Map<String, String> valueMap = new HashMap<>()
255 valueMap.put("externalId", '"' + externalId + '"')
256 valueMap.put("category", '"' + category + '"')
257 valueMap.put("description", '"' + description + '"')
258 valueMap.put("requestedStartDate", '"' + requestedStartDate + '"')
259 valueMap.put("requestedCompletionDate", '"' + requestedCompletionDate + '"')
260 valueMap.put("priority", '"'+ priority + '"')
261 valueMap.put("subscriberId", '"' + subscriberId + '"')
262 valueMap.put("customerRole", '"' + customerRole + '"')
263 valueMap.put("subscriberName", '"' + subscriberName + '"')
264 valueMap.put("referredType", '"' + referredType + '"')
265 valueMap.put("orderItemId", '"' + orderItemId + '"')
266 valueMap.put("action", '"' + action + '"')
267 valueMap.put("serviceState", '"' + serviceState + '"')
268 valueMap.put("serviceId", '"' + serviceId + '"')
269 valueMap.put("serviceName", '"' + serviceName + '"')
270 valueMap.put("serviceType", '"' + serviceType + '"')
271 valueMap.put("serviceUuId", '"' + serviceUuId + '"')
273 ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil(this)
275 valueMap.put("_requestInputs_", "")
277 String payload = externalAPIUtil.setTemplate(ExternalAPIUtil.PostServiceOrderRequestsTemplate, valueMap)
278 execution.setVariable(Prefix + "Payload", payload)
279 msoLogger.info( "Exit " + prepare3rdONAPRequest)
282 private void queryServicefrom3rdONAP(DelegateExecution execution)
284 msoLogger.info(" ***** Started queryServicefrom3rdONAP *****")
286 //https://{api_url}/nbi/api/v1/service/{serviceinstanceid}
287 String sppartnerUrl = execution.getVariable(Prefix + "SppartnerUrl")
288 String extAPIPath = sppartnerUrl + "service/" + execution.setVariable(Prefix + "SppartnerId")
290 ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil(this)
292 APIResponse response = externalAPIUtil.executeExternalAPIGetCall(execution, extAPIPath)
294 int responseCode = response.getStatusCode()
295 execution.setVariable(Prefix + "getServiceResponseCode", responseCode)
296 utils.log("DEBUG", "Get Service response code is: " + responseCode)
298 String extApiResponse = response.getResponseBodyAsString()
299 JSONObject responseObj = new JSONObject(extApiResponse)
300 execution.setVariable(Prefix + "getServiceResponse", extApiResponse)
302 //Process Response //200 OK 201 CREATED 202 ACCEPTED
303 if(responseCode == 200 || responseCode == 201 || responseCode == 202 )
305 utils.log("DEBUG", "Get Service Received a Good Response")
306 String serviceUuid = responseObj.get("serviceSpecification.id")
307 execution.setVariable(Prefix + "serviceSpecificationId", serviceUuid)
310 utils.log("DEBUG", "Get Service Received a Bad Response Code. Response Code is: " + responseCode)
311 exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Get Service Received a bad response from 3rdONAP External API")
314 msoLogger.info( "Exit " + queryServicefrom3rdONAP)
317 public void doDeleteE2ESIin3rdONAP(DelegateExecution execution) {
318 msoLogger.info(" ***** Started doDeleteE2ESIin3rdONAP *****")
320 String extAPIPath = execution.getVariable("ExternalAPIURL")
321 String payload = execution.getVariable(Prefix + "Payload")
323 ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil(this)
325 APIResponse response = externalAPIUtil.executeExternalAPIPostCall(execution, extAPIPath, payload)
327 int responseCode = response.getStatusCode()
328 execution.setVariable(Prefix + "postServiceOrderResponseCode", responseCode)
329 msoLogger.debug("Post ServiceOrder response code is: " + responseCode)
331 String extApiResponse = response.getResponseBodyAsString()
332 JSONObject responseObj = new JSONObject(extApiResponse)
333 execution.setVariable(Prefix + "postServiceOrderResponse", extApiResponse)
335 if(responseCode == 200 || responseCode == 201 || responseCode == 202 )
336 //200 OK 201 CREATED 202 ACCEPTED
338 msoLogger.debug("Post ServiceOrder Received a Good Response")
339 String serviceOrderId = responseObj.get("ServiceOrderId")
340 execution.setVariable(Prefix + "SuccessIndicator", true)
341 execution.setVariable("serviceOrderId", serviceOrderId)
344 msoLogger.debug("Post ServiceOrder Received a Bad Response Code. Response Code is: " + responseCode)
345 exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Post ServiceOrder Received a bad response from 3rdONAP External API")
348 msoLogger.info( "Exit " + doDeleteE2ESIin3rdONAP)
352 public void getE2ESIProgressin3rdONAP(DelegateExecution execution) {
353 msoLogger.info(" ***** Started getE2ESIProgressin3rdONAP *****")
355 String extAPIPath = execution.getVariable("ExternalAPIURL")
356 extAPIPath += "/" + execution.getVariable("ServiceOrderId")
358 ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil(this)
360 APIResponse response = externalAPIUtil.executeExternalAPIGetCall(execution, extAPIPath)
362 int responseCode = response.getStatusCode()
363 execution.setVariable(Prefix + "getServiceOrderResponseCode", responseCode)
364 msoLogger.debug("Get ServiceOrder response code is: " + responseCode)
366 String extApiResponse = response.getResponseBodyAsString()
367 JSONObject responseObj = new JSONObject(extApiResponse)
368 execution.setVariable(Prefix + "getServiceOrderResponse", extApiResponse)
370 //Process Response //200 OK 201 CREATED 202 ACCEPTED
371 if(responseCode == 200 || responseCode == 201 || responseCode == 202 )
373 msoLogger.debug("Get ServiceOrder Received a Good Response")
374 String serviceOrderState = responseObj.get("State")
375 execution.setVariable(Prefix + "SuccessIndicator", true)
376 execution.setVariable("serviceOrderState", serviceOrderState)
378 // Get serviceOrder State and process progress
379 if("ACKNOWLEDGED".equalsIgnoreCase(serviceOrderState)) {
380 execution.setVariable("progress", 15)
381 execution.setVariable("status", "processing")
383 if("INPROGRESS".equalsIgnoreCase(serviceOrderState)) {
384 execution.setVariable("progress", 40)
385 execution.setVariable("status", "processing")
387 if("COMPLETED".equalsIgnoreCase(serviceOrderState)) {
388 execution.setVariable("progress", 100)
389 execution.setVariable("status", "finished")
391 if("FAILED".equalsIgnoreCase(serviceOrderState)) {
392 execution.setVariable("progress", 100)
393 execution.setVariable("status", "error")
396 execution.setVariable("progress", 100)
397 execution.setVariable("status", "error")
398 execution.setVariable("statusDescription", "Delete Service Order Status is unknown")
400 execution.setVariable("statusDescription", "Delete Service Order Status is " + serviceOrderState)
403 msoLogger.debug("Get ServiceOrder Received a Bad Response Code. Response Code is: " + responseCode)
404 execution.setVariable("progress", 100)
405 execution.setVariable("status", "error")
406 execution.setVariable("statusDescription", "Get ServiceOrder Received a bad response")
407 exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Get ServiceOrder Received a bad response from 3rdONAP External API")
410 msoLogger.info( "Exit " + getE2ESIProgressin3rdONAP)
416 public void timeDelay(DelegateExecution execution) {
419 } catch(InterruptedException e) {
420 utils.log("ERROR", "Time Delay exception" + e )
424 private void getSPPartnerInAAI(DelegateExecution execution) {
425 msoLogger.info(" ***** Started postDeleteE2ESIin3rdONAP *****")
427 AaiUtil aaiUriUtil = new AaiUtil(this)
428 String serviceAaiPath = execution.getVariable(Prefix + "serviceAaiPath")
429 APIResponse response = aaiUriUtil.executeAAIGetCall(execution, serviceAaiPath)
430 int responseCode = response.getStatusCode()
431 execution.setVariable(Prefix + "GetSppartnerResponseCode", responseCode)
432 msoLogger.debug(" Get sppartner response code is: " + responseCode)
434 String aaiResponse = response.getResponseBodyAsString()
435 aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse)
436 aaiResponse = aaiResponse.replaceAll("&", "&")
437 execution.setVariable(Prefix + "GetSppartnerResponse", aaiResponse)
440 if(responseCode == 200 || responseCode == 201 || responseCode == 202 )
441 //200 OK 201 CREATED 202 ACCEPTED
443 msoLogger.debug("GET sppartner Received a Good Response")
444 execution.setVariable(Prefix + "SuccessIndicator", true)
445 execution.setVariable(Prefix + "FoundIndicator", true)
447 String sppartnerId = utils.getNodeText1(aaiResponse, "sppartner-id")
448 execution.setVariable(Prefix + "SppartnerId", sppartnerId)
449 msoLogger.debug(" SppartnerId is: " + sppartnerId)
450 String sppartnerUrl = utils.getNodeText1(aaiResponse, "sppartner-url")
451 execution.setVariable(Prefix + "SppartnerUrl", sppartnerUrl)
452 msoLogger.debug(" SppartnerUrl is: " + sppartnerUrl)
453 String callSource = utils.getNodeText1(aaiResponse, "sppartner-callsource")
454 execution.setVariable(Prefix + "CallSource", callSource)
455 msoLogger.debug(" CallSource is: " + callSource)
456 String sppartnerVersion = utils.getNodeText1(aaiResponse, "resource-version")
457 execution.setVariable(Prefix + "SppartnerVersion", sppartnerVersion)
458 msoLogger.debug(" Resource Version is: " + sppartnerVersion)
462 msoLogger.debug("Get sppartner Received a Bad Response Code. Response Code is: " + responseCode)
463 exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode)
464 throw new BpmnError("MSOWorkflowException")
467 msoLogger.info( "Exit " + deleteSPPartnerInAAI)
470 public void deleteSPPartnerInAAI(DelegateExecution execution) {
471 msoLogger.info(" ***** Started postDeleteE2ESIin3rdONAP *****")
473 String sppartnerId = execution.getVariable(Prefix + "SppartnerId")
474 String sppartnerUrl = execution.getVariable(Prefix + "sppartnerUrl")
475 String sppartnerVersion = execution.getVariable(Prefix + "sppartnerVersion")
477 AaiUtil aaiUriUtil = new AaiUtil(this)
478 String serviceAaiPath = execution.getVariable(Prefix + "serviceAaiPath") + "?resource-version=${sppartnerVersion}"
479 APIResponse response = aaiUriUtil.executeAAIDeleteCall(execution, serviceAaiPath)
480 int responseCode = response.getStatusCode()
481 execution.setVariable(Prefix + "DeleteSppartnerResponseCode", responseCode)
482 msoLogger.debug(" Get sppartner response code is: " + responseCode)
484 String aaiResponse = response.getResponseBodyAsString()
485 aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse)
486 execution.setVariable(Prefix + "DeleteSppartnerResponse", aaiResponse)
489 if(responseCode == 200 || responseCode == 201 || responseCode == 202 )
490 //200 OK 201 CREATED 202 ACCEPTED
492 msoLogger.debug("Delete sppartner Received a Good Response")
493 execution.setVariable(Prefix + "SuccessIndicator", true)
495 else if(responseCode == 404){
496 msoLogger.debug(" Delete sppartner Received a Not Found (404) Response")
497 execution.setVariable(Prefix + "FoundIndicator", false)
501 msoLogger.debug("Delete sppartner Received a Bad Response Code. Response Code is: " + responseCode)
502 exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode)
503 throw new BpmnError("MSOWorkflowException")
506 msoLogger.info( "Exit " + deleteSPPartnerInAAI)
509 private void setProgressUpdateVariables(DelegateExecution execution, String body) {
510 def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint")
511 execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint)
512 execution.setVariable("CVFMI_updateResOperStatusRequest", body)
515 public void postProcess(DelegateExecution execution){
516 msoLogger.info(" ***** Started postProcess *****")
517 String responseCode = execution.getVariable(Prefix + "putSppartnerResponseCode")
518 String responseObj = execution.getVariable(Prefix + "putSppartnerResponse")
520 msoLogger.info("response from AAI for put sppartner, response code :" + responseCode + " response object :" + responseObj)
521 msoLogger.info(" ***** Exit postProcess *****")
524 public void sendSyncResponse (DelegateExecution execution) {
525 msoLogger.debug(" *** sendSyncResponse *** ")
528 String operationStatus = "finished"
529 // RESTResponse for main flow
530 String resourceOperationResp = """{"operationStatus":"${operationStatus}"}""".trim()
531 msoLogger.debug(" sendSyncResponse to APIH:" + "\n" + resourceOperationResp)
532 sendWorkflowResponse(execution, 202, resourceOperationResp)
533 execution.setVariable("sentSyncResponse", true)
535 } catch (Exception ex) {
536 String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage()
538 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
540 msoLogger.debug(" ***** Exit sendSyncResopnse *****")