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();
59 CloudConfigFactory cloudConfigFactory=new CloudConfigFactory();
61 public static final String MSO_PROP_VNF_ADAPTER="MSO_PROP_VNF_ADAPTER";
62 private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA);
63 private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger ();
64 private static final String BPEL_AUTH_PROP = "org.openecomp.mso.adapters.vnf.bpelauth";
65 private static final String ENCRYPTION_KEY = "aa3871669d893c7fb8abbcda31b88b4f";
68 * Health Check web method. Does nothing but return to show the adapter is deployed.
71 public void healthCheckA () {
72 LOGGER.debug ("Health check call in VNF Adapter");
76 * This is the asynchronous "Create VNF" web service implementation.
77 * It will create a new VNF of the requested type in the specified cloud
78 * and tenant. The tenant must exist before this service is called.
80 * If a VNF with the same name already exists, this can be considered a
81 * success or failure, depending on the value of the 'failIfExists' parameter.
83 * All VNF types will be defined in the MSO catalog. The caller must request
84 * one of these pre-defined types or an error will be returned. Within the
85 * catalog, each VNF type references (among other things) a Heat template
86 * which is used to deploy the required VNF artifacts (VMs, networks, etc.)
89 * Depending on the Heat template, a variable set of input parameters will
90 * be defined, some of which are required. The caller is responsible to
91 * pass the necessary input data for the VNF or an error will be thrown.
93 * The method sends an asynchronous response to the notification URL when
94 * processing completes. The createAsyncResponse contains the vnfId (the
95 * canonical name of the stack), a Map of VNF output attributes, and a
96 * VnfRollback object. This last object can be passed as-is to the
97 * rollbackVnf operation to undo everything that was created for the VNF.
98 * This is useful if a VNF is successfully created but the orchestrator
99 * fails on a subsequent operation.
101 * Note: this method is implemented by calling the synchronous web method
102 * and translating the response to an asynchronous notification.
104 * @param cloudSiteId CLLI code of the cloud site in which to create the VNF
105 * @param tenantId Openstack tenant identifier
106 * @param vnfType VNF type key, should match a VNF definition in catalog DB
107 * @param vnfName Name to be assigned to the new VNF
108 * @param inputs Map of key=value inputs for VNF stack creation
109 * @param failIfExists Flag whether already existing VNF should be considered
110 * a success or failure
111 * @param msoRequest Request tracking information for logs
112 * @param notificationURL the target URL for asynchronous response
115 public void createVnfA (String cloudSiteId,
121 String volumeGroupHeatStackId,
122 Map <String, String> inputs,
123 Boolean failIfExists,
126 MsoRequest msoRequest,
127 String notificationUrl) {
129 String serviceName = "CreateVnfA";
130 MsoLogger.setLogContext (msoRequest);
131 MsoLogger.setServiceName (serviceName);
132 LOGGER.info (MessageEnum.RA_ASYNC_CREATE_VNF, vnfName, vnfType, cloudSiteId, tenantId, "", "createVnfA");
133 // Use the synchronous method to perform the actual Create
134 MsoVnfAdapter vnfAdapter = new MsoVnfAdapterImpl (msoPropertiesFactory, cloudConfigFactory);
136 // Synchronous Web Service Outputs
137 Holder <String> vnfId = new Holder <> ();
138 Holder <Map <String, String>> outputs = new Holder <> ();
139 Holder <VnfRollback> vnfRollback = new Holder <> ();
142 vnfAdapter.createVnf (cloudSiteId,
148 volumeGroupHeatStackId,
156 MsoLogger.setServiceName (serviceName);
157 } catch (VnfException e) {
158 MsoLogger.setServiceName (serviceName);
159 LOGGER.error (MessageEnum.RA_CREATE_VNF_ERR, vnfName, cloudSiteId, tenantId, "", "createVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "VnfException in createVnfA", e);
160 org.openecomp.mso.adapters.vnf.async.client.MsoExceptionCategory exCat = null;
163 eMsg = e.getFaultInfo ().getMessage ();
164 exCat = org.openecomp.mso.adapters.vnf.async.client.MsoExceptionCategory.fromValue (e.getFaultInfo ()
167 } catch (Exception e1) {
168 LOGGER.error (MessageEnum.RA_FAULT_INFO_EXC, "", "createVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - Fault info", e1);
170 // Build and send Asynchronous error response
172 VnfAdapterNotify notifyPort = getNotifyEP (notificationUrl);
173 notifyPort.createVnfNotification (messageId, false, exCat, eMsg, null, null, null);
174 } catch (Exception e1) {
175 error = "Error sending createVnf notification " + e1.getMessage ();
176 LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, "", "createVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending createVnf notification", e1);
177 alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error);
179 LOGGER.info (MessageEnum.RA_ASYNC_CREATE_VNF_COMPLETE, "", "createVnfA", "", "createVnfA");
182 LOGGER.debug ("Async Create VNF: " + vnfName + " VnfId:" + vnfId.value);
183 // Build and send Asynchronous response
185 VnfAdapterNotify notifyPort = getNotifyEP (notificationUrl);
186 notifyPort.createVnfNotification (messageId,
191 copyCreateOutputs (outputs),
192 copyVrb (vnfRollback));
193 } catch (Exception e) {
194 error = "Error sending createVnf notification " + e.getMessage ();
195 LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, "", "createVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending createVnf notification", e);
196 alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error);
198 LOGGER.info (MessageEnum.RA_ASYNC_CREATE_VNF_COMPLETE, "", "createVnfA");
203 public void updateVnfA (String cloudSiteId,
209 String volumeGroupHeatStackId,
210 Map <String, String> inputs,
212 MsoRequest msoRequest,
213 String notificationUrl) {
215 String serviceName = "UpdateVnfA";
216 MsoLogger.setServiceName (serviceName);
217 MsoLogger.setLogContext (msoRequest);
218 LOGGER.info (MessageEnum.RA_ASYNC_UPDATE_VNF, vnfName, vnfType, cloudSiteId, tenantId, "", "UpdateVnfA");
220 // Use the synchronous method to perform the actual Create
221 MsoVnfAdapter vnfAdapter = new MsoVnfAdapterImpl (msoPropertiesFactory,cloudConfigFactory);
223 // Synchronous Web Service Outputs
224 Holder <String> vnfId = new Holder <> ();
225 Holder <Map <String, String>> outputs = new Holder <> ();
226 Holder <VnfRollback> vnfRollback = new Holder <> ();
229 vnfAdapter.updateVnf (cloudSiteId, tenantId, vnfType,vnfVersion, vnfName, requestType, volumeGroupHeatStackId, inputs, msoRequest, outputs, vnfRollback);
230 MsoLogger.setServiceName (serviceName);
231 } catch (VnfException e) {
232 MsoLogger.setServiceName (serviceName);
233 LOGGER.error (MessageEnum.RA_UPDATE_VNF_ERR, vnfName, cloudSiteId, tenantId, "", "UpdateVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending updateVnf notification", e);
234 org.openecomp.mso.adapters.vnf.async.client.MsoExceptionCategory exCat = null;
237 eMsg = e.getFaultInfo ().getMessage ();
238 exCat = org.openecomp.mso.adapters.vnf.async.client.MsoExceptionCategory.fromValue (e.getFaultInfo ()
241 } catch (Exception e1) {
242 LOGGER.error (MessageEnum.RA_FAULT_INFO_EXC, "", "UpdateVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - fault info", e1);
244 // Build and send Asynchronous error response
246 VnfAdapterNotify notifyPort = getNotifyEP (notificationUrl);
247 notifyPort.updateVnfNotification (messageId, false, exCat, eMsg, null, null);
248 } catch (Exception e1) {
249 error = "Error sending updateVnf notification " + e1.getMessage ();
250 LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, "", "UpdateVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending updateVnf notification", e1);
251 alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error);
253 LOGGER.info (MessageEnum.RA_ASYNC_UPDATE_VNF_COMPLETE, "", "UpdateVnfA");
256 LOGGER.debug ("Async Update VNF: " + vnfName + " VnfId:" + vnfId.value);
257 // Build and send Asynchronous response
259 VnfAdapterNotify notifyPort = getNotifyEP (notificationUrl);
260 notifyPort.updateVnfNotification (messageId,
264 copyUpdateOutputs (outputs),
265 copyVrb (vnfRollback));
266 } catch (Exception e) {
267 error = "Error sending updateVnf notification " + e.getMessage ();
268 LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, "", "UpdateVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending updateVnf notification", e);
269 alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error);
271 LOGGER.info (MessageEnum.RA_ASYNC_UPDATE_VNF_COMPLETE, "", "UpdateVnfA");
276 * This is the "Query VNF" web service implementation.
277 * It will look up a VNF by name or ID in the specified cloud and tenant.
279 * The method returns an indicator that the VNF exists, its Openstack internal
280 * ID, its status, and the set of outputs (from when the stack was created).
282 * @param cloudSiteId CLLI code of the cloud site in which to query
283 * @param tenantId Openstack tenant identifier
284 * @param vnfName VNF Name or Openstack ID
285 * @param msoRequest Request tracking information for logs
286 * @param notificationURL the target URL for asynchronous response
289 public void queryVnfA (String cloudSiteId,
293 MsoRequest msoRequest,
294 String notificationUrl) {
296 String serviceName = "QueryVnfA";
297 MsoLogger.setServiceName (serviceName);
298 MsoLogger.setLogContext (msoRequest);
299 LOGGER.info (MessageEnum.RA_ASYNC_QUERY_VNF, vnfName, cloudSiteId, tenantId);
301 // Use the synchronous method to perform the actual query
302 MsoVnfAdapter vnfAdapter = new MsoVnfAdapterImpl (msoPropertiesFactory,cloudConfigFactory);
304 // Synchronous Web Service Outputs
305 Holder <Boolean> vnfExists = new Holder <> ();
306 Holder <String> vnfId = new Holder <> ();
307 Holder <VnfStatus> status = new Holder <> ();
308 Holder <Map <String, String>> outputs = new Holder <> ();
311 vnfAdapter.queryVnf (cloudSiteId, tenantId, vnfName, msoRequest, vnfExists, vnfId, status, outputs);
312 MsoLogger.setServiceName (serviceName);
313 } catch (VnfException e) {
314 MsoLogger.setServiceName (serviceName);
315 LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, vnfName, cloudSiteId, tenantId, "", "queryVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending queryVnfA notification", e);
316 org.openecomp.mso.adapters.vnf.async.client.MsoExceptionCategory exCat = null;
319 eMsg = e.getFaultInfo ().getMessage ();
320 exCat = org.openecomp.mso.adapters.vnf.async.client.MsoExceptionCategory.fromValue (e.getFaultInfo ()
323 } catch (Exception e1) {
324 LOGGER.error (MessageEnum.RA_FAULT_INFO_EXC, "", "queryVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - fault info", e1);
326 // Build and send Asynchronous error response
328 VnfAdapterNotify notifyPort = getNotifyEP (notificationUrl);
329 notifyPort.queryVnfNotification (messageId, false, exCat, eMsg, null, null, null, null);
330 } catch (Exception e1) {
331 error = "Error sending queryVnf notification " + e1.getMessage ();
332 LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, "", "queryVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending queryVnf notification", e1);
333 alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error);
335 LOGGER.info (MessageEnum.RA_ASYNC_QUERY_VNF_COMPLETE, "", "queryVnfA");
339 if (!vnfExists.value) {
340 LOGGER.debug ("Async Query, VNF not found");
342 LOGGER.debug ("Async Query, VNF=" + vnfId.value + ", status=" + status.value);
344 // Build and send Asynchronous response
346 VnfAdapterNotify notifyPort = getNotifyEP (notificationUrl);
347 org.openecomp.mso.adapters.vnf.async.client.VnfStatus vnfS = org.openecomp.mso.adapters.vnf.async.client.VnfStatus.fromValue (status.value.name ());
348 notifyPort.queryVnfNotification (messageId,
355 copyQueryOutputs (outputs));
356 } catch (Exception e) {
357 error = "Error sending queryVnf notification " + e.getMessage ();
358 LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, "", "queryVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending queryVnf notification", e);
359 alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error);
362 LOGGER.info (MessageEnum.RA_ASYNC_QUERY_VNF_COMPLETE, "", "queryVnfA");
367 * This is the Asynchronous "Delete VNF" web service implementation.
368 * It will delete a VNF by name or ID in the specified cloud and tenant.
370 * The method has no outputs.
372 * @param cloudSiteId CLLI code of the cloud site in which to delete
373 * @param tenantId Openstack tenant identifier
374 * @param vnfName VNF Name or Openstack ID
376 * @param msoRequest Request tracking information for logs
377 * @param notificationUrl the target URL for asynchronous response
380 public void deleteVnfA (String cloudSiteId,
384 MsoRequest msoRequest,
385 String notificationUrl) {
387 String serviceName = "DeleteVnfA";
388 MsoLogger.setServiceName (serviceName);
389 MsoLogger.setLogContext (msoRequest);
390 LOGGER.info (MessageEnum.RA_ASYNC_DELETE_VNF, vnfName, cloudSiteId, tenantId);
392 // Use the synchronous method to perform the actual delete
393 MsoVnfAdapter vnfAdapter = new MsoVnfAdapterImpl (msoPropertiesFactory,cloudConfigFactory);
396 vnfAdapter.deleteVnf (cloudSiteId, tenantId, vnfName, msoRequest);
397 MsoLogger.setServiceName (serviceName);
398 } catch (VnfException e) {
399 MsoLogger.setServiceName (serviceName);
400 LOGGER.error (MessageEnum.RA_DELETE_VNF_ERR, vnfName, cloudSiteId, tenantId, "", "deleteVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending deleteVnfA notification", e);
401 org.openecomp.mso.adapters.vnf.async.client.MsoExceptionCategory exCat = null;
404 eMsg = e.getFaultInfo ().getMessage ();
405 exCat = org.openecomp.mso.adapters.vnf.async.client.MsoExceptionCategory.fromValue (e.getFaultInfo ()
408 } catch (Exception e1) {
409 LOGGER.error (MessageEnum.RA_FAULT_INFO_EXC, "", "deleteVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - fault info", e1);
411 // Build and send Asynchronous error response
413 VnfAdapterNotify notifyPort = getNotifyEP (notificationUrl);
414 notifyPort.deleteVnfNotification (messageId, false, exCat, eMsg);
415 } catch (Exception e1) {
416 error = "Error sending deleteVnf notification " + e1.getMessage ();
417 LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, "", "deleteVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending deleteVnfA notification", e1);
418 alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error);
420 LOGGER.info (MessageEnum.RA_ASYNC_DELETE_VNF_COMPLETE, "", "deleteVnfA");
424 LOGGER.debug ("Async Delete VNF: " + vnfName);
425 // Build and send Asynchronous response
427 VnfAdapterNotify notifyPort = getNotifyEP (notificationUrl);
428 notifyPort.deleteVnfNotification (messageId, true, null, null);
430 } catch (Exception e) {
431 error = "Error sending deleteVnf notification " + e.getMessage ();
432 LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, "", "deleteVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending deleteVnfA notification", e);
433 alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error);
436 LOGGER.info (MessageEnum.RA_ASYNC_DELETE_VNF_COMPLETE, "", "deleteVnfA");
441 * This web service endpoint will rollback a previous Create VNF operation.
442 * A rollback object is returned to the client in a successful creation
443 * response. The client can pass that object as-is back to the rollbackVnf
444 * operation to undo the creation.
447 public void rollbackVnfA (VnfRollback rollback, String messageId, String notificationUrl) {
448 String serviceName = "RollbackVnfA";
449 MsoLogger.setServiceName (serviceName);
451 // rollback may be null (e.g. if stack already existed when Create was called)
452 if (rollback == null) {
453 error = "Empty Rollback: No action to perform";
454 LOGGER.info (MessageEnum.RA_ROLLBACK_NULL, "", "rollbackVnfA");
455 alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error);
459 MsoLogger.setLogContext (rollback.getMsoRequest ());
460 LOGGER.info (MessageEnum.RA_ASYNC_ROLLBACK_VNF, "", "rollbackVnfA");
462 // Use the synchronous method to perform the actual rollback
463 MsoVnfAdapter vnfAdapter = new MsoVnfAdapterImpl (msoPropertiesFactory,cloudConfigFactory);
466 vnfAdapter.rollbackVnf (rollback);
467 MsoLogger.setServiceName (serviceName);
468 } catch (VnfException e) {
469 MsoLogger.setServiceName (serviceName);
470 LOGGER.error (MessageEnum.RA_ROLLBACK_VNF_ERR, "", "rollbackVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending rollbackVnfA notification", e);
471 org.openecomp.mso.adapters.vnf.async.client.MsoExceptionCategory exCat = null;
474 eMsg = e.getFaultInfo ().getMessage ();
475 exCat = org.openecomp.mso.adapters.vnf.async.client.MsoExceptionCategory.fromValue (e.getFaultInfo ()
478 } catch (Exception e1) {
479 LOGGER.error (MessageEnum.RA_FAULT_INFO_EXC, "", "rollbackVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - fault info", e1);
481 // Build and send Asynchronous error response
483 VnfAdapterNotify notifyPort = getNotifyEP (notificationUrl);
484 notifyPort.rollbackVnfNotification (messageId, false, exCat, eMsg);
485 } catch (Exception e1) {
486 error = "Error sending rollbackVnf notification " + e1.getMessage ();
487 LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, "", "rollbackVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending rollbackVnfA notification", e1);
488 alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error);
490 LOGGER.info (MessageEnum.RA_ASYNC_ROLLBACK_VNF_COMPLETE, "", "rollbackVnfA");
494 LOGGER.debug ("Async Rollback VNF:" + rollback.getVnfId ());
495 // Build and send Asynchronous response
497 VnfAdapterNotify notifyPort = getNotifyEP (notificationUrl);
498 notifyPort.rollbackVnfNotification (messageId, true, null, null);
499 } catch (Exception e) {
500 error = "Error sending rollbackVnf notification " + e.getMessage ();
501 LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, "", "rollbackVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending rollbackVnfA notification", e);
502 alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error);
505 LOGGER.info (MessageEnum.RA_ASYNC_ROLLBACK_VNF_COMPLETE, "", "rollbackVnfA");
509 private org.openecomp.mso.adapters.vnf.async.client.VnfRollback copyVrb (Holder <VnfRollback> hVrb) {
510 org.openecomp.mso.adapters.vnf.async.client.VnfRollback cvrb = new org.openecomp.mso.adapters.vnf.async.client.VnfRollback ();
512 if (hVrb != null && hVrb.value != null) {
513 org.openecomp.mso.adapters.vnf.async.client.MsoRequest cmr = new org.openecomp.mso.adapters.vnf.async.client.MsoRequest ();
515 cvrb.setCloudSiteId (hVrb.value.getCloudSiteId ());
516 if (hVrb.value.getMsoRequest() != null) {
517 cmr.setRequestId (hVrb.value.getMsoRequest ().getRequestId ());
518 cmr.setServiceInstanceId (hVrb.value.getMsoRequest ().getServiceInstanceId ());
520 cmr.setRequestId (null);
521 cmr.setServiceInstanceId (null);
523 cvrb.setMsoRequest (cmr);
524 cvrb.setVnfId (hVrb.value.getVnfId ());
525 cvrb.setTenantId (hVrb.value.getTenantId ());
526 cvrb.setTenantCreated (hVrb.value.getTenantCreated ());
527 cvrb.setVnfCreated (hVrb.value.getVnfCreated ());
532 private CreateVnfNotification.Outputs copyCreateOutputs (Holder <Map <String, String>> hMap) {
534 CreateVnfNotification.Outputs outputs = new CreateVnfNotification.Outputs ();
536 if (hMap != null && hMap.value != null) {
537 Map <String, String> sMap = new HashMap <> ();
539 CreateVnfNotification.Outputs.Entry entry = new CreateVnfNotification.Outputs.Entry ();
541 for (String key : sMap.keySet ()) {
543 entry.setValue (sMap.get (key));
544 outputs.getEntry ().add (entry);
550 private UpdateVnfNotification.Outputs copyUpdateOutputs (Holder <Map <String, String>> hMap) {
552 UpdateVnfNotification.Outputs outputs = new UpdateVnfNotification.Outputs ();
554 if (hMap != null && hMap.value != null) {
555 Map <String, String> sMap = new HashMap <> ();
557 UpdateVnfNotification.Outputs.Entry entry = new UpdateVnfNotification.Outputs.Entry ();
559 for (Map.Entry<String,String> mapEntry : sMap.entrySet ()) {
560 String key = mapEntry.getKey();
561 String value = mapEntry.getValue();
563 entry.setValue (value);
564 outputs.getEntry ().add (entry);
570 private QueryVnfNotification.Outputs copyQueryOutputs (Holder <Map <String, String>> hMap) {
572 QueryVnfNotification.Outputs outputs = new QueryVnfNotification.Outputs ();
574 if (hMap != null && hMap.value != null) {
575 Map <String, String> sMap = new HashMap <> ();
578 QueryVnfNotification.Outputs.Entry entry = new QueryVnfNotification.Outputs.Entry ();
580 for (Map.Entry<String,String> mapEntry : sMap.entrySet ()) {
581 String key = mapEntry.getKey();
582 String value = mapEntry.getValue();
584 entry.setValue (value);
585 outputs.getEntry ().add (entry);
591 private VnfAdapterNotify getNotifyEP (String notificationUrl) {
593 URL warWsdlLoc = null;
595 warWsdlLoc = Thread.currentThread ().getContextClassLoader ().getResource ("VnfAdapterNotify.wsdl");
596 } catch (Exception e) {
597 LOGGER.error (MessageEnum.RA_WSDL_NOT_FOUND, "VnfAdapterNotify.wsdl", "", "getNotifyEP", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - WSDL not found", e);
599 if (warWsdlLoc == null) {
600 LOGGER.error (MessageEnum.RA_WSDL_NOT_FOUND, "VnfAdapterNotify.wsdl", "", "getNotifyEP", MsoLogger.ErrorCode.BusinessProcesssError, "WSDL not found");
603 LOGGER.debug ("VnfAdpaterNotify.wsdl location:" + warWsdlLoc.toURI ().toString ());
604 } catch (Exception e) {
605 LOGGER.error (MessageEnum.RA_WSDL_URL_CONVENTION_EXC, "VnfAdapterNotify.wsdl", "", "getNotifyEP", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - WSDL URL convention", e);
609 VnfAdapterNotify_Service notifySvc = new VnfAdapterNotify_Service (warWsdlLoc,
610 new QName ("http://org.openecomp.mso/vnfNotify",
611 "vnfAdapterNotify"));
613 VnfAdapterNotify notifyPort = notifySvc.getMsoVnfAdapterAsyncImplPort ();
615 BindingProvider bp = (BindingProvider) notifyPort;
619 epUrl = new URL (notificationUrl);
620 } catch (MalformedURLException e1) {
621 LOGGER.error (MessageEnum.RA_INIT_NOTIF_EXC, "", "getNotifyEP", MsoLogger.ErrorCode.BusinessProcesssError, "MalformedURLException", e1);
625 LOGGER.debug ("Notification Endpoint URL: " + epUrl.toExternalForm ());
626 bp.getRequestContext ().put (BindingProvider.ENDPOINT_ADDRESS_PROPERTY, epUrl.toExternalForm ());
629 LOGGER.debug ("epUrl is NULL:");
634 Map <String, Object> reqCtx = bp.getRequestContext ();
635 Map <String, List <String>> headers = new HashMap <> ();
637 String userCredentials = msoPropertiesFactory.getMsoJavaProperties (MSO_PROP_VNF_ADAPTER).getEncryptedProperty (BPEL_AUTH_PROP,
641 String basicAuth = "Basic " + DatatypeConverter.printBase64Binary (userCredentials.getBytes ());
642 reqCtx.put (MessageContext.HTTP_REQUEST_HEADERS, headers);
643 headers.put ("Authorization", Collections.singletonList (basicAuth));
644 } catch (Exception e) {
645 LOGGER.error (MessageEnum.RA_SET_CALLBACK_AUTH_EXC, "", "getNotifyEP", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - Unable to set authorization in callback request", e);
646 alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, "Unable to set authorization in callback request");