-/*-
+/**
* ============LICENSE_START=======================================================
- * MODEL LOADER SERVICE
+ * Model Loader
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 2017 AT&T Intellectual Property.
+ * Copyright © 2017 Amdocs
+ * 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
- *
+ * 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=========================================================
+ *
+ * ECOMP and OpenECOMP are trademarks
+ * and service marks of AT&T Intellectual Property.
*/
-
package org.openecomp.modelloader.notification;
import org.openecomp.sdc.api.IDistributionClient;
import org.openecomp.modelloader.entity.Artifact;
import org.openecomp.modelloader.entity.catalog.VnfCatalogArtifact;
import org.openecomp.modelloader.entity.catalog.VnfCatalogArtifactHandler;
+import org.openecomp.modelloader.entity.model.IModelParser;
import org.openecomp.modelloader.entity.model.ModelArtifactHandler;
-import org.openecomp.modelloader.entity.model.ModelArtifactParser;
+import org.openecomp.modelloader.entity.model.ModelParserFactory;
import org.openecomp.modelloader.service.ModelLoaderMsgs;
import org.slf4j.MDC;
List<IArtifactInfo> artifacts = getArtifacts(data);
List<Artifact> modelArtifacts = new ArrayList<Artifact>();
List<Artifact> catalogArtifacts = new ArrayList<Artifact>();
- ModelArtifactParser modelArtParser = new ModelArtifactParser();
for (IArtifactInfo artifact : artifacts) {
// Grab the current time so we can measure the download time for the
break;
}
- logger.debug("Artifact: " + artifact.getArtifactName() + " Payload:\n" + new String(downloadResult.getArtifactPayload()));
+ logger.info(ModelLoaderMsgs.DISTRIBUTION_EVENT,
+ "Downloaded artifact: " + artifact.getArtifactName() + " Payload:\n" + new String(downloadResult.getArtifactPayload()));
publishDownloadSuccess(data, artifact, downloadResult);
- if ((artifact.getArtifactType()
- .compareToIgnoreCase(ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.toString()) == 0)
- || (artifact.getArtifactType()
- .compareToIgnoreCase(ArtifactTypeEnum.MODEL_QUERY_SPEC.toString()) == 0)) {
- modelArtifacts.addAll(modelArtParser.parse(downloadResult.getArtifactPayload(),
- downloadResult.getArtifactName()));
+ if ((artifact.getArtifactType().compareToIgnoreCase(ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.toString()) == 0)
+ || (artifact.getArtifactType().compareToIgnoreCase(ArtifactTypeEnum.MODEL_QUERY_SPEC.toString()) == 0)) {
+ IModelParser parser = ModelParserFactory.createModelParser(downloadResult.getArtifactPayload(), downloadResult.getArtifactName());
+ List<Artifact> parsedArtifacts = parser.parse(downloadResult.getArtifactPayload(), downloadResult.getArtifactName());
+ if (parsedArtifacts != null && !parsedArtifacts.isEmpty()) {
+ modelArtifacts.addAll(parsedArtifacts);
+ } else {
+ success = false;
+ publishDeployFailure(data, artifact);
+ break;
+ }
} else if (artifact.getArtifactType()
.compareToIgnoreCase(ArtifactTypeEnum.VNF_CATALOG.toString()) == 0) {
catalogArtifacts
}
}
}
+ } else {
+ statusString = "FAILURE";
}
auditLogger.info(ModelLoaderMsgs.DISTRIBUTION_EVENT,
metricsLogger.info(ModelLoaderMsgs.EVENT_PUBLISHED, null, override, "download success",
artifact.getArtifactName(), sendDownloadStatus.getDistributionActionResult().toString());
- logger.info(ModelLoaderMsgs.DISTRIBUTION_EVENT,
- "Downloaded artifact: " + artifact.getArtifactName());
-
if (sendDownloadStatus.getDistributionActionResult() != DistributionActionResultEnum.SUCCESS) {
logger.error(ModelLoaderMsgs.DISTRIBUTION_EVENT_ERROR,
"Failed to publish download success status: "