aboutsummaryrefslogtreecommitdiffstats
path: root/adapters/mso-network-adapter/src/main
diff options
context:
space:
mode:
authorMunir Ahmad <munir.ahmad@bell.ca>2018-03-02 19:50:18 -0500
committerSeshu Kumar M <seshu.kumar.m@huawei.com>2018-03-06 14:47:33 +0000
commit78e5db7fa6a022e8dd319334ff40bbf045b5b66b (patch)
treea93fc57cc71e881da211c53c19b040c4f836fb4e /adapters/mso-network-adapter/src/main
parent2c3be92eccd45ebad09d4fea7245f11a3c14f583 (diff)
Make use of try with resources
Change-Id: If230b8249d482f7784f885fb4348943c755477cc Issue-ID: SO-437 Signed-off-by: Munir Ahmad <munir.ahmad@bell.ca>
Diffstat (limited to 'adapters/mso-network-adapter/src/main')
-rw-r--r--adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/MsoNetworkAdapterImpl.java1003
1 files changed, 547 insertions, 456 deletions
diff --git a/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/MsoNetworkAdapterImpl.java b/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/MsoNetworkAdapterImpl.java
index 82684bd43e..6063956af9 100644
--- a/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/MsoNetworkAdapterImpl.java
+++ b/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/MsoNetworkAdapterImpl.java
@@ -288,39 +288,45 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
}
// Get a handle to the Catalog Database
- CatalogDatabase db = getCatalogDB ();
// Make sure DB connection is always closed
- try {
- NetworkResource networkResource = networkCheck (db,
- startTime,
- networkType,
- modelCustomizationUuid,
- networkName,
- physicalNetworkName,
- vlans,
- routeTargets,
- cloudSiteOpt.get());
- String mode = networkResource.getOrchestrationMode ();
- NetworkType neutronNetworkType = NetworkType.valueOf (networkResource.getNeutronNetworkType ());
-
- if (NEUTRON_MODE.equals (mode)) {
+ try (CatalogDatabase db = getCatalogDB()) {
+ NetworkResource networkResource = networkCheck(db,
+ startTime,
+ networkType,
+ modelCustomizationUuid,
+ networkName,
+ physicalNetworkName,
+ vlans,
+ routeTargets,
+ cloudSiteOpt.get());
+ String mode = networkResource.getOrchestrationMode();
+ NetworkType neutronNetworkType = NetworkType.valueOf(networkResource.getNeutronNetworkType());
+
+ if (NEUTRON_MODE.equals(mode)) {
// Use an MsoNeutronUtils for all neutron commands
- MsoNeutronUtils neutron = new MsoNeutronUtils (MSO_PROP_NETWORK_ADAPTER, cloudConfigFactory);
+ MsoNeutronUtils neutron = new MsoNeutronUtils(MSO_PROP_NETWORK_ADAPTER, cloudConfigFactory);
// See if the Network already exists (by name)
NetworkInfo netInfo = null;
- long queryNetworkStarttime = System.currentTimeMillis ();
+ long queryNetworkStarttime = System.currentTimeMillis();
try {
- netInfo = neutron.queryNetwork (networkName, tenantId, cloudSiteId);
- LOGGER.recordMetricEvent (queryNetworkStarttime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Response successfully received from OpenStack", "OpenStack", "QueryNetwork", null);
+ netInfo = neutron.queryNetwork(networkName, tenantId, cloudSiteId);
+ LOGGER.recordMetricEvent(queryNetworkStarttime, MsoLogger.StatusCode.COMPLETE,
+ MsoLogger.ResponseCode.Suc, "Response successfully received from OpenStack", "OpenStack",
+ "QueryNetwork", null);
} catch (MsoException me) {
- LOGGER.recordMetricEvent (queryNetworkStarttime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while querying network from OpenStack", "OpenStack", "QueryNetwork", null);
- LOGGER.error (MessageEnum.RA_QUERY_NETWORK_EXC, networkName, cloudSiteId, tenantId, "OpenStack", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception while querying network from OpenStack", me);
- me.addContext (CREATE_NETWORK_CONTEXT);
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while querying network from OpenStack");
- throw new NetworkException (me);
+ LOGGER.recordMetricEvent(queryNetworkStarttime, MsoLogger.StatusCode.ERROR,
+ MsoLogger.ResponseCode.CommunicationError, "Exception while querying network from OpenStack",
+ "OpenStack", "QueryNetwork", null);
+ LOGGER.error(MessageEnum.RA_QUERY_NETWORK_EXC, networkName, cloudSiteId, tenantId, "OpenStack", "",
+ MsoLogger.ErrorCode.BusinessProcesssError, "Exception while querying network from OpenStack",
+ me);
+ me.addContext(CREATE_NETWORK_CONTEXT);
+ LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR,
+ MsoLogger.ResponseCode.CommunicationError, "Exception while querying network from OpenStack");
+ throw new NetworkException(me);
}
if (netInfo != null) {
@@ -328,49 +334,59 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
// Otherwise, return an exception.
if (failIfExists != null && failIfExists) {
String error = "Create Nework: Network " + networkName
- + " already exists in "
- + cloudSiteId
- + "/"
- + tenantId
- + " with ID " + netInfo.getId();
- LOGGER.error (MessageEnum.RA_NETWORK_ALREADY_EXIST, networkName, cloudSiteId, tenantId, "OpenStack", "", MsoLogger.ErrorCode.DataError, "Network already exists");
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, error);
+ + " already exists in "
+ + cloudSiteId
+ + "/"
+ + tenantId
+ + " with ID " + netInfo.getId();
+ LOGGER.error(MessageEnum.RA_NETWORK_ALREADY_EXIST, networkName, cloudSiteId, tenantId,
+ "OpenStack", "", MsoLogger.ErrorCode.DataError, "Network already exists");
+ LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict,
+ error);
throw new NetworkException(error, MsoExceptionCategory.USERDATA);
} else {
// Populate the outputs from the existing network.
- networkId.value = netInfo.getId ();
- neutronNetworkId.value = netInfo.getId ();
+ networkId.value = netInfo.getId();
+ neutronNetworkId.value = netInfo.getId();
rollback.value = networkRollback; // Default rollback - no updates performed
- String msg = "Found Existing network, status=" + netInfo.getStatus () + " for Neutron mode";
- LOGGER.warn (MessageEnum.RA_NETWORK_ALREADY_EXIST, networkName, cloudSiteId, tenantId, "", "", MsoLogger.ErrorCode.DataError, "Found Existing network, status=" + netInfo.getStatus ());
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, msg);
+ String msg = "Found Existing network, status=" + netInfo.getStatus() + " for Neutron mode";
+ LOGGER.warn(MessageEnum.RA_NETWORK_ALREADY_EXIST, networkName, cloudSiteId, tenantId, "", "",
+ MsoLogger.ErrorCode.DataError, "Found Existing network, status=" + netInfo.getStatus());
+ LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
+ msg);
}
return;
}
- long createNetworkStarttime = System.currentTimeMillis ();
+ long createNetworkStarttime = System.currentTimeMillis();
try {
- netInfo = neutron.createNetwork (cloudSiteId,
- tenantId,
- neutronNetworkType,
- networkName,
- physicalNetworkName,
- vlans);
- LOGGER.recordMetricEvent (createNetworkStarttime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Response successfully received from OpenStack", "OpenStack", "CreateNetwork", null);
+ netInfo = neutron.createNetwork(cloudSiteId,
+ tenantId,
+ neutronNetworkType,
+ networkName,
+ physicalNetworkName,
+ vlans);
+ LOGGER.recordMetricEvent(createNetworkStarttime, MsoLogger.StatusCode.COMPLETE,
+ MsoLogger.ResponseCode.Suc, "Response successfully received from OpenStack", "OpenStack",
+ "CreateNetwork", null);
} catch (MsoException me) {
- me.addContext (CREATE_NETWORK_CONTEXT);
- LOGGER.recordMetricEvent (createNetworkStarttime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with OpenStack", "OpenStack", "CreateNetwork", null);
- String error = "Create Network: type " + neutronNetworkType
- + " in "
- + cloudSiteId
- + "/"
- + tenantId
- + ": "
- + me;
- LOGGER.error (MessageEnum.RA_CREATE_NETWORK_EXC, networkName, cloudSiteId, tenantId, "OpenStack", "", MsoLogger.ErrorCode.DataError, "Exception while communicate with OpenStack", me);
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
-
- throw new NetworkException (me);
+ me.addContext(CREATE_NETWORK_CONTEXT);
+ LOGGER.recordMetricEvent(createNetworkStarttime, MsoLogger.StatusCode.ERROR,
+ MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with OpenStack",
+ "OpenStack", "CreateNetwork", null);
+ String error = "Create Network: type " + neutronNetworkType
+ + " in "
+ + cloudSiteId
+ + "/"
+ + tenantId
+ + ": "
+ + me;
+ LOGGER.error(MessageEnum.RA_CREATE_NETWORK_EXC, networkName, cloudSiteId, tenantId, "OpenStack", "",
+ MsoLogger.ErrorCode.DataError, "Exception while communicate with OpenStack", me);
+ LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR,
+ MsoLogger.ResponseCode.CommunicationError, error);
+
+ throw new NetworkException(me);
}
// Note: ignoring MsoNetworkAlreadyExists because we already checked.
@@ -378,263 +394,287 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
// If reach this point, network creation is successful.
// Since directly created via Neutron, networkId tracked by MSO is the same
// as the neutron network ID.
- networkId.value = netInfo.getId ();
- neutronNetworkId.value = netInfo.getId ();
+ networkId.value = netInfo.getId();
+ neutronNetworkId.value = netInfo.getId();
- networkRollback.setNetworkCreated (true);
- networkRollback.setNetworkId (netInfo.getId ());
- networkRollback.setNeutronNetworkId (netInfo.getId ());
- networkRollback.setNetworkType (networkType);
+ networkRollback.setNetworkCreated(true);
+ networkRollback.setNetworkId(netInfo.getId());
+ networkRollback.setNeutronNetworkId(netInfo.getId());
+ networkRollback.setNetworkType(networkType);
- LOGGER.debug ("Network " + networkName + " created, id = " + netInfo.getId ());
- } else if ("HEAT".equals (mode)) {
+ LOGGER.debug("Network " + networkName + " created, id = " + netInfo.getId());
+ } else if ("HEAT".equals(mode)) {
// Use an MsoHeatUtils for all Heat commands
- MsoHeatUtils heat = new MsoHeatUtils (MSO_PROP_NETWORK_ADAPTER, msoPropertiesFactory,cloudConfigFactory);
+ MsoHeatUtils heat = new MsoHeatUtils(MSO_PROP_NETWORK_ADAPTER, msoPropertiesFactory,
+ cloudConfigFactory);
//HeatTemplate heatTemplate = db.getHeatTemplate (networkResource.getTemplateId ());
- HeatTemplate heatTemplate = db.getHeatTemplateByArtifactUuidRegularQuery (networkResource.getHeatTemplateArtifactUUID());
+ HeatTemplate heatTemplate = db
+ .getHeatTemplateByArtifactUuidRegularQuery(networkResource.getHeatTemplateArtifactUUID());
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);
+ 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);
}
- LOGGER.debug ("Got HEAT Template from DB: " + heatTemplate.toString ());
+ LOGGER.debug("Got HEAT Template from DB: " + heatTemplate.toString());
// "Fix" the template if it has CR/LF (getting this from Oracle)
- String template = heatTemplate.getHeatTemplate ();
- template = template.replaceAll ("\r\n", "\n");
+ String template = heatTemplate.getHeatTemplate();
+ template = template.replaceAll("\r\n", "\n");
- boolean aic3template=false;
+ boolean aic3template = false;
String aic3nw = AIC3_NW;
try {
- aic3nw = msoPropertiesFactory.getMsoJavaProperties(MSO_PROP_NETWORK_ADAPTER).getProperty(AIC3_NW_PROPERTY, AIC3_NW);
- } catch (MsoPropertiesException e) {
- String error = "Unable to get properties:" + MSO_PROP_NETWORK_ADAPTER;
- LOGGER.error (MessageEnum.RA_CONFIG_EXC, error, "", "", MsoLogger.ErrorCode.DataError, "Exception - Unable to get properties", e);
- }
+ aic3nw = msoPropertiesFactory.getMsoJavaProperties(MSO_PROP_NETWORK_ADAPTER)
+ .getProperty(AIC3_NW_PROPERTY, AIC3_NW);
+ } catch (MsoPropertiesException e) {
+ String error = "Unable to get properties:" + MSO_PROP_NETWORK_ADAPTER;
+ LOGGER.error(MessageEnum.RA_CONFIG_EXC, error, "", "", MsoLogger.ErrorCode.DataError,
+ "Exception - Unable to get properties", e);
+ }
if (template.contains(aic3nw))
- aic3template = true;
+ aic3template = true;
// First, look up to see if the Network already exists (by name).
// For HEAT orchestration of networks, the stack name will always match the network name
StackInfo heatStack = null;
- long queryNetworkStarttime = System.currentTimeMillis ();
+ long queryNetworkStarttime = System.currentTimeMillis();
try {
- heatStack = heat.queryStack (cloudSiteId, tenantId, networkName);
- LOGGER.recordMetricEvent (queryNetworkStarttime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Response successfully received from OpenStack", "OpenStack", "QueryNetwork", null);
+ heatStack = heat.queryStack(cloudSiteId, tenantId, networkName);
+ LOGGER.recordMetricEvent(queryNetworkStarttime, MsoLogger.StatusCode.COMPLETE,
+ MsoLogger.ResponseCode.Suc, "Response successfully received from OpenStack", "OpenStack",
+ "QueryNetwork", null);
} catch (MsoException me) {
- me.addContext (CREATE_NETWORK_CONTEXT);
- LOGGER.recordMetricEvent (queryNetworkStarttime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while querying stack from OpenStack", "OpenStack", "QueryNetwork", null);
- String error = "Create Network (heat): query network " + networkName
- + " in "
- + cloudSiteId
- + "/"
- + tenantId
- + ": "
- + me;
- LOGGER.error (MessageEnum.RA_QUERY_NETWORK_EXC, networkName, cloudSiteId, tenantId, "OpenStack", "", MsoLogger.ErrorCode.DataError, "Exception while querying stack from OpenStack", me);
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
- throw new NetworkException (me);
+ me.addContext(CREATE_NETWORK_CONTEXT);
+ LOGGER.recordMetricEvent(queryNetworkStarttime, MsoLogger.StatusCode.ERROR,
+ MsoLogger.ResponseCode.CommunicationError, "Exception while querying stack from OpenStack",
+ "OpenStack", "QueryNetwork", null);
+ String error = "Create Network (heat): query network " + networkName
+ + " in "
+ + cloudSiteId
+ + "/"
+ + tenantId
+ + ": "
+ + me;
+ LOGGER.error(MessageEnum.RA_QUERY_NETWORK_EXC, networkName, cloudSiteId, tenantId, "OpenStack", "",
+ MsoLogger.ErrorCode.DataError, "Exception while querying stack from OpenStack", me);
+ LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR,
+ MsoLogger.ResponseCode.CommunicationError, error);
+ throw new NetworkException(me);
}
- if (heatStack != null && (heatStack.getStatus () != HeatStatus.NOTFOUND)) {
+ if (heatStack != null && (heatStack.getStatus() != HeatStatus.NOTFOUND)) {
// Stack exists. Return success or error depending on input directive
if (failIfExists != null && failIfExists) {
String error = "CreateNetwork: Stack " + networkName
- + " already exists in "
- + cloudSiteId
- + "/"
- + tenantId
- + " as " + heatStack.getCanonicalName();
- LOGGER.error (MessageEnum.RA_NETWORK_ALREADY_EXIST, networkName, cloudSiteId, tenantId, "", "", MsoLogger.ErrorCode.DataError, "Network already exists");
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, error);
+ + " already exists in "
+ + cloudSiteId
+ + "/"
+ + tenantId
+ + " as " + heatStack.getCanonicalName();
+ LOGGER.error(MessageEnum.RA_NETWORK_ALREADY_EXIST, networkName, cloudSiteId, tenantId, "", "",
+ MsoLogger.ErrorCode.DataError, "Network already exists");
+ LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict,
+ error);
throw new NetworkException(error, MsoExceptionCategory.USERDATA);
} else {
// Populate the outputs from the existing stack.
- networkId.value = heatStack.getCanonicalName ();
- neutronNetworkId.value = (String) heatStack.getOutputs ().get (NETWORK_ID);
+ networkId.value = heatStack.getCanonicalName();
+ neutronNetworkId.value = (String) heatStack.getOutputs().get(NETWORK_ID);
rollback.value = networkRollback; // Default rollback - no updates performed
- if (aic3template)
- {
- networkFqdn.value = (String) heatStack.getOutputs().get(NETWORK_FQDN);
+ if (aic3template) {
+ networkFqdn.value = (String) heatStack.getOutputs().get(NETWORK_FQDN);
}
- Map <String, Object> outputs = heatStack.getOutputs ();
- Map <String, String> sMap = new HashMap <> ();
+ Map<String, Object> outputs = heatStack.getOutputs();
+ Map<String, String> sMap = new HashMap<>();
if (outputs != null) {
- for (String key : outputs.keySet ()) {
- if (key != null && key.startsWith ("subnet")) {
- if (aic3template) //one subnet_id output
- {
- Map <String, String> map = getSubnetUUId(key, outputs, subnets);
- sMap.putAll(map);
- }
- else //multiples subnet_%aaid% outputs
- {
- String subnetUUId = (String) outputs.get(key);
- sMap.put (key.substring("subnet_id_".length()), subnetUUId);
- }
- }
- }
+ for (String key : outputs.keySet()) {
+ if (key != null && key.startsWith("subnet")) {
+ if (aic3template) //one subnet_id output
+ {
+ Map<String, String> map = getSubnetUUId(key, outputs, subnets);
+ sMap.putAll(map);
+ } else //multiples subnet_%aaid% outputs
+ {
+ String subnetUUId = (String) outputs.get(key);
+ sMap.put(key.substring("subnet_id_".length()), subnetUUId);
+ }
+ }
+ }
}
subnetIdMap.value = sMap;
- LOGGER.warn (MessageEnum.RA_NETWORK_ALREADY_EXIST, networkName, cloudSiteId, tenantId, "", "", MsoLogger.ErrorCode.DataError, "Found Existing network stack, status=" + heatStack.getStatus ());
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Suc, "Found Existing network stack");
+ LOGGER.warn(MessageEnum.RA_NETWORK_ALREADY_EXIST, networkName, cloudSiteId, tenantId, "", "",
+ MsoLogger.ErrorCode.DataError,
+ "Found Existing network stack, status=" + heatStack.getStatus());
+ LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Suc,
+ "Found Existing network stack");
}
return;
}
// Ready to deploy the new Network
// Build the common set of HEAT template parameters
- Map <String, Object> stackParams = populateNetworkParams (neutronNetworkType,
- networkName,
- physicalNetworkName,
- vlans,
- routeTargets,
- shared,
- external,
- aic3template);
+ Map<String, Object> stackParams = populateNetworkParams(neutronNetworkType,
+ networkName,
+ physicalNetworkName,
+ vlans,
+ routeTargets,
+ shared,
+ external,
+ aic3template);
// Validate (and update) the input parameters against the DB definition
// Shouldn't happen unless DB config is wrong, since all networks use same inputs
// and inputs were already validated.
try {
- stackParams = heat.validateStackParams (stackParams, heatTemplate);
+ stackParams = heat.validateStackParams(stackParams, heatTemplate);
} 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);
+ 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);
+ throw new NetworkException(error, MsoExceptionCategory.INTERNAL);
}
if (subnets != null) {
- try {
- if (aic3template)
- {
- template = mergeSubnetsAIC3 (template, subnets, stackParams);
- }
- else
- {
- template = mergeSubnets (template, subnets);
- }
- } catch (MsoException me) {
- me.addContext (CREATE_NETWORK_CONTEXT);
- String error = "Create Network (heat): type " + neutronNetworkType
- + " in "
- + cloudSiteId
- + "/"
- + tenantId
- + ": "
- + me;
- LOGGER.error (MessageEnum.RA_CREATE_NETWORK_EXC, neutronNetworkType.toString(), cloudSiteId, tenantId, "Openstack", "", MsoLogger.ErrorCode.DataError, "Exception Create Network, merging subnets", me);
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, error);
- throw new NetworkException (me);
- }
+ try {
+ if (aic3template) {
+ template = mergeSubnetsAIC3(template, subnets, stackParams);
+ } else {
+ template = mergeSubnets(template, subnets);
+ }
+ } catch (MsoException me) {
+ me.addContext(CREATE_NETWORK_CONTEXT);
+ String error = "Create Network (heat): type " + neutronNetworkType
+ + " in "
+ + cloudSiteId
+ + "/"
+ + tenantId
+ + ": "
+ + me;
+ LOGGER.error(MessageEnum.RA_CREATE_NETWORK_EXC, neutronNetworkType.toString(), cloudSiteId,
+ tenantId, "Openstack", "", MsoLogger.ErrorCode.DataError,
+ "Exception Create Network, merging subnets", me);
+ LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR,
+ MsoLogger.ResponseCode.InternalError, error);
+ throw new NetworkException(me);
+ }
}
if (policyFqdns != null && !policyFqdns.isEmpty() && aic3template) {
try {
- mergePolicyRefs (policyFqdns, stackParams);
+ mergePolicyRefs(policyFqdns, stackParams);
} catch (MsoException me) {
- me.addContext (CREATE_NETWORK_CONTEXT);
- String error = "Create Network (heat) mergePolicyRefs type " + neutronNetworkType
- + " in "
- + cloudSiteId
- + "/"
- + tenantId
- + ": "
- + me;
- LOGGER.error (MessageEnum.RA_CREATE_NETWORK_EXC, neutronNetworkType.toString(), cloudSiteId, tenantId, "Openstack", "", MsoLogger.ErrorCode.DataError, "Exception Create Network, merging policyRefs", me);
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, error);
- throw new NetworkException (me);
+ me.addContext(CREATE_NETWORK_CONTEXT);
+ String error = "Create Network (heat) mergePolicyRefs type " + neutronNetworkType
+ + " in "
+ + cloudSiteId
+ + "/"
+ + tenantId
+ + ": "
+ + me;
+ LOGGER.error(MessageEnum.RA_CREATE_NETWORK_EXC, neutronNetworkType.toString(), cloudSiteId,
+ tenantId, "Openstack", "", MsoLogger.ErrorCode.DataError,
+ "Exception Create Network, merging policyRefs", me);
+ LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR,
+ MsoLogger.ResponseCode.InternalError, error);
+ throw new NetworkException(me);
}
}
if (routeTableFqdns != null && !routeTableFqdns.isEmpty() && aic3template) {
try {
- mergeRouteTableRefs (routeTableFqdns, stackParams);
+ mergeRouteTableRefs(routeTableFqdns, stackParams);
} catch (MsoException me) {
- me.addContext (CREATE_NETWORK_CONTEXT);
- String error = "Create Network (heat) mergeRouteTableRefs type " + neutronNetworkType
- + " in "
- + cloudSiteId
- + "/"
- + tenantId
- + ": "
- + me;
- LOGGER.error (MessageEnum.RA_CREATE_NETWORK_EXC, neutronNetworkType.toString(), cloudSiteId, tenantId, "Openstack", "", MsoLogger.ErrorCode.DataError, "Exception Create Network, merging routeTableRefs", me);
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, error);
- throw new NetworkException (me);
+ me.addContext(CREATE_NETWORK_CONTEXT);
+ String error = "Create Network (heat) mergeRouteTableRefs type " + neutronNetworkType
+ + " in "
+ + cloudSiteId
+ + "/"
+ + tenantId
+ + ": "
+ + me;
+ LOGGER.error(MessageEnum.RA_CREATE_NETWORK_EXC, neutronNetworkType.toString(), cloudSiteId,
+ tenantId, "Openstack", "", MsoLogger.ErrorCode.DataError,
+ "Exception Create Network, merging routeTableRefs", me);
+ LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR,
+ MsoLogger.ResponseCode.InternalError, error);
+ throw new NetworkException(me);
}
}
// Deploy the network stack
// Ignore MsoStackAlreadyExists exception because we already checked.
try {
- if (backout == null)
- backout = true;
- heatStack = heat.createStack (cloudSiteId,
- tenantId,
- networkName,
- template,
- stackParams,
- true,
- heatTemplate.getTimeoutMinutes (),
- null,
- null,
- null,
- backout.booleanValue());
+ if (backout == null)
+ backout = true;
+ heatStack = heat.createStack(cloudSiteId,
+ tenantId,
+ networkName,
+ template,
+ stackParams,
+ true,
+ heatTemplate.getTimeoutMinutes(),
+ null,
+ null,
+ null,
+ backout.booleanValue());
} catch (MsoException me) {
- me.addContext (CREATE_NETWORK_CONTEXT);
- String error = "Create Network (heat): type " + neutronNetworkType
- + " in "
- + cloudSiteId
- + "/"
- + tenantId
- + ": "
- + me;
- LOGGER.error (MessageEnum.RA_CREATE_NETWORK_EXC, networkName, cloudSiteId, tenantId, "Openstack", "", MsoLogger.ErrorCode.DataError, "Exception creating network", me);
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
- throw new NetworkException (me);
+ me.addContext(CREATE_NETWORK_CONTEXT);
+ String error = "Create Network (heat): type " + neutronNetworkType
+ + " in "
+ + cloudSiteId
+ + "/"
+ + tenantId
+ + ": "
+ + me;
+ LOGGER.error(MessageEnum.RA_CREATE_NETWORK_EXC, networkName, cloudSiteId, tenantId, "Openstack", "",
+ MsoLogger.ErrorCode.DataError, "Exception creating network", me);
+ LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR,
+ MsoLogger.ResponseCode.CommunicationError, error);
+ throw new NetworkException(me);
}
// Reach this point if createStack is successful.
// For Heat-based orchestration, the MSO-tracked network ID is the heat stack,
// and the neutronNetworkId is the network UUID returned in stack outputs.
- networkId.value = heatStack.getCanonicalName ();
- neutronNetworkId.value = (String) heatStack.getOutputs ().get (NETWORK_ID);
- if (aic3template)
- {
- networkFqdn.value = (String) heatStack.getOutputs().get(NETWORK_FQDN);
+ networkId.value = heatStack.getCanonicalName();
+ neutronNetworkId.value = (String) heatStack.getOutputs().get(NETWORK_ID);
+ if (aic3template) {
+ networkFqdn.value = (String) heatStack.getOutputs().get(NETWORK_FQDN);
}
- Map <String, Object> outputs = heatStack.getOutputs ();
- Map <String, String> sMap = new HashMap <> ();
+ Map<String, Object> outputs = heatStack.getOutputs();
+ Map<String, String> sMap = new HashMap<>();
if (outputs != null) {
- for (String key : outputs.keySet ()) {
- if (key != null && key.startsWith ("subnet")) {
- if (aic3template) //one subnet output expected
- {
- Map <String, String> map = getSubnetUUId(key, outputs, subnets);
- sMap.putAll(map);
- }
- else //multiples subnet_%aaid% outputs allowed
- {
- String subnetUUId = (String) outputs.get(key);
- sMap.put (key.substring("subnet_id_".length()), subnetUUId);
- }
+ for (String key : outputs.keySet()) {
+ if (key != null && key.startsWith("subnet")) {
+ if (aic3template) //one subnet output expected
+ {
+ Map<String, String> map = getSubnetUUId(key, outputs, subnets);
+ sMap.putAll(map);
+ } else //multiples subnet_%aaid% outputs allowed
+ {
+ String subnetUUId = (String) outputs.get(key);
+ sMap.put(key.substring("subnet_id_".length()), subnetUUId);
+ }
}
}
}
@@ -642,15 +682,13 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
rollback.value = networkRollback;
// Populate remaining rollback info and response parameters.
- networkRollback.setNetworkStackId (heatStack.getCanonicalName ());
- networkRollback.setNeutronNetworkId ((String) heatStack.getOutputs ().get (NETWORK_ID));
- networkRollback.setNetworkCreated (true);
- networkRollback.setNetworkType (networkType);
+ networkRollback.setNetworkStackId(heatStack.getCanonicalName());
+ networkRollback.setNeutronNetworkId((String) heatStack.getOutputs().get(NETWORK_ID));
+ networkRollback.setNetworkCreated(true);
+ networkRollback.setNetworkType(networkType);
- LOGGER.debug ("Network " + networkName + " successfully created via HEAT");
+ LOGGER.debug("Network " + networkName + " successfully created via HEAT");
}
- } finally {
- db.close ();
}
LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Suc, "Successfully created network");
return;
@@ -803,19 +841,18 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
}
// Get a handle to the Catalog Database
- CatalogDatabase db = getCatalogDB ();
// Make sure DB connection is always closed
- try {
+ try (CatalogDatabase db = getCatalogDB()) {
NetworkResource networkResource = networkCheck(db,
- startTime,
- networkType,
- modelCustomizationUuid,
- networkName,
- physicalNetworkName,
- vlans,
- routeTargets,
- cloudSiteOpt.get());
+ startTime,
+ networkType,
+ modelCustomizationUuid,
+ networkName,
+ physicalNetworkName,
+ vlans,
+ routeTargets,
+ cloudSiteOpt.get());
String mode = networkResource.getOrchestrationMode();
NetworkType neutronNetworkType = NetworkType.valueOf(networkResource.getNeutronNetworkType());
@@ -830,54 +867,66 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
long queryNetworkStarttime = System.currentTimeMillis();
try {
netInfo = neutron.queryNetwork(networkId, tenantId, cloudSiteId);
- LOGGER.recordMetricEvent(queryNetworkStarttime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from Open Stack", "OpenStack", "QueryNetwork", null);
+ LOGGER.recordMetricEvent(queryNetworkStarttime, MsoLogger.StatusCode.COMPLETE,
+ MsoLogger.ResponseCode.Suc, "Successfully received response from Open Stack", "OpenStack",
+ "QueryNetwork", null);
} catch (MsoException me) {
me.addContext(UPDATE_NETWORK_CONTEXT);
String error = "Update Network (neutron): query " + networkId
- + " in "
- + cloudSiteId
- + "/"
- + tenantId
- + ": "
- + me;
- LOGGER.recordMetricEvent(queryNetworkStarttime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "QueryNetwork", null);
- LOGGER.error(MessageEnum.RA_QUERY_NETWORK_EXC, networkId, cloudSiteId, tenantId, "OpenStack", "QueryNetwork", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - queryNetwork", me);
- LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
+ + " in "
+ + cloudSiteId
+ + "/"
+ + tenantId
+ + ": "
+ + me;
+ LOGGER.recordMetricEvent(queryNetworkStarttime, MsoLogger.StatusCode.ERROR,
+ MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "QueryNetwork", null);
+ LOGGER.error(MessageEnum.RA_QUERY_NETWORK_EXC, networkId, cloudSiteId, tenantId, "OpenStack",
+ "QueryNetwork", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - queryNetwork", me);
+ LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR,
+ MsoLogger.ResponseCode.CommunicationError, error);
throw new NetworkException(me);
}
if (netInfo == null) {
String error = "Update Nework: Network " + networkId
- + " does not exist in "
- + cloudSiteId
- + "/"
- + tenantId;
- LOGGER.error(MessageEnum.RA_NETWORK_NOT_FOUND, networkId, cloudSiteId, tenantId, "OpenStack", "", MsoLogger.ErrorCode.BusinessProcesssError, "Network not found");
- LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.BadRequest, error);
+ + " does not exist in "
+ + cloudSiteId
+ + "/"
+ + tenantId;
+ LOGGER.error(MessageEnum.RA_NETWORK_NOT_FOUND, networkId, cloudSiteId, tenantId, "OpenStack", "",
+ MsoLogger.ErrorCode.BusinessProcesssError, "Network not found");
+ LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.BadRequest,
+ error);
// Does not exist. Throw an exception (can't update a non-existent network)
throw new NetworkException(error, MsoExceptionCategory.USERDATA);
}
long updateNetworkStarttime = System.currentTimeMillis();
try {
netInfo = neutron.updateNetwork(cloudSiteId,
- tenantId,
- networkId,
- neutronNetworkType,
- physicalNetworkName,
- vlans);
- LOGGER.recordMetricEvent(updateNetworkStarttime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from Open Stack", "OpenStack", "UpdateNetwork", null);
+ tenantId,
+ networkId,
+ neutronNetworkType,
+ physicalNetworkName,
+ vlans);
+ LOGGER.recordMetricEvent(updateNetworkStarttime, MsoLogger.StatusCode.COMPLETE,
+ MsoLogger.ResponseCode.Suc, "Successfully received response from Open Stack", "OpenStack",
+ "UpdateNetwork", null);
} catch (MsoException me) {
me.addContext(UPDATE_NETWORK_CONTEXT);
String error = "Update Network (neutron): " + networkId
- + " in "
- + cloudSiteId
- + "/"
- + tenantId
- + ": "
- + me;
- LOGGER.error(MessageEnum.RA_UPDATE_NETWORK_ERR, networkId, cloudSiteId, tenantId, "Openstack", "updateNetwork", MsoLogger.ErrorCode.DataError, "Exception - updateNetwork", me);
- LOGGER.recordMetricEvent(updateNetworkStarttime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "UpdateNetwork", null);
- LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
+ + " in "
+ + cloudSiteId
+ + "/"
+ + tenantId
+ + ": "
+ + me;
+ LOGGER.error(MessageEnum.RA_UPDATE_NETWORK_ERR, networkId, cloudSiteId, tenantId, "Openstack",
+ "updateNetwork", MsoLogger.ErrorCode.DataError, "Exception - updateNetwork", me);
+ LOGGER.recordMetricEvent(updateNetworkStarttime, MsoLogger.StatusCode.ERROR,
+ MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "UpdateNetwork", null);
+ LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR,
+ MsoLogger.ResponseCode.CommunicationError, error);
throw new NetworkException(me);
}
@@ -894,7 +943,8 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
} else if ("HEAT".equals(mode)) {
// Use an MsoHeatUtils for all Heat commands
- MsoHeatUtilsWithUpdate heat = new MsoHeatUtilsWithUpdate(MSO_PROP_NETWORK_ADAPTER, msoPropertiesFactory, cloudConfigFactory);
+ MsoHeatUtilsWithUpdate heat = new MsoHeatUtilsWithUpdate(MSO_PROP_NETWORK_ADAPTER, msoPropertiesFactory,
+ cloudConfigFactory);
// First, look up to see that the Network already exists.
// For Heat-based orchestration, the networkId is the network Stack ID.
@@ -902,30 +952,37 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
long queryStackStarttime = System.currentTimeMillis();
try {
heatStack = heat.queryStack(cloudSiteId, tenantId, networkName);
- LOGGER.recordMetricEvent(queryStackStarttime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from Open Stack", "OpenStack", "QueryStack", null);
+ LOGGER.recordMetricEvent(queryStackStarttime, MsoLogger.StatusCode.COMPLETE,
+ MsoLogger.ResponseCode.Suc, "Successfully received response from Open Stack", "OpenStack",
+ "QueryStack", null);
} catch (MsoException me) {
me.addContext(UPDATE_NETWORK_CONTEXT);
String error = "UpdateNetwork (heat): query " + networkName
- + " in "
- + cloudSiteId
- + "/"
- + tenantId
- + ": "
- + me;
- LOGGER.recordMetricEvent(queryStackStarttime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "QueryStack", null);
- LOGGER.error(MessageEnum.RA_QUERY_NETWORK_EXC, networkId, cloudSiteId, tenantId, "OpenStack", "queryStack", MsoLogger.ErrorCode.DataError, "Exception - QueryStack", me);
- LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
+ + " in "
+ + cloudSiteId
+ + "/"
+ + tenantId
+ + ": "
+ + me;
+ LOGGER.recordMetricEvent(queryStackStarttime, MsoLogger.StatusCode.ERROR,
+ MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "QueryStack", null);
+ LOGGER.error(MessageEnum.RA_QUERY_NETWORK_EXC, networkId, cloudSiteId, tenantId, "OpenStack",
+ "queryStack", MsoLogger.ErrorCode.DataError, "Exception - QueryStack", me);
+ LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR,
+ MsoLogger.ResponseCode.CommunicationError, error);
throw new NetworkException(me);
}
if (heatStack == null || (heatStack.getStatus() == HeatStatus.NOTFOUND)) {
String error = "UpdateNetwork: Stack " + networkName
- + " does not exist in "
- + cloudSiteId
- + "/"
- + tenantId;
- LOGGER.error(MessageEnum.RA_NETWORK_NOT_FOUND, networkId, cloudSiteId, tenantId, "OpenStack", "queryStack", MsoLogger.ErrorCode.DataError, "Network not found");
- LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.BadRequest, error);
+ + " does not exist in "
+ + cloudSiteId
+ + "/"
+ + tenantId;
+ LOGGER.error(MessageEnum.RA_NETWORK_NOT_FOUND, networkId, cloudSiteId, tenantId, "OpenStack",
+ "queryStack", MsoLogger.ErrorCode.DataError, "Network not found");
+ LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.BadRequest,
+ error);
// Network stack does not exist. Return an error
throw new NetworkException(error, MsoExceptionCategory.USERDATA);
}
@@ -943,7 +1000,8 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
try {
previousVlans.add(Integer.parseInt(vlan));
} catch (NumberFormatException e) {
- LOGGER.warn(MessageEnum.RA_VLAN_PARSE, networkId, vlansParam, "", "", MsoLogger.ErrorCode.DataError, "Exception - VLAN parse", e);
+ LOGGER.warn(MessageEnum.RA_VLAN_PARSE, networkId, vlansParam, "", "",
+ MsoLogger.ErrorCode.DataError, "Exception - VLAN parse", e);
}
}
}
@@ -952,12 +1010,16 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
// Ready to deploy the updated Network via Heat
//HeatTemplate heatTemplate = db.getHeatTemplate (networkResource.getTemplateId ());
- HeatTemplate heatTemplate = db.getHeatTemplateByArtifactUuidRegularQuery (networkResource.getHeatTemplateArtifactUUID());
+ HeatTemplate heatTemplate = db
+ .getHeatTemplateByArtifactUuidRegularQuery(networkResource.getHeatTemplateArtifactUUID());
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);
+ 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);
+ LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.BadRequest,
+ error);
throw new NetworkException(error, MsoExceptionCategory.INTERNAL);
}
@@ -970,23 +1032,25 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
boolean aic3template = false;
String aic3nw = AIC3_NW;
try {
- aic3nw = msoPropertiesFactory.getMsoJavaProperties(MSO_PROP_NETWORK_ADAPTER).getProperty(AIC3_NW_PROPERTY, AIC3_NW);
+ aic3nw = msoPropertiesFactory.getMsoJavaProperties(MSO_PROP_NETWORK_ADAPTER)
+ .getProperty(AIC3_NW_PROPERTY, AIC3_NW);
} catch (MsoPropertiesException e) {
String error = "Unable to get properties:" + MSO_PROP_NETWORK_ADAPTER;
- LOGGER.error(MessageEnum.RA_CONFIG_EXC, error, "OpenStack", "", MsoLogger.ErrorCode.DataError, "Exception - Unable to get properties", e);
+ LOGGER.error(MessageEnum.RA_CONFIG_EXC, error, "OpenStack", "", MsoLogger.ErrorCode.DataError,
+ "Exception - Unable to get properties", e);
}
if (template.contains(aic3nw))
aic3template = true;
// Build the common set of HEAT template parameters
Map<String, Object> stackParams = populateNetworkParams(neutronNetworkType,
- networkName,
- physicalNetworkName,
- vlans,
- routeTargets,
- shared,
- external,
- aic3template);
+ networkName,
+ physicalNetworkName,
+ vlans,
+ routeTargets,
+ shared,
+ external,
+ aic3template);
// Validate (and update) the input parameters against the DB definition
// Shouldn't happen unless DB config is wrong, since all networks use same inputs
@@ -994,9 +1058,11 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
stackParams = heat.validateStackParams(stackParams, heatTemplate);
} 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");
+ 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);
+ LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError,
+ error);
throw new NetworkException(error, MsoExceptionCategory.INTERNAL, e);
}
@@ -1010,14 +1076,17 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
} catch (MsoException me) {
me.addContext(UPDATE_NETWORK_CONTEXT);
String error = "Update Network (heat): type " + neutronNetworkType
- + " in "
- + cloudSiteId
- + "/"
- + tenantId
- + ": "
- + me;
- LOGGER.error(MessageEnum.RA_UPDATE_NETWORK_ERR, neutronNetworkType.toString(), cloudSiteId, tenantId, "OpenStack", "", MsoLogger.ErrorCode.DataError, "Exception - UpdateNetwork mergeSubnets ", me);
- LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, error);
+ + " in "
+ + cloudSiteId
+ + "/"
+ + tenantId
+ + ": "
+ + me;
+ LOGGER.error(MessageEnum.RA_UPDATE_NETWORK_ERR, neutronNetworkType.toString(), cloudSiteId,
+ tenantId, "OpenStack", "", MsoLogger.ErrorCode.DataError,
+ "Exception - UpdateNetwork mergeSubnets ", me);
+ LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR,
+ MsoLogger.ResponseCode.InternalError, error);
throw new NetworkException(me);
}
}
@@ -1028,14 +1097,17 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
} catch (MsoException me) {
me.addContext(UPDATE_NETWORK_CONTEXT);
String error = "UpdateNetwork (heat) mergePolicyRefs type " + neutronNetworkType
- + " in "
- + cloudSiteId
- + "/"
- + tenantId
- + ": "
- + me;
- LOGGER.error(MessageEnum.RA_UPDATE_NETWORK_ERR, neutronNetworkType.toString(), cloudSiteId, tenantId, "OpenStack", "", MsoLogger.ErrorCode.DataError, "Exception - UpdateNetwork mergePolicyRefs", me);
- LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, error);
+ + " in "
+ + cloudSiteId
+ + "/"
+ + tenantId
+ + ": "
+ + me;
+ LOGGER.error(MessageEnum.RA_UPDATE_NETWORK_ERR, neutronNetworkType.toString(), cloudSiteId,
+ tenantId, "OpenStack", "", MsoLogger.ErrorCode.DataError,
+ "Exception - UpdateNetwork mergePolicyRefs", me);
+ LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR,
+ MsoLogger.ResponseCode.InternalError, error);
throw new NetworkException(me);
}
}
@@ -1046,14 +1118,17 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
} catch (MsoException me) {
me.addContext(UPDATE_NETWORK_CONTEXT);
String error = "UpdateNetwork (heat) mergeRouteTableRefs type " + neutronNetworkType
- + " in "
- + cloudSiteId
- + "/"
- + tenantId
- + ": "
- + me;
- LOGGER.error(MessageEnum.RA_UPDATE_NETWORK_ERR, neutronNetworkType.toString(), cloudSiteId, tenantId, "Openstack", "", MsoLogger.ErrorCode.DataError, "Exception - UpdateNetwork mergeRouteTableRefs", me);
- LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, error);
+ + " in "
+ + cloudSiteId
+ + "/"
+ + tenantId
+ + ": "
+ + me;
+ LOGGER.error(MessageEnum.RA_UPDATE_NETWORK_ERR, neutronNetworkType.toString(), cloudSiteId,
+ tenantId, "Openstack", "", MsoLogger.ErrorCode.DataError,
+ "Exception - UpdateNetwork mergeRouteTableRefs", me);
+ LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR,
+ MsoLogger.ResponseCode.InternalError, error);
throw new NetworkException(me);
}
}
@@ -1063,19 +1138,24 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
long updateStackStarttime = System.currentTimeMillis();
try {
heatStack = heat.updateStack(cloudSiteId,
- tenantId,
- networkId,
- template,
- stackParams,
- true,
- heatTemplate.getTimeoutMinutes());
- LOGGER.recordMetricEvent(updateStackStarttime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from Open Stack", "OpenStack", "UpdateStack", null);
+ tenantId,
+ networkId,
+ template,
+ stackParams,
+ true,
+ heatTemplate.getTimeoutMinutes());
+ LOGGER.recordMetricEvent(updateStackStarttime, MsoLogger.StatusCode.COMPLETE,
+ MsoLogger.ResponseCode.Suc, "Successfully received response from Open Stack", "OpenStack",
+ "UpdateStack", null);
} catch (MsoException me) {
me.addContext(UPDATE_NETWORK_CONTEXT);
String error = "Update Network: " + networkId + " in " + cloudSiteId + "/" + tenantId + ": " + me;
- LOGGER.recordMetricEvent(updateStackStarttime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "UpdateStack", null);
- LOGGER.error(MessageEnum.RA_UPDATE_NETWORK_ERR, networkId, cloudSiteId, tenantId, "OpenStack", "", MsoLogger.ErrorCode.DataError, "Exception - update network", me);
- LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
+ LOGGER.recordMetricEvent(updateStackStarttime, MsoLogger.StatusCode.COMPLETE,
+ MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "UpdateStack", null);
+ LOGGER.error(MessageEnum.RA_UPDATE_NETWORK_ERR, networkId, cloudSiteId, tenantId, "OpenStack", "",
+ MsoLogger.ErrorCode.DataError, "Exception - update network", me);
+ LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR,
+ MsoLogger.ResponseCode.CommunicationError, error);
throw new NetworkException(me);
}
@@ -1101,10 +1181,9 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
// Reach this point if createStack is successful.
// Populate remaining rollback info and response parameters.
networkRollback.setNetworkStackId(heatStack.getCanonicalName());
- if(null != outputs) {
+ if (null != outputs) {
networkRollback.setNeutronNetworkId((String) outputs.get(NETWORK_ID));
- }
- else {
+ } else {
LOGGER.debug("outputs is NULL");
}
networkRollback.setNetworkType(networkType);
@@ -1117,8 +1196,6 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
LOGGER.debug("Network " + networkId + " successfully updated via HEAT");
}
- } finally {
- db.close ();
}
LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully updated network");
return;
@@ -1472,97 +1549,102 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
long startTime = System.currentTimeMillis ();
// Get a handle to the Catalog Database
- CatalogDatabase db = getCatalogDB ();
// Make sure DB connection is always closed
- try {
- if (isNullOrEmpty (cloudSiteId)
- || isNullOrEmpty(tenantId)
- || isNullOrEmpty(networkId)) {
+ try (CatalogDatabase db = getCatalogDB()) {
+ if (isNullOrEmpty(cloudSiteId)
+ || isNullOrEmpty(tenantId)
+ || isNullOrEmpty(networkId)) {
String error = "Missing mandatory parameter cloudSiteId, tenantId or networkId";
- LOGGER.error (MessageEnum.RA_MISSING_PARAM, "cloudSiteId or tenantId or networkId", "Openstack", "", MsoLogger.ErrorCode.DataError, "Missing mandatory parameter cloudSiteId, tenantId or networkId");
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.BadRequest, error);
- throw new NetworkException (error, MsoExceptionCategory.USERDATA);
+ LOGGER.error(MessageEnum.RA_MISSING_PARAM, "cloudSiteId or tenantId or networkId", "Openstack", "",
+ MsoLogger.ErrorCode.DataError, "Missing mandatory parameter cloudSiteId, tenantId or networkId");
+ LOGGER
+ .recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.BadRequest, error);
+ throw new NetworkException(error, MsoExceptionCategory.USERDATA);
}
// Retrieve the Network Resource definition
NetworkResource networkResource = null;
if (isNullOrEmpty(modelCustomizationUuid)) {
- networkResource = db.getNetworkResource (networkType);
- }
- else if (!isNullOrEmpty(networkType))
- {
+ networkResource = db.getNetworkResource(networkType);
+ } else if (!isNullOrEmpty(networkType)) {
networkResource = db.getNetworkResourceByModelCustUuid(modelCustomizationUuid);
}
String mode = "";
if (networkResource != null) {
- LOGGER.debug ("Got Network definition from Catalog: " + networkResource.toString ());
+ LOGGER.debug("Got Network definition from Catalog: " + networkResource.toString());
- mode = networkResource.getOrchestrationMode ();
+ mode = networkResource.getOrchestrationMode();
}
- if (NEUTRON_MODE.equals (mode)) {
+ if (NEUTRON_MODE.equals(mode)) {
// Use MsoNeutronUtils for all NEUTRON commands
- MsoNeutronUtils neutron = new MsoNeutronUtils (MSO_PROP_NETWORK_ADAPTER, cloudConfigFactory);
- long deleteNetworkStarttime = System.currentTimeMillis ();
+ MsoNeutronUtils neutron = new MsoNeutronUtils(MSO_PROP_NETWORK_ADAPTER, cloudConfigFactory);
+ long deleteNetworkStarttime = System.currentTimeMillis();
try {
// The deleteNetwork function in MsoNeutronUtils returns success if the network
// was not found. So don't bother to query first.
- boolean deleted = neutron.deleteNetwork (networkId, tenantId, cloudSiteId);
- LOGGER.recordMetricEvent (deleteNetworkStarttime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from Open Stack", "OpenStack", "DeleteNetwork", null);
+ boolean deleted = neutron.deleteNetwork(networkId, tenantId, cloudSiteId);
+ LOGGER.recordMetricEvent(deleteNetworkStarttime, MsoLogger.StatusCode.COMPLETE,
+ MsoLogger.ResponseCode.Suc, "Successfully received response from Open Stack", "OpenStack",
+ "DeleteNetwork", null);
networkDeleted.value = deleted;
} catch (MsoException me) {
- me.addContext ("DeleteNetwork");
- String error = "Delete Network (neutron): " + networkId
- + " in "
- + cloudSiteId
- + "/"
- + tenantId
- + ": "
- + me;
- LOGGER.recordMetricEvent (deleteNetworkStarttime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "DeleteNetwork", null);
- LOGGER.error (MessageEnum.RA_DELETE_NETWORK_EXC, networkId, cloudSiteId, tenantId, "Openstack", "", MsoLogger.ErrorCode.DataError, "Delete Network (neutron)", me);
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
- throw new NetworkException (me);
+ me.addContext("DeleteNetwork");
+ String error = "Delete Network (neutron): " + networkId
+ + " in "
+ + cloudSiteId
+ + "/"
+ + tenantId
+ + ": "
+ + me;
+ LOGGER.recordMetricEvent(deleteNetworkStarttime, MsoLogger.StatusCode.ERROR,
+ MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "DeleteNetwork", null);
+ LOGGER.error(MessageEnum.RA_DELETE_NETWORK_EXC, networkId, cloudSiteId, tenantId, "Openstack", "",
+ MsoLogger.ErrorCode.DataError, "Delete Network (neutron)", me);
+ LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR,
+ MsoLogger.ResponseCode.CommunicationError, error);
+ throw new NetworkException(me);
}
} else { // DEFAULT to ("HEAT".equals (mode))
- long deleteStackStarttime = System.currentTimeMillis ();
+ long deleteStackStarttime = System.currentTimeMillis();
// Use MsoHeatUtils for all HEAT commands
- MsoHeatUtils heat = new MsoHeatUtils (MSO_PROP_NETWORK_ADAPTER, msoPropertiesFactory,cloudConfigFactory);
+ MsoHeatUtils heat = new MsoHeatUtils(MSO_PROP_NETWORK_ADAPTER, msoPropertiesFactory,
+ cloudConfigFactory);
try {
// The deleteStack function in MsoHeatUtils returns NOTFOUND if the stack was not found or if the stack was deleted.
// So query first to report back if stack WAS deleted or just NOTOFUND
- StackInfo heatStack = null;
- heatStack = heat.queryStack(cloudSiteId, tenantId, networkId);
- if (heatStack != null && heatStack.getStatus() != HeatStatus.NOTFOUND)
- {
- heat.deleteStack (tenantId, cloudSiteId, networkId, true);
- LOGGER.recordMetricEvent (deleteStackStarttime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from Open Stack", "OpenStack", "DeleteStack", null);
- networkDeleted.value = true;
- }
- else
- {
- networkDeleted.value = false;
- }
+ StackInfo heatStack = null;
+ heatStack = heat.queryStack(cloudSiteId, tenantId, networkId);
+ if (heatStack != null && heatStack.getStatus() != HeatStatus.NOTFOUND) {
+ heat.deleteStack(tenantId, cloudSiteId, networkId, true);
+ LOGGER.recordMetricEvent(deleteStackStarttime, MsoLogger.StatusCode.COMPLETE,
+ MsoLogger.ResponseCode.Suc, "Successfully received response from Open Stack", "OpenStack",
+ "DeleteStack", null);
+ networkDeleted.value = true;
+ } else {
+ networkDeleted.value = false;
+ }
} catch (MsoException me) {
- me.addContext ("DeleteNetwork");
- String error = "Delete Network (heat): " + networkId
- + " in "
- + cloudSiteId
- + "/"
- + tenantId
- + ": "
- + me;
- LOGGER.recordMetricEvent (deleteStackStarttime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "DeleteStack", null);
- LOGGER.error (MessageEnum.RA_DELETE_NETWORK_EXC, networkId, cloudSiteId, tenantId, "Openstack", "", MsoLogger.ErrorCode.DataError, "Delete Network (heat)", me);
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
- throw new NetworkException (me);
+ me.addContext("DeleteNetwork");
+ String error = "Delete Network (heat): " + networkId
+ + " in "
+ + cloudSiteId
+ + "/"
+ + tenantId
+ + ": "
+ + me;
+ LOGGER.recordMetricEvent(deleteStackStarttime, MsoLogger.StatusCode.ERROR,
+ MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "DeleteStack", null);
+ LOGGER.error(MessageEnum.RA_DELETE_NETWORK_EXC, networkId, cloudSiteId, tenantId, "Openstack", "",
+ MsoLogger.ErrorCode.DataError, "Delete Network (heat)", me);
+ LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR,
+ MsoLogger.ResponseCode.CommunicationError, error);
+ throw new NetworkException(me);
}
}
- } finally {
- db.close ();
}
// On success, nothing is returned.
@@ -1608,80 +1690,89 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
// rollback may be null (e.g. if network already existed when Create was called)
// Get a handle to the Catalog Database
- CatalogDatabase db = getCatalogDB ();
// Make sure DB connection is always closed
- try {
+ try (CatalogDatabase db = getCatalogDB()) {
// Retrieve the Network Resource definition
NetworkResource networkResource = null;
if (isNullOrEmpty(modelCustomizationUuid)) {
- networkResource = db.getNetworkResource (networkType);
- }
- else
- {
+ networkResource = db.getNetworkResource(networkType);
+ } else {
networkResource = db.getNetworkResourceByModelCustUuid(modelCustomizationUuid);
}
String mode = "";
if (networkResource != null) {
- LOGGER.debug ("Got Network definition from Catalog: " + networkResource.toString ());
+ LOGGER.debug("Got Network definition from Catalog: " + networkResource.toString());
- mode = networkResource.getOrchestrationMode ();
+ mode = networkResource.getOrchestrationMode();
}
- if (rollback.getNetworkCreated ()) {
+ if (rollback.getNetworkCreated()) {
// Rolling back a newly created network, so delete it.
- if (NEUTRON_MODE.equals (mode)) {
+ if (NEUTRON_MODE.equals(mode)) {
// Use MsoNeutronUtils for all NEUTRON commands
- MsoNeutronUtils neutron = new MsoNeutronUtils (MSO_PROP_NETWORK_ADAPTER, cloudConfigFactory);
- long deleteNetworkStarttime = System.currentTimeMillis ();
+ MsoNeutronUtils neutron = new MsoNeutronUtils(MSO_PROP_NETWORK_ADAPTER, cloudConfigFactory);
+ long deleteNetworkStarttime = System.currentTimeMillis();
try {
// The deleteNetwork function in MsoNeutronUtils returns success if the network
// was not found. So don't bother to query first.
- neutron.deleteNetwork (networkId, tenantId, cloudSiteId);
- LOGGER.recordMetricEvent (deleteNetworkStarttime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from Open Stack", "OpenStack", "DeleteNetwork", null);
+ neutron.deleteNetwork(networkId, tenantId, cloudSiteId);
+ LOGGER.recordMetricEvent(deleteNetworkStarttime, MsoLogger.StatusCode.COMPLETE,
+ MsoLogger.ResponseCode.Suc, "Successfully received response from Open Stack", "OpenStack",
+ "DeleteNetwork", null);
} catch (MsoException me) {
- me.addContext ("RollbackNetwork");
+ me.addContext("RollbackNetwork");
String error = "Rollback Network (neutron): " + networkId
- + " in "
- + cloudSiteId
- + "/"
- + tenantId
- + ": "
- + me;
- LOGGER.recordMetricEvent (deleteNetworkStarttime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "DeleteNetwork", null);
- LOGGER.error (MessageEnum.RA_DELETE_NETWORK_EXC, networkId, cloudSiteId, tenantId, "OpenStack", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - Rollback Network (neutron)", me);
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
- throw new NetworkException (me);
+ + " in "
+ + cloudSiteId
+ + "/"
+ + tenantId
+ + ": "
+ + me;
+ LOGGER.recordMetricEvent(deleteNetworkStarttime, MsoLogger.StatusCode.ERROR,
+ MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "DeleteNetwork", null);
+ LOGGER
+ .error(MessageEnum.RA_DELETE_NETWORK_EXC, networkId, cloudSiteId, tenantId, "OpenStack", "",
+ MsoLogger.ErrorCode.BusinessProcesssError, "Exception - Rollback Network (neutron)",
+ me);
+ LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR,
+ MsoLogger.ResponseCode.CommunicationError, error);
+ throw new NetworkException(me);
}
} else { // DEFAULT to if ("HEAT".equals (mode))
// Use MsoHeatUtils for all HEAT commands
- MsoHeatUtils heat = new MsoHeatUtils (MSO_PROP_NETWORK_ADAPTER, msoPropertiesFactory,cloudConfigFactory);
- long deleteStackStarttime = System.currentTimeMillis ();
+ MsoHeatUtils heat = new MsoHeatUtils(MSO_PROP_NETWORK_ADAPTER, msoPropertiesFactory,
+ cloudConfigFactory);
+ long deleteStackStarttime = System.currentTimeMillis();
try {
// The deleteStack function in MsoHeatUtils returns success if the stack
// was not found. So don't bother to query first.
- heat.deleteStack (tenantId, cloudSiteId, networkId, true);
- LOGGER.recordMetricEvent (deleteStackStarttime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from Open Stack", "OpenStack", "DeleteStack", null);
+ heat.deleteStack(tenantId, cloudSiteId, networkId, true);
+ LOGGER.recordMetricEvent(deleteStackStarttime, MsoLogger.StatusCode.COMPLETE,
+ MsoLogger.ResponseCode.Suc, "Successfully received response from Open Stack", "OpenStack",
+ "DeleteStack", null);
} catch (MsoException me) {
- me.addContext ("RollbackNetwork");
+ me.addContext("RollbackNetwork");
String error = "Rollback Network (heat): " + networkId
- + " in "
- + cloudSiteId
- + "/"
- + tenantId
- + ": "
- + me;
- LOGGER.recordMetricEvent (deleteStackStarttime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "DeleteStack", null);
- LOGGER.error (MessageEnum.RA_DELETE_NETWORK_EXC, networkId, cloudSiteId, tenantId, "OpenStack", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - Rollback Network (heat)", me);
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
- throw new NetworkException (me);
+ + " in "
+ + cloudSiteId
+ + "/"
+ + tenantId
+ + ": "
+ + me;
+ LOGGER.recordMetricEvent(deleteStackStarttime, MsoLogger.StatusCode.ERROR,
+ MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "DeleteStack", null);
+ LOGGER
+ .error(MessageEnum.RA_DELETE_NETWORK_EXC, networkId, cloudSiteId, tenantId, "OpenStack", "",
+ MsoLogger.ErrorCode.BusinessProcesssError, "Exception - Rollback Network (heat)", me);
+ LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR,
+ MsoLogger.ResponseCode.CommunicationError, error);
+ throw new NetworkException(me);
}
}
}
- } finally {
- db.close ();
}
LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully rolled back network");
return;