import java.nio.file.Paths;
import java.util.List;
import java.util.Optional;
-import org.onap.sdc.tosca.parser.impl.SdcPropertyNames;
-import org.onap.sdc.toscaparser.api.elements.Metadata;
-import org.onap.so.asdc.util.ZipParser;
-import org.onap.so.logger.LoggingAnchor;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.sdc.api.IDistributionClient;
import org.onap.sdc.api.consumer.IDistributionStatusMessage;
import org.onap.sdc.api.results.IDistributionClientDownloadResult;
import org.onap.sdc.api.results.IDistributionClientResult;
import org.onap.sdc.impl.DistributionClientFactory;
+import org.onap.sdc.tosca.parser.impl.SdcPropertyNames;
+import org.onap.sdc.toscaparser.api.elements.Metadata;
import org.onap.sdc.utils.DistributionActionResultEnum;
import org.onap.sdc.utils.DistributionStatusEnum;
import org.onap.so.asdc.activity.DeployActivitySpecs;
import org.onap.so.asdc.tenantIsolation.DistributionStatus;
import org.onap.so.asdc.tenantIsolation.WatchdogDistribution;
import org.onap.so.asdc.util.ASDCNotificationLogging;
+import org.onap.so.asdc.util.ZipParser;
import org.onap.so.db.request.beans.WatchdogComponentDistributionStatus;
import org.onap.so.db.request.beans.WatchdogDistributionStatus;
import org.onap.so.db.request.data.repository.WatchdogComponentDistributionStatusRepository;
import org.onap.so.db.request.data.repository.WatchdogDistributionStatusRepository;
-import org.onap.so.logger.ErrorCode;
+import org.onap.so.logger.LoggingAnchor;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
this.controllerName = controllerConfigName;
}
+ public ASDCConfiguration getASDCConfiguration() {
+ return asdcConfig;
+ }
+
public int getNbOfNotificationsOngoing() {
return nbOfNotificationsOngoing;
}
}
// process NsstResource
this.processNsstNotification(iNotif, toscaResourceStructure);
+
+ if (iNotif.getResources().isEmpty()) {
+ logger.error("Service Model contains no resources.");
+ return;
+ }
+
for (IResourceInstance resource : iNotif.getResources()) {
String resourceType = resource.getResourceType();
*/
public String getAddress() {
if (asdcConfig != null) {
- return asdcConfig.getAsdcAddress();
+ return asdcConfig.getSdcAddress();
}
return UNKNOWN;
}
private void processNsstNotification(INotificationData iNotif, ToscaResourceStructure toscaResourceStructure) {
Metadata serviceMetadata = toscaResourceStructure.getServiceMetadata();
try {
- if (serviceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_CATEGORY).equalsIgnoreCase("NSST")) {
-
+ String category = serviceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_CATEGORY);
+ boolean isNeedInital = (category.contains("NSST") || category.equalsIgnoreCase("TN Network Requirement"))
+ && iNotif.getResources().isEmpty();
+ if (isNeedInital) {
String artifactContent = null;
List<IArtifactInfo> serviceArtifacts = iNotif.getServiceArtifacts();
Optional<IArtifactInfo> artifactOpt = serviceArtifacts.stream()
- .filter(e -> e.getArtifactType().equalsIgnoreCase("OTHER")).findFirst();
+ .filter(e -> e.getArtifactType().equalsIgnoreCase("WORKFLOW")).findFirst();
if (artifactOpt.isPresent()) {
IArtifactInfo artifactInfo = artifactOpt.get();
logger.debug("Ready to parse this serviceArtifactUUID: " + artifactInfo.getArtifactUUID());
artifactContent = zipParserInstance.parseJsonForZip(filePath);
logger.debug(
"serviceArtifact parsing success! serviceArtifactUUID: " + artifactInfo.getArtifactUUID());
+
+ ResourceStructure resourceStructure = new VfResourceStructure(iNotif, new ResourceInstance());
+ resourceStructure.setResourceType(ResourceType.OTHER);
+ toscaInstaller.installNsstService(toscaResourceStructure, (VfResourceStructure) resourceStructure,
+ artifactContent);
} else {
logger.debug("serviceArtifact is null");
+ toscaInstaller.installNsstService(toscaResourceStructure, null, null);
}
- ResourceStructure resourceStructure = new VfResourceStructure(iNotif, new ResourceInstance());
- resourceStructure.setResourceType(ResourceType.OTHER);
- toscaInstaller.installTheNsstService(toscaResourceStructure, (VfResourceStructure) resourceStructure,
- artifactContent);
+
}
+
} catch (IOException e) {
logger.error("serviceArtifact parse failure for service uuid: "
+ serviceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_CATEGORY));