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.onap.so.adapters.network;
25 import java.net.MalformedURLException;
27 import java.security.GeneralSecurityException;
28 import java.util.Collections;
29 import java.util.HashMap;
30 import java.util.List;
33 import javax.jws.WebService;
34 import javax.xml.bind.DatatypeConverter;
35 import javax.xml.namespace.QName;
36 import javax.xml.ws.BindingProvider;
37 import javax.xml.ws.Holder;
38 import javax.xml.ws.handler.MessageContext;
40 import org.onap.so.adapters.network.async.client.CreateNetworkNotification;
41 import org.onap.so.adapters.network.async.client.MsoExceptionCategory;
42 import org.onap.so.adapters.network.async.client.NetworkAdapterNotify;
43 import org.onap.so.adapters.network.async.client.NetworkAdapterNotify_Service;
44 import org.onap.so.adapters.network.async.client.QueryNetworkNotification;
45 import org.onap.so.adapters.network.async.client.UpdateNetworkNotification;
46 import org.onap.so.adapters.network.exceptions.NetworkException;
47 import org.onap.so.entity.MsoRequest;
48 import org.onap.so.logger.MessageEnum;
49 import org.onap.so.logger.MsoAlarmLogger;
50 import org.onap.so.logger.MsoLogger;
51 import org.onap.so.openstack.beans.NetworkRollback;
52 import org.onap.so.openstack.beans.NetworkStatus;
53 import org.onap.so.openstack.beans.Subnet;
54 import org.onap.so.utils.CryptoUtils;
55 import org.springframework.beans.factory.annotation.Autowired;
56 import org.springframework.core.env.Environment;
57 import org.springframework.stereotype.Component;
60 @WebService(serviceName = "NetworkAdapterAsync", endpointInterface = "org.onap.so.adapters.network.MsoNetworkAdapterAsync", targetNamespace = "http://org.onap.so/networkA")
61 public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
63 private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA,MsoNetworkAdapterAsyncImpl.class);
64 private static final MsoAlarmLogger alarmLogger = new MsoAlarmLogger ();
65 private static final String BPEL_AUTH_PROP = "org.onap.so.adapters.network.bpelauth";
66 private static final String ENCRYPTION_KEY = "aa3871669d893c7fb8abbcda31b88b4f";
69 private Environment environment;
72 private MsoNetworkAdapter networkAdapter;
74 * Health Check web method. Does nothing but return to show the adapter is deployed.
77 public void healthCheckA () {
78 LOGGER.debug ("Health check call in Network Adapter");
82 * This is the "Create Network" web service implementation.
83 * It will create a new Network of the requested type in the specified cloud
84 * and tenant. The tenant must exist at the time this service is called.
86 * If a network with the same name already exists, this can be considered a
87 * success or failure, depending on the value of the 'failIfExists' parameter.
89 * There will be a pre-defined set of network types defined in the MSO Catalog.
90 * All such networks will have a similar configuration, based on the allowable
91 * Openstack networking definitions. This includes basic networks, provider
92 * networks (with a single VLAN), and multi-provider networks (one or more VLANs)
94 * Initially, all provider networks must be "vlan" type, and multiple segments in
95 * a multi-provider network must be multiple VLANs on the same physical network.
97 * This service supports two modes of Network creation/update:
98 * - via Heat Templates
100 * The network orchestration mode for each network type is declared in its
101 * catalog definition. All Heat-based templates must support some subset of
102 * the same input parameters: network_name, physical_network, vlan(s).
104 * The method returns the network ID and a NetworkRollback object. This latter
105 * object can be passed as-is to the rollbackNetwork operation to undo everything
106 * that was created. This is useful if a network is successfully created but
107 * the orchestration fails on a subsequent operation.
110 public void createNetworkA (String cloudSiteId,
113 String modelCustomizationUuid,
115 String physicalNetworkName,
116 List <Integer> vlans,
117 Boolean failIfExists,
119 List <Subnet> subnets,
121 MsoRequest msoRequest,
122 String notificationUrl) {
125 MsoLogger.setLogContext (msoRequest);
126 MsoLogger.setServiceName ("CreateNetworkA");
127 LOGGER.debug ("Async Create Network: " + networkName
135 // Use the synchronous method to perform the actual Create
138 // Synchronous Web Service Outputs
139 Holder <String> networkId = new Holder <> ();
140 Holder <String> neutronNetworkId = new Holder <> ();
141 Holder <NetworkRollback> networkRollback = new Holder <> ();
142 Holder <Map <String, String>> subnetIdMap = new Holder <> ();
145 networkAdapter.createNetwork (cloudSiteId,
148 modelCustomizationUuid,
160 } catch (NetworkException e) {
161 LOGGER.debug ("Got a NetworkException on createNetwork: ", e);
162 MsoExceptionCategory exCat = null;
165 eMsg = e.getFaultInfo ().getMessage ();
166 exCat = MsoExceptionCategory.fromValue (e.getFaultInfo ().getCategory ().name ());
167 } catch (Exception e1) {
168 LOGGER.error (MessageEnum.RA_FAULT_INFO_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception - fault info", e1);
170 // Build and send Asynchronous error response
172 NetworkAdapterNotify notifyPort = getNotifyEP (notificationUrl);
173 notifyPort.createNetworkNotification (messageId, false, exCat, eMsg, null, null, null, null);
174 } catch (Exception e1) {
175 error = "Error sending createNetwork notification " + e1.getMessage ();
176 LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception sending createNetwork notification", e1);
177 alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error);
181 LOGGER.debug ("Async Create Network:Name " + networkName + " physicalNetworkName:" + physicalNetworkName);
182 // Build and send Asynchronous response
184 NetworkAdapterNotify notifyPort = getNotifyEP (notificationUrl);
185 notifyPort.createNetworkNotification (messageId,
190 neutronNetworkId.value,
191 copyCreateSubnetIdMap (subnetIdMap),
192 copyNrb (networkRollback));
193 } catch (Exception e) {
194 error = "Error sending createNetwork notification " + e.getMessage ();
195 LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception sending createNetwork notification", e);
196 alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error);
202 * This is the "Update Network" web service implementation.
203 * It will update an existing Network of the requested type in the specified cloud
204 * and tenant. The typical use will be to replace the VLANs with the supplied
205 * list (to add or remove a VLAN), but other properties may be updated as well.
207 * There will be a pre-defined set of network types defined in the MSO Catalog.
208 * All such networks will have a similar configuration, based on the allowable
209 * Openstack networking definitions. This includes basic networks, provider
210 * networks (with a single VLAN), and multi-provider networks (one or more VLANs).
212 * Initially, all provider networks must currently be "vlan" type, and multi-provider
213 * networks must be multiple VLANs on the same physical network.
215 * This service supports two modes of Network update:
216 * - via Heat Templates
218 * The network orchestration mode for each network type is declared in its
219 * catalog definition. All Heat-based templates must support some subset of
220 * the same input parameters: network_name, physical_network, vlan, segments.
222 * The method returns a NetworkRollback object. This object can be passed
223 * as-is to the rollbackNetwork operation to undo everything that was updated.
224 * This is useful if a network is successfully updated but orchestration
225 * fails on a subsequent operation.
228 public void updateNetworkA (String cloudSiteId,
231 String modelCustomizationUuid,
234 String physicalNetworkName,
235 List <Integer> vlans,
236 List <Subnet> subnets,
238 MsoRequest msoRequest,
239 String notificationUrl) {
242 String serviceName = "UpdateNetworkA";
243 MsoLogger.setServiceName (serviceName);
244 MsoLogger.setLogContext (msoRequest);
245 LOGGER.debug ("Async Update Network: " + networkId
253 // Use the synchronous method to perform the actual Create
256 // Synchronous Web Service Outputs
257 Holder <NetworkRollback> networkRollback = new Holder <> ();
258 Holder <Map <String, String>> subnetIdMap = new Holder <> ();
261 networkAdapter.updateNetwork (cloudSiteId,
264 modelCustomizationUuid,
273 MsoLogger.setServiceName (serviceName);
274 } catch (NetworkException e) {
275 MsoLogger.setServiceName (serviceName);
276 LOGGER.debug ("Got a NetworkException on updateNetwork: ", e);
277 MsoExceptionCategory exCat = null;
280 eMsg = e.getFaultInfo ().getMessage ();
281 exCat = MsoExceptionCategory.fromValue (e.getFaultInfo ().getCategory ().name ());
282 } catch (Exception e1) {
283 LOGGER.error (MessageEnum.RA_FAULT_INFO_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception - fault info", e1);
285 // Build and send Asynchronous error response
287 NetworkAdapterNotify notifyPort = getNotifyEP (notificationUrl);
288 notifyPort.updateNetworkNotification (messageId, false, exCat, eMsg, null, copyNrb (networkRollback));
289 } catch (Exception e1) {
290 error = "Error sending updateNetwork notification " + e1.getMessage ();
291 LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception sending updateNetwork notification", e1);
292 alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error);
296 LOGGER.debug ("Async Update Network:Name " + networkName + " NetworkId:" + networkId);
297 // Build and send Asynchronous response
299 NetworkAdapterNotify notifyPort = getNotifyEP (notificationUrl);
300 notifyPort.updateNetworkNotification (messageId,
304 copyUpdateSubnetIdMap (subnetIdMap),
305 copyNrb (networkRollback));
306 } catch (Exception e) {
307 error = "Error sending updateNotification request" + e.getMessage ();
308 LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception sending updateNotification request", e);
309 alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error);
315 * This is the queryNetwork method. It returns the existence and status of
316 * the specified network, along with its Neutron UUID and list of VLANs.
317 * This method attempts to find the network using both Heat and Neutron.
318 * Heat stacks are first searched based on the provided network name/id.
319 * If none is found, the Neutron is directly queried.
322 public void queryNetworkA (String cloudSiteId,
324 String networkNameOrId,
326 MsoRequest msoRequest,
327 String notificationUrl) {
330 MsoLogger.setLogContext (msoRequest);
331 String serviceName = "QueryNetworkA";
332 MsoLogger.setServiceName (serviceName);
333 LOGGER.debug ("Async Query Network " + networkNameOrId + " in " + cloudSiteId + "/" + tenantId);
335 // Use the synchronous method to perform the actual Create
338 // Synchronous Web Service Outputs
339 Holder <Boolean> networkExists = new Holder <> ();
340 Holder <String> networkId = new Holder <> ();
341 Holder <String> neutronNetworkId = new Holder <> ();
342 Holder <NetworkStatus> status = new Holder <> ();
343 Holder <List <Integer>> vlans = new Holder <> ();
344 Holder <Map <String, String>> subnetIdMap = new Holder <> ();
347 networkAdapter.queryNetwork (cloudSiteId,
357 MsoLogger.setServiceName (serviceName);
358 } catch (NetworkException e) {
359 MsoLogger.setServiceName (serviceName);
360 LOGGER.debug ("Got a NetworkException on createNetwork: ", e);
361 MsoExceptionCategory exCat = null;
364 eMsg = e.getFaultInfo ().getMessage ();
365 exCat = MsoExceptionCategory.fromValue (e.getFaultInfo ().getCategory ().name ());
366 } catch (Exception e1) {
367 LOGGER.error (MessageEnum.RA_FAULT_INFO_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception - fault info", e1);
369 // Build and send Asynchronous error response
371 NetworkAdapterNotify notifyPort = getNotifyEP (notificationUrl);
372 notifyPort.queryNetworkNotification (messageId, false, exCat, eMsg, null, null, null, null, null, null);
373 } catch (Exception e1) {
374 error = "Error sending createNetwork notification " + e1.getMessage ();
375 LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception sending createNetwork notification", e1);
376 alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error);
380 LOGGER.debug ("Async Query Network:NameOrId " + networkNameOrId + " tenantId:" + tenantId);
381 // Build and send Asynchronous response
383 NetworkAdapterNotify notifyPort = getNotifyEP (notificationUrl);
384 org.onap.so.adapters.network.async.client.NetworkStatus networkS = org.onap.so.adapters.network.async.client.NetworkStatus.fromValue (status.value.name ());
385 notifyPort.queryNetworkNotification (messageId,
391 neutronNetworkId.value,
394 copyQuerySubnetIdMap (subnetIdMap));
395 } catch (Exception e) {
396 error = "Error sending createNetwork notification " + e.getMessage ();
397 LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception sending createNetwork notification", e);
398 alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error);
404 * This is the "Delete Network" web service implementation.
405 * It will delete a Network in the specified cloud and tenant.
407 * If the network is not found, it is treated as a success.
409 * This service supports two modes of Network creation/update/delete:
410 * - via Heat Templates
412 * The network orchestration mode for each network type is declared in its
413 * catalog definition.
415 * For Heat-based orchestration, the networkId should be the stack ID.
416 * For Neutron-based orchestration, the networkId should be the Neutron network UUID.
418 * The method returns nothing on success. Rollback is not possible for delete
419 * commands, so any failure on delete will require manual fallout in the client.
422 public void deleteNetworkA (String cloudSiteId,
425 String modelCustomizationUuid,
428 MsoRequest msoRequest,
429 String notificationUrl) {
431 MsoLogger.setLogContext (msoRequest);
432 String serviceName = "DeleteNetworkA";
433 MsoLogger.setServiceName (serviceName);
434 LOGGER.debug ("Async Delete Network " + networkId + " in " + cloudSiteId + "/" + tenantId);
436 // Use the synchronous method to perform the actual Create
439 // Synchronous Web Service Outputs
440 Holder <Boolean> networkDeleted = new Holder <> ();
443 networkAdapter.deleteNetwork (cloudSiteId, tenantId, networkType, modelCustomizationUuid, networkId, msoRequest, networkDeleted);
444 MsoLogger.setServiceName (serviceName);
445 } catch (NetworkException e) {
446 MsoLogger.setServiceName (serviceName);
447 LOGGER.debug ("Got a NetworkException on createNetwork: ", e);
448 MsoExceptionCategory exCat = null;
451 eMsg = e.getFaultInfo ().getMessage ();
452 exCat = MsoExceptionCategory.fromValue (e.getFaultInfo ().getCategory ().name ());
453 } catch (Exception e1) {
454 LOGGER.error (MessageEnum.RA_FAULT_INFO_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception - fault info", e1);
456 // Build and send Asynchronous error response
458 NetworkAdapterNotify notifyPort = getNotifyEP (notificationUrl);
459 notifyPort.deleteNetworkNotification (messageId, false, exCat, eMsg, null);
460 } catch (Exception e1) {
461 error = "Error sending createNetwork notification " + e1.getMessage ();
462 LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception sending createNetwork notification", e1);
463 alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error);
467 LOGGER.debug ("Async Delete NetworkId: " + networkId + " tenantId:" + tenantId);
468 // Build and send Asynchronous response
470 NetworkAdapterNotify notifyPort = getNotifyEP (notificationUrl);
471 notifyPort.deleteNetworkNotification (messageId, true, null, null, networkDeleted.value);
472 } catch (Exception e) {
473 error = "Error sending deleteNetwork notification " + e.getMessage ();
474 LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception sending deleteNetwork notification", e);
475 alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error);
481 * This web service endpoint will rollback a previous Create VNF operation.
482 * A rollback object is returned to the client in a successful creation
483 * response. The client can pass that object as-is back to the rollbackNetwork
484 * operation to undo the creation.
486 * The rollback includes removing the VNF and deleting the tenant if the
487 * tenant did not exist prior to the VNF creation.
490 public void rollbackNetworkA (NetworkRollback rollback, String messageId, String notificationUrl) {
492 String serviceName = "RollbackNetworkA";
493 MsoLogger.setServiceName (serviceName);
494 // rollback may be null (e.g. if network already existed when Create was called)
495 if (rollback == null) {
496 LOGGER.warn (MessageEnum.RA_ROLLBACK_NULL, "", "", MsoLogger.ErrorCode.SchemaError, "Rollback is null");
500 MsoLogger.setLogContext (rollback.getMsoRequest ());
501 LOGGER.info (MessageEnum.RA_ASYNC_ROLLBACK, rollback.getNetworkStackId (), "", "");
502 // Use the synchronous method to perform the actual Create
506 networkAdapter.rollbackNetwork (rollback);
507 MsoLogger.setServiceName (serviceName);
508 } catch (NetworkException e) {
509 MsoLogger.setServiceName (serviceName);
510 LOGGER.debug ("Got a NetworkException on rollbackNetwork: ", e);
511 // Build and send Asynchronous error response
512 MsoExceptionCategory exCat = null;
515 eMsg = e.getFaultInfo ().getMessage ();
516 exCat = MsoExceptionCategory.fromValue (e.getFaultInfo ().getCategory ().name ());
517 } catch (Exception e1) {
518 LOGGER.error (MessageEnum.RA_FAULT_INFO_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception in get fault info", e1);
520 // Build and send Asynchronous error response
522 NetworkAdapterNotify notifyPort = getNotifyEP (notificationUrl);
523 notifyPort.rollbackNetworkNotification (rollback.getMsoRequest ().getRequestId (), false, exCat, eMsg);
524 } catch (Exception e1) {
525 error = "Error sending createNetwork notification " + e1.getMessage ();
526 LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception in sending createNetwork notification ", e1);
527 alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error);
531 LOGGER.debug ("Async Rollback NetworkId: " + rollback.getNetworkStackId () + " tenantId:" + rollback.getTenantId ());
532 // Build and send Asynchronous response
534 NetworkAdapterNotify notifyPort = getNotifyEP (notificationUrl);
535 notifyPort.rollbackNetworkNotification (rollback.getMsoRequest ().getRequestId (), true, null, null);
536 } catch (Exception e) {
537 error = "Error sending rollbackNetwork notification " + e.getMessage ();
538 LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception in sending rollbackNetwork notification", e);
539 alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error);
544 private org.onap.so.adapters.network.async.client.NetworkRollback copyNrb (Holder <NetworkRollback> hNrb) {
545 org.onap.so.adapters.network.async.client.NetworkRollback cnrb = new org.onap.so.adapters.network.async.client.NetworkRollback ();
547 if (hNrb != null && hNrb.value != null) {
548 org.onap.so.adapters.network.async.client.MsoRequest cmr = new org.onap.so.adapters.network.async.client.MsoRequest ();
550 cnrb.setCloudId (hNrb.value.getCloudId ());
551 cmr.setRequestId (hNrb.value.getMsoRequest ().getRequestId ());
552 cmr.setServiceInstanceId (hNrb.value.getMsoRequest ().getServiceInstanceId ());
553 cnrb.setMsoRequest (cmr);
554 cnrb.setNetworkId (hNrb.value.getNetworkId ());
555 cnrb.setNetworkStackId (hNrb.value.getNetworkStackId ());
556 cnrb.setNeutronNetworkId (hNrb.value.getNeutronNetworkId ());
557 cnrb.setTenantId (hNrb.value.getTenantId ());
558 cnrb.setNetworkType (hNrb.value.getNetworkType ());
559 cnrb.setNetworkCreated (hNrb.value.getNetworkCreated ());
560 cnrb.setNetworkName (hNrb.value.getNetworkName ());
561 cnrb.setPhysicalNetwork (hNrb.value.getPhysicalNetwork ());
562 List <Integer> vlansc = cnrb.getVlans ();
563 List <Integer> vlansh = hNrb.value.getVlans ();
564 if (vlansh != null) {
565 vlansc.addAll (vlansh);
571 private NetworkAdapterNotify getNotifyEP (String notificationUrl) {
573 URL warWsdlLoc = null;
575 warWsdlLoc = Thread.currentThread ().getContextClassLoader ().getResource ("NetworkAdapterNotify.wsdl");
576 } catch (Exception e) {
577 LOGGER.error (MessageEnum.RA_WSDL_NOT_FOUND, "NetworkAdpaterNotify.wsdl", "", "", MsoLogger.ErrorCode.DataError, "Exception - WSDL not found", e);
579 if (warWsdlLoc == null) {
580 LOGGER.error (MessageEnum.RA_WSDL_NOT_FOUND, "NetworkAdpaterNotify.wsdl", "", "", MsoLogger.ErrorCode.DataError, "WSDL not found");
583 LOGGER.debug ("NetworkAdpaterNotify.wsdl location:" + warWsdlLoc.toURI ().toString ());
584 } catch (Exception e) {
585 LOGGER.error (MessageEnum.RA_WSDL_URL_CONVENTION_EXC, "NetworkAdpaterNotify.wsdl", "", "", MsoLogger.ErrorCode.SchemaError, "Exception - WSDL URL convention", e);
589 NetworkAdapterNotify_Service notifySvc = new NetworkAdapterNotify_Service (warWsdlLoc,
590 new QName ("http://org.onap.so/networkNotify",
591 "networkAdapterNotify"));
593 NetworkAdapterNotify notifyPort = notifySvc.getMsoNetworkAdapterAsyncImplPort ();
595 BindingProvider bp = (BindingProvider) notifyPort;
599 epUrl = new URL (notificationUrl);
600 } catch (MalformedURLException e1) {
601 LOGGER.error (MessageEnum.RA_INIT_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception - init notification", e1);
605 LOGGER.debug ("Notification Endpoint URL: " + epUrl.toExternalForm ());
606 bp.getRequestContext ().put (BindingProvider.ENDPOINT_ADDRESS_PROPERTY, epUrl.toExternalForm ());
609 LOGGER.debug ("Notification Endpoint URL is NULL: ");
614 Map <String, Object> reqCtx = bp.getRequestContext ();
615 Map <String, List <String>> headers = new HashMap <> ();
617 String userCredentials = this.getEncryptedProperty (BPEL_AUTH_PROP, "", ENCRYPTION_KEY);
619 String basicAuth = "Basic " + DatatypeConverter.printBase64Binary (userCredentials.getBytes ());
620 reqCtx.put (MessageContext.HTTP_REQUEST_HEADERS, headers);
621 headers.put ("Authorization", Collections.singletonList (basicAuth));
622 } catch (Exception e) {
623 String error1 = "Unable to set authorization in callback request" + e.getMessage ();
624 LOGGER.error (MessageEnum.RA_SET_CALLBACK_AUTH_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception - Unable to set authorization in callback request", e);
625 alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error1);
631 public String getEncryptedProperty(String key, String defaultValue, String encryptionKey) {
633 return CryptoUtils.decrypt(this.environment.getProperty(key), encryptionKey);
634 } catch (GeneralSecurityException e) {
635 LOGGER.debug("Exception while decrypting property: " + this.environment.getProperty(key), e);
641 private CreateNetworkNotification.SubnetIdMap copyCreateSubnetIdMap (Holder <Map <String, String>> hMap) {
643 CreateNetworkNotification.SubnetIdMap subnetIdMap = new CreateNetworkNotification.SubnetIdMap ();
645 if (hMap != null && hMap.value != null) {
646 Map <String, String> sMap = new HashMap <> ();
648 CreateNetworkNotification.SubnetIdMap.Entry entry = new CreateNetworkNotification.SubnetIdMap.Entry ();
650 for (String key : sMap.keySet ()) {
652 entry.setValue (sMap.get (key));
653 subnetIdMap.getEntry ().add (entry);
659 private UpdateNetworkNotification.SubnetIdMap copyUpdateSubnetIdMap (Holder <Map <String, String>> hMap) {
661 UpdateNetworkNotification.SubnetIdMap subnetIdMap = new UpdateNetworkNotification.SubnetIdMap ();
663 if (hMap != null && hMap.value != null) {
664 Map <String, String> sMap = new HashMap <> ();
666 UpdateNetworkNotification.SubnetIdMap.Entry entry = new UpdateNetworkNotification.SubnetIdMap.Entry ();
668 for (Map.Entry<String,String> mapEntry : sMap.entrySet ()) {
669 String key = mapEntry.getKey();
670 String value = mapEntry.getValue();
672 entry.setValue (value);
673 subnetIdMap.getEntry ().add (entry);
679 private QueryNetworkNotification.SubnetIdMap copyQuerySubnetIdMap (Holder <Map <String, String>> hMap) {
681 QueryNetworkNotification.SubnetIdMap subnetIdMap = new QueryNetworkNotification.SubnetIdMap ();
683 if (hMap != null && hMap.value != null) {
684 Map <String, String> sMap = new HashMap <> ();
686 QueryNetworkNotification.SubnetIdMap.Entry entry = new QueryNetworkNotification.SubnetIdMap.Entry ();
688 for (Map.Entry<String,String> mapEntry : sMap.entrySet ()) {
689 String key = mapEntry.getKey();
690 String value = mapEntry.getValue();
692 entry.setValue (value);
693 subnetIdMap.getEntry ().add (entry);