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;
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);
67 private static final String BPEL_AUTH_PROP = "org.onap.so.adapters.network.bpelauth";
68 private static final String ENCRYPTION_KEY_PROP = "org.onap.so.adapters.network.encryptionKey";
69 private static final String NETWORK_EXCEPTION_MSG="Got a NetworkException on createNetwork: ";
70 private static final String CREATE_NETWORK_ERROR_MSG="Error sending createNetwork notification ";
71 private static final String CREATE_NETWORK_EXCEPTON_MSG="Exception sending createNetwork notification";
72 private static final String MSO_INTERNAL_ERROR_MSG="MsoInternalError";
74 private Environment environment;
77 private MsoNetworkAdapter networkAdapter;
79 * Health Check web method. Does nothing but return to show the adapter is deployed.
82 public void healthCheckA () {
83 LOGGER.debug ("Health check call in Network Adapter");
87 * This is the "Create Network" web service implementation.
88 * It will create a new Network of the requested type in the specified cloud
89 * and tenant. The tenant must exist at the time this service is called.
91 * If a network with the same name already exists, this can be considered a
92 * success or failure, depending on the value of the 'failIfExists' parameter.
94 * There will be a pre-defined set of network types defined in the MSO Catalog.
95 * All such networks will have a similar configuration, based on the allowable
96 * Openstack networking definitions. This includes basic networks, provider
97 * networks (with a single VLAN), and multi-provider networks (one or more VLANs)
99 * Initially, all provider networks must be "vlan" type, and multiple segments in
100 * a multi-provider network must be multiple VLANs on the same physical network.
102 * This service supports two modes of Network creation/update:
103 * - via Heat Templates
105 * The network orchestration mode for each network type is declared in its
106 * catalog definition. All Heat-based templates must support some subset of
107 * the same input parameters: network_name, physical_network, vlan(s).
109 * The method returns the network ID and a NetworkRollback object. This latter
110 * object can be passed as-is to the rollbackNetwork operation to undo everything
111 * that was created. This is useful if a network is successfully created but
112 * the orchestration fails on a subsequent operation.
115 public void createNetworkA (String cloudSiteId,
118 String modelCustomizationUuid,
120 String physicalNetworkName,
121 List <Integer> vlans,
122 Boolean failIfExists,
124 List <Subnet> subnets,
125 Map<String,String> networkParams,
127 MsoRequest msoRequest,
128 String notificationUrl) {
131 MsoLogger.setLogContext (msoRequest);
132 MsoLogger.setServiceName ("CreateNetworkA");
133 LOGGER.debug ("Async Create Network: " + networkName
141 // Use the synchronous method to perform the actual Create
144 // Synchronous Web Service Outputs
145 Holder <String> networkId = new Holder <> ();
146 Holder <String> neutronNetworkId = new Holder <> ();
147 Holder <NetworkRollback> networkRollback = new Holder <> ();
148 Holder <Map <String, String>> subnetIdMap = new Holder <> ();
150 HashMap<String, String> params = (HashMap<String,String>) networkParams;
152 params = new HashMap<String,String>();
153 String shared = null;
154 String external = null;
155 if (params.containsKey("shared"))
156 shared = params.get("shared");
157 if (params.containsKey("external"))
158 external = params.get("external");
161 networkAdapter.createNetwork (cloudSiteId,
164 modelCustomizationUuid,
179 } catch (NetworkException e) {
180 LOGGER.debug (NETWORK_EXCEPTION_MSG, e);
181 MsoExceptionCategory exCat = null;
184 eMsg = e.getFaultInfo ().getMessage ();
185 exCat = MsoExceptionCategory.fromValue (e.getFaultInfo ().getCategory ().name ());
186 } catch (Exception e1) {
187 LOGGER.error (MessageEnum.RA_FAULT_INFO_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception - fault info", e1);
189 // Build and send Asynchronous error response
191 NetworkAdapterNotify notifyPort = getNotifyEP (notificationUrl);
192 notifyPort.createNetworkNotification (messageId, false, exCat, eMsg, null, null, null, null);
193 } catch (Exception e1) {
194 error = CREATE_NETWORK_ERROR_MSG + e1.getMessage ();
195 LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError,CREATE_NETWORK_EXCEPTON_MSG, e1);
200 LOGGER.debug ("Async Create Network:Name " + networkName + " physicalNetworkName:" + physicalNetworkName);
201 // Build and send Asynchronous response
203 NetworkAdapterNotify notifyPort = getNotifyEP (notificationUrl);
204 notifyPort.createNetworkNotification (messageId,
209 neutronNetworkId.value,
210 copyCreateSubnetIdMap (subnetIdMap),
211 copyNrb (networkRollback));
212 } catch (Exception e) {
213 error = CREATE_NETWORK_ERROR_MSG + e.getMessage ();
214 LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, CREATE_NETWORK_EXCEPTON_MSG, e);
221 * This is the "Update Network" web service implementation.
222 * It will update an existing Network of the requested type in the specified cloud
223 * and tenant. The typical use will be to replace the VLANs with the supplied
224 * list (to add or remove a VLAN), but other properties may be updated as well.
226 * There will be a pre-defined set of network types defined in the MSO Catalog.
227 * All such networks will have a similar configuration, based on the allowable
228 * Openstack networking definitions. This includes basic networks, provider
229 * networks (with a single VLAN), and multi-provider networks (one or more VLANs).
231 * Initially, all provider networks must currently be "vlan" type, and multi-provider
232 * networks must be multiple VLANs on the same physical network.
234 * This service supports two modes of Network update:
235 * - via Heat Templates
237 * The network orchestration mode for each network type is declared in its
238 * catalog definition. All Heat-based templates must support some subset of
239 * the same input parameters: network_name, physical_network, vlan, segments.
241 * The method returns a NetworkRollback object. This object can be passed
242 * as-is to the rollbackNetwork operation to undo everything that was updated.
243 * This is useful if a network is successfully updated but orchestration
244 * fails on a subsequent operation.
247 public void updateNetworkA (String cloudSiteId,
250 String modelCustomizationUuid,
253 String physicalNetworkName,
254 List <Integer> vlans,
255 List <Subnet> subnets,
256 Map <String,String> networkParams,
258 MsoRequest msoRequest,
259 String notificationUrl) {
262 String serviceName = "UpdateNetworkA";
263 MsoLogger.setServiceName (serviceName);
264 MsoLogger.setLogContext (msoRequest);
265 LOGGER.debug ("Async Update Network: " + networkId
273 // Use the synchronous method to perform the actual Create
276 // Synchronous Web Service Outputs
277 Holder <NetworkRollback> networkRollback = new Holder <> ();
278 Holder <Map <String, String>> subnetIdMap = new Holder <> ();
280 HashMap<String, String> params = (HashMap<String,String>) networkParams;
282 params = new HashMap<String,String>();
283 String shared = null;
284 String external = null;
285 if (params.containsKey("shared"))
286 shared = params.get("shared");
287 if (params.containsKey("external"))
288 external = params.get("external");
291 networkAdapter.updateNetwork (cloudSiteId,
294 modelCustomizationUuid,
306 MsoLogger.setServiceName (serviceName);
307 } catch (NetworkException e) {
308 MsoLogger.setServiceName (serviceName);
309 LOGGER.debug ("Got a NetworkException on updateNetwork: ", e);
310 MsoExceptionCategory exCat = null;
313 eMsg = e.getFaultInfo ().getMessage ();
314 exCat = MsoExceptionCategory.fromValue (e.getFaultInfo ().getCategory ().name ());
315 } catch (Exception e1) {
316 LOGGER.error (MessageEnum.RA_FAULT_INFO_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception - fault info", e1);
318 // Build and send Asynchronous error response
320 NetworkAdapterNotify notifyPort = getNotifyEP (notificationUrl);
321 notifyPort.updateNetworkNotification (messageId, false, exCat, eMsg, null, copyNrb (networkRollback));
322 } catch (Exception e1) {
323 error = "Error sending updateNetwork notification " + e1.getMessage ();
324 LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception sending updateNetwork notification", e1);
329 LOGGER.debug ("Async Update Network:Name " + networkName + " NetworkId:" + networkId);
330 // Build and send Asynchronous response
332 NetworkAdapterNotify notifyPort = getNotifyEP (notificationUrl);
333 notifyPort.updateNetworkNotification (messageId,
337 copyUpdateSubnetIdMap (subnetIdMap),
338 copyNrb (networkRollback));
339 } catch (Exception e) {
340 error = "Error sending updateNotification request" + e.getMessage ();
341 LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception sending updateNotification request", e);
348 * This is the queryNetwork method. It returns the existence and status of
349 * the specified network, along with its Neutron UUID and list of VLANs.
350 * This method attempts to find the network using both Heat and Neutron.
351 * Heat stacks are first searched based on the provided network name/id.
352 * If none is found, the Neutron is directly queried.
355 public void queryNetworkA (String cloudSiteId,
357 String networkNameOrId,
359 MsoRequest msoRequest,
360 String notificationUrl) {
363 MsoLogger.setLogContext (msoRequest);
364 String serviceName = "QueryNetworkA";
365 MsoLogger.setServiceName (serviceName);
366 LOGGER.debug ("Async Query Network " + networkNameOrId + " in " + cloudSiteId + "/" + tenantId);
368 // Use the synchronous method to perform the actual Create
371 // Synchronous Web Service Outputs
372 Holder <Boolean> networkExists = new Holder <> ();
373 Holder <String> networkId = new Holder <> ();
374 Holder <String> neutronNetworkId = new Holder <> ();
375 Holder <NetworkStatus> status = new Holder <> ();
376 Holder <List <Integer>> vlans = new Holder <> ();
377 Holder <Map <String, String>> subnetIdMap = new Holder <> ();
380 networkAdapter.queryNetwork (cloudSiteId,
390 MsoLogger.setServiceName (serviceName);
391 } catch (NetworkException e) {
392 MsoLogger.setServiceName (serviceName);
393 LOGGER.debug (NETWORK_EXCEPTION_MSG, e);
394 MsoExceptionCategory exCat = null;
397 eMsg = e.getFaultInfo ().getMessage ();
398 exCat = MsoExceptionCategory.fromValue (e.getFaultInfo ().getCategory ().name ());
399 } catch (Exception e1) {
400 LOGGER.error (MessageEnum.RA_FAULT_INFO_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception - fault info", e1);
402 // Build and send Asynchronous error response
404 NetworkAdapterNotify notifyPort = getNotifyEP (notificationUrl);
405 notifyPort.queryNetworkNotification (messageId, false, exCat, eMsg, null, null, null, null, null, null);
406 } catch (Exception e1) {
407 error = "Error sending createNetwork notification " + e1.getMessage ();
408 LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception sending createNetwork notification", e1);
413 LOGGER.debug ("Async Query Network:NameOrId " + networkNameOrId + " tenantId:" + tenantId);
414 // Build and send Asynchronous response
416 NetworkAdapterNotify notifyPort = getNotifyEP (notificationUrl);
417 org.onap.so.adapters.network.async.client.NetworkStatus networkS = org.onap.so.adapters.network.async.client.NetworkStatus.fromValue (status.value.name ());
418 notifyPort.queryNetworkNotification (messageId,
424 neutronNetworkId.value,
427 copyQuerySubnetIdMap (subnetIdMap));
428 } catch (Exception e) {
429 error = "Error sending createNetwork notification " + e.getMessage ();
430 LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception sending createNetwork notification", e);
437 * This is the "Delete Network" web service implementation.
438 * It will delete a Network in the specified cloud and tenant.
440 * If the network is not found, it is treated as a success.
442 * This service supports two modes of Network creation/update/delete:
443 * - via Heat Templates
445 * The network orchestration mode for each network type is declared in its
446 * catalog definition.
448 * For Heat-based orchestration, the networkId should be the stack ID.
449 * For Neutron-based orchestration, the networkId should be the Neutron network UUID.
451 * The method returns nothing on success. Rollback is not possible for delete
452 * commands, so any failure on delete will require manual fallout in the client.
455 public void deleteNetworkA (String cloudSiteId,
458 String modelCustomizationUuid,
461 MsoRequest msoRequest,
462 String notificationUrl) {
464 MsoLogger.setLogContext (msoRequest);
465 String serviceName = "DeleteNetworkA";
466 MsoLogger.setServiceName (serviceName);
467 LOGGER.debug ("Async Delete Network " + networkId + " in " + cloudSiteId + "/" + tenantId);
469 // Use the synchronous method to perform the actual Create
472 // Synchronous Web Service Outputs
473 Holder <Boolean> networkDeleted = new Holder <> ();
476 networkAdapter.deleteNetwork (cloudSiteId, tenantId, networkType, modelCustomizationUuid, networkId, msoRequest, networkDeleted);
477 MsoLogger.setServiceName (serviceName);
478 } catch (NetworkException e) {
479 MsoLogger.setServiceName (serviceName);
480 LOGGER.debug (NETWORK_EXCEPTION_MSG, e);
481 MsoExceptionCategory exCat = null;
484 eMsg = e.getFaultInfo ().getMessage ();
485 exCat = MsoExceptionCategory.fromValue (e.getFaultInfo ().getCategory ().name ());
486 } catch (Exception e1) {
487 LOGGER.error (MessageEnum.RA_FAULT_INFO_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception - fault info", e1);
489 // Build and send Asynchronous error response
491 NetworkAdapterNotify notifyPort = getNotifyEP (notificationUrl);
492 notifyPort.deleteNetworkNotification (messageId, false, exCat, eMsg, null);
493 } catch (Exception e1) {
494 error = "Error sending createNetwork notification " + e1.getMessage ();
495 LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception sending createNetwork notification", e1);
500 LOGGER.debug ("Async Delete NetworkId: " + networkId + " tenantId:" + tenantId);
501 // Build and send Asynchronous response
503 NetworkAdapterNotify notifyPort = getNotifyEP (notificationUrl);
504 notifyPort.deleteNetworkNotification (messageId, true, null, null, networkDeleted.value);
505 } catch (Exception e) {
506 error = "Error sending deleteNetwork notification " + e.getMessage ();
507 LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception sending deleteNetwork notification", e);
514 * This web service endpoint will rollback a previous Create VNF operation.
515 * A rollback object is returned to the client in a successful creation
516 * response. The client can pass that object as-is back to the rollbackNetwork
517 * operation to undo the creation.
519 * The rollback includes removing the VNF and deleting the tenant if the
520 * tenant did not exist prior to the VNF creation.
523 public void rollbackNetworkA (NetworkRollback rollback, String messageId, String notificationUrl) {
525 String serviceName = "RollbackNetworkA";
526 MsoLogger.setServiceName (serviceName);
527 // rollback may be null (e.g. if network already existed when Create was called)
528 if (rollback == null) {
529 LOGGER.warn (MessageEnum.RA_ROLLBACK_NULL, "", "", MsoLogger.ErrorCode.SchemaError, "Rollback is null");
533 MsoLogger.setLogContext (rollback.getMsoRequest ());
534 LOGGER.info (MessageEnum.RA_ASYNC_ROLLBACK, rollback.getNetworkStackId (), "", "");
535 // Use the synchronous method to perform the actual Create
539 networkAdapter.rollbackNetwork (rollback);
540 MsoLogger.setServiceName (serviceName);
541 } catch (NetworkException e) {
542 MsoLogger.setServiceName (serviceName);
543 LOGGER.debug ("Got a NetworkException on rollbackNetwork: ", e);
544 // Build and send Asynchronous error response
545 MsoExceptionCategory exCat = null;
548 eMsg = e.getFaultInfo ().getMessage ();
549 exCat = MsoExceptionCategory.fromValue (e.getFaultInfo ().getCategory ().name ());
550 } catch (Exception e1) {
551 LOGGER.error (MessageEnum.RA_FAULT_INFO_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception in get fault info", e1);
553 // Build and send Asynchronous error response
555 NetworkAdapterNotify notifyPort = getNotifyEP (notificationUrl);
556 notifyPort.rollbackNetworkNotification (rollback.getMsoRequest ().getRequestId (), false, exCat, eMsg);
557 } catch (Exception e1) {
558 error = CREATE_NETWORK_ERROR_MSG + e1.getMessage ();
559 LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception in sending createNetwork notification ", e1);
564 LOGGER.debug ("Async Rollback NetworkId: " + rollback.getNetworkStackId () + " tenantId:" + rollback.getTenantId ());
565 // Build and send Asynchronous response
567 NetworkAdapterNotify notifyPort = getNotifyEP (notificationUrl);
568 notifyPort.rollbackNetworkNotification (rollback.getMsoRequest ().getRequestId (), true, null, null);
569 } catch (Exception e) {
570 error = "Error sending rollbackNetwork notification " + e.getMessage ();
571 LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception in sending rollbackNetwork notification", e);
577 private org.onap.so.adapters.network.async.client.NetworkRollback copyNrb (Holder <NetworkRollback> hNrb) {
578 org.onap.so.adapters.network.async.client.NetworkRollback cnrb = new org.onap.so.adapters.network.async.client.NetworkRollback ();
580 if (hNrb != null && hNrb.value != null) {
581 org.onap.so.adapters.network.async.client.MsoRequest cmr = new org.onap.so.adapters.network.async.client.MsoRequest ();
583 cnrb.setCloudId (hNrb.value.getCloudId ());
584 cmr.setRequestId (hNrb.value.getMsoRequest ().getRequestId ());
585 cmr.setServiceInstanceId (hNrb.value.getMsoRequest ().getServiceInstanceId ());
586 cnrb.setMsoRequest (cmr);
587 cnrb.setNetworkId (hNrb.value.getNetworkId ());
588 cnrb.setNetworkStackId (hNrb.value.getNetworkStackId ());
589 cnrb.setNeutronNetworkId (hNrb.value.getNeutronNetworkId ());
590 cnrb.setTenantId (hNrb.value.getTenantId ());
591 cnrb.setNetworkType (hNrb.value.getNetworkType ());
592 cnrb.setNetworkCreated (hNrb.value.getNetworkCreated ());
593 cnrb.setNetworkName (hNrb.value.getNetworkName ());
594 cnrb.setPhysicalNetwork (hNrb.value.getPhysicalNetwork ());
595 List <Integer> vlansc = cnrb.getVlans ();
596 List <Integer> vlansh = hNrb.value.getVlans ();
597 if (vlansh != null) {
598 vlansc.addAll (vlansh);
604 private NetworkAdapterNotify getNotifyEP (String notificationUrl) {
606 URL warWsdlLoc = null;
608 warWsdlLoc = Thread.currentThread ().getContextClassLoader ().getResource ("NetworkAdapterNotify.wsdl");
609 } catch (Exception e) {
610 LOGGER.error (MessageEnum.RA_WSDL_NOT_FOUND, "NetworkAdpaterNotify.wsdl", "", "", MsoLogger.ErrorCode.DataError, "Exception - WSDL not found", e);
612 if (warWsdlLoc == null) {
613 LOGGER.error (MessageEnum.RA_WSDL_NOT_FOUND, "NetworkAdpaterNotify.wsdl", "", "", MsoLogger.ErrorCode.DataError, "WSDL not found");
616 LOGGER.debug ("NetworkAdpaterNotify.wsdl location:" + warWsdlLoc.toURI ().toString ());
617 } catch (Exception e) {
618 LOGGER.error (MessageEnum.RA_WSDL_URL_CONVENTION_EXC, "NetworkAdpaterNotify.wsdl", "", "", MsoLogger.ErrorCode.SchemaError, "Exception - WSDL URL convention", e);
622 NetworkAdapterNotify_Service notifySvc = new NetworkAdapterNotify_Service (warWsdlLoc,
623 new QName ("http://org.onap.so/networkNotify",
624 "networkAdapterNotify"));
626 NetworkAdapterNotify notifyPort = notifySvc.getMsoNetworkAdapterAsyncImplPort ();
628 BindingProvider bp = (BindingProvider) notifyPort;
632 epUrl = new URL (notificationUrl);
633 } catch (MalformedURLException e1) {
634 LOGGER.error (MessageEnum.RA_INIT_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception - init notification", e1);
638 LOGGER.debug ("Notification Endpoint URL: " + epUrl.toExternalForm ());
639 bp.getRequestContext ().put (BindingProvider.ENDPOINT_ADDRESS_PROPERTY, epUrl.toExternalForm ());
642 LOGGER.debug ("Notification Endpoint URL is NULL: ");
647 Map <String, Object> reqCtx = bp.getRequestContext ();
648 Map <String, List <String>> headers = new HashMap <> ();
650 String userCredentials = this.getEncryptedProperty (BPEL_AUTH_PROP, "", ENCRYPTION_KEY_PROP);
652 String basicAuth = "Basic " + DatatypeConverter.printBase64Binary (userCredentials.getBytes ());
653 reqCtx.put (MessageContext.HTTP_REQUEST_HEADERS, headers);
654 headers.put ("Authorization", Collections.singletonList (basicAuth));
655 } catch (Exception e) {
656 String error1 = "Unable to set authorization in callback request" + e.getMessage ();
657 LOGGER.error (MessageEnum.RA_SET_CALLBACK_AUTH_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception - Unable to set authorization in callback request", e);
664 public String getEncryptedProperty(String key, String defaultValue, String encryptionKey) {
666 return CryptoUtils.decrypt(this.environment.getProperty(key), this.environment.getProperty(encryptionKey));
667 } catch (GeneralSecurityException e) {
668 LOGGER.debug("Exception while decrypting property: " + this.environment.getProperty(key), e);
674 private CreateNetworkNotification.SubnetIdMap copyCreateSubnetIdMap (Holder <Map <String, String>> hMap) {
676 CreateNetworkNotification.SubnetIdMap subnetIdMap = new CreateNetworkNotification.SubnetIdMap ();
678 if (hMap != null && hMap.value != null) {
679 Map <String, String> sMap = hMap.value;
680 CreateNetworkNotification.SubnetIdMap.Entry entry = new CreateNetworkNotification.SubnetIdMap.Entry ();
682 for (Map.Entry<String,String> mapEntry : sMap.entrySet ()) {
683 String key = mapEntry.getKey();
684 String value = mapEntry.getValue();
686 entry.setValue (value);
687 subnetIdMap.getEntry ().add (entry);
693 private UpdateNetworkNotification.SubnetIdMap copyUpdateSubnetIdMap (Holder <Map <String, String>> hMap) {
695 UpdateNetworkNotification.SubnetIdMap subnetIdMap = new UpdateNetworkNotification.SubnetIdMap ();
697 if (hMap != null && hMap.value != null) {
698 Map <String, String> sMap = hMap.value;
699 UpdateNetworkNotification.SubnetIdMap.Entry entry = new UpdateNetworkNotification.SubnetIdMap.Entry ();
701 for (Map.Entry<String,String> mapEntry : sMap.entrySet ()) {
702 String key = mapEntry.getKey();
703 String value = mapEntry.getValue();
705 entry.setValue (value);
706 subnetIdMap.getEntry ().add (entry);
712 private QueryNetworkNotification.SubnetIdMap copyQuerySubnetIdMap (Holder <Map <String, String>> hMap) {
714 QueryNetworkNotification.SubnetIdMap subnetIdMap = new QueryNetworkNotification.SubnetIdMap ();
716 if (hMap != null && hMap.value != null) {
717 Map <String, String> sMap = hMap.value;
718 QueryNetworkNotification.SubnetIdMap.Entry entry = new QueryNetworkNotification.SubnetIdMap.Entry ();
720 for (Map.Entry<String,String> mapEntry : sMap.entrySet ()) {
721 String key = mapEntry.getKey();
722 String value = mapEntry.getValue();
724 entry.setValue (value);
725 subnetIdMap.getEntry ().add (entry);