2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. 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.openecomp.mso.adapters.vnf;
24 import java.net.MalformedURLException;
26 import java.util.Collections;
27 import java.util.HashMap;
28 import java.util.List;
31 import javax.jws.WebService;
32 import javax.xml.bind.DatatypeConverter;
33 import javax.xml.namespace.QName;
34 import javax.xml.ws.BindingProvider;
35 import javax.xml.ws.Holder;
36 import javax.xml.ws.handler.MessageContext;
38 import org.openecomp.mso.adapters.vnf.async.client.CreateVnfNotification;
39 import org.openecomp.mso.adapters.vnf.async.client.QueryVnfNotification;
40 import org.openecomp.mso.adapters.vnf.async.client.UpdateVnfNotification;
41 import org.openecomp.mso.adapters.vnf.async.client.VnfAdapterNotify;
42 import org.openecomp.mso.adapters.vnf.async.client.VnfAdapterNotify_Service;
43 import org.openecomp.mso.adapters.vnf.exceptions.VnfException;
44 import org.openecomp.mso.cloud.CloudConfigFactory;
45 import org.openecomp.mso.entity.MsoRequest;
46 import org.openecomp.mso.logger.MessageEnum;
47 import org.openecomp.mso.logger.MsoAlarmLogger;
48 import org.openecomp.mso.logger.MsoLogger;
49 import org.openecomp.mso.properties.MsoPropertiesFactory;
50 import org.openecomp.mso.openstack.beans.VnfStatus;
51 import org.openecomp.mso.openstack.beans.VnfRollback;
53 @WebService(serviceName = "VnfAdapterAsync", endpointInterface = "org.openecomp.mso.adapters.vnf.MsoVnfAdapterAsync", targetNamespace = "http://org.openecomp.mso/vnfA")
54 public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
56 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 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 // Will capture execution time for metrics
133 long startTime = System.currentTimeMillis ();
134 // Use the synchronous method to perform the actual Create
135 MsoVnfAdapter vnfAdapter = new MsoVnfAdapterImpl (msoPropertiesFactory, cloudConfigFactory);
137 // Synchronous Web Service Outputs
138 Holder <String> vnfId = new Holder <String> ();
139 Holder <Map <String, String>> outputs = new Holder <Map <String, String>> ();
140 Holder <VnfRollback> vnfRollback = new Holder <VnfRollback> ();
143 vnfAdapter.createVnf (cloudSiteId,
149 volumeGroupHeatStackId,
157 MsoLogger.setServiceName (serviceName);
158 } catch (VnfException e) {
159 MsoLogger.setServiceName (serviceName);
160 LOGGER.error (MessageEnum.RA_CREATE_VNF_ERR, vnfName, cloudSiteId, tenantId, "", "createVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "VnfException in createVnfA", e);
161 org.openecomp.mso.adapters.vnf.async.client.MsoExceptionCategory exCat = null;
164 eMsg = e.getFaultInfo ().getMessage ();
165 exCat = org.openecomp.mso.adapters.vnf.async.client.MsoExceptionCategory.fromValue (e.getFaultInfo ()
168 } catch (Exception e1) {
169 LOGGER.error (MessageEnum.RA_FAULT_INFO_EXC, "", "createVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - Fault info", e1);
171 // Build and send Asynchronous error response
173 VnfAdapterNotify notifyPort = getNotifyEP (notificationUrl);
174 notifyPort.createVnfNotification (messageId, false, exCat, eMsg, null, null, null);
175 } catch (Exception e1) {
176 error = "Error sending createVnf notification " + e1.getMessage ();
177 LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, "", "createVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending createVnf notification", e1);
178 alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error);
180 LOGGER.info (MessageEnum.RA_ASYNC_CREATE_VNF_COMPLETE, "", "createVnfA", "", "createVnfA");
183 LOGGER.debug ("Async Create VNF: " + vnfName + " VnfId:" + vnfId.value);
184 // Build and send Asynchronous response
186 VnfAdapterNotify notifyPort = getNotifyEP (notificationUrl);
187 notifyPort.createVnfNotification (messageId,
192 copyCreateOutputs (outputs),
193 copyVrb (vnfRollback));
194 } catch (Exception e) {
195 error = "Error sending createVnf notification " + e.getMessage ();
196 LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, "", "createVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending createVnf notification", e);
197 alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error);
199 LOGGER.info (MessageEnum.RA_ASYNC_CREATE_VNF_COMPLETE, "", "createVnfA");
204 public void updateVnfA (String cloudSiteId,
210 String volumeGroupHeatStackId,
211 Map <String, String> inputs,
213 MsoRequest msoRequest,
214 String notificationUrl) {
216 String serviceName = "UpdateVnfA";
217 MsoLogger.setServiceName (serviceName);
218 MsoLogger.setLogContext (msoRequest);
219 // Will capture execution time for metrics
220 long startTime = System.currentTimeMillis ();
221 LOGGER.info (MessageEnum.RA_ASYNC_UPDATE_VNF, vnfName, vnfType, cloudSiteId, tenantId, "", "UpdateVnfA");
223 // Use the synchronous method to perform the actual Create
224 MsoVnfAdapter vnfAdapter = new MsoVnfAdapterImpl (msoPropertiesFactory,cloudConfigFactory);
226 // Synchronous Web Service Outputs
227 Holder <String> vnfId = new Holder <String> ();
228 Holder <Map <String, String>> outputs = new Holder <Map <String, String>> ();
229 Holder <VnfRollback> vnfRollback = new Holder <VnfRollback> ();
232 vnfAdapter.updateVnf (cloudSiteId, tenantId, vnfType,vnfVersion, vnfName, requestType, volumeGroupHeatStackId, inputs, msoRequest, outputs, vnfRollback);
233 MsoLogger.setServiceName (serviceName);
234 } catch (VnfException e) {
235 MsoLogger.setServiceName (serviceName);
236 LOGGER.error (MessageEnum.RA_UPDATE_VNF_ERR, vnfName, cloudSiteId, tenantId, "", "UpdateVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending updateVnf notification", e);
237 org.openecomp.mso.adapters.vnf.async.client.MsoExceptionCategory exCat = null;
240 eMsg = e.getFaultInfo ().getMessage ();
241 exCat = org.openecomp.mso.adapters.vnf.async.client.MsoExceptionCategory.fromValue (e.getFaultInfo ()
244 } catch (Exception e1) {
245 LOGGER.error (MessageEnum.RA_FAULT_INFO_EXC, "", "UpdateVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - fault info", e1);
247 // Build and send Asynchronous error response
249 VnfAdapterNotify notifyPort = getNotifyEP (notificationUrl);
250 notifyPort.updateVnfNotification (messageId, false, exCat, eMsg, null, null);
251 } catch (Exception e1) {
252 error = "Error sending updateVnf notification " + e1.getMessage ();
253 LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, "", "UpdateVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending updateVnf notification", e1);
254 alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error);
256 LOGGER.info (MessageEnum.RA_ASYNC_UPDATE_VNF_COMPLETE, "", "UpdateVnfA");
259 LOGGER.debug ("Async Update VNF: " + vnfName + " VnfId:" + vnfId.value);
260 // Build and send Asynchronous response
262 VnfAdapterNotify notifyPort = getNotifyEP (notificationUrl);
263 notifyPort.updateVnfNotification (messageId,
267 copyUpdateOutputs (outputs),
268 copyVrb (vnfRollback));
269 } catch (Exception e) {
270 error = "Error sending updateVnf notification " + e.getMessage ();
271 LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, "", "UpdateVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending updateVnf notification", e);
272 alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error);
274 LOGGER.info (MessageEnum.RA_ASYNC_UPDATE_VNF_COMPLETE, "", "UpdateVnfA");
279 * This is the "Query VNF" web service implementation.
280 * It will look up a VNF by name or ID in the specified cloud and tenant.
282 * The method returns an indicator that the VNF exists, its Openstack internal
283 * ID, its status, and the set of outputs (from when the stack was created).
285 * @param cloudSiteId CLLI code of the cloud site in which to query
286 * @param tenantId Openstack tenant identifier
287 * @param vnfName VNF Name or Openstack ID
288 * @param msoRequest Request tracking information for logs
289 * @param notificationURL the target URL for asynchronous response
292 public void queryVnfA (String cloudSiteId,
296 MsoRequest msoRequest,
297 String notificationUrl) {
299 String serviceName = "QueryVnfA";
300 MsoLogger.setServiceName (serviceName);
301 MsoLogger.setLogContext (msoRequest);
302 // Will capture execution time for metrics
303 long startTime = System.currentTimeMillis ();
304 LOGGER.info (MessageEnum.RA_ASYNC_QUERY_VNF, vnfName, cloudSiteId, tenantId);
306 // Use the synchronous method to perform the actual query
307 MsoVnfAdapter vnfAdapter = new MsoVnfAdapterImpl (msoPropertiesFactory,cloudConfigFactory);
309 // Synchronous Web Service Outputs
310 Holder <Boolean> vnfExists = new Holder <Boolean> ();
311 Holder <String> vnfId = new Holder <String> ();
312 Holder <VnfStatus> status = new Holder <VnfStatus> ();
313 Holder <Map <String, String>> outputs = new Holder <Map <String, String>> ();
316 vnfAdapter.queryVnf (cloudSiteId, tenantId, vnfName, msoRequest, vnfExists, vnfId, status, outputs);
317 MsoLogger.setServiceName (serviceName);
318 } catch (VnfException e) {
319 MsoLogger.setServiceName (serviceName);
320 LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, vnfName, cloudSiteId, tenantId, "", "queryVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending queryVnfA notification", e);
321 org.openecomp.mso.adapters.vnf.async.client.MsoExceptionCategory exCat = null;
324 eMsg = e.getFaultInfo ().getMessage ();
325 exCat = org.openecomp.mso.adapters.vnf.async.client.MsoExceptionCategory.fromValue (e.getFaultInfo ()
328 } catch (Exception e1) {
329 LOGGER.error (MessageEnum.RA_FAULT_INFO_EXC, "", "queryVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - fault info", e1);
331 // Build and send Asynchronous error response
333 VnfAdapterNotify notifyPort = getNotifyEP (notificationUrl);
334 notifyPort.queryVnfNotification (messageId, false, exCat, eMsg, null, null, null, null);
335 } catch (Exception e1) {
336 error = "Error sending queryVnf notification " + e1.getMessage ();
337 LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, "", "queryVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending queryVnf notification", e1);
338 alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error);
340 LOGGER.info (MessageEnum.RA_ASYNC_QUERY_VNF_COMPLETE, "", "queryVnfA");
344 if (!vnfExists.value) {
345 LOGGER.debug ("Async Query, VNF not found");
347 LOGGER.debug ("Async Query, VNF=" + vnfId.value + ", status=" + status.value);
349 // Build and send Asynchronous response
351 VnfAdapterNotify notifyPort = getNotifyEP (notificationUrl);
352 org.openecomp.mso.adapters.vnf.async.client.VnfStatus vnfS = org.openecomp.mso.adapters.vnf.async.client.VnfStatus.fromValue (status.value.name ());
353 notifyPort.queryVnfNotification (messageId,
360 copyQueryOutputs (outputs));
361 } catch (Exception e) {
362 error = "Error sending queryVnf notification " + e.getMessage ();
363 LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, "", "queryVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending queryVnf notification", e);
364 alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error);
367 LOGGER.info (MessageEnum.RA_ASYNC_QUERY_VNF_COMPLETE, "", "queryVnfA");
372 * This is the Asynchronous "Delete VNF" web service implementation.
373 * It will delete a VNF by name or ID in the specified cloud and tenant.
375 * The method has no outputs.
377 * @param cloudSiteId CLLI code of the cloud site in which to delete
378 * @param tenantId Openstack tenant identifier
379 * @param vnfName VNF Name or Openstack ID
380 * @param msoRequest Request tracking information for logs
381 * @param notificationURL the target URL for asynchronous response
384 public void deleteVnfA (String cloudSiteId,
388 MsoRequest msoRequest,
389 String notificationUrl) {
391 String serviceName = "DeleteVnfA";
392 MsoLogger.setServiceName (serviceName);
393 MsoLogger.setLogContext (msoRequest);
394 // Will capture execution time for metrics
395 long startTime = System.currentTimeMillis ();
396 LOGGER.info (MessageEnum.RA_ASYNC_DELETE_VNF, vnfName, cloudSiteId, tenantId);
398 // Use the synchronous method to perform the actual delete
399 MsoVnfAdapter vnfAdapter = new MsoVnfAdapterImpl (msoPropertiesFactory,cloudConfigFactory);
402 vnfAdapter.deleteVnf (cloudSiteId, tenantId, vnfName, msoRequest);
403 MsoLogger.setServiceName (serviceName);
404 } catch (VnfException e) {
405 MsoLogger.setServiceName (serviceName);
406 LOGGER.error (MessageEnum.RA_DELETE_VNF_ERR, vnfName, cloudSiteId, tenantId, "", "deleteVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending deleteVnfA notification", e);
407 org.openecomp.mso.adapters.vnf.async.client.MsoExceptionCategory exCat = null;
410 eMsg = e.getFaultInfo ().getMessage ();
411 exCat = org.openecomp.mso.adapters.vnf.async.client.MsoExceptionCategory.fromValue (e.getFaultInfo ()
414 } catch (Exception e1) {
415 LOGGER.error (MessageEnum.RA_FAULT_INFO_EXC, "", "deleteVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - fault info", e1);
417 // Build and send Asynchronous error response
419 VnfAdapterNotify notifyPort = getNotifyEP (notificationUrl);
420 notifyPort.deleteVnfNotification (messageId, false, exCat, eMsg);
421 } catch (Exception e1) {
422 error = "Error sending deleteVnf notification " + e1.getMessage ();
423 LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, "", "deleteVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending deleteVnfA notification", e1);
424 alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error);
426 LOGGER.info (MessageEnum.RA_ASYNC_DELETE_VNF_COMPLETE, "", "deleteVnfA");
430 LOGGER.debug ("Async Delete VNF: " + vnfName);
431 // Build and send Asynchronous response
433 VnfAdapterNotify notifyPort = getNotifyEP (notificationUrl);
434 notifyPort.deleteVnfNotification (messageId, true, null, null);
436 } catch (Exception e) {
437 error = "Error sending deleteVnf notification " + e.getMessage ();
438 LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, "", "deleteVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending deleteVnfA notification", e);
439 alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error);
442 LOGGER.info (MessageEnum.RA_ASYNC_DELETE_VNF_COMPLETE, "", "deleteVnfA");
447 * This web service endpoint will rollback a previous Create VNF operation.
448 * A rollback object is returned to the client in a successful creation
449 * response. The client can pass that object as-is back to the rollbackVnf
450 * operation to undo the creation.
453 public void rollbackVnfA (VnfRollback rollback, String messageId, String notificationUrl) {
454 String serviceName = "RollbackVnfA";
455 MsoLogger.setServiceName (serviceName);
456 // Will capture execution time for metrics
457 long startTime = System.currentTimeMillis ();
459 // rollback may be null (e.g. if stack already existed when Create was called)
460 if (rollback == null) {
461 error = "Empty Rollback: No action to perform";
462 LOGGER.info (MessageEnum.RA_ROLLBACK_NULL, "", "rollbackVnfA");
463 alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error);
467 MsoLogger.setLogContext (rollback.getMsoRequest ());
468 LOGGER.info (MessageEnum.RA_ASYNC_ROLLBACK_VNF, "", "rollbackVnfA");
470 // Use the synchronous method to perform the actual rollback
471 MsoVnfAdapter vnfAdapter = new MsoVnfAdapterImpl (msoPropertiesFactory,cloudConfigFactory);
474 vnfAdapter.rollbackVnf (rollback);
475 MsoLogger.setServiceName (serviceName);
476 } catch (VnfException e) {
477 MsoLogger.setServiceName (serviceName);
478 LOGGER.error (MessageEnum.RA_ROLLBACK_VNF_ERR, "", "rollbackVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending rollbackVnfA notification", e);
479 org.openecomp.mso.adapters.vnf.async.client.MsoExceptionCategory exCat = null;
482 eMsg = e.getFaultInfo ().getMessage ();
483 exCat = org.openecomp.mso.adapters.vnf.async.client.MsoExceptionCategory.fromValue (e.getFaultInfo ()
486 } catch (Exception e1) {
487 LOGGER.error (MessageEnum.RA_FAULT_INFO_EXC, "", "rollbackVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - fault info", e1);
489 // Build and send Asynchronous error response
491 VnfAdapterNotify notifyPort = getNotifyEP (notificationUrl);
492 notifyPort.rollbackVnfNotification (messageId, false, exCat, eMsg);
493 } catch (Exception e1) {
494 error = "Error sending rollbackVnf notification " + e1.getMessage ();
495 LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, "", "rollbackVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending rollbackVnfA notification", e1);
496 alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error);
498 LOGGER.info (MessageEnum.RA_ASYNC_ROLLBACK_VNF_COMPLETE, "", "rollbackVnfA");
502 LOGGER.debug ("Async Rollback VNF:" + rollback.getVnfId ());
503 // Build and send Asynchronous response
505 VnfAdapterNotify notifyPort = getNotifyEP (notificationUrl);
506 notifyPort.rollbackVnfNotification (messageId, true, null, null);
507 } catch (Exception e) {
508 error = "Error sending rollbackVnf notification " + e.getMessage ();
509 LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, "", "rollbackVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending rollbackVnfA notification", e);
510 alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error);
513 LOGGER.info (MessageEnum.RA_ASYNC_ROLLBACK_VNF_COMPLETE, "", "rollbackVnfA");
517 private org.openecomp.mso.adapters.vnf.async.client.VnfRollback copyVrb (Holder <VnfRollback> hVrb) {
518 org.openecomp.mso.adapters.vnf.async.client.VnfRollback cvrb = new org.openecomp.mso.adapters.vnf.async.client.VnfRollback ();
520 if (hVrb != null && hVrb.value != null) {
521 org.openecomp.mso.adapters.vnf.async.client.MsoRequest cmr = new org.openecomp.mso.adapters.vnf.async.client.MsoRequest ();
523 cvrb.setCloudSiteId (hVrb.value.getCloudSiteId ());
524 if (hVrb.value.getMsoRequest() != null) {
525 cmr.setRequestId (hVrb.value.getMsoRequest ().getRequestId ());
526 cmr.setServiceInstanceId (hVrb.value.getMsoRequest ().getServiceInstanceId ());
528 cmr.setRequestId (null);
529 cmr.setServiceInstanceId (null);
531 cvrb.setMsoRequest (cmr);
532 cvrb.setVnfId (hVrb.value.getVnfId ());
533 cvrb.setTenantId (hVrb.value.getTenantId ());
534 cvrb.setTenantCreated (hVrb.value.getTenantCreated ());
535 cvrb.setVnfCreated (hVrb.value.getVnfCreated ());
540 private CreateVnfNotification.Outputs copyCreateOutputs (Holder <Map <String, String>> hMap) {
542 CreateVnfNotification.Outputs outputs = new CreateVnfNotification.Outputs ();
544 if (hMap != null && hMap.value != null) {
545 Map <String, String> sMap = new HashMap <String, String> ();
547 CreateVnfNotification.Outputs.Entry entry = new CreateVnfNotification.Outputs.Entry ();
549 for (String key : sMap.keySet ()) {
551 entry.setValue (sMap.get (key));
552 outputs.getEntry ().add (entry);
558 private UpdateVnfNotification.Outputs copyUpdateOutputs (Holder <Map <String, String>> hMap) {
560 UpdateVnfNotification.Outputs outputs = new UpdateVnfNotification.Outputs ();
562 if (hMap != null && hMap.value != null) {
563 Map <String, String> sMap = new HashMap <String, String> ();
565 UpdateVnfNotification.Outputs.Entry entry = new UpdateVnfNotification.Outputs.Entry ();
567 for (String key : sMap.keySet ()) {
569 entry.setValue (sMap.get (key));
570 outputs.getEntry ().add (entry);
576 private QueryVnfNotification.Outputs copyQueryOutputs (Holder <Map <String, String>> hMap) {
578 QueryVnfNotification.Outputs outputs = new QueryVnfNotification.Outputs ();
580 if (hMap != null && hMap.value != null) {
581 Map <String, String> sMap = new HashMap <String, String> ();
584 QueryVnfNotification.Outputs.Entry entry = new QueryVnfNotification.Outputs.Entry ();
586 for (String key : sMap.keySet ()) {
588 entry.setValue (sMap.get (key));
589 outputs.getEntry ().add (entry);
595 private VnfAdapterNotify getNotifyEP (String notificationUrl) {
597 URL warWsdlLoc = null;
599 warWsdlLoc = Thread.currentThread ().getContextClassLoader ().getResource ("VnfAdapterNotify.wsdl");
600 } catch (Exception e) {
601 LOGGER.error (MessageEnum.RA_WSDL_NOT_FOUND, "VnfAdapterNotify.wsdl", "", "getNotifyEP", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - WSDL not found", e);
603 if (warWsdlLoc == null) {
604 LOGGER.error (MessageEnum.RA_WSDL_NOT_FOUND, "VnfAdapterNotify.wsdl", "", "getNotifyEP", MsoLogger.ErrorCode.BusinessProcesssError, "WSDL not found");
607 LOGGER.debug ("VnfAdpaterNotify.wsdl location:" + warWsdlLoc.toURI ().toString ());
608 } catch (Exception e) {
609 LOGGER.error (MessageEnum.RA_WSDL_URL_CONVENTION_EXC, "VnfAdapterNotify.wsdl", "", "getNotifyEP", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - WSDL URL convention", e);
613 VnfAdapterNotify_Service notifySvc = new VnfAdapterNotify_Service (warWsdlLoc,
614 new QName ("http://org.openecomp.mso/vnfNotify",
615 "vnfAdapterNotify"));
617 VnfAdapterNotify notifyPort = notifySvc.getMsoVnfAdapterAsyncImplPort ();
619 BindingProvider bp = (BindingProvider) notifyPort;
623 epUrl = new URL (notificationUrl);
624 } catch (MalformedURLException e1) {
625 LOGGER.error (MessageEnum.RA_INIT_NOTIF_EXC, "", "getNotifyEP", MsoLogger.ErrorCode.BusinessProcesssError, "MalformedURLException", e1);
628 LOGGER.debug ("Notification Endpoint URL: " + epUrl.toExternalForm ());
630 bp.getRequestContext ().put (BindingProvider.ENDPOINT_ADDRESS_PROPERTY, epUrl.toExternalForm ());
634 Map <String, Object> req_ctx = bp.getRequestContext ();
635 Map <String, List <String>> headers = new HashMap <String, List <String>> ();
637 String userCredentials = msoPropertiesFactory.getMsoJavaProperties (MSO_PROP_VNF_ADAPTER).getEncryptedProperty (BPEL_AUTH_PROP,
641 String basicAuth = "Basic " + DatatypeConverter.printBase64Binary (userCredentials.getBytes ());
642 req_ctx.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");