2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END=========================================================
22 package org.openecomp.mso.adapters.vnf;
25 import java.net.MalformedURLException;
27 import java.util.Collections;
28 import java.util.HashMap;
29 import java.util.List;
32 import javax.jws.WebService;
33 import javax.xml.bind.DatatypeConverter;
34 import javax.xml.namespace.QName;
35 import javax.xml.ws.BindingProvider;
36 import javax.xml.ws.Holder;
37 import javax.xml.ws.handler.MessageContext;
39 import org.openecomp.mso.adapters.vnf.async.client.CreateVnfNotification;
40 import org.openecomp.mso.adapters.vnf.async.client.QueryVnfNotification;
41 import org.openecomp.mso.adapters.vnf.async.client.UpdateVnfNotification;
42 import org.openecomp.mso.adapters.vnf.async.client.VnfAdapterNotify;
43 import org.openecomp.mso.adapters.vnf.async.client.VnfAdapterNotify_Service;
44 import org.openecomp.mso.adapters.vnf.exceptions.VnfException;
45 import org.openecomp.mso.cloud.CloudConfigFactory;
46 import org.openecomp.mso.entity.MsoRequest;
47 import org.openecomp.mso.logger.MessageEnum;
48 import org.openecomp.mso.logger.MsoAlarmLogger;
49 import org.openecomp.mso.logger.MsoLogger;
50 import org.openecomp.mso.openstack.beans.VnfRollback;
51 import org.openecomp.mso.openstack.beans.VnfStatus;
52 import org.openecomp.mso.properties.MsoPropertiesFactory;
54 @WebService(serviceName = "VnfAdapterAsync", endpointInterface = "org.openecomp.mso.adapters.vnf.MsoVnfAdapterAsync", targetNamespace = "http://org.openecomp.mso/vnfA")
55 public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
57 MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();
58 CloudConfigFactory cloudConfigFactory=new CloudConfigFactory();
60 public static final String MSO_PROP_VNF_ADAPTER="MSO_PROP_VNF_ADAPTER";
61 private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA);
62 private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger ();
63 private static final String BPEL_AUTH_PROP = "org.openecomp.mso.adapters.vnf.bpelauth";
64 private static final String ENCRYPTION_KEY = "aa3871669d893c7fb8abbcda31b88b4f";
67 * Health Check web method. Does nothing but return to show the adapter is deployed.
70 public void healthCheckA () {
71 LOGGER.debug ("Health check call in VNF Adapter");
75 * This is the asynchronous "Create VNF" web service implementation.
76 * It will create a new VNF of the requested type in the specified cloud
77 * and tenant. The tenant must exist before this service is called.
79 * If a VNF with the same name already exists, this can be considered a
80 * success or failure, depending on the value of the 'failIfExists' parameter.
82 * All VNF types will be defined in the MSO catalog. The caller must request
83 * one of these pre-defined types or an error will be returned. Within the
84 * catalog, each VNF type references (among other things) a Heat template
85 * which is used to deploy the required VNF artifacts (VMs, networks, etc.)
88 * Depending on the Heat template, a variable set of input parameters will
89 * be defined, some of which are required. The caller is responsible to
90 * pass the necessary input data for the VNF or an error will be thrown.
92 * The method sends an asynchronous response to the notification URL when
93 * processing completes. The createAsyncResponse contains the vnfId (the
94 * canonical name of the stack), a Map of VNF output attributes, and a
95 * VnfRollback object. This last object can be passed as-is to the
96 * rollbackVnf operation to undo everything that was created for the VNF.
97 * This is useful if a VNF is successfully created but the orchestrator
98 * fails on a subsequent operation.
100 * Note: this method is implemented by calling the synchronous web method
101 * and translating the response to an asynchronous notification.
103 * @param cloudSiteId CLLI code of the cloud site in which to create the VNF
104 * @param tenantId Openstack tenant identifier
105 * @param vnfType VNF type key, should match a VNF definition in catalog DB
106 * @param vnfName Name to be assigned to the new VNF
107 * @param inputs Map of key=value inputs for VNF stack creation
108 * @param failIfExists Flag whether already existing VNF should be considered
109 * a success or failure
110 * @param msoRequest Request tracking information for logs
111 * @param notificationURL the target URL for asynchronous response
114 public void createVnfA (String cloudSiteId,
120 String volumeGroupHeatStackId,
121 Map <String, String> inputs,
122 Boolean failIfExists,
125 MsoRequest msoRequest,
126 String notificationUrl) {
128 String serviceName = "CreateVnfA";
129 MsoLogger.setLogContext (msoRequest);
130 MsoLogger.setServiceName (serviceName);
131 LOGGER.info (MessageEnum.RA_ASYNC_CREATE_VNF, vnfName, vnfType, cloudSiteId, tenantId, "", "createVnfA");
132 // Use the synchronous method to perform the actual Create
133 MsoVnfAdapter vnfAdapter = new MsoVnfAdapterImpl (msoPropertiesFactory, cloudConfigFactory);
135 // Synchronous Web Service Outputs
136 Holder <String> vnfId = new Holder <> ();
137 Holder <Map <String, String>> outputs = new Holder <> ();
138 Holder <VnfRollback> vnfRollback = new Holder <> ();
141 vnfAdapter.createVnf (cloudSiteId,
147 volumeGroupHeatStackId,
155 MsoLogger.setServiceName (serviceName);
156 } catch (VnfException e) {
157 MsoLogger.setServiceName (serviceName);
158 LOGGER.error (MessageEnum.RA_CREATE_VNF_ERR, vnfName, cloudSiteId, tenantId, "", "createVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "VnfException in createVnfA", e);
159 org.openecomp.mso.adapters.vnf.async.client.MsoExceptionCategory exCat = null;
162 eMsg = e.getFaultInfo ().getMessage ();
163 exCat = org.openecomp.mso.adapters.vnf.async.client.MsoExceptionCategory.fromValue (e.getFaultInfo ()
166 } catch (Exception e1) {
167 LOGGER.error (MessageEnum.RA_FAULT_INFO_EXC, "", "createVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - Fault info", e1);
169 // Build and send Asynchronous error response
171 VnfAdapterNotify notifyPort = getNotifyEP (notificationUrl);
172 notifyPort.createVnfNotification (messageId, false, exCat, eMsg, null, null, null);
173 } catch (Exception e1) {
174 error = "Error sending createVnf notification " + e1.getMessage ();
175 LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, "", "createVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending createVnf notification", e1);
176 alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error);
178 LOGGER.info (MessageEnum.RA_ASYNC_CREATE_VNF_COMPLETE, "", "createVnfA", "", "createVnfA");
181 LOGGER.debug ("Async Create VNF: " + vnfName + " VnfId:" + vnfId.value);
182 // Build and send Asynchronous response
184 VnfAdapterNotify notifyPort = getNotifyEP (notificationUrl);
185 notifyPort.createVnfNotification (messageId,
190 copyCreateOutputs (outputs),
191 copyVrb (vnfRollback));
192 } catch (Exception e) {
193 error = "Error sending createVnf notification " + e.getMessage ();
194 LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, "", "createVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending createVnf notification", e);
195 alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error);
197 LOGGER.info (MessageEnum.RA_ASYNC_CREATE_VNF_COMPLETE, "", "createVnfA");
202 public void updateVnfA (String cloudSiteId,
208 String volumeGroupHeatStackId,
209 Map <String, String> inputs,
211 MsoRequest msoRequest,
212 String notificationUrl) {
214 String serviceName = "UpdateVnfA";
215 MsoLogger.setServiceName (serviceName);
216 MsoLogger.setLogContext (msoRequest);
217 LOGGER.info (MessageEnum.RA_ASYNC_UPDATE_VNF, vnfName, vnfType, cloudSiteId, tenantId, "", "UpdateVnfA");
219 // Use the synchronous method to perform the actual Create
220 MsoVnfAdapter vnfAdapter = new MsoVnfAdapterImpl (msoPropertiesFactory,cloudConfigFactory);
222 // Synchronous Web Service Outputs
223 Holder <String> vnfId = new Holder <> ();
224 Holder <Map <String, String>> outputs = new Holder <> ();
225 Holder <VnfRollback> vnfRollback = new Holder <> ();
228 vnfAdapter.updateVnf (cloudSiteId, tenantId, vnfType,vnfVersion, vnfName, requestType, volumeGroupHeatStackId, inputs, msoRequest, outputs, vnfRollback);
229 MsoLogger.setServiceName (serviceName);
230 } catch (VnfException e) {
231 MsoLogger.setServiceName (serviceName);
232 LOGGER.error (MessageEnum.RA_UPDATE_VNF_ERR, vnfName, cloudSiteId, tenantId, "", "UpdateVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending updateVnf notification", e);
233 org.openecomp.mso.adapters.vnf.async.client.MsoExceptionCategory exCat = null;
236 eMsg = e.getFaultInfo ().getMessage ();
237 exCat = org.openecomp.mso.adapters.vnf.async.client.MsoExceptionCategory.fromValue (e.getFaultInfo ()
240 } catch (Exception e1) {
241 LOGGER.error (MessageEnum.RA_FAULT_INFO_EXC, "", "UpdateVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - fault info", e1);
243 // Build and send Asynchronous error response
245 VnfAdapterNotify notifyPort = getNotifyEP (notificationUrl);
246 notifyPort.updateVnfNotification (messageId, false, exCat, eMsg, null, null);
247 } catch (Exception e1) {
248 error = "Error sending updateVnf notification " + e1.getMessage ();
249 LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, "", "UpdateVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending updateVnf notification", e1);
250 alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error);
252 LOGGER.info (MessageEnum.RA_ASYNC_UPDATE_VNF_COMPLETE, "", "UpdateVnfA");
255 LOGGER.debug ("Async Update VNF: " + vnfName + " VnfId:" + vnfId.value);
256 // Build and send Asynchronous response
258 VnfAdapterNotify notifyPort = getNotifyEP (notificationUrl);
259 notifyPort.updateVnfNotification (messageId,
263 copyUpdateOutputs (outputs),
264 copyVrb (vnfRollback));
265 } catch (Exception e) {
266 error = "Error sending updateVnf notification " + e.getMessage ();
267 LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, "", "UpdateVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending updateVnf notification", e);
268 alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error);
270 LOGGER.info (MessageEnum.RA_ASYNC_UPDATE_VNF_COMPLETE, "", "UpdateVnfA");
275 * This is the "Query VNF" web service implementation.
276 * It will look up a VNF by name or ID in the specified cloud and tenant.
278 * The method returns an indicator that the VNF exists, its Openstack internal
279 * ID, its status, and the set of outputs (from when the stack was created).
281 * @param cloudSiteId CLLI code of the cloud site in which to query
282 * @param tenantId Openstack tenant identifier
283 * @param vnfName VNF Name or Openstack ID
284 * @param msoRequest Request tracking information for logs
285 * @param notificationURL the target URL for asynchronous response
288 public void queryVnfA (String cloudSiteId,
292 MsoRequest msoRequest,
293 String notificationUrl) {
295 String serviceName = "QueryVnfA";
296 MsoLogger.setServiceName (serviceName);
297 MsoLogger.setLogContext (msoRequest);
298 LOGGER.info (MessageEnum.RA_ASYNC_QUERY_VNF, vnfName, cloudSiteId, tenantId);
300 // Use the synchronous method to perform the actual query
301 MsoVnfAdapter vnfAdapter = new MsoVnfAdapterImpl (msoPropertiesFactory,cloudConfigFactory);
303 // Synchronous Web Service Outputs
304 Holder <Boolean> vnfExists = new Holder <> ();
305 Holder <String> vnfId = new Holder <> ();
306 Holder <VnfStatus> status = new Holder <> ();
307 Holder <Map <String, String>> outputs = new Holder <> ();
310 vnfAdapter.queryVnf (cloudSiteId, tenantId, vnfName, msoRequest, vnfExists, vnfId, status, outputs);
311 MsoLogger.setServiceName (serviceName);
312 } catch (VnfException e) {
313 MsoLogger.setServiceName (serviceName);
314 LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, vnfName, cloudSiteId, tenantId, "", "queryVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending queryVnfA notification", e);
315 org.openecomp.mso.adapters.vnf.async.client.MsoExceptionCategory exCat = null;
318 eMsg = e.getFaultInfo ().getMessage ();
319 exCat = org.openecomp.mso.adapters.vnf.async.client.MsoExceptionCategory.fromValue (e.getFaultInfo ()
322 } catch (Exception e1) {
323 LOGGER.error (MessageEnum.RA_FAULT_INFO_EXC, "", "queryVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - fault info", e1);
325 // Build and send Asynchronous error response
327 VnfAdapterNotify notifyPort = getNotifyEP (notificationUrl);
328 notifyPort.queryVnfNotification (messageId, false, exCat, eMsg, null, null, null, null);
329 } catch (Exception e1) {
330 error = "Error sending queryVnf notification " + e1.getMessage ();
331 LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, "", "queryVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending queryVnf notification", e1);
332 alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error);
334 LOGGER.info (MessageEnum.RA_ASYNC_QUERY_VNF_COMPLETE, "", "queryVnfA");
338 if (!vnfExists.value) {
339 LOGGER.debug ("Async Query, VNF not found");
341 LOGGER.debug ("Async Query, VNF=" + vnfId.value + ", status=" + status.value);
343 // Build and send Asynchronous response
345 VnfAdapterNotify notifyPort = getNotifyEP (notificationUrl);
346 org.openecomp.mso.adapters.vnf.async.client.VnfStatus vnfS = org.openecomp.mso.adapters.vnf.async.client.VnfStatus.fromValue (status.value.name ());
347 notifyPort.queryVnfNotification (messageId,
354 copyQueryOutputs (outputs));
355 } catch (Exception e) {
356 error = "Error sending queryVnf notification " + e.getMessage ();
357 LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, "", "queryVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending queryVnf notification", e);
358 alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error);
361 LOGGER.info (MessageEnum.RA_ASYNC_QUERY_VNF_COMPLETE, "", "queryVnfA");
366 * This is the Asynchronous "Delete VNF" web service implementation.
367 * It will delete a VNF by name or ID in the specified cloud and tenant.
369 * The method has no outputs.
371 * @param cloudSiteId CLLI code of the cloud site in which to delete
372 * @param tenantId Openstack tenant identifier
373 * @param vnfName VNF Name or Openstack ID
375 * @param msoRequest Request tracking information for logs
376 * @param notificationUrl the target URL for asynchronous response
379 public void deleteVnfA (String cloudSiteId,
383 MsoRequest msoRequest,
384 String notificationUrl) {
386 String serviceName = "DeleteVnfA";
387 MsoLogger.setServiceName (serviceName);
388 MsoLogger.setLogContext (msoRequest);
389 LOGGER.info (MessageEnum.RA_ASYNC_DELETE_VNF, vnfName, cloudSiteId, tenantId);
391 // Use the synchronous method to perform the actual delete
392 MsoVnfAdapter vnfAdapter = new MsoVnfAdapterImpl (msoPropertiesFactory,cloudConfigFactory);
395 vnfAdapter.deleteVnf (cloudSiteId, tenantId, vnfName, msoRequest);
396 MsoLogger.setServiceName (serviceName);
397 } catch (VnfException e) {
398 MsoLogger.setServiceName (serviceName);
399 LOGGER.error (MessageEnum.RA_DELETE_VNF_ERR, vnfName, cloudSiteId, tenantId, "", "deleteVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending deleteVnfA notification", e);
400 org.openecomp.mso.adapters.vnf.async.client.MsoExceptionCategory exCat = null;
403 eMsg = e.getFaultInfo ().getMessage ();
404 exCat = org.openecomp.mso.adapters.vnf.async.client.MsoExceptionCategory.fromValue (e.getFaultInfo ()
407 } catch (Exception e1) {
408 LOGGER.error (MessageEnum.RA_FAULT_INFO_EXC, "", "deleteVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - fault info", e1);
410 // Build and send Asynchronous error response
412 VnfAdapterNotify notifyPort = getNotifyEP (notificationUrl);
413 notifyPort.deleteVnfNotification (messageId, false, exCat, eMsg);
414 } catch (Exception e1) {
415 error = "Error sending deleteVnf notification " + e1.getMessage ();
416 LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, "", "deleteVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending deleteVnfA notification", e1);
417 alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error);
419 LOGGER.info (MessageEnum.RA_ASYNC_DELETE_VNF_COMPLETE, "", "deleteVnfA");
423 LOGGER.debug ("Async Delete VNF: " + vnfName);
424 // Build and send Asynchronous response
426 VnfAdapterNotify notifyPort = getNotifyEP (notificationUrl);
427 notifyPort.deleteVnfNotification (messageId, true, null, null);
429 } catch (Exception e) {
430 error = "Error sending deleteVnf notification " + e.getMessage ();
431 LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, "", "deleteVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending deleteVnfA notification", e);
432 alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error);
435 LOGGER.info (MessageEnum.RA_ASYNC_DELETE_VNF_COMPLETE, "", "deleteVnfA");
440 * This web service endpoint will rollback a previous Create VNF operation.
441 * A rollback object is returned to the client in a successful creation
442 * response. The client can pass that object as-is back to the rollbackVnf
443 * operation to undo the creation.
446 public void rollbackVnfA (VnfRollback rollback, String messageId, String notificationUrl) {
447 String serviceName = "RollbackVnfA";
448 MsoLogger.setServiceName (serviceName);
450 // rollback may be null (e.g. if stack already existed when Create was called)
451 if (rollback == null) {
452 error = "Empty Rollback: No action to perform";
453 LOGGER.info (MessageEnum.RA_ROLLBACK_NULL, "", "rollbackVnfA");
454 alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error);
458 MsoLogger.setLogContext (rollback.getMsoRequest ());
459 LOGGER.info (MessageEnum.RA_ASYNC_ROLLBACK_VNF, "", "rollbackVnfA");
461 // Use the synchronous method to perform the actual rollback
462 MsoVnfAdapter vnfAdapter = new MsoVnfAdapterImpl (msoPropertiesFactory,cloudConfigFactory);
465 vnfAdapter.rollbackVnf (rollback);
466 MsoLogger.setServiceName (serviceName);
467 } catch (VnfException e) {
468 MsoLogger.setServiceName (serviceName);
469 LOGGER.error (MessageEnum.RA_ROLLBACK_VNF_ERR, "", "rollbackVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending rollbackVnfA notification", e);
470 org.openecomp.mso.adapters.vnf.async.client.MsoExceptionCategory exCat = null;
473 eMsg = e.getFaultInfo ().getMessage ();
474 exCat = org.openecomp.mso.adapters.vnf.async.client.MsoExceptionCategory.fromValue (e.getFaultInfo ()
477 } catch (Exception e1) {
478 LOGGER.error (MessageEnum.RA_FAULT_INFO_EXC, "", "rollbackVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - fault info", e1);
480 // Build and send Asynchronous error response
482 VnfAdapterNotify notifyPort = getNotifyEP (notificationUrl);
483 notifyPort.rollbackVnfNotification (messageId, false, exCat, eMsg);
484 } catch (Exception e1) {
485 error = "Error sending rollbackVnf notification " + e1.getMessage ();
486 LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, "", "rollbackVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending rollbackVnfA notification", e1);
487 alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error);
489 LOGGER.info (MessageEnum.RA_ASYNC_ROLLBACK_VNF_COMPLETE, "", "rollbackVnfA");
493 LOGGER.debug ("Async Rollback VNF:" + rollback.getVnfId ());
494 // Build and send Asynchronous response
496 VnfAdapterNotify notifyPort = getNotifyEP (notificationUrl);
497 notifyPort.rollbackVnfNotification (messageId, true, null, null);
498 } catch (Exception e) {
499 error = "Error sending rollbackVnf notification " + e.getMessage ();
500 LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, "", "rollbackVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending rollbackVnfA notification", e);
501 alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error);
504 LOGGER.info (MessageEnum.RA_ASYNC_ROLLBACK_VNF_COMPLETE, "", "rollbackVnfA");
508 private org.openecomp.mso.adapters.vnf.async.client.VnfRollback copyVrb (Holder <VnfRollback> hVrb) {
509 org.openecomp.mso.adapters.vnf.async.client.VnfRollback cvrb = new org.openecomp.mso.adapters.vnf.async.client.VnfRollback ();
511 if (hVrb != null && hVrb.value != null) {
512 org.openecomp.mso.adapters.vnf.async.client.MsoRequest cmr = new org.openecomp.mso.adapters.vnf.async.client.MsoRequest ();
514 cvrb.setCloudSiteId (hVrb.value.getCloudSiteId ());
515 if (hVrb.value.getMsoRequest() != null) {
516 cmr.setRequestId (hVrb.value.getMsoRequest ().getRequestId ());
517 cmr.setServiceInstanceId (hVrb.value.getMsoRequest ().getServiceInstanceId ());
519 cmr.setRequestId (null);
520 cmr.setServiceInstanceId (null);
522 cvrb.setMsoRequest (cmr);
523 cvrb.setVnfId (hVrb.value.getVnfId ());
524 cvrb.setTenantId (hVrb.value.getTenantId ());
525 cvrb.setTenantCreated (hVrb.value.getTenantCreated ());
526 cvrb.setVnfCreated (hVrb.value.getVnfCreated ());
531 private CreateVnfNotification.Outputs copyCreateOutputs (Holder <Map <String, String>> hMap) {
533 CreateVnfNotification.Outputs outputs = new CreateVnfNotification.Outputs ();
535 if (hMap != null && hMap.value != null) {
536 Map <String, String> sMap = new HashMap <> ();
538 CreateVnfNotification.Outputs.Entry entry = new CreateVnfNotification.Outputs.Entry ();
540 for (String key : sMap.keySet ()) {
542 entry.setValue (sMap.get (key));
543 outputs.getEntry ().add (entry);
549 private UpdateVnfNotification.Outputs copyUpdateOutputs (Holder <Map <String, String>> hMap) {
551 UpdateVnfNotification.Outputs outputs = new UpdateVnfNotification.Outputs ();
553 if (hMap != null && hMap.value != null) {
554 Map <String, String> sMap = new HashMap <> ();
556 UpdateVnfNotification.Outputs.Entry entry = new UpdateVnfNotification.Outputs.Entry ();
558 for (Map.Entry<String,String> mapEntry : sMap.entrySet ()) {
559 String key = mapEntry.getKey();
560 String value = mapEntry.getValue();
562 entry.setValue (value);
563 outputs.getEntry ().add (entry);
569 private QueryVnfNotification.Outputs copyQueryOutputs (Holder <Map <String, String>> hMap) {
571 QueryVnfNotification.Outputs outputs = new QueryVnfNotification.Outputs ();
573 if (hMap != null && hMap.value != null) {
574 Map <String, String> sMap = new HashMap <> ();
577 QueryVnfNotification.Outputs.Entry entry = new QueryVnfNotification.Outputs.Entry ();
579 for (Map.Entry<String,String> mapEntry : sMap.entrySet ()) {
580 String key = mapEntry.getKey();
581 String value = mapEntry.getValue();
583 entry.setValue (value);
584 outputs.getEntry ().add (entry);
590 private VnfAdapterNotify getNotifyEP (String notificationUrl) {
592 URL warWsdlLoc = null;
594 warWsdlLoc = Thread.currentThread ().getContextClassLoader ().getResource ("VnfAdapterNotify.wsdl");
595 } catch (Exception e) {
596 LOGGER.error (MessageEnum.RA_WSDL_NOT_FOUND, "VnfAdapterNotify.wsdl", "", "getNotifyEP", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - WSDL not found", e);
598 if (warWsdlLoc == null) {
599 LOGGER.error (MessageEnum.RA_WSDL_NOT_FOUND, "VnfAdapterNotify.wsdl", "", "getNotifyEP", MsoLogger.ErrorCode.BusinessProcesssError, "WSDL not found");
602 LOGGER.debug ("VnfAdpaterNotify.wsdl location:" + warWsdlLoc.toURI ().toString ());
603 } catch (Exception e) {
604 LOGGER.error (MessageEnum.RA_WSDL_URL_CONVENTION_EXC, "VnfAdapterNotify.wsdl", "", "getNotifyEP", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - WSDL URL convention", e);
608 VnfAdapterNotify_Service notifySvc = new VnfAdapterNotify_Service (warWsdlLoc,
609 new QName ("http://org.openecomp.mso/vnfNotify",
610 "vnfAdapterNotify"));
612 VnfAdapterNotify notifyPort = notifySvc.getMsoVnfAdapterAsyncImplPort ();
614 BindingProvider bp = (BindingProvider) notifyPort;
618 epUrl = new URL (notificationUrl);
619 } catch (MalformedURLException e1) {
620 LOGGER.error (MessageEnum.RA_INIT_NOTIF_EXC, "", "getNotifyEP", MsoLogger.ErrorCode.BusinessProcesssError, "MalformedURLException", e1);
624 LOGGER.debug ("Notification Endpoint URL: " + epUrl.toExternalForm ());
625 bp.getRequestContext ().put (BindingProvider.ENDPOINT_ADDRESS_PROPERTY, epUrl.toExternalForm ());
628 LOGGER.debug ("epUrl is NULL:");
633 Map <String, Object> reqCtx = bp.getRequestContext ();
634 Map <String, List <String>> headers = new HashMap <> ();
636 String userCredentials = msoPropertiesFactory.getMsoJavaProperties (MSO_PROP_VNF_ADAPTER).getEncryptedProperty (BPEL_AUTH_PROP,
640 String basicAuth = "Basic " + DatatypeConverter.printBase64Binary (userCredentials.getBytes ());
641 reqCtx.put (MessageContext.HTTP_REQUEST_HEADERS, headers);
642 headers.put ("Authorization", Collections.singletonList (basicAuth));
643 } catch (Exception e) {
644 LOGGER.error (MessageEnum.RA_SET_CALLBACK_AUTH_EXC, "", "getNotifyEP", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - Unable to set authorization in callback request", e);
645 alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, "Unable to set authorization in callback request");