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 * Modifications Copyright (C) 2018 IBM.
9 * ================================================================================
10 * Licensed under the Apache License, Version 2.0 (the "License");
11 * you may not use this file except in compliance with the License.
12 * You may obtain a copy of the License at
14 * http://www.apache.org/licenses/LICENSE-2.0
16 * Unless required by applicable law or agreed to in writing, software
17 * distributed under the License is distributed on an "AS IS" BASIS,
18 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 * See the License for the specific language governing permissions and
20 * limitations under the License.
21 * ============LICENSE_END=========================================================
24 package org.onap.so.adapters.network;
27 import java.net.MalformedURLException;
29 import java.security.GeneralSecurityException;
30 import java.util.Collections;
31 import java.util.HashMap;
32 import java.util.List;
35 import javax.jws.WebService;
36 import javax.xml.bind.DatatypeConverter;
37 import javax.xml.namespace.QName;
38 import javax.xml.ws.BindingProvider;
39 import javax.xml.ws.Holder;
40 import javax.xml.ws.handler.MessageContext;
42 import org.onap.so.adapters.network.async.client.CreateNetworkNotification;
43 import org.onap.so.adapters.network.async.client.MsoExceptionCategory;
44 import org.onap.so.adapters.network.async.client.NetworkAdapterNotify;
45 import org.onap.so.adapters.network.async.client.NetworkAdapterNotify_Service;
46 import org.onap.so.adapters.network.async.client.QueryNetworkNotification;
47 import org.onap.so.adapters.network.async.client.UpdateNetworkNotification;
48 import org.onap.so.adapters.network.exceptions.NetworkException;
49 import org.onap.so.entity.MsoRequest;
50 import org.onap.so.logger.MessageEnum;
51 import org.onap.so.logger.MsoAlarmLogger;
52 import org.onap.so.logger.MsoLogger;
53 import org.onap.so.openstack.beans.NetworkRollback;
54 import org.onap.so.openstack.beans.NetworkStatus;
55 import org.onap.so.openstack.beans.Subnet;
56 import org.onap.so.utils.CryptoUtils;
57 import org.springframework.beans.factory.annotation.Autowired;
58 import org.springframework.core.env.Environment;
59 import org.springframework.stereotype.Component;
62 @WebService(serviceName = "NetworkAdapterAsync", endpointInterface = "org.onap.so.adapters.network.MsoNetworkAdapterAsync", targetNamespace = "http://org.onap.so/networkA")
63 public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
65 private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA,MsoNetworkAdapterAsyncImpl.class);
66 private static final MsoAlarmLogger alarmLogger = new MsoAlarmLogger ();
67 private static final String BPEL_AUTH_PROP = "org.onap.so.adapters.network.bpelauth";
68 private static final String ENCRYPTION_KEY = "aa3871669d893c7fb8abbcda31b88b4f";
71 private Environment environment;
74 private MsoNetworkAdapter networkAdapter;
76 * Health Check web method. Does nothing but return to show the adapter is deployed.
79 public void healthCheckA () {
80 LOGGER.debug ("Health check call in Network Adapter");
84 * This is the "Create Network" web service implementation.
85 * It will create a new Network of the requested type in the specified cloud
86 * and tenant. The tenant must exist at the time this service is called.
88 * If a network with the same name already exists, this can be considered a
89 * success or failure, depending on the value of the 'failIfExists' parameter.
91 * There will be a pre-defined set of network types defined in the MSO Catalog.
92 * All such networks will have a similar configuration, based on the allowable
93 * Openstack networking definitions. This includes basic networks, provider
94 * networks (with a single VLAN), and multi-provider networks (one or more VLANs)
96 * Initially, all provider networks must be "vlan" type, and multiple segments in
97 * a multi-provider network must be multiple VLANs on the same physical network.
99 * This service supports two modes of Network creation/update:
100 * - via Heat Templates
102 * The network orchestration mode for each network type is declared in its
103 * catalog definition. All Heat-based templates must support some subset of
104 * the same input parameters: network_name, physical_network, vlan(s).
106 * The method returns the network ID and a NetworkRollback object. This latter
107 * object can be passed as-is to the rollbackNetwork operation to undo everything
108 * that was created. This is useful if a network is successfully created but
109 * the orchestration fails on a subsequent operation.
112 public void createNetworkA (String cloudSiteId,
115 String modelCustomizationUuid,
117 String physicalNetworkName,
118 List <Integer> vlans,
119 Boolean failIfExists,
121 List <Subnet> subnets,
123 MsoRequest msoRequest,
124 String notificationUrl) {
127 MsoLogger.setLogContext (msoRequest);
128 MsoLogger.setServiceName ("CreateNetworkA");
129 LOGGER.debug ("Async Create Network: " + networkName
137 // Use the synchronous method to perform the actual Create
140 // Synchronous Web Service Outputs
141 Holder <String> networkId = new Holder <> ();
142 Holder <String> neutronNetworkId = new Holder <> ();
143 Holder <NetworkRollback> networkRollback = new Holder <> ();
144 Holder <Map <String, String>> subnetIdMap = new Holder <> ();
147 networkAdapter.createNetwork (cloudSiteId,
150 modelCustomizationUuid,
162 } catch (NetworkException e) {
163 LOGGER.debug ("Got a NetworkException on createNetwork: ", e);
164 MsoExceptionCategory exCat = null;
167 eMsg = e.getFaultInfo ().getMessage ();
168 exCat = MsoExceptionCategory.fromValue (e.getFaultInfo ().getCategory ().name ());
169 } catch (Exception e1) {
170 LOGGER.error (MessageEnum.RA_FAULT_INFO_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception - fault info", e1);
172 // Build and send Asynchronous error response
174 NetworkAdapterNotify notifyPort = getNotifyEP (notificationUrl);
175 notifyPort.createNetworkNotification (messageId, false, exCat, eMsg, null, null, null, null);
176 } catch (Exception e1) {
177 error = "Error sending createNetwork notification " + e1.getMessage ();
178 LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception sending createNetwork notification", e1);
179 alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error);
183 LOGGER.debug ("Async Create Network:Name " + networkName + " physicalNetworkName:" + physicalNetworkName);
184 // Build and send Asynchronous response
186 NetworkAdapterNotify notifyPort = getNotifyEP (notificationUrl);
187 notifyPort.createNetworkNotification (messageId,
192 neutronNetworkId.value,
193 copyCreateSubnetIdMap (subnetIdMap),
194 copyNrb (networkRollback));
195 } catch (Exception e) {
196 error = "Error sending createNetwork notification " + e.getMessage ();
197 LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception sending createNetwork notification", e);
198 alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error);
204 * This is the "Update Network" web service implementation.
205 * It will update an existing Network of the requested type in the specified cloud
206 * and tenant. The typical use will be to replace the VLANs with the supplied
207 * list (to add or remove a VLAN), but other properties may be updated as well.
209 * There will be a pre-defined set of network types defined in the MSO Catalog.
210 * All such networks will have a similar configuration, based on the allowable
211 * Openstack networking definitions. This includes basic networks, provider
212 * networks (with a single VLAN), and multi-provider networks (one or more VLANs).
214 * Initially, all provider networks must currently be "vlan" type, and multi-provider
215 * networks must be multiple VLANs on the same physical network.
217 * This service supports two modes of Network update:
218 * - via Heat Templates
220 * The network orchestration mode for each network type is declared in its
221 * catalog definition. All Heat-based templates must support some subset of
222 * the same input parameters: network_name, physical_network, vlan, segments.
224 * The method returns a NetworkRollback object. This object can be passed
225 * as-is to the rollbackNetwork operation to undo everything that was updated.
226 * This is useful if a network is successfully updated but orchestration
227 * fails on a subsequent operation.
230 public void updateNetworkA (String cloudSiteId,
233 String modelCustomizationUuid,
236 String physicalNetworkName,
237 List <Integer> vlans,
238 List <Subnet> subnets,
240 MsoRequest msoRequest,
241 String notificationUrl) {
244 String serviceName = "UpdateNetworkA";
245 MsoLogger.setServiceName (serviceName);
246 MsoLogger.setLogContext (msoRequest);
247 LOGGER.debug ("Async Update Network: " + networkId
255 // Use the synchronous method to perform the actual Create
258 // Synchronous Web Service Outputs
259 Holder <NetworkRollback> networkRollback = new Holder <> ();
260 Holder <Map <String, String>> subnetIdMap = new Holder <> ();
263 networkAdapter.updateNetwork (cloudSiteId,
266 modelCustomizationUuid,
275 MsoLogger.setServiceName (serviceName);
276 } catch (NetworkException e) {
277 MsoLogger.setServiceName (serviceName);
278 LOGGER.debug ("Got a NetworkException on updateNetwork: ", e);
279 MsoExceptionCategory exCat = null;
282 eMsg = e.getFaultInfo ().getMessage ();
283 exCat = MsoExceptionCategory.fromValue (e.getFaultInfo ().getCategory ().name ());
284 } catch (Exception e1) {
285 LOGGER.error (MessageEnum.RA_FAULT_INFO_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception - fault info", e1);
287 // Build and send Asynchronous error response
289 NetworkAdapterNotify notifyPort = getNotifyEP (notificationUrl);
290 notifyPort.updateNetworkNotification (messageId, false, exCat, eMsg, null, copyNrb (networkRollback));
291 } catch (Exception e1) {
292 error = "Error sending updateNetwork notification " + e1.getMessage ();
293 LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception sending updateNetwork notification", e1);
294 alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error);
298 LOGGER.debug ("Async Update Network:Name " + networkName + " NetworkId:" + networkId);
299 // Build and send Asynchronous response
301 NetworkAdapterNotify notifyPort = getNotifyEP (notificationUrl);
302 notifyPort.updateNetworkNotification (messageId,
306 copyUpdateSubnetIdMap (subnetIdMap),
307 copyNrb (networkRollback));
308 } catch (Exception e) {
309 error = "Error sending updateNotification request" + e.getMessage ();
310 LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception sending updateNotification request", e);
311 alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error);
317 * This is the queryNetwork method. It returns the existence and status of
318 * the specified network, along with its Neutron UUID and list of VLANs.
319 * This method attempts to find the network using both Heat and Neutron.
320 * Heat stacks are first searched based on the provided network name/id.
321 * If none is found, the Neutron is directly queried.
324 public void queryNetworkA (String cloudSiteId,
326 String networkNameOrId,
328 MsoRequest msoRequest,
329 String notificationUrl) {
332 MsoLogger.setLogContext (msoRequest);
333 String serviceName = "QueryNetworkA";
334 MsoLogger.setServiceName (serviceName);
335 LOGGER.debug ("Async Query Network " + networkNameOrId + " in " + cloudSiteId + "/" + tenantId);
337 // Use the synchronous method to perform the actual Create
340 // Synchronous Web Service Outputs
341 Holder <Boolean> networkExists = new Holder <> ();
342 Holder <String> networkId = new Holder <> ();
343 Holder <String> neutronNetworkId = new Holder <> ();
344 Holder <NetworkStatus> status = new Holder <> ();
345 Holder <List <Integer>> vlans = new Holder <> ();
346 Holder <Map <String, String>> subnetIdMap = new Holder <> ();
349 networkAdapter.queryNetwork (cloudSiteId,
359 MsoLogger.setServiceName (serviceName);
360 } catch (NetworkException e) {
361 MsoLogger.setServiceName (serviceName);
362 LOGGER.debug ("Got a NetworkException on createNetwork: ", e);
363 MsoExceptionCategory exCat = null;
366 eMsg = e.getFaultInfo ().getMessage ();
367 exCat = MsoExceptionCategory.fromValue (e.getFaultInfo ().getCategory ().name ());
368 } catch (Exception e1) {
369 LOGGER.error (MessageEnum.RA_FAULT_INFO_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception - fault info", e1);
371 // Build and send Asynchronous error response
373 NetworkAdapterNotify notifyPort = getNotifyEP (notificationUrl);
374 notifyPort.queryNetworkNotification (messageId, false, exCat, eMsg, null, null, null, null, null, null);
375 } catch (Exception e1) {
376 error = "Error sending createNetwork notification " + e1.getMessage ();
377 LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception sending createNetwork notification", e1);
378 alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error);
382 LOGGER.debug ("Async Query Network:NameOrId " + networkNameOrId + " tenantId:" + tenantId);
383 // Build and send Asynchronous response
385 NetworkAdapterNotify notifyPort = getNotifyEP (notificationUrl);
386 org.onap.so.adapters.network.async.client.NetworkStatus networkS = org.onap.so.adapters.network.async.client.NetworkStatus.fromValue (status.value.name ());
387 notifyPort.queryNetworkNotification (messageId,
393 neutronNetworkId.value,
396 copyQuerySubnetIdMap (subnetIdMap));
397 } catch (Exception e) {
398 error = "Error sending createNetwork notification " + e.getMessage ();
399 LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception sending createNetwork notification", e);
400 alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error);
406 * This is the "Delete Network" web service implementation.
407 * It will delete a Network in the specified cloud and tenant.
409 * If the network is not found, it is treated as a success.
411 * This service supports two modes of Network creation/update/delete:
412 * - via Heat Templates
414 * The network orchestration mode for each network type is declared in its
415 * catalog definition.
417 * For Heat-based orchestration, the networkId should be the stack ID.
418 * For Neutron-based orchestration, the networkId should be the Neutron network UUID.
420 * The method returns nothing on success. Rollback is not possible for delete
421 * commands, so any failure on delete will require manual fallout in the client.
424 public void deleteNetworkA (String cloudSiteId,
427 String modelCustomizationUuid,
430 MsoRequest msoRequest,
431 String notificationUrl) {
433 MsoLogger.setLogContext (msoRequest);
434 String serviceName = "DeleteNetworkA";
435 MsoLogger.setServiceName (serviceName);
436 LOGGER.debug ("Async Delete Network " + networkId + " in " + cloudSiteId + "/" + tenantId);
438 // Use the synchronous method to perform the actual Create
441 // Synchronous Web Service Outputs
442 Holder <Boolean> networkDeleted = new Holder <> ();
445 networkAdapter.deleteNetwork (cloudSiteId, tenantId, networkType, modelCustomizationUuid, networkId, msoRequest, networkDeleted);
446 MsoLogger.setServiceName (serviceName);
447 } catch (NetworkException e) {
448 MsoLogger.setServiceName (serviceName);
449 LOGGER.debug ("Got a NetworkException on createNetwork: ", e);
450 MsoExceptionCategory exCat = null;
453 eMsg = e.getFaultInfo ().getMessage ();
454 exCat = MsoExceptionCategory.fromValue (e.getFaultInfo ().getCategory ().name ());
455 } catch (Exception e1) {
456 LOGGER.error (MessageEnum.RA_FAULT_INFO_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception - fault info", e1);
458 // Build and send Asynchronous error response
460 NetworkAdapterNotify notifyPort = getNotifyEP (notificationUrl);
461 notifyPort.deleteNetworkNotification (messageId, false, exCat, eMsg, null);
462 } catch (Exception e1) {
463 error = "Error sending createNetwork notification " + e1.getMessage ();
464 LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception sending createNetwork notification", e1);
465 alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error);
469 LOGGER.debug ("Async Delete NetworkId: " + networkId + " tenantId:" + tenantId);
470 // Build and send Asynchronous response
472 NetworkAdapterNotify notifyPort = getNotifyEP (notificationUrl);
473 notifyPort.deleteNetworkNotification (messageId, true, null, null, networkDeleted.value);
474 } catch (Exception e) {
475 error = "Error sending deleteNetwork notification " + e.getMessage ();
476 LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception sending deleteNetwork notification", e);
477 alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error);
483 * This web service endpoint will rollback a previous Create VNF operation.
484 * A rollback object is returned to the client in a successful creation
485 * response. The client can pass that object as-is back to the rollbackNetwork
486 * operation to undo the creation.
488 * The rollback includes removing the VNF and deleting the tenant if the
489 * tenant did not exist prior to the VNF creation.
492 public void rollbackNetworkA (NetworkRollback rollback, String messageId, String notificationUrl) {
494 String serviceName = "RollbackNetworkA";
495 MsoLogger.setServiceName (serviceName);
496 // rollback may be null (e.g. if network already existed when Create was called)
497 if (rollback == null) {
498 LOGGER.warn (MessageEnum.RA_ROLLBACK_NULL, "", "", MsoLogger.ErrorCode.SchemaError, "Rollback is null");
502 MsoLogger.setLogContext (rollback.getMsoRequest ());
503 LOGGER.info (MessageEnum.RA_ASYNC_ROLLBACK, rollback.getNetworkStackId (), "", "");
504 // Use the synchronous method to perform the actual Create
508 networkAdapter.rollbackNetwork (rollback);
509 MsoLogger.setServiceName (serviceName);
510 } catch (NetworkException e) {
511 MsoLogger.setServiceName (serviceName);
512 LOGGER.debug ("Got a NetworkException on rollbackNetwork: ", e);
513 // Build and send Asynchronous error response
514 MsoExceptionCategory exCat = null;
517 eMsg = e.getFaultInfo ().getMessage ();
518 exCat = MsoExceptionCategory.fromValue (e.getFaultInfo ().getCategory ().name ());
519 } catch (Exception e1) {
520 LOGGER.error (MessageEnum.RA_FAULT_INFO_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception in get fault info", e1);
522 // Build and send Asynchronous error response
524 NetworkAdapterNotify notifyPort = getNotifyEP (notificationUrl);
525 notifyPort.rollbackNetworkNotification (rollback.getMsoRequest ().getRequestId (), false, exCat, eMsg);
526 } catch (Exception e1) {
527 error = "Error sending createNetwork notification " + e1.getMessage ();
528 LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception in sending createNetwork notification ", e1);
529 alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error);
533 LOGGER.debug ("Async Rollback NetworkId: " + rollback.getNetworkStackId () + " tenantId:" + rollback.getTenantId ());
534 // Build and send Asynchronous response
536 NetworkAdapterNotify notifyPort = getNotifyEP (notificationUrl);
537 notifyPort.rollbackNetworkNotification (rollback.getMsoRequest ().getRequestId (), true, null, null);
538 } catch (Exception e) {
539 error = "Error sending rollbackNetwork notification " + e.getMessage ();
540 LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception in sending rollbackNetwork notification", e);
541 alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error);
546 private org.onap.so.adapters.network.async.client.NetworkRollback copyNrb (Holder <NetworkRollback> hNrb) {
547 org.onap.so.adapters.network.async.client.NetworkRollback cnrb = new org.onap.so.adapters.network.async.client.NetworkRollback ();
549 if (hNrb != null && hNrb.value != null) {
550 org.onap.so.adapters.network.async.client.MsoRequest cmr = new org.onap.so.adapters.network.async.client.MsoRequest ();
552 cnrb.setCloudId (hNrb.value.getCloudId ());
553 cmr.setRequestId (hNrb.value.getMsoRequest ().getRequestId ());
554 cmr.setServiceInstanceId (hNrb.value.getMsoRequest ().getServiceInstanceId ());
555 cnrb.setMsoRequest (cmr);
556 cnrb.setNetworkId (hNrb.value.getNetworkId ());
557 cnrb.setNetworkStackId (hNrb.value.getNetworkStackId ());
558 cnrb.setNeutronNetworkId (hNrb.value.getNeutronNetworkId ());
559 cnrb.setTenantId (hNrb.value.getTenantId ());
560 cnrb.setNetworkType (hNrb.value.getNetworkType ());
561 cnrb.setNetworkCreated (hNrb.value.getNetworkCreated ());
562 cnrb.setNetworkName (hNrb.value.getNetworkName ());
563 cnrb.setPhysicalNetwork (hNrb.value.getPhysicalNetwork ());
564 List <Integer> vlansc = cnrb.getVlans ();
565 List <Integer> vlansh = hNrb.value.getVlans ();
566 if (vlansh != null) {
567 vlansc.addAll (vlansh);
573 private NetworkAdapterNotify getNotifyEP (String notificationUrl) {
575 URL warWsdlLoc = null;
577 warWsdlLoc = Thread.currentThread ().getContextClassLoader ().getResource ("NetworkAdapterNotify.wsdl");
578 } catch (Exception e) {
579 LOGGER.error (MessageEnum.RA_WSDL_NOT_FOUND, "NetworkAdpaterNotify.wsdl", "", "", MsoLogger.ErrorCode.DataError, "Exception - WSDL not found", e);
581 if (warWsdlLoc == null) {
582 LOGGER.error (MessageEnum.RA_WSDL_NOT_FOUND, "NetworkAdpaterNotify.wsdl", "", "", MsoLogger.ErrorCode.DataError, "WSDL not found");
585 LOGGER.debug ("NetworkAdpaterNotify.wsdl location:" + warWsdlLoc.toURI ().toString ());
586 } catch (Exception e) {
587 LOGGER.error (MessageEnum.RA_WSDL_URL_CONVENTION_EXC, "NetworkAdpaterNotify.wsdl", "", "", MsoLogger.ErrorCode.SchemaError, "Exception - WSDL URL convention", e);
591 NetworkAdapterNotify_Service notifySvc = new NetworkAdapterNotify_Service (warWsdlLoc,
592 new QName ("http://org.onap.so/networkNotify",
593 "networkAdapterNotify"));
595 NetworkAdapterNotify notifyPort = notifySvc.getMsoNetworkAdapterAsyncImplPort ();
597 BindingProvider bp = (BindingProvider) notifyPort;
601 epUrl = new URL (notificationUrl);
602 } catch (MalformedURLException e1) {
603 LOGGER.error (MessageEnum.RA_INIT_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception - init notification", e1);
607 LOGGER.debug ("Notification Endpoint URL: " + epUrl.toExternalForm ());
608 bp.getRequestContext ().put (BindingProvider.ENDPOINT_ADDRESS_PROPERTY, epUrl.toExternalForm ());
611 LOGGER.debug ("Notification Endpoint URL is NULL: ");
616 Map <String, Object> reqCtx = bp.getRequestContext ();
617 Map <String, List <String>> headers = new HashMap <> ();
619 String userCredentials = this.getEncryptedProperty (BPEL_AUTH_PROP, "", ENCRYPTION_KEY);
621 String basicAuth = "Basic " + DatatypeConverter.printBase64Binary (userCredentials.getBytes ());
622 reqCtx.put (MessageContext.HTTP_REQUEST_HEADERS, headers);
623 headers.put ("Authorization", Collections.singletonList (basicAuth));
624 } catch (Exception e) {
625 String error1 = "Unable to set authorization in callback request" + e.getMessage ();
626 LOGGER.error (MessageEnum.RA_SET_CALLBACK_AUTH_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception - Unable to set authorization in callback request", e);
627 alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error1);
633 public String getEncryptedProperty(String key, String defaultValue, String encryptionKey) {
635 return CryptoUtils.decrypt(this.environment.getProperty(key), encryptionKey);
636 } catch (GeneralSecurityException e) {
637 LOGGER.debug("Exception while decrypting property: " + this.environment.getProperty(key), e);
643 private CreateNetworkNotification.SubnetIdMap copyCreateSubnetIdMap (Holder <Map <String, String>> hMap) {
645 CreateNetworkNotification.SubnetIdMap subnetIdMap = new CreateNetworkNotification.SubnetIdMap ();
647 if (hMap != null && hMap.value != null) {
648 Map <String, String> sMap = hMap.value;
649 CreateNetworkNotification.SubnetIdMap.Entry entry = new CreateNetworkNotification.SubnetIdMap.Entry ();
651 for (Map.Entry<String,String> mapEntry : sMap.entrySet ()) {
652 String key = mapEntry.getKey();
653 String value = mapEntry.getValue();
655 entry.setValue (value);
656 subnetIdMap.getEntry ().add (entry);
662 private UpdateNetworkNotification.SubnetIdMap copyUpdateSubnetIdMap (Holder <Map <String, String>> hMap) {
664 UpdateNetworkNotification.SubnetIdMap subnetIdMap = new UpdateNetworkNotification.SubnetIdMap ();
666 if (hMap != null && hMap.value != null) {
667 Map <String, String> sMap = hMap.value;
668 UpdateNetworkNotification.SubnetIdMap.Entry entry = new UpdateNetworkNotification.SubnetIdMap.Entry ();
670 for (Map.Entry<String,String> mapEntry : sMap.entrySet ()) {
671 String key = mapEntry.getKey();
672 String value = mapEntry.getValue();
674 entry.setValue (value);
675 subnetIdMap.getEntry ().add (entry);
681 private QueryNetworkNotification.SubnetIdMap copyQuerySubnetIdMap (Holder <Map <String, String>> hMap) {
683 QueryNetworkNotification.SubnetIdMap subnetIdMap = new QueryNetworkNotification.SubnetIdMap ();
685 if (hMap != null && hMap.value != null) {
686 Map <String, String> sMap = hMap.value;
687 QueryNetworkNotification.SubnetIdMap.Entry entry = new QueryNetworkNotification.SubnetIdMap.Entry ();
689 for (Map.Entry<String,String> mapEntry : sMap.entrySet ()) {
690 String key = mapEntry.getKey();
691 String value = mapEntry.getValue();
693 entry.setValue (value);
694 subnetIdMap.getEntry ().add (entry);