2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END=========================================================
22 package org.openecomp.mso.adapters.network;
25 import java.net.MalformedURLException;
27 import java.util.Collections;
28 import java.util.HashMap;
29 import java.util.List;
32 import javax.jws.WebService;
33 import javax.xml.bind.DatatypeConverter;
34 import javax.xml.namespace.QName;
35 import javax.xml.ws.BindingProvider;
36 import javax.xml.ws.Holder;
37 import javax.xml.ws.handler.MessageContext;
39 import org.openecomp.mso.adapters.network.async.client.CreateNetworkNotification;
40 import org.openecomp.mso.adapters.network.async.client.MsoExceptionCategory;
41 import org.openecomp.mso.adapters.network.async.client.NetworkAdapterNotify;
42 import org.openecomp.mso.adapters.network.async.client.NetworkAdapterNotify_Service;
43 import org.openecomp.mso.adapters.network.async.client.QueryNetworkNotification;
44 import org.openecomp.mso.adapters.network.async.client.UpdateNetworkNotification;
45 import org.openecomp.mso.adapters.network.exceptions.NetworkException;
46 import org.openecomp.mso.cloud.CloudConfigFactory;
47 import org.openecomp.mso.entity.MsoRequest;
48 import org.openecomp.mso.logger.MessageEnum;
49 import org.openecomp.mso.logger.MsoAlarmLogger;
50 import org.openecomp.mso.logger.MsoLogger;
51 import org.openecomp.mso.openstack.beans.NetworkRollback;
52 import org.openecomp.mso.openstack.beans.NetworkStatus;
53 import org.openecomp.mso.openstack.beans.Subnet;
54 import org.openecomp.mso.properties.MsoPropertiesFactory;
57 @WebService(serviceName = "NetworkAdapterAsync", endpointInterface = "org.openecomp.mso.adapters.network.MsoNetworkAdapterAsync", targetNamespace = "http://org.openecomp.mso/networkA")
58 public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
60 MsoPropertiesFactory msoPropertiesFactory=new MsoPropertiesFactory();
62 CloudConfigFactory cloudConfigFactory=new CloudConfigFactory();
64 public static final String MSO_PROP_NETWORK_ADAPTER="MSO_PROP_NETWORK_ADAPTER";
65 private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA);
66 private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger ();
67 private static final String BPEL_AUTH_PROP = "org.openecomp.mso.adapters.network.bpelauth";
68 private static final String ENCRYPTION_KEY = "aa3871669d893c7fb8abbcda31b88b4f";
70 * Health Check web method. Does nothing but return to show the adapter is deployed.
73 public void healthCheckA () {
74 LOGGER.debug ("Health check call in Network Adapter");
78 * This is the "Create Network" web service implementation.
79 * It will create a new Network of the requested type in the specified cloud
80 * and tenant. The tenant must exist at the time this service is called.
82 * If a network with the same name already exists, this can be considered a
83 * success or failure, depending on the value of the 'failIfExists' parameter.
85 * There will be a pre-defined set of network types defined in the MSO Catalog.
86 * All such networks will have a similar configuration, based on the allowable
87 * Openstack networking definitions. This includes basic networks, provider
88 * networks (with a single VLAN), and multi-provider networks (one or more VLANs)
90 * Initially, all provider networks must be "vlan" type, and multiple segments in
91 * a multi-provider network must be multiple VLANs on the same physical network.
93 * This service supports two modes of Network creation/update:
94 * - via Heat Templates
96 * The network orchestration mode for each network type is declared in its
97 * catalog definition. All Heat-based templates must support some subset of
98 * the same input parameters: network_name, physical_network, vlan(s).
100 * The method returns the network ID and a NetworkRollback object. This latter
101 * object can be passed as-is to the rollbackNetwork operation to undo everything
102 * that was created. This is useful if a network is successfully created but
103 * the orchestration fails on a subsequent operation.
106 public void createNetworkA (String cloudSiteId,
109 String modelCustomizationUuid,
111 String physicalNetworkName,
112 List <Integer> vlans,
113 Boolean failIfExists,
115 List <Subnet> subnets,
117 MsoRequest msoRequest,
118 String notificationUrl) {
121 MsoLogger.setLogContext (msoRequest);
122 MsoLogger.setServiceName ("CreateNetworkA");
123 LOGGER.debug ("Async Create Network: " + networkName
131 // Use the synchronous method to perform the actual Create
132 MsoNetworkAdapter networkAdapter = new MsoNetworkAdapterImpl (msoPropertiesFactory,cloudConfigFactory);
134 // Synchronous Web Service Outputs
135 Holder <String> networkId = new Holder <> ();
136 Holder <String> neutronNetworkId = new Holder <> ();
137 Holder <NetworkRollback> networkRollback = new Holder <> ();
138 Holder <Map <String, String>> subnetIdMap = new Holder <> ();
141 networkAdapter.createNetwork (cloudSiteId,
144 modelCustomizationUuid,
156 } catch (NetworkException e) {
157 LOGGER.debug ("Got a NetworkException on createNetwork: ", e);
158 MsoExceptionCategory exCat = null;
161 eMsg = e.getFaultInfo ().getMessage ();
162 exCat = MsoExceptionCategory.fromValue (e.getFaultInfo ().getCategory ().name ());
163 } catch (Exception e1) {
164 LOGGER.error (MessageEnum.RA_FAULT_INFO_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception - fault info", e1);
166 // Build and send Asynchronous error response
168 NetworkAdapterNotify notifyPort = getNotifyEP (notificationUrl);
169 notifyPort.createNetworkNotification (messageId, false, exCat, eMsg, null, null, null, null);
170 } catch (Exception e1) {
171 error = "Error sending createNetwork notification " + e1.getMessage ();
172 LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception sending createNetwork notification", e1);
173 alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error);
177 LOGGER.debug ("Async Create Network:Name " + networkName + " physicalNetworkName:" + physicalNetworkName);
178 // Build and send Asynchronous response
180 NetworkAdapterNotify notifyPort = getNotifyEP (notificationUrl);
181 notifyPort.createNetworkNotification (messageId,
186 neutronNetworkId.value,
187 copyCreateSubnetIdMap (subnetIdMap),
188 copyNrb (networkRollback));
189 } catch (Exception e) {
190 error = "Error sending createNetwork notification " + e.getMessage ();
191 LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception sending createNetwork notification", e);
192 alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error);
198 * This is the "Update Network" web service implementation.
199 * It will update an existing Network of the requested type in the specified cloud
200 * and tenant. The typical use will be to replace the VLANs with the supplied
201 * list (to add or remove a VLAN), but other properties may be updated as well.
203 * There will be a pre-defined set of network types defined in the MSO Catalog.
204 * All such networks will have a similar configuration, based on the allowable
205 * Openstack networking definitions. This includes basic networks, provider
206 * networks (with a single VLAN), and multi-provider networks (one or more VLANs).
208 * Initially, all provider networks must currently be "vlan" type, and multi-provider
209 * networks must be multiple VLANs on the same physical network.
211 * This service supports two modes of Network update:
212 * - via Heat Templates
214 * The network orchestration mode for each network type is declared in its
215 * catalog definition. All Heat-based templates must support some subset of
216 * the same input parameters: network_name, physical_network, vlan, segments.
218 * The method returns a NetworkRollback object. This object can be passed
219 * as-is to the rollbackNetwork operation to undo everything that was updated.
220 * This is useful if a network is successfully updated but orchestration
221 * fails on a subsequent operation.
224 public void updateNetworkA (String cloudSiteId,
227 String modelCustomizationUuid,
230 String physicalNetworkName,
231 List <Integer> vlans,
232 List <Subnet> subnets,
234 MsoRequest msoRequest,
235 String notificationUrl) {
238 String serviceName = "UpdateNetworkA";
239 MsoLogger.setServiceName (serviceName);
240 MsoLogger.setLogContext (msoRequest);
241 LOGGER.debug ("Async Update Network: " + networkId
249 // Use the synchronous method to perform the actual Create
250 MsoNetworkAdapter networkAdapter = new MsoNetworkAdapterImpl (msoPropertiesFactory,cloudConfigFactory);
252 // Synchronous Web Service Outputs
253 Holder <NetworkRollback> networkRollback = new Holder <> ();
254 Holder <Map <String, String>> subnetIdMap = new Holder <> ();
257 networkAdapter.updateNetwork (cloudSiteId,
260 modelCustomizationUuid,
269 MsoLogger.setServiceName (serviceName);
270 } catch (NetworkException e) {
271 MsoLogger.setServiceName (serviceName);
272 LOGGER.debug ("Got a NetworkException on updateNetwork: ", e);
273 MsoExceptionCategory exCat = null;
276 eMsg = e.getFaultInfo ().getMessage ();
277 exCat = MsoExceptionCategory.fromValue (e.getFaultInfo ().getCategory ().name ());
278 } catch (Exception e1) {
279 LOGGER.error (MessageEnum.RA_FAULT_INFO_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception - fault info", e1);
281 // Build and send Asynchronous error response
283 NetworkAdapterNotify notifyPort = getNotifyEP (notificationUrl);
284 notifyPort.updateNetworkNotification (messageId, false, exCat, eMsg, null, copyNrb (networkRollback));
285 } catch (Exception e1) {
286 error = "Error sending updateNetwork notification " + e1.getMessage ();
287 LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception sending updateNetwork notification", e1);
288 alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error);
292 LOGGER.debug ("Async Update Network:Name " + networkName + " NetworkId:" + networkId);
293 // Build and send Asynchronous response
295 NetworkAdapterNotify notifyPort = getNotifyEP (notificationUrl);
296 notifyPort.updateNetworkNotification (messageId,
300 copyUpdateSubnetIdMap (subnetIdMap),
301 copyNrb (networkRollback));
302 } catch (Exception e) {
303 error = "Error sending updateNotification request" + e.getMessage ();
304 LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception sending updateNotification request", e);
305 alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error);
311 * This is the queryNetwork method. It returns the existence and status of
312 * the specified network, along with its Neutron UUID and list of VLANs.
313 * This method attempts to find the network using both Heat and Neutron.
314 * Heat stacks are first searched based on the provided network name/id.
315 * If none is found, the Neutron is directly queried.
318 public void queryNetworkA (String cloudSiteId,
320 String networkNameOrId,
322 MsoRequest msoRequest,
323 String notificationUrl) {
326 MsoLogger.setLogContext (msoRequest);
327 String serviceName = "QueryNetworkA";
328 MsoLogger.setServiceName (serviceName);
329 LOGGER.debug ("Async Query Network " + networkNameOrId + " in " + cloudSiteId + "/" + tenantId);
331 // Use the synchronous method to perform the actual Create
332 MsoNetworkAdapter networkAdapter = new MsoNetworkAdapterImpl (msoPropertiesFactory,cloudConfigFactory);
334 // Synchronous Web Service Outputs
335 Holder <Boolean> networkExists = new Holder <> ();
336 Holder <String> networkId = new Holder <> ();
337 Holder <String> neutronNetworkId = new Holder <> ();
338 Holder <NetworkStatus> status = new Holder <> ();
339 Holder <List <Integer>> vlans = new Holder <> ();
340 Holder <Map <String, String>> subnetIdMap = new Holder <> ();
343 networkAdapter.queryNetwork (cloudSiteId,
353 MsoLogger.setServiceName (serviceName);
354 } catch (NetworkException e) {
355 MsoLogger.setServiceName (serviceName);
356 LOGGER.debug ("Got a NetworkException on createNetwork: ", e);
357 MsoExceptionCategory exCat = null;
360 eMsg = e.getFaultInfo ().getMessage ();
361 exCat = MsoExceptionCategory.fromValue (e.getFaultInfo ().getCategory ().name ());
362 } catch (Exception e1) {
363 LOGGER.error (MessageEnum.RA_FAULT_INFO_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception - fault info", e1);
365 // Build and send Asynchronous error response
367 NetworkAdapterNotify notifyPort = getNotifyEP (notificationUrl);
368 notifyPort.queryNetworkNotification (messageId, false, exCat, eMsg, null, null, null, null, null, null);
369 } catch (Exception e1) {
370 error = "Error sending createNetwork notification " + e1.getMessage ();
371 LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception sending createNetwork notification", e1);
372 alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error);
376 LOGGER.debug ("Async Query Network:NameOrId " + networkNameOrId + " tenantId:" + tenantId);
377 // Build and send Asynchronous response
379 NetworkAdapterNotify notifyPort = getNotifyEP (notificationUrl);
380 org.openecomp.mso.adapters.network.async.client.NetworkStatus networkS = org.openecomp.mso.adapters.network.async.client.NetworkStatus.fromValue (status.value.name ());
381 notifyPort.queryNetworkNotification (messageId,
387 neutronNetworkId.value,
390 copyQuerySubnetIdMap (subnetIdMap));
391 } catch (Exception e) {
392 error = "Error sending createNetwork notification " + e.getMessage ();
393 LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception sending createNetwork notification", e);
394 alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error);
400 * This is the "Delete Network" web service implementation.
401 * It will delete a Network in the specified cloud and tenant.
403 * If the network is not found, it is treated as a success.
405 * This service supports two modes of Network creation/update/delete:
406 * - via Heat Templates
408 * The network orchestration mode for each network type is declared in its
409 * catalog definition.
411 * For Heat-based orchestration, the networkId should be the stack ID.
412 * For Neutron-based orchestration, the networkId should be the Neutron network UUID.
414 * The method returns nothing on success. Rollback is not possible for delete
415 * commands, so any failure on delete will require manual fallout in the client.
418 public void deleteNetworkA (String cloudSiteId,
421 String modelCustomizationUuid,
424 MsoRequest msoRequest,
425 String notificationUrl) {
427 MsoLogger.setLogContext (msoRequest);
428 String serviceName = "DeleteNetworkA";
429 MsoLogger.setServiceName (serviceName);
430 LOGGER.debug ("Async Delete Network " + networkId + " in " + cloudSiteId + "/" + tenantId);
432 // Use the synchronous method to perform the actual Create
433 MsoNetworkAdapter networkAdapter = new MsoNetworkAdapterImpl (msoPropertiesFactory,cloudConfigFactory);
435 // Synchronous Web Service Outputs
436 Holder <Boolean> networkDeleted = new Holder <> ();
439 networkAdapter.deleteNetwork (cloudSiteId, tenantId, networkType, modelCustomizationUuid, networkId, msoRequest, networkDeleted);
440 MsoLogger.setServiceName (serviceName);
441 } catch (NetworkException e) {
442 MsoLogger.setServiceName (serviceName);
443 LOGGER.debug ("Got a NetworkException on createNetwork: ", e);
444 MsoExceptionCategory exCat = null;
447 eMsg = e.getFaultInfo ().getMessage ();
448 exCat = MsoExceptionCategory.fromValue (e.getFaultInfo ().getCategory ().name ());
449 } catch (Exception e1) {
450 LOGGER.error (MessageEnum.RA_FAULT_INFO_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception - fault info", e1);
452 // Build and send Asynchronous error response
454 NetworkAdapterNotify notifyPort = getNotifyEP (notificationUrl);
455 notifyPort.deleteNetworkNotification (messageId, false, exCat, eMsg, null);
456 } catch (Exception e1) {
457 error = "Error sending createNetwork notification " + e1.getMessage ();
458 LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception sending createNetwork notification", e1);
459 alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error);
463 LOGGER.debug ("Async Delete NetworkId: " + networkId + " tenantId:" + tenantId);
464 // Build and send Asynchronous response
466 NetworkAdapterNotify notifyPort = getNotifyEP (notificationUrl);
467 notifyPort.deleteNetworkNotification (messageId, true, null, null, networkDeleted.value);
468 } catch (Exception e) {
469 error = "Error sending deleteNetwork notification " + e.getMessage ();
470 LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception sending deleteNetwork notification", e);
471 alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error);
477 * This web service endpoint will rollback a previous Create VNF operation.
478 * A rollback object is returned to the client in a successful creation
479 * response. The client can pass that object as-is back to the rollbackNetwork
480 * operation to undo the creation.
482 * The rollback includes removing the VNF and deleting the tenant if the
483 * tenant did not exist prior to the VNF creation.
486 public void rollbackNetworkA (NetworkRollback rollback, String messageId, String notificationUrl) {
488 String serviceName = "RollbackNetworkA";
489 MsoLogger.setServiceName (serviceName);
490 // rollback may be null (e.g. if network already existed when Create was called)
491 if (rollback == null) {
492 LOGGER.warn (MessageEnum.RA_ROLLBACK_NULL, "", "", MsoLogger.ErrorCode.SchemaError, "Rollback is null");
496 MsoLogger.setLogContext (rollback.getMsoRequest ());
497 LOGGER.info (MessageEnum.RA_ASYNC_ROLLBACK, rollback.getNetworkStackId (), "", "");
498 // Use the synchronous method to perform the actual Create
499 MsoNetworkAdapter networkAdapter = new MsoNetworkAdapterImpl (msoPropertiesFactory,cloudConfigFactory);
502 networkAdapter.rollbackNetwork (rollback);
503 MsoLogger.setServiceName (serviceName);
504 } catch (NetworkException e) {
505 MsoLogger.setServiceName (serviceName);
506 LOGGER.debug ("Got a NetworkException on rollbackNetwork: ", e);
507 // Build and send Asynchronous error response
508 MsoExceptionCategory exCat = null;
511 eMsg = e.getFaultInfo ().getMessage ();
512 exCat = MsoExceptionCategory.fromValue (e.getFaultInfo ().getCategory ().name ());
513 } catch (Exception e1) {
514 LOGGER.error (MessageEnum.RA_FAULT_INFO_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception in get fault info", e1);
516 // Build and send Asynchronous error response
518 NetworkAdapterNotify notifyPort = getNotifyEP (notificationUrl);
519 notifyPort.rollbackNetworkNotification (rollback.getMsoRequest ().getRequestId (), false, exCat, eMsg);
520 } catch (Exception e1) {
521 error = "Error sending createNetwork notification " + e1.getMessage ();
522 LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception in sending createNetwork notification ", e1);
523 alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error);
527 LOGGER.debug ("Async Rollback NetworkId: " + rollback.getNetworkStackId () + " tenantId:" + rollback.getTenantId ());
528 // Build and send Asynchronous response
530 NetworkAdapterNotify notifyPort = getNotifyEP (notificationUrl);
531 notifyPort.rollbackNetworkNotification (rollback.getMsoRequest ().getRequestId (), true, null, null);
532 } catch (Exception e) {
533 error = "Error sending rollbackNetwork notification " + e.getMessage ();
534 LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception in sending rollbackNetwork notification", e);
535 alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error);
540 private org.openecomp.mso.adapters.network.async.client.NetworkRollback copyNrb (Holder <NetworkRollback> hNrb) {
541 org.openecomp.mso.adapters.network.async.client.NetworkRollback cnrb = new org.openecomp.mso.adapters.network.async.client.NetworkRollback ();
543 if (hNrb != null && hNrb.value != null) {
544 org.openecomp.mso.adapters.network.async.client.MsoRequest cmr = new org.openecomp.mso.adapters.network.async.client.MsoRequest ();
546 cnrb.setCloudId (hNrb.value.getCloudId ());
547 cmr.setRequestId (hNrb.value.getMsoRequest ().getRequestId ());
548 cmr.setServiceInstanceId (hNrb.value.getMsoRequest ().getServiceInstanceId ());
549 cnrb.setMsoRequest (cmr);
550 cnrb.setNetworkId (hNrb.value.getNetworkId ());
551 cnrb.setNetworkStackId (hNrb.value.getNetworkStackId ());
552 cnrb.setNeutronNetworkId (hNrb.value.getNeutronNetworkId ());
553 cnrb.setTenantId (hNrb.value.getTenantId ());
554 cnrb.setNetworkType (hNrb.value.getNetworkType ());
555 cnrb.setNetworkCreated (hNrb.value.getNetworkCreated ());
556 cnrb.setNetworkName (hNrb.value.getNetworkName ());
557 cnrb.setPhysicalNetwork (hNrb.value.getPhysicalNetwork ());
558 List <Integer> vlansc = cnrb.getVlans ();
559 List <Integer> vlansh = hNrb.value.getVlans ();
560 if (vlansh != null) {
561 vlansc.addAll (vlansh);
567 private NetworkAdapterNotify getNotifyEP (String notificationUrl) {
569 URL warWsdlLoc = null;
571 warWsdlLoc = Thread.currentThread ().getContextClassLoader ().getResource ("NetworkAdapterNotify.wsdl");
572 } catch (Exception e) {
573 LOGGER.error (MessageEnum.RA_WSDL_NOT_FOUND, "NetworkAdpaterNotify.wsdl", "", "", MsoLogger.ErrorCode.DataError, "Exception - WSDL not found", e);
575 if (warWsdlLoc == null) {
576 LOGGER.error (MessageEnum.RA_WSDL_NOT_FOUND, "NetworkAdpaterNotify.wsdl", "", "", MsoLogger.ErrorCode.DataError, "WSDL not found");
579 LOGGER.debug ("NetworkAdpaterNotify.wsdl location:" + warWsdlLoc.toURI ().toString ());
580 } catch (Exception e) {
581 LOGGER.error (MessageEnum.RA_WSDL_URL_CONVENTION_EXC, "NetworkAdpaterNotify.wsdl", "", "", MsoLogger.ErrorCode.SchemaError, "Exception - WSDL URL convention", e);
585 NetworkAdapterNotify_Service notifySvc = new NetworkAdapterNotify_Service (warWsdlLoc,
586 new QName ("http://org.openecomp.mso/networkNotify",
587 "networkAdapterNotify"));
589 NetworkAdapterNotify notifyPort = notifySvc.getMsoNetworkAdapterAsyncImplPort ();
591 BindingProvider bp = (BindingProvider) notifyPort;
595 epUrl = new URL (notificationUrl);
596 } catch (MalformedURLException e1) {
597 LOGGER.error (MessageEnum.RA_INIT_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception - init notification", e1);
601 LOGGER.debug ("Notification Endpoint URL: " + epUrl.toExternalForm ());
602 bp.getRequestContext ().put (BindingProvider.ENDPOINT_ADDRESS_PROPERTY, epUrl.toExternalForm ());
605 LOGGER.debug ("Notification Endpoint URL is NULL: ");
610 Map <String, Object> reqCtx = bp.getRequestContext ();
611 Map <String, List <String>> headers = new HashMap <> ();
613 String userCredentials = msoPropertiesFactory.getMsoJavaProperties (MSO_PROP_NETWORK_ADAPTER).getEncryptedProperty (BPEL_AUTH_PROP,
617 String basicAuth = "Basic " + DatatypeConverter.printBase64Binary (userCredentials.getBytes ());
618 reqCtx.put (MessageContext.HTTP_REQUEST_HEADERS, headers);
619 headers.put ("Authorization", Collections.singletonList (basicAuth));
620 } catch (Exception e) {
621 String error1 = "Unable to set authorization in callback request" + e.getMessage ();
622 LOGGER.error (MessageEnum.RA_SET_CALLBACK_AUTH_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception - Unable to set authorization in callback request", e);
623 alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error1);
629 private CreateNetworkNotification.SubnetIdMap copyCreateSubnetIdMap (Holder <Map <String, String>> hMap) {
631 CreateNetworkNotification.SubnetIdMap subnetIdMap = new CreateNetworkNotification.SubnetIdMap ();
633 if (hMap != null && hMap.value != null) {
634 Map <String, String> sMap = new HashMap <> ();
636 CreateNetworkNotification.SubnetIdMap.Entry entry = new CreateNetworkNotification.SubnetIdMap.Entry ();
638 for (String key : sMap.keySet ()) {
640 entry.setValue (sMap.get (key));
641 subnetIdMap.getEntry ().add (entry);
647 private UpdateNetworkNotification.SubnetIdMap copyUpdateSubnetIdMap (Holder <Map <String, String>> hMap) {
649 UpdateNetworkNotification.SubnetIdMap subnetIdMap = new UpdateNetworkNotification.SubnetIdMap ();
651 if (hMap != null && hMap.value != null) {
652 Map <String, String> sMap = new HashMap <> ();
654 UpdateNetworkNotification.SubnetIdMap.Entry entry = new UpdateNetworkNotification.SubnetIdMap.Entry ();
656 for (Map.Entry<String,String> mapEntry : sMap.entrySet ()) {
657 String key = mapEntry.getKey();
658 String value = mapEntry.getValue();
660 entry.setValue (value);
661 subnetIdMap.getEntry ().add (entry);
667 private QueryNetworkNotification.SubnetIdMap copyQuerySubnetIdMap (Holder <Map <String, String>> hMap) {
669 QueryNetworkNotification.SubnetIdMap subnetIdMap = new QueryNetworkNotification.SubnetIdMap ();
671 if (hMap != null && hMap.value != null) {
672 Map <String, String> sMap = new HashMap <> ();
674 QueryNetworkNotification.SubnetIdMap.Entry entry = new QueryNetworkNotification.SubnetIdMap.Entry ();
676 for (Map.Entry<String,String> mapEntry : sMap.entrySet ()) {
677 String key = mapEntry.getKey();
678 String value = mapEntry.getValue();
680 entry.setValue (value);
681 subnetIdMap.getEntry ().add (entry);