diff options
Diffstat (limited to 'adapters/mso-openstack-adapters/src/main/java')
14 files changed, 190 insertions, 136 deletions
diff --git a/adapters/mso-openstack-adapters/src/main/java/db/migration/R__CloudConfigMigration.java b/adapters/mso-openstack-adapters/src/main/java/db/migration/R__CloudConfigMigration.java index 3ec02bfb0e..257ad3c023 100644 --- a/adapters/mso-openstack-adapters/src/main/java/db/migration/R__CloudConfigMigration.java +++ b/adapters/mso-openstack-adapters/src/main/java/db/migration/R__CloudConfigMigration.java @@ -36,6 +36,7 @@ import org.onap.so.logger.MsoLogger; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; +import java.nio.file.Paths; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; @@ -53,6 +54,11 @@ public class R__CloudConfigMigration implements JdbcMigration , MigrationInfoPro private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, R__CloudConfigMigration.class); @JsonProperty("cloud_config") private CloudConfig cloudConfig; + + @Override + public boolean isUndo(){ + return false; + } @Override public void migrate(Connection connection) throws Exception { @@ -61,11 +67,13 @@ public class R__CloudConfigMigration implements JdbcMigration , MigrationInfoPro CloudConfig cloudConfig = null; // Try the override file - String configLocation = System.getProperty("spring.config.location"); + String configLocation = System.getProperty("spring.config.additional-location"); if (configLocation != null) { - try (InputStream stream = new FileInputStream(configLocation)) { + try (InputStream stream = new FileInputStream(Paths.get(configLocation).normalize().toString())) { cloudConfig = loadCloudConfig(stream); - } + }catch(Exception e){ + LOGGER.warnSimple("Error Loading override.yaml",e); + } } if (cloudConfig == null) { diff --git a/adapters/mso-openstack-adapters/src/main/java/db/migration/V4_2__DummyMigration.java b/adapters/mso-openstack-adapters/src/main/java/db/migration/V4_2__DummyMigration.java deleted file mode 100644 index 6c6366904f..0000000000 --- a/adapters/mso-openstack-adapters/src/main/java/db/migration/V4_2__DummyMigration.java +++ /dev/null @@ -1,32 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package db.migration; - -import org.flywaydb.core.api.migration.jdbc.JdbcMigration; - -import java.sql.Connection; - -public class V4_2__DummyMigration implements JdbcMigration { - @Override - public void migrate(Connection connection) throws Exception { - //does nothing - } -} diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/BpelRestClient.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/BpelRestClient.java index cf11ab94c1..6c646f3e63 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/BpelRestClient.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/BpelRestClient.java @@ -69,7 +69,7 @@ public class BpelRestClient { private static final String RETRY_COUNT_PROPERTY = PROPERTY_DOMAIN+".retrycount"; private static final String RETRY_INTERVAL_PROPERTY = PROPERTY_DOMAIN+".retryinterval"; private static final String RETRY_LIST_PROPERTY = PROPERTY_DOMAIN+".retrylist"; - private static final String ENCRYPTION_KEY = "aa3871669d893c7fb8abbcda31b88b4f"; + private static final String ENCRYPTION_KEY_PROP = PROPERTY_DOMAIN + ".encryptionKey"; private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, BpelRestClient.class); @Autowired @@ -123,7 +123,7 @@ public class BpelRestClient { retryCount = env.getProperty(RETRY_COUNT_PROPERTY, Integer.class, DEFAULT_RETRY_COUNT); retryInterval = env.getProperty(RETRY_INTERVAL_PROPERTY, Integer.class, DEFAULT_RETRY_INTERVAL); setRetryList(env.getProperty(RETRY_LIST_PROPERTY, DEFAULT_RETRY_LIST)); - credentials = getEncryptedProperty(BPEL_AUTH_PROPERTY, DEFAULT_CREDENTIALS, ENCRYPTION_KEY); + credentials = getEncryptedProperty(BPEL_AUTH_PROPERTY, DEFAULT_CREDENTIALS, env.getProperty(ENCRYPTION_KEY_PROP)); } public int getSocketTimeout() { diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapter.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapter.java index 27829a6156..6e2fcb02c9 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapter.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapter.java @@ -55,9 +55,12 @@ public interface MsoNetworkAdapter @WebParam(name="networkName") @XmlElement(required=true) String networkName, @WebParam(name="physicalNetworkName") String physicalNetworkName, @WebParam(name="vlans") List<Integer> vlans, + @WebParam(name="shared") String shared, + @WebParam(name="external") String external, @WebParam(name="failIfExists") Boolean failIfExists, @WebParam(name="backout") Boolean backout, @WebParam(name="subnets") List<Subnet> subnets, + @WebParam(name="networkParams") Map<String, String> networkParams, @WebParam(name="request") MsoRequest msoRequest, @WebParam(name="networkId", mode=Mode.OUT) Holder<String> networkId, @WebParam(name="neutronNetworkId", mode=Mode.OUT) Holder<String> neutronNetworkId, @@ -77,6 +80,7 @@ public interface MsoNetworkAdapter @WebParam(name="failIfExists") Boolean failIfExists, @WebParam(name="backout") Boolean backout, @WebParam(name="subnets") List<Subnet> subnets, + @WebParam(name="networkParams") Map<String, String> networkParams, @WebParam(name="policyFqdns") List<String> policyFqdns, @WebParam(name="routeTableFqdns") List<String> routeTableFqdns, @WebParam(name="request") MsoRequest msoRequest, @@ -100,7 +104,10 @@ public interface MsoNetworkAdapter @WebParam(name="networkName") @XmlElement(required=true) String networkName, @WebParam(name="physicalNetworkName") @XmlElement(required=true) String physicalNetworkName, @WebParam(name="vlans") @XmlElement(required=true) List<Integer> vlans, + @WebParam(name="shared") String shared, + @WebParam(name="external") String external, @WebParam(name="subnets") List<Subnet> subnets, + @WebParam(name="networkParams") Map<String,String> networkParams, @WebParam(name="request") MsoRequest msoRequest, @WebParam(name="subnetIdMap", mode=Mode.OUT) Holder<Map<String, String>> subnetIdMap, @WebParam(name="rollback", mode=Mode.OUT) Holder<NetworkRollback> rollback ) @@ -117,6 +124,7 @@ public interface MsoNetworkAdapter @WebParam(name="shared") String shared, @WebParam(name="external") String external, @WebParam(name="subnets") List<Subnet> subnets, + @WebParam(name="networkParams") Map<String,String> networkParams, @WebParam(name="policyFqdns") List<String> policyFqdns, @WebParam(name="routeTableFqdns") List<String> routeTableFqdns, @WebParam(name="request") MsoRequest msoRequest, diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsync.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsync.java index 99f590b773..a85da58536 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsync.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsync.java @@ -22,6 +22,7 @@ package org.onap.so.adapters.network; import java.util.List; +import java.util.Map; import javax.jws.Oneway; import javax.jws.WebMethod; @@ -56,6 +57,7 @@ public interface MsoNetworkAdapterAsync @WebParam(name="failIfExists") Boolean failIfExists, @WebParam(name="backout") Boolean backout, @WebParam(name="subnets") List<Subnet> subnets, + @WebParam(name="networkParams") Map<String, String> networkParams, @WebParam(name="messageId") @XmlElement(required=true) String messageId, @WebParam(name="request") MsoRequest msoRequest, @WebParam(name="notificationUrl") @XmlElement(required=true) String notificationUrl ); @@ -71,6 +73,7 @@ public interface MsoNetworkAdapterAsync @WebParam(name="physicalNetworkName") @XmlElement(required=true) String physicalNetworkName, @WebParam(name="vlans") @XmlElement(required=true) List<Integer> vlans, @WebParam(name="subnets") List<Subnet> subnets, + @WebParam(name="networkParams") Map<String, String> networkParams, @WebParam(name="messageId") @XmlElement(required=true) String messageId, @WebParam(name="request") MsoRequest msoRequest, @WebParam(name="notificationUrl") @XmlElement(required=true) String notificationUrl ); diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java index b47905d134..8181714c0a 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java @@ -48,7 +48,7 @@ import org.onap.so.adapters.network.async.client.UpdateNetworkNotification; import org.onap.so.adapters.network.exceptions.NetworkException; import org.onap.so.entity.MsoRequest; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoAlarmLogger; + import org.onap.so.logger.MsoLogger; import org.onap.so.openstack.beans.NetworkRollback; import org.onap.so.openstack.beans.NetworkStatus; @@ -63,16 +63,16 @@ import org.springframework.stereotype.Component; public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA,MsoNetworkAdapterAsyncImpl.class); - private static final MsoAlarmLogger alarmLogger = new MsoAlarmLogger (); + private static final String BPEL_AUTH_PROP = "org.onap.so.adapters.network.bpelauth"; - private static final String ENCRYPTION_KEY = "aa3871669d893c7fb8abbcda31b88b4f"; + private static final String ENCRYPTION_KEY_PROP = "org.onap.so.adapters.network.encryptionKey"; private static final String NETWORK_EXCEPTION_MSG="Got a NetworkException on createNetwork: "; private static final String CREATE_NETWORK_ERROR_MSG="Error sending createNetwork notification "; private static final String CREATE_NETWORK_EXCEPTON_MSG="Exception sending createNetwork notification"; private static final String MSO_INTERNAL_ERROR_MSG="MsoInternalError"; @Autowired private Environment environment; - + @Autowired private MsoNetworkAdapter networkAdapter; /** @@ -122,6 +122,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { Boolean failIfExists, Boolean backout, List <Subnet> subnets, + Map<String,String> networkParams, String messageId, MsoRequest msoRequest, String notificationUrl) { @@ -145,6 +146,16 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { Holder <String> neutronNetworkId = new Holder <> (); Holder <NetworkRollback> networkRollback = new Holder <> (); Holder <Map <String, String>> subnetIdMap = new Holder <> (); + + HashMap<String, String> params = (HashMap<String,String>) networkParams; + if (params == null) + params = new HashMap<String,String>(); + String shared = null; + String external = null; + if (params.containsKey("shared")) + shared = params.get("shared"); + if (params.containsKey("external")) + external = params.get("external"); try { networkAdapter.createNetwork (cloudSiteId, @@ -154,9 +165,12 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { networkName, physicalNetworkName, vlans, + shared, + external, failIfExists, backout, subnets, + params, msoRequest, networkId, neutronNetworkId, @@ -179,7 +193,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { } catch (Exception e1) { error = CREATE_NETWORK_ERROR_MSG + e1.getMessage (); LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError,CREATE_NETWORK_EXCEPTON_MSG, e1); - alarmLogger.sendAlarm (MSO_INTERNAL_ERROR_MSG, MsoAlarmLogger.CRITICAL, error); + } return; } @@ -198,7 +212,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { } catch (Exception e) { error = CREATE_NETWORK_ERROR_MSG + e.getMessage (); LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, CREATE_NETWORK_EXCEPTON_MSG, e); - alarmLogger.sendAlarm (MSO_INTERNAL_ERROR_MSG, MsoAlarmLogger.CRITICAL, error); + } return; } @@ -239,6 +253,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { String physicalNetworkName, List <Integer> vlans, List <Subnet> subnets, + Map <String,String> networkParams, String messageId, MsoRequest msoRequest, String notificationUrl) { @@ -261,6 +276,16 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { // Synchronous Web Service Outputs Holder <NetworkRollback> networkRollback = new Holder <> (); Holder <Map <String, String>> subnetIdMap = new Holder <> (); + + HashMap<String, String> params = (HashMap<String,String>) networkParams; + if (params == null) + params = new HashMap<String,String>(); + String shared = null; + String external = null; + if (params.containsKey("shared")) + shared = params.get("shared"); + if (params.containsKey("external")) + external = params.get("external"); try { networkAdapter.updateNetwork (cloudSiteId, @@ -271,7 +296,10 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { networkName, physicalNetworkName, vlans, + shared, + external, subnets, + params, msoRequest, subnetIdMap, networkRollback); @@ -294,7 +322,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { } catch (Exception e1) { error = "Error sending updateNetwork notification " + e1.getMessage (); LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception sending updateNetwork notification", e1); - alarmLogger.sendAlarm (MSO_INTERNAL_ERROR_MSG, MsoAlarmLogger.CRITICAL, error); + } return; } @@ -311,7 +339,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { } catch (Exception e) { error = "Error sending updateNotification request" + e.getMessage (); LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception sending updateNotification request", e); - alarmLogger.sendAlarm (MSO_INTERNAL_ERROR_MSG, MsoAlarmLogger.CRITICAL, error); + } return; } @@ -376,9 +404,9 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { NetworkAdapterNotify notifyPort = getNotifyEP (notificationUrl); notifyPort.queryNetworkNotification (messageId, false, exCat, eMsg, null, null, null, null, null, null); } catch (Exception e1) { - error = CREATE_NETWORK_ERROR_MSG + e1.getMessage (); - LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, CREATE_NETWORK_EXCEPTON_MSG, e1); - alarmLogger.sendAlarm (MSO_INTERNAL_ERROR_MSG, MsoAlarmLogger.CRITICAL, error); + error = "Error sending createNetwork notification " + e1.getMessage (); + LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception sending createNetwork notification", e1); + } return; } @@ -398,9 +426,9 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { vlans.value, copyQuerySubnetIdMap (subnetIdMap)); } catch (Exception e) { - error = CREATE_NETWORK_ERROR_MSG + e.getMessage (); - LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, CREATE_NETWORK_EXCEPTON_MSG, e); - alarmLogger.sendAlarm (MSO_INTERNAL_ERROR_MSG, MsoAlarmLogger.CRITICAL, error); + error = "Error sending createNetwork notification " + e.getMessage (); + LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception sending createNetwork notification", e); + } return; } @@ -463,9 +491,9 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { NetworkAdapterNotify notifyPort = getNotifyEP (notificationUrl); notifyPort.deleteNetworkNotification (messageId, false, exCat, eMsg, null); } catch (Exception e1) { - error = CREATE_NETWORK_ERROR_MSG + e1.getMessage (); - LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, CREATE_NETWORK_EXCEPTON_MSG, e1); - alarmLogger.sendAlarm (MSO_INTERNAL_ERROR_MSG, MsoAlarmLogger.CRITICAL, error); + error = "Error sending createNetwork notification " + e1.getMessage (); + LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception sending createNetwork notification", e1); + } return; } @@ -477,7 +505,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { } catch (Exception e) { error = "Error sending deleteNetwork notification " + e.getMessage (); LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception sending deleteNetwork notification", e); - alarmLogger.sendAlarm (MSO_INTERNAL_ERROR_MSG, MsoAlarmLogger.CRITICAL, error); + } return; } @@ -529,7 +557,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { } catch (Exception e1) { error = CREATE_NETWORK_ERROR_MSG + e1.getMessage (); LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception in sending createNetwork notification ", e1); - alarmLogger.sendAlarm (MSO_INTERNAL_ERROR_MSG, MsoAlarmLogger.CRITICAL, error); + } return; } @@ -541,7 +569,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { } catch (Exception e) { error = "Error sending rollbackNetwork notification " + e.getMessage (); LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception in sending rollbackNetwork notification", e); - alarmLogger.sendAlarm (MSO_INTERNAL_ERROR_MSG, MsoAlarmLogger.CRITICAL, error); + } return; } @@ -619,7 +647,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { Map <String, Object> reqCtx = bp.getRequestContext (); Map <String, List <String>> headers = new HashMap <> (); - String userCredentials = this.getEncryptedProperty (BPEL_AUTH_PROP, "", ENCRYPTION_KEY); + String userCredentials = this.getEncryptedProperty (BPEL_AUTH_PROP, "", ENCRYPTION_KEY_PROP); String basicAuth = "Basic " + DatatypeConverter.printBase64Binary (userCredentials.getBytes ()); reqCtx.put (MessageContext.HTTP_REQUEST_HEADERS, headers); @@ -627,7 +655,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { } catch (Exception e) { String error1 = "Unable to set authorization in callback request" + e.getMessage (); LOGGER.error (MessageEnum.RA_SET_CALLBACK_AUTH_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception - Unable to set authorization in callback request", e); - alarmLogger.sendAlarm (MSO_INTERNAL_ERROR_MSG, MsoAlarmLogger.CRITICAL, error1); + } return notifyPort; @@ -635,7 +663,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { public String getEncryptedProperty(String key, String defaultValue, String encryptionKey) { try { - return CryptoUtils.decrypt(this.environment.getProperty(key), encryptionKey); + return CryptoUtils.decrypt(this.environment.getProperty(key), this.environment.getProperty(encryptionKey)); } catch (GeneralSecurityException e) { LOGGER.debug("Exception while decrypting property: " + this.environment.getProperty(key), e); } diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java index 4b6bd09144..d250561f16 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java @@ -49,7 +49,7 @@ import org.onap.so.db.catalog.data.repository.NetworkResourceRepository; import org.onap.so.db.catalog.utils.MavenLikeVersioning; import org.onap.so.entity.MsoRequest; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoAlarmLogger; + import org.onap.so.logger.MsoLogger; import org.onap.so.openstack.beans.HeatStatus; import org.onap.so.openstack.beans.NetworkInfo; @@ -92,7 +92,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { private static final String NEUTRON_MODE = "NEUTRON"; private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA,MsoNetworkAdapterImpl.class); - private static final MsoAlarmLogger alarmLogger = new MsoAlarmLogger (); + @Autowired private CloudConfig cloudConfig; @Autowired @@ -138,9 +138,12 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { String networkName, String physicalNetworkName, List <Integer> vlans, + String shared, + String external, Boolean failIfExists, Boolean backout, List <Subnet> subnets, + Map<String, String> networkParams, MsoRequest msoRequest, Holder <String> networkId, Holder <String> neutronNetworkId, @@ -155,8 +158,8 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { physicalNetworkName, vlans, null, - null, - null, + shared, + external, failIfExists, backout, subnets, @@ -182,6 +185,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { Boolean failIfExists, Boolean backout, List <Subnet> subnets, + Map<String, String> networkParams, List <String> policyFqdns, List<String> routeTableFqdns, MsoRequest msoRequest, @@ -404,10 +408,6 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { if (heatTemplate == null) { String error = "Network error - undefined Heat Template. Network Type = " + networkType; LOGGER.error (MessageEnum.RA_PARAM_NOT_FOUND, "Heat Template", "Network Type", networkType, "Openstack", "", MsoLogger.ErrorCode.DataError, "Network error - undefined Heat Template. Network Type = " + networkType); - alarmLogger.sendAlarm (MSO_CONFIGURATION_ERROR, MsoAlarmLogger.CRITICAL, error); // Alarm on this - // error, - // configuration - // must be fixed LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error); throw new NetworkException (error, MsoExceptionCategory.INTERNAL); } @@ -514,10 +514,6 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { } catch (IllegalArgumentException e) { String error = "Create Network: Configuration Error: " + e.getMessage (); LOGGER.error (MessageEnum.RA_CONFIG_EXC, e.getMessage(), "Openstack", "", MsoLogger.ErrorCode.DataError, "Exception - Create Network, Configuration Error", e); - alarmLogger.sendAlarm (MSO_CONFIGURATION_ERROR, MsoAlarmLogger.CRITICAL, error); // Alarm on this - // error, - // configuration - // must be fixed LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataError, error); // Input parameters were not valid throw new NetworkException (error, MsoExceptionCategory.INTERNAL); @@ -668,7 +664,10 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { String networkName, String physicalNetworkName, List <Integer> vlans, + String shared, + String external, List <Subnet> subnets, + Map<String,String> networkParams, MsoRequest msoRequest, Holder <Map <String, String>> subnetIdMap, Holder <NetworkRollback> rollback) throws NetworkException { @@ -681,8 +680,8 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { physicalNetworkName, vlans, null, - null, - null, + shared, + external, subnets, null, null, @@ -703,6 +702,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { String shared, String external, List <Subnet> subnets, + Map<String, String> networkParams, List <String> policyFqdns, List<String> routeTableFqdns, MsoRequest msoRequest, @@ -953,7 +953,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { if (heatTemplate == null) { String error = "Network error - undefined Heat Template. Network Type=" + networkType; LOGGER.error(MessageEnum.RA_PARAM_NOT_FOUND, "Heat Template", "Network Type", networkType, "OpenStack", "getHeatTemplate", MsoLogger.ErrorCode.DataError, "Network error - undefined Heat Template. Network Type=" + networkType); - alarmLogger.sendAlarm(MSO_CONFIGURATION_ERROR, MsoAlarmLogger.CRITICAL, error); + LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.BadRequest, error); throw new NetworkException(error, MsoExceptionCategory.INTERNAL); } @@ -989,7 +989,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { } catch (IllegalArgumentException e) { String error = "UpdateNetwork: Configuration Error: Network Type=" + networkType; LOGGER.error(MessageEnum.RA_CONFIG_EXC, "Network Type=" + networkType, "OpenStack", "", MsoLogger.ErrorCode.DataError, "Exception - UpdateNetwork: Configuration Error"); - alarmLogger.sendAlarm(MSO_CONFIGURATION_ERROR, MsoAlarmLogger.CRITICAL, error); + LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, error); throw new NetworkException(error, MsoExceptionCategory.INTERNAL, e); } @@ -1177,10 +1177,6 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { LOGGER.error(MessageEnum.RA_NETWORK_ORCHE_MODE_NOT_SUPPORT, mode, "OpenStack", "", MsoLogger.ErrorCode.DataError, "CreateNetwork: Configuration Error"); - // Alarm on this error, configuration must be fixed - alarmLogger.sendAlarm(MSO_CONFIGURATION_ERROR, - MsoAlarmLogger.CRITICAL, error); - throw new NetworkException(error, MsoExceptionCategory.INTERNAL); } diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java index effe7a8c61..8d08b3b52c 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java @@ -168,6 +168,13 @@ public class NetworkAdapterRest { Holder<String> networkFqdn = new Holder<>(); Holder<Map<String, String>> subnetIdMap = new Holder<>(); Holder<NetworkRollback> rollback = new Holder<>(); + + HashMap<String, String> params = (HashMap<String, String>) req.getNetworkParams(); + if (params == null) { + params = new HashMap<String,String>(); + } + String shared = null; + String external = null; String cloudsite = req.getCloudSiteId(); if (cloudsite != null && cloudsite.equals(TESTING_KEYWORD)) { @@ -186,6 +193,20 @@ public class NetworkAdapterRest { ctn = new ContrailNetwork(); req.setContrailNetwork(ctn); } + if (params.containsKey("shared")) { + shared = params.get("shared"); + } else { + if (ctn.getShared() != null) { + shared = ctn.getShared(); + } + } + if (params.containsKey("external")) { + external = params.get("external"); + } else { + if (ctn.getExternal() != null) { + external = ctn.getExternal(); + } + } adapter.createNetworkContrail( req.getCloudSiteId(), req.getTenantId(), @@ -193,11 +214,12 @@ public class NetworkAdapterRest { req.getModelCustomizationUuid(), req.getNetworkName(), req.getContrailNetwork().getRouteTargets(), - req.getContrailNetwork().getShared(), - req.getContrailNetwork().getExternal(), + shared, + external, req.getFailIfExists(), req.getBackout(), req.getSubnets(), + params, req.getContrailNetwork().getPolicyFqdns(), req.getContrailNetwork().getRouteTableFqdns(), req.getMsoRequest(), @@ -212,6 +234,10 @@ public class NetworkAdapterRest { pvn = new ProviderVlanNetwork(); req.setProviderVlanNetwork(pvn); } + if (params.containsKey("shared")) + shared = params.get("shared"); + if (params.containsKey("external")) + external = params.get("external"); adapter.createNetwork( req.getCloudSiteId(), req.getTenantId(), @@ -220,9 +246,12 @@ public class NetworkAdapterRest { req.getNetworkName(), req.getProviderVlanNetwork().getPhysicalNetworkName(), req.getProviderVlanNetwork().getVlans(), + shared, + external, req.getFailIfExists(), req.getBackout(), req.getSubnets(), + params, req.getMsoRequest(), networkId, neutronNetworkId, @@ -593,6 +622,12 @@ public class NetworkAdapterRest { try { Holder<Map<String, String>> subnetIdMap = new Holder<>(); Holder<NetworkRollback> rollback = new Holder<> (); + HashMap<String, String> params = (HashMap<String, String>) req.getNetworkParams(); + if (params == null) { + params = new HashMap<String,String>(); + } + String shared = null; + String external = null; if (req.getCloudSiteId().equals(TESTING_KEYWORD)) { subnetIdMap.value = testMap(); @@ -607,6 +642,20 @@ public class NetworkAdapterRest { ctn = new ContrailNetwork(); req.setContrailNetwork(ctn); } + if (params.containsKey("shared")) { + shared = params.get("shared"); + } else { + if (ctn.getShared() != null) { + shared = ctn.getShared(); + } + } + if (params.containsKey("external")) { + external = params.get("external"); + } else { + if (ctn.getExternal() != null) { + external = ctn.getExternal(); + } + } adapter.updateNetworkContrail( req.getCloudSiteId(), req.getTenantId(), @@ -615,9 +664,10 @@ public class NetworkAdapterRest { req.getNetworkStackId(), req.getNetworkName(), req.getContrailNetwork().getRouteTargets(), - req.getContrailNetwork().getShared(), - req.getContrailNetwork().getExternal(), + shared, + external, req.getSubnets(), + params, req.getContrailNetwork().getPolicyFqdns(), req.getContrailNetwork().getRouteTableFqdns(), req.getMsoRequest(), @@ -629,6 +679,12 @@ public class NetworkAdapterRest { pvn = new ProviderVlanNetwork(); req.setProviderVlanNetwork(pvn); } + if (params.containsKey("shared")) { + shared = params.get("shared"); + } + if (params.containsKey("external")) { + external = params.get("external"); + } adapter.updateNetwork( req.getCloudSiteId(), req.getTenantId(), @@ -638,7 +694,10 @@ public class NetworkAdapterRest { req.getNetworkName(), req.getProviderVlanNetwork().getPhysicalNetworkName(), req.getProviderVlanNetwork().getVlans(), + shared, + external, req.getSubnets(), + params, req.getMsoRequest(), subnetIdMap, rollback); diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetUpdateResponse.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetUpdateResponse.java index 36f11d30c0..b6cb27caa3 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetUpdateResponse.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetUpdateResponse.java @@ -21,7 +21,7 @@ package org.onap.so.adapters.valet.beans; import java.io.Serializable; -import java.util.Map; +import java.util.HashMap; import java.util.Objects; import com.fasterxml.jackson.annotation.JsonProperty; @@ -34,7 +34,7 @@ public class ValetUpdateResponse implements Serializable { @JsonProperty("status") private ValetStatus status; @JsonProperty("parameters") - private Map<String, Object> parameters; + private HashMap<String, Object> parameters; public ValetUpdateResponse() { super(); @@ -46,10 +46,10 @@ public class ValetUpdateResponse implements Serializable { public void setStatus(ValetStatus status) { this.status = status; } - public Map<String, Object> getParameters() { + public HashMap<String, Object> getParameters() { return this.parameters; } - public void setParameters(Map<String, Object> parameters) { + public void setParameters(HashMap<String, Object> parameters) { this.parameters = parameters; } diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/BpelRestClient.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/BpelRestClient.java index 6383f57693..5fa21c64b1 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/BpelRestClient.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/BpelRestClient.java @@ -68,7 +68,7 @@ public class BpelRestClient { private static final String RETRY_COUNT_PROPERTY = PROPERTY_DOMAIN+".retrycount"; private static final String RETRY_INTERVAL_PROPERTY = PROPERTY_DOMAIN+".retryinterval"; private static final String RETRY_LIST_PROPERTY = PROPERTY_DOMAIN+".retrylist"; - private static final String ENCRYPTION_KEY = "aa3871669d893c7fb8abbcda31b88b4f"; + private static final String ENCRYPTION_KEY_PROP = "org.onap.so.adapters.network.encryptionKey"; private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, BpelRestClient.class); /** Default socket timeout (in seconds) */ @@ -122,7 +122,7 @@ public class BpelRestClient { retryCount = env.getProperty(RETRY_COUNT_PROPERTY, Integer.class, DEFAULT_RETRY_COUNT); retryInterval = env.getProperty(RETRY_INTERVAL_PROPERTY, Integer.class, DEFAULT_RETRY_INTERVAL); setRetryList(env.getProperty(RETRY_LIST_PROPERTY, DEFAULT_RETRY_LIST)); - credentials = getEncryptedProperty(BPEL_AUTH_PROPERTY, DEFAULT_CREDENTIALS, ENCRYPTION_KEY); + credentials = getEncryptedProperty(BPEL_AUTH_PROPERTY, DEFAULT_CREDENTIALS, ENCRYPTION_KEY_PROP); } public int getSocketTimeout() { @@ -285,7 +285,7 @@ public class BpelRestClient { private String getEncryptedProperty(String key, String defaultValue, String encryptionKey) { if (env.getProperty(key) != null) { try { - return CryptoUtils.decrypt(env.getProperty(key), encryptionKey); + return CryptoUtils.decrypt(env.getProperty(key), env.getProperty(encryptionKey)); } catch (GeneralSecurityException e) { LOGGER.debug("Exception while decrypting property: " + env.getProperty(key), e); } diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java index 95135f579d..21b7ea4142 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java @@ -45,7 +45,7 @@ import org.onap.so.adapters.vnf.async.client.VnfAdapterNotify_Service; import org.onap.so.adapters.vnf.exceptions.VnfException; import org.onap.so.entity.MsoRequest; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoAlarmLogger; + import org.onap.so.logger.MsoLogger; import org.onap.so.openstack.beans.VnfRollback; import org.onap.so.openstack.beans.VnfStatus; @@ -60,9 +60,9 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { public static final String MSO_PROP_VNF_ADAPTER="MSO_PROP_VNF_ADAPTER"; private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, MsoVnfAdapterAsyncImpl.class); - private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger (); + private static final String BPEL_AUTH_PROP = "org.onap.so.adapters.vnf.bpelauth"; - private static final String ENCRYPTION_KEY = "aa3871669d893c7fb8abbcda31b88b4f"; + private static final String ENCRYPTION_KEY_PROP = "org.onap.so.adapters.network.encryptionKey"; @Autowired private Environment environment; @@ -181,7 +181,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { } catch (Exception e1) { error = "Error sending createVnf notification " + e1.getMessage (); LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, "", "createVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending createVnf notification", e1); - alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error); + } LOGGER.info (MessageEnum.RA_ASYNC_CREATE_VNF_COMPLETE, "", "createVnfA", ""); return; @@ -200,7 +200,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { } catch (Exception e) { error = "Error sending createVnf notification " + e.getMessage (); LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, "", "createVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending createVnf notification", e); - alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error); + } LOGGER.info (MessageEnum.RA_ASYNC_CREATE_VNF_COMPLETE, "", "","createVnfA"); return; @@ -255,7 +255,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { } catch (Exception e1) { error = "Error sending updateVnf notification " + e1.getMessage (); LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, "", "UpdateVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending updateVnf notification", e1); - alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error); + } LOGGER.info (MessageEnum.RA_ASYNC_UPDATE_VNF_COMPLETE,"","","UpdateVnfA"); return; @@ -273,7 +273,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { } catch (Exception e) { error = "Error sending updateVnf notification " + e.getMessage (); LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, "", "UpdateVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending updateVnf notification", e); - alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error); + } LOGGER.info (MessageEnum.RA_ASYNC_UPDATE_VNF_COMPLETE, "", "","UpdateVnfA"); return; @@ -337,7 +337,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { } catch (Exception e1) { error = "Error sending queryVnf notification " + e1.getMessage (); LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, "", "queryVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending queryVnf notification", e1); - alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error); + } LOGGER.info (MessageEnum.RA_ASYNC_QUERY_VNF_COMPLETE, "","", "queryVnfA"); return; @@ -363,7 +363,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { } catch (Exception e) { error = "Error sending queryVnf notification " + e.getMessage (); LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, "", "queryVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending queryVnf notification", e); - alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error); + } LOGGER.info (MessageEnum.RA_ASYNC_QUERY_VNF_COMPLETE, "","", "queryVnfA"); @@ -421,7 +421,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { } catch (Exception e1) { error = "Error sending deleteVnf notification " + e1.getMessage (); LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, "", "deleteVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending deleteVnfA notification", e1); - alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error); + } LOGGER.info (MessageEnum.RA_ASYNC_DELETE_VNF_COMPLETE, "","", "deleteVnfA"); return; @@ -436,7 +436,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { } catch (Exception e) { error = "Error sending deleteVnf notification " + e.getMessage (); LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, "", "deleteVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending deleteVnfA notification", e); - alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error); + } LOGGER.info (MessageEnum.RA_ASYNC_DELETE_VNF_COMPLETE, "", "","deleteVnfA"); @@ -458,7 +458,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { if (rollback == null) { error = "Empty Rollback: No action to perform"; LOGGER.info (MessageEnum.RA_ROLLBACK_NULL, "","", "rollbackVnfA"); - alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error); + return; } @@ -491,7 +491,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { } catch (Exception e1) { error = "Error sending rollbackVnf notification " + e1.getMessage (); LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, "", "rollbackVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending rollbackVnfA notification", e1); - alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error); + } LOGGER.info (MessageEnum.RA_ASYNC_ROLLBACK_VNF_COMPLETE, "","", "rollbackVnfA"); return; @@ -505,7 +505,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { } catch (Exception e) { error = "Error sending rollbackVnf notification " + e.getMessage (); LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, "", "rollbackVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending rollbackVnfA notification", e); - alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error); + } LOGGER.info (MessageEnum.RA_ASYNC_ROLLBACK_VNF_COMPLETE, "", "","rollbackVnfA"); @@ -640,14 +640,14 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { Map <String, Object> reqCtx = bp.getRequestContext (); Map <String, List <String>> headers = new HashMap <> (); - String userCredentials = this.getEncryptedProperty(BPEL_AUTH_PROP, "", ENCRYPTION_KEY); + String userCredentials = this.getEncryptedProperty(BPEL_AUTH_PROP, "", ENCRYPTION_KEY_PROP); String basicAuth = "Basic " + DatatypeConverter.printBase64Binary (userCredentials.getBytes ()); reqCtx.put (MessageContext.HTTP_REQUEST_HEADERS, headers); headers.put ("Authorization", Collections.singletonList (basicAuth)); } catch (Exception e) { LOGGER.error (MessageEnum.RA_SET_CALLBACK_AUTH_EXC, "", "getNotifyEP", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - Unable to set authorization in callback request", e); - alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, "Unable to set authorization in callback request"); + } return notifyPort; @@ -655,7 +655,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { public String getEncryptedProperty(String key, String defaultValue, String encryptionKey) { try { - return CryptoUtils.decrypt(this.environment.getProperty(key), encryptionKey); + return CryptoUtils.decrypt(this.environment.getProperty(key), this.environment.getProperty(encryptionKey)); } catch (GeneralSecurityException e) { LOGGER.debug("Exception while decrypting property: " + this.environment.getProperty(key), e); } diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java index 19a41ad7a8..94434cd781 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java @@ -52,7 +52,7 @@ import org.onap.so.db.catalog.data.repository.VnfResourceRepository; import org.onap.so.db.catalog.utils.MavenLikeVersioning; import org.onap.so.entity.MsoRequest; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoAlarmLogger; + import org.onap.so.logger.MsoLogger; import org.onap.so.openstack.beans.HeatStatus; import org.onap.so.openstack.beans.StackInfo; @@ -96,7 +96,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { private static final String MSO_CONFIGURATION_ERROR = "MsoConfigurationError"; private static final String VNF_ADAPTER_SERVICE_NAME = "MSO-BPMN:MSO-VnfAdapter."; private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA,MsoVnfAdapterImpl.class); - private static final MsoAlarmLogger alarmLogger = new MsoAlarmLogger (); + private static final String CHECK_REQD_PARAMS = "org.onap.so.adapters.vnf.checkRequiredParameters"; private static final String ADD_GET_FILES_ON_VOLUME_REQ = "org.onap.so.adapters.vnf.addGetFilesOnVolumeReq"; private static final ObjectMapper JSON_MAPPER = new ObjectMapper(); @@ -803,7 +803,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error); throw new VnfException(error, MsoExceptionCategory.USERDATA); } else { - LOGGER.debug("Found vfModuleCust entry " + vfmc.toString()); + LOGGER.trace("Found vfModuleCust entry " + vfmc.toString()); } if (vf.getIsBase()) { isBaseRequest = true; @@ -932,9 +932,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { if (heatTemplate == null) { String error = "UpdateVF: No Heat Template ID defined in catalog database for " + vfModuleType + ", reqType=" + requestTypeString; LOGGER.error(MessageEnum.RA_VNF_UNKNOWN_PARAM, "Heat Template ID", vfModuleType, "OpenStack", "", MsoLogger.ErrorCode.DataError, error); - LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error); - alarmLogger.sendAlarm(MSO_CONFIGURATION_ERROR, - MsoAlarmLogger.CRITICAL, error); + LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error); throw new VnfException(error, MsoExceptionCategory.INTERNAL); } else { LOGGER.debug ("Got HEAT Template from DB: " + heatTemplate.getHeatTemplate()); @@ -948,9 +946,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String error = "Update VNF: undefined Heat Environment. VF=" + vfModuleType; LOGGER.error (MessageEnum.RA_VNF_UNKNOWN_PARAM, "Heat Environment ID", "OpenStack", "", MsoLogger.ErrorCode.DataError, error); LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error); - // Alarm on this error, configuration must be fixed - alarmLogger.sendAlarm (MSO_CONFIGURATION_ERROR, MsoAlarmLogger.CRITICAL, error); - throw new VnfException (error, MsoExceptionCategory.INTERNAL); } else { LOGGER.debug ("Got Heat Environment from DB: " + heatEnvironment.getEnvironment()); @@ -1661,8 +1656,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String error = "UpdateVF: No Heat Template ID defined in catalog database for " + vfModuleType + ", reqType=" + requestTypeString; LOGGER.error(MessageEnum.RA_VNF_UNKNOWN_PARAM, "Heat Template ID", vfModuleType, "OpenStack", "", MsoLogger.ErrorCode.DataError, error); LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error); - alarmLogger.sendAlarm(MSO_CONFIGURATION_ERROR, - MsoAlarmLogger.CRITICAL, error); throw new VnfException(error, MsoExceptionCategory.INTERNAL); } else { LOGGER.debug ("Got HEAT Template from DB: " + heatTemplate.getHeatTemplate()); @@ -1672,9 +1665,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String error = "Update VNF: undefined Heat Environment. VF=" + vfModuleType; LOGGER.error (MessageEnum.RA_VNF_UNKNOWN_PARAM, "Heat Environment ID", "OpenStack", "", MsoLogger.ErrorCode.DataError, error); LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error); - // Alarm on this error, configuration must be fixed - alarmLogger.sendAlarm (MSO_CONFIGURATION_ERROR, MsoAlarmLogger.CRITICAL, error); - throw new VnfException (error, MsoExceptionCategory.INTERNAL); } else { LOGGER.debug ("Got Heat Environment from DB: " + heatEnvironment.getEnvironment()); @@ -2226,6 +2216,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { vfModuleId = vnfName.substring(vnfName.indexOf('/') + 1); } catch (Exception e) { // do nothing - send what we got for vnfName for both to valet + LOGGER.error("An exception occurred trying to call MsoVnfAdapterImpl.valetDeleteRequest() method", e); } GenericValetResponse<ValetDeleteResponse> deleteReq = this.vci.callValetDeleteRequest(msoRequest.getRequestId(), cloudSiteId, tenantId, vfModuleId, vfModuleName); diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java index 41da3c2988..00e72373dd 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java @@ -52,7 +52,7 @@ import org.onap.so.db.catalog.data.repository.VFModuleCustomizationRepository; import org.onap.so.db.catalog.utils.MavenLikeVersioning; import org.onap.so.entity.MsoRequest; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoAlarmLogger; + import org.onap.so.logger.MsoLogger; import org.onap.so.openstack.beans.MsoTenant; import org.onap.so.openstack.beans.VnfRollback; @@ -81,7 +81,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { private static final String VNF_ADAPTER_SERVICE_NAME = "MSO-BPMN:MSO-VnfAdapter."; private static final String LOG_REPLY_NAME = "MSO-VnfAdapter:MSO-BPMN."; private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, MsoVnfCloudifyAdapterImpl.class); - private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger (); + private static final String CHECK_REQD_PARAMS = "org.onap.so.adapters.vnf.checkRequiredParameters"; private static final String ADD_GET_FILES_ON_VOLUME_REQ = "org.onap.so.adapters.vnf.addGetFilesOnVolumeReq"; private static final String CLOUDIFY_RESPONSE_SUCCESS="Successfully received response from Cloudify"; @@ -873,9 +873,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { if (heatTemplate == null) { String error = "UpdateVF: No Heat Template ID defined in catalog database for " + vfModuleType + ", reqType=" + requestType; LOGGER.error(MessageEnum.RA_VNF_UNKNOWN_PARAM, "Heat Template ID", vfModuleType, "OpenStack", "", MsoLogger.ErrorCode.DataError, error); - LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error); - alarmLogger.sendAlarm(MSO_CONFIGURATION_ERROR, - MsoAlarmLogger.CRITICAL, error); + LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error); throw new VnfException(error, MsoExceptionCategory.INTERNAL); } else { LOGGER.debug ("Got HEAT Template from DB: " + heatTemplate.getHeatTemplate()); @@ -886,7 +884,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { LOGGER.error (MessageEnum.RA_VNF_UNKNOWN_PARAM, "Heat Environment ID", "OpenStack", "", MsoLogger.ErrorCode.DataError, error); LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error); // Alarm on this error, configuration must be fixed - alarmLogger.sendAlarm (MSO_CONFIGURATION_ERROR, MsoAlarmLogger.CRITICAL, error); + throw new VnfException (error, MsoExceptionCategory.INTERNAL); } else { diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java index d37342323f..09ee0cde04 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java @@ -71,7 +71,7 @@ import org.onap.so.db.catalog.data.repository.VFModuleCustomizationRepository; import org.onap.so.db.catalog.utils.MavenLikeVersioning; import org.onap.so.entity.MsoRequest; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoAlarmLogger; + import org.onap.so.logger.MsoLogger; import org.onap.so.openstack.beans.VnfRollback; import org.onap.so.openstack.beans.VnfStatus; @@ -98,7 +98,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { private static final String MSO_CONFIGURATION_ERROR = "MsoConfigurationError"; private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, MsoVnfPluginAdapterImpl.class); - private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger (); + private static final String CHECK_REQD_PARAMS = "org.onap.so.adapters.vnf.checkRequiredParameters"; private static final ObjectMapper JSON_MAPPER = new ObjectMapper(); @@ -919,9 +919,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { if (heatTemplate == null) { String error = "UpdateVF: No Heat Template ID defined in catalog database for " + vfModuleType + ", reqType=" + requestType; LOGGER.error(MessageEnum.RA_VNF_UNKNOWN_PARAM, "Heat Template ID", vfModuleType, "VNF", "", MsoLogger.ErrorCode.DataError, error); - LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error); - alarmLogger.sendAlarm(MSO_CONFIGURATION_ERROR, - MsoAlarmLogger.CRITICAL, error); + LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error); throw new VnfException(error, MsoExceptionCategory.INTERNAL); } else { LOGGER.debug ("Got HEAT Template from DB: " + heatTemplate.getHeatTemplate()); @@ -931,9 +929,6 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { String error = "Update VNF: undefined Heat Environment. VF=" + vfModuleType; LOGGER.error (MessageEnum.RA_VNF_UNKNOWN_PARAM, "Heat Environment ID", "OpenStack", "", MsoLogger.ErrorCode.DataError, error); LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error); - // Alarm on this error, configuration must be fixed - alarmLogger.sendAlarm (MSO_CONFIGURATION_ERROR, MsoAlarmLogger.CRITICAL, error); - throw new VnfException (error, MsoExceptionCategory.INTERNAL); } else { LOGGER.debug ("Got Heat Environment from DB: " + heatEnvironment.getEnvironment()); |