diff options
author | Michael Lando <ml636r@att.com> | 2017-02-19 12:35:04 +0200 |
---|---|---|
committer | Michael Lando <ml636r@att.com> | 2017-02-19 12:35:04 +0200 |
commit | f5f13c4f6b6fe3b4d98e349dfd7db59339803436 (patch) | |
tree | 72caffc93fab394ffa3b761505775331f1c559b9 /openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src | |
parent | 451a3400b76511393c62a444f588a4ed15f4a549 (diff) |
push addional code
Change-Id: Ia427bb3460cda3a896f8faced2de69eaf3807b74
Signed-off-by: Michael Lando <ml636r@att.com>
Diffstat (limited to 'openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src')
188 files changed, 25121 insertions, 0 deletions
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/VendorSoftwareProductManager.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/VendorSoftwareProductManager.java new file mode 100644 index 0000000000..0d38d165c2 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/VendorSoftwareProductManager.java @@ -0,0 +1,173 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 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 org.openecomp.sdc.vendorsoftwareproduct; + +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NetworkEntity; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.PackageInfo; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails; +import org.openecomp.sdc.vendorsoftwareproduct.types.CompositionEntityResponse; +import org.openecomp.sdc.vendorsoftwareproduct.types.CompositionEntityValidationData; +import org.openecomp.sdc.vendorsoftwareproduct.types.QuestionnaireResponse; +import org.openecomp.sdc.vendorsoftwareproduct.types.UploadFileResponse; +import org.openecomp.sdc.vendorsoftwareproduct.types.ValidationResponse; +import org.openecomp.sdc.vendorsoftwareproduct.types.VersionedVendorSoftwareProductInfo; +import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComponentData; +import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Network; +import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Nic; +import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.MibUploadStatus; +import org.openecomp.sdc.versioning.dao.types.Version; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.util.Collection; +import java.util.List; + +public interface VendorSoftwareProductManager { + + Version checkout(String vendorSoftwareProductId, String user); + + Version undoCheckout(String vendorSoftwareProductId, String user); + + Version checkin(String vendorSoftwareProductId, String user); + + ValidationResponse submit(String vendorSoftwareProductId, String user) throws IOException; + + + VspDetails createNewVsp(VspDetails vspDetails, String user); + + List<VersionedVendorSoftwareProductInfo> getVspList(String versionFilter, String user); + + void updateVsp(VspDetails vspDetails, String user); + + VersionedVendorSoftwareProductInfo getVspDetails(String vspId, Version version, String user); + + void deleteVsp(String vspIdToDelete, String user); + + + UploadFileResponse uploadFile(String vspId, InputStream heatFileToUpload, String user); + + PackageInfo createPackage(String vspId, String user) throws IOException; + + List<PackageInfo> listPackages(String category, String subCategory); + + File getTranslatedFile(String vspId, Version version, String user); + + File getLatestHeatPackage(String vspId, String user); + + QuestionnaireResponse getVspQuestionnaire(String vspId, Version version, String user); + + void updateVspQuestionnaire(String vspId, String questionnaireData, String user); + + + Collection<NetworkEntity> listNetworks(String vspId, Version version, String user); + + NetworkEntity createNetwork(NetworkEntity network, String user); + + CompositionEntityValidationData updateNetwork(NetworkEntity networkEntity, String user); + + CompositionEntityResponse<Network> getNetwork(String vspId, Version version, String networkId, + String user); + + void deleteNetwork(String vspId, String networkId, String user); + + + QuestionnaireResponse getComponentQuestionnaire(String vspId, Version version, String componentId, + String user); + + void updateComponentQuestionnaire(String vspId, String componentId, String questionnaireData, + String user); + + + Collection<ComponentEntity> listComponents(String vspId, Version version, String user); + + void deleteComponents(String vspId, String user); + + ComponentEntity createComponent(ComponentEntity componentEntity, String user); + + CompositionEntityValidationData updateComponent(ComponentEntity componentEntity, String user); + + CompositionEntityResponse<ComponentData> getComponent(String vspId, Version version, + String componentId, String user); + + void deleteComponent(String vspId, String componentId, String user); + + + Collection<org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity> listProcesses( + String vspId, Version version, String componentId, + String user); + + void deleteProcesses(String vspId, String componentId, String user); + + org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity createProcess( + org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity processEntity, String user); + + org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity getProcess(String vspId, + Version version, + String componentId, + String processId, + String user); + + void updateProcess(org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity processEntity, + String user); + + void deleteProcess(String vspId, String componentId, String processId, String user); + + + File getProcessArtifact(String vspId, Version version, String componentId, String processId, + String user); + + void deleteProcessArtifact(String vspId, String componentId, String processId, String user); + + void uploadProcessArtifact(InputStream uploadFile, String fileName, String vspId, + String componentId, String processId, String user); + + + Collection<org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity> listNics(String vspId, + Version version, + String componentId, + String user); + + org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity createNic( + org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity nic, String user); + + CompositionEntityValidationData updateNic( + org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity nicEntity, String user); + + CompositionEntityResponse<Nic> getNic(String vspId, Version version, String componentId, + String nicId, String user); + + void deleteNic(String vspId, String componentId, String nicId, String user); + + QuestionnaireResponse getNicQuestionnaire(String vspId, Version version, String componentId, + String nicId, String user); + + void updateNicQuestionnaire(String vspId, String componentId, String nicId, + String questionnaireData, String user); + + void deleteComponentMib(String vspId, String componentId, boolean isTrap, String user); + + void uploadComponentMib(InputStream object, String filename, String vspId, String componentId, + boolean isTrap, String user); + + MibUploadStatus listMibFilenames(String vspId, String componentId, String user); +} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/CreatePackageForNonFinalVendorSoftwareProductErrorBuilder.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/CreatePackageForNonFinalVendorSoftwareProductErrorBuilder.java new file mode 100644 index 0000000000..527530d4de --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/CreatePackageForNonFinalVendorSoftwareProductErrorBuilder.java @@ -0,0 +1,59 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 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 org.openecomp.sdc.vendorsoftwareproduct.errors; + +import org.openecomp.sdc.common.errors.ErrorCategory; +import org.openecomp.sdc.common.errors.ErrorCode; +import org.openecomp.sdc.versioning.dao.types.Version; + +/** + * The type Create package for non final vendor software product error builder. + */ +public class CreatePackageForNonFinalVendorSoftwareProductErrorBuilder { + + private static final String CREATE_PACKAGE_FOR_NON_FINAL_VSP_MSG = + "Package creation for vendor software product with id %s and version %s is not allowed " + + "since it is not final (submitted)."; + private final ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder(); + + /** + * Instantiates a new Create package for non final vendor software product error builder. + * + * @param vendorSoftwareProductId the vendor software product id + * @param version the version + */ + public CreatePackageForNonFinalVendorSoftwareProductErrorBuilder(String vendorSoftwareProductId, + Version version) { + builder.withId(VendorSoftwareProductErrorCodes.CREATE_PACKAGE_FOR_NON_FINAL_VSP); + builder.withCategory(ErrorCategory.APPLICATION); + builder.withMessage(String + .format(CREATE_PACKAGE_FOR_NON_FINAL_VSP_MSG, vendorSoftwareProductId, version.toString())); + } + + /** + * Build error code. + * + * @return the error code + */ + public ErrorCode build() { + return builder.build(); + } +} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/FileCreationErrorBuilder.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/FileCreationErrorBuilder.java new file mode 100644 index 0000000000..5a40609270 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/FileCreationErrorBuilder.java @@ -0,0 +1,56 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 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 org.openecomp.sdc.vendorsoftwareproduct.errors; + +import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.HEAT_PACKAGE_FILE_CREATION; + +import org.openecomp.sdc.common.errors.ErrorCategory; +import org.openecomp.sdc.common.errors.ErrorCode; + +/** + * The type File creation error builder. + */ +public class FileCreationErrorBuilder { + private static final String HEAT_PKG_FILE_CREATION_ERROR_MSG = + "Error while trying to create heat file from the package of vendor software product " + + "with Id %s."; + private final ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder(); + + /** + * Instantiates a new File creation error builder. + * + * @param vendorSoftwareProductId the vendor software product id + */ + public FileCreationErrorBuilder(String vendorSoftwareProductId) { + builder.withId(HEAT_PACKAGE_FILE_CREATION); + builder.withCategory(ErrorCategory.SYSTEM); + builder.withMessage(String.format(HEAT_PKG_FILE_CREATION_ERROR_MSG, vendorSoftwareProductId)); + } + + /** + * Build error code. + * + * @return the error code + */ + public ErrorCode build() { + return builder.build(); + } +} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/MibUploadErrorBuilder.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/MibUploadErrorBuilder.java new file mode 100644 index 0000000000..75a4aa3ff7 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/MibUploadErrorBuilder.java @@ -0,0 +1,59 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 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 org.openecomp.sdc.vendorsoftwareproduct.errors; + +import org.openecomp.sdc.common.errors.BaseErrorBuilder; +import org.openecomp.sdc.common.errors.ErrorCategory; + +/** + * The type Mib upload error builder. + */ +public class MibUploadErrorBuilder extends BaseErrorBuilder { + private static final String UPLOAD_INVALID_DETAILED_MSG = + "MIB uploaded for vendor software product with Id %s and version %s is invalid: %s"; + + + /** + * Instantiates a new Mib upload error builder. + * + * @param vendorSoftwareProductId the vendor software product id + * @param version the version + * @param error the error + */ + public MibUploadErrorBuilder(String vendorSoftwareProductId, org.openecomp.sdc.versioning.dao + .types.Version version, String error) { + getErrorCodeBuilder().withId(VendorSoftwareProductErrorCodes.MIB_UPLOAD_INVALID); + getErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION); + getErrorCodeBuilder().withMessage(String + .format(UPLOAD_INVALID_DETAILED_MSG, vendorSoftwareProductId, version.toString(), error)); + } + + /** + * Instantiates a new Mib upload error builder. + * + * @param errorMessage the error message + */ + public MibUploadErrorBuilder(String errorMessage) { + getErrorCodeBuilder().withId(VendorSoftwareProductErrorCodes.MIB_UPLOAD_INVALID); + getErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION); + getErrorCodeBuilder().withMessage(errorMessage); + } +} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/PackageInvalidErrorBuilder.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/PackageInvalidErrorBuilder.java new file mode 100644 index 0000000000..279dbfe4ea --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/PackageInvalidErrorBuilder.java @@ -0,0 +1,60 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 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 org.openecomp.sdc.vendorsoftwareproduct.errors; + +import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes + .PACKAGE_INVALID; + +import org.openecomp.sdc.common.errors.ErrorCategory; +import org.openecomp.sdc.common.errors.ErrorCode; +import org.openecomp.sdc.versioning.dao.types.Version; + +/** + * The type Package invalid error builder. + */ +public class PackageInvalidErrorBuilder { + private static final String PACKAGE_INVALID_MSG = + "Package for vendor software product with Id %s and version %s is invalid " + + "(does not contain translated data)."; + private final ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder(); + + /** + * Instantiates a new Package invalid error builder. + * + * @param vendorSoftwareProductId the vendor software product id + * @param version the version + */ + public PackageInvalidErrorBuilder(String vendorSoftwareProductId, Version version) { + builder.withId(PACKAGE_INVALID); + builder.withCategory(ErrorCategory.APPLICATION); + builder.withMessage( + String.format(PACKAGE_INVALID_MSG, vendorSoftwareProductId, version.toString())); + } + + /** + * Build error code. + * + * @return the error code + */ + public ErrorCode build() { + return builder.build(); + } +} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/PackageNotFoundErrorBuilder.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/PackageNotFoundErrorBuilder.java new file mode 100644 index 0000000000..3a32fa30b1 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/PackageNotFoundErrorBuilder.java @@ -0,0 +1,71 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 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 org.openecomp.sdc.vendorsoftwareproduct.errors; + +import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.PACKAGE_NOT_FOUND; + +import org.openecomp.sdc.common.errors.ErrorCategory; +import org.openecomp.sdc.common.errors.ErrorCode; +import org.openecomp.sdc.versioning.dao.types.Version; + +/** + * The type Package not found error builder. + */ +public class PackageNotFoundErrorBuilder { + private static final String PACKAGE_VERSION_NOT_FOUND_MSG = + "Package for vendor software product with Id %s and version %s does not exist."; + private static final String PACKAGE_NOT_FOUND_MSG = + "Package for vendor software product with Id %s does not exist."; + private final ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder(); + + /** + * Instantiates a new Package not found error builder. + * + * @param vendorSoftwareProductId the vendor software product id + * @param version the version + */ + public PackageNotFoundErrorBuilder(String vendorSoftwareProductId, Version version) { + builder.withId(PACKAGE_NOT_FOUND); + builder.withCategory(ErrorCategory.APPLICATION); + builder.withMessage( + String.format(PACKAGE_VERSION_NOT_FOUND_MSG, vendorSoftwareProductId, version.toString())); + } + + /** + * Instantiates a new Package not found error builder. + * + * @param vendorSoftwareProductId the vendor software product id + */ + public PackageNotFoundErrorBuilder(String vendorSoftwareProductId) { + builder.withId(PACKAGE_NOT_FOUND); + builder.withCategory(ErrorCategory.APPLICATION); + builder.withMessage(String.format(PACKAGE_NOT_FOUND_MSG, vendorSoftwareProductId)); + } + + /** + * Build error code. + * + * @return the error code + */ + public ErrorCode build() { + return builder.build(); + } +} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/TranslationFileCreationErrorBuilder.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/TranslationFileCreationErrorBuilder.java new file mode 100644 index 0000000000..2267e1d80a --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/TranslationFileCreationErrorBuilder.java @@ -0,0 +1,60 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 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 org.openecomp.sdc.vendorsoftwareproduct.errors; + +import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes + .TRANSLATION_FILE_CREATION; + +import org.openecomp.sdc.common.errors.ErrorCategory; +import org.openecomp.sdc.common.errors.ErrorCode; +import org.openecomp.sdc.versioning.dao.types.Version; + +/** + * The type Translation file creation error builder. + */ +public class TranslationFileCreationErrorBuilder { + private static final String TRANSLATION_FILE_CREATION_ERROR_MSG = + "Error while trying to create translation file from the package of vendor software " + + "product with Id %s and version %s."; + private final ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder(); + + /** + * Instantiates a new Translation file creation error builder. + * + * @param vendorSoftwareProductId the vendor software product id + * @param version the version + */ + public TranslationFileCreationErrorBuilder(String vendorSoftwareProductId, Version version) { + builder.withId(TRANSLATION_FILE_CREATION); + builder.withCategory(ErrorCategory.SYSTEM); + builder.withMessage(String + .format(TRANSLATION_FILE_CREATION_ERROR_MSG, vendorSoftwareProductId, version.toString())); + } + + /** + * Build error code. + * + * @return the error code + */ + public ErrorCode build() { + return builder.build(); + } +} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/UploadInvalidErrorBuilder.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/UploadInvalidErrorBuilder.java new file mode 100644 index 0000000000..0974af1c6a --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/UploadInvalidErrorBuilder.java @@ -0,0 +1,82 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 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 org.openecomp.sdc.vendorsoftwareproduct.errors; + +import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes + .UPLOAD_INVALID; + +import org.openecomp.sdc.common.errors.BaseErrorBuilder; +import org.openecomp.sdc.common.errors.ErrorCategory; +import org.openecomp.sdc.datatypes.error.ErrorMessage; +import org.openecomp.sdc.versioning.dao.types.Version; + +import java.util.List; +import java.util.Map; + +/** + * The type Upload invalid error builder. + */ +public class UploadInvalidErrorBuilder extends BaseErrorBuilder { + private static final String UPLOAD_INVALID_DETAILED_MSG = + "File uploaded for vendor software product with Id %s and version %s is invalid: %s"; + private static final String UPLOAD_INVALID_MSG = "Uploaded file is invalid"; + + /** + * Instantiates a new Upload invalid error builder. + * + * @param vendorSoftwareProductId the vendor software product id + * @param version the version + * @param errors the errors + */ + public UploadInvalidErrorBuilder(String vendorSoftwareProductId, Version version, + Map<String, List<ErrorMessage>> errors) { + getErrorCodeBuilder().withId(UPLOAD_INVALID); + getErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION); + getErrorCodeBuilder().withMessage(String + .format(UPLOAD_INVALID_DETAILED_MSG, vendorSoftwareProductId, version.toString(), + toString(errors))); + } + + /** + * Instantiates a new Upload invalid error builder. + */ + public UploadInvalidErrorBuilder() { + getErrorCodeBuilder().withId(UPLOAD_INVALID); + getErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION); + getErrorCodeBuilder().withMessage(UPLOAD_INVALID_MSG); + } + + private String toString(Map<String, List<ErrorMessage>> errors) { + StringBuffer sb = new StringBuffer(); + errors.entrySet().stream() + .forEach(entry -> singleErrorToString(sb, entry.getKey(), entry.getValue())); + return sb.toString(); + } + + private void singleErrorToString(StringBuffer sb, String fileName, List<ErrorMessage> errors) { + sb.append(System.lineSeparator()); + sb.append(fileName); + sb.append(sb.append(": ")); + errors.stream().forEach( + error -> sb.append(error.getMessage()).append("[").append(error.getLevel()).append("], ")); + } + +} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/VendorSoftwareProductErrorCodes.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/VendorSoftwareProductErrorCodes.java new file mode 100644 index 0000000000..369e99d75f --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/VendorSoftwareProductErrorCodes.java @@ -0,0 +1,48 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 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 org.openecomp.sdc.vendorsoftwareproduct.errors; + +public class VendorSoftwareProductErrorCodes { + + public static final String VSP_NOT_FOUND = "VSP_NOT_FOUND"; + public static final String VSP_INVALID = "VSP_INVALID"; + + public static final String UPLOAD_INVALID = "UPLOAD_INVALID"; + + public static final String PACKAGE_NOT_FOUND = "PACKAGE_NOT_FOUND"; + + public static final String PACKAGE_INVALID = "PACKAGE_INVALID"; + public static final String VSP_COMPOSITION_EDIT_NOT_ALLOWED = "VSP_COMPOSITION_EDIT_NOT_ALLOWED"; + + public static final String CREATE_PACKAGE_FOR_NON_FINAL_VSP = "CREATE_PACKAGE_FOR_NON_FINAL_VSP"; + + public static final String TRANSLATION_FILE_CREATION = "TRANSLATION_FILE_CREATION"; + + public static final String HEAT_PACKAGE_FILE_CREATION = "HEAT_PACKAGE_FILE_CREATION"; + + public static final String TOSCA_ENTRY_NOT_FOUND = "TOSCA_ENTRY_NOT_FOUND"; + public static final String TOSCA_INVALID_SUBSTITUTE_NODE_TEMPLATE = + "TOSCA_INVALID_SUBSTITUTE_NODE_TEMPLATE"; + + public static final String MIB_UPLOAD_INVALID = "MIB_UPLOAD_INVALID"; + + +} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/VendorSoftwareProductInvalidErrorBuilder.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/VendorSoftwareProductInvalidErrorBuilder.java new file mode 100644 index 0000000000..1439563b17 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/VendorSoftwareProductInvalidErrorBuilder.java @@ -0,0 +1,60 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 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 org.openecomp.sdc.vendorsoftwareproduct.errors; + +import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.VSP_INVALID; + +import org.openecomp.sdc.common.errors.ErrorCategory; +import org.openecomp.sdc.common.errors.ErrorCode; +import org.openecomp.sdc.versioning.dao.types.Version; + + +/** + * The type Vendor software product invalid error builder. + */ +public class VendorSoftwareProductInvalidErrorBuilder { + private static final String VSP_INVALID_MSG = + "Vendor software product with Id %s and version %s is invalid - does not contain " + + "service model."; + private final ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder(); + + /** + * Instantiates a new Vendor software product invalid error builder. + * + * @param vendorSoftwareProductId the vendor software product id + * @param version the version + */ + public VendorSoftwareProductInvalidErrorBuilder(String vendorSoftwareProductId, Version version) { + builder.withId(VSP_INVALID); + builder.withCategory(ErrorCategory.APPLICATION); + builder + .withMessage(String.format(VSP_INVALID_MSG, vendorSoftwareProductId, version.toString())); + } + + /** + * Build error code. + * + * @return the error code + */ + public ErrorCode build() { + return builder.build(); + } +} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/VendorSoftwareProductNotFoundErrorBuilder.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/VendorSoftwareProductNotFoundErrorBuilder.java new file mode 100644 index 0000000000..89fc08cdb0 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/VendorSoftwareProductNotFoundErrorBuilder.java @@ -0,0 +1,54 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 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 org.openecomp.sdc.vendorsoftwareproduct.errors; + +import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.VSP_NOT_FOUND; + +import org.openecomp.sdc.common.errors.ErrorCategory; +import org.openecomp.sdc.common.errors.ErrorCode; + +/** + * The type Vendor software product not found error builder. + */ +public class VendorSoftwareProductNotFoundErrorBuilder { + private static final String VSP_FOUND_MSG = "Vendor software product with Id %s not found."; + private final ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder(); + + /** + * Instantiates a new Vendor software product not found error builder. + * + * @param vendorSoftwareProductId the vendor software product id + */ + public VendorSoftwareProductNotFoundErrorBuilder(String vendorSoftwareProductId) { + builder.withId(VSP_NOT_FOUND); + builder.withCategory(ErrorCategory.APPLICATION); + builder.withMessage(String.format(VSP_FOUND_MSG, vendorSoftwareProductId)); + } + + /** + * Build error code. + * + * @return the error code + */ + public ErrorCode build() { + return builder.build(); + } +} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java new file mode 100644 index 0000000000..191c8d728c --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java @@ -0,0 +1,1567 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 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 org.openecomp.sdc.vendorsoftwareproduct.impl; + +import static org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants.CSAR; +import static org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants.GENERAL_COMPONENT_ID; +import static org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants.UPLOAD_RAW_DATA; +import static org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants.VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE; +import static org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants.VSP_PACKAGE_ZIP; + +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.collections4.MapUtils; +import org.openecomp.core.enrichment.EnrichmentArtifactsServiceFactory; +import org.openecomp.core.enrichment.api.EnrichmentManager; +import org.openecomp.core.enrichment.enrichmentartifacts.EnrichmentArtifactsService; +import org.openecomp.core.enrichment.factory.EnrichmentManagerFactory; +import org.openecomp.core.enrichment.types.ComponentArtifactType; +import org.openecomp.core.model.dao.EnrichedServiceModelDao; +import org.openecomp.core.model.dao.EnrichedServiceModelDaoFactory; +import org.openecomp.core.model.dao.ServiceModelDao; +import org.openecomp.core.model.dao.ServiceModelDaoFactory; +import org.openecomp.core.model.types.ServiceElement; +import org.openecomp.core.util.UniqueValueUtil; +import org.openecomp.core.utilities.CommonMethods; +import org.openecomp.core.utilities.file.FileContentHandler; +import org.openecomp.core.utilities.file.FileUtils; +import org.openecomp.core.utilities.json.JsonSchemaDataGenerator; +import org.openecomp.core.utilities.json.JsonUtil; +import org.openecomp.core.validation.api.ValidationManager; +import org.openecomp.core.validation.errors.Messages; +import org.openecomp.core.validation.types.MessageContainerUtil; +import org.openecomp.sdc.common.errors.CoreException; +import org.openecomp.sdc.common.errors.ErrorCategory; +import org.openecomp.sdc.common.errors.ErrorCode; +import org.openecomp.sdc.common.errors.ValidationErrorBuilder; +import org.openecomp.sdc.common.utils.AsdcCommon; +import org.openecomp.sdc.datatypes.error.ErrorLevel; +import org.openecomp.sdc.datatypes.error.ErrorMessage; +import org.openecomp.sdc.enrichment.impl.tosca.ComponentInfo; +import org.openecomp.sdc.heat.datatypes.structure.HeatStructureTree; +import org.openecomp.sdc.heat.datatypes.structure.ValidationStructureList; +import org.openecomp.sdc.heat.services.tree.HeatTreeManager; +import org.openecomp.sdc.heat.services.tree.HeatTreeManagerUtil; +import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel; +import org.openecomp.sdc.tosca.services.impl.ToscaFileOutputServiceCsarImpl; +import org.openecomp.sdc.validation.utils.ValidationManagerUtil; +import org.openecomp.sdc.vendorlicense.VendorLicenseArtifactServiceFactory; +import org.openecomp.sdc.vendorlicense.facade.VendorLicenseFacade; +import org.openecomp.sdc.vendorlicense.facade.VendorLicenseFacadeFactory; +import org.openecomp.sdc.vendorlicense.licenseartifacts.VendorLicenseArtifactsService; +import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants; +import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductManager; +import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentArtifactDao; +import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentArtifactDaoFactory; +import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDao; +import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDaoFactory; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentArtifactEntity; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NetworkEntity; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.PackageInfo; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessArtifactEntity; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.UploadDataEntity; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspQuestionnaireEntity; +import org.openecomp.sdc.vendorsoftwareproduct.errors.CreatePackageForNonFinalVendorSoftwareProductErrorBuilder; +import org.openecomp.sdc.vendorsoftwareproduct.errors.FileCreationErrorBuilder; +import org.openecomp.sdc.vendorsoftwareproduct.errors.MibUploadErrorBuilder; +import org.openecomp.sdc.vendorsoftwareproduct.errors.PackageInvalidErrorBuilder; +import org.openecomp.sdc.vendorsoftwareproduct.errors.PackageNotFoundErrorBuilder; +import org.openecomp.sdc.vendorsoftwareproduct.errors.TranslationFileCreationErrorBuilder; +import org.openecomp.sdc.vendorsoftwareproduct.errors.UploadInvalidErrorBuilder; +import org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes; +import org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductInvalidErrorBuilder; +import org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductNotFoundErrorBuilder; +import org.openecomp.sdc.vendorsoftwareproduct.services.CompositionDataExtractor; +import org.openecomp.sdc.vendorsoftwareproduct.services.CompositionEntityDataManager; +import org.openecomp.sdc.vendorsoftwareproduct.services.SchemaGenerator; +import org.openecomp.sdc.vendorsoftwareproduct.types.CompositionEntityResponse; +import org.openecomp.sdc.vendorsoftwareproduct.types.CompositionEntityValidationData; +import org.openecomp.sdc.vendorsoftwareproduct.types.QuestionnaireResponse; +import org.openecomp.sdc.vendorsoftwareproduct.types.QuestionnaireValidationResult; +import org.openecomp.sdc.vendorsoftwareproduct.types.UploadFileResponse; +import org.openecomp.sdc.vendorsoftwareproduct.types.ValidationResponse; +import org.openecomp.sdc.vendorsoftwareproduct.types.VersionedVendorSoftwareProductInfo; +import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Component; +import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComponentData; +import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionData; +import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityId; +import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityType; +import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Network; +import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Nic; +import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.ComponentCompositionSchemaInput; +import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.ComponentQuestionnaireSchemaInput; +import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.MibUploadStatus; +import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.NetworkCompositionSchemaInput; +import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.NicCompositionSchemaInput; +import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.SchemaTemplateContext; +import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.SchemaTemplateInput; +import org.openecomp.sdc.vendorsoftwareproduct.util.CompilationUtil; +import org.openecomp.sdc.vendorsoftwareproduct.util.VendorSoftwareProductUtils; +import org.openecomp.sdc.versioning.VersioningManager; +import org.openecomp.sdc.versioning.VersioningManagerFactory; +import org.openecomp.sdc.versioning.VersioningUtil; +import org.openecomp.sdc.versioning.dao.types.Version; +import org.openecomp.sdc.versioning.dao.types.VersionStatus; +import org.openecomp.sdc.versioning.errors.RequestedVersionInvalidErrorBuilder; +import org.openecomp.sdc.versioning.types.VersionInfo; +import org.openecomp.sdc.versioning.types.VersionableEntityAction; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.nio.ByteBuffer; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * The type Vendor software product manager. + */ +public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductManager { + + private static final String VSP_COMPOSITION_EDIT_NOT_ALLOWED_MSG = + "Composition entities may not be created / deleted for Vendor Software Product whose " + + "entities were uploaded"; + + private static final VersioningManager versioningManager = + VersioningManagerFactory.getInstance().createInterface(); + private static final VendorSoftwareProductDao vendorSoftwareProductDao = + VendorSoftwareProductDaoFactory.getInstance().createInterface(); + private static final VendorLicenseFacade vendorLicenseFacade = + VendorLicenseFacadeFactory.getInstance().createInterface(); + private static final ComponentArtifactDao componentArtifactDao = + ComponentArtifactDaoFactory.getInstance().createInterface(); + private static final ServiceModelDao<ToscaServiceModel, ServiceElement> serviceModelDao = + ServiceModelDaoFactory.getInstance().createInterface(); + private static final EnrichedServiceModelDao<ToscaServiceModel, ServiceElement> + enrichedServiceModelDao = EnrichedServiceModelDaoFactory.getInstance().createInterface(); + private static VendorLicenseArtifactsService licenseArtifactsService = + VendorLicenseArtifactServiceFactory.getInstance().createInterface(); + private static EnrichmentArtifactsService enrichmentArtifactsService = + EnrichmentArtifactsServiceFactory.getInstance().createInterface(); + + + /** + * Instantiates a new Vendor software product manager. + */ + public VendorSoftwareProductManagerImpl() { + vendorSoftwareProductDao.registerVersioning(VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE); + serviceModelDao.registerVersioning(VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE); + enrichedServiceModelDao.registerVersioning(VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE); + componentArtifactDao.registerVersioning(VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE); + } + + private static List<ErrorCode> validateCompletedVendorSoftwareProduct(VspDetails vspDetails, + UploadDataEntity uploadData, + Object serviceModel) { + List<ErrorCode> errros = new ArrayList<>(); + + if (vspDetails.getName() == null) { + errros.add(createMissingMandatoryFieldError("name")); + } + if (vspDetails.getDescription() == null) { + errros.add(createMissingMandatoryFieldError("description")); + } + if (vspDetails.getVendorId() == null) { + errros.add(createMissingMandatoryFieldError("vendor Id")); + } + if (vspDetails.getVlmVersion() == null) { + errros.add(createMissingMandatoryFieldError( + "licensing version (in the format of: {integer}.{integer})")); + } + if (vspDetails.getCategory() == null) { + errros.add(createMissingMandatoryFieldError("category")); + } + if (vspDetails.getSubCategory() == null) { + errros.add(createMissingMandatoryFieldError("sub category")); + } + if (vspDetails.getLicenseAgreement() == null) { + errros.add(createMissingMandatoryFieldError("license agreement")); + } + if (CollectionUtils.isEmpty(vspDetails.getFeatureGroups())) { + errros.add(createMissingMandatoryFieldError("feature groups")); + } + if (uploadData == null || uploadData.getContentData() == null || serviceModel == null) { + errros.add( + new VendorSoftwareProductInvalidErrorBuilder(vspDetails.getId(), vspDetails.getVersion()) + .build()); + } + + return errros.isEmpty() ? null : errros; + } + + private static ErrorCode createMissingMandatoryFieldError(String fieldName) { + return new ValidationErrorBuilder("must be supplied", fieldName).build(); + } + + private static String getVspQuestionnaireSchema(SchemaTemplateInput schemaInput) { + return SchemaGenerator + .generate(SchemaTemplateContext.questionnaire, CompositionEntityType.vsp, schemaInput); + } + + private static String getComponentQuestionnaireSchema(SchemaTemplateInput schemaInput) { + return SchemaGenerator + .generate(SchemaTemplateContext.questionnaire, CompositionEntityType.component, + schemaInput); + } + + private static String getNicQuestionnaireSchema(SchemaTemplateInput schemaInput) { + return SchemaGenerator + .generate(SchemaTemplateContext.questionnaire, CompositionEntityType.nic, schemaInput); + } + + private static void sortVspListByModificationTimeDescOrder( + List<VersionedVendorSoftwareProductInfo> vendorLicenseModels) { + Collections.sort(vendorLicenseModels, new Comparator<VersionedVendorSoftwareProductInfo>() { + @Override + public int compare(VersionedVendorSoftwareProductInfo o1, + VersionedVendorSoftwareProductInfo o2) { + return o2.getVspDetails().getWritetimeMicroSeconds() + .compareTo(o1.getVspDetails().getWritetimeMicroSeconds()); + } + }); + } + + private boolean isManual(String vspId, Version version) { + return false; + } + + @Override + public Version checkout(String vendorSoftwareProductId, String user) { + Version newVersion = versioningManager + .checkout(VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE, vendorSoftwareProductId, user); + vendorSoftwareProductDao.updateVspLatestModificationTime(vendorSoftwareProductId, newVersion); + return newVersion; + } + + @Override + public Version undoCheckout(String vendorSoftwareProductId, String user) { + Version newVersion = versioningManager + .undoCheckout(VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE, vendorSoftwareProductId, user); + vendorSoftwareProductDao.updateVspLatestModificationTime(vendorSoftwareProductId, newVersion); + return newVersion; + } + + @Override + public Version checkin(String vendorSoftwareProductId, String user) { + Version newVersion = versioningManager + .checkin(VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE, vendorSoftwareProductId, user, null); + vendorSoftwareProductDao.updateVspLatestModificationTime(vendorSoftwareProductId, newVersion); + return newVersion; + } + + @Override + public ValidationResponse submit(String vendorSoftwareProductId, String user) throws IOException { + VspDetails vspDetails = getVspDetails(vendorSoftwareProductId, null, user).getVspDetails(); + UploadDataEntity uploadData = vendorSoftwareProductDao + .getUploadData(new UploadDataEntity(vendorSoftwareProductId, vspDetails.getVersion())); + ToscaServiceModel serviceModel = + serviceModelDao.getServiceModel(vendorSoftwareProductId, vspDetails.getVersion()); + Version newVersion = null; + + ValidationResponse validationResponse = new ValidationResponse(); + validationResponse + .setVspErrors(validateCompletedVendorSoftwareProduct(vspDetails, uploadData, serviceModel)); + validationResponse.setLicensingDataErrors(validateLicensingData(vspDetails)); + validationResponse.setUploadDataErrors(validateUploadData(uploadData)); + validationResponse.setQuestionnaireValidationResult( + validateQuestionnaire(vspDetails.getId(), vspDetails.getVersion())); + validationResponse.setCompilationErrors( + compile(vendorSoftwareProductId, vspDetails.getVersion(), serviceModel)); + + if (validationResponse.isValid()) { + newVersion = versioningManager + .submit(VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE, vendorSoftwareProductId, user, null); + } + //vendorSoftwareProductDao.updateVspLatestModificationTime(vendorSoftwareProductId, newVersion); + return validationResponse; + } + + private Map<String, List<ErrorMessage>> compile(String vendorSoftwareProductId, Version version, + ToscaServiceModel serviceModel) { + Collection<ComponentEntity> components = listComponents(vendorSoftwareProductId, version); + if (serviceModel == null) { + return null; + } + if (CollectionUtils.isEmpty(components)) { + enrichedServiceModelDao.storeServiceModel(vendorSoftwareProductId, version, serviceModel); + return null; + } + EnrichmentManager<ToscaServiceModel> enrichmentManager = + EnrichmentManagerFactory.getInstance().createInterface(); + enrichmentManager.initInput(vendorSoftwareProductId, version); + enrichmentManager.addModel(serviceModel); + + ComponentInfo componentInfo = new ComponentInfo(); + Map<String, List<ErrorMessage>> compileErrors = new HashMap<>(); + CompilationUtil.addMonitoringInfo(componentInfo, compileErrors); + for (ComponentEntity componentEntity : components) { + ComponentInfo currentEntityComponentInfo = new ComponentInfo(); + currentEntityComponentInfo.setCeilometerInfo(componentInfo.getCeilometerInfo()); + CompilationUtil + .addMibInfo(vendorSoftwareProductId, version, componentEntity, currentEntityComponentInfo, + compileErrors); + enrichmentManager.addEntityInput(componentEntity.getComponentCompositionData().getName(), + currentEntityComponentInfo); + + } + Map<String, List<ErrorMessage>> enrichErrors; + enrichErrors = enrichmentManager.enrich(); + enrichedServiceModelDao + .storeServiceModel(vendorSoftwareProductId, version, enrichmentManager.getModel()); + if (enrichErrors != null) { + compileErrors.putAll(enrichErrors); + } + + vendorSoftwareProductDao.updateVspLatestModificationTime(vendorSoftwareProductId, version); + + return compileErrors; + } + + private Collection<ErrorCode> validateLicensingData(VspDetails vspDetails) { + if (vspDetails.getVendorId() == null || vspDetails.getVlmVersion() == null + || vspDetails.getLicenseAgreement() == null + || CollectionUtils.isEmpty(vspDetails.getFeatureGroups())) { + return null; + } + return vendorLicenseFacade + .validateLicensingData(vspDetails.getVendorId(), vspDetails.getVlmVersion(), + vspDetails.getLicenseAgreement(), vspDetails.getFeatureGroups()); + } + + @Override + public VspDetails createNewVsp(VspDetails vspDetails, String user) { + UniqueValueUtil.validateUniqueValue( + VendorSoftwareProductConstants.UniqueValues.VENDOR_SOFTWARE_PRODUCT_NAME, + vspDetails.getName()); + vspDetails.setId(CommonMethods.nextUuId()); + + // vspDetails.setLastModificationTime(new Date()); + + Version version = versioningManager + .create(VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE, vspDetails.getId(), user); + vspDetails.setVersion(version); + + // vspDetails.setLastModificationTime(new Date()); + + vendorSoftwareProductDao.createVendorSoftwareProductInfo(vspDetails); + vendorSoftwareProductDao.updateQuestionnaire(vspDetails.getId(), version, + new JsonSchemaDataGenerator(getVspQuestionnaireSchema(null)).generateData()); + UniqueValueUtil + .createUniqueValue(VendorSoftwareProductConstants.UniqueValues.VENDOR_SOFTWARE_PRODUCT_NAME, + vspDetails.getName()); + + return vspDetails; + } + + @Override + public List<VersionedVendorSoftwareProductInfo> getVspList(String versionFilter, String user) { + Map<String, VersionInfo> idToVersionsInfo = versioningManager + .listEntitiesVersionInfo(VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE, user, + VersionableEntityAction.Read); + + List<VersionedVendorSoftwareProductInfo> vsps = new ArrayList<>(); + for (Map.Entry<String, VersionInfo> entry : idToVersionsInfo.entrySet()) { + VersionInfo versionInfo = entry.getValue(); + if (versionFilter != null && versionFilter.equals(VersionStatus.Final.name())) { + if (versionInfo.getLatestFinalVersion() == null) { + continue; + } + versionInfo.setActiveVersion(versionInfo.getLatestFinalVersion()); + versionInfo.setStatus(VersionStatus.Final); + versionInfo.setLockingUser(null); + } + + VspDetails vsp = vendorSoftwareProductDao.getVendorSoftwareProductInfo( + new VspDetails(entry.getKey(), entry.getValue().getActiveVersion())); + if (vsp != null) { + vsp.setValidationDataStructure(null); + vsps.add(new VersionedVendorSoftwareProductInfo(vsp, entry.getValue())); + } + } + + sortVspListByModificationTimeDescOrder(vsps); + return vsps; + } + + @Override + public void updateVsp(VspDetails vspDetails, String user) { + Version activeVersion = + getVersionInfo(vspDetails.getId(), VersionableEntityAction.Write, user).getActiveVersion(); + vspDetails.setVersion(activeVersion); + // vspDetails.setLastModificationTime(new Date()); + + VspDetails retrieved = vendorSoftwareProductDao.getVendorSoftwareProductInfo(vspDetails); + vspDetails.setValidationData(retrieved.getValidationData()); + UniqueValueUtil + .updateUniqueValue(VendorSoftwareProductConstants.UniqueValues.VENDOR_SOFTWARE_PRODUCT_NAME, + retrieved.getName(), vspDetails.getName()); + vendorSoftwareProductDao.updateVendorSoftwareProductInfo(vspDetails); + + vendorSoftwareProductDao.updateVspLatestModificationTime(vspDetails.getId(), activeVersion); + } + + @Override + public VersionedVendorSoftwareProductInfo getVspDetails(String vspId, Version version, + String user) { + VersionInfo versionInfo = getVersionInfo(vspId, VersionableEntityAction.Read, user); + if (version == null) { + version = versionInfo.getActiveVersion(); + } else { + if (!versionInfo.getViewableVersions().contains(version)) { + throw new CoreException(new RequestedVersionInvalidErrorBuilder().build()); + } + } + + VspDetails vendorSoftwareProductInfo = + vendorSoftwareProductDao.getVendorSoftwareProductInfo(new VspDetails(vspId, version)); + if (vendorSoftwareProductInfo == null) { + throw new CoreException(new VendorSoftwareProductNotFoundErrorBuilder(vspId).build()); + } + return new VersionedVendorSoftwareProductInfo(vendorSoftwareProductInfo, versionInfo); + } + + @Override + public void deleteVsp(String vspId, String user) { + throw new UnsupportedOperationException("Unsupported operation for 1607 release."); + } + + @Override + public UploadFileResponse uploadFile(String vspId, InputStream heatFileToUpload, String user) { + Version activeVersion = + getVersionInfo(vspId, VersionableEntityAction.Write, user).getActiveVersion(); + UploadFileResponse uploadFileResponse = new UploadFileResponse(); + + if (heatFileToUpload == null) { + uploadFileResponse.addStructureError(AsdcCommon.UPLOAD_FILE, + new ErrorMessage(ErrorLevel.ERROR, + Messages.NO_ZIP_FILE_WAS_UPLOADED_OR_ZIP_NOT_EXIST.getErrorMessage())); + return uploadFileResponse; + } + + InputStream uploadedFileData; + FileContentHandler fileContentMap; + Map<String, List<ErrorMessage>> errors = new HashMap<>(); + try { + fileContentMap = getContent(heatFileToUpload, errors); + if (!errors.isEmpty()) { + return addStructureErrorsToResponse(uploadFileResponse, errors); + } + + uploadedFileData = fileContentMap.getFileContent(UPLOAD_RAW_DATA); + fileContentMap.remove(UPLOAD_RAW_DATA); + + ValidationManagerUtil.handleMissingManifest(fileContentMap, errors); + if (!errors.isEmpty()) { + return addStructureErrorsToResponse(uploadFileResponse, errors); + } + + } catch (CoreException ce) { + ErrorMessage.ErrorMessageUtil.addMessage(AsdcCommon.UPLOAD_FILE, errors) + .add(new ErrorMessage(ErrorLevel.ERROR, ce.getMessage())); + return addStructureErrorsToResponse(uploadFileResponse, errors); + } + + HeatStructureTree tree = createAndValidateHeatTree(uploadFileResponse, fileContentMap); + + deleteUploadDataAndContent(vspId, activeVersion); + saveHotData(vspId, activeVersion, uploadedFileData, fileContentMap, tree); + + vendorSoftwareProductDao.updateVspLatestModificationTime(vspId, activeVersion); + + ToscaServiceModel toscaServiceModel = + VendorSoftwareProductUtils.loadAndTranslateTemplateData(fileContentMap) + .getToscaServiceModel(); + if (toscaServiceModel != null) { + serviceModelDao.storeServiceModel(vspId, activeVersion, toscaServiceModel); + saveCompositionData(vspId, activeVersion, + CompositionDataExtractor.extractServiceCompositionData(toscaServiceModel)); + } + + return uploadFileResponse; + } + + private UploadFileResponse addStructureErrorsToResponse(UploadFileResponse uploadFileResponse, + Map<String, List<ErrorMessage>> errors) { + uploadFileResponse.addStructureErrors(errors); + return uploadFileResponse; + } + + private HeatStructureTree createAndValidateHeatTree(UploadFileResponse uploadFileResponse, + FileContentHandler fileContentMap) { + VendorSoftwareProductUtils.addFileNamesToUploadFileResponse(fileContentMap, uploadFileResponse); + Map<String, List<ErrorMessage>> validationErrors = + ValidationManagerUtil.initValidationManager(fileContentMap).validate(); + uploadFileResponse.getErrors().putAll(validationErrors); + + HeatTreeManager heatTreeManager = HeatTreeManagerUtil.initHeatTreeManager(fileContentMap); + heatTreeManager.createTree(); + heatTreeManager.addErrors(validationErrors); + return heatTreeManager.getTree(); + } + + private void saveHotData(String vspId, Version activeVersion, InputStream uploadedFileData, + FileContentHandler fileContentMap, HeatStructureTree tree) { + Map<String, Object> manifestAsMap = (Map<String, Object>) JsonUtil + .json2Object(fileContentMap.getFileContent(AsdcCommon.MANIFEST_NAME), Map.class); + + UploadDataEntity uploadData = new UploadDataEntity(vspId, activeVersion); + uploadData.setPackageName((String) manifestAsMap.get("name")); + uploadData.setPackageVersion((String) manifestAsMap.get("version")); + uploadData.setContentData(ByteBuffer.wrap(FileUtils.toByteArray(uploadedFileData))); + uploadData.setValidationDataStructure(new ValidationStructureList(tree)); + vendorSoftwareProductDao.updateUploadData(uploadData); + } + + private FileContentHandler getContent(InputStream heatFileToUpload, + Map<String, List<ErrorMessage>> errors) { + FileContentHandler contentMap = null; + byte[] uploadedFileData; + try { + uploadedFileData = FileUtils.toByteArray(heatFileToUpload); + VendorSoftwareProductUtils.validateRawZipData(uploadedFileData, errors); + contentMap = VendorSoftwareProductUtils.loadUploadFileContent(uploadedFileData); + VendorSoftwareProductUtils.validateContentZipData(contentMap, errors); + contentMap.addFile(UPLOAD_RAW_DATA, uploadedFileData); + } catch (IOException e0) { + ErrorMessage.ErrorMessageUtil.addMessage(AsdcCommon.UPLOAD_FILE, errors) + .add(new ErrorMessage(ErrorLevel.ERROR, Messages.INVALID_ZIP_FILE.getErrorMessage())); + } + return contentMap; + } + + private void validateMibZipContent(String vspId, Version version, byte[] uploadedFileData, + Map<String, List<ErrorMessage>> errors) { + FileContentHandler contentMap; + try { + contentMap = VendorSoftwareProductUtils.loadUploadFileContent(uploadedFileData); + VendorSoftwareProductUtils.validateContentZipData(contentMap, errors); + } catch (IOException e0) { + throw new CoreException( + new MibUploadErrorBuilder(vspId, version, Messages.INVALID_ZIP_FILE.getErrorMessage()) + .build()); + } + } + + @Override + public List<PackageInfo> listPackages(String category, String subCategory) { + return vendorSoftwareProductDao.listPackages(category, subCategory); + } + + @Override + public File getTranslatedFile(String vspId, Version version, String user) { + VersionInfo versionInfo = getVersionInfo(vspId, VersionableEntityAction.Read, user); + if (version == null) { + if (versionInfo.getLatestFinalVersion() == null) { + throw new CoreException(new PackageNotFoundErrorBuilder(vspId).build()); + } + version = versionInfo.getLatestFinalVersion(); + } else { + if (!version.isFinal() || !versionInfo.getViewableVersions().contains(version)) { + throw new CoreException(new RequestedVersionInvalidErrorBuilder().build()); + } + } + + PackageInfo packageInfo = + vendorSoftwareProductDao.getPackageInfo(new PackageInfo(vspId, version)); + if (packageInfo == null) { + throw new CoreException(new PackageNotFoundErrorBuilder(vspId, version).build()); + } + + ByteBuffer translatedFileBuffer = packageInfo.getTranslatedFile(); + if (translatedFileBuffer == null) { + throw new CoreException(new PackageInvalidErrorBuilder(vspId, version).build()); + } + + File translatedFile = new File(VSP_PACKAGE_ZIP); + + try { + FileOutputStream fos = new FileOutputStream(translatedFile); + fos.write(translatedFileBuffer.array()); + fos.close(); + } catch (IOException e0) { + throw new CoreException(new TranslationFileCreationErrorBuilder(vspId, version).build(), e0); + } + + return translatedFile; + } + + @Override + public File getLatestHeatPackage(String vspId, + String user) { //todo remove the writing to file system.. + VersionInfo versionInfo = getVersionInfo(vspId, VersionableEntityAction.Read, user); + Version version = versionInfo.getActiveVersion(); + + UploadDataEntity uploadData = + vendorSoftwareProductDao.getUploadData(new UploadDataEntity(vspId, version)); + + ByteBuffer contentData = uploadData.getContentData(); + if (contentData == null) { + return null; + } + + File heatPkgFile = new File(String.format("heats-for-%s.zip", vspId)); + + try { + FileOutputStream fos = new FileOutputStream(heatPkgFile); + fos.write(contentData.array()); + fos.close(); + } catch (IOException e0) { + throw new CoreException(new FileCreationErrorBuilder(vspId).build(), e0); + } + return heatPkgFile; + } + + @Override + public PackageInfo createPackage(String vspId, String user) throws IOException { + VersionInfo versionInfo = getVersionInfo(vspId, VersionableEntityAction.Read, user); + Version activeVersion = versionInfo.getActiveVersion(); + if (!activeVersion.isFinal()) { + throw new CoreException( + new CreatePackageForNonFinalVendorSoftwareProductErrorBuilder(vspId, activeVersion) + .build()); + } + + ToscaServiceModel toscaServiceModel = + enrichedServiceModelDao.getServiceModel(vspId, activeVersion); + VspDetails vspDetails = + vendorSoftwareProductDao.getVendorSoftwareProductInfo(new VspDetails(vspId, activeVersion)); + Version vlmVersion = vspDetails.getVlmVersion(); + + PackageInfo packageInfo = createPackageInfo(vspId, vspDetails); + + ToscaFileOutputServiceCsarImpl toscaServiceTemplateServiceCsar = + new ToscaFileOutputServiceCsarImpl(); + FileContentHandler licenseArtifacts = licenseArtifactsService + .createLicenseArtifacts(vspDetails.getId(), vspDetails.getVendorId(), vlmVersion, + vspDetails.getFeatureGroups(), user); + //todo add tosca validation here + packageInfo.setTranslatedFile(ByteBuffer.wrap( + toscaServiceTemplateServiceCsar.createOutputFile(toscaServiceModel, licenseArtifacts))); + + vendorSoftwareProductDao.insertPackageDetails(packageInfo); + + vendorSoftwareProductDao.updateVspLatestModificationTime(vspId, vspDetails.getVersion()); + + return packageInfo; + } + + private PackageInfo createPackageInfo(String vspId, VspDetails vspDetails) { + PackageInfo packageInfo = new PackageInfo(); + packageInfo.setVspId(vspId); + packageInfo.setVersion(vspDetails.getVersion()); + packageInfo.setDisplayName(vspDetails.getPackageName()); + packageInfo.setVspName(vspDetails.getName()); + packageInfo.setVspDescription(vspDetails.getDescription()); + packageInfo.setCategory(vspDetails.getCategory()); + packageInfo.setSubCategory(vspDetails.getSubCategory()); + packageInfo.setVendorName(vspDetails.getVendorName()); + packageInfo.setPackageType(CSAR); + packageInfo.setVendorRelease("1.0"); //todo TBD + return packageInfo; + } + + @Override + public QuestionnaireResponse getVspQuestionnaire(String vspId, Version version, String user) { + version = VersioningUtil + .resolveVersion(version, getVersionInfo(vspId, VersionableEntityAction.Read, user)); + + QuestionnaireResponse questionnaireResponse = new QuestionnaireResponse(); + questionnaireResponse.setData(getVspQuestionnaire(vspId, version).getQuestionnaireData()); + questionnaireResponse.setSchema(getVspQuestionnaireSchema(null)); + + return questionnaireResponse; + } + + private VspQuestionnaireEntity getVspQuestionnaire(String vspId, Version version) { + VspQuestionnaireEntity retrieved = vendorSoftwareProductDao.getQuestionnaire(vspId, version); + VersioningUtil.validateEntityExistence(retrieved, new VspQuestionnaireEntity(vspId, version), + VspDetails.ENTITY_TYPE); + return retrieved; + } + + @Override + public void updateVspQuestionnaire(String vspId, String questionnaireData, String user) { + Version activeVersion = + getVersionInfo(vspId, VersionableEntityAction.Write, user).getActiveVersion(); + + vendorSoftwareProductDao.updateVspLatestModificationTime(vspId, activeVersion); + + vendorSoftwareProductDao.updateQuestionnaire(vspId, activeVersion, questionnaireData); + } + + @Override + public Collection<NetworkEntity> listNetworks(String vspId, Version version, String user) { + version = VersioningUtil + .resolveVersion(version, getVersionInfo(vspId, VersionableEntityAction.Read, user)); + return listNetworks(vspId, version); + } + + private Collection<NetworkEntity> listNetworks(String vspId, Version version) { + return vendorSoftwareProductDao.listNetworks(vspId, version); + } + + @Override + public NetworkEntity createNetwork(NetworkEntity network, String user) { + Version activeVersion = + getVersionInfo(network.getVspId(), VersionableEntityAction.Write, user).getActiveVersion(); + network.setVersion(activeVersion); + if (!isManual(network.getVspId(), activeVersion)) { + throw new CoreException( + new ErrorCode.ErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION) + .withId(VendorSoftwareProductErrorCodes.VSP_COMPOSITION_EDIT_NOT_ALLOWED) + .withMessage(VSP_COMPOSITION_EDIT_NOT_ALLOWED_MSG).build()); + } + + vendorSoftwareProductDao.updateVspLatestModificationTime(network.getVspId(), activeVersion); + return null; + } + + private NetworkEntity createNetwork(NetworkEntity network) { + network.setId(CommonMethods.nextUuId()); + vendorSoftwareProductDao.createNetwork(network); + + return network; + } + + @Override + public CompositionEntityValidationData updateNetwork(NetworkEntity network, String user) { + Version activeVersion = + getVersionInfo(network.getVspId(), VersionableEntityAction.Write, user).getActiveVersion(); + network.setVersion(activeVersion); + NetworkEntity retrieved = getNetwork(network.getVspId(), activeVersion, network.getId()); + + NetworkCompositionSchemaInput schemaInput = new NetworkCompositionSchemaInput(); + schemaInput.setManual(isManual(network.getVspId(), activeVersion)); + schemaInput.setNetwork(retrieved.getNetworkCompositionData()); + + CompositionEntityValidationData validationData = CompositionEntityDataManager + .validateEntity(network, SchemaTemplateContext.composition, schemaInput); + if (CollectionUtils.isEmpty(validationData.getErrors())) { + vendorSoftwareProductDao.updateNetwork(network); + } + + vendorSoftwareProductDao.updateVspLatestModificationTime(network.getVspId(), activeVersion); + + return validationData; + } + + @Override + public CompositionEntityResponse<Network> getNetwork(String vspId, Version version, + String networkId, String user) { + version = VersioningUtil + .resolveVersion(version, getVersionInfo(vspId, VersionableEntityAction.Read, user)); + NetworkEntity networkEntity = getNetwork(vspId, version, networkId); + Network network = networkEntity.getNetworkCompositionData(); + + NetworkCompositionSchemaInput schemaInput = new NetworkCompositionSchemaInput(); + schemaInput.setManual(isManual(vspId, version)); + schemaInput.setNetwork(network); + + CompositionEntityResponse<Network> response = new CompositionEntityResponse<>(); + response.setId(networkId); + response.setData(network); + response.setSchema(SchemaGenerator + .generate(SchemaTemplateContext.composition, CompositionEntityType.network, schemaInput)); + + return response; + } + + private NetworkEntity getNetwork(String vspId, Version version, String networkId) { + NetworkEntity retrieved = vendorSoftwareProductDao.getNetwork(vspId, version, networkId); + VersioningUtil.validateEntityExistence(retrieved, new NetworkEntity(vspId, version, networkId), + VspDetails.ENTITY_TYPE); + return retrieved; + } + + @Override + public void deleteNetwork(String vspId, String networkId, String user) { + Version activeVersion = + getVersionInfo(vspId, VersionableEntityAction.Write, user).getActiveVersion(); + if (!isManual(vspId, activeVersion)) { + throw new CoreException( + new ErrorCode.ErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION) + .withId(VendorSoftwareProductErrorCodes.VSP_COMPOSITION_EDIT_NOT_ALLOWED) + .withMessage(VSP_COMPOSITION_EDIT_NOT_ALLOWED_MSG).build()); + } + + vendorSoftwareProductDao.updateVspLatestModificationTime(vspId, activeVersion); + } + + @Override + public QuestionnaireResponse getComponentQuestionnaire(String vspId, Version version, + String componentId, String user) { + version = VersioningUtil + .resolveVersion(version, getVersionInfo(vspId, VersionableEntityAction.Read, user)); + + QuestionnaireResponse questionnaireResponse = new QuestionnaireResponse(); + questionnaireResponse.setData(getComponent(vspId, version, componentId).getQuestionnaireData()); + List<String> nicNames = listNics(vspId, version, componentId).stream() + .map(nic -> nic.getNicCompositionData().getName()).collect(Collectors.toList()); + questionnaireResponse.setSchema(getComponentQuestionnaireSchema( + new ComponentQuestionnaireSchemaInput(nicNames, + JsonUtil.json2Object(questionnaireResponse.getData(), Map.class)))); + + return questionnaireResponse; + } + + @Override + public void updateComponentQuestionnaire(String vspId, String componentId, + String questionnaireData, String user) { + Version activeVersion = + getVersionInfo(vspId, VersionableEntityAction.Write, user).getActiveVersion(); + getComponent(vspId, activeVersion, componentId); + + vendorSoftwareProductDao + .updateComponentQuestionnaire(vspId, activeVersion, componentId, questionnaireData); + + vendorSoftwareProductDao.updateVspLatestModificationTime(vspId, activeVersion); + } + + @Override + public Collection<ComponentEntity> listComponents(String vspId, Version version, String user) { + version = VersioningUtil + .resolveVersion(version, getVersionInfo(vspId, VersionableEntityAction.Read, user)); + return listComponents(vspId, version); + } + + private Collection<ComponentEntity> listComponents(String vspId, Version version) { + return vendorSoftwareProductDao.listComponents(vspId, version); + } + + @Override + public void deleteComponents(String vspId, String user) { + Version activeVersion = + getVersionInfo(vspId, VersionableEntityAction.Write, user).getActiveVersion(); + if (!isManual(vspId, activeVersion)) { + throw new CoreException( + new ErrorCode.ErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION) + .withId(VendorSoftwareProductErrorCodes.VSP_COMPOSITION_EDIT_NOT_ALLOWED) + .withMessage(VSP_COMPOSITION_EDIT_NOT_ALLOWED_MSG).build()); + } + + vendorSoftwareProductDao.updateVspLatestModificationTime(vspId, activeVersion); + } + + @Override + public ComponentEntity createComponent(ComponentEntity component, String user) { + Version activeVersion = + getVersionInfo(component.getVspId(), VersionableEntityAction.Write, user) + .getActiveVersion(); + component.setVersion(activeVersion); + + if (!isManual(component.getVspId(), activeVersion)) { + throw new CoreException( + new ErrorCode.ErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION) + .withId(VendorSoftwareProductErrorCodes.VSP_COMPOSITION_EDIT_NOT_ALLOWED) + .withMessage(VSP_COMPOSITION_EDIT_NOT_ALLOWED_MSG).build()); + + } + + /* ComponentCompositionSchemaInput schemaInput = new ComponentCompositionSchemaInput(); + schemaInput.setManual(true); + CompositionEntityValidationData validationData = CompositionEntityDataManager + .validateEntity(component, SchemaTemplateContext.composition, schemaInput); + if (CollectionUtils.isEmpty(validationData.getErrors())) { + return createComponent(component); + } + return validationData;*/ + + vendorSoftwareProductDao.updateVspLatestModificationTime(component.getVspId(), activeVersion); + + return null; + } + + private ComponentEntity createComponent(ComponentEntity component) { + component.setId(CommonMethods.nextUuId()); + component.setQuestionnaireData( + new JsonSchemaDataGenerator(getComponentQuestionnaireSchema(null)).generateData()); + + vendorSoftwareProductDao.createComponent(component); + + return component; + } + + @Override + public CompositionEntityResponse<ComponentData> getComponent(String vspId, Version version, + String componentId, String user) { + version = VersioningUtil + .resolveVersion(version, getVersionInfo(vspId, VersionableEntityAction.Read, user)); + ComponentEntity componentEntity = getComponent(vspId, version, componentId); + ComponentData component = componentEntity.getComponentCompositionData(); + + ComponentCompositionSchemaInput schemaInput = new ComponentCompositionSchemaInput(); + schemaInput.setManual(isManual(vspId, version)); + schemaInput.setComponent(component); + + CompositionEntityResponse<ComponentData> response = new CompositionEntityResponse<>(); + response.setId(componentId); + response.setData(component); + response.setSchema(SchemaGenerator + .generate(SchemaTemplateContext.composition, CompositionEntityType.component, schemaInput)); + + return response; + } + + private ComponentEntity getComponent(String vspId, Version version, String componentId) { + ComponentEntity retrieved = vendorSoftwareProductDao.getComponent(vspId, version, componentId); + VersioningUtil + .validateEntityExistence(retrieved, new ComponentEntity(vspId, version, componentId), + VspDetails.ENTITY_TYPE); + return retrieved; + } + + @Override + public CompositionEntityValidationData updateComponent(ComponentEntity component, String user) { + Version activeVersion = + getVersionInfo(component.getVspId(), VersionableEntityAction.Write, user) + .getActiveVersion(); + component.setVersion(activeVersion); + ComponentEntity retrieved = + getComponent(component.getVspId(), activeVersion, component.getId()); + + ComponentCompositionSchemaInput schemaInput = new ComponentCompositionSchemaInput(); + schemaInput.setManual(isManual(component.getVspId(), activeVersion)); + schemaInput.setComponent(retrieved.getComponentCompositionData()); + + CompositionEntityValidationData validationData = CompositionEntityDataManager + .validateEntity(component, SchemaTemplateContext.composition, schemaInput); + if (CollectionUtils.isEmpty(validationData.getErrors())) { + vendorSoftwareProductDao.updateComponent(component); + } + + vendorSoftwareProductDao.updateVspLatestModificationTime(component.getVspId(), activeVersion); + + return validationData; + } + + @Override + public void deleteComponent(String vspId, String componentId, String user) { + Version activeVersion = + getVersionInfo(vspId, VersionableEntityAction.Write, user).getActiveVersion(); + if (!isManual(vspId, activeVersion)) { + throw new CoreException( + new ErrorCode.ErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION) + .withId(VendorSoftwareProductErrorCodes.VSP_COMPOSITION_EDIT_NOT_ALLOWED) + .withMessage(VSP_COMPOSITION_EDIT_NOT_ALLOWED_MSG).build()); + } + + vendorSoftwareProductDao.updateVspLatestModificationTime(vspId, activeVersion); + } + + @Override + public Collection<org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity> listProcesses( + String vspId, Version version, String componentId, + String user) { + version = VersioningUtil + .resolveVersion(version, getVersionInfo(vspId, VersionableEntityAction.Read, user)); + if (!GENERAL_COMPONENT_ID.equals(componentId)) { + getComponent(vspId, version, componentId); + } + return vendorSoftwareProductDao.listProcesses(vspId, version, componentId); + } + + @Override + public void deleteProcesses(String vspId, String componentId, String user) { + Version activeVersion = + getVersionInfo(vspId, VersionableEntityAction.Write, user).getActiveVersion(); + if (!GENERAL_COMPONENT_ID.equals(componentId)) { + getComponent(vspId, activeVersion, componentId); + } + + Collection<org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity> processes = + vendorSoftwareProductDao.listProcesses(vspId, activeVersion, componentId); + for (org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity process : processes) { + UniqueValueUtil.deleteUniqueValue(VendorSoftwareProductConstants.UniqueValues.PROCESS_NAME, + process.getVspId(), process.getVersion().toString(), process.getComponentId(), + process.getName()); + } + + vendorSoftwareProductDao.deleteProcesses(vspId, activeVersion, componentId); + + vendorSoftwareProductDao.updateVspLatestModificationTime(vspId, activeVersion); + } + + @Override + public org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity createProcess( + org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity process, String user) { + Version activeVersion = + getVersionInfo(process.getVspId(), VersionableEntityAction.Write, user).getActiveVersion(); + process.setVersion(activeVersion); + UniqueValueUtil.validateUniqueValue(VendorSoftwareProductConstants.UniqueValues.PROCESS_NAME, + process.getVspId(), process.getVersion().toString(), process.getComponentId(), + process.getName()); + process.setId(CommonMethods.nextUuId()); + if (!GENERAL_COMPONENT_ID.equals(process.getComponentId())) { + getComponent(process.getVspId(), activeVersion, process.getComponentId()); + } + + vendorSoftwareProductDao.createProcess(process); + UniqueValueUtil.createUniqueValue(VendorSoftwareProductConstants.UniqueValues.PROCESS_NAME, + process.getVspId(), process.getVersion().toString(), process.getComponentId(), + process.getName()); + + vendorSoftwareProductDao.updateVspLatestModificationTime(process.getVspId(), activeVersion); + return process; + } + + @Override + public org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity getProcess(String vspId, + Version version, + String componentId, + String processId, + String user) { + version = VersioningUtil + .resolveVersion(version, getVersionInfo(vspId, VersionableEntityAction.Read, user)); + org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity retrieved = + vendorSoftwareProductDao.getProcess(vspId, version, componentId, processId); + validateProcessExistence(vspId, version, componentId, processId, retrieved); + return retrieved; + } + + @Override + public void updateProcess(org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity process, + String user) { + Version activeVersion = + getVersionInfo(process.getVspId(), VersionableEntityAction.Write, user).getActiveVersion(); + process.setVersion(activeVersion); + + org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity retrieved = + vendorSoftwareProductDao + .getProcess(process.getVspId(), activeVersion, process.getComponentId(), + process.getId()); + validateProcessExistence(process.getVspId(), activeVersion, process.getComponentId(), + process.getId(), retrieved); + + UniqueValueUtil.updateUniqueValue(VendorSoftwareProductConstants.UniqueValues.PROCESS_NAME, + retrieved.getName(), process.getName(), process.getVspId(), process.getVersion().toString(), + process.getComponentId()); + vendorSoftwareProductDao.updateProcess(process); + + vendorSoftwareProductDao.updateVspLatestModificationTime(process.getVspId(), activeVersion); + } + + @Override + public void deleteProcess(String vspId, String componentId, String processId, String user) { + Version activeVersion = + getVersionInfo(vspId, VersionableEntityAction.Write, user).getActiveVersion(); + org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity retrieved = + vendorSoftwareProductDao.getProcess(vspId, activeVersion, componentId, processId); + validateProcessExistence(vspId, activeVersion, componentId, processId, retrieved); + + vendorSoftwareProductDao.deleteProcess(vspId, activeVersion, componentId, processId); + UniqueValueUtil.deleteUniqueValue(VendorSoftwareProductConstants.UniqueValues.PROCESS_NAME, + retrieved.getVspId(), retrieved.getVersion().toString(), retrieved.getComponentId(), + retrieved.getName()); + + vendorSoftwareProductDao.updateVspLatestModificationTime(vspId, activeVersion); + } + + @Override + public File getProcessArtifact(String vspId, Version version, String componentId, + String processId, String user) { + version = VersioningUtil + .resolveVersion(version, getVersionInfo(vspId, VersionableEntityAction.Read, user)); + ProcessArtifactEntity retrieved = + vendorSoftwareProductDao.getProcessArtifact(vspId, version, componentId, processId); + validateProcessArtifactExistence(vspId, version, componentId, processId, retrieved); + + File file = new File(String + .format("%s_%s_%s_%s", vspId, version.toString().replace('.', '_'), componentId, + processId)); + try { + FileOutputStream fos = new FileOutputStream(file); + fos.write(retrieved.getArtifact().array()); + fos.close(); + } catch (IOException e0) { + throw new CoreException(new UploadInvalidErrorBuilder().build()); + } + + return file; + } + + @Override + public void deleteProcessArtifact(String vspId, String componentId, String processId, + String user) { + Version activeVersion = + getVersionInfo(vspId, VersionableEntityAction.Write, user).getActiveVersion(); + ProcessArtifactEntity retrieved = + vendorSoftwareProductDao.getProcessArtifact(vspId, activeVersion, componentId, processId); + validateProcessArtifactExistence(vspId, activeVersion, componentId, processId, retrieved); + + vendorSoftwareProductDao.deleteProcessArtifact(vspId, activeVersion, componentId, processId); + + vendorSoftwareProductDao.updateVspLatestModificationTime(vspId, activeVersion); + } + + @Override + public void uploadProcessArtifact(InputStream artifactFile, String artifactFileName, String vspId, + String componentId, String processId, String user) { + Version activeVersion = + getVersionInfo(vspId, VersionableEntityAction.Write, user).getActiveVersion(); + org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity retrieved = + vendorSoftwareProductDao.getProcess(vspId, activeVersion, componentId, processId); + validateProcessExistence(vspId, activeVersion, componentId, processId, retrieved); + + if (artifactFile == null) { + throw new CoreException(new UploadInvalidErrorBuilder().build()); + } + + byte[] artifact; + try { + artifact = FileUtils.toByteArray(artifactFile); + } catch (RuntimeException e0) { + throw new CoreException(new UploadInvalidErrorBuilder().build()); + } + + vendorSoftwareProductDao + .uploadProcessArtifact(vspId, activeVersion, componentId, processId, artifact, + artifactFileName); + + vendorSoftwareProductDao.updateVspLatestModificationTime(vspId, activeVersion); + } + + @Override + public Collection<org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity> listNics( + String vspId, Version version, String componentId, + String user) { + version = VersioningUtil + .resolveVersion(version, getVersionInfo(vspId, VersionableEntityAction.Read, user)); + Collection<org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity> nics = + listNics(vspId, version, componentId); + + Map<String, String> networksNameById = listNetworksNameById(vspId, version); + nics.stream().forEach(nicEntity -> { + Nic nic = nicEntity.getNicCompositionData(); + nic.setNetworkName(networksNameById.get(nic.getNetworkId())); + nicEntity.setNicCompositionData(nic); + }); + return nics; + } + + private Collection<org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity> listNics( + String vspId, Version version, String componentId) { + getComponent(vspId, version, componentId); + + return vendorSoftwareProductDao.listNics(vspId, version, componentId); + } + + private Map<String, String> listNetworksNameById(String vspId, Version version) { + Collection<NetworkEntity> networks = listNetworks(vspId, version); + return networks.stream().collect(Collectors.toMap(NetworkEntity::getId, + networkEntity -> networkEntity.getNetworkCompositionData().getName())); + } + + @Override + public org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity createNic( + org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity nic, String user) { + Version activeVersion = + getVersionInfo(nic.getVspId(), VersionableEntityAction.Write, user).getActiveVersion(); + nic.setVersion(activeVersion); + if (!isManual(nic.getVspId(), activeVersion)) { + throw new CoreException( + new ErrorCode.ErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION) + .withId(VendorSoftwareProductErrorCodes.VSP_COMPOSITION_EDIT_NOT_ALLOWED) + .withMessage(VSP_COMPOSITION_EDIT_NOT_ALLOWED_MSG).build()); + } + + vendorSoftwareProductDao.updateVspLatestModificationTime(nic.getVspId(), activeVersion); + + return null; + } + + private org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity createNic( + org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity nic) { + nic.setId(CommonMethods.nextUuId()); + nic.setQuestionnaireData( + new JsonSchemaDataGenerator(getNicQuestionnaireSchema(null)).generateData()); + + vendorSoftwareProductDao.createNic(nic); + + return nic; + } + + @Override + public CompositionEntityResponse<Nic> getNic(String vspId, Version version, String componentId, + String nicId, String user) { + version = VersioningUtil + .resolveVersion(version, getVersionInfo(vspId, VersionableEntityAction.Read, user)); + org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity + nicEntity = getNic(vspId, version, componentId, nicId); + Nic nic = nicEntity.getNicCompositionData(); + + NicCompositionSchemaInput schemaInput = new NicCompositionSchemaInput(); + schemaInput.setManual(isManual(vspId, version)); + schemaInput.setNic(nic); + Map<String, String> networksNameById = listNetworksNameById(vspId, version); + nic.setNetworkName(networksNameById.get(nic.getNetworkId())); + schemaInput.setNetworkIds(networksNameById.keySet()); + + CompositionEntityResponse<Nic> response = new CompositionEntityResponse<>(); + response.setId(nicId); + response.setData(nic); + response.setSchema(SchemaGenerator + .generate(SchemaTemplateContext.composition, CompositionEntityType.nic, schemaInput)); + + return response; + } + + private org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity getNic(String vspId, + Version version, + String componentId, + String nicId) { + getComponent(vspId, version, componentId); + org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity + retrieved = vendorSoftwareProductDao.getNic(vspId, version, componentId, nicId); + VersioningUtil + .validateEntityExistence(retrieved, + new org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity(vspId, version, + componentId, nicId), + VspDetails.ENTITY_TYPE); + return retrieved; + } + + @Override + public void deleteNic(String vspId, String componentId, String nicId, String user) { + Version activeVersion = + getVersionInfo(vspId, VersionableEntityAction.Write, user).getActiveVersion(); + if (!isManual(vspId, activeVersion)) { + throw new CoreException( + new ErrorCode.ErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION) + .withId(VendorSoftwareProductErrorCodes.VSP_COMPOSITION_EDIT_NOT_ALLOWED) + .withMessage(VSP_COMPOSITION_EDIT_NOT_ALLOWED_MSG).build()); + } + + vendorSoftwareProductDao.updateVspLatestModificationTime(vspId, activeVersion); + } + + @Override + public CompositionEntityValidationData updateNic( + org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity nic, String user) { + Version activeVersion = + getVersionInfo(nic.getVspId(), VersionableEntityAction.Write, user).getActiveVersion(); + nic.setVersion(activeVersion); + org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity + retrieved = getNic(nic.getVspId(), activeVersion, nic.getComponentId(), nic.getId()); + + NicCompositionSchemaInput schemaInput = new NicCompositionSchemaInput(); + schemaInput.setManual(isManual(nic.getVspId(), activeVersion)); + schemaInput.setNic(retrieved.getNicCompositionData()); + + CompositionEntityValidationData validationData = CompositionEntityDataManager + .validateEntity(nic, SchemaTemplateContext.composition, schemaInput); + if (CollectionUtils.isEmpty(validationData.getErrors())) { + vendorSoftwareProductDao.updateNic(nic); + } + + vendorSoftwareProductDao.updateVspLatestModificationTime(nic.getVspId(), activeVersion); + return validationData; + } + + @Override + public QuestionnaireResponse getNicQuestionnaire(String vspId, Version version, + String componentId, String nicId, String user) { + version = VersioningUtil + .resolveVersion(version, getVersionInfo(vspId, VersionableEntityAction.Read, user)); + + QuestionnaireResponse questionnaireResponse = new QuestionnaireResponse(); + questionnaireResponse + .setData(getNic(vspId, version, componentId, nicId).getQuestionnaireData()); + questionnaireResponse.setSchema(getNicQuestionnaireSchema(null)); + + return questionnaireResponse; + } + + @Override + public void updateNicQuestionnaire(String vspId, String componentId, String nicId, + String questionnaireData, String user) { + Version activeVersion = + getVersionInfo(vspId, VersionableEntityAction.Write, user).getActiveVersion(); + getNic(vspId, activeVersion, componentId, nicId); + + vendorSoftwareProductDao + .updateNicQuestionnaire(vspId, activeVersion, componentId, nicId, questionnaireData); + + vendorSoftwareProductDao.updateVspLatestModificationTime(vspId, activeVersion); + } + + @Override + public void deleteComponentMib(String vspId, String componentId, boolean isTrap, String user) { + Version activeVersion = + getVersionInfo(vspId, VersionableEntityAction.Write, user).getActiveVersion(); + ComponentArtifactEntity componentArtifactEntity = + setValuesForComponentArtifactEntityUpload(vspId, activeVersion, null, componentId, null, + isTrap, null); + ComponentArtifactEntity retrieved = + componentArtifactDao.getArtifactByType(componentArtifactEntity); + + componentArtifactDao.delete(retrieved); + + vendorSoftwareProductDao.updateVspLatestModificationTime(vspId, activeVersion); + } + + @Override + public void uploadComponentMib(InputStream object, String filename, String vspId, + String componentId, boolean isTrap, String user) { + Version activeVersion = + getVersionInfo(vspId, VersionableEntityAction.Write, user).getActiveVersion(); + ComponentArtifactEntity componentArtifactEntity; + + + if (object == null) { + throw new CoreException(new MibUploadErrorBuilder( + Messages.NO_ZIP_FILE_WAS_UPLOADED_OR_ZIP_NOT_EXIST.getErrorMessage()).build()); + } else { + byte[] uploadedFileData; + Map<String, List<ErrorMessage>> errors = new HashMap<>(); + try { + uploadedFileData = FileUtils.toByteArray(object); + validateMibZipContent(vspId, activeVersion, uploadedFileData, errors); + if (MapUtils.isNotEmpty(errors)) { + throw new CoreException( + new MibUploadErrorBuilder(errors.values().iterator().next().get(0).getMessage()) + .build()); + } + + createArtifactInDatabase(vspId, activeVersion, filename, componentId, isTrap, + uploadedFileData); + + } catch (Exception e0) { + throw new CoreException(new MibUploadErrorBuilder(e0.getMessage()).build()); + } + } + + vendorSoftwareProductDao.updateVspLatestModificationTime(vspId, activeVersion); + } + + private void createArtifactInDatabase(String vspId, Version activeVersion, String filename, + String componentId, boolean isTrap, + byte[] uploadedFileData) { + ComponentArtifactEntity componentArtifactEntity; + + String artifactId = CommonMethods.nextUuId(); + componentArtifactEntity = + setValuesForComponentArtifactEntityUpload(vspId, activeVersion, filename, componentId, + artifactId, isTrap, uploadedFileData); + componentArtifactDao.update(componentArtifactEntity); + } + + @Override + public MibUploadStatus listMibFilenames(String vspId, String componentId, String user) { + Version activeVersion = + getVersionInfo(vspId, VersionableEntityAction.Read, user).getActiveVersion(); + ComponentArtifactEntity current = + new ComponentArtifactEntity(vspId, activeVersion, componentId, null); + + return setMibUploadStatusValues(current); + + } + + private MibUploadStatus setMibUploadStatusValues( + ComponentArtifactEntity componentArtifactEntity) { + MibUploadStatus mibUploadStatus = new MibUploadStatus(); + + Collection<ComponentArtifactEntity> artifactNames = + componentArtifactDao.getArtifactNamesAndTypesForComponent(componentArtifactEntity); + Map<ComponentArtifactType, String> artifactTypeToFilename = + VendorSoftwareProductUtils.filterNonTrapOrPollArtifacts(artifactNames); + + if (MapUtils.isNotEmpty(artifactTypeToFilename)) { + if (artifactTypeToFilename.containsKey(ComponentArtifactType.SNMP_TRAP)) { + mibUploadStatus.setSnmpTrap(artifactTypeToFilename.get(ComponentArtifactType.SNMP_TRAP)); + } + if (artifactTypeToFilename.containsKey(ComponentArtifactType.SNMP_POLL)) { + mibUploadStatus.setSnmpPoll(artifactTypeToFilename.get(ComponentArtifactType.SNMP_POLL)); + } + } + + return mibUploadStatus; + } + + private ComponentArtifactEntity setValuesForComponentArtifactEntityUpload(String vspId, + Version version, + String filename, + String componentId, + String artifactId, + boolean isTrap, + byte[] + uploadedFileData) { + ComponentArtifactEntity componentArtifactEntity = new ComponentArtifactEntity(); + + componentArtifactEntity.setVspId(vspId); + componentArtifactEntity.setVersion(version); + componentArtifactEntity.setComponentId(componentId); + componentArtifactEntity.setId(artifactId); + componentArtifactEntity.setType(ComponentArtifactType.getComponentArtifactType(isTrap)); + componentArtifactEntity.setArtifactName(filename); + + if (Objects.nonNull(uploadedFileData)) { + componentArtifactEntity.setArtifact(ByteBuffer.wrap(uploadedFileData)); + } + + return componentArtifactEntity; + } + + private void validateProcessExistence(String vspId, Version version, String componentId, + String processId, + org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity retrieved) { + if (retrieved != null) { + return; + } + if (!GENERAL_COMPONENT_ID.equals(componentId)) { + getComponent(vspId, version, componentId); + } + VersioningUtil.validateEntityExistence(retrieved, + new org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity(vspId, version, + componentId, processId), + VspDetails.ENTITY_TYPE);//todo retrieved is always null ?? + } + + private void validateProcessArtifactExistence(String vspId, Version version, String componentId, + String processId, ProcessArtifactEntity retrieved) { + if (retrieved != null) { + VersioningUtil.validateEntityExistence(retrieved.getArtifact(), + new ProcessArtifactEntity(vspId, version, componentId, processId), + VspDetails.ENTITY_TYPE); + } else { + if (!GENERAL_COMPONENT_ID.equals(componentId)) { + getComponent(vspId, version, componentId); + } + VersioningUtil.validateEntityExistence(retrieved, + new org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity(vspId, version, + componentId, processId), + VspDetails.ENTITY_TYPE); //todo retrieved is always null ?? + } + } + + private Map<String, List<ErrorMessage>> validateUploadData(UploadDataEntity uploadData) + throws IOException { + if (uploadData == null || uploadData.getContentData() == null) { + return null; + } + + FileContentHandler fileContentMap = + VendorSoftwareProductUtils.loadUploadFileContent(uploadData.getContentData().array()); + ValidationManager validationManager = + ValidationManagerUtil.initValidationManager(fileContentMap); + Map<String, List<ErrorMessage>> validationErrors = validationManager.validate(); + + return + MapUtils.isEmpty(MessageContainerUtil.getMessageByLevel(ErrorLevel.ERROR, validationErrors)) + ? null : validationErrors; + } + + private VersionInfo getVersionInfo(String vendorSoftwareProductId, VersionableEntityAction action, + String user) { + return versioningManager + .getEntityVersionInfo(VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE, vendorSoftwareProductId, + user, action); + } + + private void saveCompositionData(String vspId, Version version, CompositionData compositionData) { + Map<String, String> networkIdByName = new HashMap<>(); + for (Network network : compositionData.getNetworks()) { + + NetworkEntity networkEntity = new NetworkEntity(vspId, version, null); + networkEntity.setNetworkCompositionData(network); + + if (network.getName() != null) { + networkIdByName.put(network.getName(), createNetwork(networkEntity).getId()); + } + } + + for (Component component : compositionData.getComponents()) { + ComponentEntity componentEntity = new ComponentEntity(vspId, version, null); + componentEntity.setComponentCompositionData(component.getData()); + + String componentId = createComponent(componentEntity).getId(); + + if (CollectionUtils.isNotEmpty(component.getNics())) { + for (Nic nic : component.getNics()) { + if (nic.getNetworkName() != null) { + nic.setNetworkId(networkIdByName.get(nic.getNetworkName())); + nic.setNetworkName(null); + } + + org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity + nicEntity = + new org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity(vspId, version, + componentId, null); + nicEntity.setNicCompositionData(nic); + createNic(nicEntity); + } + } + } + } + + private void deleteUploadDataAndContent(String vspId, Version version) { + vendorSoftwareProductDao.deleteUploadData(vspId, version); + } + + private QuestionnaireValidationResult validateQuestionnaire(String vspId, Version version) { + CompositionEntityDataManager compositionEntityDataManager = new CompositionEntityDataManager(); + compositionEntityDataManager + .addEntity(vendorSoftwareProductDao.getQuestionnaire(vspId, version), null); + + Collection<org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity> nics = + vendorSoftwareProductDao.listNicsByVsp(vspId, version); + + Map<String, List<String>> nicNamesByComponent = new HashMap<>(); + for (org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity nicEntity : nics) { + compositionEntityDataManager.addEntity(nicEntity, null); + + Nic nic = nicEntity.getNicCompositionData(); + if (nic != null && nic.getName() != null) { + List<String> nicNames = nicNamesByComponent.get(nicEntity.getComponentId()); + if (nicNames == null) { + nicNames = new ArrayList<>(); + nicNamesByComponent.put(nicEntity.getComponentId(), nicNames); + } + nicNames.add(nic.getName()); + } + } + + Collection<ComponentEntity> components = + vendorSoftwareProductDao.listComponentsQuestionnaire(vspId, version); + components.stream().forEach(component -> compositionEntityDataManager.addEntity(component, + new ComponentQuestionnaireSchemaInput(nicNamesByComponent.get(component.getId()), + JsonUtil.json2Object(component.getQuestionnaireData(), Map.class)))); + + Map<CompositionEntityId, Collection<String>> errorsByEntityId = + compositionEntityDataManager.validateEntitiesQuestionnaire(); + if (MapUtils.isNotEmpty(errorsByEntityId)) { + compositionEntityDataManager.buildTrees(); + compositionEntityDataManager.addErrorsToTrees(errorsByEntityId); + Collection<CompositionEntityValidationData> roots = compositionEntityDataManager.getTrees(); + return new QuestionnaireValidationResult(roots.iterator().next()); + } + + return null; + } +} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/CompositionDataExtractor.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/CompositionDataExtractor.java new file mode 100644 index 0000000000..f92b83532e --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/CompositionDataExtractor.java @@ -0,0 +1,386 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 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 org.openecomp.sdc.vendorsoftwareproduct.services; + +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.collections4.MapUtils; +import org.openecomp.sdc.common.errors.CoreException; +import org.openecomp.sdc.tosca.datatypes.ToscaCapabilityType; +import org.openecomp.sdc.tosca.datatypes.ToscaFunctions; +import org.openecomp.sdc.tosca.datatypes.ToscaNodeType; +import org.openecomp.sdc.tosca.datatypes.ToscaRelationshipType; +import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel; +import org.openecomp.sdc.tosca.datatypes.model.NodeTemplate; +import org.openecomp.sdc.tosca.datatypes.model.ParameterDefinition; +import org.openecomp.sdc.tosca.datatypes.model.RequirementAssignment; +import org.openecomp.sdc.tosca.datatypes.model.ServiceTemplate; +import org.openecomp.sdc.tosca.errors.ToscaInvalidEntryNotFoundErrorBuilder; +import org.openecomp.sdc.tosca.errors.ToscaInvalidSubstituteNodeTemplateErrorBuilder; +import org.openecomp.sdc.tosca.errors.ToscaMissingSubstitutionMappingForReqCapErrorBuilder; +import org.openecomp.sdc.tosca.services.ToscaAnalyzerService; +import org.openecomp.sdc.tosca.services.ToscaConstants; +import org.openecomp.sdc.tosca.services.impl.ToscaAnalyzerServiceImpl; +import org.openecomp.sdc.tosca.services.yamlutil.ToscaExtensionYamlUtil; +import org.openecomp.sdc.vendorsoftwareproduct.types.ExtractCompositionDataContext; +import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Component; +import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComponentData; +import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionData; +import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Network; +import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Nic; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; + +/** + * The type Composition data extractor. + */ +public class CompositionDataExtractor { + + /** + * The constant logger. + */ + protected static Logger logger; + private static ToscaAnalyzerService toscaAnalyzerService; + + static { + logger = LoggerFactory.getLogger(CompositionDataExtractor.class); + toscaAnalyzerService = new ToscaAnalyzerServiceImpl(); + } + + /** + * Extract service composition data composition data. + * + * @param toscaServiceModel the tosca service model + * @return the composition data + */ + public static CompositionData extractServiceCompositionData(ToscaServiceModel toscaServiceModel) { + ExtractCompositionDataContext context = new ExtractCompositionDataContext(); + String entryDefinitionServiceTemplateFileName = + toscaServiceModel.getEntryDefinitionServiceTemplate(); + ServiceTemplate entryDefinitionServiceTemplate = + toscaServiceModel.getServiceTemplates().get(entryDefinitionServiceTemplateFileName); + extractServiceCompositionData(entryDefinitionServiceTemplateFileName, + entryDefinitionServiceTemplate, toscaServiceModel, context); + + CompositionData compositionData = new CompositionData(); + compositionData.setNetworks(context.getNetworks()); + compositionData.setComponents(context.getComponents()); + return compositionData; + } + + private static void extractServiceCompositionData(String serviceTemplateFileName, + ServiceTemplate serviceTemplate, + ToscaServiceModel toscaServiceModel, + ExtractCompositionDataContext context) { + if (context.getHandledServiceTemplates().contains(serviceTemplateFileName)) { + return; + } + context.addNetworks(extractNetworks(serviceTemplate, toscaServiceModel)); + extractComponents(serviceTemplate, toscaServiceModel, context); + handleSubstitution(serviceTemplate, toscaServiceModel, context); + context.addHandledServiceTemplates(serviceTemplateFileName); + } + + private static void handleSubstitution(ServiceTemplate serviceTemplate, + ToscaServiceModel toscaServiceModel, + ExtractCompositionDataContext context) { + Map<String, NodeTemplate> substitutableNodeTemplates = + toscaAnalyzerService.getSubstitutableNodeTemplates(serviceTemplate); + + if (substitutableNodeTemplates != null) { + for (String substitutableNodeTemplateId : substitutableNodeTemplates.keySet()) { + handleSubstitutableNodeTemplate(serviceTemplate, toscaServiceModel, + substitutableNodeTemplateId, + substitutableNodeTemplates.get(substitutableNodeTemplateId), context); + } + } + } + + private static void handleSubstitutableNodeTemplate(ServiceTemplate serviceTemplate, + ToscaServiceModel toscaServiceModel, + String substitutableNodeTemplateId, + NodeTemplate substitutableNodeTemplate, + ExtractCompositionDataContext context) { + ToscaExtensionYamlUtil toscaExtensionYamlUtil = new ToscaExtensionYamlUtil(); + Optional<String> substituteServiceTemplateFileName = toscaAnalyzerService + .getSubstituteServiceTemplateName(substitutableNodeTemplateId, substitutableNodeTemplate); + if (!substituteServiceTemplateFileName.isPresent()) { + throw new CoreException( + new ToscaInvalidSubstituteNodeTemplateErrorBuilder(substitutableNodeTemplateId).build()); + } + if (context.getHandledServiceTemplates().contains(substituteServiceTemplateFileName.get())) { + return; + } + + ServiceTemplate substituteServiceTemplate = + toscaServiceModel.getServiceTemplates().get(substituteServiceTemplateFileName.get()); + extractServiceCompositionData(substituteServiceTemplateFileName.get(), + substituteServiceTemplate, toscaServiceModel, context); + + List<Map<String, RequirementAssignment>> substitutableRequirements = + substitutableNodeTemplate.getRequirements(); + + if (CollectionUtils.isEmpty(substitutableRequirements)) { + return; + } + + for (Map<String, RequirementAssignment> substitutableReq : substitutableRequirements) { + substitutableReq.keySet().stream().filter(reqId -> { + RequirementAssignment reqAssignment = toscaExtensionYamlUtil + .yamlToObject(toscaExtensionYamlUtil.objectToYaml(substitutableReq.get(reqId)), + RequirementAssignment.class); + return isLinkToNetworkRequirementAssignment(reqAssignment); + }).forEach(reqId -> { + RequirementAssignment linkToNetworkRequirement = toscaExtensionYamlUtil + .yamlToObject(toscaExtensionYamlUtil.objectToYaml(substitutableReq.get(reqId)), + RequirementAssignment.class); + String connectedNodeId = linkToNetworkRequirement.getNode(); + Optional<NodeTemplate> connectedNodeTemplate = + toscaAnalyzerService.getNodeTemplateById(serviceTemplate, connectedNodeId); + + if (connectedNodeTemplate.isPresent() && toscaAnalyzerService + .isTypeOf(connectedNodeTemplate.get(), ToscaNodeType.NETWORK.getDisplayName(), + serviceTemplate, toscaServiceModel)) { + Optional<Map.Entry<String, NodeTemplate>> mappedNodeTemplate = toscaAnalyzerService + .getSubstitutionMappedNodeTemplateByExposedReq( + substituteServiceTemplateFileName.get(), substituteServiceTemplate, reqId); + if (!mappedNodeTemplate.isPresent()) { + throw new CoreException(new ToscaMissingSubstitutionMappingForReqCapErrorBuilder( + ToscaMissingSubstitutionMappingForReqCapErrorBuilder.MappingExposedEntry + .REQUIREMENT, connectedNodeId).build()); + } + + if (toscaAnalyzerService.isTypeOf(mappedNodeTemplate.get().getValue(), + ToscaNodeType.NETWORK_PORT.getDisplayName(), serviceTemplate, toscaServiceModel)) { + Nic port = context.getNics().get(mappedNodeTemplate.get().getKey()); + if (port != null) { + port.setNetworkName(connectedNodeId); + } else { + logger.warn( + "Different ports define for the same component which is used in different " + + "substitution service templates."); + } + } + } else if (!connectedNodeTemplate.isPresent()) { + throw new CoreException( + new ToscaInvalidEntryNotFoundErrorBuilder("Node Template", connectedNodeId).build()); + } + }); + } + } + + private static boolean isLinkToNetworkRequirementAssignment(RequirementAssignment requirement) { + return toscaAnalyzerService.isDesiredRequirementAssignment(requirement, + ToscaCapabilityType.NETWORK_LINKABLE.getDisplayName(), null, + ToscaRelationshipType.NETWORK_LINK_TO.getDisplayName()); + } + + + private static void connectPortToNetwork(Nic port, NodeTemplate portNodeTemplate) { + List<RequirementAssignment> linkRequirementsToNetwork = + toscaAnalyzerService.getRequirements(portNodeTemplate, ToscaConstants.LINK_REQUIREMENT_ID); + + //port is connected to one network + for (RequirementAssignment linkRequirementToNetwork : linkRequirementsToNetwork) { + port.setNetworkName(linkRequirementToNetwork.getNode()); + } + + } + + /* + return Map with key - compute node template id, value - list of connected port node template id + */ + private static Map<String, List<String>> getComputeToPortsConnection( + Map<String, NodeTemplate> portNodeTemplates) { + Map<String, List<String>> computeToPortConnection = new HashMap<>(); + if (MapUtils.isEmpty(portNodeTemplates)) { + return computeToPortConnection; + } + for (String portId : portNodeTemplates.keySet()) { + List<RequirementAssignment> bindingRequirementsToCompute = toscaAnalyzerService + .getRequirements(portNodeTemplates.get(portId), ToscaConstants.BINDING_REQUIREMENT_ID); + for (RequirementAssignment bindingRequirementToCompute : bindingRequirementsToCompute) { + computeToPortConnection + .putIfAbsent(bindingRequirementToCompute.getNode(), new ArrayList<>()); + computeToPortConnection.get(bindingRequirementToCompute.getNode()).add(portId); + } + + } + + return computeToPortConnection; + } + + private static void extractComponents(ServiceTemplate serviceTemplate, + ToscaServiceModel toscaServiceModel, + ExtractCompositionDataContext context) { + Map<String, NodeTemplate> computeNodeTemplates = toscaAnalyzerService + .getNodeTemplatesByType(serviceTemplate, ToscaNodeType.COMPUTE.getDisplayName(), + toscaServiceModel); + if (MapUtils.isEmpty(computeNodeTemplates)) { + return; + } + Map<String, NodeTemplate> portNodeTemplates = toscaAnalyzerService + .getNodeTemplatesByType(serviceTemplate, ToscaNodeType.NETWORK_PORT.getDisplayName(), + toscaServiceModel); + Map<String, List<String>> computeToPortsConnection = + getComputeToPortsConnection(portNodeTemplates); + Map<String, List<String>> computesGroupedByType = + getNodeTemplatesGroupedByType(computeNodeTemplates); + + computesGroupedByType.keySet() + .stream() + .filter(nodeType -> + !context.getCreatedComponents().contains(nodeType)) + .forEach(nodeType -> extractComponent(serviceTemplate, computeToPortsConnection, + computesGroupedByType, nodeType, context)); + } + + private static void extractComponent(ServiceTemplate serviceTemplate, + Map<String, List<String>> computeToPortsConnection, + Map<String, List<String>> computesGroupedByType, + String computeNodeType, + ExtractCompositionDataContext context) { + ComponentData component = new ComponentData(); + component.setName(computeNodeType); + component.setDisplayName(getComponentDisplayName(component.getName())); + Component componentModel = new Component(); + componentModel.setData(component); + + String computeId = computesGroupedByType.get(computeNodeType).get(0); + List<String> connectedPortIds = computeToPortsConnection.get(computeId); + + if (connectedPortIds != null) { + componentModel.setNics(new ArrayList<>()); + for (String portId : connectedPortIds) { + Nic port = extractPort(serviceTemplate, portId); + componentModel.getNics().add(port); + context.addNic(portId, port); + } + } + context.addComponent(componentModel); + context.getCreatedComponents().add(computeNodeType); + } + + private static Nic extractPort(ServiceTemplate serviceTemplate, String portNodeTemplateId) { + Optional<NodeTemplate> portNodeTemplate = + toscaAnalyzerService.getNodeTemplateById(serviceTemplate, portNodeTemplateId); + if (portNodeTemplate.isPresent()) { + Nic port = new Nic(); + port.setName(portNodeTemplateId); + connectPortToNetwork(port, portNodeTemplate.get()); + return port; + } else { + throw new CoreException( + new ToscaInvalidEntryNotFoundErrorBuilder("Node Template", portNodeTemplateId).build()); + } + } + + + private static Map<String, List<String>> getNodeTemplatesGroupedByType( + Map<String, NodeTemplate> nodeTemplates) { + Map<String, List<String>> nodeTemplatesGrouped = + new HashMap<>(); //key - node type, value - list of node ids with this type + for (String nodeId : nodeTemplates.keySet()) { + String nodeType = nodeTemplates.get(nodeId).getType(); + nodeTemplatesGrouped.putIfAbsent(nodeType, new ArrayList<>()); + nodeTemplatesGrouped.get(nodeType).add(nodeId); + } + return nodeTemplatesGrouped; + } + + private static List<Network> extractNetworks(ServiceTemplate serviceTemplate, + ToscaServiceModel toscaServiceModel) { + List<Network> networks = new ArrayList<>(); + Map<String, NodeTemplate> networkNodeTemplates = toscaAnalyzerService + .getNodeTemplatesByType(serviceTemplate, ToscaNodeType.NETWORK.getDisplayName(), + toscaServiceModel); + if (MapUtils.isEmpty(networkNodeTemplates)) { + return networks; + } + for (String networkId : networkNodeTemplates.keySet()) { + Network network = new Network(); + network.setName(networkId); + Optional<Boolean> networkDhcpValue = + getNetworkDhcpValue(serviceTemplate, networkNodeTemplates.get(networkId)); + network.setDhcp(networkDhcpValue.isPresent() ? networkDhcpValue.get() : true); + networks.add(network); + } + + return networks; + } + + //dhcp default value is true + private static Optional<Boolean> getNetworkDhcpValue(ServiceTemplate serviceTemplate, + NodeTemplate networkNodeTemplate) { + if (networkNodeTemplate == null) { + return Optional.empty(); + } + if (networkNodeTemplate.getProperties() == null + || networkNodeTemplate.getProperties().get(ToscaConstants.DHCP_ENABLED_PROPERTY_NAME) + == null) { + return Optional.of(true); + } + + Object dhcp = + networkNodeTemplate.getProperties().get(ToscaConstants.DHCP_ENABLED_PROPERTY_NAME); + if (dhcp instanceof String) { + return Optional.of(Boolean.valueOf((String) dhcp)); + } else if (dhcp instanceof Boolean) { + return Optional.of((Boolean) dhcp); + } else if (dhcp instanceof Map) { + String inputParameterName = + (String) ((Map) dhcp).get(ToscaFunctions.GET_INPUT.getDisplayName()); + if (inputParameterName != null) { + ParameterDefinition inputParameterDefinition = + serviceTemplate.getTopology_template().getInputs().get(inputParameterName); + if (inputParameterDefinition != null) { + if (inputParameterDefinition.get_default() != null) { + return Optional.of(Boolean.valueOf(inputParameterDefinition.get_default().toString())); + } + } else { + throw new CoreException( + new ToscaInvalidEntryNotFoundErrorBuilder("Input Parameter", inputParameterName) + .build()); + } + } + } + + return Optional.of(true); + } + + private static String getComponentDisplayName(String componentName) { + if (componentName == null) { + return null; + } + String delimiterChar = "."; + if (componentName.contains(delimiterChar)) { + return componentName.substring(componentName.lastIndexOf(delimiterChar) + 1); + } + return componentName; + + } + +} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/CompositionEntityDataManager.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/CompositionEntityDataManager.java new file mode 100644 index 0000000000..e3f56a6578 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/CompositionEntityDataManager.java @@ -0,0 +1,257 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 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 org.openecomp.sdc.vendorsoftwareproduct.services; + +import org.openecomp.core.utilities.json.JsonUtil; +import org.openecomp.sdc.common.errors.CoreException; +import org.openecomp.sdc.common.errors.ErrorCategory; +import org.openecomp.sdc.common.errors.ErrorCode; +import org.openecomp.sdc.vendorsoftwareproduct.types.CompositionEntityValidationData; +import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.SchemaTemplateContext; +import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.SchemaTemplateInput; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * The type Composition entity data manager. + */ +public class CompositionEntityDataManager { + + private static final String COMPOSITION_ENTITY_DATA_MANAGER_ERR = + "COMPOSITION_ENTITY_DATA_MANAGER_ERR"; + private static final String COMPOSITION_ENTITY_DATA_MANAGER_ERR_MSG = + "Invalid input: %s may not be null"; + + private Map<org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityId, + CompositionEntityData> entities = new HashMap<>(); + private Map<org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityType, + String> nonDynamicSchemas = new HashMap<>(); + private List<CompositionEntityValidationData> roots = new ArrayList<>(); + + /** + * Validate entity composition entity validation data. + * + * @param entity the entity + * @param schemaTemplateContext the schema template context + * @param schemaTemplateInput the schema template input + * @return the composition entity validation data + */ + public static CompositionEntityValidationData validateEntity( + org.openecomp.sdc.vendorsoftwareproduct.dao.type.CompositionEntity entity, + SchemaTemplateContext schemaTemplateContext, + SchemaTemplateInput schemaTemplateInput) { + if (entity == null) { + throw new CoreException( + new ErrorCode.ErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION) + .withId(COMPOSITION_ENTITY_DATA_MANAGER_ERR).withMessage( + String.format(COMPOSITION_ENTITY_DATA_MANAGER_ERR_MSG, "composition entity")) + .build()); + } + if (schemaTemplateContext == null) { + throw new CoreException( + new ErrorCode.ErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION) + .withId(COMPOSITION_ENTITY_DATA_MANAGER_ERR).withMessage( + String.format(COMPOSITION_ENTITY_DATA_MANAGER_ERR_MSG, "schema template context")) + .build()); + } + + CompositionEntityValidationData validationData = + new CompositionEntityValidationData(entity.getType(), entity.getId()); + String json = + schemaTemplateContext == SchemaTemplateContext.composition ? entity.getCompositionData() + : entity.getQuestionnaireData(); + validationData.setErrors(JsonUtil.validate( + json == null ? JsonUtil.object2Json(new Object()) : json, + SchemaGenerator.generate(schemaTemplateContext, entity.getType(), schemaTemplateInput))); + + return validationData; + } + + /** + * Add entity. + * + * @param entity the entity + * @param schemaTemplateInput the schema template input + */ + public void addEntity(org.openecomp.sdc.vendorsoftwareproduct.dao.type.CompositionEntity entity, + SchemaTemplateInput schemaTemplateInput) { + if (entity == null) { + throw new CoreException( + new ErrorCode.ErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION) + .withId(COMPOSITION_ENTITY_DATA_MANAGER_ERR).withMessage( + String.format(COMPOSITION_ENTITY_DATA_MANAGER_ERR_MSG, "composition entity")) + .build()); + } + entities.put(entity.getCompositionEntityId(), + new CompositionEntityData(entity, schemaTemplateInput)); + } + + /** + * Validate entities questionnaire map. + * + * @return the map + */ + public Map<org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityId, + Collection<String>> validateEntitiesQuestionnaire() { + Map<org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityId, + Collection<String>> + errorsByEntityId = new HashMap<>(); + + entities.entrySet().stream().forEach(entry -> { + Collection<String> errors = validateQuestionnaire(entry.getValue()); + if (errors != null) { + errorsByEntityId.put(entry.getKey(), errors); + } + }); + + return errorsByEntityId; + } + + /** + * Build trees. + */ + public void buildTrees() { + Map<org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityId, + CompositionEntityValidationData> + entitiesValidationData = + new HashMap<>(); + entities.entrySet().stream().forEach( + entry -> addValidationDataEntity(entitiesValidationData, entry.getKey(), + entry.getValue().entity)); + } + + /** + * Gets trees. + * + * @return the trees + */ + public Collection<CompositionEntityValidationData> getTrees() { + return roots; + } + + /** + * Add errors to trees. + * + * @param errors the errors + */ + public void addErrorsToTrees( + Map<org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityId, + Collection<String>> errors) { + roots.stream().forEach(root -> addErrorsToTree(root, null, errors)); + } + + private void addValidationDataEntity( + Map<org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityId, + CompositionEntityValidationData> entitiesValidationData, + org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityId entityId, + org.openecomp.sdc.vendorsoftwareproduct.dao.type.CompositionEntity entity) { + if (entitiesValidationData.containsKey(entityId)) { + return; + } + + CompositionEntityValidationData validationData = + new CompositionEntityValidationData(entity.getType(), entity.getId()); + entitiesValidationData.put(entityId, validationData); + + org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityId parentEntityId = + entityId.getParentId(); + if (parentEntityId == null) { + roots.add(validationData); + } else { + CompositionEntityData parentEntity = entities.get(parentEntityId); + if (parentEntity == null) { + roots.add(validationData); + } else { + addValidationDataEntity(entitiesValidationData, parentEntityId, parentEntity.entity); + entitiesValidationData.get(parentEntityId).addSubEntityValidationData(validationData); + } + } + } + + private void addErrorsToTree(CompositionEntityValidationData node, + org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityId parentNodeId, + Map<org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityId, + Collection<String>> errors) { + if (node == null) { + return; + } + org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityId + nodeId = new org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityId( + node.getEntityId(), parentNodeId); + node.setErrors(errors.get(nodeId)); + + if (node.getSubEntitiesValidationData() != null) { + node.getSubEntitiesValidationData().stream() + .forEach(subNode -> addErrorsToTree(subNode, nodeId, errors)); + } + } + + private Collection<String> validateQuestionnaire(CompositionEntityData compositionEntityData) { + return JsonUtil.validate( + compositionEntityData.entity.getQuestionnaireData() == null ? JsonUtil + .object2Json(new Object()) : compositionEntityData.entity.getQuestionnaireData(), + getSchema(compositionEntityData.entity.getType(), SchemaTemplateContext.questionnaire, + compositionEntityData.schemaTemplateInput)); + } + + private String getSchema( + org.openecomp.sdc.vendorsoftwareproduct.types + .composition.CompositionEntityType compositionEntityType, + SchemaTemplateContext schemaTemplateContext, + SchemaTemplateInput schemaTemplateInput) { + return schemaTemplateInput == null ? getNonDynamicSchema(schemaTemplateContext, + compositionEntityType) : SchemaGenerator + .generate(schemaTemplateContext, compositionEntityType, schemaTemplateInput); + } + + private String getNonDynamicSchema(SchemaTemplateContext schemaTemplateContext, + org.openecomp.sdc.vendorsoftwareproduct.types.composition + .CompositionEntityType compositionEntityType) { + String schema = nonDynamicSchemas.get(compositionEntityType); + if (schema == null) { + schema = SchemaGenerator.generate(schemaTemplateContext, compositionEntityType, null); + nonDynamicSchemas.put(compositionEntityType, schema); + } + return schema; + } + + private static class CompositionEntityData { + private org.openecomp.sdc.vendorsoftwareproduct.dao.type.CompositionEntity entity; + private SchemaTemplateInput schemaTemplateInput; + + /** + * Instantiates a new Composition entity data. + * + * @param entity the entity + * @param schemaTemplateInput the schema template input + */ + public CompositionEntityData( + org.openecomp.sdc.vendorsoftwareproduct.dao.type.CompositionEntity entity, + SchemaTemplateInput schemaTemplateInput) { + this.entity = entity; + this.schemaTemplateInput = schemaTemplateInput; + } + } +} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/SchemaGenerator.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/SchemaGenerator.java new file mode 100644 index 0000000000..53fe5455fb --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/SchemaGenerator.java @@ -0,0 +1,70 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 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 org.openecomp.sdc.vendorsoftwareproduct.services; + +import freemarker.template.Template; +import freemarker.template.TemplateException; +import org.openecomp.sdc.common.errors.CoreException; +import org.openecomp.sdc.common.errors.ErrorCategory; +import org.openecomp.sdc.common.errors.ErrorCode; +import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.SchemaTemplateContext; +import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.SchemaTemplateInput; + +import java.io.IOException; +import java.io.StringWriter; +import java.io.Writer; + +/** + * The type Schema generator. + */ +public class SchemaGenerator { + /** + * The constant SCHEMA_GENERATION_ERROR. + */ + public static final String SCHEMA_GENERATION_ERROR = "SCHEMA_GENERATION_ERROR"; + + /** + * Generate string. + * + * @param schemaTemplateContext the schema template context + * @param entityType the entity type + * @param input the input + * @return the string + */ + public static String generate(SchemaTemplateContext schemaTemplateContext, + org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityType entityType, + SchemaTemplateInput input) { + Template schemaTemplate = + SchemaGeneratorConfig.getSchemaTemplate(schemaTemplateContext, entityType); + return processTemplate(input, schemaTemplate); + } + + private static String processTemplate(SchemaTemplateInput input, Template schemaTemplate) { + try (Writer writer = new StringWriter(1024)) { + schemaTemplate.process(input, writer); + return writer.toString(); + } catch (IOException | TemplateException exception) { + throw new CoreException( + new ErrorCode.ErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION) + .withId(SCHEMA_GENERATION_ERROR).withMessage(exception.getMessage()).build()); + } + } +} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/SchemaGeneratorConfig.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/SchemaGeneratorConfig.java new file mode 100644 index 0000000000..034d8520fb --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/SchemaGeneratorConfig.java @@ -0,0 +1,184 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 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 org.openecomp.sdc.vendorsoftwareproduct.services; + +import freemarker.cache.StringTemplateLoader; +import freemarker.template.Configuration; +import freemarker.template.Template; +import freemarker.template.TemplateExceptionHandler; +import org.openecomp.core.utilities.applicationconfig.ApplicationConfig; +import org.openecomp.core.utilities.applicationconfig.ApplicationConfigFactory; +import org.openecomp.core.utilities.applicationconfig.type.ConfigurationData; +import org.openecomp.sdc.common.errors.CoreException; +import org.openecomp.sdc.common.errors.ErrorCategory; +import org.openecomp.sdc.common.errors.ErrorCode; +import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.SchemaTemplateContext; + +import java.io.File; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + +/** + * The type Schema generator config. + */ +public class SchemaGeneratorConfig { + /** + * The constant SCHEMA_GENERATOR_INITIALIZATION_ERROR. + */ + public static final String SCHEMA_GENERATOR_INITIALIZATION_ERROR = + "SCHEMA_GENERATOR_INITIALIZATION_ERROR"; + /** + * The constant SCHEMA_GENERATOR_INITIALIZATION_ERROR_MSG. + */ + public static final String SCHEMA_GENERATOR_INITIALIZATION_ERROR_MSG = + "Error occurred while loading questionnaire schema schemaTemplates"; + private static final String CONFIGURATION_NAMESPACE = "vsp.schemaTemplates"; + private static Map<SchemaTemplateId, SchemaTemplate> schemaTemplates = new HashMap<>(); + private static ApplicationConfig applicationConfig = + ApplicationConfigFactory.getInstance().createInterface(); + + private static Configuration configuration = new Configuration(Configuration.VERSION_2_3_23); + private static StringTemplateLoader stringLoader = new StringTemplateLoader(); + + static { + configuration.setClassLoaderForTemplateLoading(SchemaGenerator.class.getClassLoader(), + File.pathSeparator); + configuration.setDefaultEncoding("UTF-8"); + configuration.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER); + configuration.setLogTemplateExceptions(true); + configuration.setTemplateLoader(stringLoader); + } + + /** + * Insert schema template. + * + * @param schemaTemplateContext the schema template context + * @param entityType the entity type + * @param schemaTemplateString the schema template string + */ + public static void insertSchemaTemplate(SchemaTemplateContext schemaTemplateContext, + org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityType entityType, + String schemaTemplateString) { + applicationConfig.insertValue(CONFIGURATION_NAMESPACE, + new SchemaTemplateId(schemaTemplateContext, entityType).toString(), schemaTemplateString); + } + + /** + * Gets schema template. + * + * @param schemaTemplateContext the schema template context + * @param entityType the entity type + * @return the schema template + */ + public static Template getSchemaTemplate(SchemaTemplateContext schemaTemplateContext, + org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityType entityType) { + SchemaTemplateId id = new SchemaTemplateId(schemaTemplateContext, entityType); + ConfigurationData configurationData = + applicationConfig.getConfigurationData(CONFIGURATION_NAMESPACE, id.toString()); + + SchemaTemplate schemaTemplate = schemaTemplates.get(id); + if (schemaTemplate == null || schemaTemplate.timestamp != configurationData.getTimeStamp()) { + stringLoader.putTemplate(id.toString(), configurationData.getValue()); + Template template; + try { + template = configuration.getTemplate(id.toString()); + } catch (IOException exception) { + throw new CoreException( + new ErrorCode.ErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION) + .withId(SCHEMA_GENERATOR_INITIALIZATION_ERROR) + .withMessage(SCHEMA_GENERATOR_INITIALIZATION_ERROR_MSG).build(), exception); + } + schemaTemplate = new SchemaTemplate(template, configurationData.getTimeStamp()); + schemaTemplates.put(id, schemaTemplate); + } + return schemaTemplate.template; + } + + private static class SchemaTemplateId { + private SchemaTemplateContext context; + private org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityType + entityType; + + /** + * Instantiates a new Schema template id. + * + * @param context the context + * @param entityType the entity type + */ + public SchemaTemplateId(SchemaTemplateContext context, + org.openecomp.sdc.vendorsoftwareproduct.types.composition + .CompositionEntityType entityType) { + this.context = context; + this.entityType = entityType; + } + + @Override + public String toString() { + return context + "." + entityType; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null || getClass() != obj.getClass()) { + return false; + } + + SchemaTemplateId that = (SchemaTemplateId) obj; + + if (entityType != that.entityType) { + return false; + } + if (context != that.context) { + return false; + } + + return true; + } + + @Override + public int hashCode() { + int result = entityType != null ? entityType.hashCode() : 0; + result = 31 * result + (context != null ? context.hashCode() : 0); + return result; + } + } + + private static class SchemaTemplate { + private Template template; + private long timestamp; + + /** + * Instantiates a new Schema template. + * + * @param template the template + * @param timestamp the timestamp + */ + public SchemaTemplate(Template template, long timestamp) { + this.template = template; + this.timestamp = timestamp; + } + } + +} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/CompositionEntityResponse.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/CompositionEntityResponse.java new file mode 100644 index 0000000000..6a71db041b --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/CompositionEntityResponse.java @@ -0,0 +1,53 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 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 org.openecomp.sdc.vendorsoftwareproduct.types; + +public class CompositionEntityResponse<T extends org.openecomp.sdc + .vendorsoftwareproduct.types.composition.CompositionDataEntity> { + + private String id; + private String schema; + private T data; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getSchema() { + return schema; + } + + public void setSchema(String schema) { + this.schema = schema; + } + + public T getData() { + return data; + } + + public void setData(T data) { + this.data = data; + } +} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/CompositionEntityValidationData.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/CompositionEntityValidationData.java new file mode 100644 index 0000000000..d334e18637 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/CompositionEntityValidationData.java @@ -0,0 +1,122 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 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 org.openecomp.sdc.vendorsoftwareproduct.types; + +import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityType; + +import java.util.ArrayList; +import java.util.Collection; + +/** + * The type Composition entity validation data. + */ +public class CompositionEntityValidationData { + private CompositionEntityType entityType; + private String entityId; + private Collection<String> errors; + private Collection<CompositionEntityValidationData> subEntitiesValidationData; + + /** + * Instantiates a new Composition entity validation data. + * + * @param entityType the entity type + * @param entityId the entity id + */ + public CompositionEntityValidationData(CompositionEntityType entityType, String entityId) { + this.entityType = entityType; + this.entityId = entityId; + } + + /** + * Gets entity type. + * + * @return the entity type + */ + public CompositionEntityType getEntityType() { + return entityType; + } + + /** + * Sets entity type. + * + * @param entityType the entity type + */ + public void setEntityType(CompositionEntityType entityType) { + this.entityType = entityType; + } + + /** + * Gets entity id. + * + * @return the entity id + */ + public String getEntityId() { + return entityId; + } + + /** + * Sets entity id. + * + * @param entityId the entity id + */ + public void setEntityId(String entityId) { + this.entityId = entityId; + } + + /** + * Gets errors. + * + * @return the errors + */ + public Collection<String> getErrors() { + return errors; + } + + /** + * Sets errors. + * + * @param errors the errors + */ + public void setErrors(Collection<String> errors) { + this.errors = errors; + } + + /** + * Gets sub entities validation data. + * + * @return the sub entities validation data + */ + public Collection<CompositionEntityValidationData> getSubEntitiesValidationData() { + return subEntitiesValidationData; + } + + /** + * Add sub entity validation data. + * + * @param subEntityValidationData the sub entity validation data + */ + public void addSubEntityValidationData(CompositionEntityValidationData subEntityValidationData) { + if (subEntitiesValidationData == null) { + subEntitiesValidationData = new ArrayList<>(); + } + subEntitiesValidationData.add(subEntityValidationData); + } +} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/ExtractCompositionDataContext.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/ExtractCompositionDataContext.java new file mode 100644 index 0000000000..0e34fc4e56 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/ExtractCompositionDataContext.java @@ -0,0 +1,204 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 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 org.openecomp.sdc.vendorsoftwareproduct.types; + +import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Nic; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * The type Extract composition data context. + */ +public class ExtractCompositionDataContext { + private List<org.openecomp.sdc.vendorsoftwareproduct.types.composition.Network> networks = + new ArrayList<>(); + private List<org.openecomp.sdc.vendorsoftwareproduct.types.composition.Component> components = + new ArrayList<>(); + private Map<String, Nic> nics = new HashMap<>(); + private Set<String> handledServiceTemplates = new HashSet<>(); + private Set<String> createdComponents = new HashSet<>(); + + /** + * Gets created components. + * + * @return the created components + */ + public Set<String> getCreatedComponents() { + return createdComponents; + } + + /** + * Sets created components. + * + * @param createdComponents the created components + */ + public void setCreatedComponents(Set<String> createdComponents) { + this.createdComponents = createdComponents; + } + + /** + * Gets handled service templates. + * + * @return the handled service templates + */ + public Set<String> getHandledServiceTemplates() { + return handledServiceTemplates; + } + + /** + * Sets handled service templates. + * + * @param handledServiceTemplates the handled service templates + */ + public void setHandledServiceTemplates(Set<String> handledServiceTemplates) { + this.handledServiceTemplates = handledServiceTemplates; + } + + /** + * Add handled service templates. + * + * @param handledServiceTemplate the handled service template + */ + public void addHandledServiceTemplates(String handledServiceTemplate) { + this.handledServiceTemplates.add(handledServiceTemplate); + } + + /** + * Gets networks. + * + * @return the networks + */ + public List<org.openecomp.sdc.vendorsoftwareproduct.types.composition.Network> getNetworks() { + return networks; + } + + /** + * Sets networks. + * + * @param networks the networks + */ + public void setNetworks( + List<org.openecomp.sdc.vendorsoftwareproduct.types.composition.Network> networks) { + this.networks = networks; + } + + /** + * Add network. + * + * @param network the network + */ + public void addNetwork( + org.openecomp.sdc.vendorsoftwareproduct.types.composition.Network network) { + if (network != null) { + networks.add(network); + } + } + + /** + * Add networks. + * + * @param network the network + */ + public void addNetworks( + List<org.openecomp.sdc.vendorsoftwareproduct.types.composition.Network> network) { + if (networks != null) { + networks.addAll(network); + } + } + + /** + * Gets components. + * + * @return the components + */ + public List<org.openecomp.sdc.vendorsoftwareproduct.types.composition.Component> getComponents() { + return components; + } + + /** + * Sets components. + * + * @param components the components + */ + public void setComponents( + List<org.openecomp.sdc.vendorsoftwareproduct.types.composition.Component> components) { + this.components = components; + } + + /** + * Add component. + * + * @param component the component + */ + public void addComponent( + org.openecomp.sdc.vendorsoftwareproduct.types.composition.Component component) { + if (component != null) { + components.add(component); + } + } + + /** + * Add components. + * + * @param components the components + */ + public void addComponents( + List<org.openecomp.sdc.vendorsoftwareproduct.types.composition.Component> components) { + if (components != null) { + this.components.addAll(components); + } + } + + /** + * Gets nics. + * + * @return the nics + */ + public Map<String, Nic> getNics() { + return nics; + } + + /** + * Sets nics. + * + * @param nics the nics + */ + public void setNics(Map<String, Nic> nics) { + this.nics = nics; + } + + /** + * Add nic. + * + * @param nicId the nic id + * @param nic the nic + */ + public void addNic(String nicId, Nic nic) { + this.nics.put(nicId, nic); + } + + +} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/LicensingData.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/LicensingData.java new file mode 100644 index 0000000000..f0f6c095dd --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/LicensingData.java @@ -0,0 +1,45 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 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 org.openecomp.sdc.vendorsoftwareproduct.types; + +import java.util.List; + +public class LicensingData { + + private String licenseAgreement; + private List<String> featureGroups; + + public String getLicenseAgreement() { + return licenseAgreement; + } + + public void setLicenseAgreement(String licenseAgreement) { + this.licenseAgreement = licenseAgreement; + } + + public List<String> getFeatureGroups() { + return featureGroups; + } + + public void setFeatureGroups(List<String> featureGroups) { + this.featureGroups = featureGroups; + } +} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/QuestionnaireResponse.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/QuestionnaireResponse.java new file mode 100644 index 0000000000..84a2ed58f8 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/QuestionnaireResponse.java @@ -0,0 +1,42 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 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 org.openecomp.sdc.vendorsoftwareproduct.types; + +public class QuestionnaireResponse { + private String schema; + private String data; + + public String getSchema() { + return schema; + } + + public void setSchema(String schema) { + this.schema = schema; + } + + public String getData() { + return data; + } + + public void setData(String data) { + this.data = data; + } +} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/QuestionnaireValidationResult.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/QuestionnaireValidationResult.java new file mode 100644 index 0000000000..d970e73a06 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/QuestionnaireValidationResult.java @@ -0,0 +1,39 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 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 org.openecomp.sdc.vendorsoftwareproduct.types; + +public class QuestionnaireValidationResult { + private boolean valid; + private CompositionEntityValidationData validationData; + + public QuestionnaireValidationResult(CompositionEntityValidationData validationData) { + this.validationData = validationData; + valid = validationData == null; + } + + public boolean isValid() { + return valid; + } + + public CompositionEntityValidationData getValidationData() { + return validationData; + } +} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/UploadFileResponse.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/UploadFileResponse.java new file mode 100644 index 0000000000..68389b6ed9 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/UploadFileResponse.java @@ -0,0 +1,143 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 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 org.openecomp.sdc.vendorsoftwareproduct.types; + + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class UploadFileResponse { + private List<String> fileNames; + private Map<String, List<org.openecomp.sdc.datatypes.error.ErrorMessage>> errors = + new HashMap<>(); + private UploadFileStatus status = UploadFileStatus.Success; + + /** + * Gets status. + * + * @return the status + */ + public UploadFileStatus getStatus() { + return status; + } + + /** + * Sets status. + * + * @param status the status + */ + public void setStatus(UploadFileStatus status) { + this.status = status; + } + + /** + * Gets file names. + * + * @return the file names + */ + public List<String> getFileNames() { + return fileNames; + } + + /** + * Sets file names. + * + * @param fileNames the file names + */ + public void setFileNames(List<String> fileNames) { + this.fileNames = fileNames; + } + + /** + * Add new file to list. + * + * @param filename the filename + */ + public void addNewFileToList(String filename) { + this.fileNames.add(filename); + } + + /** + * Remove file from list. + * + * @param toRemove the to remove + */ + public void removeFileFromList(String toRemove) { + this.fileNames.remove(toRemove); + } + + /** + * Add structure error. + * + * @param fileName the file name + * @param errorMessage the error message + */ + public void addStructureError(String fileName, + org.openecomp.sdc.datatypes.error.ErrorMessage errorMessage) { + List<org.openecomp.sdc.datatypes.error.ErrorMessage> errorList = errors.get(fileName); + if (errorList == null) { + errorList = new ArrayList<>(); + errors.put(fileName, errorList); + } + errorList.add(errorMessage); + if (org.openecomp.sdc.datatypes.error.ErrorLevel.ERROR.equals(errorMessage.getLevel())) { + status = UploadFileStatus.Failure; + } + } + + /** + * Add structure errors. + * + * @param errorsByFileName the errors by file name + */ + public void addStructureErrors( + Map<String, List<org.openecomp.sdc.datatypes.error.ErrorMessage>> errorsByFileName) { + if (errorsByFileName == null) { + return; + } + + errors.putAll(errorsByFileName); + + if (status == UploadFileStatus.Failure) { + return; + } + for (Map.Entry<String, List<org.openecomp.sdc.datatypes.error.ErrorMessage>> entry + : errorsByFileName.entrySet()) { + for (org.openecomp.sdc.datatypes.error.ErrorMessage errorMessage : entry.getValue()) { + if (errorMessage.getLevel() == org.openecomp.sdc.datatypes.error.ErrorLevel.ERROR) { + status = UploadFileStatus.Failure; + return; + } + } + } + } + + /** + * Gets errors. + * + * @return the errors + */ + public Map<String, List<org.openecomp.sdc.datatypes.error.ErrorMessage>> getErrors() { + return errors; + } +} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/UploadFileStatus.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/UploadFileStatus.java new file mode 100644 index 0000000000..2bd8d76a66 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/UploadFileStatus.java @@ -0,0 +1,26 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 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 org.openecomp.sdc.vendorsoftwareproduct.types; + +public enum UploadFileStatus { + Success, + Failure +} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/UploadFileStructure.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/UploadFileStructure.java new file mode 100644 index 0000000000..1e21c60577 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/UploadFileStructure.java @@ -0,0 +1,40 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 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 org.openecomp.sdc.vendorsoftwareproduct.types; + +import java.util.List; + +public class UploadFileStructure { + + private List<String> fileNames; + + public List<String> getFileNames() { + return fileNames; + } + + public void setFileNames(List<String> fileNames) { + this.fileNames = fileNames; + } + + public void addNewFileToList(String filename) { + this.fileNames.add(filename); + } +} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/ValidationResponse.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/ValidationResponse.java new file mode 100644 index 0000000000..29e5f73bce --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/ValidationResponse.java @@ -0,0 +1,157 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 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 org.openecomp.sdc.vendorsoftwareproduct.types; + +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.collections4.MapUtils; +import org.openecomp.sdc.common.errors.ErrorCode; +import org.openecomp.sdc.datatypes.error.ErrorMessage; + +import java.util.Collection; +import java.util.List; +import java.util.Map; + +/** + * The type Validation response. + */ +public class ValidationResponse { + private boolean valid = true; + private Collection<ErrorCode> vspErrors; + private Collection<ErrorCode> licensingDataErrors; + private Map<String, List<ErrorMessage>> uploadDataErrors; + private Map<String, List<ErrorMessage>> compilationErrors; + private QuestionnaireValidationResult questionnaireValidationResult; + + /** + * Is valid boolean. + * + * @return the boolean + */ + public boolean isValid() { + return valid; + } + + /** + * Gets vsp errors. + * + * @return the vsp errors + */ + public Collection<ErrorCode> getVspErrors() { + return vspErrors; + } + + /** + * Sets vsp errors. + * + * @param vspErrors the vsp errors + */ + public void setVspErrors(Collection<ErrorCode> vspErrors) { + this.vspErrors = vspErrors; + if (CollectionUtils.isNotEmpty(vspErrors)) { + valid = false; + } + } + + /** + * Gets licensing data errors. + * + * @return the licensing data errors + */ + public Collection<ErrorCode> getLicensingDataErrors() { + return licensingDataErrors; + } + + /** + * Sets licensing data errors. + * + * @param licensingDataErrors the licensing data errors + */ + public void setLicensingDataErrors(Collection<ErrorCode> licensingDataErrors) { + this.licensingDataErrors = licensingDataErrors; + if (CollectionUtils.isNotEmpty(licensingDataErrors)) { + valid = false; + } + } + + /** + * Gets upload data errors. + * + * @return the upload data errors + */ + public Map<String, List<ErrorMessage>> getUploadDataErrors() { + return uploadDataErrors; + } + + /** + * Sets upload data errors. + * + * @param uploadDataErrors the upload data errors + */ + public void setUploadDataErrors(Map<String, List<ErrorMessage>> uploadDataErrors) { + this.uploadDataErrors = uploadDataErrors; + if (MapUtils.isNotEmpty(uploadDataErrors)) { + valid = false; + } + } + + /** + * Gets compilation errors. + * + * @return the compilation errors + */ + public Map<String, List<ErrorMessage>> getCompilationErrors() { + return compilationErrors; + } + + /** + * Sets compilation errors. + * + * @param compilationErrors the compilation errors + */ + public void setCompilationErrors(Map<String, List<ErrorMessage>> compilationErrors) { + this.compilationErrors = compilationErrors; + if (MapUtils.isNotEmpty(compilationErrors)) { + valid = false; + } + } + + /** + * Gets questionnaire validation result. + * + * @return the questionnaire validation result + */ + public QuestionnaireValidationResult getQuestionnaireValidationResult() { + return questionnaireValidationResult; + } + + /** + * Sets questionnaire validation result. + * + * @param questionnaireValidationResult the questionnaire validation result + */ + public void setQuestionnaireValidationResult( + QuestionnaireValidationResult questionnaireValidationResult) { + this.questionnaireValidationResult = questionnaireValidationResult; + if (questionnaireValidationResult != null && !questionnaireValidationResult.isValid()) { + valid = false; + } + } +} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/VersionedVendorSoftwareProductInfo.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/VersionedVendorSoftwareProductInfo.java new file mode 100644 index 0000000000..cbc81da1ee --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/VersionedVendorSoftwareProductInfo.java @@ -0,0 +1,53 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 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 org.openecomp.sdc.vendorsoftwareproduct.types; + +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails; + +public class VersionedVendorSoftwareProductInfo { + private VspDetails vspDetails; + private org.openecomp.sdc.versioning.types.VersionInfo versionInfo; + + public VersionedVendorSoftwareProductInfo() { + } + + public VersionedVendorSoftwareProductInfo(VspDetails vspDetails, + org.openecomp.sdc.versioning.types.VersionInfo versionInfo) { + this.vspDetails = vspDetails; + this.versionInfo = versionInfo; + } + + public VspDetails getVspDetails() { + return vspDetails; + } + + public void setVspDetails(VspDetails vspDetails) { + this.vspDetails = vspDetails; + } + + public org.openecomp.sdc.versioning.types.VersionInfo getVersionInfo() { + return versionInfo; + } + + public void setVersionInfo(org.openecomp.sdc.versioning.types.VersionInfo versionInfo) { + this.versionInfo = versionInfo; + } +} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/schemagenerator/ComponentCompositionSchemaInput.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/schemagenerator/ComponentCompositionSchemaInput.java new file mode 100644 index 0000000000..7fb5ec890b --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/schemagenerator/ComponentCompositionSchemaInput.java @@ -0,0 +1,43 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 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 org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator; + +public class ComponentCompositionSchemaInput implements SchemaTemplateInput { + private boolean manual; + private org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComponentData component; + + public boolean isManual() { + return manual; + } + + public void setManual(boolean manual) { + this.manual = manual; + } + + public org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComponentData getComponent() { + return component; + } + + public void setComponent( + org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComponentData component) { + this.component = component; + } +} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/schemagenerator/ComponentQuestionnaireSchemaInput.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/schemagenerator/ComponentQuestionnaireSchemaInput.java new file mode 100644 index 0000000000..1f92e6d957 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/schemagenerator/ComponentQuestionnaireSchemaInput.java @@ -0,0 +1,42 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 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 org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator; + +import java.util.List; +import java.util.Map; + +public class ComponentQuestionnaireSchemaInput implements SchemaTemplateInput { + private List<String> nicNames; + private Map componentQuestionnaireData; + + public ComponentQuestionnaireSchemaInput(List<String> nicNames, Map componentQuestionnaireData) { + this.nicNames = nicNames; + this.componentQuestionnaireData = componentQuestionnaireData; + } + + public List<String> getNicNames() { + return nicNames; + } + + public Map getComponentQuestionnaireData() { + return componentQuestionnaireData; + } +} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/schemagenerator/MibUploadStatus.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/schemagenerator/MibUploadStatus.java new file mode 100644 index 0000000000..046d53054e --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/schemagenerator/MibUploadStatus.java @@ -0,0 +1,51 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 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 org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator; + +public class MibUploadStatus { + private String snmpTrap; + private String snmpPoll; + + + public MibUploadStatus(String snmpTrap, String snmpPoll) { + this.snmpTrap = snmpTrap; + this.snmpPoll = snmpPoll; + } + + public MibUploadStatus() { + } + + public String getSnmpTrap() { + return snmpTrap; + } + + public void setSnmpTrap(String snmpTrap) { + this.snmpTrap = snmpTrap; + } + + public String getSnmpPoll() { + return snmpPoll; + } + + public void setSnmpPoll(String snmpPoll) { + this.snmpPoll = snmpPoll; + } +} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/schemagenerator/NetworkCompositionSchemaInput.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/schemagenerator/NetworkCompositionSchemaInput.java new file mode 100644 index 0000000000..456b4409fd --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/schemagenerator/NetworkCompositionSchemaInput.java @@ -0,0 +1,43 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 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 org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator; + +public class NetworkCompositionSchemaInput implements SchemaTemplateInput { + private boolean manual; + private org.openecomp.sdc.vendorsoftwareproduct.types.composition.Network network; + + public boolean isManual() { + return manual; + } + + public void setManual(boolean manual) { + this.manual = manual; + } + + public org.openecomp.sdc.vendorsoftwareproduct.types.composition.Network getNetwork() { + return network; + } + + public void setNetwork(org.openecomp.sdc.vendorsoftwareproduct.types.composition + .Network network) { + this.network = network; + } +} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/schemagenerator/NicCompositionSchemaInput.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/schemagenerator/NicCompositionSchemaInput.java new file mode 100644 index 0000000000..87693a492c --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/schemagenerator/NicCompositionSchemaInput.java @@ -0,0 +1,55 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 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 org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator; + +import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Nic; + +import java.util.Collection; + +public class NicCompositionSchemaInput implements SchemaTemplateInput { + private boolean manual; + private Nic nic; + private Collection<String> networkIds; + + public boolean isManual() { + return manual; + } + + public void setManual(boolean manual) { + this.manual = manual; + } + + public Nic getNic() { + return nic; + } + + public void setNic(Nic nic) { + this.nic = nic; + } + + public Collection<String> getNetworkIds() { + return networkIds; + } + + public void setNetworkIds(Collection<String> networkIds) { + this.networkIds = networkIds; + } +} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/schemagenerator/SchemaTemplateContext.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/schemagenerator/SchemaTemplateContext.java new file mode 100644 index 0000000000..3ee3e4a5e6 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/schemagenerator/SchemaTemplateContext.java @@ -0,0 +1,26 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 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 org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator; + +public enum SchemaTemplateContext { + composition, + questionnaire +} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/schemagenerator/SchemaTemplateInput.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/schemagenerator/SchemaTemplateInput.java new file mode 100644 index 0000000000..93e614f98b --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/schemagenerator/SchemaTemplateInput.java @@ -0,0 +1,25 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 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 org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator; + +public interface SchemaTemplateInput { + +} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/util/CompilationUtil.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/util/CompilationUtil.java new file mode 100644 index 0000000000..54038bcd73 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/util/CompilationUtil.java @@ -0,0 +1,126 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 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 org.openecomp.sdc.vendorsoftwareproduct.util; + +import org.openecomp.core.enrichment.types.ComponentArtifactType; +import org.openecomp.core.enrichment.types.ComponentCeilometerInfo; +import org.openecomp.core.enrichment.types.ComponentMibInfo; +import org.openecomp.core.enrichment.types.MibInfo; +import org.openecomp.core.utilities.applicationconfig.ApplicationConfig; +import org.openecomp.core.utilities.applicationconfig.ApplicationConfigFactory; +import org.openecomp.core.utilities.json.JsonUtil; +import org.openecomp.sdc.datatypes.error.ErrorMessage; +import org.openecomp.sdc.enrichment.impl.tosca.ComponentInfo; +import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentArtifactDao; +import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentArtifactDaoFactory; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentArtifactEntity; +import org.openecomp.sdc.versioning.dao.types.Version; + +import java.io.File; +import java.util.List; +import java.util.Map; + +/** + * The type Compilation util. + */ +public class CompilationUtil { + + private static final ApplicationConfig applicationConfig = + ApplicationConfigFactory.getInstance().createInterface(); + private static final ComponentArtifactDao componentArtifactDao = + ComponentArtifactDaoFactory.getInstance().createInterface(); + + /** + * Add monitoring info. + * + * @param componentInfo the component info + * @param compileErrors the compile errors + */ + public static void addMonitoringInfo(ComponentInfo componentInfo, + Map<String, List<ErrorMessage>> compileErrors) { + + String ceilometerJson = + applicationConfig.getConfigurationData("vsp.monitoring", "component.ceilometer").getValue(); + ComponentCeilometerInfo ceilometerInfo = + JsonUtil.json2Object(ceilometerJson, ComponentCeilometerInfo.class); + componentInfo.setCeilometerInfo(ceilometerInfo); + } + + /** + * Add mib info. + * + * @param vspId the vsp id + * @param version the version + * @param componentEntity the component entity + * @param componentInfo the component info + * @param compileErrors the compile errors + */ + public static void addMibInfo(String vspId, Version version, org.openecomp.sdc + .vendorsoftwareproduct.dao.type.ComponentEntity componentEntity, + ComponentInfo componentInfo, + Map<String, List<ErrorMessage>> compileErrors) { + + String componentId = componentEntity.getId(); + + ComponentArtifactEntity entity = new ComponentArtifactEntity(); + entity.setVspId(vspId); + entity.setVersion(version); + entity.setComponentId(componentId); + + ComponentMibInfo componentMibInfo = new ComponentMibInfo(); + + extractAndInsertMibContentToComponentInfo(componentId, ComponentArtifactType.SNMP_POLL, entity, + componentMibInfo, compileErrors); + extractAndInsertMibContentToComponentInfo(componentId, ComponentArtifactType.SNMP_TRAP, entity, + componentMibInfo, compileErrors); + componentInfo.setMibInfo(componentMibInfo); + } + + private static void extractAndInsertMibContentToComponentInfo(String componentId, + ComponentArtifactType type, + ComponentArtifactEntity componentArtifactEntity, + ComponentMibInfo componentMibInfo, + Map<String, List<ErrorMessage>> compileErrors) { + String path; + componentArtifactEntity.setType(type); + ComponentArtifactEntity artifact = + componentArtifactDao.getArtifactByType(componentArtifactEntity); + + if (artifact == null) { + return; + } + path = componentId + File.separator + type.name(); + MibInfo mibInfo = new MibInfo(); + mibInfo.setName(path); + mibInfo.setContent(artifact.getArtifact().array()); + switch (type) { + case SNMP_POLL: + componentMibInfo.setSnmpPoll(mibInfo); + break; + case SNMP_TRAP: + componentMibInfo.setSnmpTrap(mibInfo); + break; + default: + } + + + } +} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/util/VendorSoftwareProductUtils.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/util/VendorSoftwareProductUtils.java new file mode 100644 index 0000000000..62e8dd8b87 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/util/VendorSoftwareProductUtils.java @@ -0,0 +1,254 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 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 org.openecomp.sdc.vendorsoftwareproduct.util; + +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.collections4.MapUtils; +import org.openecomp.core.enrichment.types.ComponentArtifactType; +import org.openecomp.core.translator.api.HeatToToscaTranslator; +import org.openecomp.core.translator.datatypes.TranslatorOutput; +import org.openecomp.core.translator.factory.HeatToToscaTranslatorFactory; +import org.openecomp.core.utilities.file.FileContentHandler; +import org.openecomp.core.utilities.file.FileUtils; +import org.openecomp.core.validation.errors.Messages; +import org.openecomp.core.validation.types.MessageContainerUtil; +import org.openecomp.sdc.common.errors.CoreException; +import org.openecomp.sdc.common.errors.ErrorCategory; +import org.openecomp.sdc.common.errors.ErrorCode; +import org.openecomp.sdc.common.utils.AsdcCommon; +import org.openecomp.sdc.datatypes.error.ErrorMessage; +import org.openecomp.sdc.heat.datatypes.structure.HeatStructureTree; +import org.openecomp.sdc.heat.datatypes.structure.ValidationStructureList; +import org.openecomp.sdc.heat.services.tree.HeatTreeManager; +import org.openecomp.sdc.heat.services.tree.HeatTreeManagerUtil; +import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDaoFactory; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentArtifactEntity; +import org.openecomp.sdc.vendorsoftwareproduct.types.UploadFileResponse; + +import java.io.ByteArrayInputStream; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.zip.ZipEntry; +import java.util.zip.ZipInputStream; + +/** + * The type Vendor software product utils. + */ +public class VendorSoftwareProductUtils { + + private static org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDao + vendorSoftwareProductDao = + VendorSoftwareProductDaoFactory.getInstance().createInterface(); + + /** + * Load upload file content file content handler. + * + * @param uploadedFileData the uploaded file data + * @return the file content handler + * @throws IOException the io exception + */ + public static FileContentHandler loadUploadFileContent(byte[] uploadedFileData) + throws IOException { + return getFileContentMapFromZip(uploadedFileData); + } + + private static FileContentHandler getFileContentMapFromZip(byte[] uploadFileData) + throws IOException, CoreException { + ZipEntry zipEntry; + List<String> folderList = new ArrayList<>(); + FileContentHandler mapFileContent = new FileContentHandler(); + try { + ZipInputStream inputZipStream; + + byte[] fileByteContent; + String currentEntryName; + inputZipStream = new ZipInputStream(new ByteArrayInputStream(uploadFileData)); + + while ((zipEntry = inputZipStream.getNextEntry()) != null) { + currentEntryName = zipEntry.getName(); + // else, get the file content (as byte array) and save it in a map. + fileByteContent = FileUtils.toByteArray(inputZipStream); + + int index = lastIndexFileSeparatorIndex(currentEntryName); + String currSubstringWithoutSeparator = + currentEntryName.substring(index + 1, currentEntryName.length()); + if (index != -1) { //todo ? + folderList.add(currentEntryName); + } else { + mapFileContent.addFile(currentEntryName, fileByteContent); + } + + } + + } catch (RuntimeException e0) { + throw new IOException(e0); + } + + if (CollectionUtils.isNotEmpty(folderList)) { + throw new CoreException((new ErrorCode.ErrorCodeBuilder()) + .withMessage(Messages.ZIP_SHOULD_NOT_CONTAIN_FOLDERS.getErrorMessage()) + .withId(Messages.ZIP_SHOULD_NOT_CONTAIN_FOLDERS.getErrorMessage()) + .withCategory(ErrorCategory.APPLICATION).build()); + } + + return mapFileContent; + } + + /** + * Load and translate template data translator output. + * + * @param fileNameContentMap the file name content map + * @return the translator output + */ + public static TranslatorOutput loadAndTranslateTemplateData( + FileContentHandler fileNameContentMap) { + HeatToToscaTranslator heatToToscaTranslator = + HeatToToscaTranslatorFactory.getInstance().createInterface(); + InputStream fileContent = fileNameContentMap.getFileContent(AsdcCommon.MANIFEST_NAME); + + heatToToscaTranslator.addManifest(AsdcCommon.MANIFEST_NAME, FileUtils.toByteArray(fileContent)); + + fileNameContentMap.getFileList().stream() + .filter(fileName -> !(fileName.equals(AsdcCommon.MANIFEST_NAME))).forEach( + fileName -> heatToToscaTranslator + .addFile(fileName, FileUtils.toByteArray(fileNameContentMap.getFileContent(fileName)))); + + Map<String, List<ErrorMessage>> errors = heatToToscaTranslator.validate(); + if (MapUtils.isNotEmpty(MessageContainerUtil.getMessageByLevel( + org.openecomp.sdc.datatypes.error.ErrorLevel.ERROR, errors))) { + TranslatorOutput translatorOutput = new TranslatorOutput(); + translatorOutput.setErrorMessages(errors); + return translatorOutput; + } + + InputStream structureFile = getHeatStructureTreeFile(fileNameContentMap); + heatToToscaTranslator.addExternalArtifacts(AsdcCommon.HEAT_META, structureFile); + return heatToToscaTranslator.translate(); + } + + private static InputStream getHeatStructureTreeFile(FileContentHandler fileNameContentMap) { + HeatTreeManager heatTreeManager = HeatTreeManagerUtil.initHeatTreeManager(fileNameContentMap); + heatTreeManager.createTree(); + HeatStructureTree tree = heatTreeManager.getTree(); + ValidationStructureList validationStructureList = new ValidationStructureList(tree); + return FileUtils.convertToInputStream(validationStructureList, FileUtils.FileExtension.JSON); + } + + + private static int lastIndexFileSeparatorIndex(String filePath) { + int length = filePath.length() - 1; + + for (int i = length; i >= 0; i--) { + char currChar = filePath.charAt(i); + if (currChar == '/' || currChar == File.separatorChar || currChar == File.pathSeparatorChar) { + return i; + } + } + // if we've reached to the start of the string and didn't find file separator - return -1 + return -1; + } + + /** + * Add file names to upload file response. + * + * @param fileContentMap the file content map + * @param uploadFileResponse the upload file response + */ + public static void addFileNamesToUploadFileResponse(FileContentHandler fileContentMap, + UploadFileResponse uploadFileResponse) { + uploadFileResponse.setFileNames(new ArrayList<>()); + for (String filename : fileContentMap.getFileList()) { + if (!new File(filename).isDirectory()) { + uploadFileResponse.addNewFileToList(filename); + } + } + uploadFileResponse.removeFileFromList(AsdcCommon.MANIFEST_NAME); + } + + /** + * Validate raw zip data. + * + * @param uploadedFileData the uploaded file data + * @param errors the errors + */ + public static void validateRawZipData(byte[] uploadedFileData, + Map<String, List<ErrorMessage>> errors) { + if (uploadedFileData.length == 0) { + ErrorMessage.ErrorMessageUtil.addMessage(AsdcCommon.UPLOAD_FILE, errors).add( + new ErrorMessage(org.openecomp.sdc.datatypes.error.ErrorLevel.ERROR, + Messages.NO_ZIP_FILE_WAS_UPLOADED_OR_ZIP_NOT_EXIST.getErrorMessage())); + } + } + + /** + * Validate content zip data. + * + * @param contentMap the content map + * @param errors the errors + */ + public static void validateContentZipData(FileContentHandler contentMap, + Map<String, List<ErrorMessage>> errors) { + if (contentMap == null) { + ErrorMessage.ErrorMessageUtil.addMessage(AsdcCommon.UPLOAD_FILE, errors).add( + new ErrorMessage(org.openecomp.sdc.datatypes.error.ErrorLevel.ERROR, + Messages.ZIP_SHOULD_NOT_CONTAIN_FOLDERS.getErrorMessage())); + + } else if (contentMap.getFileList().size() == 0) { + ErrorMessage.ErrorMessageUtil.addMessage(AsdcCommon.UPLOAD_FILE, errors) + .add(new ErrorMessage(org.openecomp.sdc.datatypes.error.ErrorLevel.ERROR, + Messages.INVALID_ZIP_FILE.getErrorMessage())); + } + } + + + /** + * Filter non trap or poll artifacts map. + * + * @param artifacts the artifacts + * @return the map + */ + public static Map<ComponentArtifactType, String> filterNonTrapOrPollArtifacts( + Collection<ComponentArtifactEntity> artifacts) { + Map<ComponentArtifactType, String> artifactTypeToFilename = new HashMap<>(); + + for (ComponentArtifactEntity entity : artifacts) { + if (isTrapOrPoll(entity.getType())) { + artifactTypeToFilename.put(entity.getType(), entity.getArtifactName()); + } + } + + return artifactTypeToFilename; + } + + + private static boolean isTrapOrPoll(ComponentArtifactType type) { + return type.equals(ComponentArtifactType.SNMP_POLL) + || type.equals(ComponentArtifactType.SNMP_TRAP); + } + + +} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/ComponentProcessesTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/ComponentProcessesTest.java new file mode 100644 index 0000000000..cfc2e111ac --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/ComponentProcessesTest.java @@ -0,0 +1,46 @@ +package org.openecomp.sdc.vendorsoftwareproduct; + +import org.testng.annotations.BeforeClass; + +public class ComponentProcessesTest extends ProcessesTest { + + @BeforeClass + @Override + protected void init() { +// super.init(); +// +// org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity +// comp11 = new org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity(vsp1Id, null, null); +// org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComponentData +// compData11 = new org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComponentData(); +// compData11.setName("c11 name"); +// compData11.setDescription("c11 desc"); +// comp11.setComponentCompositionData(compData11); +// +//// component11Id = vendorSoftwareProductManager.createComponent(comp11, USER1).getId(); +// +// org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity +// comp21 = new org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity(vsp2Id, null, null); +// org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComponentData +// compData21 = new org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComponentData(); +// compData21.setName("c21 name"); +// compData21.setDescription("c21 desc"); +// comp21.setComponentCompositionData(compData21); + +// component21Id = vendorSoftwareProductManager.createComponent(comp21, USER1).getId(); + } + + @Override + public void testCreateWithExistingNameUnderOtherComponent() { +// org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity +// comp12 = new org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity(vsp1Id, null, null); +// org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComponentData +// compData12 = new org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComponentData(); +// compData12.setName("c12 name"); +// compData12.setDescription("c12 desc"); +// comp12.setComponentCompositionData(compData12); +// +// String component12Id = vendorSoftwareProductManager.createComponent(comp12, USER1).getId(); +// testCreate(vsp1Id, component12Id); + } +} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/ComponentsTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/ComponentsTest.java new file mode 100644 index 0000000000..ff33bcb9ee --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/ComponentsTest.java @@ -0,0 +1,329 @@ +package org.openecomp.sdc.vendorsoftwareproduct; + +import org.openecomp.sdc.common.errors.CoreException; +import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDaoFactory; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails; +import org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes; +import org.openecomp.sdc.vendorsoftwareproduct.impl.VendorSoftwareProductManagerImpl; +import org.openecomp.sdc.vendorsoftwareproduct.types.CompositionEntityResponse; +import org.openecomp.sdc.vendorsoftwareproduct.types.CompositionEntityValidationData; +import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComponentData; +import org.openecomp.sdc.versioning.dao.types.Version; +import org.openecomp.sdc.versioning.errors.VersioningErrorCodes; +import org.openecomp.core.utilities.CommonMethods; + +import org.testng.Assert; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; + +import java.util.Collection; + +public class ComponentsTest { + + private static final String USER1 = "componentsTestUser1"; + private static final String USER2 = "componentsTestUser2"; + private static final Version VERSION01 = new Version(0, 1); + private static final VendorSoftwareProductManager vendorSoftwareProductManager = + new VendorSoftwareProductManagerImpl(); + private static final org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDao + vendorSoftwareProductDao = + VendorSoftwareProductDaoFactory.getInstance().createInterface(); + + private static String vsp1Id; + private static String vsp2Id; + private static String comp1Id = "1"; + private static String comp2Id = "2"; + + static org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity createComponent(String vspId, Version version, String compId) { + org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity + componentEntity = new org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity(vspId, version, compId); + ComponentData compData = new ComponentData(); + compData.setName(compId + " name"); + compData.setDisplayName(compId + " display name"); + compData.setDescription(compId + " desc"); + componentEntity.setComponentCompositionData(compData); + vendorSoftwareProductDao.createComponent(componentEntity); + return componentEntity; + } + + @BeforeClass + private void init() { + VspDetails vsp1 = vendorSoftwareProductManager.createNewVsp(VSPCommon + .createVspDetails(null, null, "VSP_" + CommonMethods.nextUuId(), "Test-vsp1", "vendorName", + "vlm1Id", "icon", "category", "subCategory", "123", null), USER1); + vsp1Id = vsp1.getId(); + + VspDetails vsp2 = vendorSoftwareProductManager.createNewVsp(VSPCommon + .createVspDetails(null, null, "VSP_" + CommonMethods.nextUuId(), "Test-vsp2", "vendorName", + "vlm1Id", "icon", "category", "subCategory", "123", null), USER1); + vsp2Id = vsp2.getId(); + } + + @Test + public void testListWhenNone() { + Collection<org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity> components = + vendorSoftwareProductManager.listComponents(vsp1Id, null, USER1); + Assert.assertEquals(components.size(), 0); + } + + @Test + public void testCreateNonExistingVspId_negative() { + testCreate_negative(new org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity("non existing vsp id", null, null), USER1, + VersioningErrorCodes.VERSIONABLE_ENTITY_NOT_EXIST); + } + + @Test + public void testCreateOnLockedVsp_negative() { + testCreate_negative(new org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity(vsp1Id, null, null), USER2, + VersioningErrorCodes.EDIT_ON_ENTITY_LOCKED_BY_OTHER_USER); + } + +/* @Test(dependsOnMethods = "testListWhenNone") + public void testCreate() { + comp1Id = testCreate(vsp1Id); + } + + private String testCreate(String vspId) { + ComponentEntity expected = new ComponentEntity(vspId, null, null); + ComponentData compData = new ComponentData(); + compData.setName("comp1 name"); + compData.setDescription("comp1 desc"); + expected.setComponentCompositionData(compData); + + ComponentEntity created = vendorSoftwareProductManager.createComponent(expected, USER1); + Assert.assertNotNull(created); + expected.setId(created.getId()); + expected.setVersion(VERSION01); + + ComponentEntity actual = vendorSoftwareProductDao.getComponent(vspId, VERSION01, created.getId()); + + Assert.assertEquals(actual, expected); + return created.getId(); + }*/ + +/* @Test(dependsOnMethods = {"testCreate"}) + public void testCreateWithExistingName_negative() { + ComponentEntity component = new ComponentEntity(vsp1Id, null, null); + ComponentData compData = new ComponentData(); + compData.setName("comp1 name"); + compData.setDescription("comp1 desc"); + component.setComponentCompositionData(compData); + testCreate_negative(component, USER1, UniqueValueUtil.UNIQUE_VALUE_VIOLATION); + }*/ + +/* @Test(dependsOnMethods = {"testCreate"}) + public void testCreateWithExistingNameUnderOtherVsp() { + testCreate(vsp2Id); + }*/ + + @Test + public void testCreateOnUploadVsp_negative() { + testCreate_negative(new org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity(vsp1Id, null, null), USER1, + VendorSoftwareProductErrorCodes.VSP_COMPOSITION_EDIT_NOT_ALLOWED); + } + + @Test + public void testGetNonExistingComponentId_negative() { + testGet_negative(vsp1Id, null, "non existing component id", USER1, + VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND); + } + + @Test + public void testGetNonExistingVspId_negative() { + testGet_negative("non existing vsp id", null, comp1Id, USER1, + VersioningErrorCodes.VERSIONABLE_ENTITY_NOT_EXIST); + } + + @Test(dependsOnMethods = "testListWhenNone")//"testCreate") + public void testGet() { + org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity + expected = createComponent(vsp1Id, VERSION01, comp1Id); + testGet(vsp1Id, VERSION01, comp1Id, USER1, expected); + } + + @Test + public void testUpdateNonExistingComponentId_negative() { + testUpdate_negative(vsp1Id, "non existing component id", USER1, + VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND); + } + + @Test + public void testUpdateNonExistingVspId_negative() { + testUpdate_negative("non existing vsp id", comp1Id, USER1, + VersioningErrorCodes.VERSIONABLE_ENTITY_NOT_EXIST); + } + + @Test(dependsOnMethods = {"testGet"}) + public void testUpdateOnUploadVsp() { + org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity + expected = new org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity(vsp1Id, null, comp1Id); + ComponentData compData = new ComponentData(); + compData.setName(comp1Id + " name"); // no change + compData.setDisplayName(comp1Id + " display name"); // no change + compData.setDescription(comp1Id + " desc updated"); // allowed change + expected.setComponentCompositionData(compData); + + CompositionEntityValidationData validationData = + vendorSoftwareProductManager.updateComponent(expected, USER1); + Assert.assertTrue(validationData == null || validationData.getErrors() == null); + expected.setVersion(VERSION01); + + org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity actual = vendorSoftwareProductDao.getComponent(vsp1Id, VERSION01, comp1Id); + Assert.assertEquals(actual, expected); + } + + @Test(dependsOnMethods = {"testUpdateOnUploadVsp"}) + public void testIllegalUpdateOnUploadVsp() { + org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity + expected = new org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity(vsp1Id, null, comp1Id); + ComponentData compData = new ComponentData(); + compData + .setName("comp1 name updated"); // not allowed: changed name + omitted display name + expected.setComponentCompositionData(compData); + + CompositionEntityValidationData validationData = + vendorSoftwareProductManager.updateComponent(expected, USER1); + Assert.assertNotNull(validationData); + Assert.assertEquals(validationData.getErrors().size(), 2); + } + + @Test + public void testListNonExistingVspId_negative() { + testList_negative("non existing vsp id", null, USER1, + VersioningErrorCodes.VERSIONABLE_ENTITY_NOT_EXIST); + } +/* + @Test(dependsOnMethods = {"testUpdateOnUploadVsp", "testList"}) + public void testCreateWithERemovedName() { + testCreate(vsp1Id); + } + + @Test(dependsOnMethods = "testList") + public void testDeleteNonExistingComponentId_negative() { + testDelete_negative(vsp1Id, "non existing component id", USER1, VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND); + }*/ + + @Test(dependsOnMethods = {"testGet"}) + public void testList() { + org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity + createdP2 = createComponent(vsp1Id, VERSION01, comp2Id); + + Collection<org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity> actual = + vendorSoftwareProductManager.listComponents(vsp1Id, null, USER1); + Assert.assertEquals(actual.size(), 2); + } + + @Test + public void testDeleteNonExistingVspId_negative() { + testDelete_negative("non existing vsp id", comp1Id, USER1, + VersioningErrorCodes.VERSIONABLE_ENTITY_NOT_EXIST); + } +/* + @Test(dependsOnMethods = "testList") + public void testDelete() { + vendorSoftwareProductManager.deleteComponent(vsp1Id, comp1Id, USER1); + ComponentEntity actual = vendorSoftwareProductDao.getComponent(vsp1Id, VERSION01, comp1Id); + Assert.assertNull(actual); + }*/ + + @Test + public void testDeleteOnUploadVsp_negative() { + testDelete_negative(vsp1Id, comp1Id, USER1, + VendorSoftwareProductErrorCodes.VSP_COMPOSITION_EDIT_NOT_ALLOWED); + } + + @Test + public void testDeleteListNonExistingVspId_negative() { + testDeleteList_negative("non existing vsp id", USER1, + VersioningErrorCodes.VERSIONABLE_ENTITY_NOT_EXIST); + } +/* + @Test(dependsOnMethods = "testDelete") + public void testDeleteList() { + ComponentEntity comp3 = new ComponentEntity(vsp1Id, null, null); + comp3.setName("comp3 name"); + comp3.setDescription("comp3 desc"); + vendorSoftwareProductManager.createComponent(comp3, USER1); + + vendorSoftwareProductManager.deleteComponents(vsp1Id, USER1); + + Collection<ComponentEntity> actual = vendorSoftwareProductManager.listComponents(vsp1Id, null, USER1); + Assert.assertEquals(actual.size(), 0); + }*/ + + @Test + public void testDeleteListOnUploadVsp_negative() { + testDeleteList_negative(vsp1Id, USER1, + VendorSoftwareProductErrorCodes.VSP_COMPOSITION_EDIT_NOT_ALLOWED); + } + + private void testGet(String vspId, Version version, String componentId, String user, + org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity expected) { + CompositionEntityResponse<ComponentData> response = + vendorSoftwareProductManager.getComponent(vspId, null, componentId, user); + Assert.assertEquals(response.getId(), expected.getId()); + Assert.assertEquals(response.getData(), expected.getComponentCompositionData()); + Assert.assertNotNull(response.getSchema()); + } + + private void testCreate_negative( + org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity component, String user, + String expectedErrorCode) { + try { + vendorSoftwareProductManager.createComponent(component, user); + Assert.fail(); + } catch (CoreException e) { + Assert.assertEquals(e.code().id(), expectedErrorCode); + } + } + + private void testGet_negative(String vspId, Version version, String componentId, String user, + String expectedErrorCode) { + try { + vendorSoftwareProductManager.getComponent(vspId, version, componentId, user); + Assert.fail(); + } catch (CoreException e) { + Assert.assertEquals(e.code().id(), expectedErrorCode); + } + } + + private void testUpdate_negative(String vspId, String componentId, String user, + String expectedErrorCode) { + try { + vendorSoftwareProductManager + .updateComponent(new org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity(vspId, null, componentId), user); + Assert.fail(); + } catch (CoreException e) { + Assert.assertEquals(e.code().id(), expectedErrorCode); + } + } + + private void testList_negative(String vspId, Version version, String user, + String expectedErrorCode) { + try { + vendorSoftwareProductManager.listComponents(vspId, version, user); + Assert.fail(); + } catch (CoreException e) { + Assert.assertEquals(e.code().id(), expectedErrorCode); + } + } + + private void testDeleteList_negative(String vspId, String user, String expectedErrorCode) { + try { + vendorSoftwareProductManager.deleteComponents(vspId, user); + Assert.fail(); + } catch (CoreException e) { + Assert.assertEquals(e.code().id(), expectedErrorCode); + } + } + + private void testDelete_negative(String vspId, String componentId, String user, + String expectedErrorCode) { + try { + vendorSoftwareProductManager.deleteComponent(vspId, componentId, user); + Assert.fail(); + } catch (CoreException e) { + Assert.assertEquals(e.code().id(), expectedErrorCode); + } + } +}
\ No newline at end of file diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/ComponentsUploadTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/ComponentsUploadTest.java new file mode 100644 index 0000000000..0819d89851 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/ComponentsUploadTest.java @@ -0,0 +1,159 @@ +package org.openecomp.sdc.vendorsoftwareproduct; + +import org.openecomp.sdc.vendorlicense.facade.VendorLicenseFacade; +import org.openecomp.sdc.vendorlicense.facade.VendorLicenseFacadeFactory; +import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDao; +import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDaoFactory; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails; +import org.openecomp.sdc.vendorsoftwareproduct.impl.VendorSoftwareProductManagerImpl; +import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.MibUploadStatus; +import org.openecomp.sdc.versioning.dao.types.Version; +import org.openecomp.core.util.UniqueValueUtil; +import org.openecomp.core.utilities.CommonMethods; + +import org.testng.Assert; +import org.testng.annotations.BeforeTest; +import org.testng.annotations.Test; + +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; + +public class ComponentsUploadTest { + + private static final String USER1 = "vspTestUser1"; + + private static VendorSoftwareProductManager vendorSoftwareProductManager = + new VendorSoftwareProductManagerImpl(); + private static VendorSoftwareProductDao vendorSoftwareProductDao = + VendorSoftwareProductDaoFactory.getInstance().createInterface(); + private static VendorLicenseFacade vendorLicenseFacade = + VendorLicenseFacadeFactory.getInstance().createInterface(); + + private static String vspId = null; + private static Version activeVersion = null; + private static String trapFileName = "MMSC.zip"; + private static String pollFileName = "MNS OAM FW.zip"; + private static String notZipFileName = "notZipFile"; + private static String zipWithFoldersFileName = "zipFileWithFolder.zip"; + private static String emptyZipFileName = "emptyZip.zip"; + private String vlm1Id; + private String componentId; + + @BeforeTest + private void init() { + UniqueValueUtil + .deleteUniqueValue(VendorSoftwareProductConstants.UniqueValues.VENDOR_SOFTWARE_PRODUCT_NAME, + "VSPTestMib"); + vlm1Id = vendorLicenseFacade.createVendorLicenseModel(VSPCommon + .createVendorLicenseModel("vlmName " + CommonMethods.nextUuId(), "vlm1Id desc", "icon1"), + USER1).getId(); + VspDetails vspDetails = vendorSoftwareProductManager.createNewVsp(VSPCommon + .createVspDetails(null, null, "VSPTestMib", "Test-vsp-mib", "vendorName", vlm1Id, "icon", + "category", "subCategory", "123", null), USER1); + + vspId = vspDetails.getId(); + activeVersion = vspDetails.getVersion(); + componentId = createComponent(new ComponentEntity(vspId, activeVersion, null)).getId(); + } + + + @Test + public void testUploadAndFilenamesList() { + InputStream zis1 = getFileInputStream("/validation/zips/various/MMSC.zip"); + InputStream zis2 = getFileInputStream("/validation/zips/various/MNS OAM FW.zip"); + + vendorSoftwareProductManager + .uploadComponentMib(zis1, "MMSC.zip", vspId, componentId, true, USER1); + vendorSoftwareProductManager + .uploadComponentMib(zis2, "MNS OAM FW.zip", vspId, componentId, false, USER1); + + MibUploadStatus mibUploadStatus = + vendorSoftwareProductManager.listMibFilenames(vspId, componentId, USER1); + Assert.assertEquals(mibUploadStatus.getSnmpTrap(), trapFileName); + Assert.assertEquals(mibUploadStatus.getSnmpPoll(), pollFileName); + } + + @Test(dependsOnMethods = "testUploadAndFilenamesList") + public void testMibsExistentAfterCheckout() throws IOException { + activeVersion = vendorSoftwareProductManager.checkin(vspId, USER1); +// UniqueValueUtil.deleteUniqueValue(VendorSoftwareProductConstants.UniqueValues.COMPONENT_ARTIFACT_NAME, "MMSC.zip"); +// UniqueValueUtil.deleteUniqueValue(VendorSoftwareProductConstants.UniqueValues.COMPONENT_ARTIFACT_NAME, "MNS OAM FW.zip"); + activeVersion = vendorSoftwareProductManager.checkout(vspId, USER1); + + MibUploadStatus mibUploadStatus = + vendorSoftwareProductManager.listMibFilenames(vspId, componentId, USER1); + Assert.assertNotNull(mibUploadStatus.getSnmpTrap()); + Assert.assertNotNull(mibUploadStatus.getSnmpPoll()); + } + + @Test(dependsOnMethods = "testMibsExistentAfterCheckout") + public void testDeleteFile() { + vendorSoftwareProductManager.deleteComponentMib(vspId, componentId, true, USER1); + vendorSoftwareProductManager.deleteComponentMib(vspId, componentId, false, USER1); + + MibUploadStatus mibUploadStatus = + vendorSoftwareProductManager.listMibFilenames(vspId, componentId, USER1); + Assert.assertNull(mibUploadStatus.getSnmpTrap()); + Assert.assertNull(mibUploadStatus.getSnmpPoll()); + } + + @Test(dependsOnMethods = "testDeleteFile") + public void testUploadInvalidZip() { + URL url = this.getClass().getResource("/notZipFile"); + + try { + vendorSoftwareProductManager + .uploadComponentMib(url.openStream(), notZipFileName, vspId, componentId, true, USER1); + Assert.fail(); + } catch (Exception e) { +// Assert.assertEquals(e.getMessage(), "MIB uploaded for vendor software product with Id " + vspId + " and version " + activeVersion + " is invalid: Invalid zip file"); + Assert.assertEquals(e.getMessage(), "Invalid zip file"); + } + } + + @Test(dependsOnMethods = "testUploadInvalidZip") + public void testUploadZipWithFolders() { + InputStream zis = getFileInputStream("/vspmanager/zips/zipFileWithFolder.zip"); + + try { + vendorSoftwareProductManager + .uploadComponentMib(zis, zipWithFoldersFileName, vspId, componentId, true, USER1); + Assert.fail(); + } catch (Exception e) { + Assert.assertEquals(e.getMessage(), "Zip file should not contain folders"); + } + } + + @Test(dependsOnMethods = "testUploadZipWithFolders") + public void testUploadEmptyZip() { + InputStream zis = getFileInputStream("/vspmanager/zips/emptyZip.zip"); + + try { + vendorSoftwareProductManager + .uploadComponentMib(zis, emptyZipFileName, vspId, componentId, true, USER1); + Assert.fail(); + } catch (Exception e) { + Assert.assertEquals(e.getMessage(), "Invalid zip file"); + } + } + + + private InputStream getFileInputStream(String fileName) { + URL url = this.getClass().getResource(fileName); + try { + return url.openStream(); + } catch (IOException e) { + e.printStackTrace(); + return null; + } + } + + + private ComponentEntity createComponent(ComponentEntity component) { + component.setId(CommonMethods.nextUuId()); + vendorSoftwareProductDao.createComponent(component); + return component; + } +} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/NetworksTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/NetworksTest.java new file mode 100644 index 0000000000..2921f19c1b --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/NetworksTest.java @@ -0,0 +1,292 @@ +package org.openecomp.sdc.vendorsoftwareproduct; + +import org.openecomp.sdc.common.errors.CoreException; +import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDaoFactory; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails; +import org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes; +import org.openecomp.sdc.vendorsoftwareproduct.impl.VendorSoftwareProductManagerImpl; +import org.openecomp.sdc.vendorsoftwareproduct.types.CompositionEntityResponse; +import org.openecomp.sdc.vendorsoftwareproduct.types.CompositionEntityValidationData; +import org.openecomp.sdc.versioning.dao.types.Version; +import org.openecomp.sdc.versioning.errors.VersioningErrorCodes; +import org.openecomp.core.utilities.CommonMethods; + +import org.testng.Assert; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; + +import java.util.Collection; + +public class NetworksTest { + + private static final String USER1 = "networksTestUser1"; + private static final String USER2 = "networksTestUser2"; + private static final Version VERSION01 = new Version(0, 1); + private static final VendorSoftwareProductManager vendorSoftwareProductManager = + new VendorSoftwareProductManagerImpl(); + private static final org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDao + vendorSoftwareProductDao = + VendorSoftwareProductDaoFactory.getInstance().createInterface(); + + private static String vsp1Id; + private static String vsp2Id; + private static String networkId = "1"; + + static org.openecomp.sdc.vendorsoftwareproduct.dao.type.NetworkEntity createNetwork(String vspId, Version version, String networkId) { + org.openecomp.sdc.vendorsoftwareproduct.dao.type.NetworkEntity + networkEntity = new org.openecomp.sdc.vendorsoftwareproduct.dao.type.NetworkEntity(vspId, version, networkId); + org.openecomp.sdc.vendorsoftwareproduct.types.composition.Network + networkData = new org.openecomp.sdc.vendorsoftwareproduct.types.composition.Network(); + networkData.setName(networkId + " name"); + networkData.setDhcp(true); + networkEntity.setNetworkCompositionData(networkData); + vendorSoftwareProductDao.createNetwork(networkEntity); + return networkEntity; + } + + @BeforeClass + private void init() { + VspDetails vsp1 = vendorSoftwareProductManager.createNewVsp(VSPCommon + .createVspDetails(null, null, "VSP_" + CommonMethods.nextUuId(), "Test-vsp1", "vendorName", + "vlm1Id", "icon", "category", "subCategory", "123", null), USER1); + vsp1Id = vsp1.getId(); + + VspDetails vsp2 = vendorSoftwareProductManager.createNewVsp(VSPCommon + .createVspDetails(null, null, "VSP_" + CommonMethods.nextUuId(), "Test-vsp2", "vendorName", + "vlm1Id", "icon", "category", "subCategory", "123", null), USER1); + vsp2Id = vsp2.getId(); + } + + @Test + public void testListWhenNone() { + Collection<org.openecomp.sdc.vendorsoftwareproduct.dao.type.NetworkEntity> networks = + vendorSoftwareProductManager.listNetworks(vsp1Id, null, USER1); + Assert.assertEquals(networks.size(), 0); + } + + @Test + public void testCreateNonExistingVspId_negative() { + testCreate_negative(new org.openecomp.sdc.vendorsoftwareproduct.dao.type.NetworkEntity("non existing vsp id", null, null), USER1, + VersioningErrorCodes.VERSIONABLE_ENTITY_NOT_EXIST); + } + + @Test + public void testCreateOnLockedVsp_negative() { + testCreate_negative(new org.openecomp.sdc.vendorsoftwareproduct.dao.type.NetworkEntity(vsp1Id, null, null), USER2, + VersioningErrorCodes.EDIT_ON_ENTITY_LOCKED_BY_OTHER_USER); + } + +/* @Test(dependsOnMethods = "testListWhenNone") + public void testCreate() { + networkId = testCreate(vsp1Id); + } + + private String testCreate(String vspId) { + NetworkEntity expected = new NetworkEntity(vspId, null, null); + Network networkData = new Network(); + networkData.setName("network1 name"); + networkData.setDhcp(true); + expected.setNetworkCompositionData(networkData); + + + NetworkEntity created = vendorSoftwareProductManager.createNetwork(expected, USER1); + Assert.assertNotNull(created); + expected.setId(created.getId()); + expected.setVersion(VERSION01); + + NetworkEntity actual = vendorSoftwareProductDao.getNetwork(vspId, VERSION01, created.getId()); + + Assert.assertEquals(actual, expected); + return created.getId(); + } + + @Test(dependsOnMethods = {"testCreate"}) + public void testCreateWithExistingName_negative() { + NetworkEntity network = new NetworkEntity(vsp1Id, null, null); + Network networkData = new Network(); + networkData.setName("network1 name"); + networkData.setDhcp(true); + network.setNetworkCompositionData(networkData); + testCreate_negative(network, USER1, UniqueValueUtil.UNIQUE_VALUE_VIOLATION); + }*/ + + @Test + public void testCreateOnUploadVsp_negative() { + testCreate_negative(new org.openecomp.sdc.vendorsoftwareproduct.dao.type.NetworkEntity(vsp1Id, null, null), USER1, + VendorSoftwareProductErrorCodes.VSP_COMPOSITION_EDIT_NOT_ALLOWED); + } + + /* @Test(dependsOnMethods = {"testCreate"}) + public void testCreateWithExistingNameUnderOtherVsp() { + testCreate(vsp2Id); + } + */ + @Test(dependsOnMethods = "testListWhenNone")//"testCreate") + public void testGetNonExistingNetworkId_negative() { + testGet_negative(vsp1Id, null, "non existing network id", USER1, + VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND); + } + + @Test(dependsOnMethods = "testListWhenNone")//"testCreate") + public void testGetNonExistingVspId_negative() { + testGet_negative("non existing vsp id", null, networkId, USER1, + VersioningErrorCodes.VERSIONABLE_ENTITY_NOT_EXIST); + } + + @Test(dependsOnMethods = "testListWhenNone")//"testCreate") + public void testGet() { + org.openecomp.sdc.vendorsoftwareproduct.dao.type.NetworkEntity + expected = createNetwork(vsp1Id, VERSION01, networkId); + testGet(vsp1Id, VERSION01, networkId, USER1, expected); + } + + @Test(dependsOnMethods = "testListWhenNone")//"testCreate") + public void testUpdateNonExistingNetworkId_negative() { + testUpdate_negative(vsp1Id, "non existing network id", USER1, + VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND); + } + + @Test(dependsOnMethods = "testListWhenNone")//"testCreate") + public void testUpdateNonExistingVspId_negative() { + testUpdate_negative("non existing vsp id", networkId, USER1, + VersioningErrorCodes.VERSIONABLE_ENTITY_NOT_EXIST); + } + + @Test(dependsOnMethods = {"testGet"}) + public void testIllegalUpdateOnUploadVsp() { + org.openecomp.sdc.vendorsoftwareproduct.dao.type.NetworkEntity + expected = new org.openecomp.sdc.vendorsoftwareproduct.dao.type.NetworkEntity(vsp1Id, null, networkId); + org.openecomp.sdc.vendorsoftwareproduct.types.composition.Network + networkData = new org.openecomp.sdc.vendorsoftwareproduct.types.composition.Network(); + networkData.setName(networkId + " name updated"); + networkData.setDhcp(false); + expected.setNetworkCompositionData(networkData); + + CompositionEntityValidationData validationData = + vendorSoftwareProductManager.updateNetwork(expected, USER1); + Assert.assertNotNull(validationData); + Assert.assertTrue(validationData.getErrors().size() > 0); + } + + @Test(dependsOnMethods = {"testGet"}) + public void testListNonExistingVspId_negative() { + testList_negative("non existing vsp id", null, USER1, + VersioningErrorCodes.VERSIONABLE_ENTITY_NOT_EXIST); + } + + /* + @Test(dependsOnMethods = {"testUpdateOnUploadVsp", "testList"}) + public void testCreateWithERemovedName() { + testCreate(vsp1Id); + } + + @Test(dependsOnMethods = "testList") + public void testDeleteNonExistingNetworkId_negative() { + testDelete_negative(vsp1Id, "non existing network id", USER1, VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND); + }*/ + + @Test(dependsOnMethods = {"testGet"}) + public void testList() { + createNetwork(vsp1Id, VERSION01, "2"); + + Collection<org.openecomp.sdc.vendorsoftwareproduct.dao.type.NetworkEntity> actual = + vendorSoftwareProductManager.listNetworks(vsp1Id, null, USER1); + Assert.assertEquals(actual.size(), 2); + } + + @Test(dependsOnMethods = "testList") + public void testDeleteNonExistingVspId_negative() { + testDelete_negative("non existing vsp id", networkId, USER1, + VersioningErrorCodes.VERSIONABLE_ENTITY_NOT_EXIST); + } +/* + @Test(dependsOnMethods = "testList") + public void testDelete() { + vendorSoftwareProductManager.deleteNetwork(vsp1Id, networkId, USER1); + NetworkEntity actual = vendorSoftwareProductDao.getNetwork(vsp1Id, VERSION01, networkId); + Assert.assertNull(actual); + } + + @Test + public void testDeleteListNonExistingVspId_negative() { + testDeleteList_negative("non existing vsp id", USER1, VersioningErrorCodes.VERSIONABLE_ENTITY_NOT_EXIST); + } + + @Test(dependsOnMethods = "testDelete") + public void testDeleteList() { + NetworkEntity network3 = new NetworkEntity(vsp1Id, null, null); + network3.setName("network3 name"); + network3.setDescription("network3 desc"); + vendorSoftwareProductManager.createNetwork(network3, USER1); + + vendorSoftwareProductManager.deleteNetworks(vsp1Id, USER1); + + Collection<NetworkEntity> actual = vendorSoftwareProductManager.listNetworks(vsp1Id, null, USER1); + Assert.assertEquals(actual.size(), 0); + }*/ + + @Test(dependsOnMethods = "testList") + public void testDeleteOnUploadVsp_negative() { + testDelete_negative(vsp1Id, networkId, USER1, + VendorSoftwareProductErrorCodes.VSP_COMPOSITION_EDIT_NOT_ALLOWED); + } + + private void testGet(String vspId, Version version, String networkId, String user, + org.openecomp.sdc.vendorsoftwareproduct.dao.type.NetworkEntity expected) { + CompositionEntityResponse<org.openecomp.sdc.vendorsoftwareproduct.types.composition.Network> response = + vendorSoftwareProductManager.getNetwork(vspId, null, networkId, user); + Assert.assertEquals(response.getId(), expected.getId()); + Assert.assertEquals(response.getData(), expected.getNetworkCompositionData()); + Assert.assertNotNull(response.getSchema()); + } + + private void testCreate_negative( + org.openecomp.sdc.vendorsoftwareproduct.dao.type.NetworkEntity network, String user, String expectedErrorCode) { + try { + vendorSoftwareProductManager.createNetwork(network, user); + Assert.fail(); + } catch (CoreException e) { + Assert.assertEquals(e.code().id(), expectedErrorCode); + } + } + + private void testGet_negative(String vspId, Version version, String networkId, String user, + String expectedErrorCode) { + try { + vendorSoftwareProductManager.getNetwork(vspId, version, networkId, user); + Assert.fail(); + } catch (CoreException e) { + Assert.assertEquals(e.code().id(), expectedErrorCode); + } + } + + private void testUpdate_negative(String vspId, String networkId, String user, + String expectedErrorCode) { + try { + vendorSoftwareProductManager.updateNetwork(new org.openecomp.sdc.vendorsoftwareproduct.dao.type.NetworkEntity(vspId, null, networkId), user); + Assert.fail(); + } catch (CoreException e) { + Assert.assertEquals(e.code().id(), expectedErrorCode); + } + } + + private void testList_negative(String vspId, Version version, String user, + String expectedErrorCode) { + try { + vendorSoftwareProductManager.listNetworks(vspId, version, user); + Assert.fail(); + } catch (CoreException e) { + Assert.assertEquals(e.code().id(), expectedErrorCode); + } + } + + private void testDelete_negative(String vspId, String networkId, String user, + String expectedErrorCode) { + try { + vendorSoftwareProductManager.deleteNetwork(vspId, networkId, user); + Assert.fail(); + } catch (CoreException e) { + Assert.assertEquals(e.code().id(), expectedErrorCode); + } + } +} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/NicsTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/NicsTest.java new file mode 100644 index 0000000000..10ea7f7eaf --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/NicsTest.java @@ -0,0 +1,346 @@ +package org.openecomp.sdc.vendorsoftwareproduct; + +import org.openecomp.sdc.common.errors.CoreException; +import org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes; +import org.openecomp.sdc.vendorsoftwareproduct.impl.VendorSoftwareProductManagerImpl; +import org.openecomp.sdc.vendorsoftwareproduct.types.CompositionEntityResponse; +import org.openecomp.sdc.vendorsoftwareproduct.types.CompositionEntityValidationData; +import org.openecomp.core.utilities.CommonMethods; + +import org.testng.Assert; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; + +import java.util.Collection; + +public class NicsTest { + + private static final String USER1 = "nicsTestUser1"; + private static final String USER2 = "nicsTestUser2"; + private static final org.openecomp.sdc.versioning.dao.types.Version + VERSION01 = new org.openecomp.sdc.versioning.dao.types.Version(0, 1); + private static final VendorSoftwareProductManager vendorSoftwareProductManager = + new VendorSoftwareProductManagerImpl(); + private static final org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDao + vendorSoftwareProductDao = + org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDaoFactory.getInstance().createInterface(); + + private static String vsp1Id; + private static String vsp2Id; + private static org.openecomp.sdc.vendorsoftwareproduct.dao.type.NetworkEntity network1; + private static org.openecomp.sdc.vendorsoftwareproduct.dao.type.NetworkEntity network2; + private static String component11Id; + private static String component21Id; + private static String nic1Id = "nic1"; + + static org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity createNic(String vspId, org.openecomp.sdc.versioning.dao.types.Version version, String compId, String nicId, + String networkId) { + org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity + nicEntity = new org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity(vspId, version, compId, nicId); + org.openecomp.sdc.vendorsoftwareproduct.types.composition.Nic + nicData = new org.openecomp.sdc.vendorsoftwareproduct.types.composition.Nic(); + nicData.setName(nicId + " name"); + nicData.setDescription(nicId + " desc"); + nicData.setNetworkId(networkId); + nicEntity.setNicCompositionData(nicData); + vendorSoftwareProductDao.createNic(nicEntity); + return nicEntity; + } + + @BeforeClass + private void init() { + vsp1Id = vendorSoftwareProductManager.createNewVsp(VSPCommon + .createVspDetails(null, null, "VSP_" + CommonMethods.nextUuId(), "Test-vsp1", "vendorName1", + "vlm1Id", "icon", "category", "subCategory", "123", null), USER1).getId(); + network1 = NetworksTest.createNetwork(vsp1Id, VERSION01, "network1"); + component11Id = ComponentsTest.createComponent(vsp1Id, VERSION01, "component11").getId(); + + vsp2Id = vendorSoftwareProductManager.createNewVsp(VSPCommon + .createVspDetails(null, null, "VSP_" + CommonMethods.nextUuId(), "Test-vsp2", "vendorName1", + "vlm1Id", "icon", "category", "subCategory", "123", null), USER1).getId(); + network2 = NetworksTest.createNetwork(vsp2Id, VERSION01, "network2"); + component21Id = ComponentsTest.createComponent(vsp2Id, VERSION01, "component21").getId(); + } + +/* @Test + public void testCreateNonExistingComponentId_negative() { + testCreate_negative(new NicEntity(vsp1Id, null, "non existing component id", null), USER1, VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND); + }*/ + + @Test + public void testListWhenNone() { + Collection<org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity> nics = + vendorSoftwareProductManager.listNics(vsp1Id, null, component11Id, USER1); + Assert.assertEquals(nics.size(), 0); + } + + @Test + public void testCreateNonExistingVspId_negative() { + testCreate_negative(new org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity("non existing vsp id", null, component11Id, null), USER1, + org.openecomp.sdc.versioning.errors.VersioningErrorCodes.VERSIONABLE_ENTITY_NOT_EXIST); + } + + @Test + public void testCreateOnLockedVsp_negative() { + testCreate_negative(new org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity(vsp1Id, null, component11Id, null), USER2, + org.openecomp.sdc.versioning.errors.VersioningErrorCodes.EDIT_ON_ENTITY_LOCKED_BY_OTHER_USER); + } + +// @Test(dependsOnMethods = "testListWhenNone") +// public void testCreate() { +// nic1Id = testCreate(vsp1Id, component11Id, network1.getId(), network1.getNetworkCompositionData().getName()); +// } + +/* @Test(dependsOnMethods = {"testCreate"}) + public void testCreateWithExistingName_negative() { + NicEntity nic = new NicEntity(vsp1Id, null, component11Id, null); + Nic nicData = new Nic(); + nicData.setName("nic1 name"); + nic.setNicCompositionData(nicData); + testCreate_negative(nic, USER1, UniqueValueUtil.UNIQUE_VALUE_VIOLATION); + }*/ + +// @Test(dependsOnMethods = {"testCreate"}) +// public void testCreateWithExistingNameUnderOtherComponent() { +// ComponentEntity component12 = new ComponentEntity(vsp1Id, null, null); +// ComponentData compData12 = new ComponentData(); +// compData12.setName("comp12 name"); +// compData12.setDescription("comp12 desc"); +// component12.setComponentCompositionData(compData12); +// +// String component12Id = vendorSoftwareProductManager.createComponent(component12, USER1).getId(); +// testCreate(vsp1Id, component12Id, network1.getId(), network1.getNetworkCompositionData().getName()); +// } + +// @Test(dependsOnMethods = {"testCreate"}) +// public void testCreateWithExistingNameUnderOtherVsp() { +// testCreate(vsp2Id, component21Id, network2.getId(), network2.getNetworkCompositionData().getName()); +// } + + @Test + public void testCreateOnUploadVsp_negative() { + testCreate_negative(new org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity(vsp1Id, null, component11Id, null), USER1, + VendorSoftwareProductErrorCodes.VSP_COMPOSITION_EDIT_NOT_ALLOWED); + } + + @Test + public void testGetNonExistingNicId_negative() { + testGet_negative(vsp1Id, null, component11Id, "non existing nic id", USER1, + org.openecomp.sdc.versioning.errors.VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND); + } + + @Test(dependsOnMethods = "testListWhenNone")//"testCreate") + public void testGetNonExistingComponentId_negative() { + testGet_negative(vsp1Id, null, "non existing component id", nic1Id, USER1, + org.openecomp.sdc.versioning.errors.VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND); + } + + @Test(dependsOnMethods = "testListWhenNone")//"testCreate") + public void testGetNonExistingVspId_negative() { + testGet_negative("non existing vsp id", null, component11Id, nic1Id, USER1, + org.openecomp.sdc.versioning.errors.VersioningErrorCodes.VERSIONABLE_ENTITY_NOT_EXIST); + } + + @Test(dependsOnMethods = "testListWhenNone")//"testCreate") + public void testGet() { + createNic(vsp1Id, VERSION01, component11Id, nic1Id, network1.getId()); + testGet(vsp1Id, VERSION01, component11Id, nic1Id, USER1); + } + + @Test + public void testUpdateNonExistingNicId_negative() { + testUpdate_negative(vsp1Id, component11Id, "non existing nic id", USER1, + org.openecomp.sdc.versioning.errors.VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND); + } + + @Test(dependsOnMethods = "testListWhenNone")//"testCreate") + public void testUpdateNonExistingComponentId_negative() { + testUpdate_negative(vsp1Id, "non existing component id", nic1Id, USER1, + org.openecomp.sdc.versioning.errors.VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND); + } + + @Test(dependsOnMethods = "testListWhenNone")//"testCreate") + public void testUpdateNonExistingVspId_negative() { + testUpdate_negative("non existing vsp id", component11Id, nic1Id, USER1, + org.openecomp.sdc.versioning.errors.VersioningErrorCodes.VERSIONABLE_ENTITY_NOT_EXIST); + } + + @Test(dependsOnMethods = {"testGet"}) + public void testUpdateOnUploadVsp() { + org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity + expected = new org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity(vsp1Id, null, component11Id, nic1Id); + org.openecomp.sdc.vendorsoftwareproduct.types.composition.Nic + nicData = new org.openecomp.sdc.vendorsoftwareproduct.types.composition.Nic(); + nicData.setName(nic1Id + " name"); + nicData.setDescription(nic1Id + " desc updated"); + nicData.setNetworkId(network1.getId()); + expected.setNicCompositionData(nicData); + + CompositionEntityValidationData validationData = + vendorSoftwareProductManager.updateNic(expected, USER1); + Assert.assertTrue(validationData == null || validationData.getErrors() == null); + expected.setVersion(VERSION01); + + org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity + actual = vendorSoftwareProductDao.getNic(vsp1Id, VERSION01, component11Id, nic1Id); + Assert.assertEquals(actual, expected); + } + + @Test(dependsOnMethods = {"testGet"}) + public void testIllegalUpdateOnUploadVsp() { + org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity + expected = new org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity(vsp1Id, null, component11Id, nic1Id); + org.openecomp.sdc.vendorsoftwareproduct.types.composition.Nic + nicData = new org.openecomp.sdc.vendorsoftwareproduct.types.composition.Nic(); + nicData.setName(nic1Id + " name updated"); + nicData.setDescription(nic1Id + " desc updated"); + nicData.setNetworkId(network1.getId()); + expected.setNicCompositionData(nicData); + + CompositionEntityValidationData validationData = + vendorSoftwareProductManager.updateNic(expected, USER1); + Assert.assertNotNull(validationData); + Assert.assertTrue(validationData.getErrors().size() > 0); + } + + @Test + public void testListNonExistingComponentId_negative() { + testList_negative(vsp1Id, null, "non existing component id", USER1, + org.openecomp.sdc.versioning.errors.VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND); + } + + @Test + public void testListNonExistingVspId_negative() { + testList_negative("non existing vsp id", null, component11Id, USER1, + org.openecomp.sdc.versioning.errors.VersioningErrorCodes.VERSIONABLE_ENTITY_NOT_EXIST); + } +/* + @Test(dependsOnMethods = {"testUpdateOnUploadVsp", "testList"}) + public void testCreateWithRemovedName() { + testCreate(vsp1Id, component11Id); + } + + @Test + public void testDeleteNonExistingNicId_negative() { + testDelete_negative(vsp1Id, component11Id, "non existing nic id", USER1, VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND); + } + + @Test(dependsOnMethods = "testList") + public void testDeleteNonExistingComponentId_negative() { + testDelete_negative(vsp1Id, "non existing component id", nic1Id, USER1, VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND); + }*/ + + @Test(dependsOnMethods = {"testGet"}) + public void testList() { + createNic(vsp1Id, VERSION01, component11Id, "nic2", network1.getId()); + + Collection<org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity> actual = + vendorSoftwareProductManager.listNics(vsp1Id, null, component11Id, USER1); + Assert.assertEquals(actual.size(), 2); + } + + @Test(dependsOnMethods = "testList") + public void testDeleteNonExistingVspId_negative() { + testDelete_negative("non existing vsp id", component11Id, nic1Id, USER1, + org.openecomp.sdc.versioning.errors.VersioningErrorCodes.VERSIONABLE_ENTITY_NOT_EXIST); + } +/* + @Test(dependsOnMethods = "testList") + public void testDelete() { + vendorSoftwareProductManager.deleteNic(vsp1Id, component11Id, nic1Id, USER1); + NicEntity actual = vendorSoftwareProductDao.getNic(vsp1Id, VERSION01, component11Id, nic1Id); + Assert.assertNull(actual); + }*/ + + @Test(dependsOnMethods = "testList") + public void testDeleteOnUploadVsp_negative() { + testDelete_negative(vsp1Id, component11Id, nic1Id, USER1, + VendorSoftwareProductErrorCodes.VSP_COMPOSITION_EDIT_NOT_ALLOWED); + } + + private String testCreate(String vspId, String componentId, String networkId, + String networkName) { + org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity + expected = new org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity(vspId, null, componentId, null); + + org.openecomp.sdc.vendorsoftwareproduct.types.composition.Nic + nicData = new org.openecomp.sdc.vendorsoftwareproduct.types.composition.Nic(); + nicData.setName("nic1 name"); + nicData.setNetworkId(networkId); + //nicData.setNetworkName(networkName); + nicData.setNetworkType(org.openecomp.sdc.vendorsoftwareproduct.types.composition.NetworkType.External); + expected.setNicCompositionData(nicData); + + org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity created = vendorSoftwareProductManager.createNic(expected, USER1); + Assert.assertNotNull(created); + expected.setId(created.getId()); + expected.setVersion(VERSION01); + + org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity actual = + vendorSoftwareProductDao.getNic(vspId, VERSION01, componentId, created.getId()); + + Assert.assertEquals(actual, expected); + + return created.getId(); + } + + private void testGet(String vspId, org.openecomp.sdc.versioning.dao.types.Version version, String componentId, String nicId, + String user) { + CompositionEntityResponse<org.openecomp.sdc.vendorsoftwareproduct.types.composition.Nic> response = + vendorSoftwareProductManager.getNic(vspId, null, componentId, nicId, user); + org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity + expected = vendorSoftwareProductDao.getNic(vspId, version, componentId, nicId); + Assert.assertEquals(response.getId(), expected.getId()); + Assert.assertEquals(response.getData(), expected.getNicCompositionData()); + Assert.assertNotNull(response.getSchema()); + } + + private void testCreate_negative(org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity nic, String user, String expectedErrorCode) { + try { + vendorSoftwareProductManager.createNic(nic, user); + Assert.fail(); + } catch (CoreException e) { + Assert.assertEquals(e.code().id(), expectedErrorCode); + } + } + + private void testGet_negative(String vspId, org.openecomp.sdc.versioning.dao.types.Version version, String componentId, String nicId, + String user, String expectedErrorCode) { + try { + vendorSoftwareProductManager.getNic(vspId, version, componentId, nicId, user); + Assert.fail(); + } catch (CoreException e) { + Assert.assertEquals(e.code().id(), expectedErrorCode); + } + } + + private void testUpdate_negative(String vspId, String componentId, String nicId, String user, + String expectedErrorCode) { + try { + vendorSoftwareProductManager.updateNic(new org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity(vspId, null, componentId, nicId), user); + Assert.fail(); + } catch (CoreException e) { + Assert.assertEquals(e.code().id(), expectedErrorCode); + } + } + + private void testList_negative(String vspId, org.openecomp.sdc.versioning.dao.types.Version version, String componentId, String user, + String expectedErrorCode) { + try { + vendorSoftwareProductManager.listNics(vspId, version, componentId, user); + Assert.fail(); + } catch (CoreException e) { + Assert.assertEquals(e.code().id(), expectedErrorCode); + } + } + + private void testDelete_negative(String vspId, String componentId, String nicId, String user, + String expectedErrorCode) { + try { + vendorSoftwareProductManager.deleteNic(vspId, componentId, nicId, user); + Assert.fail(); + } catch (CoreException e) { + Assert.assertEquals(e.code().id(), expectedErrorCode); + } + } +} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/ProcessesTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/ProcessesTest.java new file mode 100644 index 0000000000..8571088be1 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/ProcessesTest.java @@ -0,0 +1,473 @@ +package org.openecomp.sdc.vendorsoftwareproduct; + +import org.openecomp.sdc.common.errors.CoreException; +import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDao; +import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDaoFactory; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessArtifactEntity; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails; +import org.openecomp.sdc.vendorsoftwareproduct.impl.VendorSoftwareProductManagerImpl; +import org.openecomp.sdc.versioning.dao.types.Version; +import org.openecomp.sdc.versioning.errors.VersioningErrorCodes; +import org.openecomp.core.util.UniqueValueUtil; +import org.openecomp.core.utilities.CommonMethods; + +import org.testng.Assert; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; + +import java.io.ByteArrayInputStream; +import java.io.File; +import java.util.Collection; + +public class ProcessesTest { + + protected static final String USER1 = "processesTestUser1"; + protected static final VendorSoftwareProductManager vendorSoftwareProductManager = + new VendorSoftwareProductManagerImpl(); + private static final String USER2 = "processesTestUser2"; + private static final String ARTIFACT_NAME = "artifact.sh"; + private static final Version VERSION01 = new Version(0, 1); + private static final VendorSoftwareProductDao vendorSoftwareProductDao = + VendorSoftwareProductDaoFactory.getInstance().createInterface(); + + protected String vsp1Id; + protected String vsp2Id; + protected String component11Id = VendorSoftwareProductConstants.GENERAL_COMPONENT_ID; + protected String component21Id = VendorSoftwareProductConstants.GENERAL_COMPONENT_ID; + private String p1Id; + private String p2Id; + + @BeforeClass + protected void init() { + VspDetails vsp1 = vendorSoftwareProductManager.createNewVsp(VSPCommon + .createVspDetails(null, null, "VSP_" + CommonMethods.nextUuId(), "Test-vsp1", "vendorName1", + "vlm1Id", "icon", "category", "subCategory", "123", null), USER1); + vsp1Id = vsp1.getId(); + + VspDetails vsp2 = vendorSoftwareProductManager.createNewVsp(VSPCommon + .createVspDetails(null, null, "VSP_" + CommonMethods.nextUuId(), "Test-vsp2", "vendorName1", + "vlm1Id", "icon", "category", "subCategory", "123", null), USER1); + vsp2Id = vsp2.getId(); + } + + @Test + public void testListWhenNone() { + Collection<org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity> processes = + vendorSoftwareProductManager.listProcesses(vsp1Id, null, component11Id, USER1); + Assert.assertEquals(processes.size(), 0); + } + + @Test + public void testCreateNonExistingComponentId_negative() { + testCreate_negative(new org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity(vsp1Id, null, "non existing component id", null), USER1, + VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND); + } + + @Test + public void testCreateNonExistingVspId_negative() { + testCreate_negative(new org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity("non existing vsp id", null, component11Id, null), USER1, + VersioningErrorCodes.VERSIONABLE_ENTITY_NOT_EXIST); + } + + @Test + public void testCreateOnLockedVsp_negative() { + testCreate_negative(new org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity(vsp1Id, null, component11Id, null), USER2, + VersioningErrorCodes.EDIT_ON_ENTITY_LOCKED_BY_OTHER_USER); + } + + @Test(dependsOnMethods = "testListWhenNone") + public void testCreate() { + p1Id = testCreate(vsp1Id, component11Id); + } + + @Test(dependsOnMethods = {"testCreate"}) + public void testCreateWithExistingName_negative() { + org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity + process = new org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity(vsp1Id, null, component11Id, null); + process.setName("p1 name"); + testCreate_negative(process, USER1, UniqueValueUtil.UNIQUE_VALUE_VIOLATION); + } + + @Test(dependsOnMethods = {"testCreate"}) + public void testCreateWithExistingNameUnderOtherComponent() { + // This method is implemented in the sub class ComponentProcessesTest, it is here in order to keep the tests sequence down there (using @Test). + } + + @Test(dependsOnMethods = {"testCreate"}) + public void testCreateWithExistingNameUnderOtherVsp() { + testCreate(vsp2Id, component21Id); + } + + @Test + public void testGetNonExistingProcessId_negative() { + testGet_negative(vsp1Id, null, component11Id, "non existing process id", USER1, + VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND); + } + + @Test(dependsOnMethods = "testCreate") + public void testGetNonExistingComponentId_negative() { + testGet_negative(vsp1Id, null, "non existing component id", p1Id, USER1, + VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND); + } + + @Test(dependsOnMethods = "testCreate") + public void testGetNonExistingVspId_negative() { + testGet_negative("non existing vsp id", null, component11Id, p1Id, USER1, + VersioningErrorCodes.VERSIONABLE_ENTITY_NOT_EXIST); + } + + @Test(dependsOnMethods = "testCreate") + public void testGet() { + org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity + actual = testGet(vsp1Id, VERSION01, component11Id, p1Id, USER1); + Assert.assertNull(actual.getArtifactName()); + } + + @Test + public void testUpdateNonExistingProcessId_negative() { + testUpdate_negative(vsp1Id, component11Id, "non existing process id", USER1, + VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND); + } + + @Test(dependsOnMethods = "testCreate") + public void testUpdateNonExistingComponentId_negative() { + testUpdate_negative(vsp1Id, "non existing component id", p1Id, USER1, + VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND); + } + + @Test(dependsOnMethods = "testCreate") + public void testUpdateNonExistingVspId_negative() { + testUpdate_negative("non existing vsp id", component11Id, p1Id, USER1, + VersioningErrorCodes.VERSIONABLE_ENTITY_NOT_EXIST); + } + + @Test(dependsOnMethods = {"testGet"}) + public void testUpdate() { + org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity + expected = new org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity(vsp1Id, null, component11Id, p1Id); + expected.setName("p1 name updated"); + expected.setDescription("p1 desc updated"); + + vendorSoftwareProductManager.updateProcess(expected, USER1); + expected.setVersion(VERSION01); + + org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity actual = + vendorSoftwareProductDao.getProcess(vsp1Id, VERSION01, component11Id, p1Id); + Assert.assertEquals(actual, expected); + } + + @Test + public void testListNonExistingComponentId_negative() { + testList_negative(vsp1Id, null, "non existing component id", USER1, + VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND); + } + + @Test + public void testListNonExistingVspId_negative() { + testList_negative("non existing vsp id", null, component11Id, USER1, + VersioningErrorCodes.VERSIONABLE_ENTITY_NOT_EXIST); + } + + @Test(dependsOnMethods = {"testGet"}) + public void testList() { + org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity + p2 = new org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity(vsp1Id, null, component11Id, null); + p2.setName("p2 name"); + p2.setDescription("p2 desc"); + + org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity createdP2 = vendorSoftwareProductManager.createProcess(p2, USER1); + p2Id = createdP2.getId(); + + Collection<org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity> actual = + vendorSoftwareProductManager.listProcesses(vsp1Id, null, component11Id, USER1); + Collection<org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity> expected = + vendorSoftwareProductDao.listProcesses(vsp1Id, VERSION01, component11Id); + Assert.assertEquals(actual.size(), 2); + Assert.assertEquals(actual, expected); + } + + @Test(dependsOnMethods = {"testUpdate", "testList"}) + public void testCreateWithRemovedName() { + testCreate(vsp1Id, component11Id); + } + + @Test + public void testDeleteNonExistingProcessId_negative() { + testDelete_negative(vsp1Id, component11Id, "non existing process id", USER1, + VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND); + } + + @Test(dependsOnMethods = "testList") + public void testDeleteNonExistingComponentId_negative() { + testDelete_negative(vsp1Id, "non existing component id", p1Id, USER1, + VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND); + } + + @Test(dependsOnMethods = "testList") + public void testDeleteNonExistingVspId_negative() { + testDelete_negative("non existing vsp id", component11Id, p1Id, USER1, + VersioningErrorCodes.VERSIONABLE_ENTITY_NOT_EXIST); + } + + @Test(dependsOnMethods = "testList") + public void testDelete() { + vendorSoftwareProductManager.deleteProcess(vsp1Id, component11Id, p1Id, USER1); + org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity actual = + vendorSoftwareProductDao.getProcess(vsp1Id, VERSION01, component11Id, p1Id); + Assert.assertNull(actual); + } + + @Test + public void testUploadFileNonExistingProcessId_negative() { + testUploadFile_negative(vsp1Id, component11Id, "non existing process id", USER1, + VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND); + } + + @Test(dependsOnMethods = "testList") + public void testUploadFileNonExistingComponentId_negative() { + testUploadFile_negative(vsp1Id, "non existing component id", p2Id, USER1, + VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND); + } + + @Test(dependsOnMethods = "testList") + public void testUploadFileNonExistingVspId_negative() { + testUploadFile_negative("non existing vsp id", component11Id, p2Id, USER1, + VersioningErrorCodes.VERSIONABLE_ENTITY_NOT_EXIST); + } + + @Test(dependsOnMethods = "testList") + public void testGetFileWhenNone_negative() { + testGetFile_negative(vsp1Id, null, component11Id, p2Id, USER1, + VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND); + } + + @Test(dependsOnMethods = "testList") + public void testDeleteFileWhenNone_negative() { + testDeleteFile_negative(vsp1Id, component11Id, p2Id, USER1, + VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND); + } + + @Test(dependsOnMethods = {"testGetFileWhenNone_negative", "testDeleteFileWhenNone_negative"}) + public void testUploadFile() { + vendorSoftwareProductManager + .uploadProcessArtifact(new ByteArrayInputStream("bla bla".getBytes()), ARTIFACT_NAME, + vsp1Id, component11Id, p2Id, USER1); + ProcessArtifactEntity actual = + vendorSoftwareProductDao.getProcessArtifact(vsp1Id, VERSION01, component11Id, p2Id); + Assert.assertNotNull(actual); + Assert.assertNotNull(actual.getArtifact()); + Assert.assertEquals(actual.getArtifactName(), ARTIFACT_NAME); + } + + @Test(dependsOnMethods = "testUploadFile") + public void testGetAfterUploadFile() { + org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity + actual = testGet(vsp1Id, VERSION01, component11Id, p2Id, USER1); + Assert.assertEquals(actual.getArtifactName(), ARTIFACT_NAME); + } + + @Test + public void testGetFileNonExistingProcessId_negative() { + testGetFile_negative(vsp1Id, null, component11Id, "non existing process id", USER1, + VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND); + } + + @Test(dependsOnMethods = "testList") + public void testGetFileNonExistingComponentId_negative() { + testGetFile_negative(vsp1Id, null, "non existing component id", p2Id, USER1, + VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND); + } + + @Test(dependsOnMethods = "testList") + public void testGetFileNonExistingVspId_negative() { + testGetFile_negative("non existing vsp id", null, component11Id, p2Id, USER1, + VersioningErrorCodes.VERSIONABLE_ENTITY_NOT_EXIST); + } + + @Test(dependsOnMethods = "testUploadFile") + public void testGetFile() { + File actual = + vendorSoftwareProductManager.getProcessArtifact(vsp1Id, null, component11Id, p2Id, USER1); + Assert.assertNotNull(actual); + ProcessArtifactEntity expected = + vendorSoftwareProductDao.getProcessArtifact(vsp1Id, VERSION01, component11Id, p2Id); + Assert.assertNotNull(expected); + Assert.assertNotNull(expected.getArtifact()); + } + + @Test + public void testDeleteFileNonExistingProcessId_negative() { + testDeleteFile_negative(vsp1Id, component11Id, "non existing process id", USER1, + VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND); + } + + @Test(dependsOnMethods = "testList") + public void testDeleteFileNonExistingComponentId_negative() { + testDeleteFile_negative(vsp1Id, "non existing component id", p2Id, USER1, + VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND); + } + + @Test(dependsOnMethods = "testList") + public void testDeleteFileNonExistingVspId_negative() { + testDeleteFile_negative("non existing vsp id", component11Id, p2Id, USER1, + VersioningErrorCodes.VERSIONABLE_ENTITY_NOT_EXIST); + } + + @Test(dependsOnMethods = "testGetFile") + public void testDeleteFile() { + vendorSoftwareProductManager.deleteProcessArtifact(vsp1Id, component11Id, p2Id, USER1); + ProcessArtifactEntity expected = + vendorSoftwareProductDao.getProcessArtifact(vsp1Id, VERSION01, component11Id, p2Id); + Assert.assertNull(expected.getArtifact()); + } + + @Test + public void testDeleteListNonExistingComponentId_negative() { + testDeleteList_negative(vsp1Id, "non existing component id", USER1, + VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND); + } + + @Test + public void testDeleteListNonExistingVspId_negative() { + testDeleteList_negative("non existing vsp id", component11Id, USER1, + VersioningErrorCodes.VERSIONABLE_ENTITY_NOT_EXIST); + } + + @Test(dependsOnMethods = {"testDeleteFile"}) + public void testDeleteList() { + org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity + p3 = new org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity(vsp1Id, null, component11Id, null); + p3.setName("p3 name"); + p3.setDescription("p3 desc"); + vendorSoftwareProductManager.createProcess(p3, USER1); + + vendorSoftwareProductManager.deleteProcesses(vsp1Id, component11Id, USER1); + + Collection<org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity> actual = + vendorSoftwareProductManager.listProcesses(vsp1Id, null, component11Id, USER1); + Assert.assertEquals(actual.size(), 0); + } + + protected String testCreate(String vspId, String componentId) { + org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity + expected = new org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity(vspId, null, componentId, null); + expected.setName("p1 name"); + expected.setDescription("p1 desc"); + + org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity created = vendorSoftwareProductManager.createProcess(expected, USER1); + Assert.assertNotNull(created); + expected.setId(created.getId()); + expected.setVersion(VERSION01); + + org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity actual = + vendorSoftwareProductDao.getProcess(vspId, VERSION01, componentId, created.getId()); + + Assert.assertEquals(actual, expected); + + return created.getId(); + } + + private org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity testGet(String vspId, Version version, String componentId, String processId, + String user) { + org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity actual = + vendorSoftwareProductManager.getProcess(vspId, null, componentId, processId, user); + org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity expected = + vendorSoftwareProductDao.getProcess(vspId, version, componentId, processId); + Assert.assertEquals(actual, expected); + return actual; + } + + private void testCreate_negative( + org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity process, String user, String expectedErrorCode) { + try { + vendorSoftwareProductManager.createProcess(process, user); + Assert.fail(); + } catch (CoreException e) { + Assert.assertEquals(e.code().id(), expectedErrorCode); + } + } + + private void testGet_negative(String vspId, Version version, String componentId, String processId, + String user, String expectedErrorCode) { + try { + vendorSoftwareProductManager.getProcess(vspId, version, componentId, processId, user); + Assert.fail(); + } catch (CoreException e) { + Assert.assertEquals(e.code().id(), expectedErrorCode); + } + } + + private void testUpdate_negative(String vspId, String componentId, String processId, String user, + String expectedErrorCode) { + try { + vendorSoftwareProductManager + .updateProcess(new org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity(vspId, null, componentId, processId), user); + Assert.fail(); + } catch (CoreException e) { + Assert.assertEquals(e.code().id(), expectedErrorCode); + } + } + + private void testList_negative(String vspId, Version version, String componentId, String user, + String expectedErrorCode) { + try { + vendorSoftwareProductManager.listProcesses(vspId, version, componentId, user); + Assert.fail(); + } catch (CoreException e) { + Assert.assertEquals(e.code().id(), expectedErrorCode); + } + } + + private void testDeleteList_negative(String vspId, String componentId, String user, + String expectedErrorCode) { + try { + vendorSoftwareProductManager.deleteProcesses(vspId, componentId, user); + Assert.fail(); + } catch (CoreException e) { + Assert.assertEquals(e.code().id(), expectedErrorCode); + } + } + + private void testDelete_negative(String vspId, String componentId, String processId, String user, + String expectedErrorCode) { + try { + vendorSoftwareProductManager.deleteProcess(vspId, componentId, processId, user); + Assert.fail(); + } catch (CoreException e) { + Assert.assertEquals(e.code().id(), expectedErrorCode); + } + } + + private void testGetFile_negative(String vspId, Version version, String componentId, + String processId, String user, String expectedErrorCode) { + try { + vendorSoftwareProductManager.getProcessArtifact(vspId, version, componentId, processId, user); + Assert.fail(); + } catch (CoreException e) { + Assert.assertEquals(e.code().id(), expectedErrorCode); + } + } + + private void testUploadFile_negative(String vspId, String componentId, String processId, + String user, String expectedErrorCode) { + try { + vendorSoftwareProductManager + .uploadProcessArtifact(new ByteArrayInputStream("bla bla".getBytes()), "artifact.sh", + vspId, componentId, processId, user); + Assert.fail(); + } catch (CoreException e) { + Assert.assertEquals(e.code().id(), expectedErrorCode); + } + } + + private void testDeleteFile_negative(String vspId, String componentId, String processId, + String user, String expectedErrorCode) { + try { + vendorSoftwareProductManager.deleteProcessArtifact(vspId, componentId, processId, user); + Assert.fail(); + } catch (CoreException e) { + Assert.assertEquals(e.code().id(), expectedErrorCode); + } + } + +} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/VSPCommon.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/VSPCommon.java new file mode 100644 index 0000000000..4eaba77f2b --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/VSPCommon.java @@ -0,0 +1,78 @@ +package org.openecomp.sdc.vendorsoftwareproduct; + +import org.openecomp.sdc.vendorlicense.dao.types.VendorLicenseModelEntity; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails; + +import org.openecomp.sdc.versioning.dao.types.Version; +import org.openecomp.core.utilities.file.FileUtils; + +import java.io.*; +import java.util.List; +import java.util.zip.ZipEntry; +import java.util.zip.ZipOutputStream; + +public class VSPCommon { + + public static VspDetails createVspDetails(String id, Version version, String name, String desc, + String vendorName, String vlm, String icon, + String category, String subCategory, + String licenseAgreement, List<String> featureGroups) { + VspDetails vspDetails = new VspDetails(id, version); + vspDetails.setName(name); + vspDetails.setDescription(desc); + vspDetails.setIcon(icon); + vspDetails.setCategory(category); + vspDetails.setSubCategory(subCategory); + vspDetails.setVendorName(vendorName); + vspDetails.setVendorId(vlm); + vspDetails.setVlmVersion(new Version(1, 0)); + vspDetails.setLicenseAgreement(licenseAgreement); + vspDetails.setFeatureGroups(featureGroups); + return vspDetails; + } + + + public static VendorLicenseModelEntity createVendorLicenseModel(String name, String desc, + String icon) { + VendorLicenseModelEntity vendorLicenseModel = new VendorLicenseModelEntity(); + vendorLicenseModel.setVendorName(name); + vendorLicenseModel.setDescription(desc); + vendorLicenseModel.setIconRef(icon); + return vendorLicenseModel; + } + + public static void zipDir(File file, String path, ZipOutputStream zos) { + zipDir(file, path, zos, false); + } + + public static void zipDir(File file, String path, ZipOutputStream zos, boolean isRootDir) { + if (file.isDirectory()) { + path += File.separator + file.getName(); + File[] files = file.listFiles(); + if (files != null) { + for (File innerFile : files) { + if (isRootDir) { + zipDir(innerFile, "", zos, false); + } else { + zipDir(innerFile, path, zos, false); + } + } + } + } else { + + try { + if (!path.isEmpty()) { + path += File.separator; + } + zos.putNextEntry(new ZipEntry(path + file.getName())); + InputStream is = new FileInputStream(file); + byte[] data = FileUtils.toByteArray(is); + zos.write(data); + zos.closeEntry(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + +} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/VSPFullTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/VSPFullTest.java new file mode 100644 index 0000000000..ebc4c3af64 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/VSPFullTest.java @@ -0,0 +1,194 @@ +package org.openecomp.sdc.vendorsoftwareproduct; + +import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel; +import org.openecomp.sdc.tosca.datatypes.model.CapabilityDefinition; +import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity; +import org.openecomp.sdc.vendorlicense.facade.VendorLicenseFacade; +import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDaoFactory; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails; +import org.openecomp.sdc.vendorsoftwareproduct.impl.VendorSoftwareProductManagerImpl; +import org.openecomp.sdc.vendorsoftwareproduct.types.ValidationResponse; +import org.openecomp.sdc.vendorsoftwareproduct.types.VersionedVendorSoftwareProductInfo; +import org.openecomp.sdc.versioning.dao.types.Version; +import org.openecomp.core.model.dao.EnrichedServiceModelDaoFactory; +import org.openecomp.core.util.UniqueValueUtil; +import org.openecomp.core.utilities.CommonMethods; +import org.apache.commons.collections4.MapUtils; +import org.apache.commons.io.IOUtils; +import org.testng.Assert; +import org.testng.annotations.Test; + +import java.io.*; +import java.net.URL; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; + +public class VSPFullTest { + + + public static final Version VERSION01 = new Version(0, 1); + private static final org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDao + vendorSoftwareProductDao = + VendorSoftwareProductDaoFactory.getInstance().createInterface(); + private static final String USER1 = "vspTestUser1"; + private static VendorSoftwareProductManager vendorSoftwareProductManager = + new VendorSoftwareProductManagerImpl(); + private static VendorLicenseFacade vendorLicenseFacade = + org.openecomp.sdc.vendorlicense.facade.VendorLicenseFacadeFactory.getInstance().createInterface(); + + @Test + public void testEnrichModelInSubmit() { + UniqueValueUtil + .deleteUniqueValue(VendorSoftwareProductConstants.UniqueValues.VENDOR_SOFTWARE_PRODUCT_NAME, + "VSP_FullTest"); + + String vlm1Id = vendorLicenseFacade.createVendorLicenseModel(VSPCommon + .createVendorLicenseModel("vlmName " + CommonMethods.nextUuId(), "vlm1Id desc", "icon1"), + USER1).getId(); + String entitlementPoolId = vendorLicenseFacade + .createEntitlementPool(new EntitlementPoolEntity(vlm1Id, null, null), USER1).getId(); + + org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupEntity + featureGroup = new org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupEntity(vlm1Id, null, null); + featureGroup.getEntitlementPoolIds().add(entitlementPoolId); + String featureGroupId = vendorLicenseFacade.createFeatureGroup(featureGroup, USER1).getId(); + + org.openecomp.sdc.vendorlicense.dao.types.LicenseAgreementEntity + licenseAgreement = new org.openecomp.sdc.vendorlicense.dao.types.LicenseAgreementEntity(vlm1Id, null, null); + licenseAgreement.getFeatureGroupIds().add(featureGroupId); + String licenseAgreementId = + vendorLicenseFacade.createLicenseAgreement(licenseAgreement, USER1).getId(); + + vendorLicenseFacade.checkin(vlm1Id, USER1); + vendorLicenseFacade.submit(vlm1Id, USER1); + + String vspId = createVsp(vlm1Id, licenseAgreementId, licenseAgreement.getFeatureGroupIds()); + + Collection<org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity> components = uploadFullCompositionFile(vspId); + + + //check in + vendorSoftwareProductManager.checkin(vspId, USER1); + //submit + try { + ValidationResponse result = vendorSoftwareProductManager.submit(vspId, USER1); + //Assert.assertTrue(result.isValid()); + //PackageInfo createPackageResult = vendorSoftwareProductManager.createPackage(vspId, USER1); + + } catch (IOException e) { + Assert.fail(); + } + VersionedVendorSoftwareProductInfo details = + vendorSoftwareProductManager.getVspDetails(vspId, null, USER1); + + + //File csar = vendorSoftwareProductManager.getTranslatedFile(vspId,details.getVersionInfo().getActiveVersion(),USER1); + // writeFile(csar); + + + ToscaServiceModel model = + (ToscaServiceModel) EnrichedServiceModelDaoFactory.getInstance().createInterface() + .getServiceModel(vspId, details.getVersionInfo().getActiveVersion()); + + Map<String, CapabilityDefinition> capabilities = new HashMap<>(); + for (org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity component : components) { + model.getServiceTemplates(). + entrySet(). + stream(). + filter(entryValue -> entryValue.getValue() != null && + entryValue.getValue().getNode_types() != null && + entryValue.getValue(). + getNode_types(). + containsKey(component.getComponentCompositionData().getName())). + forEach(entryValue -> entryValue.getValue().getNode_types(). + values(). + stream(). + filter(type -> MapUtils.isNotEmpty(type.getCapabilities())). + forEach(type -> type.getCapabilities(). + entrySet(). + forEach(entry -> addCapability(entryValue.getKey(), capabilities, entry.getKey(), + entry.getValue())))); + + } + + Assert.assertNotNull(capabilities); + } + + private Collection<org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity> uploadFullCompositionFile(String vspId) { + vendorSoftwareProductManager + .uploadFile(vspId, getFileInputStream("/vspmanager/zips/fullComposition.zip"), USER1); + + Collection<org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity> components = + vendorSoftwareProductManager.listComponents(vspId, null, USER1); + Assert.assertFalse(components.isEmpty()); + + for (org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity component : components) { + Assert.assertNotNull(vendorSoftwareProductManager + .getComponentQuestionnaire(vspId, null, component.getId(), USER1).getData()); + + Collection<org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity> nics = + vendorSoftwareProductManager.listNics(vspId, null, component.getId(), USER1); + Assert.assertFalse(nics.isEmpty()); + for (org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity nic : nics) { + Assert.assertNotNull(vendorSoftwareProductManager + .getNicQuestionnaire(vspId, null, component.getId(), nic.getId(), USER1).getData()); + } + } + + return components; + } + + private String createVsp(String vlm1Id, String licenseAgreementId, Set<String> featureGroupIds) { + VspDetails expectedVsp = VSPCommon + .createVspDetails(null, null, "VSP_FullTest", "Test-vsp_fullTest", "vendorName", vlm1Id, + "icon", "category", "subCategory", licenseAgreementId, + featureGroupIds.stream().collect(Collectors.toList())); + String vspId = vendorSoftwareProductManager.createNewVsp(expectedVsp, USER1).getId(); + + VspDetails actualVsp = + vendorSoftwareProductDao.getVendorSoftwareProductInfo(new VspDetails(vspId, VERSION01)); + expectedVsp.setId(vspId); + expectedVsp.setVersion(VERSION01); + + VendorSoftwareProductManagerTest.assertVspsEquals(actualVsp, expectedVsp); + Assert.assertNotNull( + vendorSoftwareProductManager.getVspQuestionnaire(vspId, null, USER1).getData()); + return vspId; + } + + private void writeFile(File csar) { + try { + FileInputStream in = new FileInputStream(csar); + File output = new File("CSAR_vDNS.zip"); + + FileOutputStream out = new FileOutputStream(output); + + IOUtils.copy(in, out); + in.close(); + out.close(); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + private void addCapability(String entryValueKey, Map<String, CapabilityDefinition> capabilities, + String key, CapabilityDefinition value) { + + capabilities.put(entryValueKey + "_" + key, value); + } + + private InputStream getFileInputStream(String fileName) { + URL url = this.getClass().getResource(fileName); + try { + return url.openStream(); + } catch (IOException e) { + e.printStackTrace(); + return null; + } + } + + +} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/VendorSoftwareProductManagerTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/VendorSoftwareProductManagerTest.java new file mode 100644 index 0000000000..d94c868f25 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/VendorSoftwareProductManagerTest.java @@ -0,0 +1,672 @@ +package org.openecomp.sdc.vendorsoftwareproduct; + +import org.openecomp.sdc.common.errors.CoreException; +import org.openecomp.sdc.common.errors.ErrorCode; +import org.openecomp.sdc.common.errors.ValidationErrorBuilder; +import org.openecomp.sdc.common.utils.AsdcCommon; +import org.openecomp.sdc.heat.datatypes.structure.HeatStructureTree; +import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel; +import org.openecomp.sdc.tosca.datatypes.model.CapabilityDefinition; +import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity; +import org.openecomp.sdc.vendorlicense.dao.types.LicenseAgreementEntity; +import org.openecomp.sdc.vendorlicense.facade.VendorLicenseFacade; + +import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDaoFactory; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.PackageInfo; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.UploadDataEntity; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails; +import org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes; +import org.openecomp.sdc.vendorsoftwareproduct.impl.VendorSoftwareProductManagerImpl; +import org.openecomp.sdc.vendorsoftwareproduct.tree.UploadFileTest; +import org.openecomp.sdc.vendorsoftwareproduct.types.UploadFileResponse; +import org.openecomp.sdc.vendorsoftwareproduct.types.ValidationResponse; +import org.openecomp.sdc.vendorsoftwareproduct.types.VersionedVendorSoftwareProductInfo; +import org.openecomp.sdc.versioning.dao.types.Version; +import org.openecomp.sdc.versioning.errors.VersioningErrorCodes; +import org.openecomp.core.model.dao.EnrichedServiceModelDaoFactory; +import org.openecomp.core.util.UniqueValueUtil; +import org.openecomp.core.utilities.CommonMethods; +import org.openecomp.core.validation.errors.Messages; +import org.apache.commons.collections4.MapUtils; +import org.apache.commons.io.IOUtils; +import org.testng.Assert; +import org.testng.annotations.BeforeTest; +import org.testng.annotations.Test; + +import java.io.*; +import java.net.URL; +import java.util.*; +import java.util.stream.Collectors; + +public class VendorSoftwareProductManagerTest { + public static final Version VERSION01 = new Version(0, 1); + public static final Version VERSION10 = new Version(1, 0); + private static final String USER1 = "vspTestUser1"; + private static final String USER2 = "vspTestUser2"; + private static final String USER3 = "vspTestUser3"; + public static String id001 = null; + public static String id002 = null; + public static String id003 = null; + public static String id004 = null; + public static String id005 = null; + public static String id006 = null; + public static String id007 = null; + public static Version activeVersion002 = null; + private static VendorSoftwareProductManager vendorSoftwareProductManager = + new VendorSoftwareProductManagerImpl(); + private static org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDao + vendorSoftwareProductDao = + VendorSoftwareProductDaoFactory.getInstance().createInterface(); + private static VendorLicenseFacade vendorLicenseFacade = + org.openecomp.sdc.vendorlicense.facade.VendorLicenseFacadeFactory.getInstance().createInterface(); + private static String vlm1Id; + private static String licenseAgreementId; + private static String featureGroupId; + private static VspDetails vsp1; + private static VspDetails vsp2; + UploadFileTest ut = new UploadFileTest(); + + static void assertVspsEquals(VspDetails actual, VspDetails expected) { + Assert.assertEquals(actual.getId(), expected.getId()); + Assert.assertEquals(actual.getVersion(), expected.getVersion()); + Assert.assertEquals(actual.getName(), expected.getName()); + Assert.assertEquals(actual.getDescription(), expected.getDescription()); + Assert.assertEquals(actual.getIcon(), expected.getIcon()); + Assert.assertEquals(actual.getCategory(), expected.getCategory()); + Assert.assertEquals(actual.getSubCategory(), expected.getSubCategory()); + Assert.assertEquals(actual.getVendorName(), expected.getVendorName()); + Assert.assertEquals(actual.getVendorId(), expected.getVendorId()); + Assert.assertEquals(actual.getLicenseAgreement(), expected.getLicenseAgreement()); + Assert.assertEquals(actual.getFeatureGroups(), expected.getFeatureGroups()); + } + + @BeforeTest + private void init() { + UniqueValueUtil + .deleteUniqueValue(VendorSoftwareProductConstants.UniqueValues.VENDOR_SOFTWARE_PRODUCT_NAME, + "VSP1"); + UniqueValueUtil + .deleteUniqueValue(VendorSoftwareProductConstants.UniqueValues.VENDOR_SOFTWARE_PRODUCT_NAME, + "VSP3"); + UniqueValueUtil + .deleteUniqueValue(VendorSoftwareProductConstants.UniqueValues.VENDOR_SOFTWARE_PRODUCT_NAME, + "VSP4"); + UniqueValueUtil + .deleteUniqueValue(VendorSoftwareProductConstants.UniqueValues.VENDOR_SOFTWARE_PRODUCT_NAME, + "VSP5"); + UniqueValueUtil + .deleteUniqueValue(VendorSoftwareProductConstants.UniqueValues.VENDOR_SOFTWARE_PRODUCT_NAME, + "vsp1_test"); + UniqueValueUtil + .deleteUniqueValue(VendorSoftwareProductConstants.UniqueValues.VENDOR_SOFTWARE_PRODUCT_NAME, + "vsp2_test"); + createVlm(); + } + + private void createVlm() { + vlm1Id = vendorLicenseFacade.createVendorLicenseModel(VSPCommon + .createVendorLicenseModel("vlmName " + CommonMethods.nextUuId(), "vlm1Id desc", "icon1"), + USER1).getId(); + + String entitlementPoolId = vendorLicenseFacade + .createEntitlementPool(new EntitlementPoolEntity(vlm1Id, null, null), USER1).getId(); + + org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupEntity + featureGroup = new org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupEntity(vlm1Id, null, null); + featureGroup.getEntitlementPoolIds().add(entitlementPoolId); + featureGroupId = vendorLicenseFacade.createFeatureGroup(featureGroup, USER1).getId(); + + LicenseAgreementEntity licenseAgreement = new LicenseAgreementEntity(vlm1Id, null, null); + licenseAgreement.getFeatureGroupIds().add(featureGroupId); + licenseAgreementId = + vendorLicenseFacade.createLicenseAgreement(licenseAgreement, USER1).getId(); + + vendorLicenseFacade.checkin(vlm1Id, USER1); + vendorLicenseFacade.submit(vlm1Id, USER1); + } + + @Test + public void testHeatSet() { + Set<HeatStructureTree> set = new HashSet<>(); + HeatStructureTree heatStructureTree1 = new HeatStructureTree(); + HeatStructureTree heatStructureTree2 = new HeatStructureTree(); + + heatStructureTree1.setFileName("file"); + + HeatStructureTree env = new HeatStructureTree(); + env.setFileName("env"); + heatStructureTree1.setEnv(env); + + heatStructureTree2.setFileName("file"); + heatStructureTree2.setEnv(env); + + set.add(heatStructureTree1); + set.add(heatStructureTree2); + + Assert.assertEquals(set.size(), 1); + } + + @Test(dependsOnMethods = {"testHeatSet"}) + public void testCreateVSP() { + VspDetails expectedVsp = VSPCommon + .createVspDetails(null, null, "VSP1", "Test-vsp", "vendorName", vlm1Id, "icon", "category", + "subCategory", "123", null); + + VspDetails createdVsp = vendorSoftwareProductManager.createNewVsp(expectedVsp, USER1); + id001 = createdVsp.getId(); + Assert.assertNotNull(id001); + Assert.assertNotNull(createdVsp.getVersion()); + + VspDetails actualVsp = + vendorSoftwareProductDao.getVendorSoftwareProductInfo(new VspDetails(id001, VERSION01)); + expectedVsp.setId(id001); + expectedVsp.setVersion(VERSION01); + + assertVspsEquals(actualVsp, expectedVsp); + Assert.assertNotNull( + vendorSoftwareProductManager.getVspQuestionnaire(id001, null, USER1).getData()); + } + + @Test(dependsOnMethods = {"testCreateVSP"}) + public void testCreateWithExistingName_negative() { + try { + VspDetails expectedVsp = VSPCommon + .createVspDetails(null, null, "Vsp1", "Test-vsp", "vendorName", vlm1Id, "icon", + "category", "subCategory", "123", null); + vendorSoftwareProductManager.createNewVsp(expectedVsp, USER1); + Assert.fail(); + } catch (CoreException e) { + Assert.assertEquals(e.code().id(), UniqueValueUtil.UNIQUE_VALUE_VIOLATION); + } + } + + @Test(dependsOnMethods = {"testCreateWithExistingName_negative"}) + public void testGetVSPDetails() { + VersionedVendorSoftwareProductInfo actualVsp = + vendorSoftwareProductManager.getVspDetails(id001, null, USER1); + + VspDetails expectedVsp = + vendorSoftwareProductDao.getVendorSoftwareProductInfo(new VspDetails(id001, VERSION01)); + assertVspsEquals(actualVsp.getVspDetails(), expectedVsp); + Assert.assertEquals(actualVsp.getVersionInfo().getActiveVersion(), VERSION01); + Assert.assertEquals(actualVsp.getVersionInfo().getStatus(), org.openecomp.sdc.versioning.dao.types.VersionStatus.Locked); + Assert.assertEquals(actualVsp.getVersionInfo().getLockingUser(), USER1); + } + + @Test(dependsOnMethods = {"testGetVSPDetails"}) + public void testUpdateVSP() { + VspDetails expectedVsp = VSPCommon + .createVspDetails(id001, VERSION01, "VSP1", null, "vendorName", vlm1Id, "icon", "category", + "subCategory", "456", null); + vendorSoftwareProductManager.updateVsp(expectedVsp, USER1); + + VspDetails actualVsp = + vendorSoftwareProductDao.getVendorSoftwareProductInfo(new VspDetails(id001, VERSION01)); + + assertVspsEquals(actualVsp, expectedVsp); + } + + @Test(dependsOnMethods = {"testUpdateVSP"}) + public void testGetVSPDetailsAfterUpdate() { + VersionedVendorSoftwareProductInfo vspDetails = + vendorSoftwareProductManager.getVspDetails(id001, null, USER1); + Assert.assertEquals(vspDetails.getVspDetails().getName(), "VSP1"); + Assert.assertEquals(vspDetails.getVspDetails().getCategory(), "category"); + Assert.assertEquals(vspDetails.getVspDetails().getSubCategory(), "subCategory"); + Assert.assertEquals(vspDetails.getVspDetails().getVendorId(), vlm1Id); + Assert.assertEquals(vspDetails.getVersionInfo().getActiveVersion(), VERSION01); + Assert.assertEquals(vspDetails.getVersionInfo().getStatus(), org.openecomp.sdc.versioning.dao.types.VersionStatus.Locked); + Assert.assertEquals(vspDetails.getVersionInfo().getLockingUser(), USER1); + } + + @Test(dependsOnMethods = {"testGetVSPDetailsAfterUpdate"}) + public void testGetVSPList() { + String licenseAgreementId = "bla bla"; + VspDetails vspDetails = vendorSoftwareProductManager.createNewVsp(VSPCommon + .createVspDetails(null, null, "VSP3", "Test-vsp", "vendorName", vlm1Id, "icon", "category", + "subCategory", licenseAgreementId, null), USER1); + id002 = vspDetails.getId(); + vspDetails = vendorSoftwareProductManager.createNewVsp(VSPCommon + .createVspDetails(null, null, "VSP4", "Test-vsp", "vendorName", vlm1Id, "icon", "category", + "subCategory", licenseAgreementId, null), USER1); + id003 = vspDetails.getId(); + + List<VersionedVendorSoftwareProductInfo> vspDetailsList = + vendorSoftwareProductManager.getVspList(null, USER1); + int foundCount = 0; + for (VersionedVendorSoftwareProductInfo vsp : vspDetailsList) { + if (vsp.getVspDetails().getId().equals(id001) || vsp.getVspDetails().getId().equals(id002) || + vsp.getVspDetails().getId().equals(id003)) { + foundCount++; + } + } + + Assert.assertEquals(foundCount, 3); + } + + @Test(dependsOnMethods = {"testGetVSPList"}) + // Unsupported operation for 1607 release. +/* public void testDeleteVSP() { + vendorSoftwareProductManager.deleteVsp(id001, USER1); + + VspDetails vspDetails = vendorSoftwareProductDao.getVendorSoftwareProductInfo(new VspDetails(id001, VERSION01)); + Assert.assertNull(vspDetails); + + List<VersionedVendorSoftwareProductInfo> vspDetailsList = vendorSoftwareProductManager.getVspList(null, USER1); + boolean found001 = false; + for (VersionedVendorSoftwareProductInfo vsp : vspDetailsList) { + if (vsp.getVspDetails().getId().equals(id001)) { + found001 = true; + } + } + + Assert.assertFalse(found001); + } + + + @Test(dependsOnMethods = {"testDeleteVSP"})*/ + public void testCheckin() { + vendorSoftwareProductManager.checkin(id002, USER1); + + VersionedVendorSoftwareProductInfo vsp2 = + vendorSoftwareProductManager.getVspDetails(id002, null, USER1); + Assert.assertEquals(vsp2.getVersionInfo().getActiveVersion(), VERSION01); + Assert.assertEquals(vsp2.getVersionInfo().getStatus(), org.openecomp.sdc.versioning.dao.types.VersionStatus.Available); + Assert.assertNull(vsp2.getVersionInfo().getLockingUser()); + } + + @Test(dependsOnMethods = {"testCheckin"}) + public void testCheckout() { + vendorSoftwareProductManager.checkout(id002, USER2); + + VersionedVendorSoftwareProductInfo vsp2 = + vendorSoftwareProductManager.getVspDetails(id002, null, USER2); + Assert.assertEquals(vsp2.getVersionInfo().getActiveVersion(), new Version(0, 2)); + Assert.assertEquals(vsp2.getVersionInfo().getStatus(), org.openecomp.sdc.versioning.dao.types.VersionStatus.Locked); + Assert.assertEquals(vsp2.getVersionInfo().getLockingUser(), USER2); + + vsp2 = vendorSoftwareProductManager.getVspDetails(id002, null, USER1); + Assert.assertEquals(vsp2.getVersionInfo().getActiveVersion(), VERSION01); + Assert.assertEquals(vsp2.getVersionInfo().getStatus(), org.openecomp.sdc.versioning.dao.types.VersionStatus.Locked); + Assert.assertEquals(vsp2.getVersionInfo().getLockingUser(), USER2); + } + + @Test(dependsOnMethods = {"testCheckout"}) + public void testUndoCheckout() { + vendorSoftwareProductManager.undoCheckout(id002, USER2); + + VersionedVendorSoftwareProductInfo vsp2 = + vendorSoftwareProductManager.getVspDetails(id002, null, USER2); + Assert.assertEquals(vsp2.getVersionInfo().getActiveVersion(), VERSION01); + Assert.assertEquals(vsp2.getVersionInfo().getStatus(), org.openecomp.sdc.versioning.dao.types.VersionStatus.Available); + Assert.assertNull(vsp2.getVersionInfo().getLockingUser()); + } + + @Test(dependsOnMethods = {"testUndoCheckout"}) + public void testListFinalVspsWhenNone() { + List<VersionedVendorSoftwareProductInfo> vspDetailsList = + vendorSoftwareProductManager.getVspList( + org.openecomp.sdc.versioning.dao.types.VersionStatus.Final.name(), USER1); + int nonFinalFoundCount = 0; + for (VersionedVendorSoftwareProductInfo vsp : vspDetailsList) { + if (vsp.getVspDetails().getId().equals(id001) || vsp.getVspDetails().getId().equals(id002) || + vsp.getVspDetails().getId().equals(id003)) { + nonFinalFoundCount++; + } + } + + Assert.assertEquals(nonFinalFoundCount, 0); + } + + @Test(dependsOnMethods = "testListFinalVspsWhenNone") + public void testSubmitWithoutLicencingData() throws IOException { + ValidationResponse validationResponse = vendorSoftwareProductManager.submit(id002, USER2); + Assert.assertNotNull(validationResponse); + Assert.assertFalse(validationResponse.isValid()); + List<String> errorIds = validationResponse.getVspErrors().stream().map(ErrorCode::id).distinct() + .collect(Collectors.toList()); + Assert.assertTrue(errorIds.contains(ValidationErrorBuilder.FIELD_VALIDATION_ERROR_ERR_ID)); + Assert.assertTrue(errorIds.contains(VendorSoftwareProductErrorCodes.VSP_INVALID)); + } + + @Test(dependsOnMethods = {"testSubmitWithoutLicencingData"}) + public void testSubmitWithoutUploadData() throws IOException { + vendorSoftwareProductManager.checkout(id002, USER2); + + VspDetails updatedVsp2 = + vendorSoftwareProductManager.getVspDetails(id002, null, USER2).getVspDetails(); + updatedVsp2.setFeatureGroups(new ArrayList<>()); + updatedVsp2.getFeatureGroups().add(featureGroupId); + updatedVsp2.setLicenseAgreement(licenseAgreementId); + + vendorSoftwareProductManager.updateVsp(updatedVsp2, USER2); + activeVersion002 = vendorSoftwareProductManager.checkin(id002, USER2); + + ValidationResponse validationResponse = vendorSoftwareProductManager.submit(id002, USER2); + Assert.assertNotNull(validationResponse); + Assert.assertFalse(validationResponse.isValid()); + Assert.assertTrue(validationResponse.getVspErrors().size() > 0); + } + + @Test(dependsOnMethods = {"testSubmitWithoutUploadData"}) + public void testUploadFile() throws IOException { + activeVersion002 = vendorSoftwareProductManager.checkout(id002, USER1); + testLegalUpload(id002, activeVersion002, + getFileInputStream("/vspmanager/zips/emptyComposition.zip"), USER1); + } + +/* @Test(dependsOnMethods = {"testUploadFile"}) + public void testUploadFile2() throws IOException { + testLegalUpload(id002, activeVersion002, ut.getZipInputStream("/legalUpload2"), USER1); + }*/ + + @Test + public void testDownloadFile() throws IOException { + VspDetails expectedVsp = VSPCommon + .createVspDetails(null, null, String.format("VSP-test-%s", vlm1Id), "Test-vsp", + "vendorName", vlm1Id, "icon", "category", "subCategory", "123", null); + VspDetails createdVsp = vendorSoftwareProductManager.createNewVsp(expectedVsp, USER1); + + id005 = createdVsp.getId(); + Assert.assertNotNull(id005); + Assert.assertNotNull(createdVsp.getVersion()); + + //InputStream zipInputStream = getFileInputStream("/legalUpload/zip/legalUpload.zip") + try (InputStream zipInputStream = ut.getZipInputStream("/legalUpload")) { + + UploadFileResponse resp = + vendorSoftwareProductManager.uploadFile(id005, zipInputStream, USER1); + File latestHeatPackage = vendorSoftwareProductManager.getLatestHeatPackage(id005, USER1); + + zipInputStream.reset(); + byte[] uploaded = IOUtils.toByteArray(zipInputStream); + + byte[] downloaded; + try (BufferedInputStream fileStream = new BufferedInputStream( + new FileInputStream(latestHeatPackage))) { + downloaded = IOUtils.toByteArray(fileStream); + } + + Assert.assertTrue(Arrays.equals(uploaded, downloaded)); + } + } + + @Test(dependsOnMethods = {"testUploadFile"}) + public void testUploadNotExistingFile() throws IOException { + URL url = this.getClass().getResource("notExist.zip"); + testLegalUpload(id002, activeVersion002, url == null ? null : url.openStream(), USER1); + } + + @Test(dependsOnMethods = {"testUploadFile"}, expectedExceptions = CoreException.class) + public void negativeTestCreatePackageBeforeSubmit() throws IOException { + vendorSoftwareProductManager.createPackage(id002, USER1); + } + + @Test(dependsOnMethods = {"negativeTestCreatePackageBeforeSubmit"}) + public void negativeTestGetVSPDetailsNonExistingVersion() { + try { + vendorSoftwareProductManager.getVspDetails(id002, new Version(43, 8), USER1); + Assert.assertTrue(false); + } catch (CoreException e) { + Assert.assertEquals(e.code().id(), VersioningErrorCodes.REQUESTED_VERSION_INVALID); + } + } + + @Test(dependsOnMethods = {"negativeTestCreatePackageBeforeSubmit"}) + public void negativeTestGetVSPDetailsCheckoutByOtherVersion() { + try { + vendorSoftwareProductManager.getVspDetails(id002, activeVersion002, USER2); + Assert.assertTrue(false); + } catch (CoreException e) { + Assert.assertEquals(e.code().id(), VersioningErrorCodes.REQUESTED_VERSION_INVALID); + } + } + + @Test(dependsOnMethods = {"negativeTestCreatePackageBeforeSubmit"}) + public void testGetVSPDetailsCandidateVersion() { + VersionedVendorSoftwareProductInfo actualVsp = + vendorSoftwareProductManager.getVspDetails(id002, new Version(0, 3), USER1); + + VspDetails expectedVsp = vendorSoftwareProductDao + .getVendorSoftwareProductInfo(new VspDetails(id002, new Version(0, 3))); + assertVspsEquals(actualVsp.getVspDetails(), expectedVsp); + Assert.assertEquals(actualVsp.getVersionInfo().getActiveVersion(), new Version(0, 3)); + Assert.assertEquals(actualVsp.getVersionInfo().getStatus(), org.openecomp.sdc.versioning.dao.types.VersionStatus.Locked); + Assert.assertEquals(actualVsp.getVersionInfo().getLockingUser(), USER1); + } + + @Test(dependsOnMethods = {"negativeTestCreatePackageBeforeSubmit"}) + public void testGetVSPDetailsOldVersion() { + VersionedVendorSoftwareProductInfo actualVsp = + vendorSoftwareProductManager.getVspDetails(id002, new Version(0, 1), USER2); + + VspDetails expectedVsp = vendorSoftwareProductDao + .getVendorSoftwareProductInfo(new VspDetails(id002, new Version(0, 1))); + assertVspsEquals(actualVsp.getVspDetails(), expectedVsp); + Assert.assertEquals(actualVsp.getVersionInfo().getActiveVersion(), new Version(0, 2)); + Assert.assertEquals(actualVsp.getVersionInfo().getStatus(), org.openecomp.sdc.versioning.dao.types.VersionStatus.Locked); + Assert.assertEquals(actualVsp.getVersionInfo().getLockingUser(), USER1); + } + + @Test(dependsOnMethods = {"negativeTestGetVSPDetailsNonExistingVersion", + "negativeTestGetVSPDetailsCheckoutByOtherVersion", "testGetVSPDetailsCandidateVersion", + "testGetVSPDetailsOldVersion"}) + public void testSubmit() throws IOException { + activeVersion002 = vendorSoftwareProductManager.checkin(id002, USER1); + ValidationResponse validationResponse = vendorSoftwareProductManager.submit(id002, USER1); + Assert.assertTrue(validationResponse.isValid()); + + VersionedVendorSoftwareProductInfo vsp2 = + vendorSoftwareProductManager.getVspDetails(id002, null, USER1); + Assert.assertEquals(vsp2.getVersionInfo().getActiveVersion(), VERSION10); + Assert.assertEquals(vsp2.getVersionInfo().getStatus(), org.openecomp.sdc.versioning.dao.types.VersionStatus.Final); + Assert.assertNull(vsp2.getVersionInfo().getLockingUser()); + } + + @Test(dependsOnMethods = {"testSubmit"}) + public void testListFinalVspsWhenExist() { + List<VersionedVendorSoftwareProductInfo> vspDetailsList = + vendorSoftwareProductManager.getVspList( + org.openecomp.sdc.versioning.dao.types.VersionStatus.Final.name(), USER1); + int nonFinalFoundCount = 0; + boolean found002 = false; + for (VersionedVendorSoftwareProductInfo vsp : vspDetailsList) { + if (vsp.getVspDetails().getId().equals(id002)) { + found002 = true; + } + if (vsp.getVspDetails().getId().equals(id001) || vsp.getVspDetails().getId().equals(id003)) { + nonFinalFoundCount++; + } + } + + Assert.assertEquals(nonFinalFoundCount, 0); + Assert.assertTrue(found002); + } + + @Test(dependsOnMethods = {"testSubmit"}) + public void testCreatePackage() throws IOException { + PackageInfo packageInfo = vendorSoftwareProductManager.createPackage(id002, USER1); + Assert.assertNotNull(packageInfo.getVspId()); + } + + @Test + public void testUploadFileWithoutManifest() { + InputStream zis = getFileInputStream("/vspmanager/zips/withoutManifest.zip"); + VspDetails vspDetails = vendorSoftwareProductManager.createNewVsp(VSPCommon + .createVspDetails(null, null, "VSP5", "Test-vsp", "vendorName", vlm1Id, "icon", "category", + "subCategory", "456", null), USER1); + id004 = vspDetails.getId(); + + UploadFileResponse uploadFileResponse = + vendorSoftwareProductManager.uploadFile(id004, zis, USER1); + + Assert.assertNotNull(uploadFileResponse.getErrors()); + Assert.assertEquals(uploadFileResponse.getErrors().size(), 1); + } + + @Test(dependsOnMethods = {"testUploadFileWithoutManifest"}) + public void testUploadFileMissingFile() { + InputStream zis = getFileInputStream("/vspmanager/zips/missingYml.zip"); + + UploadFileResponse uploadFileResponse = + vendorSoftwareProductManager.uploadFile(id004, zis, USER1); + + Assert.assertEquals(uploadFileResponse.getErrors().size(), 3); + } + + @Test(dependsOnMethods = {"testUploadFileMissingFile"}) + public void testUploadNotZipFile() throws IOException { + URL url = this.getClass().getResource("/notZipFile"); + UploadFileResponse uploadFileResponse = + vendorSoftwareProductManager.uploadFile(id004, url.openStream(), USER1); + + Assert.assertNotNull(uploadFileResponse.getErrors()); + Assert.assertEquals( + uploadFileResponse.getErrors().get(AsdcCommon.UPLOAD_FILE).get(0).getMessage(), + Messages.INVALID_ZIP_FILE.getErrorMessage()); + } + + @Test + public void testEnrichModelInSubmit() { + UniqueValueUtil + .deleteUniqueValue(VendorSoftwareProductConstants.UniqueValues.VENDOR_SOFTWARE_PRODUCT_NAME, + "VSP_syb"); + VspDetails vspDetails = vendorSoftwareProductManager.createNewVsp(VSPCommon + .createVspDetails(null, null, "VSP_syb", "Test-vsp_syb", "vendorName", vlm1Id, "icon", + "category", "subCategory", "456", null), USER1); + String id = vspDetails.getId(); + + //upload file + InputStream zis = getFileInputStream("/vspmanager/zips/fullComposition.zip"); + UploadFileResponse uploadFileResponse = vendorSoftwareProductManager.uploadFile(id, zis, USER1); + + //check in + vendorSoftwareProductManager.checkin(id, USER1); + //submit + try { + ValidationResponse result = vendorSoftwareProductManager.submit(id, USER1); + } catch (IOException e) { + Assert.fail(); + } + VersionedVendorSoftwareProductInfo details = + vendorSoftwareProductManager.getVspDetails(id, null, USER1); + Collection<org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity> components = vendorSoftwareProductManager + .listComponents(id, details.getVersionInfo().getActiveVersion(), USER1); + + ToscaServiceModel model = + (ToscaServiceModel) EnrichedServiceModelDaoFactory.getInstance().createInterface() + .getServiceModel(id, details.getVersionInfo().getActiveVersion()); + + Map<String, CapabilityDefinition> capabilities = new HashMap<>(); + for (org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity component : components) { + model.getServiceTemplates(). + entrySet(). + stream(). + filter(entryValue -> entryValue.getValue() != null && + entryValue.getValue().getNode_types() != null && + entryValue.getValue(). + getNode_types(). + containsKey(component.getComponentCompositionData().getName())). + forEach(entryValue -> entryValue.getValue().getNode_types(). + values(). + stream(). + filter(type -> MapUtils.isNotEmpty(type.getCapabilities())). + forEach(type -> type.getCapabilities(). + entrySet(). + forEach(entry -> addCapability(entryValue.getKey(), capabilities, entry.getKey(), + entry.getValue())))); + + } + + Assert.assertNotNull(capabilities); + } + + @Test(dependsOnMethods = {"testEnrichModelInSubmit"}) + public void testVSPListSortedByModificationTimeDescOreder() { + vsp1 = VSPCommon + .createVspDetails(null, null, "vsp1_test", "Test-vsp", "vendorName", vlm1Id, "icon", + "category", "subCategory", "123", null); + id006 = vendorSoftwareProductManager.createNewVsp(vsp1, USER3).getId(); + + vsp2 = VSPCommon + .createVspDetails(null, null, "vsp2_test", "Test-vsp", "vendorName", vlm1Id, "icon", + "category", "subCategory", "123", null); + id007 = vendorSoftwareProductManager.createNewVsp(vsp2, USER3).getId(); + + assertVSPInWantedLocationInVSPList(id007, 0, USER3); + assertVSPInWantedLocationInVSPList(id006, 1, USER3); + } + + @Test(dependsOnMethods = {"testVSPListSortedByModificationTimeDescOreder"}) + public void testUpdatedVSPShouldBeInBeginningOfList() { + vendorSoftwareProductManager.updateVsp(vsp1, USER3); + assertVSPInWantedLocationInVSPList(id006, 0, USER3); + + vendorSoftwareProductManager + .uploadFile(id007, getFileInputStream("/vspmanager/zips/emptyComposition.zip"), USER3); + assertVSPInWantedLocationInVSPList(id007, 0, USER3); + } + + @Test(dependsOnMethods = {"testUpdatedVSPShouldBeInBeginningOfList"}) + public void testVSPInBeginningOfListAfterCheckin() { + vendorSoftwareProductManager.checkin(id006, USER3); + assertVSPInWantedLocationInVSPList(id006, 0, USER3); + + vendorSoftwareProductManager.checkin(id007, USER3); + assertVSPInWantedLocationInVSPList(id007, 0, USER3); + } + + @Test(dependsOnMethods = {"testVSPInBeginningOfListAfterCheckin"}) + public void testVSPInBeginningOfListAfterCheckout() { + vendorSoftwareProductManager.checkout(id006, USER3); + assertVSPInWantedLocationInVSPList(id006, 0, USER3); + } + + @Test(dependsOnMethods = {"testVSPInBeginningOfListAfterCheckout"}) + public void testVSPInBeginningOfListAfterUndoCheckout() { + vendorSoftwareProductManager.checkout(id007, USER3); + assertVSPInWantedLocationInVSPList(id007, 0, USER3); + + vendorSoftwareProductManager.undoCheckout(id006, USER3); + assertVSPInWantedLocationInVSPList(id006, 0, USER3); + } + + @Test(dependsOnMethods = {"testVSPInBeginningOfListAfterUndoCheckout"}) + public void testVSPInBeginningOfListAfterSubmit() throws IOException { + vendorSoftwareProductManager.checkin(id007, USER3); + vendorSoftwareProductManager.submit(id007, USER3); + + assertVSPInWantedLocationInVSPList(id007, 0, USER3); + } + + private void testLegalUpload(String vspId, Version version, InputStream upload, String user) { + vendorSoftwareProductManager.uploadFile(vspId, upload, user); + + UploadDataEntity uploadData = + vendorSoftwareProductDao.getUploadData(new UploadDataEntity(vspId, version)); + Assert.assertNotNull(uploadData); + Assert.assertNotNull(uploadData.getContentData()); + } + + private void addCapability(String entryValueKey, Map<String, CapabilityDefinition> capabilities, + String key, CapabilityDefinition value) { + + capabilities.put(entryValueKey + "_" + key, value); + } + + private InputStream getFileInputStream(String fileName) { + URL url = this.getClass().getResource(fileName); + try { + return url.openStream(); + } catch (IOException e) { + e.printStackTrace(); + return null; + } + } + + private void assertVSPInWantedLocationInVSPList(String vspId, int location, String user) { + List<VersionedVendorSoftwareProductInfo> vspList = + vendorSoftwareProductManager.getVspList(null, user); + Assert.assertEquals(vspList.get(location).getVspDetails().getId(), vspId); + } +}
\ No newline at end of file diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/services/CompositionDataExtractorTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/services/CompositionDataExtractorTest.java new file mode 100644 index 0000000000..55f30db609 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/services/CompositionDataExtractorTest.java @@ -0,0 +1,280 @@ +package org.openecomp.sdc.vendorsoftwareproduct.services; + +import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel; +import org.openecomp.sdc.tosca.datatypes.model.ServiceTemplate; +import org.openecomp.sdc.tosca.services.yamlutil.ToscaExtensionYamlUtil; + +import org.testng.Assert; +import org.testng.annotations.Test; + +import java.io.*; +import java.net.URL; +import java.nio.file.NotDirectoryException; +import java.util.HashMap; +import java.util.Map; + +public class CompositionDataExtractorTest { + + + private static ToscaServiceModel loadToscaServiceModel(String serviceTemplatesPath, + String globalServiceTemplatesPath, + String entryDefinitionServiceTemplate) + throws IOException { + ToscaExtensionYamlUtil toscaExtensionYamlUtil = new ToscaExtensionYamlUtil(); + Map<String, ServiceTemplate> serviceTemplates = new HashMap<>(); + if (entryDefinitionServiceTemplate == null) { + entryDefinitionServiceTemplate = "MainServiceTemplate.yaml"; + } + + loadServiceTemplates(serviceTemplatesPath, toscaExtensionYamlUtil, serviceTemplates); + if (globalServiceTemplatesPath != null) { + loadServiceTemplates(globalServiceTemplatesPath, toscaExtensionYamlUtil, serviceTemplates); + } + + return new ToscaServiceModel(null, serviceTemplates, entryDefinitionServiceTemplate); + } + + private static void loadServiceTemplates(String serviceTemplatesPath, + ToscaExtensionYamlUtil toscaExtensionYamlUtil, + Map<String, ServiceTemplate> serviceTemplates) + throws IOException { + URL urlFile = CompositionDataExtractorTest.class.getResource(serviceTemplatesPath); + if (urlFile != null) { + File pathFile = new File(urlFile.getFile()); + File[] files = pathFile.listFiles(); + if (files != null) { + addServiceTemplateFiles(serviceTemplates, files, toscaExtensionYamlUtil); + } else { + throw new NotDirectoryException(serviceTemplatesPath); + } + } else { + throw new NotDirectoryException(serviceTemplatesPath); + } + } + + private static void addServiceTemplateFiles(Map<String, ServiceTemplate> serviceTemplates, + File[] files, + ToscaExtensionYamlUtil toscaExtensionYamlUtil) + throws IOException { + for (File file : files) { + try (InputStream yamlFile = new FileInputStream(file)) { + ServiceTemplate serviceTemplateFromYaml = + toscaExtensionYamlUtil.yamlToObject(yamlFile, ServiceTemplate.class); + serviceTemplates.put(file.getName(), serviceTemplateFromYaml); + try { + yamlFile.close(); + } catch (IOException ignore) { + } + } catch (FileNotFoundException e) { + throw e; + } catch (IOException e) { + throw e; + } + } + } + + @Test + public void testExtractNetworks() throws Exception { + ToscaServiceModel toscaServiceModel = + loadToscaServiceModel("/extractServiceComposition/networks/", + "/extractServiceComposition/toscaGlobalServiceTemplates/", null); + org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionData compositionData = + CompositionDataExtractor.extractServiceCompositionData(toscaServiceModel); + Assert.assertEquals(compositionData.getComponents().size(), 0); + Assert.assertEquals(compositionData.getNetworks().size(), 7); + + for (org.openecomp.sdc.vendorsoftwareproduct.types.composition.Network network : compositionData.getNetworks()) { + boolean dhcp = network.isDhcp(); + switch (network.getName()) { + case "contail-net-default-true-dhcp": + Assert.assertEquals(dhcp, true); + break; + case "contail-net-dhcp-false-param": + Assert.assertEquals(dhcp, false); + break; + case "contail-net-dhcp-false": + Assert.assertEquals(dhcp, false); + break; + case "contail-net-dhcp-true-param": + Assert.assertEquals(dhcp, true); + break; + case "contail-net-dhcp-true": + Assert.assertEquals(dhcp, true); + break; + case "contail-net-dhcp-default-true-param": + Assert.assertEquals(dhcp, true); + break; + case "neutron-net-default-dhcp": + Assert.assertEquals(dhcp, true); + break; + default: + throw new Exception("Unexpected Network Name " + network.getName()); + } + + } + } + + @Test + public void testExtractOnlyComponents() throws Exception { + ToscaServiceModel toscaServiceModel = + loadToscaServiceModel("/extractServiceComposition/onlyComponents/", + "/extractServiceComposition/toscaGlobalServiceTemplates/", "OnlyComponentsST.yaml"); + org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionData compositionData = + CompositionDataExtractor.extractServiceCompositionData(toscaServiceModel); + Assert.assertEquals(compositionData.getComponents().size(), 3); + Assert.assertEquals(compositionData.getNetworks().size(), 0); + + for (org.openecomp.sdc.vendorsoftwareproduct.types.composition.Component component : compositionData.getComponents()) { + switch (component.getData().getName()) { + case "org.openecomp.resource.vfc.nodes.heat.pcrf_psm": + Assert.assertNull(component.getNics()); + Assert.assertEquals(component.getData().getDisplayName(), "pcrf_psm"); + break; + case "org.openecomp.resource.vfc.nodes.heat.nova.Server": + Assert.assertNull(component.getNics()); + Assert.assertEquals(component.getData().getDisplayName(), "Server"); + break; + case "org.openecomp.resource.vfc.nodes.heat.pcm": + Assert.assertNull(component.getNics()); + Assert.assertEquals(component.getData().getDisplayName(), "pcm"); + break; + default: + throw new Exception("Unexpected ComponentData Name " + component.getData().getName()); + } + } + } + + @Test + public void testExtractComponentsWithPorts() throws Exception { + + ToscaServiceModel toscaServiceModel = + loadToscaServiceModel("/extractServiceComposition/componentsWithPort/", + "/extractServiceComposition/toscaGlobalServiceTemplates/", "ComponentsWithPortST.yaml"); + org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionData compositionData = + CompositionDataExtractor.extractServiceCompositionData(toscaServiceModel); + + Assert.assertEquals(compositionData.getComponents().size(), 3); + Assert.assertEquals(compositionData.getNetworks().size(), 0); + + for (org.openecomp.sdc.vendorsoftwareproduct.types.composition.Component component : compositionData.getComponents()) { + switch (component.getData().getName()) { + case "org.openecomp.resource.vfc.nodes.heat.pcrf_psm": + Assert.assertEquals(component.getNics().size(), 1); + Assert.assertEquals(component.getNics().get(0).getName(), "psm01_port_0"); + Assert.assertNull(component.getNics().get(0).getNetworkName()); + Assert.assertEquals(component.getData().getDisplayName(), "pcrf_psm"); + break; + case "org.openecomp.resource.vfc.nodes.heat.nova.Server": + Assert.assertEquals(component.getNics().size(), 1); + Assert.assertEquals(component.getNics().get(0).getName(), "FSB1_Internal2"); + Assert.assertNull(component.getNics().get(0).getNetworkName()); + Assert.assertEquals(component.getData().getDisplayName(), "Server"); + break; + case "org.openecomp.resource.vfc.nodes.heat.pcm": + Assert.assertEquals(component.getNics().size(), 2); + Assert.assertEquals(component.getData().getDisplayName(), "pcm"); + break; + default: + throw new Exception("Unexpected ComponentData Name " + component.getData().getName()); + } + } + } + + @Test + public void testExtractFullComposition() throws Exception { + + ToscaServiceModel toscaServiceModel = + loadToscaServiceModel("/extractServiceComposition/fullComposition/", + "/extractServiceComposition/toscaGlobalServiceTemplates/", null); + org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionData compositionData = + CompositionDataExtractor.extractServiceCompositionData(toscaServiceModel); + Assert.assertEquals(compositionData.getComponents().size(), 3); + Assert.assertEquals(compositionData.getNetworks().size(), 3); + + for (org.openecomp.sdc.vendorsoftwareproduct.types.composition.Component component : compositionData.getComponents()) { + switch (component.getData().getName()) { + case "org.openecomp.resource.vfc.nodes.heat.pcrf_psm": + Assert.assertEquals(component.getNics().size(), 1); + Assert.assertEquals(component.getNics().get(0).getName(), "psm01_port_0"); + Assert.assertNull(component.getNics().get(0).getNetworkName()); + Assert.assertEquals(component.getData().getDisplayName(), "pcrf_psm"); + break; + case "org.openecomp.resource.vfc.nodes.heat.nova.Server": + Assert.assertEquals(component.getNics().size(), 3); + Assert.assertEquals(component.getData().getDisplayName(), "Server"); + for (org.openecomp.sdc.vendorsoftwareproduct.types.composition.Nic port : component.getNics()) { + switch (port.getName()) { + case "FSB1_Internal2_port": + Assert.assertEquals(port.getNetworkName(), "Internal2-net"); + break; + case "FSB1_OAM_Port": + Assert.assertNull(port.getNetworkName()); + break; + case "FSB1_Internal1_port": + Assert.assertEquals(port.getNetworkName(), "Internal1-net"); + break; + default: + throw new Exception("Unexpected Nic " + port.getName()); + } + } + break; + case "org.openecomp.resource.vfc.nodes.heat.pcm": + Assert.assertEquals(component.getNics().size(), 2); + Assert.assertEquals(component.getData().getDisplayName(), "pcm"); + break; + default: + throw new Exception("Unexpected ComponentData Name " + component.getData().getName()); + } + } + } + + @Test + public void testExtractSubstitutionComposition() throws Exception { + + ToscaServiceModel toscaServiceModel = + loadToscaServiceModel("/extractServiceComposition/substitution/", + "/extractServiceComposition/toscaGlobalServiceTemplates/", null); + org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionData compositionData = + CompositionDataExtractor.extractServiceCompositionData(toscaServiceModel); + Assert.assertEquals(compositionData.getComponents().size(), 2); + Assert.assertEquals(compositionData.getNetworks().size(), 4); + + for (org.openecomp.sdc.vendorsoftwareproduct.types.composition.Component component : compositionData.getComponents()) { + switch (component.getData().getName()) { + case "org.openecomp.resource.vfc.nodes.heat.cmaui_image": + Assert.assertEquals(component.getNics().size(), 1); + Assert.assertEquals(component.getNics().get(0).getName(), "cmaui_port_1"); + Assert.assertEquals(component.getNics().get(0).getNetworkName(), "test_net1"); + Assert.assertEquals(component.getData().getDisplayName(), "cmaui_image"); + break; + case "org.openecomp.resource.vfc.nodes.heat.abc_image": + Assert.assertEquals(component.getNics().size(), 1); + Assert.assertEquals(component.getNics().get(0).getName(), "abc_port_1"); + Assert.assertEquals(component.getNics().get(0).getNetworkName(), "test_net2"); + Assert.assertEquals(component.getData().getDisplayName(), "abc_image"); + break; + default: + throw new Exception("Unexpected ComponentData Name " + component.getData().getName()); + } + } + for (org.openecomp.sdc.vendorsoftwareproduct.types.composition.Network network : compositionData.getNetworks()) { + boolean dhcp = network.isDhcp(); + switch (network.getName()) { + case "test_net2": + Assert.assertEquals(dhcp, true); + break; + case "test_net1": + Assert.assertEquals(dhcp, true); + break; + case "Internal1-net": // same network display twice since define in 2 nested files with the same key + Assert.assertEquals(dhcp, true); + break; + default: + throw new Exception("Unexpected Network Name " + network.getName()); + } + + } + } + + +}
\ No newline at end of file diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/services/CompositionEntityDataManagerTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/services/CompositionEntityDataManagerTest.java new file mode 100644 index 0000000000..e1ddcdc975 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/services/CompositionEntityDataManagerTest.java @@ -0,0 +1,141 @@ +package org.openecomp.sdc.vendorsoftwareproduct.services; + +import org.openecomp.sdc.common.errors.CoreException; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NetworkEntity; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspQuestionnaireEntity; +import org.openecomp.sdc.vendorsoftwareproduct.types.CompositionEntityValidationData; +import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityId; +import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityType; +import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Network; +import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.NetworkCompositionSchemaInput; +import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.SchemaTemplateContext; +import org.openecomp.sdc.versioning.dao.types.Version; +import org.apache.commons.collections.CollectionUtils; +import org.testng.Assert; +import org.testng.annotations.Test; + +import java.util.Collection; +import java.util.Map; + +public class CompositionEntityDataManagerTest { + + public static final String VSP1 = "vsp1"; + public static final String COMPONENT1 = "component1"; + public static final String NIC1 = "nic1"; + private static CompositionEntityDataManager compositionEntityDataManager = + new CompositionEntityDataManager(); + private static Map<CompositionEntityId, Collection<String>> errorsById; + + private static void assertValidationData(CompositionEntityValidationData validationData, + String id, CompositionEntityType type, + boolean hasErrors) { + Assert.assertNotNull(validationData); + Assert.assertEquals(validationData.getEntityId(), id); + Assert.assertEquals(validationData.getEntityType(), type); + Assert.assertTrue(CollectionUtils.isNotEmpty(validationData.getErrors()) == hasErrors); + } + + @Test(expectedExceptions = CoreException.class) + public void testAddNullEntity_negative() { + compositionEntityDataManager.addEntity(null, null); + } + + @Test + public void testAddEntity() { + compositionEntityDataManager + .addEntity(new VspQuestionnaireEntity(VSP1, new Version(0, 1)), null); + + String invalidQuestionnaireData = "{\"a\": \"b\"}"; + + ComponentEntity component = new ComponentEntity(VSP1, new Version(0, 1), COMPONENT1); + component.setQuestionnaireData(invalidQuestionnaireData); + compositionEntityDataManager.addEntity(component, null); + + org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity + nic = new org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity(VSP1, new Version(0, 1), COMPONENT1, NIC1); + nic.setQuestionnaireData(invalidQuestionnaireData); + compositionEntityDataManager.addEntity(nic, null); + } + + @Test(dependsOnMethods = "testAddEntity") + public void testValidateEntitiesQuestionnaire() { + errorsById = compositionEntityDataManager.validateEntitiesQuestionnaire(); + Assert.assertNotNull(errorsById); + Assert.assertEquals(errorsById.size(), 2); // both component and nic data don't mach schemas + CompositionEntityId nicId = + new org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity(VSP1, new Version(0, 1), COMPONENT1, NIC1).getCompositionEntityId(); + Assert.assertTrue(errorsById.containsKey(nicId)); + Assert.assertTrue(errorsById.containsKey(nicId.getParentId())); + } + + @Test(dependsOnMethods = "testAddEntity") + public void testBuildTrees() { + compositionEntityDataManager.buildTrees(); + } + + @Test(dependsOnMethods = "testBuildTrees") + public void testAddErrorsToTrees() { + compositionEntityDataManager.addErrorsToTrees(errorsById); + } + + @Test(dependsOnMethods = "testAddErrorsToTrees") + public void testGetTrees() { + Collection<CompositionEntityValidationData> trees = compositionEntityDataManager.getTrees(); + Assert.assertNotNull(trees); + Assert.assertEquals(trees.size(), 1); + + CompositionEntityValidationData vspValidationData = trees.iterator().next(); + assertValidationData(vspValidationData, VSP1, CompositionEntityType.vsp, false); + Assert.assertEquals(vspValidationData.getSubEntitiesValidationData().size(), 1); + + CompositionEntityValidationData componentValidationData = + vspValidationData.getSubEntitiesValidationData().iterator().next(); + assertValidationData(componentValidationData, COMPONENT1, CompositionEntityType.component, + true); + Assert.assertEquals(componentValidationData.getSubEntitiesValidationData().size(), 1); + + CompositionEntityValidationData nicValidationData = + componentValidationData.getSubEntitiesValidationData().iterator().next(); + assertValidationData(nicValidationData, NIC1, CompositionEntityType.nic, true); + Assert.assertNull(nicValidationData.getSubEntitiesValidationData()); + } + + @Test + public void testValidateValidEntity() { + NetworkEntity networkEntity = new NetworkEntity(VSP1, new Version(0, 1), "network1"); + Network network = new Network(); + network.setName("network1 name"); + network.setDhcp(true); + networkEntity.setNetworkCompositionData(network); + + NetworkCompositionSchemaInput schemaTemplateInput = new NetworkCompositionSchemaInput(); + schemaTemplateInput.setManual(false); + schemaTemplateInput.setNetwork(network); + + CompositionEntityValidationData validationData = CompositionEntityDataManager + .validateEntity(networkEntity, SchemaTemplateContext.composition, schemaTemplateInput); + assertValidationData(validationData, "network1", CompositionEntityType.network, false); + } + + @Test + public void testValidateInvalidEntity() { + NetworkEntity networkEntity = new NetworkEntity(VSP1, new Version(0, 1), "network1"); + Network network = new Network(); + network.setName("network1 name changed"); + network.setDhcp(false); + networkEntity.setNetworkCompositionData(network); + + NetworkCompositionSchemaInput schemaTemplateInput = new NetworkCompositionSchemaInput(); + schemaTemplateInput.setManual(false); + Network origNetwork = new Network(); + origNetwork.setName("network1 name"); + origNetwork.setDhcp(true); + schemaTemplateInput.setNetwork(origNetwork); + + CompositionEntityValidationData validationData = CompositionEntityDataManager + .validateEntity(networkEntity, SchemaTemplateContext.composition, schemaTemplateInput); + assertValidationData(validationData, "network1", CompositionEntityType.network, true); + Assert.assertEquals(validationData.getErrors().size(), 2); + } +}
\ No newline at end of file diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/services/QuestionnaireSchemaTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/services/QuestionnaireSchemaTest.java new file mode 100644 index 0000000000..4d03b5980f --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/services/QuestionnaireSchemaTest.java @@ -0,0 +1,64 @@ +package org.openecomp.sdc.vendorsoftwareproduct.services; + +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspQuestionnaireEntity; +import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityId; +import org.openecomp.sdc.versioning.dao.types.Version; +import org.openecomp.core.utilities.file.FileUtils; + +import org.testng.Assert; +import org.testng.annotations.Test; + +import java.util.Collection; +import java.util.List; +import java.util.Map; + +public class QuestionnaireSchemaTest { + + public static final String VSP1 = "vsp1"; + public static final String COMPONENT1 = "component1"; + public static final String NIC1 = "nic1"; + private static CompositionEntityDataManager compositionEntityDataManager = + new CompositionEntityDataManager(); + private static Map<CompositionEntityId, Collection<String>> errorsById; + private static org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity componentEntity; + private static org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity nicEntity; + + private static String loadFileToString(String path) { + return new String(FileUtils.toByteArray(FileUtils.loadFileToInputStream(path))); + } + + @Test + public void testAddEntity() { + compositionEntityDataManager + .addEntity(new VspQuestionnaireEntity(VSP1, new Version(0, 1)), null); + + componentEntity = new org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity(VSP1, new Version(0, 1), COMPONENT1); + nicEntity = new org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity(VSP1, new Version(0, 1), COMPONENT1, NIC1); + compositionEntityDataManager.addEntity(componentEntity, null); + + componentEntity.setQuestionnaireData(loadFileToString("quesionnaire/validComponent.json")); + nicEntity.setQuestionnaireData(loadFileToString("quesionnaire/validNic.json")); + compositionEntityDataManager.addEntity(nicEntity, null); + } + + @Test(dependsOnMethods = "testAddEntity") + public void testNicAndComponentValidQuestionnaire() { + errorsById = compositionEntityDataManager.validateEntitiesQuestionnaire(); + Assert.assertEquals(errorsById.size(), 0); + } + + @Test(dependsOnMethods = "testNicAndComponentValidQuestionnaire") + public void testComponentInvalidQuestionnaire() { + componentEntity.setQuestionnaireData(loadFileToString("quesionnaire/invalidComponent.json")); + compositionEntityDataManager.addEntity(componentEntity, null); + + errorsById = compositionEntityDataManager.validateEntitiesQuestionnaire(); + Assert.assertEquals(errorsById.size(), 1); + + CompositionEntityId component = errorsById.keySet().iterator().next(); + List<String> errors = (List<String>) errorsById.get(component); + Assert.assertEquals(errors.size(), 1); + Assert.assertEquals(errors.get(0), + "#/general/recovery/pointObjective: 20.0 is not lower or equal to 15"); + } +} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/services/QuestionnaireValidatorTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/services/QuestionnaireValidatorTest.java new file mode 100644 index 0000000000..0dedacb34a --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/services/QuestionnaireValidatorTest.java @@ -0,0 +1,74 @@ +package org.openecomp.sdc.vendorsoftwareproduct.services; + +public class QuestionnaireValidatorTest { +/* + public static QuestionnaireValidator validator = new QuestionnaireValidator(); + + @Test(expectedExceptions = CoreException.class) + public void testAddSubEntityBeforeRoot_negative() { + validator.addSubEntity(createComponent("componentId2"), CompositionEntityType.vsp); + } + + @Test(dependsOnMethods = "testAddSubEntityBeforeRoot_negative") + public void testAddRootEntity() { + validator.addRootEntity(createVspQuestionnaireEntity()); + } + + @Test(dependsOnMethods = "testAddRootEntity", expectedExceptions = CoreException.class) + public void testAddRootEntityWhenAlreadyExist_negative() { + validator.addRootEntity(createVspQuestionnaireEntity()); + } + + @Test(dependsOnMethods = "testAddRootEntity") + public void testAddSubEntity() { + validator.addSubEntity(createComponent("componentId1"), CompositionEntityType.vsp); + } + + @Test(dependsOnMethods = "testAddRootEntity", expectedExceptions = CoreException.class) + public void testAddSubEntityWithNonExistingParentType() { + validator.addSubEntity(new ComponentEntity("vspId1", new Version(0, 1), "componentId2"), CompositionEntityType.nic); + } + + @Test(dependsOnMethods = "testAddSubEntity") + public void testAddSubEntities() throws Exception { + Collection<CompositionEntity> nics = new ArrayList<>(); + nics.add(createNic("nicId1", "componentId1")); + nics.add(createNic("nicId2", "componentId1")); + nics.add(createNic("nicId3", "componentId1")); + + validator.addSubEntities(nics, CompositionEntityType.component); + } + + + @Test(dependsOnMethods = "testAddSubEntities") + public void testValidate() throws Exception { + QuestionnaireValidationResult validationResult = validator.validate(); + Assert.assertTrue(validationResult.isValid()); + } + + private static VspQuestionnaireEntity createVspQuestionnaireEntity() { + VspQuestionnaireEntity vspQuestionnaireEntity = new VspQuestionnaireEntity(); + vspQuestionnaireEntity.setId("vspId1"); + vspQuestionnaireEntity.setVersion(new Version(0, 1)); + vspQuestionnaireEntity.setQuestionnaireData("{\n" + + " \"name\": \"bla bla\"\n" + + "}"); + return vspQuestionnaireEntity; + } + + private static ComponentEntity createComponent(String componentId) { + ComponentEntity component = new ComponentEntity("vspId1", new Version(0, 1), componentId); + component.setQuestionnaireData("{\n" + + " \"name\": \"bla bla\"\n" + + "}"); + return component; + } + + private static CompositionEntity createNic(String nicId, String componentId) { + NicEntity nic = new NicEntity("vspId1", new Version(0, 1), componentId, nicId); + nic.setQuestionnaireData("{\n" + + " \"name\": \"bla bla\"\n" + + "}"); + return nic; + }*/ +}
\ No newline at end of file diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/services/SchemaGeneratorTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/services/SchemaGeneratorTest.java new file mode 100644 index 0000000000..fd293c66dd --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/services/SchemaGeneratorTest.java @@ -0,0 +1,244 @@ +package org.openecomp.sdc.vendorsoftwareproduct.services; + +import org.openecomp.core.utilities.json.JsonUtil; +import org.everit.json.schema.EmptySchema; +import org.everit.json.schema.loader.SchemaLoader; +import org.json.JSONObject; +import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComponentData; +import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityType; +import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Network; +import org.openecomp.sdc.vendorsoftwareproduct.types.composition.NetworkType; +import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Nic; +import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.ComponentCompositionSchemaInput; +import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.ComponentQuestionnaireSchemaInput; +import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.NetworkCompositionSchemaInput; +import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.NicCompositionSchemaInput; +import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.SchemaTemplateContext; +import org.testng.Assert; +import org.testng.annotations.Test; + +import java.util.Arrays; +import java.util.Map; + +public class SchemaGeneratorTest { + + private static int getMinOfVmMax(JSONObject schemaJson) { + return schemaJson.getJSONObject("properties").getJSONObject("compute") + .getJSONObject("properties").getJSONObject("numOfVMs").getJSONObject("properties") + .getJSONObject("maximum").getInt("minimum"); + } + + private static JSONObject validateSchema(String schema) { + System.out.println(schema); + Assert.assertNotNull(schema); + Assert.assertTrue(JsonUtil.isValidJson(schema)); + JSONObject schemaJson = new JSONObject(schema); + Assert.assertFalse(SchemaLoader.load(schemaJson) instanceof EmptySchema); + return schemaJson; + } + + @Test + public void testGenerateVspQuestionnaire() { + String schema = SchemaGenerator + .generate(SchemaTemplateContext.questionnaire, CompositionEntityType.vsp, null); + validateSchema(schema); + } + + @Test + public void testGenerateNetworkCompositionUpload() { + Network network = new Network(); + network.setName("upload network1 name"); + network.setDhcp(true); + + NetworkCompositionSchemaInput input = new NetworkCompositionSchemaInput(); + input.setManual(false); + input.setNetwork(network); + + String schema = SchemaGenerator + .generate(SchemaTemplateContext.composition, CompositionEntityType.network, input); + validateSchema(schema); + } + + @Test + public void testGenerateNetworkCompositionManual() { + NetworkCompositionSchemaInput input = new NetworkCompositionSchemaInput(); + input.setManual(true); + + String schema = SchemaGenerator + .generate(SchemaTemplateContext.composition, CompositionEntityType.network, input); + + validateSchema(schema); + } + + @Test + public void testGenerateComponentQuestionnaireWithoutInput() { + String schema = SchemaGenerator + .generate(SchemaTemplateContext.questionnaire, CompositionEntityType.component, null); + validateSchema(schema); + } + + @Test + public void testGenerateComponentQuestionnaireWithMissingInput() { + ComponentQuestionnaireSchemaInput input = + new ComponentQuestionnaireSchemaInput(Arrays.asList("nic1", "nic2"), + JsonUtil.json2Object("{\n" + + " \"compute\": {\n" + + " \"numOfVMs\": {\n" + + " \"blabla\": 70\n" + // no minimum + " }\n" + + " }\n" + + "}", Map.class)); + String schema = SchemaGenerator + .generate(SchemaTemplateContext.questionnaire, CompositionEntityType.component, input); + JSONObject schemaJson = validateSchema(schema); + //Assert.assertEquals(getMinOfVmMax(schemaJson), 0); + } + + @Test + public void testGenerateComponentQuestionnaireWithInvalidTypeInput() { + ComponentQuestionnaireSchemaInput input = + new ComponentQuestionnaireSchemaInput(Arrays.asList("nic1", "nic2"), + JsonUtil.json2Object("{\n" + + " \"compute\": {\n" + + " \"numOfVMs\": {\n" + + " \"minimum\": \"some string instead of integer\"\n" + + // invalid minimum - string + " }\n" + + " }\n" + + "}", Map.class)); + String schema = SchemaGenerator + .generate(SchemaTemplateContext.questionnaire, CompositionEntityType.component, input); + JSONObject schemaJson = validateSchema(schema); + Assert.assertEquals(getMinOfVmMax(schemaJson), 0); + } + + @Test + public void testGenerateComponentQuestionnaireWithInvalidRangeInput() { + ComponentQuestionnaireSchemaInput input = + new ComponentQuestionnaireSchemaInput(Arrays.asList("nic1", "nic2"), + JsonUtil.json2Object("{\n" + + " \"compute\": {\n" + + " \"numOfVMs\": {\n" + + " \"minimum\": 150\n" + // invalid minimum - integer out of range (0-100) + " }\n" + + " }\n" + + "}", Map.class)); + String schema = SchemaGenerator + .generate(SchemaTemplateContext.questionnaire, CompositionEntityType.component, input); + JSONObject schemaJson = validateSchema(schema); + Assert.assertEquals(getMinOfVmMax(schemaJson), 0); + } + + @Test + public void testGenerateComponentQuestionnaireWithValidInput() { + ComponentQuestionnaireSchemaInput input = + new ComponentQuestionnaireSchemaInput(Arrays.asList("nic1", "nic2"), + JsonUtil.json2Object("{\n" + + " \"compute\": {\n" + + " \"numOfVMs\": {\n" + + " \"minimum\": 30\n" + // valid minimum - integer at the correct range (0-100) + " }\n" + + " }\n" + + "}", Map.class)); + String schema = SchemaGenerator + .generate(SchemaTemplateContext.questionnaire, CompositionEntityType.component, input); + JSONObject schemaJson = validateSchema(schema); + Assert.assertEquals(getMinOfVmMax(schemaJson), 30); + } + + @Test + public void testGenerateNicQuestionnaire() { + String schema = SchemaGenerator + .generate(SchemaTemplateContext.questionnaire, CompositionEntityType.nic, null); + validateSchema(schema); + } + + @Test + public void testGenerateComponentCompositionUpload() { + ComponentData component = new ComponentData(); + component.setName("upload comp1 name"); + component.setDescription("upload comp1 desc"); + + ComponentCompositionSchemaInput input = new ComponentCompositionSchemaInput(); + input.setManual(false); + input.setComponent(component); + + String schema = SchemaGenerator + .generate(SchemaTemplateContext.composition, CompositionEntityType.component, input); + validateSchema(schema); + } + + @Test + public void testGenerateComponentCompositionManual() { + ComponentCompositionSchemaInput input = new ComponentCompositionSchemaInput(); + input.setManual(true); + + String schema = SchemaGenerator + .generate(SchemaTemplateContext.composition, CompositionEntityType.component, input); + validateSchema(schema); + } + + @Test + public void testGenerateNicCompositionUpload() { + Nic nic = new Nic(); + nic.setName("upload nic1 name"); + nic.setDescription("upload nic1 desc"); + nic.setNetworkId("upload nic1 networkId"); + //nic.setNetworkName("upload nic1 networkName"); + nic.setNetworkType(NetworkType.External); + + NicCompositionSchemaInput input = new NicCompositionSchemaInput(); + input.setManual(false); + input.setNic(nic); + + String schema = SchemaGenerator + .generate(SchemaTemplateContext.composition, CompositionEntityType.nic, input); + validateSchema(schema); + } + + +// @Test +// public void testGenerateNicCompositionManualWithoutNetworkId() { +// Nic nic = new Nic(); +// nic.setName("upload nic1 name"); +// nic.setDescription("upload nic1 desc"); +// //nic.setNetworkName("upload nic1 networkName"); +// nic.setNetworkType(NetworkType.External); +// +// NicCompositionSchemaInput input = new NicCompositionSchemaInput(); +// input.setManual(true); +// input.setNic(nic); +// +// String schema = SchemaGenerator.generate(SchemaTemplateContext.composition, CompositionEntityType.nic, input); +// validateSchema(schema); +// } + + @Test + public void testGenerateNicCompositionUploadWithoutNetworkId() { + Nic nic = new Nic(); + nic.setName("upload nic1 name"); + nic.setDescription("upload nic1 desc"); + //nic.setNetworkName("upload nic1 networkName"); + nic.setNetworkType(NetworkType.External); + + NicCompositionSchemaInput input = new NicCompositionSchemaInput(); + input.setManual(false); + input.setNic(nic); + + String schema = SchemaGenerator + .generate(SchemaTemplateContext.composition, CompositionEntityType.nic, input); + validateSchema(schema); + } + + @Test + public void testGenerateNicCompositionManual() { + NicCompositionSchemaInput input = new NicCompositionSchemaInput(); + input.setManual(true); + input.setNetworkIds( + Arrays.asList("manual networkId1", "manual networkId2", "manual networkId3")); + + String schema = SchemaGenerator + .generate(SchemaTemplateContext.composition, CompositionEntityType.nic, input); + validateSchema(schema); + } +} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/tree/HeatTreeManagerTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/tree/HeatTreeManagerTest.java new file mode 100644 index 0000000000..c926977c7b --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/tree/HeatTreeManagerTest.java @@ -0,0 +1,102 @@ +package org.openecomp.sdc.vendorsoftwareproduct.tree; + +import org.openecomp.sdc.datatypes.error.ErrorMessage; +import org.openecomp.sdc.heat.datatypes.structure.HeatStructureTree; +import org.openecomp.sdc.heat.services.tree.HeatTreeManager; +import org.junit.Assert; +import org.junit.Test; + +import java.io.IOException; +import java.util.*; + + +public class HeatTreeManagerTest extends TreeBaseTest { + + @Test + public void testHeatTreeManager() { + + INPUT_DIR = "/tree/valid_tree/input/"; + HeatTreeManager heatTreeManager = initHeatTreeManager(); + heatTreeManager.createTree(); + Map<String, List<ErrorMessage>> errorMap = new HashMap<>(); + + List<ErrorMessage> errorList = new ArrayList<>(); + errorList.add(new ErrorMessage(org.openecomp.sdc.datatypes.error.ErrorLevel.ERROR, "Missing Artifact")); + errorMap.put("missing-artifact", errorList); + errorList = new ArrayList<>(); + errorList.add(new ErrorMessage(org.openecomp.sdc.datatypes.error.ErrorLevel.WARNING, "Missing Nested File")); + errorMap.put("missingNested.yaml", errorList); + heatTreeManager.addErrors(errorMap); + HeatStructureTree tree = heatTreeManager.getTree(); + Assert.assertNotNull(tree); + } + + @Test + public void testHeatTreeManagerMissingManifest() { + + INPUT_DIR = "/tree/missing_manifest/input/"; + HeatTreeManager heatTreeManager = initHeatTreeManager(); + heatTreeManager.createTree(); + Map<String, List<ErrorMessage>> errorMap = new HashMap<>(); + + List<ErrorMessage> errorList = new ArrayList<>(); + errorList.add(new ErrorMessage(org.openecomp.sdc.datatypes.error.ErrorLevel.ERROR, "Missing Artifact")); + errorMap.put("missing-artifact", errorList); + errorList = new ArrayList<>(); + errorList.add(new ErrorMessage(org.openecomp.sdc.datatypes.error.ErrorLevel.WARNING, "Missing Nested File")); + errorMap.put("missingNested.yaml", errorList); + heatTreeManager.addErrors(errorMap); + HeatStructureTree tree = heatTreeManager.getTree(); + Assert.assertNotNull(tree); + Assert.assertEquals(tree.getHEAT(), null); + + } + + + @Test + public void testResourceGroupShowsAsNestedFileInTree() throws IOException { + INPUT_DIR = "/tree/nested_resource_group"; + HeatTreeManager heatTreeManager = initHeatTreeManager(); + heatTreeManager.createTree(); + HeatStructureTree tree = heatTreeManager.getTree(); + + Set<HeatStructureTree> heat = tree.getHEAT(); + Assert.assertNotNull(heat); + + HeatStructureTree addOnHeatSubTree = + HeatStructureTree.getHeatStructureTreeByName(heat, "addOn.yml"); + Assert.assertNotNull(addOnHeatSubTree); + + Set<HeatStructureTree> addOnNestedFiles = addOnHeatSubTree.getNested(); + Assert.assertNotNull(addOnNestedFiles); + + HeatStructureTree nestedFile = + HeatStructureTree.getHeatStructureTreeByName(addOnNestedFiles, "nested.yml"); + Assert.assertNotNull(nestedFile); + } + + + @Test + public void testVolumeNestedFileIsNotUnderVolumeSubTree() { + INPUT_DIR = "/tree/nested_volume"; + HeatTreeManager heatTreeManager = initHeatTreeManager(); + heatTreeManager.createTree(); + HeatStructureTree tree = heatTreeManager.getTree(); + + Set<HeatStructureTree> heat = tree.getHEAT(); + Set<HeatStructureTree> volume = tree.getVolume(); + Assert.assertNotNull(heat); + Assert.assertNull(volume); + + HeatStructureTree baseMobtSubTree = + HeatStructureTree.getHeatStructureTreeByName(heat, "base_mobt.yaml"); + Assert.assertNotNull(baseMobtSubTree); + + Set<HeatStructureTree> baseMobtNestedFiles = baseMobtSubTree.getNested(); + Assert.assertNotNull(baseMobtNestedFiles); + + HeatStructureTree nestedVolumeFile = HeatStructureTree + .getHeatStructureTreeByName(baseMobtNestedFiles, "hot_mobt_volume_attach_nested.yaml"); + Assert.assertNotNull(nestedVolumeFile); + } +} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/tree/TreeBaseTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/tree/TreeBaseTest.java new file mode 100644 index 0000000000..df6cf54058 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/tree/TreeBaseTest.java @@ -0,0 +1,33 @@ +package org.openecomp.sdc.vendorsoftwareproduct.tree; + +import org.openecomp.sdc.heat.services.tree.HeatTreeManager; +import org.openecomp.core.utilities.file.FileUtils; + +import java.io.File; +import java.net.URISyntaxException; +import java.net.URL; + +public class TreeBaseTest { + + String INPUT_DIR; + + + HeatTreeManager initHeatTreeManager() { + HeatTreeManager heatTreeManager = new HeatTreeManager(); + + URL url = TreeBaseTest.class.getResource(INPUT_DIR); + + File inputDir = null; + try { + inputDir = new File(url.toURI()); + } catch (URISyntaxException e) { + e.printStackTrace(); + } + File[] files = inputDir.listFiles(); + for (File inputFile : files) { + heatTreeManager.addFile(inputFile.getName(), FileUtils.loadFileToInputStream( + INPUT_DIR.replace("/", File.separator) + File.separator + inputFile.getName())); + } + return heatTreeManager; + } +} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/tree/UploadFileTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/tree/UploadFileTest.java new file mode 100644 index 0000000000..ee31ba4d70 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/tree/UploadFileTest.java @@ -0,0 +1,90 @@ +package org.openecomp.sdc.vendorsoftwareproduct.tree; + +import org.openecomp.sdc.vendorlicense.facade.VendorLicenseFacade; +import org.openecomp.sdc.vendorlicense.facade.VendorLicenseFacadeFactory; +import org.openecomp.sdc.vendorsoftwareproduct.VSPCommon; +import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductManager; +import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDao; +import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDaoFactory; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.UploadDataEntity; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails; +import org.openecomp.sdc.vendorsoftwareproduct.impl.VendorSoftwareProductManagerImpl; +import org.openecomp.sdc.versioning.dao.types.Version; +import org.junit.BeforeClass; +import org.junit.Test; + +import java.io.*; +import java.net.URL; +import java.util.zip.ZipOutputStream; + +public class UploadFileTest { + + + public static final Version VERSION01 = new Version(0, 1); + private static final String USER1 = "vspTestUser1"; + public static String id001 = null; + public static String id002 = null; + public static Version activeVersion002 = null; + private static VendorSoftwareProductManager vendorSoftwareProductManager = + new VendorSoftwareProductManagerImpl(); + private static VendorSoftwareProductDao vendorSoftwareProductDao = + VendorSoftwareProductDaoFactory.getInstance().createInterface(); + private static VendorLicenseFacade vendorLicenseFacade = + VendorLicenseFacadeFactory.getInstance().createInterface(); + private static String vlm1Id; + + @BeforeClass + static public void init() { + + //testCreateVSP + vlm1Id = vendorLicenseFacade.createVendorLicenseModel( + VSPCommon.createVendorLicenseModel("vlmName", "vlm1Id desc", "icon1"), USER1).getId(); + VspDetails expectedVsp = VSPCommon + .createVspDetails(null, null, "VSP1", "Test-vsp", "vendorName", vlm1Id, "icon", "category", + "subCategory", "123", null); + + VspDetails createdVsp = vendorSoftwareProductManager.createNewVsp(expectedVsp, USER1); + id001 = createdVsp.getId(); + + VspDetails actualVsp = + vendorSoftwareProductDao.getVendorSoftwareProductInfo(new VspDetails(id001, VERSION01)); + expectedVsp.setId(id001); + expectedVsp.setVersion(VERSION01); + + + } + + @Test + public void testUploadFile() { + //vspActiveVersion = vendorSoftwareProductManager.checkout(id001, USER1); + vendorSoftwareProductManager.uploadFile(id001, getZipInputStream("/legalUpload"), USER1); + //testLegalUpload(id001, vspActiveVersion, getZipInputStream("/legalUpload"), USER1); + } + + + private void testLegalUpload(String vspId, Version version, InputStream upload, String user) { + vendorSoftwareProductManager.uploadFile(vspId, upload, user); + + UploadDataEntity uploadData = + vendorSoftwareProductDao.getUploadData(new UploadDataEntity(vspId, version)); + + } + + public InputStream getZipInputStream(String name) { + URL url = this.getClass().getResource(name); + File templateDir = new File(url.getFile()); + + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + ZipOutputStream zos = new ZipOutputStream(baos); + + VSPCommon.zipDir(templateDir, "", zos, true); + try { + zos.close(); + } catch (IOException e) { + e.printStackTrace(); + } + return new ByteArrayInputStream(baos.toByteArray()); + } + + +} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/upload/HeatCleanup/HeatCleanupOnNewUploadTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/upload/HeatCleanup/HeatCleanupOnNewUploadTest.java new file mode 100644 index 0000000000..f1bf5682e0 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/upload/HeatCleanup/HeatCleanupOnNewUploadTest.java @@ -0,0 +1,167 @@ +package org.openecomp.sdc.vendorsoftwareproduct.upload.HeatCleanup; + +import org.openecomp.sdc.datatypes.error.ErrorLevel; +import org.openecomp.sdc.vendorsoftwareproduct.VSPCommon; +import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants; +import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductManager; +import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDao; +import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDaoFactory; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.UploadDataEntity; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails; +import org.openecomp.sdc.vendorsoftwareproduct.impl.VendorSoftwareProductManagerImpl; +import org.openecomp.sdc.vendorsoftwareproduct.types.UploadFileResponse; +import org.openecomp.sdc.vendorsoftwareproduct.types.UploadFileStatus; +import org.openecomp.sdc.versioning.dao.types.Version; +import org.openecomp.core.model.dao.ServiceModelDao; +import org.openecomp.core.model.dao.ServiceModelDaoFactory; +import org.openecomp.core.util.UniqueValueUtil; +import org.openecomp.core.validation.types.MessageContainerUtil; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.collections4.MapUtils; +import org.testng.Assert; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; + +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; +import java.util.List; + +public class HeatCleanupOnNewUploadTest { + private static final String USER1 = "vspTestUser1"; + + private static final VendorSoftwareProductManager vendorSoftwareProductManager = + new VendorSoftwareProductManagerImpl(); + private static final VendorSoftwareProductDao vendorSoftwareProductDao = + VendorSoftwareProductDaoFactory.getInstance().createInterface(); + private static final ServiceModelDao serviceModelDao = + ServiceModelDaoFactory.getInstance().createInterface(); + + private static String vspId = null; + private static Version vspActiveVersion = null; + + private static void validateUploadContentExistence(boolean exist) { + UploadDataEntity uploadDataEntity = + vendorSoftwareProductDao.getUploadData(new UploadDataEntity(vspId, vspActiveVersion)); + Assert.assertTrue((uploadDataEntity.getContentData() != null) == exist); + Assert.assertTrue((uploadDataEntity.getValidationData() != null) == exist); + Assert.assertTrue((uploadDataEntity.getPackageName() != null) == exist); + Assert.assertTrue((uploadDataEntity.getPackageVersion() != null) == exist); + Assert.assertTrue((serviceModelDao.getServiceModel(vspId, vspActiveVersion) != null) == exist); + } + + private static void validateCompositionDataExistence(boolean exist) { + Assert.assertTrue(CollectionUtils + .isNotEmpty(vendorSoftwareProductDao.listNetworks(vspId, vspActiveVersion)) == exist); + Assert.assertTrue(CollectionUtils + .isNotEmpty(vendorSoftwareProductDao.listComponents(vspId, vspActiveVersion)) == exist); + Assert.assertTrue(CollectionUtils + .isNotEmpty(vendorSoftwareProductDao.listNicsByVsp(vspId, vspActiveVersion)) == exist); + } + + private static InputStream getFileInputStream(String fileName) { + URL url = HeatCleanupOnNewUploadTest.class.getResource(fileName); + try { + return url.openStream(); + } catch (IOException e) { + e.printStackTrace(); + return null; + } + } + + @BeforeClass + private void init() { + UniqueValueUtil + .deleteUniqueValue(VendorSoftwareProductConstants.UniqueValues.VENDOR_SOFTWARE_PRODUCT_NAME, + "VSPTestEmpty"); + + VspDetails vspDetails = vendorSoftwareProductManager.createNewVsp(VSPCommon + .createVspDetails(null, null, "VSPTestEmpty", "Test-vsp-empty", "vendorName", "vlm1Id", + "icon", "category", "subCategory", "123", null), USER1); + vspId = vspDetails.getId(); + vspActiveVersion = vspDetails.getVersion(); + } + + @Test + public void testUploadWithComposition() { + InputStream zis = getFileInputStream("/vspmanager/zips/fullComposition.zip"); + + UploadFileResponse uploadFileResponse = + vendorSoftwareProductManager.uploadFile(vspId, zis, USER1); + + Assert.assertEquals(uploadFileResponse.getStatus(), UploadFileStatus.Success); + Assert.assertTrue(MapUtils.isEmpty( + MessageContainerUtil.getMessageByLevel(ErrorLevel.ERROR, uploadFileResponse.getErrors()))); + + validateUploadContentExistence(true); + validateCompositionDataExistence(true); + } + + @Test(dependsOnMethods = {"testUploadWithComposition"}) + public void testProccesesMIBsDeletionAfterNewUpload() { + InputStream zis1 = getFileInputStream("/vspmanager/zips/fullComposition.zip"); + InputStream zis2 = getFileInputStream("/vspmanager/zips/fullComposition.zip"); + InputStream mib = getFileInputStream("/vspmanager/zips/vDNS.zip"); + + vendorSoftwareProductManager.uploadFile(vspId, zis1, USER1); + List<ComponentEntity> components = + (List<ComponentEntity>) vendorSoftwareProductDao.listComponents(vspId, vspActiveVersion); + String componentId = components.get(0).getId(); + + vendorSoftwareProductManager + .uploadComponentMib(mib, "vDNS.zip", vspId, componentId, true, USER1); + vendorSoftwareProductManager + .createProcess(new org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity(vspId, vspActiveVersion, componentId, null), USER1); + + vendorSoftwareProductManager.uploadFile(vspId, zis2, USER1); + Assert.assertTrue( + vendorSoftwareProductManager.listMibFilenames(vspId, componentId, USER1).getSnmpTrap() == + null); + Assert.assertTrue(CollectionUtils + .isEmpty(vendorSoftwareProductDao.listProcesses(vspId, vspActiveVersion, componentId))); + } + + @Test(dependsOnMethods = {"testProccesesMIBsDeletionAfterNewUpload"}) + public void testInvalidStructureUploadAfterFullComposition() { + InputStream zis = getFileInputStream("/vspmanager/zips/withoutManifest.zip"); + + UploadFileResponse uploadFileResponse = + vendorSoftwareProductManager.uploadFile(vspId, zis, USER1); + Assert.assertEquals(uploadFileResponse.getStatus(), UploadFileStatus.Failure); + Assert.assertTrue(MapUtils.isNotEmpty( + MessageContainerUtil.getMessageByLevel(ErrorLevel.ERROR, uploadFileResponse.getErrors()))); + + validateUploadContentExistence(true); + validateCompositionDataExistence(true); + } + + @Test(dependsOnMethods = {"testInvalidStructureUploadAfterFullComposition"}) + public void testInvalidUploadAfterFullComposition() { + InputStream zis = getFileInputStream("/vspmanager/zips/missingYml.zip"); + + UploadFileResponse uploadFileResponse = + vendorSoftwareProductManager.uploadFile(vspId, zis, USER1); + Assert.assertEquals(uploadFileResponse.getStatus(), UploadFileStatus.Success); + Assert.assertTrue(MapUtils.isNotEmpty( + MessageContainerUtil.getMessageByLevel(ErrorLevel.ERROR, uploadFileResponse.getErrors()))); + + validateUploadContentExistence(true); + validateCompositionDataExistence(false); + } + + @Test(dependsOnMethods = {"testInvalidUploadAfterFullComposition"}) + public void testEmptyCompositionUploadAfterFullComposition() throws IOException { + testUploadWithComposition(); + + InputStream zis = getFileInputStream("/vspmanager/zips/emptyComposition.zip"); + UploadFileResponse uploadFileResponse = + vendorSoftwareProductManager.uploadFile(vspId, zis, USER1); + Assert.assertEquals(uploadFileResponse.getStatus(), UploadFileStatus.Success); + Assert.assertTrue(MapUtils.isEmpty( + MessageContainerUtil.getMessageByLevel(ErrorLevel.ERROR, uploadFileResponse.getErrors()))); + + validateUploadContentExistence(true); + validateCompositionDataExistence(false); + } +} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/upload/validation/UploadFileValidationTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/upload/validation/UploadFileValidationTest.java new file mode 100644 index 0000000000..3ec8cb2e40 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/upload/validation/UploadFileValidationTest.java @@ -0,0 +1,199 @@ +package org.openecomp.sdc.vendorsoftwareproduct.upload.validation; + +import org.openecomp.sdc.common.errors.CoreException; +import org.openecomp.sdc.common.utils.AsdcCommon; +import org.openecomp.sdc.datatypes.error.ErrorMessage; + +import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductManager; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails; +import org.openecomp.sdc.vendorsoftwareproduct.impl.VendorSoftwareProductManagerImpl; +import org.openecomp.sdc.vendorsoftwareproduct.types.UploadFileResponse; +import org.openecomp.core.util.UniqueValueUtil; +import org.openecomp.core.utilities.CommonMethods; +import org.openecomp.core.validation.errors.Messages; +import org.openecomp.core.validation.types.MessageContainerUtil; +import org.apache.commons.collections4.MapUtils; +import org.testng.Assert; +import org.testng.annotations.BeforeTest; +import org.testng.annotations.Test; + +import java.io.*; +import java.net.URL; +import java.util.List; +import java.util.Map; + +public class UploadFileValidationTest { + + private static final String USER1 = "UploadFileValidationTest"; + private static final String EMPTY_ZIP_FILE = "/validation/zips/emptyZip.zip"; + private static final String MISSING_MANIFEST_IN_ZIP_FILE = + "/validation/zips/missingManifestInZip.zip"; + private static final String ZIP_FILE_WITH_FOLDER = "/validation/zips/zipFileWithFolder.zip"; + private static VendorSoftwareProductManager vendorSoftwareProductManager = + new VendorSoftwareProductManagerImpl(); + private static String vspId; + + public static org.openecomp.sdc.vendorlicense.dao.types.VendorLicenseModelEntity createVendorLicenseModel(String name, String desc, + String icon) { + org.openecomp.sdc.vendorlicense.dao.types.VendorLicenseModelEntity + vendorLicenseModel = new org.openecomp.sdc.vendorlicense.dao.types.VendorLicenseModelEntity(); + vendorLicenseModel.setVendorName(name); + vendorLicenseModel.setDescription(desc); + vendorLicenseModel.setIconRef(icon); + return vendorLicenseModel; + } + + @BeforeTest + private void init() { + VspDetails vspDetails = new VspDetails(); + vspDetails.setVendorName("vspName_" + CommonMethods.nextUuId()); + vspId = vendorSoftwareProductManager.createNewVsp(vspDetails, USER1).getId(); + + UniqueValueUtil + .deleteUniqueValue(org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants.UniqueValues.VENDOR_SOFTWARE_PRODUCT_NAME, + "VSP_syb_upload_various"); + UniqueValueUtil + .deleteUniqueValue(org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants.UniqueValues.VENDOR_SOFTWARE_PRODUCT_NAME, + "vsp_syb_upload_no_error"); + UniqueValueUtil + .deleteUniqueValue(org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants.UniqueValues.VENDOR_SOFTWARE_PRODUCT_NAME, + "vsp_syb"); + } + + @Test + public void testUploadZipNull() { + UploadFileResponse response = vendorSoftwareProductManager.uploadFile(vspId, null, USER1); + Assert.assertEquals(response.getErrors().size(), 1); + Assert.assertTrue(response.getErrors().containsKey(AsdcCommon.UPLOAD_FILE)); + Assert.assertEquals(response.getErrors().get(AsdcCommon.UPLOAD_FILE).get(0).getMessage(), + Messages.NO_ZIP_FILE_WAS_UPLOADED_OR_ZIP_NOT_EXIST.getErrorMessage()); + } + + @Test(dependsOnMethods = "testUploadZipNull") + public void testUploadEmptyFile() { + UploadFileResponse response = vendorSoftwareProductManager + .uploadFile(vspId, new ByteArrayInputStream("".getBytes()), USER1); + Assert.assertEquals(response.getErrors().size(), 1); + Assert.assertTrue(response.getErrors().containsKey(AsdcCommon.UPLOAD_FILE)); + Assert.assertEquals(response.getErrors().get(AsdcCommon.UPLOAD_FILE).get(0).getMessage(), + Messages.NO_ZIP_FILE_WAS_UPLOADED_OR_ZIP_NOT_EXIST.getErrorMessage()); + } + + @Test(dependsOnMethods = "testUploadEmptyFile") + public void testUploadEmptyZip() { + UploadFileResponse response = + vendorSoftwareProductManager.uploadFile(vspId, getFileInputStream(EMPTY_ZIP_FILE), USER1); + Assert.assertEquals(response.getErrors().size(), 1); + Assert.assertTrue(response.getErrors().containsKey(AsdcCommon.UPLOAD_FILE)); + Assert.assertEquals(response.getErrors().get(AsdcCommon.UPLOAD_FILE).get(0).getMessage(), + Messages.INVALID_ZIP_FILE.getErrorMessage()); + } + + @Test(dependsOnMethods = "testUploadEmptyZip") + public void testUploadMissingManifestInZip() { + UploadFileResponse response = vendorSoftwareProductManager + .uploadFile(vspId, getFileInputStream(MISSING_MANIFEST_IN_ZIP_FILE), USER1); + Assert.assertEquals(response.getErrors().size(), 1); + Assert.assertTrue(response.getErrors().containsKey(AsdcCommon.MANIFEST_NAME)); + Assert.assertEquals(response.getErrors().get(AsdcCommon.MANIFEST_NAME).get(0).getMessage(), + Messages.MANIFEST_NOT_EXIST.getErrorMessage()); + } + + @Test(dependsOnMethods = "testUploadMissingManifestInZip") + public void testUploadZipWithFolder() { + UploadFileResponse response = vendorSoftwareProductManager + .uploadFile(vspId, getFileInputStream(ZIP_FILE_WITH_FOLDER), USER1); + Assert.assertEquals(response.getErrors().size(), 1); + Assert.assertTrue(response.getErrors().containsKey(AsdcCommon.UPLOAD_FILE)); + Assert.assertEquals(response.getErrors().get(AsdcCommon.UPLOAD_FILE).get(0).getMessage(), + Messages.ZIP_SHOULD_NOT_CONTAIN_FOLDERS.getErrorMessage()); + } + + @Test(dependsOnMethods = "testUploadZipWithFolder") + public void testUploadVariousZips() { + + File[] files = getFileList("/validation/zips/various"); + InputStream is; + for (File file : files) { + if (file.isFile()) { + UploadFileResponse response = null; + try { + + is = new FileInputStream(file); + response = vendorSoftwareProductManager.uploadFile(vspId, is, USER1); + + } catch (FileNotFoundException e) { + throw new RuntimeException(e); + } catch (CoreException ce) { + throw new RuntimeException("failed upload:" + file.getName(), ce); + } catch (RuntimeException re) { + + throw new RuntimeException("failed upload:" + file.getName(), re); + } + System.out.println("zip:" + file.getName() + " Errors:" + calculateNumberOfMessages( + MessageContainerUtil.getMessageByLevel(org.openecomp.sdc.datatypes.error.ErrorLevel.ERROR, response.getErrors())) + + " Warnings:" + calculateNumberOfMessages( + MessageContainerUtil.getMessageByLevel(org.openecomp.sdc.datatypes.error.ErrorLevel.WARNING, response.getErrors()))); + } + } + } + + @Test(dependsOnMethods = "testUploadVariousZips") + public void testUploadNoErrorVariousZips() { + + + File[] files = getFileList("/validation/zips/various/noError"); + InputStream is; + for (File file : files) { + if (file.isFile()) { + try { + is = new FileInputStream(file); + UploadFileResponse response = vendorSoftwareProductManager.uploadFile(vspId, is, USER1); + Map<String, List<ErrorMessage>> errors = response.getErrors(); + Assert.assertTrue( + MapUtils.isEmpty(MessageContainerUtil.getMessageByLevel( + org.openecomp.sdc.datatypes.error.ErrorLevel.ERROR, errors))); + + + } catch (FileNotFoundException e) { + throw new RuntimeException(e); + } catch (CoreException ce) { + Assert.fail("failed upload:" + file.getName() + " exception:" + ce.getMessage()); + + } catch (RuntimeException re) { + Assert.fail("failed upload:" + file.getName() + " exception:" + re.getMessage()); + } + } + } + } + + private InputStream getFileInputStream(String fileName) { + URL url = this.getClass().getResource(fileName); + try { + return url.openStream(); + } catch (IOException e) { + e.printStackTrace(); + return null; + } + } + + private File[] getFileList(String dir) { + URL url = UploadFileValidationTest.class.getResource(dir); + + String path = url.getPath(); + File pathFile = new File(path); + return pathFile.listFiles(); + + + } + + private int calculateNumberOfMessages(Map<String, List<ErrorMessage>> messages) { + int sum = 0; + for (List<ErrorMessage> errors : messages.values()) { + sum += errors.size(); + } + return sum; + } + + +} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/emptyComposition/MANIFEST.json b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/emptyComposition/MANIFEST.json new file mode 100644 index 0000000000..af1e3fbbae --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/emptyComposition/MANIFEST.json @@ -0,0 +1,11 @@ +{ + "name": "vEP_JSA_Net", + "description": "Version 2.0 02-09-2016 (Authors: John Doe, user PROD)", + "version": "2013-05-23", + "data": [ + { + "file": "ep-jsa_net.yaml", + "type": "HEAT" + } + ] +}
\ No newline at end of file diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/emptyComposition/ep-jsa_net.yaml b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/emptyComposition/ep-jsa_net.yaml new file mode 100644 index 0000000000..f0773b7611 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/emptyComposition/ep-jsa_net.yaml @@ -0,0 +1,21 @@ +heat_template_version: 2013-05-23 + +description: > + Version 2.0 02-09-2016 (Authors: John Doe, user PROD) + +parameters: + snapshot02: + type: string + description: prop + network_name: + type: string + description: prop + +resources: + + pcrf_server_init: + type: OS::Heat::MultipartMime + properties: + parts: + - config: { get_param: network_name} + - config: { get_param: snapshot02}
\ No newline at end of file diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/extractServiceComposition/componentsWithPort/ComponentsWithPortST.yaml b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/extractServiceComposition/componentsWithPort/ComponentsWithPortST.yaml new file mode 100644 index 0000000000..1446e98d91 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/extractServiceComposition/componentsWithPort/ComponentsWithPortST.yaml @@ -0,0 +1,428 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +metadata: + template_name: Main +imports: + NeutronPortGlobalTypes: + file: NeutronPortGlobalTypesServiceTemplate.yaml + NeutronNetGlobalTypes: + file: NeutronNetGlobalTypesServiceTemplate.yaml + CommonGlobalTypes: + file: CommonGlobalTypesServiceTemplate.yaml + CinderVolumeGlobalTypes: + file: CinderVolumeGlobalTypesServiceTemplate.yaml + ContrailNetworkRuleGlobalType: + file: ContrailNetworkRuleGlobalTypeServiceTemplate.yaml + NeutronSecurityRulesGlobalTypes: + file: NeutronSecurityRulesGlobalTypesServiceTemplate.yaml + NovaServerGlobalTypes: + file: NovaServerGlobalTypesServiceTemplate.yaml + ContrailVirtualNetworkGlobalType: + file: ContrailVirtualNetworkGlobalTypeServiceTemplate.yaml + AbstractSubstituteGlobalTypes: + file: AbstractSubstituteGlobalTypesServiceTemplate.yaml +node_types: + org.openecomp.resource.vfc.nodes.heat.pcrf_psm: + derived_from: org.openecomp.resource.vfc.nodes.heat.nova.Server + org.openecomp.resource.vfc.nodes.heat.pcm: + derived_from: org.openecomp.resource.vfc.nodes.heat.nova.Server +topology_template: + inputs: + Internal2_name: + label: Internal2_name + hidden: false + immutable: false + type: string + description: Internal2_name + Internal1_shared: + label: Internal1_shared + hidden: false + immutable: false + type: string + description: Internal1_shared + FSB1_volume_name: + label: FSB1_volume + hidden: false + immutable: false + type: string + description: FSB1_volume_1 + jsa_cidr: + label: jsa_cidr + hidden: false + immutable: false + type: string + description: jsa_cidr + default: 107.243.7.128/26 + availabilityzone_name: + label: availabilityzone_name + hidden: false + immutable: false + type: string + description: availabilityzone_name + fsb1-name: + label: FSB1_name + hidden: false + immutable: false + type: string + description: FSB1_name + pcm_image_name: + label: pcm_image_name + hidden: false + immutable: false + type: string + description: pcm_image_name + Internal2_external: + label: Internal2_external + hidden: false + immutable: false + type: string + description: Internal2_external + Internal2_forwarding_mode: + label: Internal2_forwarding_mode + hidden: false + immutable: false + type: string + description: Internal2_forwarding_mode + pcrf_psm_flavor_name: + label: pcrf_psm_flavor_name + hidden: false + immutable: false + type: string + description: pcrf_psm_flavor_name + pcrf_psm_image_name: + label: pcrf_psm_image_name + hidden: false + immutable: false + type: string + description: pcrf_psm_image_name + FSB_1_image: + label: MME_FSB1 + hidden: false + immutable: false + type: string + description: MME_FSB1_15B-CP04-r5a01 + volume_size: + label: volume size + hidden: false + immutable: false + type: float + description: my volume size 320GB + fsb1-Internal1-mac: + label: FSB1_internal_mac + hidden: false + immutable: false + type: string + description: FSB1_internal_mac + Internal2_shared: + label: Internal2_shared + hidden: false + immutable: false + type: string + description: Internal2_shared + pcm_server_name: + label: pcm_server_name + hidden: false + immutable: false + type: string + description: pcm_server_name + Internal1_net_name: + label: Internal1_net_name + hidden: false + immutable: false + type: string + description: Internal1_net_name + oam_net_name: + label: oam_net_name + hidden: false + immutable: false + type: string + description: oam_net_name + fsb1-flavor: + label: FSB1_flavor + hidden: false + immutable: false + type: string + description: FSB1_flavor + fsb1-Internal2-mac: + label: FSB1_internal_mac + hidden: false + immutable: false + type: string + description: FSB1_internal_mac + volume_type: + label: volume type + hidden: false + immutable: false + type: string + description: volume type Gold + fsb1-zone: + label: FSB1_zone + hidden: false + immutable: false + type: string + description: FSB1_zone + fsb_zone: + label: FSB1_zone + hidden: false + immutable: false + type: string + description: FSB1_zone + security_group_name: + hidden: false + immutable: false + type: list + description: CMAUI1, CMAUI2 server names + entry_schema: + type: String + jsa_net_name: + label: jsa_net_name + hidden: false + immutable: false + type: string + description: jsa_net_name + default: jsa_log_net_0 + pcrf_psm_server_name: + label: pcrf_psm_server_name + hidden: false + immutable: false + type: string + description: pcrf_psm_server_name + pcm_flavor_name: + label: pcm_flavor_name + hidden: false + immutable: false + type: string + description: pcm_flavor_name + oam_net_id: + label: oam_net_id + hidden: false + immutable: false + type: string + description: oam_net_id + fsb2-Internal1-mac: + label: FSB1_internal_mac + hidden: false + immutable: false + type: string + description: FSB1_internal_mac + Internal1_forwarding_mode: + label: Internal1_forwarding_mode + hidden: false + immutable: false + type: string + description: Internal1_forwarding_mode + pcrf_cps_net_name: + label: pcrf_cps_net_name + hidden: false + immutable: false + type: string + description: pcrf_cps_net_name + cps_net_name: + label: cps_net_name + hidden: false + immutable: false + type: string + description: cps_net_name + pcrf_security_group_name: + hidden: false + immutable: false + type: list + description: CMAUI1, CMAUI2 server names + entry_schema: + type: String + Internal1_external: + label: Internal1_external + hidden: false + immutable: false + type: string + description: Internal1_external + node_templates: + pcm_port_1: + type: org.openecomp.resource.cp.nodes.heat.network.neutron.Port + properties: + security_groups: + - get_input: security_group_name + fixed_ips: + - ip_address: + get_input: oam_net_ip + network: + get_input: oam_net_name + requirements: + - binding: + capability: tosca.capabilities.network.Bindable + node: server_pcm + relationship: tosca.relationships.network.BindsTo + FSB1_Internal2: + type: org.openecomp.resource.cp.nodes.heat.network.neutron.Port + properties: + mac_address: + get_input: fsb1-Internal2-mac + network: Internal2-net + requirements: + - binding: + capability: tosca.capabilities.network.Bindable + node: FSB2 + relationship: tosca.relationships.network.BindsTo + FSB1_Internal1: + type: org.openecomp.resource.cp.nodes.heat.network.neutron.Port + properties: + mac_address: + get_input: fsb1-Internal1-mac + network: Internal1-net + requirements: + - link: + capability: tosca.capabilities.network.Linkable + node: Internal1-net + relationship: tosca.relationships.network.LinksTo + - binding: + capability: tosca.capabilities.network.Bindable + node: FSB1 + relationship: tosca.relationships.network.BindsTo + FSB1_OAM: + type: org.openecomp.resource.cp.nodes.heat.network.neutron.Port + properties: + fixed_ips: + - ip_address: + get_input: fsb1-oam-ip + network: + get_input: oam_net_id + requirements: + - binding: + capability: tosca.capabilities.network.Bindable + node: FSB1 + relationship: tosca.relationships.network.BindsTo + psm01_port_0: + type: org.openecomp.resource.cp.nodes.heat.network.neutron.Port + properties: + security_groups: + - get_input: pcrf_security_group_name + fixed_ips: + - ip_address: + get_input: pcrf_cps_net_ip + network: + get_input: pcrf_cps_net_name + requirements: + - binding: + capability: tosca.capabilities.network.Bindable + node: pcrf_server_psm + relationship: tosca.relationships.network.BindsTo + pcm_port_0: + type: org.openecomp.resource.cp.nodes.heat.network.neutron.Port + properties: + security_groups: + - get_input: security_group_name + fixed_ips: + - ip_address: + get_input: cps_net_ip + network: + get_input: cps_net_name + requirements: + - binding: + capability: tosca.capabilities.network.Bindable + node: server_pcm + relationship: tosca.relationships.network.BindsTo + server_pcm: + type: org.openecomp.resource.vfc.nodes.heat.pcm + properties: + flavor: + get_input: pcm_flavor_name + availability_zone: + get_input: availabilityzone_name + image: + get_input: pcm_image_name + config_drive: 'True' + user_data_format: RAW + name: + get_input: pcm_server_name + user_data: UNSUPPORTED_RESOURCE_server_init + pcrf_server_psm: + type: org.openecomp.resource.vfc.nodes.heat.pcrf_psm + properties: + flavor: + get_input: pcrf_psm_flavor_name + availability_zone: + get_input: availabilityzone_name + image: + get_input: pcrf_psm_image_name + config_drive: 'True' + metadata: + vnf_id: + get_input: pcrf_vnf_id + user_data_format: RAW + name: + get_input: pcrf_psm_server_name + user_data: UNSUPPORTED_RESOURCE_pcrf_server_init + FSB2: + type: org.openecomp.resource.vfc.nodes.heat.nova.Server + properties: + flavor: + get_input: fsb1-flavor + availability_zone: + get_input: fsb_zone + name: + get_input: fsb1-name + FSB1: + type: org.openecomp.resource.vfc.nodes.heat.nova.Server + properties: + flavor: + get_input: fsb1-flavor + availability_zone: + get_input: fsb_zone + metadata: + write_files: + - path: /etc/sysconfig/network-scripts/ifcfg-eth0 + permissions: '0644' + content: + str_replace: + template: + get_artifact: + - SELF + - nimbus-ethernet + params: + $dev: eth0 + $netmask: + get_input: cps_net_mask + $ip: + get_input: cps_net_ip + - path: /etc/sysconfig/network-scripts/ifcfg-eth1 + permissions: '0644' + content: + str_replace: + template: + get_artifact: + - SELF + - nimbus-ethernet-gw + params: + $dev: eth1 + $netmask: + get_input: oam_net_mask + $gateway: + get_input: oam_net_gw + $ip: + get_input: oam_net_ip + name: + get_input: fsb1-name + artifacts: + nimbus-ethernet-gw: + type: tosca.artifacts.Deployment + file: ../Artifacts/nimbus-ethernet-gw + nimbus-ethernet: + type: tosca.artifacts.Deployment + file: ../Artifacts/nimbus-ethernet + groups: + ep-jsa_net: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/ep-jsa_net.yaml + description: | + Version 2.0 02-09-2016 (Authors: John Doe, user PROD) + members: + - pcm_port_1 + - FSB1_Internal2 + - FSB1_Internal1 + - FSB1_OAM + - psm01_port_0 + - pcm_port_0 + - server_pcm + - pcrf_server_psm + - FSB2 + - FSB1
\ No newline at end of file diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/extractServiceComposition/fullComposition/MainServiceTemplate.yaml b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/extractServiceComposition/fullComposition/MainServiceTemplate.yaml new file mode 100644 index 0000000000..62865b3e78 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/extractServiceComposition/fullComposition/MainServiceTemplate.yaml @@ -0,0 +1,473 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +metadata: + template_name: Main +imports: + NeutronPortGlobalTypes: + file: NeutronPortGlobalTypesServiceTemplate.yaml + NeutronNetGlobalTypes: + file: NeutronNetGlobalTypesServiceTemplate.yaml + CommonGlobalTypes: + file: CommonGlobalTypesServiceTemplate.yaml + CinderVolumeGlobalTypes: + file: CinderVolumeGlobalTypesServiceTemplate.yaml + ContrailNetworkRuleGlobalType: + file: ContrailNetworkRuleGlobalTypeServiceTemplate.yaml + NeutronSecurityRulesGlobalTypes: + file: NeutronSecurityRulesGlobalTypesServiceTemplate.yaml + NovaServerGlobalTypes: + file: NovaServerGlobalTypesServiceTemplate.yaml + ContrailVirtualNetworkGlobalType: + file: ContrailVirtualNetworkGlobalTypeServiceTemplate.yaml + AbstractSubstituteGlobalTypes: + file: AbstractSubstituteGlobalTypesServiceTemplate.yaml +node_types: + org.openecomp.resource.vfc.nodes.heat.pcrf_psm: + derived_from: org.openecomp.resource.vfc.nodes.heat.nova.Server + org.openecomp.resource.vfc.nodes.heat.pcm: + derived_from: org.openecomp.resource.vfc.nodes.heat.nova.Server +topology_template: + inputs: + Internal2_name: + label: Internal2_name + hidden: false + immutable: false + type: string + description: Internal2_name + Internal1_shared: + label: Internal1_shared + hidden: false + immutable: false + type: string + description: Internal1_shared + FSB1_volume_name: + label: FSB1_volume + hidden: false + immutable: false + type: string + description: FSB1_volume_1 + jsa_cidr: + label: jsa_cidr + hidden: false + immutable: false + type: string + description: jsa_cidr + default: 107.243.7.128/26 + availabilityzone_name: + label: availabilityzone_name + hidden: false + immutable: false + type: string + description: availabilityzone_name + fsb1-name: + label: FSB1_name + hidden: false + immutable: false + type: string + description: FSB1_name + pcm_image_name: + label: pcm_image_name + hidden: false + immutable: false + type: string + description: pcm_image_name + Internal2_external: + label: Internal2_external + hidden: false + immutable: false + type: string + description: Internal2_external + Internal2_forwarding_mode: + label: Internal2_forwarding_mode + hidden: false + immutable: false + type: string + description: Internal2_forwarding_mode + pcrf_psm_flavor_name: + label: pcrf_psm_flavor_name + hidden: false + immutable: false + type: string + description: pcrf_psm_flavor_name + pcrf_psm_image_name: + label: pcrf_psm_image_name + hidden: false + immutable: false + type: string + description: pcrf_psm_image_name + FSB_1_image: + label: MME_FSB1 + hidden: false + immutable: false + type: string + description: MME_FSB1_15B-CP04-r5a01 + volume_size: + label: volume size + hidden: false + immutable: false + type: float + description: my volume size 320GB + fsb1-Internal1-mac: + label: FSB1_internal_mac + hidden: false + immutable: false + type: string + description: FSB1_internal_mac + Internal2_shared: + label: Internal2_shared + hidden: false + immutable: false + type: string + description: Internal2_shared + pcm_server_name: + label: pcm_server_name + hidden: false + immutable: false + type: string + description: pcm_server_name + Internal1_net_name: + label: Internal1_net_name + hidden: false + immutable: false + type: string + description: Internal1_net_name + oam_net_name: + label: oam_net_name + hidden: false + immutable: false + type: string + description: oam_net_name + fsb1-flavor: + label: FSB1_flavor + hidden: false + immutable: false + type: string + description: FSB1_flavor + fsb1-Internal2-mac: + label: FSB1_internal_mac + hidden: false + immutable: false + type: string + description: FSB1_internal_mac + volume_type: + label: volume type + hidden: false + immutable: false + type: string + description: volume type Gold + fsb1-zone: + label: FSB1_zone + hidden: false + immutable: false + type: string + description: FSB1_zone + fsb_zone: + label: FSB1_zone + hidden: false + immutable: false + type: string + description: FSB1_zone + security_group_name: + hidden: false + immutable: false + type: list + description: CMAUI1, CMAUI2 server names + entry_schema: + type: String + jsa_net_name: + label: jsa_net_name + hidden: false + immutable: false + type: string + description: jsa_net_name + default: jsa_log_net_0 + pcrf_psm_server_name: + label: pcrf_psm_server_name + hidden: false + immutable: false + type: string + description: pcrf_psm_server_name + pcm_flavor_name: + label: pcm_flavor_name + hidden: false + immutable: false + type: string + description: pcm_flavor_name + oam_net_id: + label: oam_net_id + hidden: false + immutable: false + type: string + description: oam_net_id + fsb2-Internal1-mac: + label: FSB1_internal_mac + hidden: false + immutable: false + type: string + description: FSB1_internal_mac + Internal1_forwarding_mode: + label: Internal1_forwarding_mode + hidden: false + immutable: false + type: string + description: Internal1_forwarding_mode + pcrf_cps_net_name: + label: pcrf_cps_net_name + hidden: false + immutable: false + type: string + description: pcrf_cps_net_name + cps_net_name: + label: cps_net_name + hidden: false + immutable: false + type: string + description: cps_net_name + pcrf_security_group_name: + hidden: false + immutable: false + type: list + description: CMAUI1, CMAUI2 server names + entry_schema: + type: String + Internal1_external: + label: Internal1_external + hidden: false + immutable: false + type: string + description: Internal1_external + node_templates: + pcm_vol_02: + type: org.openecomp.resource.vfc.nodes.heat.cinder.Volume + properties: + image: + get_input: FSB_1_image + volume_type: + get_input: volume_type + size: '(get_input : volume_size) * 1024' + read_only: true + name: + get_input: FSB1_volume_name + Internal2-net: + type: org.openecomp.resource.vl.nodes.heat.network.contrail.VirtualNetwork + properties: + shared: + get_input: Internal2_shared + forwarding_mode: + get_input: Internal2_forwarding_mode + external: + get_input: Internal2_external + network_name: + get_input: Internal2_name + pcm_port_1: + type: org.openecomp.resource.cp.nodes.heat.network.neutron.Port + properties: + security_groups: + - get_input: security_group_name + fixed_ips: + - ip_address: + get_input: oam_net_ip + network: + get_input: oam_net_name + requirements: + - binding: + capability: tosca.capabilities.network.Bindable + node: server_pcm + relationship: tosca.relationships.network.BindsTo + server_VolumeTest_snapshot02: + type: org.openecomp.resource.vfc.nodes.heat.cinder.Volume + properties: + snapshot_id: + get_input: snapshot02 + FSB1_Internal2_port: + type: org.openecomp.resource.cp.nodes.heat.network.neutron.Port + properties: + mac_address: + get_input: fsb1-Internal2-mac + network: Internal2-net + requirements: + - link: + capability: tosca.capabilities.network.Linkable + node: Internal2-net + relationship: tosca.relationships.network.LinksTo + - binding: + capability: tosca.capabilities.network.Bindable + node: FSB1 + relationship: tosca.relationships.network.BindsTo + server_VolumeTest_snapshot01: + type: org.openecomp.resource.vfc.nodes.heat.cinder.Volume + properties: + snapshot_id: + get_input: snapshot01 + FSB1_Internal1_port: + type: org.openecomp.resource.cp.nodes.heat.network.neutron.Port + properties: + mac_address: + get_input: fsb1-Internal1-mac + network: Internal1-net + requirements: + - link: + capability: tosca.capabilities.network.Linkable + node: Internal1-net + relationship: tosca.relationships.network.LinksTo + - binding: + capability: tosca.capabilities.network.Bindable + node: FSB1 + relationship: tosca.relationships.network.BindsTo + FSB1_OAM_Port: + type: org.openecomp.resource.cp.nodes.heat.network.neutron.Port + properties: + fixed_ips: + - ip_address: + get_input: fsb1-oam-ip + network: + get_input: oam_net_id + requirements: + - binding: + capability: tosca.capabilities.network.Bindable + node: FSB1 + relationship: tosca.relationships.network.BindsTo + psm01_port_0: + type: org.openecomp.resource.cp.nodes.heat.network.neutron.Port + properties: + security_groups: + - get_input: pcrf_security_group_name + fixed_ips: + - ip_address: + get_input: pcrf_cps_net_ip + network: + get_input: pcrf_cps_net_name + requirements: + - binding: + capability: tosca.capabilities.network.Bindable + node: pcrf_server_psm + relationship: tosca.relationships.network.BindsTo + pcm_port_0: + type: org.openecomp.resource.cp.nodes.heat.network.neutron.Port + properties: + security_groups: + - get_input: security_group_name + fixed_ips: + - ip_address: + get_input: cps_net_ip + network: + get_input: cps_net_name + requirements: + - binding: + capability: tosca.capabilities.network.Bindable + node: server_pcm + relationship: tosca.relationships.network.BindsTo + network: + type: org.openecomp.resource.vl.nodes.heat.network.contrail.VirtualNetwork + properties: + network_name: + get_input: Internal1_net_name + server_pcm: + type: org.openecomp.resource.vfc.nodes.heat.pcm + properties: + flavor: + get_input: pcm_flavor_name + availability_zone: + get_input: availabilityzone_name + image: + get_input: pcm_image_name + config_drive: 'True' + user_data_format: RAW + name: + get_input: pcm_server_name + user_data: UNSUPPORTED_RESOURCE_server_init + Internal1-net: + type: org.openecomp.resource.vl.nodes.heat.network.contrail.VirtualNetwork + properties: + shared: + get_input: Internal1_shared + forwarding_mode: + get_input: Internal1_forwarding_mode + external: + get_input: Internal1_external + network_name: + get_input: Internal1_net_name + pcrf_server_psm: + type: org.openecomp.resource.vfc.nodes.heat.pcrf_psm + properties: + flavor: + get_input: pcrf_psm_flavor_name + availability_zone: + get_input: availabilityzone_name + image: + get_input: pcrf_psm_image_name + config_drive: 'True' + metadata: + vnf_id: + get_input: pcrf_vnf_id + user_data_format: RAW + name: + get_input: pcrf_psm_server_name + user_data: UNSUPPORTED_RESOURCE_pcrf_server_init + FSB1: + type: org.openecomp.resource.vfc.nodes.heat.nova.Server + properties: + flavor: + get_input: fsb1-flavor + availability_zone: + get_input: fsb_zone + metadata: + write_files: + - path: /etc/sysconfig/network-scripts/ifcfg-eth0 + permissions: '0644' + content: + str_replace: + template: + get_artifact: + - SELF + - nimbus-ethernet + params: + $dev: eth0 + $netmask: + get_input: cps_net_mask + $ip: + get_input: cps_net_ip + - path: /etc/sysconfig/network-scripts/ifcfg-eth1 + permissions: '0644' + content: + str_replace: + template: + get_artifact: + - SELF + - nimbus-ethernet-gw + params: + $dev: eth1 + $netmask: + get_input: oam_net_mask + $gateway: + get_input: oam_net_gw + $ip: + get_input: oam_net_ip + name: + get_input: fsb1-name + artifacts: + nimbus-ethernet-gw: + type: tosca.artifacts.Deployment + file: ../Artifacts/nimbus-ethernet-gw + nimbus-ethernet: + type: tosca.artifacts.Deployment + file: ../Artifacts/nimbus-ethernet + groups: + ep-jsa_net: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/ep-jsa_net.yaml + description: | + Version 2.0 02-09-2016 (Authors: John Doe, user PROD) + members: + - pcm_vol_02 + - Internal2-net + - pcm_port_1 + - FSB1_Internal2_port + - FSB1_Internal1_port + - FSB1_OAM_Port + - psm01_port_0 + - pcm_port_0 + - server_pcm + - Internal1-net + - pcrf_server_psm + - FSB1
\ No newline at end of file diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/extractServiceComposition/networks/MainServiceTemplate.yaml b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/extractServiceComposition/networks/MainServiceTemplate.yaml new file mode 100644 index 0000000000..e5c68b61d0 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/extractServiceComposition/networks/MainServiceTemplate.yaml @@ -0,0 +1,829 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +metadata: + template_name: Main +imports: + NeutronPortGlobalTypes: + file: NeutronPortGlobalTypesServiceTemplate.yaml + NeutronNetGlobalTypes: + file: NeutronNetGlobalTypesServiceTemplate.yaml + CommonGlobalTypes: + file: CommonGlobalTypesServiceTemplate.yaml + CinderVolumeGlobalTypes: + file: CinderVolumeGlobalTypesServiceTemplate.yaml + ContrailNetworkRuleGlobalType: + file: ContrailNetworkRuleGlobalTypeServiceTemplate.yaml + NeutronSecurityRulesGlobalTypes: + file: NeutronSecurityRulesGlobalTypesServiceTemplate.yaml + NovaServerGlobalTypes: + file: NovaServerGlobalTypesServiceTemplate.yaml + ContrailVirtualNetworkGlobalType: + file: ContrailVirtualNetworkGlobalTypeServiceTemplate.yaml + AbstractSubstituteGlobalTypes: + file: AbstractSubstituteGlobalTypesServiceTemplate.yaml +topology_template: + inputs: + Internal2_name: + hidden: false + immutable: false + type: string + default: Internal2-subnet + vlc2-Internal2-mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc2-Internal2 + default: 00:81:37:0E:02:12 + epc-sctp-a-net-rt: + hidden: false + immutable: false + type: string + description: epc-sctp-a route target + default: 13979:105717 + epc-sctp-b-net-rt: + hidden: false + immutable: false + type: string + description: epc-sctp-b route target + default: 13979:105719 + gpb-flavor: + hidden: false + immutable: false + type: string + description: Flavor to use for servers gpb + default: m4.xlarge4 + Internal1_cidr: + hidden: false + immutable: false + type: string + default: 169.253.0.0/17 + epc-sctp-a-pool-start: + hidden: false + immutable: false + type: string + description: epc-sctp-a-net network ip pool start IP address + default: 107.243.37.3 + Internal2_subnet_name: + hidden: false + immutable: false + type: string + default: vmme_int_int_sub_2 + Internal1_subnet_name: + hidden: false + immutable: false + type: string + default: vmme_int_int_sub_1 + gpb1-Internal1-mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb1-Internal1 + default: 00:80:37:0E:01:22 + gpb1-Internal1-ip: + hidden: false + immutable: false + type: string + default: 169.254.0.101 + FSB_1_image: + hidden: false + immutable: false + type: string + description: image name + fsb1-Internal2-mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to fsb1-Internal2 + default: 00:81:37:0E:0B:12 + ncb_zone: + hidden: false + immutable: false + type: string + description: cluster for spawnning ncb instances + default: nova + Internal2_net_name: + hidden: false + immutable: false + type: string + default: vmme_int_int_2 + epc-sctp-a-pool-end: + hidden: false + immutable: false + type: string + description: epc-sctp-a-net network ip pool end IP address + default: 107.243.37.30 + Internal1_name: + hidden: false + immutable: false + type: string + default: Internal1-subnet + gpb2-name: + hidden: false + immutable: false + type: string + description: Name of gpb2 + default: ZRDM1MMEX33GPB002 + fsb2-Internal1-mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to fsb2-Internal1 + default: 00:80:37:0E:0D:12 + fsb2-name: + hidden: false + immutable: false + type: string + description: Name of fsb1 + default: ZRDM1MMEX33FSB002 + static_prefix_sctp_b_1: + hidden: false + immutable: false + type: string + description: Static Prefix + default: 107.239.40.64/30 + fsb2-oam-ip: + hidden: false + immutable: false + type: string + default: 107.250.172.222 + fsb2-flavor: + hidden: false + immutable: false + type: string + description: Flavor to use for servers fsb2 + default: m4.xlarge4 + fsb2-Internal2-mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to fsb2-Internal2 + default: 00:81:37:0E:0D:12 + ncb2-Internal1-mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to ncb2-Internal1 + default: 00:80:37:0E:0F:12 + ncb2-name: + hidden: false + immutable: false + type: string + description: Name of ncb2 + default: ZRDM1MMEX33NCB002 + epc-sctp-b-pool-end: + hidden: false + immutable: false + type: string + description: epc-sctp-b-net network ip pool end IP address + default: 107.243.37.62 + vlc1-gtp-ip: + hidden: false + immutable: false + type: string + default: 107.243.37.67 + epc-sctp-b-pool-start: + hidden: false + immutable: false + type: string + description: epc-sctp-b-net network ip pool start IP address + default: 107.243.37.35 + my_instance: + hidden: false + immutable: false + type: string + description: instance + Internal2_shared: + hidden: false + immutable: false + type: string + default: 'False' + Internal1_net_name: + hidden: false + immutable: false + type: string + default: vmme_int_int_1 + vlc2-name: + hidden: false + immutable: false + type: string + description: Name of vlc2 + default: ZRDM1MMEX33VLC002 + Internal2_ipam_name: + hidden: false + immutable: false + type: string + default: vmme_ipam_int2 + vlc1-sctp-b-ip: + hidden: false + immutable: false + type: string + default: 107.243.37.35 + Internal1_net_pool_end: + hidden: false + immutable: false + type: string + default: 169.253.0.254 + Internal1_default_gateway: + hidden: false + immutable: false + type: string + default: 169.253.0.3 + ncb1-Internal1-mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to ncb1-Internal1 + default: 00:80:37:0E:09:12 + epc-gtp-net-name: + hidden: false + immutable: false + type: string + description: gtp net name + default: EPC-GTP + vlc1-Internal1-mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc1-Internal1 + default: 00:80:37:0E:01:12 + gpb2-Internal1-mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb2-Internal1 + default: 00:80:37:0E:02:22 + epc-gtp-net-cidr: + hidden: false + immutable: false + type: string + description: gtp stubnet + default: 107.243.37.64/27 + oam_net_id: + hidden: false + immutable: false + type: string + description: uuid of oam network + default: 47bf4cca-0961-422f-bcd6-d5a4fbb1a351 + vlc_zone: + hidden: false + immutable: false + type: string + description: cluster for spawnning vlc instances + default: nova + vlc2-Internal1-mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc2-Internal1 + default: 00:80:37:0E:02:12 + epc-sctp-a-net-cidr: + hidden: false + immutable: false + type: string + description: epc-sctp-a subnet + default: 107.243.37.0/27 + Internal1_forwarding_mode: + hidden: false + immutable: false + type: string + default: l2 + Internal2_dhcp: + hidden: false + immutable: false + type: string + default: 'False' + Internal4_dhcp: + hidden: false + immutable: false + type: string + fsb1-oam-ip: + hidden: false + immutable: false + type: string + default: 107.250.172.221 + FSB_2_image: + hidden: false + immutable: false + type: string + description: image name + vlc1-oam-ip: + hidden: false + immutable: false + type: string + default: 107.250.172.227 + epc-sctp-a-net-name: + hidden: false + immutable: false + type: string + description: epc-sctp-a net name + default: EPC-SCTP-A + vlc2-oam-ip: + hidden: false + immutable: false + type: string + default: 107.250.172.228 + Internal2_net_pool_start: + hidden: false + immutable: false + type: string + default: 169.255.0.100 + FSB1_volume_name: + hidden: false + immutable: false + type: string + description: volume name + vlc1-sctp-a-ip: + hidden: false + immutable: false + type: string + default: 107.243.37.3 + Internal1_ipam_name: + hidden: false + immutable: false + type: string + default: vmme_ipam_int1 + Internal1_dhcp: + hidden: false + immutable: false + type: string + default: 'False' + Internal3_dhcp: + hidden: false + immutable: false + type: string + default: 'True' + Internal2_external: + hidden: false + immutable: false + type: string + default: 'False' + Internal2_forwarding_mode: + hidden: false + immutable: false + type: string + default: l2 + vlc1-name: + hidden: false + immutable: false + type: string + description: Name of vlc1 + default: ZRDM1MMEX33VLC002 + vlc-flavor: + hidden: false + immutable: false + type: string + description: Flavor to use for servers vlc + default: m4.xlarge4 + epc-gtp-net-rt: + hidden: false + immutable: false + type: string + description: gtp route target + default: 13979:105715 + gpb_zone: + hidden: false + immutable: false + type: string + description: cluster for spawnning gpb instances + default: nova + Internal1-net: + hidden: false + immutable: false + type: string + description: net + gpb1-Internal2-mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb1-Internal2 + default: 00:81:37:0E:01:22 + fsb1-Internal1-mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to fsb1-Internal1 + default: 00:80:37:0E:0B:12 + FSB2_volume_name: + hidden: false + immutable: false + type: string + description: volume name + VMME_FSB2_boot_volume: + hidden: false + immutable: false + type: string + default: 089a0d11-4b15-4370-8343-3f90907b1221 + fsb_zone: + hidden: false + immutable: false + type: string + description: cluster for spawnning fsb instances + default: nova + VMME_FSB1_boot_volume: + hidden: false + immutable: false + type: string + default: 8248e794-6173-4b49-b9c3-8219b0b56f4e + Internal2_default_gateway: + hidden: false + immutable: false + type: string + default: 169.255.0.3 + Internal1_external: + hidden: false + immutable: false + type: string + default: 'False' + vlc2-sctp-a-ip: + hidden: false + immutable: false + type: string + default: 107.243.37.4 + ncb-flavor: + hidden: false + immutable: false + type: string + description: Flavor to use for servers ncb + default: m4.xlarge4 + Internal1_shared: + hidden: false + immutable: false + type: string + default: 'False' + fsb1-name: + hidden: false + immutable: false + type: string + description: Name of fsb1 + default: ZRDM1MMEX33FSB001 + static_prefix_gtp_1: + hidden: false + immutable: false + type: string + description: Static Prefix + default: 107.239.40.96/30 + epc-sctp-b-net-gateway: + hidden: false + immutable: false + type: string + description: epc-sctp-b-net network gateway + default: 107.243.37.33 + epc-sctp-b-net-cidr: + hidden: false + immutable: false + type: string + description: epc-sctp-b subnet + default: 107.243.37.32/24 + epc-gtp-pool-end: + hidden: false + immutable: false + type: string + description: gtp network ip pool end IP address + default: 107.243.37.94 + epc-sctp-a-net-gateway: + hidden: false + immutable: false + type: string + description: epc-sctp-a-net network gateway + default: 107.243.37.1 + vlc2-gtp-ip: + hidden: false + immutable: false + type: string + default: 107.243.37.68 + vlc2-sctp-b-ip: + hidden: false + immutable: false + type: string + default: 107.243.37.36 + Internal1_net_pool_start: + hidden: false + immutable: false + type: string + default: 169.253.0.100 + volume_size: + hidden: false + immutable: false + type: string + description: volume + fsb2-image: + hidden: false + immutable: false + type: string + description: Name of image to use for server fsb2 + default: MME_FSB2_15B-CP04-r5a01 + ncb2-Internal2-mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to ncb2-Internal2 + default: 00:81:37:0E:0F:12 + ncb1-name: + hidden: false + immutable: false + type: string + description: Name of ncb1 + default: ZRDM1MMEX33NCB001 + fsb1-image: + hidden: false + immutable: false + type: string + description: Name of image to use for server fsb1 + default: MME_FSB1_15B-CP04-r5a01 + fsb1-flavor: + hidden: false + immutable: false + type: string + description: Flavor to use for servers fsb1 + default: m4.xlarge4 + volume_type: + hidden: false + immutable: false + type: string + description: volume + Internal2_net_pool_end: + hidden: false + immutable: false + type: string + default: 169.255.0.254 + epc-sctp-b-net-name: + hidden: false + immutable: false + type: string + description: epc-sctp-b net name + default: EPC-SCTP-B + Internal2_cidr: + hidden: false + immutable: false + type: string + default: 169.255.0.0/17 + epc-gtp-net-gateway: + hidden: false + immutable: false + type: string + description: gtp network gateway + default: 107.243.37.65 + gpb2-Internal2-mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb2-Internal2 + default: 00:81:37:0E:02:22 + ncb1-Internal2-mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to ncb1-Internal2 + default: 00:81:37:0E:09:12 + epc-gtp-pool-start: + hidden: false + immutable: false + type: string + description: gtp network ip pool start IP address + default: 107.243.37.67 + static_prefix_sctp_a_1: + hidden: false + immutable: false + type: string + description: Static Prefix + default: 107.239.40.32/30 + gpb1-name: + hidden: false + immutable: false + type: string + description: Name of gpb1 + default: ZRDM1MMEX33GPB001 + pxe-image: + hidden: false + immutable: false + type: string + description: Name of image to use for server ncb + default: MME_PXE-BOOT_cxp9025898_2r5a01.qcow2 + vlc1-Internal2-mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc1-Internal2 + default: 00:81:37:0E:01:12 + node_templates: + contail-net-default-true-dhcp: + type: org.openecomp.resource.vl.nodes.heat.network.contrail.VirtualNetwork + properties: + route_targets: + - get_input: epc-gtp-net-rt + network_name: + get_input: epc-gtp-net-name + subnets: + epc-gtp-subnet: + cidr: + get_input: epc-gtp-net-cidr + gateway_ip: + get_input: epc-gtp-net-gateway + allocation_pools: + - start: + get_input: epc-gtp-pool-start + end: + get_input: epc-gtp-pool-end + contail-net-dhcp-false-param: + type: org.openecomp.resource.vl.nodes.heat.network.contrail.VirtualNetwork + properties: + shared: + get_input: Internal1_shared + forwarding_mode: + get_input: Internal1_forwarding_mode + external: true + route_targets: + get_artifact: + - SELF + - nimbus-ethernet + network_name: + get_input: Internal1_net_name + subnets: + Internal3-subnet: + enable_dhcp: + get_input: Internal2_dhcp + cidr: + get_input: Internal2_cidr + gateway_ip: + get_input: Internal2_default_gateway + Internal1-subnet: + enable_dhcp: + get_input: Internal1_dhcp + cidr: + get_input: Internal1_cidr + gateway_ip: + get_input: Internal1_default_gateway + dhcp_enabled: + get_input: Internal1_dhcp + artifacts: + nimbus-ethernet: + type: tosca.artifacts.Deployment + file: ../Artifacts/nimbus-ethernet.sh + contail-net-dhcp-false: + type: org.openecomp.resource.vl.nodes.heat.network.contrail.VirtualNetwork + properties: + shared: + get_input: Internal1_shared + forwarding_mode: + get_input: Internal1_forwarding_mode + external: true + route_targets: + get_artifact: + - SELF + - nimbus-ethernet + network_name: + get_input: Internal1_net_name + subnets: + Internal3-subnet: + enable_dhcp: + get_input: Internal2_dhcp + cidr: + get_input: Internal2_cidr + gateway_ip: + get_input: Internal2_default_gateway + Internal1-subnet: + enable_dhcp: + get_input: Internal1_dhcp + cidr: + get_input: Internal1_cidr + gateway_ip: + get_input: Internal1_default_gateway + dhcp_enabled: false + artifacts: + nimbus-ethernet: + type: tosca.artifacts.Deployment + file: ../Artifacts/nimbus-ethernet.sh + contail-net-dhcp-true-param: + type: org.openecomp.resource.vl.nodes.heat.network.contrail.VirtualNetwork + properties: + shared: + get_input: Internal1_shared + forwarding_mode: + get_input: Internal1_forwarding_mode + external: true + route_targets: + get_artifact: + - SELF + - nimbus-ethernet + network_name: + get_input: Internal1_net_name + subnets: + Internal3-subnet: + enable_dhcp: + get_input: Internal2_dhcp + cidr: + get_input: Internal2_cidr + gateway_ip: + get_input: Internal2_default_gateway + Internal1-subnet: + enable_dhcp: + get_input: Internal1_dhcp + cidr: + get_input: Internal1_cidr + gateway_ip: + get_input: Internal1_default_gateway + dhcp_enabled: + get_input: Internal3_dhcp + artifacts: + nimbus-ethernet: + type: tosca.artifacts.Deployment + file: ../Artifacts/nimbus-ethernet.sh + contail-net-dhcp-true: + type: org.openecomp.resource.vl.nodes.heat.network.contrail.VirtualNetwork + properties: + shared: + get_input: Internal1_shared + forwarding_mode: + get_input: Internal1_forwarding_mode + external: true + route_targets: + get_artifact: + - SELF + - nimbus-ethernet + network_name: + get_input: Internal1_net_name + subnets: + Internal3-subnet: + enable_dhcp: + get_input: Internal2_dhcp + cidr: + get_input: Internal2_cidr + gateway_ip: + get_input: Internal2_default_gateway + Internal1-subnet: + enable_dhcp: + get_input: Internal1_dhcp + cidr: + get_input: Internal1_cidr + gateway_ip: + get_input: Internal1_default_gateway + dhcp_enabled: true + artifacts: + nimbus-ethernet: + type: tosca.artifacts.Deployment + file: ../Artifacts/nimbus-ethernet.sh + contail-net-dhcp-default-true-param: + type: org.openecomp.resource.vl.nodes.heat.network.contrail.VirtualNetwork + properties: + shared: + get_input: Internal1_shared + forwarding_mode: + get_input: Internal1_forwarding_mode + external: true + route_targets: + get_artifact: + - SELF + - nimbus-ethernet + network_name: + get_input: Internal1_net_name + subnets: + Internal3-subnet: + enable_dhcp: + get_input: Internal2_dhcp + cidr: + get_input: Internal2_cidr + gateway_ip: + get_input: Internal2_default_gateway + Internal1-subnet: + enable_dhcp: + get_input: Internal1_dhcp + cidr: + get_input: Internal1_cidr + gateway_ip: + get_input: Internal1_default_gateway + dhcp_enabled: + get_input: Internal4_dhcp + artifacts: + nimbus-ethernet: + type: tosca.artifacts.Deployment + file: ../Artifacts/nimbus-ethernet.sh + neutron-net-default-dhcp: + type: org.openecomp.resource.vl.nodes.heat.network.neutron.Net + properties: + network_name: + get_input: private_net_2_name + subnets: + private_subnet_2: + cidr: + get_input: private_net_2_cidr + gateway_ip: + get_input: private_net_2_gateway + allocation_pools: + - start: + get_input: private_net_2_pool_start + end: + get_input: private_net_2_pool_end + groups: + vmme_small: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/vmme_small.yml + description: | + HOT template to create vmme 2 fsb 2 ncb 2 gbp 2 vlc + members: + - contail-net-default-true-dhcp + - contail-net-dhcp-false-param + - contail-net-dhcp-false + - contail-net-dhcp-true-param + - contail-net-dhcp-true + - contail-net-dhcp-default-true-param + - neutron-net-default-dhcp
\ No newline at end of file diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/extractServiceComposition/onlyComponents/OnlyComponentsST.yaml b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/extractServiceComposition/onlyComponents/OnlyComponentsST.yaml new file mode 100644 index 0000000000..54f39e4219 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/extractServiceComposition/onlyComponents/OnlyComponentsST.yaml @@ -0,0 +1,350 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +metadata: + template_name: Main +imports: + NeutronPortGlobalTypes: + file: NeutronPortGlobalTypesServiceTemplate.yaml + NeutronNetGlobalTypes: + file: NeutronNetGlobalTypesServiceTemplate.yaml + CommonGlobalTypes: + file: CommonGlobalTypesServiceTemplate.yaml + CinderVolumeGlobalTypes: + file: CinderVolumeGlobalTypesServiceTemplate.yaml + ContrailNetworkRuleGlobalType: + file: ContrailNetworkRuleGlobalTypeServiceTemplate.yaml + NeutronSecurityRulesGlobalTypes: + file: NeutronSecurityRulesGlobalTypesServiceTemplate.yaml + NovaServerGlobalTypes: + file: NovaServerGlobalTypesServiceTemplate.yaml + ContrailVirtualNetworkGlobalType: + file: ContrailVirtualNetworkGlobalTypeServiceTemplate.yaml + AbstractSubstituteGlobalTypes: + file: AbstractSubstituteGlobalTypesServiceTemplate.yaml +node_types: + org.openecomp.resource.vfc.nodes.heat.pcrf_psm: + derived_from: org.openecomp.resource.vfc.nodes.heat.nova.Server + org.openecomp.resource.vfc.nodes.heat.pcm: + derived_from: org.openecomp.resource.vfc.nodes.heat.nova.Server +topology_template: + inputs: + Internal2_name: + label: Internal2_name + hidden: false + immutable: false + type: string + description: Internal2_name + Internal1_shared: + label: Internal1_shared + hidden: false + immutable: false + type: string + description: Internal1_shared + FSB1_volume_name: + label: FSB1_volume + hidden: false + immutable: false + type: string + description: FSB1_volume_1 + jsa_cidr: + label: jsa_cidr + hidden: false + immutable: false + type: string + description: jsa_cidr + default: 107.243.7.128/26 + availabilityzone_name: + label: availabilityzone_name + hidden: false + immutable: false + type: string + description: availabilityzone_name + fsb1-name: + label: FSB1_name + hidden: false + immutable: false + type: string + description: FSB1_name + pcm_image_name: + label: pcm_image_name + hidden: false + immutable: false + type: string + description: pcm_image_name + Internal2_external: + label: Internal2_external + hidden: false + immutable: false + type: string + description: Internal2_external + Internal2_forwarding_mode: + label: Internal2_forwarding_mode + hidden: false + immutable: false + type: string + description: Internal2_forwarding_mode + pcrf_psm_flavor_name: + label: pcrf_psm_flavor_name + hidden: false + immutable: false + type: string + description: pcrf_psm_flavor_name + pcrf_psm_image_name: + label: pcrf_psm_image_name + hidden: false + immutable: false + type: string + description: pcrf_psm_image_name + FSB_1_image: + label: MME_FSB1 + hidden: false + immutable: false + type: string + description: MME_FSB1_15B-CP04-r5a01 + volume_size: + label: volume size + hidden: false + immutable: false + type: float + description: my volume size 320GB + fsb1-Internal1-mac: + label: FSB1_internal_mac + hidden: false + immutable: false + type: string + description: FSB1_internal_mac + Internal2_shared: + label: Internal2_shared + hidden: false + immutable: false + type: string + description: Internal2_shared + pcm_server_name: + label: pcm_server_name + hidden: false + immutable: false + type: string + description: pcm_server_name + Internal1_net_name: + label: Internal1_net_name + hidden: false + immutable: false + type: string + description: Internal1_net_name + oam_net_name: + label: oam_net_name + hidden: false + immutable: false + type: string + description: oam_net_name + fsb1-flavor: + label: FSB1_flavor + hidden: false + immutable: false + type: string + description: FSB1_flavor + fsb1-Internal2-mac: + label: FSB1_internal_mac + hidden: false + immutable: false + type: string + description: FSB1_internal_mac + volume_type: + label: volume type + hidden: false + immutable: false + type: string + description: volume type Gold + fsb1-zone: + label: FSB1_zone + hidden: false + immutable: false + type: string + description: FSB1_zone + fsb_zone: + label: FSB1_zone + hidden: false + immutable: false + type: string + description: FSB1_zone + security_group_name: + hidden: false + immutable: false + type: list + description: CMAUI1, CMAUI2 server names + entry_schema: + type: String + jsa_net_name: + label: jsa_net_name + hidden: false + immutable: false + type: string + description: jsa_net_name + default: jsa_log_net_0 + pcrf_psm_server_name: + label: pcrf_psm_server_name + hidden: false + immutable: false + type: string + description: pcrf_psm_server_name + pcm_flavor_name: + label: pcm_flavor_name + hidden: false + immutable: false + type: string + description: pcm_flavor_name + oam_net_id: + label: oam_net_id + hidden: false + immutable: false + type: string + description: oam_net_id + fsb2-Internal1-mac: + label: FSB1_internal_mac + hidden: false + immutable: false + type: string + description: FSB1_internal_mac + Internal1_forwarding_mode: + label: Internal1_forwarding_mode + hidden: false + immutable: false + type: string + description: Internal1_forwarding_mode + pcrf_cps_net_name: + label: pcrf_cps_net_name + hidden: false + immutable: false + type: string + description: pcrf_cps_net_name + cps_net_name: + label: cps_net_name + hidden: false + immutable: false + type: string + description: cps_net_name + pcrf_security_group_name: + hidden: false + immutable: false + type: list + description: CMAUI1, CMAUI2 server names + entry_schema: + type: String + Internal1_external: + label: Internal1_external + hidden: false + immutable: false + type: string + description: Internal1_external + node_templates: + nova_local_type_pcm1: + type: org.openecomp.resource.vfc.nodes.heat.pcm + properties: + flavor: + get_input: pcm_flavor_name + availability_zone: + get_input: availabilityzone_name + image: + get_input: pcm_image_name + config_drive: 'True' + user_data_format: RAW + name: + get_input: pcm_server_name + user_data: UNSUPPORTED_RESOURCE_server_init + nova_local_type_pcm2: + type: org.openecomp.resource.vfc.nodes.heat.pcm + properties: + flavor: + get_input: pcm_flavor_name + availability_zone: + get_input: availabilityzone_name + image: + get_input: pcm_image_name + config_drive: 'True' + user_data_format: RAW + name: + get_input: pcm_server_name + user_data: UNSUPPORTED_RESOURCE_server_init + nova_local_type_pcrf_psm: + type: org.openecomp.resource.vfc.nodes.heat.pcrf_psm + properties: + flavor: + get_input: pcm_flavor_name + availability_zone: + get_input: availabilityzone_name + image: + get_input: pcm_image_name + config_drive: 'True' + user_data_format: RAW + name: + get_input: pcm_server_name + user_data: UNSUPPORTED_RESOURCE_server_init + nova_global_type1: + type: org.openecomp.resource.vfc.nodes.heat.nova.Server + properties: + flavor: + get_input: fsb1-flavor + availability_zone: + get_input: fsb_zone + name: + get_input: fsb1-name + nova_global_type2: + type: org.openecomp.resource.vfc.nodes.heat.nova.Server + properties: + flavor: + get_input: fsb1-flavor + availability_zone: + get_input: fsb_zone + metadata: + write_files: + - path: /etc/sysconfig/network-scripts/ifcfg-eth0 + permissions: '0644' + content: + str_replace: + template: + get_artifact: + - SELF + - nimbus-ethernet + params: + $dev: eth0 + $netmask: + get_input: cps_net_mask + $ip: + get_input: cps_net_ip + - path: /etc/sysconfig/network-scripts/ifcfg-eth1 + permissions: '0644' + content: + str_replace: + template: + get_artifact: + - SELF + - nimbus-ethernet-gw + params: + $dev: eth1 + $netmask: + get_input: oam_net_mask + $gateway: + get_input: oam_net_gw + $ip: + get_input: oam_net_ip + name: + get_input: fsb1-name + artifacts: + nimbus-ethernet-gw: + type: tosca.artifacts.Deployment + file: ../Artifacts/nimbus-ethernet-gw + nimbus-ethernet: + type: tosca.artifacts.Deployment + file: ../Artifacts/nimbus-ethernet + groups: + ep-jsa_net: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/ep-jsa_net.yaml + description: | + Version 2.0 02-09-2016 (Authors: John Doe, user PROD) + members: + - nova_local_type_pcm1 + - nova_local_type_pcm2 + - nova_local_type_pcrf_psm + - nova_global_type1 + - nova_global_type2
\ No newline at end of file diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/extractServiceComposition/substitution/GlobalSubstitutionTypesServiceTemplate.yaml b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/extractServiceComposition/substitution/GlobalSubstitutionTypesServiceTemplate.yaml new file mode 100644 index 0000000000..06e6fb0b01 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/extractServiceComposition/substitution/GlobalSubstitutionTypesServiceTemplate.yaml @@ -0,0 +1,235 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +metadata: + template_name: GlobalSubstitutionTypes +imports: + NeutronPortGlobalTypes: + file: NeutronPortGlobalTypesServiceTemplate.yaml + NeutronNetGlobalTypes: + file: NeutronNetGlobalTypesServiceTemplate.yaml + CommonGlobalTypes: + file: CommonGlobalTypesServiceTemplate.yaml + CinderVolumeGlobalTypes: + file: CinderVolumeGlobalTypesServiceTemplate.yaml + ContrailNetworkRuleGlobalType: + file: ContrailNetworkRuleGlobalTypeServiceTemplate.yaml + NeutronSecurityRulesGlobalTypes: + file: NeutronSecurityRulesGlobalTypesServiceTemplate.yaml + NovaServerGlobalTypes: + file: NovaServerGlobalTypesServiceTemplate.yaml + ContrailVirtualNetworkGlobalType: + file: ContrailVirtualNetworkGlobalTypeServiceTemplate.yaml + AbstractSubstituteGlobalTypes: + file: AbstractSubstituteGlobalTypesServiceTemplate.yaml +node_types: + org.openecomp.resource.abstract.nodes.heat.nested1: + derived_from: org.openecomp.resource.abstract.nodes.AbstractSubstitute + properties: + cmaui_names: + type: list + description: CMAUI1, CMAUI2 server names + entry_schema: + type: String + p1: + type: string + description: UID of OAM network + p2: + type: string + description: UID of OAM network + abc_flavor: + type: string + description: Flavor for CMAUI server + cmaui_image: + type: string + description: Image for CMAUI server + cmaui_flavor: + type: string + description: Flavor for CMAUI server + abc_names: + type: list + description: CMAUI1, CMAUI2 server names + entry_schema: + type: String + security_group_name: + description: not impotrtant + availability_zone_0: + type: string + description: availabilityzone name + abc_image: + type: string + description: Image for CMAUI server + requirements: + - link_cmaui_port_2: + capability: tosca.capabilities.network.Linkable + node: tosca.nodes.Root + relationship: tosca.relationships.network.LinksTo + occurrences: + - 1 + - 1 + - local_storage_server_cmaui: + capability: tosca.capabilities.Attachment + node: tosca.nodes.BlockStorage + relationship: tosca.relationships.AttachesTo + occurrences: + - 0 + - UNBOUNDED + - local_storage_server_abc: + capability: tosca.capabilities.Attachment + node: tosca.nodes.BlockStorage + relationship: tosca.relationships.AttachesTo + occurrences: + - 0 + - UNBOUNDED + - link_abc_port_1: + capability: tosca.capabilities.network.Linkable + node: tosca.nodes.Root + relationship: tosca.relationships.network.LinksTo + occurrences: + - 1 + - 1 + - link_cmaui_port_1: + capability: tosca.capabilities.network.Linkable + node: tosca.nodes.Root + relationship: tosca.relationships.network.LinksTo + occurrences: + - 1 + - 1 + capabilities: + scalable_server_abc: + type: tosca.capabilities.Scalable + occurrences: + - 1 + - UNBOUNDED + os_server_cmaui: + type: tosca.capabilities.OperatingSystem + occurrences: + - 1 + - UNBOUNDED + attachment_abc_port_1: + type: tosca.capabilities.Attachment + occurrences: + - 1 + - UNBOUNDED + host_server_abc: + type: tosca.capabilities.Container + valid_source_types: + - tosca.nodes.SoftwareComponent + occurrences: + - 1 + - UNBOUNDED + scalable_server_cmaui: + type: tosca.capabilities.Scalable + occurrences: + - 1 + - UNBOUNDED + os_server_abc: + type: tosca.capabilities.OperatingSystem + occurrences: + - 1 + - UNBOUNDED + host_server_cmaui: + type: tosca.capabilities.Container + valid_source_types: + - tosca.nodes.SoftwareComponent + occurrences: + - 1 + - UNBOUNDED + binding_server_abc: + type: tosca.capabilities.network.Bindable + occurrences: + - 1 + - UNBOUNDED + endpoint_server_cmaui: + type: tosca.capabilities.Endpoint.Admin + occurrences: + - 1 + - UNBOUNDED + binding_server_cmaui: + type: tosca.capabilities.network.Bindable + occurrences: + - 1 + - UNBOUNDED + endpoint_server_abc: + type: tosca.capabilities.Endpoint.Admin + occurrences: + - 1 + - UNBOUNDED + attachment_cmaui_port_2: + type: tosca.capabilities.Attachment + occurrences: + - 1 + - UNBOUNDED + attachment_cmaui_port_1: + type: tosca.capabilities.Attachment + occurrences: + - 1 + - UNBOUNDED + org.openecomp.resource.abstract.nodes.heat.nested2: + derived_from: org.openecomp.resource.abstract.nodes.AbstractSubstitute + properties: + cmaui_names: + type: list + description: CMAUI1, CMAUI2 server names + entry_schema: + type: String + p1: + type: string + description: UID of OAM network + cmaui_image: + type: string + description: Image for CMAUI server + cmaui_flavor: + type: string + description: Flavor for CMAUI server + security_group_name: + description: not impotrtant + availability_zone_0: + type: string + description: availabilityzone name + requirements: + - local_storage_server_cmaui: + capability: tosca.capabilities.Attachment + node: tosca.nodes.BlockStorage + relationship: tosca.relationships.AttachesTo + occurrences: + - 0 + - UNBOUNDED + - link_cmaui_port_1: + capability: tosca.capabilities.network.Linkable + node: tosca.nodes.Root + relationship: tosca.relationships.network.LinksTo + occurrences: + - 1 + - 1 + capabilities: + host_server_cmaui: + type: tosca.capabilities.Container + valid_source_types: + - tosca.nodes.SoftwareComponent + occurrences: + - 1 + - UNBOUNDED + os_server_cmaui: + type: tosca.capabilities.OperatingSystem + occurrences: + - 1 + - UNBOUNDED + endpoint_server_cmaui: + type: tosca.capabilities.Endpoint.Admin + occurrences: + - 1 + - UNBOUNDED + binding_server_cmaui: + type: tosca.capabilities.network.Bindable + occurrences: + - 1 + - UNBOUNDED + scalable_server_cmaui: + type: tosca.capabilities.Scalable + occurrences: + - 1 + - UNBOUNDED + attachment_cmaui_port_1: + type: tosca.capabilities.Attachment + occurrences: + - 1 + - UNBOUNDED
\ No newline at end of file diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/extractServiceComposition/substitution/MainServiceTemplate.yaml b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/extractServiceComposition/substitution/MainServiceTemplate.yaml new file mode 100644 index 0000000000..6dd557798d --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/extractServiceComposition/substitution/MainServiceTemplate.yaml @@ -0,0 +1,139 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +metadata: + template_name: Main +imports: + NeutronPortGlobalTypes: + file: NeutronPortGlobalTypesServiceTemplate.yaml + NeutronNetGlobalTypes: + file: NeutronNetGlobalTypesServiceTemplate.yaml + CommonGlobalTypes: + file: CommonGlobalTypesServiceTemplate.yaml + CinderVolumeGlobalTypes: + file: CinderVolumeGlobalTypesServiceTemplate.yaml + ContrailNetworkRuleGlobalType: + file: ContrailNetworkRuleGlobalTypeServiceTemplate.yaml + NeutronSecurityRulesGlobalTypes: + file: NeutronSecurityRulesGlobalTypesServiceTemplate.yaml + NovaServerGlobalTypes: + file: NovaServerGlobalTypesServiceTemplate.yaml + ContrailVirtualNetworkGlobalType: + file: ContrailVirtualNetworkGlobalTypeServiceTemplate.yaml + AbstractSubstituteGlobalTypes: + file: AbstractSubstituteGlobalTypesServiceTemplate.yaml +topology_template: + inputs: + shared_network_id1: + hidden: false + immutable: false + type: string + description: network name of jsa log network + shared_network_id2: + hidden: false + immutable: false + type: string + description: network name of jsa log network + jsa_net_name: + hidden: false + immutable: false + type: string + description: network name of jsa log network + node_templates: + test_net2: + type: org.openecomp.resource.vl.nodes.heat.network.neutron.Net + properties: + shared: true + network_name: + get_input: jsa_net_name + test_nested2: + type: org.openecomp.resource.abstract.nodes.heat.nested2 + directives: + - substitutable + properties: + p1: + get_input: shared_network_id1 + service_template_filter: + substitute_service_template: nested2ServiceTemplate.yaml + requirements: + - link_cmaui_port_1: + capability: tosca.capabilities.network.Linkable + node: test_net1 + relationship: tosca.relationships.network.LinksTo + test_nested3: + type: org.openecomp.resource.abstract.nodes.heat.nested1 + directives: + - substitutable + properties: + p1: + get_input: shared_network_id1 + service_template_filter: + substitute_service_template: nested1ServiceTemplate.yaml + p2: + get_input: shared_network_id2 + requirements: + - link_cmaui_port_2: + capability: tosca.capabilities.network.Linkable + node: test_net2 + relationship: tosca.relationships.network.LinksTo + - link_abc_port_1: + capability: tosca.capabilities.network.Linkable + node: test_net2 + relationship: tosca.relationships.network.LinksTo + - link_cmaui_port_1: + capability: tosca.capabilities.network.Linkable + node: test_net1 + relationship: tosca.relationships.network.LinksTo + test_net1: + type: org.openecomp.resource.vl.nodes.heat.network.neutron.Net + properties: + shared: true + network_name: + get_input: jsa_net_name + test_nested1: + type: org.openecomp.resource.abstract.nodes.heat.nested1 + directives: + - substitutable + properties: + p1: + get_input: shared_network_id1 + service_template_filter: + substitute_service_template: nested1ServiceTemplate.yaml + p2: + get_input: shared_network_id2 + requirements: + - link_cmaui_port_2: + capability: tosca.capabilities.network.Linkable + node: test_net2 + relationship: tosca.relationships.network.LinksTo + - link_abc_port_1: + capability: tosca.capabilities.network.Linkable + node: test_net2 + relationship: tosca.relationships.network.LinksTo + - link_cmaui_port_1: + capability: tosca.capabilities.network.Linkable + node: test_net1 + relationship: tosca.relationships.network.LinksTo + groups: + addOn: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/addOn.yml + description: | + Version 2.0 02-09-2016 (Authors: John Doe, user PROD) + members: + - test_nested2 + - test_nested3 + - test_nested1 + main: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/main.yml + description: | + Version 2.0 02-09-2016 (Authors: John Doe, user PROD) + members: + - test_net2 + - test_net1 + outputs: + shared_network_id1: + value: test_net1 + shared_network_id2: + value: test_net2
\ No newline at end of file diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/extractServiceComposition/substitution/nested1ServiceTemplate.yaml b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/extractServiceComposition/substitution/nested1ServiceTemplate.yaml new file mode 100644 index 0000000000..1eb0796736 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/extractServiceComposition/substitution/nested1ServiceTemplate.yaml @@ -0,0 +1,241 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +metadata: + template_name: nested1 +imports: + NeutronPortGlobalTypes: + file: NeutronPortGlobalTypesServiceTemplate.yaml + NeutronNetGlobalTypes: + file: NeutronNetGlobalTypesServiceTemplate.yaml + CommonGlobalTypes: + file: CommonGlobalTypesServiceTemplate.yaml + CinderVolumeGlobalTypes: + file: CinderVolumeGlobalTypesServiceTemplate.yaml + ContrailNetworkRuleGlobalType: + file: ContrailNetworkRuleGlobalTypeServiceTemplate.yaml + NeutronSecurityRulesGlobalTypes: + file: NeutronSecurityRulesGlobalTypesServiceTemplate.yaml + NovaServerGlobalTypes: + file: NovaServerGlobalTypesServiceTemplate.yaml + nested1: + file: GlobalSubstitutionTypesServiceTemplate.yaml + ContrailVirtualNetworkGlobalType: + file: ContrailVirtualNetworkGlobalTypeServiceTemplate.yaml + AbstractSubstituteGlobalTypes: + file: AbstractSubstituteGlobalTypesServiceTemplate.yaml +node_types: + org.openecomp.resource.vfc.nodes.heat.cmaui_image: + derived_from: org.openecomp.resource.vfc.nodes.heat.nova.Server + org.openecomp.resource.vfc.nodes.heat.abc_image: + derived_from: org.openecomp.resource.vfc.nodes.heat.nova.Server +topology_template: + inputs: + cmaui_names: + hidden: false + immutable: false + type: list + description: CMAUI1, CMAUI2 server names + entry_schema: + type: String + p1: + hidden: false + immutable: false + type: string + description: UID of OAM network + p2: + hidden: false + immutable: false + type: string + description: UID of OAM network + abc_flavor: + hidden: false + immutable: false + type: string + description: Flavor for CMAUI server + cmaui_image: + hidden: false + immutable: false + type: string + description: Image for CMAUI server + cmaui_flavor: + hidden: false + immutable: false + type: string + description: Flavor for CMAUI server + abc_names: + hidden: false + immutable: false + type: list + description: CMAUI1, CMAUI2 server names + entry_schema: + type: String + security_group_name: + hidden: false + immutable: false + description: not impotrtant + availability_zone_0: + label: availabilityzone name + hidden: false + immutable: false + type: string + description: availabilityzone name + abc_image: + hidden: false + immutable: false + type: string + description: Image for CMAUI server + node_templates: + cmaui_port_2: + type: org.openecomp.resource.cp.nodes.heat.network.neutron.Port + properties: + replacement_policy: AUTO + security_groups: + - get_input: security_group_name + fixed_ips: + - ip_address: + get_input: + - cmaui_oam_ips + - 0 + network: + get_input: p2 + requirements: + - binding: + capability: tosca.capabilities.network.Bindable + node: server_cmaui + relationship: tosca.relationships.network.BindsTo + server_cmaui: + type: org.openecomp.resource.vfc.nodes.heat.cmaui_image + properties: + flavor: + get_input: cmaui_flavor + availability_zone: + get_input: availability_zone_0 + image: + get_input: cmaui_image + name: + get_input: + - cmaui_names + - 0 + server_abc: + type: org.openecomp.resource.vfc.nodes.heat.abc_image + properties: + flavor: + get_input: abc_flavor + availability_zone: + get_input: availability_zone_0 + image: + get_input: abc_image + name: + get_input: + - abc_names + - 0 + abc_port_1: + type: org.openecomp.resource.cp.nodes.heat.network.neutron.Port + properties: + replacement_policy: AUTO + security_groups: + - get_input: security_group_name + fixed_ips: + - ip_address: + get_input: + - abc_oam_ips + - 0 + network: + get_input: p2 + requirements: + - binding: + capability: tosca.capabilities.network.Bindable + node: server_abc + relationship: tosca.relationships.network.BindsTo + cmaui_port_1: + type: org.openecomp.resource.cp.nodes.heat.network.neutron.Port + properties: + replacement_policy: AUTO + security_groups: + - get_input: security_group_name + fixed_ips: + - ip_address: + get_input: + - cmaui_oam_ips + - 0 + network: + get_input: p1 + requirements: + - binding: + capability: tosca.capabilities.network.Bindable + node: server_cmaui + relationship: tosca.relationships.network.BindsTo + Internal1-net: + type: org.openecomp.resource.vl.nodes.heat.network.contrail.VirtualNetwork + properties: + network_name: + get_input: Internal1_net_name + groups: + nested1: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/nested1.yml + description: cmaui server template for vMMSC + members: + - cmaui_port_2 + - server_cmaui + - server_abc + - abc_port_1 + - cmaui_port_1 + substitution_mappings: + node_type: org.openecomp.resource.abstract.nodes.heat.nested1 + capabilities: + scalable_server_abc: + - server_abc + - scalable + os_server_cmaui: + - server_cmaui + - os + attachment_abc_port_1: + - abc_port_1 + - attachment + host_server_abc: + - server_abc + - host + scalable_server_cmaui: + - server_cmaui + - scalable + os_server_abc: + - server_abc + - os + host_server_cmaui: + - server_cmaui + - host + binding_server_abc: + - server_abc + - binding + endpoint_server_cmaui: + - server_cmaui + - endpoint + binding_server_cmaui: + - server_cmaui + - binding + endpoint_server_abc: + - server_abc + - endpoint + attachment_cmaui_port_2: + - cmaui_port_2 + - attachment + attachment_cmaui_port_1: + - cmaui_port_1 + - attachment + requirements: + local_storage_server_cmaui: + - server_cmaui + - local_storage + link_abc_port_1: + - abc_port_1 + - link + link_cmaui_port_2: + - cmaui_port_2 + - link + link_cmaui_port_1: + - cmaui_port_1 + - link + local_storage_server_abc: + - server_abc + - local_storage
\ No newline at end of file diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/extractServiceComposition/substitution/nested2ServiceTemplate.yaml b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/extractServiceComposition/substitution/nested2ServiceTemplate.yaml new file mode 100644 index 0000000000..3545683971 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/extractServiceComposition/substitution/nested2ServiceTemplate.yaml @@ -0,0 +1,135 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +metadata: + template_name: nested2 +imports: + NeutronPortGlobalTypes: + file: NeutronPortGlobalTypesServiceTemplate.yaml + NeutronNetGlobalTypes: + file: NeutronNetGlobalTypesServiceTemplate.yaml + CommonGlobalTypes: + file: CommonGlobalTypesServiceTemplate.yaml + CinderVolumeGlobalTypes: + file: CinderVolumeGlobalTypesServiceTemplate.yaml + ContrailNetworkRuleGlobalType: + file: ContrailNetworkRuleGlobalTypeServiceTemplate.yaml + NeutronSecurityRulesGlobalTypes: + file: NeutronSecurityRulesGlobalTypesServiceTemplate.yaml + nested2: + file: GlobalSubstitutionTypesServiceTemplate.yaml + NovaServerGlobalTypes: + file: NovaServerGlobalTypesServiceTemplate.yaml + ContrailVirtualNetworkGlobalType: + file: ContrailVirtualNetworkGlobalTypeServiceTemplate.yaml + AbstractSubstituteGlobalTypes: + file: AbstractSubstituteGlobalTypesServiceTemplate.yaml +node_types: + org.openecomp.resource.vfc.nodes.heat.cmaui_image: + derived_from: org.openecomp.resource.vfc.nodes.heat.nova.Server +topology_template: + inputs: + cmaui_names: + hidden: false + immutable: false + type: list + description: CMAUI1, CMAUI2 server names + entry_schema: + type: String + p1: + hidden: false + immutable: false + type: string + description: UID of OAM network + cmaui_image: + hidden: false + immutable: false + type: string + description: Image for CMAUI server + cmaui_flavor: + hidden: false + immutable: false + type: string + description: Flavor for CMAUI server + security_group_name: + hidden: false + immutable: false + description: not impotrtant + availability_zone_0: + label: availabilityzone name + hidden: false + immutable: false + type: string + description: availabilityzone name + node_templates: + server_cmaui: + type: org.openecomp.resource.vfc.nodes.heat.cmaui_image + properties: + flavor: + get_input: cmaui_flavor + availability_zone: + get_input: availability_zone_0 + image: + get_input: cmaui_image + name: + get_input: + - cmaui_names + - 0 + cmaui_port_1: + type: org.openecomp.resource.cp.nodes.heat.network.neutron.Port + properties: + replacement_policy: AUTO + security_groups: + - get_input: security_group_name + fixed_ips: + - ip_address: + get_input: + - cmaui_oam_ips + - 0 + network: + get_input: p1 + requirements: + - binding: + capability: tosca.capabilities.network.Bindable + node: server_cmaui + relationship: tosca.relationships.network.BindsTo + Internal1-net: + type: org.openecomp.resource.vl.nodes.heat.network.contrail.VirtualNetwork + properties: + network_name: + get_input: Internal1_net_name + groups: + nested2: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/nested2.yml + description: cmaui server template for vMMSC + members: + - server_cmaui + - cmaui_port_1 + substitution_mappings: + node_type: org.openecomp.resource.abstract.nodes.heat.nested2 + capabilities: + host_server_cmaui: + - server_cmaui + - host + os_server_cmaui: + - server_cmaui + - os + endpoint_server_cmaui: + - server_cmaui + - endpoint + binding_server_cmaui: + - server_cmaui + - binding + scalable_server_cmaui: + - server_cmaui + - scalable + attachment_cmaui_port_1: + - cmaui_port_1 + - attachment + requirements: + local_storage_server_cmaui: + - server_cmaui + - local_storage + link_cmaui_port_1: + - cmaui_port_1 + - link
\ No newline at end of file diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/extractServiceComposition/toscaGlobalServiceTemplates/AbstractSubstituteGlobalTypesServiceTemplate.yaml b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/extractServiceComposition/toscaGlobalServiceTemplates/AbstractSubstituteGlobalTypesServiceTemplate.yaml new file mode 100644 index 0000000000..8813b0abf6 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/extractServiceComposition/toscaGlobalServiceTemplates/AbstractSubstituteGlobalTypesServiceTemplate.yaml @@ -0,0 +1,47 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +metadata: + template_name: AbstractSubstituteGlobalTypes + template_version: 1.0.0 +description: Abstract Substitute Global Types +imports: + common_definitions: + file: CommonGlobalTypesServiceTemplate.yaml +data_types: + org.openecomp.datatypes.heat.substitution.SubstitutionFilter: + derived_from: tosca.datatypes.Root + description: Substitution Filter + properties: + substitute_service_template: + type: string + description: Substitute Service Template + required: true + status: SUPPORTED + index_variable: + type: string + description: Index variable + required: false + default: '%index%' + status: SUPPORTED + constraints: + - min_length: 3 + count: + type: string + description: Count + required: false + default: 1 + status: SUPPORTED + mandatory: + type: boolean + description: Mandatory + required: false + default: true + status: SUPPORTED +node_types: + org.openecomp.resource.abstract.nodes.AbstractSubstitute: + derived_from: tosca.nodes.Root + properties: + service_template_filter: + type: org.openecomp.datatypes.heat.substitution.SubstitutionFilter + description: Substitution Filter + required: true + status: SUPPORTED
\ No newline at end of file diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/extractServiceComposition/toscaGlobalServiceTemplates/CinderVolumeGlobalTypesServiceTemplate.yaml b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/extractServiceComposition/toscaGlobalServiceTemplates/CinderVolumeGlobalTypesServiceTemplate.yaml new file mode 100644 index 0000000000..3ef94f22e7 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/extractServiceComposition/toscaGlobalServiceTemplates/CinderVolumeGlobalTypesServiceTemplate.yaml @@ -0,0 +1,176 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +metadata: + template_name: CinderVolumeGlobalTypes + template_version: 1.0.0 +description: Cinder Volume TOSCA Global Types +relationship_types: + org.openecomp.relationships.heat.cinder.VolumeAttachesTo: + derived_from: tosca.relationships.AttachesTo + description: This type represents an attachment relationship for associating volume + properties: + volume_id: + type: string + description: The ID of the volume to be attached + required: true + status: SUPPORTED + location: + type: string + description: The location where the volume is exposed on the instance, mountpoint + required: false + status: SUPPORTED + instance_uuid: + type: string + description: The ID of the server to which the volume attaches + required: true + status: SUPPORTED + attributes: + show: + type: string + description: Detailed information about resource + status: SUPPORTED +node_types: + org.openecomp.resource.vfc.nodes.heat.cinder.Volume: + derived_from: tosca.nodes.BlockStorage + properties: + availability_zone: + type: string + description: The availability zone in which the volume will be created + required: false + status: SUPPORTED + image: + type: string + description: If specified, the name or ID of the image to create the volume from + required: false + status: SUPPORTED + metadata: + type: map + description: Key/value pairs to associate with the volume + required: false + status: SUPPORTED + entry_schema: + type: string + volume_type: + type: string + description: If specified, the type of volume to use, mapping to a specific backend + required: false + status: SUPPORTED + description: + type: string + description: A description of the volume + required: false + status: SUPPORTED + device_type: + type: string + description: Device type + required: false + status: SUPPORTED + constraints: + - valid_values: + - cdrom + - disk + disk_bus: + type: string + description: 'Bus of the device: hypervisor driver chooses a suitable default + if omitted' + required: false + status: SUPPORTED + constraints: + - valid_values: + - ide + - lame_bus + - scsi + - usb + - virtio + backup_id: + type: string + description: If specified, the backup to create the volume from + required: false + status: SUPPORTED + source_volid: + type: string + description: If specified, the volume to use as source + required: false + status: SUPPORTED + boot_index: + type: integer + description: Integer used for ordering the boot disks + required: false + status: SUPPORTED + size: + type: scalar-unit.size + description: The requested storage size (default unit is MB) + required: false + status: SUPPORTED + constraints: + - greater_or_equal: 1 GB + read_only: + type: boolean + description: Enables or disables read-only access mode of volume + required: false + status: SUPPORTED + name: + type: string + description: A name used to distinguish the volume + required: false + status: SUPPORTED + scheduler_hints: + type: map + description: Arbitrary key-value pairs specified by the client to help the Cinder scheduler creating a volume + required: false + status: SUPPORTED + entry_schema: + type: string + swap_size: + type: scalar-unit.size + description: The size of the swap, in MB + required: false + status: SUPPORTED + delete_on_termination: + type: boolean + description: Indicate whether the volume should be deleted when the server is terminated + required: false + status: SUPPORTED + multiattach: + type: boolean + description: Whether allow the volume to be attached more than once + required: false + status: SUPPORTED + attributes: + display_description: + type: string + description: Description of the volume + status: SUPPORTED + attachments: + type: string + description: The list of attachments of the volume + status: SUPPORTED + entry_schema: + type: string + encrypted: + type: boolean + description: Boolean indicating if the volume is encrypted or not + status: SUPPORTED + show: + type: string + description: Detailed information about resource + status: SUPPORTED + created_at: + type: timestamp + description: The timestamp indicating volume creation + status: SUPPORTED + display_name: + type: string + description: Name of the volume + status: SUPPORTED + metadata_values: + type: map + description: Key/value pairs associated with the volume in raw dict form + status: SUPPORTED + bootable: + type: boolean + description: Boolean indicating if the volume can be booted or not + status: SUPPORTED + status: + type: string + description: The current status of the volume + status: SUPPORTED diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/extractServiceComposition/toscaGlobalServiceTemplates/CommonGlobalTypesServiceTemplate.yaml b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/extractServiceComposition/toscaGlobalServiceTemplates/CommonGlobalTypesServiceTemplate.yaml new file mode 100644 index 0000000000..3388d5a89b --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/extractServiceComposition/toscaGlobalServiceTemplates/CommonGlobalTypesServiceTemplate.yaml @@ -0,0 +1,213 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +metadata: + template_name: CommonGlobalTypes + template_version: 1.0.0 +description: TOSCA Global Types +imports: + NativeTypesServiceTemplate: + file: NativeTypesServiceTemplateServiceTemplate.yaml +data_types: + org.openecomp.datatypes.heat.network.AddressPair: + derived_from: tosca.datatypes.Root + description: MAC/IP address pairs + properties: + mac_address: + type: string + description: MAC address + required: false + status: SUPPORTED + ip_address: + type: string + description: IP address + required: false + status: SUPPORTED + org.openecomp.datatypes.heat.network.subnet.HostRoute: + derived_from: tosca.datatypes.Root + description: Host route info for the subnet + properties: + destination: + type: string + description: The destination for static route + required: false + status: SUPPORTED + nexthop: + type: string + description: The next hop for the destination + required: false + status: SUPPORTED + org.openecomp.datatypes.heat.network.neutron.Subnet: + derived_from: tosca.datatypes.Root + description: A subnet represents an IP address block that can be used for assigning IP addresses to virtual instances + properties: + tenant_id: + type: string + description: The ID of the tenant who owns the network + required: false + status: SUPPORTED + enable_dhcp: + type: boolean + description: Set to true if DHCP is enabled and false if DHCP is disabled + required: false + default: true + status: SUPPORTED + ipv6_address_mode: + type: string + description: IPv6 address mode + required: false + status: SUPPORTED + constraints: + - valid_values: + - dhcpv6-stateful + - dhcpv6-stateless + - slaac + ipv6_ra_mode: + type: string + description: IPv6 RA (Router Advertisement) mode + required: false + status: SUPPORTED + constraints: + - valid_values: + - dhcpv6-stateful + - dhcpv6-stateless + - slaac + value_specs: + type: map + description: Extra parameters to include in the request + required: false + default: { + } + status: SUPPORTED + entry_schema: + type: string + allocation_pools: + type: list + description: The start and end addresses for the allocation pools + required: false + status: SUPPORTED + entry_schema: + type: org.openecomp.datatypes.heat.network.AllocationPool + subnetpool: + type: string + description: The name or ID of the subnet pool + required: false + status: SUPPORTED + dns_nameservers: + type: list + description: A specified set of DNS name servers to be used + required: false + default: [ + ] + status: SUPPORTED + entry_schema: + type: string + host_routes: + type: list + description: The gateway IP address + required: false + status: SUPPORTED + entry_schema: + type: org.openecomp.datatypes.heat.network.subnet.HostRoute + ip_version: + type: integer + description: The gateway IP address + required: false + default: 4 + status: SUPPORTED + constraints: + - valid_values: + - '4' + - '6' + name: + type: string + description: The name of the subnet + required: false + status: SUPPORTED + prefixlen: + type: integer + description: Prefix length for subnet allocation from subnet pool + required: false + status: SUPPORTED + constraints: + - greater_or_equal: 0 + cidr: + type: string + description: The CIDR + required: false + status: SUPPORTED + gateway_ip: + type: string + description: The gateway IP address + required: false + status: SUPPORTED + org.openecomp.datatypes.heat.network.AllocationPool: + derived_from: tosca.datatypes.Root + description: The start and end addresses for the allocation pool + properties: + start: + type: string + description: Start address for the allocation pool + required: false + status: SUPPORTED + end: + type: string + description: End address for the allocation pool + required: false + status: SUPPORTED +relationship_types: + org.openecomp.relationships.AttachesTo: + derived_from: tosca.relationships.Root + description: This type represents an attachment relationship +group_types: + org.openecomp.groups.heat.HeatStack: + derived_from: tosca.groups.Root + description: Grouped all heat resources which are in the same heat stack + properties: + heat_file: + type: string + description: Heat file which associate to this group/heat stack + required: true + status: SUPPORTED + description: + type: string + description: Heat file description + required: false + status: SUPPORTED +policy_types: + org.openecomp.policies.placement.Colocate: + derived_from: tosca.policy.placement + description: Keep associated nodes (groups of nodes) based upon affinity value + properties: + name: + type: string + description: The name of the policy + required: false + status: SUPPORTED + affinity: + type: string + description: affinity + required: true + status: SUPPORTED + constraints: + - valid_values: + - host + - region + - compute + org.openecomp.policies.placement.Antilocate: + derived_from: tosca.policy.placement + description: My placement policy for separation based upon container type value + properties: + name: + type: string + description: The name of the policy + required: false + status: SUPPORTED + container_type: + type: string + description: container type + required: false + status: SUPPORTED + constraints: + - valid_values: + - host + - region + - compute diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/extractServiceComposition/toscaGlobalServiceTemplates/ContrailNetworkRuleGlobalTypeServiceTemplate.yaml b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/extractServiceComposition/toscaGlobalServiceTemplates/ContrailNetworkRuleGlobalTypeServiceTemplate.yaml new file mode 100644 index 0000000000..98317310fa --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/extractServiceComposition/toscaGlobalServiceTemplates/ContrailNetworkRuleGlobalTypeServiceTemplate.yaml @@ -0,0 +1,117 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +metadata: + template_name: ContrailNetworkRuleGlobalType + template_version: 1.0.0 +description: Contrail Network Rule Global Types +imports: + common_definitions: + file: CommonGlobalTypesServiceTemplate.yaml +data_types: + org.openecomp.datatypes.heat.contrail.network.rule.PortPairs: + derived_from: tosca.datatypes.Root + description: source and destination port pairs + properties: + start_port: + type: string + description: Start port + required: false + status: SUPPORTED + end_port: + type: string + description: End port + required: false + status: SUPPORTED + org.openecomp.datatypes.heat.contrail.network.rule.Rule: + derived_from: tosca.datatypes.Root + description: policy rule + properties: + src_ports: + type: list + description: Source ports + required: false + status: SUPPORTED + entry_schema: + type: org.openecomp.datatypes.heat.contrail.network.rule.PortPairs + protocol: + type: string + description: Protocol + required: false + status: SUPPORTED + dst_addresses: + type: list + description: Destination addresses + required: false + status: SUPPORTED + entry_schema: + type: org.openecomp.datatypes.heat.contrail.network.rule.VirtualNetwork + apply_service: + type: string + description: Service to apply + required: false + status: SUPPORTED + dst_ports: + type: list + description: Destination ports + required: false + status: SUPPORTED + entry_schema: + type: org.openecomp.datatypes.heat.contrail.network.rule.PortPairs + src_addresses: + type: list + description: Source addresses + required: false + status: SUPPORTED + entry_schema: + type: org.openecomp.datatypes.heat.contrail.network.rule.VirtualNetwork + direction: + type: string + description: Direction + required: false + status: SUPPORTED + org.openecomp.datatypes.heat.contrail.network.rule.RuleList: + derived_from: tosca.datatypes.Root + description: list of policy rules + properties: + policy_rule: + type: list + description: Contrail network rule + required: false + status: SUPPORTED + entry_schema: + type: org.openecomp.datatypes.heat.contrail.network.rule.Rule + org.openecomp.datatypes.heat.contrail.network.rule.VirtualNetwork: + derived_from: tosca.datatypes.Root + description: source and destination addresses + properties: + virtual_network: + type: string + description: Virtual network + required: false + status: SUPPORTED +node_types: + org.openecomp.resource.nodes.heat.network.contrail.NetworkRules: + derived_from: tosca.nodes.Root + properties: + entries: + type: org.openecomp.datatypes.heat.contrail.network.rule.RuleList + description: A symbolic name for this contrail network rule + required: false + status: SUPPORTED + name: + type: string + description: A symbolic name for this contrail network rule + required: false + status: SUPPORTED + attributes: + fq_name: + type: string + description: fq_name + status: SUPPORTED + requirements: + - network: + capability: tosca.capabilities.Attachment + node: tosca.nodes.network.Network + relationship: org.openecomp.relationships.AttachesTo + occurrences: + - 0 + - UNBOUNDED diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/extractServiceComposition/toscaGlobalServiceTemplates/ContrailVirtualNetworkGlobalTypeServiceTemplate.yaml b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/extractServiceComposition/toscaGlobalServiceTemplates/ContrailVirtualNetworkGlobalTypeServiceTemplate.yaml new file mode 100644 index 0000000000..0927e3dd0e --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/extractServiceComposition/toscaGlobalServiceTemplates/ContrailVirtualNetworkGlobalTypeServiceTemplate.yaml @@ -0,0 +1,71 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +metadata: + template_name: ContrailVirtualNetworkGlobalType + template_version: 1.0.0 +description: Contrail Virtual Network Global Types +imports: + common_definitions: + file: CommonGlobalTypesServiceTemplate.yaml +node_types: + org.openecomp.resource.vl.nodes.heat.network.contrail.VirtualNetwork: + derived_from: tosca.nodes.network.Network + properties: + shared: + type: string + description: Is virtual network shared + required: false + status: SUPPORTED + forwarding_mode: + type: string + description: forwarding mode of the virtual network + required: false + status: SUPPORTED + external: + type: string + description: Is virtual network external + required: false + status: SUPPORTED + flood_unknown_unicast: + type: string + description: flood L2 packets on network + required: false + status: SUPPORTED + route_targets: + type: list + description: route targets associated with the virtual network + required: false + status: SUPPORTED + entry_schema: + type: string + subnets: + type: map + description: Network related subnets + required: false + status: SUPPORTED + entry_schema: + type: org.openecomp.datatypes.heat.network.neutron.Subnet + attributes: + subnets_name: + type: list + description: Subnets name of this network + status: SUPPORTED + entry_schema: + type: string + subnets_show: + type: map + description: Detailed information about each subnet + status: SUPPORTED + entry_schema: + type: string + subnets: + type: map + description: Network related subnets + status: SUPPORTED + entry_schema: + type: org.openecomp.datatypes.heat.network.neutron.Subnet + capabilities: + attachment: + type: tosca.capabilities.Attachment + occurrences: + - 1 + - UNBOUNDED diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/extractServiceComposition/toscaGlobalServiceTemplates/GlobalSubstitutionTypesServiceTemplate.yaml b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/extractServiceComposition/toscaGlobalServiceTemplates/GlobalSubstitutionTypesServiceTemplate.yaml new file mode 100644 index 0000000000..08c47bc646 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/extractServiceComposition/toscaGlobalServiceTemplates/GlobalSubstitutionTypesServiceTemplate.yaml @@ -0,0 +1,93 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +metadata: + template_name: GlobalSubstitutionTypes +imports: + NeutronPortGlobalTypes: + file: NeutronPortGlobalTypesServiceTemplate.yaml + NeutronNetGlobalTypes: + file: NeutronNetGlobalTypesServiceTemplate.yaml + CommonGlobalTypes: + file: CommonGlobalTypesServiceTemplate.yaml + CinderVolumeGlobalTypes: + file: CinderVolumeGlobalTypesServiceTemplate.yaml + ContrailNetworkRuleGlobalType: + file: ContrailNetworkRuleGlobalTypeServiceTemplate.yaml + NeutronSecurityRulesGlobalTypes: + file: NeutronSecurityRulesGlobalTypesServiceTemplate.yaml + NovaServerGlobalTypes: + file: NovaServerGlobalTypesServiceTemplate.yaml + ContrailVirtualNetworkGlobalType: + file: ContrailVirtualNetworkGlobalTypeServiceTemplate.yaml + AbstractSubstituteGlobalTypes: + file: AbstractSubstituteGlobalTypesServiceTemplate.yaml +node_types: + org.openecomp.resource.abstract.nodes.heat.nested: + derived_from: org.openecomp.resource.abstract.nodes.AbstractSubstitute + properties: + cmaui_names: + type: list + description: CMAUI1, CMAUI2 server names + entry_schema: + type: String + p1: + type: string + description: UID of OAM network + cmaui_image: + type: string + description: Image for CMAUI server + cmaui_flavor: + type: string + description: Flavor for CMAUI server + security_group_name: + description: not impotrtant + availability_zone_0: + type: string + description: availabilityzone name + requirements: + - local_storage_server_cmaui: + capability: tosca.capabilities.Attachment + node: tosca.nodes.BlockStorage + relationship: tosca.relationships.AttachesTo + occurrences: + - 0 + - UNBOUNDED + - link_cmaui_port_0: + capability: tosca.capabilities.network.Linkable + node: tosca.nodes.Root + relationship: tosca.relationships.network.LinksTo + occurrences: + - 1 + - 1 + capabilities: + host_server_cmaui: + type: tosca.capabilities.Container + valid_source_types: + - tosca.nodes.SoftwareComponent + occurrences: + - 1 + - UNBOUNDED + os_server_cmaui: + type: tosca.capabilities.OperatingSystem + occurrences: + - 1 + - UNBOUNDED + endpoint_server_cmaui: + type: tosca.capabilities.Endpoint.Admin + occurrences: + - 1 + - UNBOUNDED + binding_server_cmaui: + type: tosca.capabilities.network.Bindable + occurrences: + - 1 + - UNBOUNDED + scalable_server_cmaui: + type: tosca.capabilities.Scalable + occurrences: + - 1 + - UNBOUNDED + attachment_cmaui_port_0: + type: tosca.capabilities.Attachment + occurrences: + - 1 + - UNBOUNDED
\ No newline at end of file diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/extractServiceComposition/toscaGlobalServiceTemplates/NativeTypesServiceTemplateServiceTemplate.yaml b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/extractServiceComposition/toscaGlobalServiceTemplates/NativeTypesServiceTemplateServiceTemplate.yaml new file mode 100644 index 0000000000..e7dfd49ed9 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/extractServiceComposition/toscaGlobalServiceTemplates/NativeTypesServiceTemplateServiceTemplate.yaml @@ -0,0 +1,194 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +metadata: + template_name: NativeTypesServiceTemplate + template_version: 1.0.0 +description: TOSCA Native Node Types +node_types: + tosca.nodes.Compute: + derived_from: tosca.nodes.Root + attributes: + private_address: + type: string + description: private address + status: SUPPORTED + public_address: + type: string + description: public_address + status: SUPPORTED + networks: + type: map + description: networks + status: SUPPORTED + entry_schema: + type: tosca.datatypes.network.NetworkInfo + ports: + type: map + description: ports + status: SUPPORTED + entry_schema: + type: tosca.datatypes.network.PortInfo + requirements: + - local_storage: + capability: tosca.capabilities.Attachment + node: tosca.nodes.BlockStorage + relationship: tosca.relationships.AttachesTo + occurrences: + - 0 + - UNBOUNDED + capabilities: + scalable: + type: tosca.capabilities.Scalable + occurrences: + - 1 + - UNBOUNDED + endpoint: + type: tosca.capabilities.Endpoint.Admin + occurrences: + - 1 + - UNBOUNDED + os: + type: tosca.capabilities.OperatingSystem + occurrences: + - 1 + - UNBOUNDED + host: + type: tosca.capabilities.Container + valid_source_types: + - tosca.nodes.SoftwareComponent + occurrences: + - 1 + - UNBOUNDED + binding: + type: tosca.capabilities.network.Bindable + occurrences: + - 1 + - UNBOUNDED + tosca.nodes.network.Port: + derived_from: tosca.nodes.Root + properties: + ip_range_end: + type: string + required: false + status: SUPPORTED + ip_range_start: + type: string + required: false + status: SUPPORTED + ip_address: + type: string + required: false + status: SUPPORTED + is_default: + type: boolean + required: false + default: false + status: SUPPORTED + order: + type: integer + required: true + default: 0 + status: SUPPORTED + constraints: + - greater_or_equal: 0 + requirements: + - link: + capability: tosca.capabilities.network.Linkable + node: tosca.nodes.Root + relationship: tosca.relationships.network.LinksTo + - binding: + capability: tosca.capabilities.network.Bindable + node: tosca.nodes.Root + relationship: tosca.relationships.network.BindsTo + tosca.nodes.Root: + attributes: + tosca_name: + type: string + description: tosca name + status: SUPPORTED + state: + type: string + description: state + status: SUPPORTED + tosca_id: + type: string + description: tosca id + status: SUPPORTED + interfaces: { + } + tosca.nodes.network.Network: + derived_from: tosca.nodes.Root + properties: + physical_network: + type: string + required: false + status: SUPPORTED + segmentation_id: + type: string + required: false + status: SUPPORTED + network_id: + type: string + required: false + status: SUPPORTED + ip_version: + type: integer + required: false + default: 4 + status: SUPPORTED + constraints: + - valid_values: + - 4 + - 6 + start_ip: + type: string + required: false + status: SUPPORTED + network_name: + type: string + required: false + status: SUPPORTED + cidr: + type: string + required: false + status: SUPPORTED + gateway_ip: + type: string + required: false + status: SUPPORTED + network_type: + type: string + required: false + status: SUPPORTED + end_ip: + type: string + required: false + status: SUPPORTED + capabilities: + link: + type: tosca.capabilities.network.Linkable + occurrences: + - 1 + - UNBOUNDED + tosca.nodes.BlockStorage: + derived_from: tosca.nodes.Root + properties: + size: + type: scalar-unit.size + required: false + status: SUPPORTED + constraints: + - greater_or_equal: 1 MB + volume_id: + type: string + required: false + status: SUPPORTED + snapshot_id: + type: string + required: false + status: SUPPORTED + capabilities: + attachment: + type: tosca.capabilities.Attachment + occurrences: + - 1 + - UNBOUNDED diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/extractServiceComposition/toscaGlobalServiceTemplates/NeutronNetGlobalTypesServiceTemplate.yaml b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/extractServiceComposition/toscaGlobalServiceTemplates/NeutronNetGlobalTypesServiceTemplate.yaml new file mode 100644 index 0000000000..e80e2727c7 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/extractServiceComposition/toscaGlobalServiceTemplates/NeutronNetGlobalTypesServiceTemplate.yaml @@ -0,0 +1,97 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +metadata: + template_name: NeutronNetGlobalTypes + template_version: 1.0.0 +description: Neutron Network TOSCA Global Types +imports: + common_definitions: + file: CommonGlobalTypesServiceTemplate.yaml +node_types: + org.openecomp.resource.vl.nodes.heat.network.neutron.Net: + derived_from: tosca.nodes.network.Network + properties: + dhcp_agent_ids: + type: list + description: The IDs of the DHCP agent to schedule the network + required: false + status: SUPPORTED + entry_schema: + type: string + tenant_id: + type: string + description: The ID of the tenant which will own the network + required: false + status: SUPPORTED + port_security_enabled: + type: boolean + description: Flag to enable/disable port security on the network + required: false + status: SUPPORTED + shared: + type: boolean + description: Whether this network should be shared across all tenants + required: false + default: false + status: SUPPORTED + admin_state_up: + type: boolean + description: A boolean value specifying the administrative status of the network + required: false + default: true + status: SUPPORTED + qos_policy: + type: string + description: The name or ID of QoS policy to attach to this network + required: false + status: SUPPORTED + subnets: + type: map + description: Network related subnets + required: false + status: SUPPORTED + entry_schema: + type: org.openecomp.datatypes.heat.network.neutron.Subnet + value_specs: + type: map + description: Extra parameters to include in the request + required: false + default: { + } + status: SUPPORTED + entry_schema: + type: string + attributes: + qos_policy_id: + type: string + description: The QoS policy ID attached to this network + status: SUPPORTED + show: + type: string + description: Detailed information about resource + status: SUPPORTED + subnets_name: + type: list + description: Subnets name of this network + status: SUPPORTED + entry_schema: + type: string + subnets: + type: map + description: Network related subnets + status: SUPPORTED + entry_schema: + type: org.openecomp.datatypes.heat.network.neutron.Subnet + mtu: + type: scalar-unit.size + description: The maximum transmission unit size(in bytes) for the network + status: SUPPORTED + status: + type: string + description: The status of the network + status: SUPPORTED + capabilities: + attachment: + type: tosca.capabilities.Attachment + occurrences: + - 1 + - UNBOUNDED diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/extractServiceComposition/toscaGlobalServiceTemplates/NeutronPortGlobalTypesServiceTemplate.yaml b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/extractServiceComposition/toscaGlobalServiceTemplates/NeutronPortGlobalTypesServiceTemplate.yaml new file mode 100644 index 0000000000..a337d6ed18 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/extractServiceComposition/toscaGlobalServiceTemplates/NeutronPortGlobalTypesServiceTemplate.yaml @@ -0,0 +1,151 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +metadata: + template_name: NeutronPortGlobalTypes + template_version: 1.0.0 +description: Neutron Port TOSCA Global Types +imports: + common_definitions: + file: CommonGlobalTypesServiceTemplate.yaml +data_types: + org.openecomp.datatypes.heat.neutron.port.FixedIps: + derived_from: tosca.datatypes.Root + description: subnet/ip_address + properties: + subnet: + type: string + description: Subnet in which to allocate the IP address for this port + required: false + status: SUPPORTED + ip_address: + type: string + description: IP address desired in the subnet for this port + required: false + status: SUPPORTED +node_types: + org.openecomp.resource.cp.nodes.heat.network.neutron.Port: + derived_from: tosca.nodes.network.Port + properties: + port_security_enabled: + type: boolean + description: Flag to enable/disable port security on the network + required: false + status: SUPPORTED + device_id: + type: string + description: Device ID of this port + required: false + status: SUPPORTED + qos_policy: + type: string + description: The name or ID of QoS policy to attach to this network + required: false + status: SUPPORTED + allowed_address_pairs: + type: list + description: Additional MAC/IP address pairs allowed to pass through the port + required: false + status: SUPPORTED + entry_schema: + type: org.openecomp.datatypes.heat.network.AddressPair + binding:vnic_type: + type: string + description: The vnic type to be bound on the neutron port + required: false + status: SUPPORTED + constraints: + - valid_values: + - macvtap + - direct + - normal + value_specs: + type: map + description: Extra parameters to include in the request + required: false + default: { + } + status: SUPPORTED + entry_schema: + type: string + device_owner: + type: string + description: Name of the network owning the port + required: false + status: SUPPORTED + network: + type: string + description: Network this port belongs to + required: false + status: SUPPORTED + replacement_policy: + type: string + description: Policy on how to respond to a stack-update for this resource + required: false + default: AUTO + status: SUPPORTED + constraints: + - valid_values: + - REPLACE_ALWAYS + - AUTO + security_groups: + type: list + description: List of security group names or IDs + required: false + status: SUPPORTED + entry_schema: + type: string + fixed_ips: + type: list + description: Desired IPs for this port + required: false + status: SUPPORTED + entry_schema: + type: org.openecomp.datatypes.heat.neutron.port.FixedIps + mac_address: + type: string + description: MAC address to give to this port + required: false + status: SUPPORTED + admin_state_up: + type: boolean + description: A boolean value specifying the administrative status of the network + required: false + default: true + status: SUPPORTED + name: + type: string + description: A symbolic name for this port + required: false + status: SUPPORTED + attributes: + tenant_id: + type: string + description: Tenant owning the port + status: SUPPORTED + network_id: + type: string + description: Unique identifier for the network owning the port + status: SUPPORTED + qos_policy_id: + type: string + description: The QoS policy ID attached to this network + status: SUPPORTED + show: + type: string + description: Detailed information about resource + status: SUPPORTED + subnets: + type: list + description: Subnets of this network + status: SUPPORTED + entry_schema: + type: string + status: + type: string + description: The status of the network + status: SUPPORTED + capabilities: + attachment: + type: tosca.capabilities.Attachment + occurrences: + - 1 + - UNBOUNDED
\ No newline at end of file diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/extractServiceComposition/toscaGlobalServiceTemplates/NeutronSecurityRulesGlobalTypesServiceTemplate.yaml b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/extractServiceComposition/toscaGlobalServiceTemplates/NeutronSecurityRulesGlobalTypesServiceTemplate.yaml new file mode 100644 index 0000000000..49c9a102c8 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/extractServiceComposition/toscaGlobalServiceTemplates/NeutronSecurityRulesGlobalTypesServiceTemplate.yaml @@ -0,0 +1,116 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +metadata: + template_name: NeutronSecurityRulesGlobalTypes + template_version: 1.0.0 +description: Neutron Security Rules TOSCA Global Types +imports: + common_definitions: + file: CommonGlobalTypesServiceTemplate.yaml +data_types: + org.openecomp.datatypes.heat.network.neutron.SecurityRules.Rule: + derived_from: tosca.datatypes.Root + description: Rules Pairs + properties: + remote_group_id: + type: string + description: The remote group ID to be associated with this security group rule + required: false + status: SUPPORTED + protocol: + type: string + description: The protocol that is matched by the security group rule + required: false + status: SUPPORTED + constraints: + - valid_values: + - tcp + - udp + - icmp + ethertype: + type: string + description: Ethertype of the traffic + required: false + default: IPv4 + status: SUPPORTED + constraints: + - valid_values: + - IPv4 + - IPv6 + port_range_max: + type: integer + description: 'The maximum port number in the range that is matched by the + security group rule. ' + required: false + status: SUPPORTED + constraints: + - in_range: + - 0 + - 65535 + remote_ip_prefix: + type: string + description: The remote IP prefix (CIDR) to be associated with this security group rule + required: false + status: SUPPORTED + remote_mode: + type: string + description: Whether to specify a remote group or a remote IP prefix + required: false + default: remote_ip_prefix + status: SUPPORTED + constraints: + - valid_values: + - remote_ip_prefix + - remote_group_id + direction: + type: string + description: The direction in which the security group rule is applied + required: false + default: ingress + status: SUPPORTED + constraints: + - valid_values: + - egress + - ingress + port_range_min: + type: integer + description: The minimum port number in the range that is matched by the security group rule. + required: false + status: SUPPORTED + constraints: + - in_range: + - 0 + - 65535 +node_types: + org.openecomp.resource.nodes.heat.network.neutron.SecurityRules: + derived_from: tosca.nodes.Root + properties: + description: + type: string + description: Description of the security group + required: false + status: SUPPORTED + name: + type: string + description: A symbolic name for this security group, which is not required to be unique. + required: false + status: SUPPORTED + rules: + type: list + description: List of security group rules + required: false + status: SUPPORTED + entry_schema: + type: org.openecomp.datatypes.heat.network.neutron.SecurityRules.Rule + attributes: + show: + type: string + description: Detailed information about resource + status: SUPPORTED + requirements: + - port: + capability: tosca.capabilities.Attachment + node: org.openecomp.resource.cp.nodes.heat.network.neutron.Port + relationship: org.openecomp.relationships.AttachesTo + occurrences: + - 0 + - UNBOUNDED
\ No newline at end of file diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/extractServiceComposition/toscaGlobalServiceTemplates/NovaServerGlobalTypesServiceTemplate.yaml b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/extractServiceComposition/toscaGlobalServiceTemplates/NovaServerGlobalTypesServiceTemplate.yaml new file mode 100644 index 0000000000..2253a1e4af --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/extractServiceComposition/toscaGlobalServiceTemplates/NovaServerGlobalTypesServiceTemplate.yaml @@ -0,0 +1,249 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +metadata: + template_name: NovaServerGlobalTypes + template_version: 1.0.0 +description: Nova Server TOSCA Global Types +imports: + common_definitions: + file: CommonGlobalTypesServiceTemplate.yaml +data_types: + org.openecomp.datatypes.heat.novaServer.network.PortExtraProperties: + derived_from: tosca.datatypes.Root + description: Nova server network expand properties for port + properties: + port_security_enabled: + type: boolean + description: Flag to enable/disable port security on the port + required: false + status: SUPPORTED + mac_address: + type: string + description: MAC address to give to this port + required: false + status: SUPPORTED + admin_state_up: + type: boolean + description: The administrative state of this port + required: false + default: true + status: SUPPORTED + qos_policy: + type: string + description: The name or ID of QoS policy to attach to this port + required: false + status: SUPPORTED + allowed_address_pairs: + type: list + description: Additional MAC/IP address pairs allowed to pass through the port + required: false + status: SUPPORTED + entry_schema: + type: org.openecomp.datatypes.heat.network.AddressPair + binding:vnic_type: + type: string + description: The vnic type to be bound on the neutron port + required: false + status: SUPPORTED + constraints: + - valid_values: + - macvtap + - direct + - normal + value_specs: + type: map + description: Extra parameters to include in the request + required: false + default: { + } + status: SUPPORTED + entry_schema: + type: string + org.openecomp.datatypes.heat.novaServer.network.AddressInfo: + derived_from: tosca.datatypes.network.NetworkInfo + description: Network addresses with corresponding port id + properties: + port_id: + type: string + description: Port id + required: false + status: SUPPORTED +node_types: + org.openecomp.resource.vfc.nodes.heat.nova.Server: + derived_from: tosca.nodes.Compute + properties: + admin_pass: + type: string + description: The administrator password for the server + required: false + status: SUPPORTED + availability_zone: + type: string + description: Availability zone to create servers in + required: false + status: SUPPORTED + image: + type: string + description: The ID or name of the image to boot with + required: false + status: SUPPORTED + image_update_policy: + type: string + description: Policy on how to apply an image-id update + required: false + default: REBUILD + status: SUPPORTED + constraints: + - valid_values: + - REBUILD_PRESERVE_EPHEMERAL + - REPLACE + - REBUILD + metadata: + type: map + description: Arbitrary key/value metadata to store for this server + required: false + status: SUPPORTED + constraints: + - max_length: 255 + entry_schema: + type: string + constraints: + - max_length: 255 + user_data_update_policy: + type: string + description: Policy on how to apply a user_data update + required: false + default: REPLACE + status: SUPPORTED + constraints: + - valid_values: + - REPLACE + - IGNORE + flavor_update_policy: + type: string + description: Policy on how to apply a flavor update + required: false + default: RESIZE + status: SUPPORTED + constraints: + - valid_values: + - RESIZE + - REPLACE + user_data: + type: string + description: User data script to be executed by cloud-init + required: false + default: '' + status: SUPPORTED + flavor: + type: string + description: The ID or name of the flavor to boot onto + required: true + status: SUPPORTED + key_name: + type: string + description: Name of keypair to inject into the server + required: false + status: SUPPORTED + reservation_id: + type: string + description: A UUID for the set of servers being requested + required: false + status: SUPPORTED + security_groups: + type: list + description: List of security group names or IDs + required: false + default: [ + ] + status: SUPPORTED + entry_schema: + type: string + config_drive: + type: boolean + description: enable config drive on the server + required: false + status: SUPPORTED + personality: + type: map + description: A map of files to create/overwrite on the server upon boot + required: false + default: { + } + status: SUPPORTED + entry_schema: + type: string + software_config_transport: + type: string + description: How the server should receive the metadata required for software configuration + required: false + default: POLL_SERVER_CFN + status: SUPPORTED + constraints: + - valid_values: + - POLL_SERVER_CFN + - POLL_SERVER_HEAT + - POLL_TEMP_URL + - ZAQAR_MESSAGE + user_data_format: + type: string + description: How the user_data should be formatted for the server + required: false + default: HEAT_CFNTOOLS + status: SUPPORTED + constraints: + - valid_values: + - SOFTWARE_CONFIG + - RAW + - HEAT_CFNTOOLS + diskConfig: + type: string + description: Control how the disk is partitioned when the server is created + required: false + status: SUPPORTED + constraints: + - valid_values: + - AUTO + - MANUAL + name: + type: string + description: Server name + required: false + status: SUPPORTED + scheduler_hints: + type: map + description: Arbitrary key-value pairs specified by the client to help boot a server + required: false + status: SUPPORTED + entry_schema: + type: string + attributes: + accessIPv4: + type: string + description: The manually assigned alternative public IPv4 address of the server + status: SUPPORTED + addresses: + type: map + description: A dict of all network addresses with corresponding port_id + status: SUPPORTED + entry_schema: + type: org.openecomp.datatypes.heat.novaServer.network.AddressInfo + accessIPv6: + type: string + description: The manually assigned alternative public IPv6 address of the server + status: SUPPORTED + instance_name: + type: string + description: AWS compatible instance name + status: SUPPORTED + name: + type: string + description: Name of the server + status: SUPPORTED + show: + type: string + description: Detailed information about resource + status: SUPPORTED + console_urls: + type: string + description: URLs of servers consoles + status: SUPPORTED
\ No newline at end of file diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/fullComposition/MANIFEST.json b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/fullComposition/MANIFEST.json new file mode 100644 index 0000000000..40c2b4c296 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/fullComposition/MANIFEST.json @@ -0,0 +1,17 @@ +{ + "name": "hot-mog", + "description": "HOT template to create hot mog server", + "version": "2013-05-23", + "data": [ + { + "file": "hot-mog-0108-bs1271.yml", + "type": "HEAT", + "data": [ + { + "file": "hot-mog-0108-bs1271.env", + "type": "HEAT_ENV" + } + ] + } + ] +} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/fullComposition/hot-mog-0108-bs1271.env b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/fullComposition/hot-mog-0108-bs1271.env new file mode 100644 index 0000000000..407bc8db30 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/fullComposition/hot-mog-0108-bs1271.env @@ -0,0 +1,60 @@ +parameters: + pd_server_names: ZRDM1MOGX01MPD001,ZRDM1MOGX01MPD002 + pd_image_name: MOG_BASE_8.0 + pd_flavor_name: m3.xlarge + oam_server_names: ZRDM1MOGX01OAM001,ZRDM1MOGX01OAM002 + oam_image_name: MOG_BASE_8.0 + oam_flavor_name: m3.xlarge + sm_server_names: ZRDM1MOGX01MSM001,ZRDM1MOGX01MSM002 + sm_image_name: MOG_BASE_8.0 + sm_flavor_name: m2.xlarge4 + ps_server_names: ZRDM1MOGX01MPS001,ZRDM1MOGX01MPS002,ZRDM1MOGX01MPS003,ZRDM1MOGX01MPS004 + ps_image_name: MOG_BASE_8.0 + ps_flavor_name: m3.xlarge + cm_server_names: ZRDM1MOGX01MCM001 + cm_image_name: MOG_BASE_8.0 + cm_flavor_name: m3.xlarge + availabilityzone_name: nova + oam_net_name: oam_protected_net_0 + oam_net_ips: 107.250.172.213,107.250.172.214,107.250.172.215,107.250.172.216,107.250.172.217 + #internet_net_name: dmz_protected_net_0 + #internet_net_ips: 107.239.53.4,107.239.53.5 + # internet_net_floating_ip: 107.239.53.6 + sl_net_name: exn_protected_net_0 + sl_net_ips: 107.239.45.4,107.239.45.5 + sl_net_floating_ip: 107.239.45.6 + repl_net_name: cor_direct_net_0 + repl_net_ips: 107.239.33.57,107.239.33.58 + rx_net_name: cor_direct_net_1 + rx_net_ips: 107.239.34.3,107.239.34.4 + rx_net_floating_ip: 107.239.34.5 + ran_net_name: gn_direct_net_0 + ran_net_ips: 107.239.36.3,107.239.36.4 + ran_net_floating_ip: 107.239.36.5 + dummy_net_name_0: mog_dummy_0 + dummy_net_start_0: 169.254.1.4 + dummy_net_end_0: 169.254.1.254 + dummy_net_cidr_0: 169.254.1.0/24 + dummy_net_netmask_0: 255.255.255.0 + dummy_net_name_1: mog_dummy_1 + dummy_net_start_1: 169.254.2.4 + dummy_net_end_1: 169.254.2.254 + dummy_net_cidr_1: 169.254.2.0/24 + dummy_net_netmask_1: 255.255.255.0 + csb_net_name: int_mog_csb_net + csb_net_ips: 172.26.0.10,172.26.0.11,172.26.0.12,172.26.0.13,172.26.0.14,172.26.0.15,172.26.0.16,172.26.0.17,172.26.0.18,172.26.0.19,172.26.0.20 + csb_net_start: 172.26.0.1 + csb_net_end: 172.26.0.254 + csb_net_cidr: 172.26.0.0/24 + csb_net_netmask: 255.255.255.0 + security_group_name: mog_security_group + mog_swift_container: http://10.147.38.210:8080/v1/AUTH_8e501b8121f34a6eaaf526d3305985cc/mogtestcontainer + mog_script_dir: /root + mog_script_name: http://10.147.38.210:8080/v1/AUTH_8e501b8121f34a6eaaf526d3305985cc/mogtestcontainer/mog-cloudinit.sh + mog_parameter_name: http://10.147.38.210:8080/v1/AUTH_8e501b8121f34a6eaaf526d3305985cc/mogtestcontainer + cluster-manager-vol-1: 43ccf5ba-2d50-427b-a38f-e8c7d8670eee + session-manager-vol-1: 49201898-333d-4c88-b58d-cf573b091633 + session-manager-vol-2: 4c35b5f1-ce99-4220-a6e2-cda6e2d713a0 + oam-vol-1: 0a7fcd9e-2624-401d-ac21-b0191f85ec77 + oam-vol-2: 6d169cb6-6ddc-41dc-920c-2839898a2924 + cluster-manager-vol-2: 6f92e211-2d61-487d-8f84-d2d00cea3698 diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/fullComposition/hot-mog-0108-bs1271.yml b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/fullComposition/hot-mog-0108-bs1271.yml new file mode 100644 index 0000000000..85ca654ce1 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/fullComposition/hot-mog-0108-bs1271.yml @@ -0,0 +1,733 @@ +heat_template_version: 2013-05-23 + +description: heat template that creates MOG stack + +parameters: + pd_server_names: + type: comma_delimited_list + label: PD server names + description: name of the PD instance + pd_image_name: + type: string + label: image name + description: PD image name + pd_flavor_name: + type: string + label: PD flavor name + description: flavor name of PD instance + oam_server_names: + type: comma_delimited_list + label: OAM server names + description: name of the OAM instance + oam_image_name: + type: string + label: image name + description: OAM image name + oam_flavor_name: + type: string + label: OAM flavor name + description: flavor name of OAM instance + sm_server_names: + type: comma_delimited_list + label: SM server names + description: name of the SM instance + sm_image_name: + type: string + label: image name + description: SM image name + sm_flavor_name: + type: string + label: SM flavor name + description: flavor name of SM instance + ps_server_names: + type: comma_delimited_list + label: PS server names + description: name of the PS instance + ps_image_name: + type: string + label: PS image name + description: PS image name + ps_flavor_name: + type: string + label: PS flavor name + description: flavor name of PS instance + cm_server_names: + type: comma_delimited_list + label: CM server names + description: name of the CM instance + cm_image_name: + type: string + label: image name + description: CM image name + cm_flavor_name: + type: string + label: CM flavor name + description: flavor name of CM instance + availabilityzone_name: + type: string + label: availabilityzone name + description: availabilityzone name + oam_net_name: + type: string + label: oam network name + description: name of the oam network + oam_net_ips: + type: comma_delimited_list + label: internet network ips + description: ip of the OAM network + # internet_net_name: + # type: string + # label: internet network name + # description: id of the internet network + # internet_net_ips: + # type: comma_delimited_list + # label: internet network ips + # description: ip of the internet network + # internet_net_floating_ip: + # type: string + # label: mog internet virtual ip + # description: mog internet virtual ip + sl_net_name: + type: string + label: silver lining network name + description: id of the sl network + sl_net_ips: + type: comma_delimited_list + label: silver lining network ips + description: ips of the sl network + sl_net_floating_ip: + type: string + label: mog sl net virtual ip + description: mog sl net virtual ip + repl_net_name: + type: string + label: Replication network name + description: name of the replication network + repl_net_ips: + type: comma_delimited_list + label: repl network ips + description: ips of repl network + rx_net_name: + type: string + label: Rx network name + description: Rx network name + rx_net_ips: + type: comma_delimited_list + label: Rx network ips + description: Rx network ips + rx_net_floating_ip: + type: string + label: mog rx net virtual ip + description: mog rx net virtual ip + ran_net_name: + type: string + label: RAN network name + description: RAN network name + ran_net_ips: + type: comma_delimited_list + label: RAN network ips + description: RAN network ip + ran_net_floating_ip: + type: string + label: mog ran net virtual ip + description: mog ran net virtual ip + csb_net_name: + type: string + label: csb internal network name + description: csb internal network name + csb_net_start: + type: string + label: csb internal start + description: csb internal start + csb_net_end: + type: string + label: csb internal end + description: csb internal end + csb_net_cidr: + type: string + label: csb ineternal cidr + description: csb internal cidr + csb_net_netmask: + type: string + description: CSB internal network subnet mask + csb_net_ips: + type: comma_delimited_list + description: mog_csb_net IP addresses + dummy_net_name_0: + type: string + label: csb internal network name + description: csb internal network name + dummy_net_start_0: + type: string + label: csb internal start + description: csb internal start + dummy_net_end_0: + type: string + label: csb internal end + description: csb internal end + dummy_net_cidr_0: + type: string + label: csb ineternal cidr + description: csb internal cidr + dummy_net_netmask_0: + type: string + description: CSB internal network subnet mask + dummy_net_name_1: + type: string + label: csb internal network name + description: csb internal network name + dummy_net_start_1: + type: string + label: csb internal start + description: csb internal start + dummy_net_end_1: + type: string + label: csb internal end + description: csb internal end + dummy_net_cidr_1: + type: string + label: csb ineternal cidr + description: csb internal cidr + dummy_net_netmask_1: + type: string + description: CSB internal network subnet mask + + security_group_name: + type: string + label: security group name + description: the name of security group + cluster-manager-vol-1: + type: string + label: mog-cm-vol-1 + description: Cluster Manager volume 1 + session-manager-vol-1: + type: string + label: mog-sm-vol-1 + description: Session Manager volume 1 + session-manager-vol-2: + type: string + label: mog-sm-vol-2 + description: Session Manager volume 2 + oam-vol-1: + type: string + label: mog-oam-vol-1 + description: OAM volume 1 + oam-vol-2: + type: string + label: mog-oam-vol-2 + description: OAM volume 2 + mog_swift_container: + type: string + label: mog Config URL + description: Config URL + mog_script_dir: + type: string + label: mog Config script directory + description: Config script directory + mog_script_name: + type: string + label: mog Config script name + description: Config script name + mog_parameter_name: + type: string + label: mog script parameter name + description: Config script parameter csv file name + cluster-manager-vol-2: + type: string + label: mog-cm-vol-2 + description: Cluster Manager volume 2 with ISO image + +resources: + mog_security_group: + type: OS::Neutron::SecurityGroup + properties: + description: mog security group + name: {get_param: security_group_name} + rules: [{"direction": egress, "ethertype": IPv4, "port_range_min": 1, "port_range_max": 65535, "protocol": tcp, "remote_ip_prefix": 0.0.0.0/0}, + {"direction": egress, "ethertype": IPv4, "port_range_min": 1, "port_range_max": 65535, "protocol": udp, "remote_ip_prefix": 0.0.0.0/0}, + {"direction": egress, "ethertype": IPv4, "protocol": icmp, "remote_ip_prefix": 0.0.0.0/0}, + {"direction": ingress, "ethertype": IPv4, "port_range_min": 1, "port_range_max": 65535, "protocol": tcp, "remote_ip_prefix": 0.0.0.0/0}, + {"direction": ingress, "ethertype": IPv4, "port_range_min": 1, "port_range_max": 65535, "protocol": udp, "remote_ip_prefix": 0.0.0.0/0}, + {"direction": ingress, "ethertype": IPv4, "protocol": icmp, "remote_ip_prefix": 0.0.0.0/0} + ] + + csb_net: + type: OS::Contrail::VirtualNetwork + properties: + name: { get_param: csb_net_name} + + csb_ip_subnet: + type: OS::Neutron::Subnet + properties: + name: {get_param: csb_net_name} + network_id: { get_resource: csb_net } + cidr: { get_param: csb_net_cidr } + allocation_pools: [{"start": {get_param: csb_net_start}, "end": {get_param: csb_net_end}}] + enable_dhcp: true + + dummy_net_0: + type: OS::Contrail::VirtualNetwork + properties: + name: { get_param: dummy_net_name_0} + + dummy_ip_subnet_0: + type: OS::Neutron::Subnet + properties: + name: {get_param: dummy_net_name_0} + network_id: { get_resource: dummy_net_0 } + cidr: { get_param: dummy_net_cidr_0 } + allocation_pools: [{"start": {get_param: dummy_net_start_0}, "end": {get_param: dummy_net_end_0}}] + enable_dhcp: true + + dummy_net_1: + type: OS::Contrail::VirtualNetwork + properties: + name: { get_param: dummy_net_name_1} + + dummy_ip_subnet_1: + type: OS::Neutron::Subnet + properties: + name: {get_param: dummy_net_name_1} + network_id: { get_resource: dummy_net_1 } + cidr: { get_param: dummy_net_cidr_1 } + allocation_pools: [{"start": {get_param: dummy_net_start_1}, "end": {get_param: dummy_net_end_1}}] + enable_dhcp: true + + + mogconfig: + type: OS::Heat::SoftwareConfig + properties: + group: ungrouped + config: + str_replace: + template: | + #!/bin/bash + wget -P script_dir swift_container/script_name + wget -P script_dir swift_container/parameter_name + chmod 755 script_dir/script_name + script_dir/script_name + params: + swift_container: {get_param: mog_swift_container} + script_dir: {get_param: mog_script_dir} + script_name: {get_param: mog_script_name} + #parameter_name: {get_param: mog_parameter_name} + + + servergroup_mog01: + type: OS::Nova::ServerGroup + properties: + policies: + - anti-affinity + server_pd_01: + type: OS::Nova::Server + properties: +# config_drive: "True" + name: {get_param: [pd_server_names, 0]} + image: {get_param: pd_image_name} + flavor: {get_param: pd_flavor_name} + availability_zone: {get_param: availabilityzone_name} + networks: + - port: {get_resource: pd01_port_0} + - port: {get_resource: pd01_port_1} + - port: {get_resource: pd01_port_2} + - port: {get_resource: pd01_port_3} + - port: {get_resource: pd01_port_4} + - port: {get_resource: pd01_port_5} + - port: {get_resource: pd01_port_6} + # - port: {get_resource: pd01_port_7} + user_data: + scheduler_hints: {group: {get_resource: servergroup_mog01}} + user_data_format: RAW + + + pd01_port_0: + type: OS::Neutron::Port + properties: + network: {get_resource: csb_net} + security_groups: [{get_resource: mog_security_group}] + pd01_port_1: + type: OS::Neutron::Port + properties: + network: {get_param: oam_net_name} + fixed_ips: [{"ip_address": {get_param: [oam_net_ips, 0]}}] + security_groups: [{get_resource: mog_security_group}] + pd01_port_2: + type: OS::Neutron::Port + properties: + network: {get_resource: dummy_net_0} + security_groups: [{get_resource: mog_security_group}] + pd01_port_3: + type: OS::Neutron::Port + properties: + network: {get_param: rx_net_name} + fixed_ips: [{"ip_address": {get_param: [rx_net_ips, 0]}}] + allowed_address_pairs: [{"ip_address": {get_param: rx_net_floating_ip} }] + security_groups: [{get_resource: mog_security_group}] + pd01_port_4: + type: OS::Neutron::Port + properties: + network: {get_resource: dummy_net_1} + security_groups: [{get_resource: mog_security_group}] + pd01_port_5: + type: OS::Neutron::Port + properties: + network: {get_param: ran_net_name} + fixed_ips: [{"ip_address": {get_param: [ran_net_ips, 0]}}] + allowed_address_pairs: [{"ip_address": {get_param: ran_net_floating_ip} }] + security_groups: [{get_resource: mog_security_group}] + + pd01_port_6: + type: OS::Neutron::Port + properties: + network: {get_param: sl_net_name} + fixed_ips: [{"ip_address": {get_param: [sl_net_ips, 0]}}] + allowed_address_pairs: [{"ip_address": {get_param: sl_net_floating_ip}}] + security_groups: [{get_resource: mog_security_group}] + + # pd01_port_7: + #j type: OS::Neutron::Port + # properties: + # network: {get_param: internet_net_name} + # fixed_ips: [{"ip_address": {get_param: [internet_net_ips, 0]}}] + # allowed_address_pairs: [{"ip_address": {get_param: internet_net_floating_ip} }] + # security_groups: [{get_resource: mog_security_group}] + + server_pd_02: + type: OS::Nova::Server + properties: +# config_drive: "True" + name: {get_param: [pd_server_names, 1]} + image: {get_param: pd_image_name} + flavor: {get_param: pd_flavor_name} + availability_zone: {get_param: availabilityzone_name} + networks: + - port: {get_resource: pd02_port_0} + - port: {get_resource: pd02_port_1} + - port: {get_resource: pd02_port_2} + - port: {get_resource: pd02_port_3} + - port: {get_resource: pd02_port_4} + - port: {get_resource: pd02_port_5} + - port: {get_resource: pd02_port_6} + # - port: {get_resource: pd02_port_7} + + user_data: + scheduler_hints: {group: {get_resource: servergroup_mog01}} + user_data_format: RAW + + pd02_port_0: + type: OS::Neutron::Port + properties: + network: {get_resource: csb_net} + security_groups: [{get_resource: mog_security_group}] + + pd02_port_1: + type: OS::Neutron::Port + properties: + network: {get_param: oam_net_name} + fixed_ips: [{"ip_address": {get_param: [oam_net_ips, 1]}}] + security_groups: [{get_resource: mog_security_group}] + + pd02_port_2: + type: OS::Neutron::Port + properties: + network: {get_resource: dummy_net_0} + security_groups: [{get_resource: mog_security_group}] + + pd02_port_3: + type: OS::Neutron::Port + properties: + network: {get_param: rx_net_name} + fixed_ips: [{"ip_address": {get_param: [rx_net_ips, 1]}}] + allowed_address_pairs: [{"ip_address": {get_param: rx_net_floating_ip} }] + security_groups: [{get_resource: mog_security_group}] + + pd02_port_4: + type: OS::Neutron::Port + properties: + network: {get_resource: dummy_net_1} + security_groups: [{get_resource: mog_security_group}] + + pd02_port_5: + type: OS::Neutron::Port + properties: + network: {get_param: ran_net_name} + fixed_ips: [{"ip_address": {get_param: [ran_net_ips, 1]}}] + allowed_address_pairs: [{"ip_address": {get_param: ran_net_floating_ip} }] + security_groups: [{get_resource: mog_security_group}] + + pd02_port_6: + type: OS::Neutron::Port + properties: + network: {get_param: sl_net_name} + fixed_ips: [{"ip_address": {get_param: [sl_net_ips, 1]}}] + allowed_address_pairs: [{"ip_address": {get_param: sl_net_floating_ip}}] + security_groups: [{get_resource: mog_security_group}] + + # pd02_port_7: + # type: OS::Neutron::Port + # properties: + # network: {get_param: internet_net_name} + # fixed_ips: [{"ip_address": {get_param: [internet_net_ips, 1]}}] + # allowed_address_pairs: [{"ip_address": {get_param: internet_net_floating_ip} }] + # security_groups: [{get_resource: mog_security_group}] + + servergroup_mog02: + type: OS::Nova::ServerGroup + properties: + policies: + - anti-affinity + server_oam01: + type: OS::Nova::Server + properties: +# config_drive: "True" + name: {get_param: [oam_server_names, 0]} + image: {get_param: oam_image_name} + flavor: {get_param: oam_flavor_name} + availability_zone: {get_param: availabilityzone_name} + networks: + - port: {get_resource: oam01_port_0} + - port: {get_resource: oam01_port_1} +# block_device_mapping: +# - device_name: vdd +# volume_id: { get_param: oam-vol-1 } + user_data: + scheduler_hints: {group: {get_resource: servergroup_mog02}} + user_data_format: RAW + + oam01_port_0: + type: OS::Neutron::Port + properties: + network: {get_resource: csb_net} + security_groups: [{get_resource: mog_security_group}] + + oam01_port_1: + type: OS::Neutron::Port + properties: + network: {get_param: oam_net_name} + fixed_ips: [{"ip_address": {get_param: [oam_net_ips, 2]}}] + security_groups: [{get_resource: mog_security_group}] + + + server_oam02: + type: OS::Nova::Server + properties: +# config_drive: "True" + name: {get_param: [oam_server_names, 1]} + image: {get_param: oam_image_name} + flavor: {get_param: oam_flavor_name} + availability_zone: {get_param: availabilityzone_name} + networks: + - port: {get_resource: oam02_port_0} + - port: {get_resource: oam02_port_1} +# block_device_mapping: +# - device_name: vdd +# volume_id: { get_param: oam-vol-2 } + user_data: + scheduler_hints: {group: {get_resource: servergroup_mog02}} + user_data_format: RAW + + oam02_port_0: + type: OS::Neutron::Port + properties: + network: {get_resource: csb_net} + security_groups: [{get_resource: mog_security_group}] + + oam02_port_1: + type: OS::Neutron::Port + properties: + network: {get_param: oam_net_name} + fixed_ips: [{"ip_address": {get_param: [oam_net_ips, 3]}}] + security_groups: [{get_resource: mog_security_group}] + + + server_sm01: + type: OS::Nova::Server + properties: +# config_drive: "True" + name: {get_param: [sm_server_names, 0]} + image: {get_param: sm_image_name} + flavor: {get_param: sm_flavor_name} + availability_zone: {get_param: availabilityzone_name} + networks: + - port: {get_resource: sm01_port_0} + - port: {get_resource: sm01_port_1} +# block_device_mapping: +# - device_name: vdd +# volume_id: { get_param: session-manager-vol-1 } + user_data: + scheduler_hints: {group: {get_resource: servergroup_mog02}} + user_data_format: RAW + + sm01_port_0: + type: OS::Neutron::Port + properties: + network: {get_resource: csb_net} + security_groups: [{get_resource: mog_security_group}] + + sm01_port_1: + type: OS::Neutron::Port + properties: + network: {get_resource: dummy_net_0} + security_groups: [{get_resource: mog_security_group}] + + sm01_port_2: + type: OS::Neutron::Port + properties: + network: {get_param: repl_net_name} + fixed_ips: [{"ip_address": {get_param: [repl_net_ips, 0]}}] + security_groups: [{get_resource: mog_security_group}] + + server_sm02: + type: OS::Nova::Server + properties: +# config_drive: "True" + name: {get_param: [sm_server_names, 1]} + image: {get_param: sm_image_name} + flavor: {get_param: sm_flavor_name} + availability_zone: {get_param: availabilityzone_name} +# block_device_mapping: +# - device_name: vdd +# volume_id: { get_param: session-manager-vol-2 } + networks: + - port: {get_resource: sm02_port_0} + - port: {get_resource: sm02_port_1} + user_data: + scheduler_hints: {group: {get_resource: servergroup_mog02}} + user_data_format: RAW + + sm02_port_0: + type: OS::Neutron::Port + properties: + network: {get_resource: csb_net} + security_groups: [{get_resource: mog_security_group}] + + sm02_port_1: + type: OS::Neutron::Port + properties: + network: {get_resource: dummy_net_0} + security_groups: [{get_resource: mog_security_group}] + + sm02_port_2: + type: OS::Neutron::Port + properties: + network: {get_param: repl_net_name} + fixed_ips: [{"ip_address": {get_param: [repl_net_ips, 1]}}] + security_groups: [{get_resource: mog_security_group}] + + servergroup_mog03: + type: OS::Nova::ServerGroup + properties: + policies: + - anti-affinity + server_ps01: + type: OS::Nova::Server + properties: +# config_drive: "True" + name: {get_param: [ps_server_names, 0]} + image: {get_param: ps_image_name} + flavor: {get_param: ps_flavor_name} + availability_zone: {get_param: availabilityzone_name} + networks: + - port: {get_resource: ps01_port_0} + user_data: + scheduler_hints: {group: {get_resource: servergroup_mog03}} + user_data_format: RAW + + ps01_port_0: + type: OS::Neutron::Port + properties: + network: {get_resource: csb_net} + security_groups: [{get_resource: mog_security_group}] + + server_ps02: + type: OS::Nova::Server + properties: +# config_drive: "True" + name: {get_param: [ps_server_names, 1]} + image: {get_param: ps_image_name} + flavor: {get_param: ps_flavor_name} + availability_zone: {get_param: availabilityzone_name} + networks: + - port: {get_resource: ps02_port_0} + user_data: + scheduler_hints: {group: {get_resource: servergroup_mog03}} + user_data_format: RAW + + ps02_port_0: + type: OS::Neutron::Port + properties: + network: {get_resource: csb_net} + security_groups: [{get_resource: mog_security_group}] + + server_ps03: + type: OS::Nova::Server + properties: + name: {get_param: [ps_server_names, 2]} + image: {get_param: ps_image_name} + flavor: {get_param: ps_flavor_name} + availability_zone: {get_param: availabilityzone_name} + networks: + - port: {get_resource: ps03_port_0} + user_data: + scheduler_hints: {group: {get_resource: servergroup_mog03}} + user_data_format: RAW + + ps03_port_0: + type: OS::Neutron::Port + properties: + network: {get_resource: csb_net} + security_groups: [{get_resource: mog_security_group}] + + server_ps04: + type: OS::Nova::Server + properties: + name: {get_param: [ps_server_names, 3]} + image: {get_param: ps_image_name} + flavor: {get_param: ps_flavor_name} + availability_zone: {get_param: availabilityzone_name} + networks: + - port: {get_resource: ps04_port_0} + user_data: + scheduler_hints: {group: {get_resource: servergroup_mog03}} + user_data_format: RAW + + ps04_port_0: + type: OS::Neutron::Port + properties: + network: {get_resource: csb_net} + security_groups: [{get_resource: mog_security_group}] + + server_cm01: + type: OS::Nova::Server + properties: +# config_drive: "True" + name: {get_param: [cm_server_names, 0]} + image: {get_param: cm_image_name} + flavor: {get_param: cm_flavor_name} + availability_zone: {get_param: availabilityzone_name} + networks: + - port: {get_resource: cm01_port_0} + - port: {get_resource: cm01_port_1} +# block_device_mapping: +# - device_name: vdd +# volume_id: { get_param: cluster-manager-vol-2 } +# - device_name: vde +# volume_id: { get_param: cluster-manager-vol-1 } + user_data: + scheduler_hints: {group: {get_resource: servergroup_mog03}} + user_data_format: RAW + + cm01_port_0: + type: OS::Neutron::Port + properties: + network: {get_resource: csb_net} + fixed_ips: [{"ip_address": {get_param: [csb_net_ips, 10]}}] + security_groups: [{get_resource: mog_security_group}] + + cm01_port_1: + type: OS::Neutron::Port + properties: + network: {get_param: oam_net_name} + fixed_ips: [{"ip_address": {get_param: [oam_net_ips, 4]}}] + security_groups: [{get_resource: mog_security_group}] + diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/invalidTypes/MANIFEST.json b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/invalidTypes/MANIFEST.json new file mode 100644 index 0000000000..6b48646d70 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/invalidTypes/MANIFEST.json @@ -0,0 +1,42 @@ +{ + "name": "multiple_not_nested", + "description": "multiple heat files in zip, no nesting", + "version": "2013-05-23", + "data": [{ + "file": "cmaui.yml", + "type": "HEAT", + "data": [{ + "file": "cmaui.env", + "type": "HEAT_ENV" + }] + }, + { + "file": "eca_oam.yaml", + "type": "AAA", + "data": [{ + "file": "eca_oam.env", + "type": "AAA" + }] + }, + { + "file": "eca_oam_2.yaml", + "type": "AAA" + }, + { + "file": "MMSC_Capacity_Line.yml", + "type": "HEAT", + "data": [{ + "file": "MMSC_Capacity_Line_1.env", + "type": "HEAT_ENV" + }] + }, + { + "file": "SG_ECA_MGMT.yaml", + "type": "HEAT", + "data": [{ + "file": "sg_eca_mgmt.env", + "type": "HEAT_ENV" + }] + } + ] +}
\ No newline at end of file diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/invalidTypes/MMSC_Capacity_Line.yml b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/invalidTypes/MMSC_Capacity_Line.yml new file mode 100644 index 0000000000..3b0bc56e09 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/invalidTypes/MMSC_Capacity_Line.yml @@ -0,0 +1,3223 @@ +heat_template_version: 2013-05-23 + +description: > + HOT template that creates internal networks, load balancers and servers for vMMSC capacity Line 1. + #11/23: updated the network definition to meet the juniper best practices way of defining the gateway, DHCP enable for internal networks (L457-L547) + +parameters: + vnf_id: + type: string + description: Unique ID for this VNF instance + default: This_is_the_MMSC_id + oam_net_name: + type: string + label: UID of OAM network + description: UID of OAM network + oam_network_netmask: + type: string + label: oam network netmask + description: oam network gateway + oam_network_gateway: + type: string + label: oam network gateway + description: oam network gateway + oam_network_route_1: + type: string + label: oam network route 1 + description: oam network route 1 + oam_network_route_2: + type: string + label: oam network route 2 + description: oam network route 2 + external_dns: + type: string + label: dns server + description: dns server for MMSC + external_ntp: + type: string + label: ntp server + description: ntp server for MMSC + lb_oam_ips: + type: comma_delimited_list + label: management network ips for mmsc lb + description: the ips of the management network for mmsc lb + dmz_protected_net_name: + type: string + label: UID of dmz_protected network + description: UID of dmz_protected network + lb_dmz_protected_ips: + type: comma_delimited_list + label: dmz protected network local ips for lb VM + description: local ips of the dmz protected network for lb VM + cor_direct_net_name: + type: string + label: cor direct net UID + description: cor direct net + lb_cor_direct_ips: + type: comma_delimited_list + label: cor direct network local ips for lb VM + description: local ips of cor direct network for lb VM + mms_traffic_net_name: + type: string + label: Name of MMS traffic network + description: Name of MMS traffic network + mms_traffic_net_cidr: + type: string + label: MMS traffic network address (CIDR notation) + description: MMS traffic network address (CIDR notation) + mms_traffic_netmask: + type: string + label: MMS traffic network subnet mask + description: MMS traffic network subnet mask + mms_traffic_net_gateway: + type: string + label: MMS traffic network gateway address + description: MMS traffic network gateway address + mms_traffic_start: + type: string + label: mmsc traffic start IP + description: mmsc traffic start IP + mms_traffic_end: + type: string + label: mmsc traffic end IP + description: mmsc traffic end IP + mms_traffic_net_cidr: + type: string + label: mmsc traffic cidr + description: mmsc traffic cidr + mms_traffic_net_local_ip1: + type: string + label: mmsc traffic network local ip1 + description: the local ip1 of the mmsc traffic network + mms_traffic_net_local_ip2: + type: string + label: mmsc traffic network local ip2 + description: the local ip2 of the mmsc traffic network + mms_traffic_net_floating_ip: + type: string + label: mmsc traffic floating ip + description: mmsc traffic floating ip + nems_internal_name: + type: string + label: nems internal network name + description: nems internal network name + nems_internal_start: + type: string + label: nems internal start + description: nems internal start + nems_internal_end: + type: string + label: nems internal end + description: nems internal end + nems_internal_cidr: + type: string + label: nems ineternal cidr + description: nems internal cidr + nems_internal_netmask: + type: string + label: NEMS internal network subnet mask + description: NEMS internal network subnet mask + nems_internal_gateway: + type: string + label: nems internal gw + description: nems internal gw + nems_traffic_name: + type: string + label: nems traffic name + description: nems traffic name + nems_traffic_start: + type: string + label: nems traffic start + description: nems traffic start + nems_traffic_end: + type: string + label: nems traffic end + description: nems traffic end + nems_traffic_cidr: + type: string + label: nems traffic cidr + description: nems traffic cidr + nems_traffic_netmask: + type: string + label: NEMS traffic network subnet mask + description: NEMS traffic network subnet mask + nems_traffic_gateway: + type: string + label: NEMS traffic network gateway + description: NEMS traffic network gateway + nems_traffic_net_local_ip1: + type: string + label: nems traffic network local ip1 + description: the local ip1 of the nems traffic network + nems_traffic_net_local_ip2: + type: string + label: nems traffic network local ip2 + description: the local ip2 of the nems traffic network + nems_traffic_net_floating_ip: + type: string + label: nems traffic floating ip + description: nems traffic floating ip + nems_user_web_name: + type: string + label: nems user web name + description: nems user web name + nems_user_web_start: + type: string + label: nems user web start + description: nems user web end + nems_user_web_end: + type: string + label: nems user web end + description: nems user web end + nems_user_web_cidr: + type: string + label: nems user web cidr + description: nems user web cidr + nems_user_web_netmask: + type: string + label: NEMS user web network subnet mask + description: NEMS user web network subnet mask + nems_user_web_gateway: + type: string + label: NEMS user web network gateway + description: NEMS user web network gateway + nems_user_web_net_local_ip1: + type: string + label: nems user web network local ip1 + description: the local ip1 of the nems user web network + nems_user_web_net_local_ip2: + type: string + label: nems user web network local ip2 + description: the local ip2 of the nems user web network + nems_user_web_net_floating_ip: + type: string + label: nems user web floating ip + description: nems user web floating ip + nems_imap_name: + type: string + label: nems imap name + description: nems imap name + nems_imap_netmask: + type: string + label: nems imap subnet mask + description: nems imap subnet mask + nems_imap_start: + type: string + label: nems imap start + description: nems imap start + nems_imap_end: + type: string + label: nems imap end + description: nems imap end + nems_imap_cidr: + type: string + label: nems imap cidr + description: nems imap cidr + nems_imap_gateway: + type: string + label: nems imap gateway + description: nems imap gateway + eca_traffic_name: + type: string + label: eca traffic name + description: eca traffic name + eca_traffic_start: + type: string + label: eca traffic start + description: eca traffic start + eca_traffic_end: + type: string + label: eca traffic end + description: eca traffic end + eca_traffic_cidr: + type: string + label: eca traffic cidr + description: eca traffic cidr + eca_traffic_netmask: + type: string + label: ECA traffic network subnet mask + description: ECA traffic network subnet mask + eca_traffic_net_gateway: + type: string + label: eca_traffic network gateway + description: eca_traffic network gateway + eca_traffic_net_local_ip1: + type: string + label: eca traffic network local ip1 + description: the local ip1 of the eca traffic network + eca_traffic_net_local_ip2: + type: string + label: eca traffic network local ip2 + description: the local ip2 of the eca traffic network + eca_traffic_net_floating_ip: + type: string + label: eca traffic floating ip + description: eca traffic floating ip + ha_net_name: + type: string + label: ha_failover network name + description: ha_failover network name + ha_net_start: + type: string + label: ha net start + description: ha net start + ha_net_end: + type: string + label: ha net end + description: ha net end + ha_net_cidr: + type: string + label: ha net cidr + description: ha net cidr + ha_net_local_ip1: + type: string + label: ha net network local ip1 + description: the local ip1 of the ha network + ha_net_local_ip2: + type: string + label: ha net network local ip2 + description: the local ip2 of the ha network + lb_names: + type: comma_delimited_list + label: MMSC load balancer instance names + description: MMSC load balancer instance names + lb_image_name: + type: string + label: MMSC load balancer image name + description: MMSC load balancer image name + lb_flavor_name: + type: string + label: Load balancer flavor name + description: the flavor name of MMSC load balancer instance + availability_zone_0: + type: string + label: MMSC availabilityzone name + description: MMSC availabilityzone name + security_group_name: + type: string + label: MMSC security group name + description: MMSC security group name + mmsc_image: + type: string + label: Image for MMSC server + description: Image for MMSC server + mmsc_flavor: + type: string + label: Flavor for MMSC server + description: Flavor for MMSC server + mmsc_cinder_volume_size: + type: number + label: MMSC Cinder volume size + description: the size of the MMSC Cinder volume + nems_fe_image: + type: string + label: Image for NEMS FE server + description: Image for NEMS FE server + nems_fe_flavor: + type: string + label: Flavor for NEMS FE server + description: Flavor for NEMS FE server + nems_be_image: + type: string + label: Image for NEMS BE server + description: Image for NEMS BE server + nems_be_flavor: + type: string + label: Flavor for NEMS BE server + description: Flavor for NEMS BE server + eca_trx_image: + type: string + label: Image for ECA TRX server + description: Image for ECA TRX server + eca_trx_flavor: + type: string + label: Flavor for ECA TRX server + description: Flavor for ECA TRX server + mmsc_oam_ips: + type: comma_delimited_list + label: MMSC oam_net IP addresses + description: MMSC oam_net IP addresses + mmsc_mms_traffic_net_ips: + type: comma_delimited_list + label: MMSC mms_traffic_net IP addresses + description: MMSC mms_traffic_net IP addresses + nems_fe_names: + type: comma_delimited_list + label: NEMS_FE server names + description: NEMS_FE server names + nems_fe_node_roles: + type: comma_delimited_list + label: nems fe node roles + description: nems fe node roles + nems_fe_oam_ips: + type: comma_delimited_list + label: OAM_net IP for NEMS_FE + description: OAM_net IP for NEMS_FE + nems_fe_nems_traffic_net_ips: + type: comma_delimited_list + label: nems_traffic_net IPs for NEMS_FE + description: nems_traffic_net IPs for NEMS_FE + nems_fe_nems_user_web_net_ips: + type: comma_delimited_list + label: nems_web_user_net IPs for NEMS_FE + description: nems_web_user_net IPs for NEMS_FE + nems_fe_nems_internal_net_ips: + type: comma_delimited_list + label: nems_internal_net IPs for NEMS_FE + description: nems_internal_net IPs for NEMS_FE + nems_fe_nems_imap_net_ips: + type: comma_delimited_list + label: nems_imap_net IPs for NEMS_FE + description: nems_imap_net IPs for NEMS_FE + nems_be_names: + type: string + label: NEMS_BE server names + description: NEMS_BE server names + nems_be_node_roles: + type: string + label: nems node roles + description: nems node roles + nems_be_oam_ips: + type: string + label: OAM net IPs for NEMS_BE + description: OAM net IPs for NEMS_BE + nems_be_nems_internal_net_ips: + type: string + label: nems internal net IPs for NEMS_BE + description: nems internal net IPs for NEMS_BE + nems_be_nems_imap_net_ips: + type: string + label: nems imap_net IPs for NEMS_BE + description: nems imap net IPs for NEMS_BE + eca_trx_oam_ips: + type: comma_delimited_list + label: OAM net IP for ECA_TRX + description: OAM net IP for ECA_TRX + eca_trx_mgmt_ips: + type: comma_delimited_list + label: eca mgmt net IP for ECA_TRX + description: eca mgmt net IP for ECA_TRX + timezone: + type: string + label: timezone + description: timezone + eca_trx_names: + type: comma_delimited_list + label: ECA_TRX server names + description: ECA_TRX server names + eca_trx_eca_traffic_net_ips: + type: comma_delimited_list + label: eca traffic net IPs for ECA_TRX + description: eca traffic net IPs for ECA_TRX + mmsc_names: + type: comma_delimited_list + label: MMSC server names + description: MMSC server names + nems_volume_size: + type: number + label: nems fe volume size + description: nems fe volume size + nems_be_volume_size: + type: number + label: nems be volume size + description: nems be volume size + MMSC_volume_type: + type: string + label: MMSC vm volume type + description: the name of the target volume backend + NEMS_FE_volume_type: + type: string + label: nems fe vm volume type + description: the name of the target volume backend + NEMS_BE_volume_type: + type: string + label: nems be vm volume type + description: the name of the target volume backend + mmsc_core_virtual_server_ips: + type: comma_delimited_list + label: mmsc core virtual server ips + description: mmsc core virtual server ips + mmsc_core_snat_ips: + type: comma_delimited_list + label: mmsc core snat ips + description: mmsc core snat ips + mmsc_dmz_protected_virtual_server_ips: + type: comma_delimited_list + label: mmsc dmz_protected virtual server ips + description: mmsc dmz_protected virtual server ips + mmsc_dmz_protected_snat_ips: + type: comma_delimited_list + label: mmsc dmz_protected snat ips + description: mmsc dmz_protected snat ips + eca_mgmt_net_name: + type: string + label: eca management network ID + description: Network ID for eca management + +resources: + mms_traffic_net: + type: OS::Contrail::VirtualNetwork + properties: + name: { get_param: mms_traffic_net_name } + + mms_traffic_ip_subnet: + type: OS::Neutron::Subnet + properties: + name: {get_param: mms_traffic_net_name} + network_id: { get_resource: mms_traffic_net } + cidr: { get_param: mms_traffic_net_cidr } + allocation_pools: [{"start": {get_param: mms_traffic_start}, "end": {get_param: mms_traffic_end}}] + + nems_internal_net: + type: OS::Contrail::VirtualNetwork + properties: + name: {get_param: nems_internal_name} + + nems_internal_network_ip_subnet: + type: OS::Neutron::Subnet + properties: + name: {get_param: nems_internal_name} + allocation_pools: [{"start": {get_param: nems_internal_start}, "end": {get_param: nems_internal_end}}] + cidr: {get_param: nems_internal_cidr} + network_id: {get_resource: nems_internal_net} + + nems_traffic_net: + type: OS::Contrail::VirtualNetwork + properties: + name: {get_param: nems_traffic_name} + + nems_traffic_network_ip_subnet: + type: OS::Neutron::Subnet + properties: + name: {get_param: nems_traffic_name} + allocation_pools: [{"start": {get_param: nems_traffic_start}, "end": {get_param: nems_traffic_end}}] + cidr: {get_param: nems_traffic_cidr} + network_id: {get_resource: nems_traffic_net} + + nems_user_web_net: + type: OS::Contrail::VirtualNetwork + properties: + name: {get_param: nems_user_web_name} + + nems_user_web_network_ip_subnet: + type: OS::Neutron::Subnet + properties: + name: {get_param: nems_user_web_name} + allocation_pools: [{"start": {get_param: nems_user_web_start}, "end": {get_param: nems_user_web_end}}] + cidr: {get_param: nems_user_web_cidr} + network_id: {get_resource: nems_user_web_net} + + nems_imap_net: + type: OS::Contrail::VirtualNetwork + properties: + name: {get_param: nems_imap_name} + + nems_imap_network_ip_subnet: + type: OS::Neutron::Subnet + properties: + name: {get_param: nems_imap_name} + allocation_pools: [{"start": {get_param: nems_imap_start}, "end": {get_param: nems_imap_end}}] + cidr: {get_param: nems_imap_cidr} + network_id: {get_resource: nems_imap_net} + + eca_traffic_net: + type: OS::Contrail::VirtualNetwork + properties: + name: {get_param: eca_traffic_name} + + eca_traffic_ip_subnet: + type: OS::Neutron::Subnet + properties: + name: {get_param: eca_traffic_name} + allocation_pools: [{"start": {get_param: eca_traffic_start}, "end": {get_param: eca_traffic_end}}] + cidr: {get_param: eca_traffic_cidr} + network_id: {get_resource: eca_traffic_net} + + ha_net: + type: OS::Contrail::VirtualNetwork + properties: + name: {get_param: ha_net_name} + + ha_net_ip_subnet: + type: OS::Neutron::Subnet + properties: + name: {get_param: ha_net_name} + allocation_pools: [{"start": {get_param: ha_net_start}, "end": {get_param: ha_net_end}}] + cidr: {get_param: ha_net_cidr} + network_id: {get_resource: ha_net} + + lb1_instance: + type: OS::Nova::Server + properties: + name: {get_param: [lb_names, 0]} + image: {get_param: lb_image_name} + flavor: {get_param: lb_flavor_name} + availability_zone: {get_param: availability_zone_0} + networks: + - port: {get_resource: lb1_mgmt_port} + - port: {get_resource: lb1_dmz_protected_port} + - port: {get_resource: lb1_cor_direct_port} + - port: {get_resource: lb1_mms_traffic_port} + - port: {get_resource: lb1_nems_traffic_port} + - port: {get_resource: lb1_nems_user_web_port} + - port: {get_resource: lb1_eca_traffic_port} + - port: {get_resource: lb1_ha_net_port} + metadata: + vnf_id: { get_param: vnf_id } + + lb1_mgmt_port: + type: OS::Neutron::Port + properties: + network: {get_param: oam_net_name} + fixed_ips: [{"ip_address": {get_param: [lb_oam_ips, 0]}}] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + lb1_mms_traffic_port: + type: OS::Neutron::Port + properties: + network_id: {get_resource: mms_traffic_net} + fixed_ips: [{"ip_address": {get_param: mms_traffic_net_local_ip1}}] + allowed_address_pairs: [{"ip_address": {get_param: mms_traffic_net_floating_ip} }] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + lb1_dmz_protected_port: + type: OS::Neutron::Port + properties: + network: {get_param: dmz_protected_net_name} + fixed_ips: [{"ip_address": {get_param: [lb_dmz_protected_ips, 0]}}] + allowed_address_pairs: [{"ip_address": {get_param: [mmsc_dmz_protected_virtual_server_ips, 0]}}, {"ip_address": {get_param: [mmsc_dmz_protected_virtual_server_ips, 1]}}, {"ip_address": {get_param: [mmsc_dmz_protected_virtual_server_ips, 2]}}, {"ip_address": {get_param: [mmsc_dmz_protected_snat_ips, 0]}}, {"ip_address": {get_param: [mmsc_dmz_protected_snat_ips, 1]}}, {"ip_address": {get_param: [mmsc_dmz_protected_snat_ips, 2]}}, {"ip_address": {get_param: [mmsc_dmz_protected_snat_ips, 3]}}] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + lb1_cor_direct_port: + type: OS::Neutron::Port + properties: + network: {get_param: cor_direct_net_name} + fixed_ips: [{"ip_address": {get_param: [lb_cor_direct_ips, 0]}}] + allowed_address_pairs: [{"ip_address": {get_param: [mmsc_core_virtual_server_ips, 0]}}, {"ip_address": {get_param: [mmsc_core_virtual_server_ips, 1]}}, {"ip_address": {get_param: [mmsc_core_snat_ips, 0]}}, {"ip_address": {get_param: [mmsc_core_snat_ips, 1]}}, {"ip_address": {get_param: [mmsc_core_snat_ips, 2]}}, {"ip_address": {get_param: [mmsc_core_snat_ips, 3]}}, {"ip_address": {get_param: [mmsc_core_snat_ips, 4]}} ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + lb1_nems_traffic_port: + type: OS::Neutron::Port + properties: + network_id: {get_resource: nems_traffic_net} + fixed_ips: [{"ip_address": {get_param: nems_traffic_net_local_ip1}}] + allowed_address_pairs: [{"ip_address": {get_param: nems_traffic_net_floating_ip} }] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + lb1_nems_user_web_port: + type: OS::Neutron::Port + properties: + network_id: {get_resource: nems_user_web_net} + fixed_ips: [{"ip_address": {get_param: nems_user_web_net_local_ip1}}] + allowed_address_pairs: [{"ip_address": {get_param: nems_user_web_net_floating_ip} }] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + lb1_ha_net_port: + type: OS::Neutron::Port + properties: + network_id: {get_resource: ha_net} + fixed_ips: [{"ip_address": {get_param: ha_net_local_ip1}}] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + lb1_eca_traffic_port: + type: OS::Neutron::Port + properties: + network_id: {get_resource: eca_traffic_net} + fixed_ips: [{"ip_address": {get_param: eca_traffic_net_local_ip1}}] + allowed_address_pairs: [{"ip_address": {get_param: eca_traffic_net_floating_ip} }] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + lb2_instance: + type: OS::Nova::Server + properties: + name: {get_param: [lb_names, 1]} + image: {get_param: lb_image_name} + flavor: {get_param: lb_flavor_name} + availability_zone: {get_param: availability_zone_0} + networks: + - port: {get_resource: lb2_mgmt_port} + - port: {get_resource: lb2_dmz_protected_port} + - port: {get_resource: lb2_cor_direct_port} + - port: {get_resource: lb2_mms_traffic_port} + - port: {get_resource: lb2_nems_traffic_port} + - port: {get_resource: lb2_nems_user_web_port} + - port: {get_resource: lb2_eca_traffic_port} + - port: {get_resource: lb2_ha_net_port} + metadata: + vnf_id: { get_param: vnf_id } + + lb2_mgmt_port: + type: OS::Neutron::Port + properties: + network: {get_param: oam_net_name} + fixed_ips: [{"ip_address": {get_param: [lb_oam_ips, 1]}}] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + lb2_mms_traffic_port: + type: OS::Neutron::Port + properties: + network_id: {get_resource: mms_traffic_net} + fixed_ips: [{"ip_address": {get_param: mms_traffic_net_local_ip2}}] + allowed_address_pairs: [{"ip_address": {get_param: mms_traffic_net_floating_ip}}] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + lb2_dmz_protected_port: + type: OS::Neutron::Port + properties: + network: {get_param: dmz_protected_net_name} + fixed_ips: [{"ip_address": {get_param: [lb_dmz_protected_ips, 1]}}] + allowed_address_pairs: [{"ip_address": {get_param: [mmsc_dmz_protected_virtual_server_ips, 0]}}, {"ip_address": {get_param: [mmsc_dmz_protected_virtual_server_ips, 1]}}, {"ip_address": {get_param: [mmsc_dmz_protected_virtual_server_ips, 2]}}, {"ip_address": {get_param: [mmsc_dmz_protected_snat_ips, 0]}}, {"ip_address": {get_param: [mmsc_dmz_protected_snat_ips, 1]}}, {"ip_address": {get_param: [mmsc_dmz_protected_snat_ips, 2]}}, {"ip_address": {get_param: [mmsc_dmz_protected_snat_ips, 3]}}] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + lb2_cor_direct_port: + type: OS::Neutron::Port + properties: + network: {get_param: cor_direct_net_name} + fixed_ips: [{"ip_address": {get_param: [lb_cor_direct_ips, 1]}}] + allowed_address_pairs: [{"ip_address": {get_param: [mmsc_core_virtual_server_ips, 0]}}, {"ip_address": {get_param: [mmsc_core_virtual_server_ips, 1]}}, {"ip_address": {get_param: [mmsc_core_snat_ips, 0]}}, {"ip_address": {get_param: [mmsc_core_snat_ips, 1]}}, {"ip_address": {get_param: [mmsc_core_snat_ips, 2]}}, {"ip_address": {get_param: [mmsc_core_snat_ips, 3]}}, {"ip_address": {get_param: [mmsc_core_snat_ips, 4]}} ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + lb2_nems_traffic_port: + type: OS::Neutron::Port + properties: + network_id: {get_resource: nems_traffic_net} + fixed_ips: [{"ip_address": {get_param: nems_traffic_net_local_ip2}}] + allowed_address_pairs: [{"ip_address": {get_param: nems_traffic_net_floating_ip}}] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + lb2_nems_user_web_port: + type: OS::Neutron::Port + properties: + network_id: {get_resource: nems_user_web_net} + fixed_ips: [{"ip_address": {get_param: nems_user_web_net_local_ip2}}] + allowed_address_pairs: [{"ip_address": {get_param: nems_user_web_net_floating_ip}}] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + lb2_ha_net_port: + type: OS::Neutron::Port + properties: + network_id: {get_resource: ha_net} + fixed_ips: [{"ip_address": {get_param: ha_net_local_ip2}}] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + lb2_eca_traffic_port: + type: OS::Neutron::Port + properties: + network_id: {get_resource: eca_traffic_net} + fixed_ips: [{"ip_address": {get_param: eca_traffic_net_local_ip2}}] + allowed_address_pairs: [{"ip_address": {get_param: eca_traffic_net_floating_ip} }] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + server_mmsc1: + type: OS::Nova::Server + properties: + name: { get_param: [mmsc_names, 0]} + image: { get_param: mmsc_image } + availability_zone: { get_param: availability_zone_0 } + flavor: { get_param: mmsc_flavor } + networks: + - port: { get_resource: mmsc1_port_0 } + - port: { get_resource: mmsc1_port_1 } + metadata: + vnf_id: { get_param: vnf_id } + user_data: + str_replace: + template: | + mmsc.mgmt.ip=${mmsc.mgmt.ip} + mmsc.mgmt.netmask=${mmsc.mgmt.netmask} + mmsc.mgmt.gateway=${mmsc.mgmt.gateway} + mmsc.traffic.ip=${mmsc.traffic.ip} + mmsc.traffic.netmask=${mmsc.traffic.netmask} + mmsc.traffic.gateway=${mmsc.traffic.gateway} + mmsc.mgmt.route.1=${mmsc.mgmt.route.1} + mmsc.mgmt.route.2=${mmsc.mgmt.route.2} + mmsc.external.dns=${mmsc.external.dns} + mmsc.external.ntp=${mmsc.external.ntp} + mmsc.hostname=${mmsc.hostname} + mmsc.timezone=${mmsc.timezone} + params: + ${mmsc.mgmt.ip}: {get_param: [mmsc_oam_ips, 0]} + ${mmsc.mgmt.netmask}: {get_param: oam_network_netmask} + ${mmsc.mgmt.gateway}: {get_param: oam_network_gateway} + ${mmsc.traffic.ip}: {get_param: [mmsc_mms_traffic_net_ips, 0]} + ${mmsc.traffic.netmask}: {get_param: mms_traffic_netmask} + ${mmsc.traffic.gateway}: {get_param: mms_traffic_net_gateway} + ${mmsc.mgmt.route.1}: {get_param: oam_network_route_1} + ${mmsc.mgmt.route.2}: {get_param: oam_network_route_2} + ${mmsc.external.dns}: {get_param: external_dns} + ${mmsc.external.ntp}: {get_param: external_ntp} + ${mmsc.hostname}: {get_param: [mmsc_names, 0]} + ${mmsc.timezone}: {get_param: timezone} + user_data_format: RAW + + mmsc1_volume: + type: OS::Cinder::Volume + properties: + size: {get_param: mmsc_cinder_volume_size} + volume_type: {get_param: MMSC_volume_type} + + mmsc1_volume_attachment: + type: OS::Cinder::VolumeAttachment + properties: + volume_id: {get_resource: mmsc1_volume} + instance_uuid: {get_resource: server_mmsc1} + + mmsc1_port_0: + type: OS::Neutron::Port + properties: + network: {get_param: oam_net_name} + fixed_ips: [ + "ip_address": {get_param: [mmsc_oam_ips, 0]} + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + mmsc1_port_1: + type: OS::Neutron::Port + properties: + network_id: {get_resource: mms_traffic_net} + fixed_ips: [ + "ip_address": {get_param: [mmsc_mms_traffic_net_ips, 0]} + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + server_mmsc2: + type: OS::Nova::Server + properties: + name: { get_param: [mmsc_names, 1]} + image: { get_param: mmsc_image } + availability_zone: { get_param: availability_zone_0 } + flavor: { get_param: mmsc_flavor } + networks: + - port: { get_resource: mmsc2_port_0 } + - port: { get_resource: mmsc2_port_1 } + metadata: + vnf_id: { get_param: vnf_id } + user_data: + str_replace: + template: | + mmsc.mgmt.ip=${mmsc.mgmt.ip} + mmsc.mgmt.netmask=${mmsc.mgmt.netmask} + mmsc.mgmt.gateway=${mmsc.mgmt.gateway} + mmsc.traffic.ip=${mmsc.traffic.ip} + mmsc.traffic.netmask=${mmsc.traffic.netmask} + mmsc.traffic.gateway=${mmsc.traffic.gateway} + mmsc.mgmt.route.1=${mmsc.mgmt.route.1} + mmsc.mgmt.route.2=${mmsc.mgmt.route.2} + mmsc.external.dns=${mmsc.external.dns} + mmsc.external.ntp=${mmsc.external.ntp} + mmsc.hostname=${mmsc.hostname} + mmsc.timezone=${mmsc.timezone} + params: + ${mmsc.mgmt.ip}: {get_param: [mmsc_oam_ips, 1]} + ${mmsc.mgmt.netmask}: {get_param: oam_network_netmask} + ${mmsc.mgmt.gateway}: {get_param: oam_network_gateway} + ${mmsc.traffic.ip}: {get_param: [mmsc_mms_traffic_net_ips, 1]} + ${mmsc.traffic.netmask}: {get_param: mms_traffic_netmask} + ${mmsc.traffic.gateway}: {get_param: mms_traffic_net_gateway} + ${mmsc.mgmt.route.1}: {get_param: oam_network_route_1} + ${mmsc.mgmt.route.2}: {get_param: oam_network_route_2} + ${mmsc.external.dns}: {get_param: external_dns} + ${mmsc.external.ntp}: {get_param: external_ntp} + ${mmsc.hostname}: {get_param: [mmsc_names, 1]} + ${mmsc.timezone}: {get_param: timezone} + user_data_format: RAW + + mmsc2_volume: + type: OS::Cinder::Volume + properties: + size: {get_param: mmsc_cinder_volume_size} + volume_type: {get_param: MMSC_volume_type} + + mmsc2_volume_attachment: + type: OS::Cinder::VolumeAttachment + properties: + volume_id: {get_resource: mmsc2_volume} + instance_uuid: {get_resource: server_mmsc2} + + mmsc2_port_0: + type: OS::Neutron::Port + properties: + network: {get_param: oam_net_name} + fixed_ips: [ + "ip_address": {get_param: [mmsc_oam_ips, 1]} + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + mmsc2_port_1: + type: OS::Neutron::Port + properties: + network_id: {get_resource: mms_traffic_net} + fixed_ips: [ + "ip_address": {get_param: [mmsc_mms_traffic_net_ips, 1]} + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + server_mmsc3: + type: OS::Nova::Server + properties: + name: { get_param: [mmsc_names, 2]} + image: { get_param: mmsc_image } + availability_zone: { get_param: availability_zone_0 } + flavor: { get_param: mmsc_flavor } + networks: + - port: { get_resource: mmsc3_port_0 } + - port: { get_resource: mmsc3_port_1 } + metadata: + vnf_id: { get_param: vnf_id } + user_data: + str_replace: + template: | + mmsc.mgmt.ip=${mmsc.mgmt.ip} + mmsc.mgmt.netmask=${mmsc.mgmt.netmask} + mmsc.mgmt.gateway=${mmsc.mgmt.gateway} + mmsc.traffic.ip=${mmsc.traffic.ip} + mmsc.traffic.netmask=${mmsc.traffic.netmask} + mmsc.traffic.gateway=${mmsc.traffic.gateway} + mmsc.mgmt.route.1=${mmsc.mgmt.route.1} + mmsc.mgmt.route.2=${mmsc.mgmt.route.2} + mmsc.external.dns=${mmsc.external.dns} + mmsc.external.ntp=${mmsc.external.ntp} + mmsc.hostname=${mmsc.hostname} + mmsc.timezone=${mmsc.timezone} + params: + ${mmsc.mgmt.ip}: {get_param: [mmsc_oam_ips, 2]} + ${mmsc.mgmt.netmask}: {get_param: oam_network_netmask} + ${mmsc.mgmt.gateway}: {get_param: oam_network_gateway} + ${mmsc.traffic.ip}: {get_param: [mmsc_mms_traffic_net_ips, 2]} + ${mmsc.traffic.netmask}: {get_param: mms_traffic_netmask} + ${mmsc.traffic.gateway}: {get_param: mms_traffic_net_gateway} + ${mmsc.mgmt.route.1}: {get_param: oam_network_route_1} + ${mmsc.mgmt.route.2}: {get_param: oam_network_route_2} + ${mmsc.external.dns}: {get_param: external_dns} + ${mmsc.external.ntp}: {get_param: external_ntp} + ${mmsc.hostname}: {get_param: [mmsc_names, 2]} + ${mmsc.timezone}: {get_param: timezone} + user_data_format: RAW + + mmsc3_volume: + type: OS::Cinder::Volume + properties: + size: {get_param: mmsc_cinder_volume_size} + volume_type: {get_param: MMSC_volume_type} + + mmsc3_volume_attachment: + type: OS::Cinder::VolumeAttachment + properties: + volume_id: {get_resource: mmsc3_volume} + instance_uuid: {get_resource: server_mmsc3} + + mmsc3_port_0: + type: OS::Neutron::Port + properties: + network: {get_param: oam_net_name} + fixed_ips: [ + "ip_address": {get_param: [mmsc_oam_ips, 2]} + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + mmsc3_port_1: + type: OS::Neutron::Port + properties: + network_id: {get_resource: mms_traffic_net} + fixed_ips: [ + "ip_address": {get_param: [mmsc_mms_traffic_net_ips, 2]} + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + server_mmsc4: + type: OS::Nova::Server + properties: + name: { get_param: [mmsc_names, 3]} + image: { get_param: mmsc_image } + availability_zone: { get_param: availability_zone_0 } + flavor: { get_param: mmsc_flavor } + networks: + - port: { get_resource: mmsc4_port_0 } + - port: { get_resource: mmsc4_port_1 } + metadata: + vnf_id: { get_param: vnf_id } + user_data: + str_replace: + template: | + mmsc.mgmt.ip=${mmsc.mgmt.ip} + mmsc.mgmt.netmask=${mmsc.mgmt.netmask} + mmsc.mgmt.gateway=${mmsc.mgmt.gateway} + mmsc.traffic.ip=${mmsc.traffic.ip} + mmsc.traffic.netmask=${mmsc.traffic.netmask} + mmsc.traffic.gateway=${mmsc.traffic.gateway} + mmsc.mgmt.route.1=${mmsc.mgmt.route.1} + mmsc.mgmt.route.2=${mmsc.mgmt.route.2} + mmsc.external.dns=${mmsc.external.dns} + mmsc.external.ntp=${mmsc.external.ntp} + mmsc.hostname=${mmsc.hostname} + mmsc.timezone=${mmsc.timezone} + params: + ${mmsc.mgmt.ip}: {get_param: [mmsc_oam_ips, 3]} + ${mmsc.mgmt.netmask}: {get_param: oam_network_netmask} + ${mmsc.mgmt.gateway}: {get_param: oam_network_gateway} + ${mmsc.traffic.ip}: {get_param: [mmsc_mms_traffic_net_ips, 3]} + ${mmsc.traffic.netmask}: {get_param: mms_traffic_netmask} + ${mmsc.traffic.gateway}: {get_param: mms_traffic_net_gateway} + ${mmsc.mgmt.route.1}: {get_param: oam_network_route_1} + ${mmsc.mgmt.route.2}: {get_param: oam_network_route_2} + ${mmsc.external.dns}: {get_param: external_dns} + ${mmsc.external.ntp}: {get_param: external_ntp} + ${mmsc.hostname}: {get_param: [mmsc_names, 3]} + ${mmsc.timezone}: {get_param: timezone} + user_data_format: RAW + + mmsc4_volume: + type: OS::Cinder::Volume + properties: + size: {get_param: mmsc_cinder_volume_size} + volume_type: {get_param: MMSC_volume_type} + + mmsc4_volume_attachment: + type: OS::Cinder::VolumeAttachment + properties: + volume_id: {get_resource: mmsc4_volume} + instance_uuid: {get_resource: server_mmsc4} + + mmsc4_port_0: + type: OS::Neutron::Port + properties: + network: {get_param: oam_net_name} + fixed_ips: [ + "ip_address": {get_param: [mmsc_oam_ips, 3]} + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + mmsc4_port_1: + type: OS::Neutron::Port + properties: + network_id: {get_resource: mms_traffic_net} + fixed_ips: [ + "ip_address": {get_param: [mmsc_mms_traffic_net_ips, 3]} + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + server_mmsc5: + type: OS::Nova::Server + properties: + name: { get_param: [mmsc_names, 4]} + image: { get_param: mmsc_image } + availability_zone: { get_param: availability_zone_0 } + flavor: { get_param: mmsc_flavor } + networks: + - port: { get_resource: mmsc5_port_0 } + - port: { get_resource: mmsc5_port_1 } + metadata: + vnf_id: { get_param: vnf_id } + user_data: + str_replace: + template: | + mmsc.mgmt.ip=${mmsc.mgmt.ip} + mmsc.mgmt.netmask=${mmsc.mgmt.netmask} + mmsc.mgmt.gateway=${mmsc.mgmt.gateway} + mmsc.traffic.ip=${mmsc.traffic.ip} + mmsc.traffic.netmask=${mmsc.traffic.netmask} + mmsc.traffic.gateway=${mmsc.traffic.gateway} + mmsc.mgmt.route.1=${mmsc.mgmt.route.1} + mmsc.mgmt.route.2=${mmsc.mgmt.route.2} + mmsc.external.dns=${mmsc.external.dns} + mmsc.external.ntp=${mmsc.external.ntp} + mmsc.hostname=${mmsc.hostname} + mmsc.timezone=${mmsc.timezone} + params: + ${mmsc.mgmt.ip}: {get_param: [mmsc_oam_ips, 4]} + ${mmsc.mgmt.netmask}: {get_param: oam_network_netmask} + ${mmsc.mgmt.gateway}: {get_param: oam_network_gateway} + ${mmsc.traffic.ip}: {get_param: [mmsc_mms_traffic_net_ips, 4]} + ${mmsc.traffic.netmask}: {get_param: mms_traffic_netmask} + ${mmsc.traffic.gateway}: {get_param: mms_traffic_net_gateway} + ${mmsc.mgmt.route.1}: {get_param: oam_network_route_1} + ${mmsc.mgmt.route.2}: {get_param: oam_network_route_2} + ${mmsc.external.dns}: {get_param: external_dns} + ${mmsc.external.ntp}: {get_param: external_ntp} + ${mmsc.hostname}: {get_param: [mmsc_names, 4]} + ${mmsc.timezone}: {get_param: timezone} + user_data_format: RAW + + mmsc5_volume: + type: OS::Cinder::Volume + properties: + size: {get_param: mmsc_cinder_volume_size} + volume_type: {get_param: MMSC_volume_type} + + mmsc5_volume_attachment: + type: OS::Cinder::VolumeAttachment + properties: + volume_id: {get_resource: mmsc5_volume} + instance_uuid: {get_resource: server_mmsc5} + + mmsc5_port_0: + type: OS::Neutron::Port + properties: + network: {get_param: oam_net_name} + fixed_ips: [ + "ip_address": {get_param: [mmsc_oam_ips, 4]} + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + mmsc5_port_1: + type: OS::Neutron::Port + properties: + network_id: {get_resource: mms_traffic_net} + fixed_ips: [ + "ip_address": {get_param: [mmsc_mms_traffic_net_ips, 4]} + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + server_nems_fe1: + type: OS::Nova::Server + properties: + name: { get_param: [nems_fe_names, 0] } + image: { get_param: nems_fe_image } + availability_zone: { get_param: availability_zone_0 } + flavor: { get_param: nems_fe_flavor } + networks: + - port: { get_resource: nems_fe1_port_0 } + - port: { get_resource: nems_fe1_port_1 } + - port: { get_resource: nems_fe1_port_2 } + - port: { get_resource: nems_fe1_port_3 } + - port: { get_resource: nems_fe1_port_4 } + metadata: + vnf_id: { get_param: vnf_id } + user_data: + str_replace: + template: | + nems.mgmt.ip=${nems.mgmt.ip} + nems.mgmt.netmask=${nems.mgmt.netmask} + nems.mgmt.gateway=${nems.mgmt.gateway} + nems.traffic.ip=${nems.traffic.ip} + nems.traffic.netmask=${nems.traffic.netmask} + nems.traffic.gateway=${nems.traffic.gateway} + nems.fe0.internal.ip=${nems.fe0.internal.ip} + nems.fe1.internal.ip=${nems.fe1.internal.ip} + nems.internal.netmask=${nems.internal.netmask} + nems.userweb.ip=${nems.userweb.ip} + nems.userweb.netmask=${nems.userweb.netmask} + nems.userweb.gateway=${nems.userweb.gateway} + nems.imap.ip=${nems.imap.ip} + nems.imap.netmask=${nems.imap.netmask} + nems.be.internal.ip=${nems.be.internal.ip} + nems.be.imap.ip=${nems.be.imap.ip} + nems.mgmt.route.1=${nems.mgmt.route.1} + nems.mgmt.route.2=${nems.mgmt.route.2} + nems.external.dns=${nems.external.dns} + nems.external.ntp=${nems.external.ntp} + nems.node=${nems.node} + nems.be0.host.name=${nems.be0.host.name} + nems.fe0.host.name=${nems.fe0.host.name} + nems.fe1.host.name=${nems.fe1.host.name} + nems.timezone=${nems.timezone} + params: + ${nems.mgmt.ip}: {get_param: [nems_fe_oam_ips, 0]} + ${nems.mgmt.netmask}: {get_param: oam_network_netmask} + ${nems.mgmt.gateway}: {get_param: oam_network_gateway} + ${nems.traffic.ip}: {get_param: [nems_fe_nems_traffic_net_ips, 0]} + ${nems.traffic.netmask}: {get_param: nems_traffic_netmask} + ${nems.traffic.gateway}: {get_param: nems_traffic_gateway} + ${nems.fe0.internal.ip}: {get_param: [nems_fe_nems_internal_net_ips, 0]} + ${nems.fe1.internal.ip}: {get_param: [nems_fe_nems_internal_net_ips, 1]} + ${nems.internal.netmask}: {get_param: nems_internal_netmask} + ${nems.userweb.ip}: {get_param: [nems_fe_nems_user_web_net_ips, 0]} + ${nems.userweb.netmask}: {get_param: nems_user_web_netmask} + ${nems.userweb.gateway}: {get_param: nems_user_web_gateway} + ${nems.imap.ip}: {get_param: [nems_fe_nems_imap_net_ips, 0]} + ${nems.imap.netmask}: {get_param: nems_imap_netmask} + ${nems.be.internal.ip}: {get_param: nems_be_nems_internal_net_ips} + ${nems.be.imap.ip}: {get_param: nems_be_nems_imap_net_ips} + ${nems.mgmt.route.1}: {get_param: oam_network_route_1} + ${nems.mgmt.route.2}: {get_param: oam_network_route_2} + ${nems.external.dns}: {get_param: external_dns} + ${nems.external.ntp}: {get_param: external_ntp} + ${nems.node}: {get_param: [nems_fe_node_roles, 0]} + ${nems.fe0.host.name}: {get_param: [nems_fe_names, 0]} + ${nems.fe1.host.name}: {get_param: [nems_fe_names, 1]} + ${nems.be0.host.name}: {get_param: nems_be_names} + ${nems.timezone}: {get_param: timezone} + user_data_format: RAW + + nems1_fe_volume: + type: OS::Cinder::Volume + properties: + size: {get_param: nems_volume_size} + volume_type: {get_param: NEMS_FE_volume_type} + + nems1_fe_volume_attachment: + type: OS::Cinder::VolumeAttachment + properties: + volume_id: {get_resource: nems1_fe_volume} + instance_uuid: {get_resource: server_nems_fe1} + + nems_fe1_port_0: + type: OS::Neutron::Port + properties: + network: {get_param: oam_net_name} + fixed_ips: [ + "ip_address": { get_param: [nems_fe_oam_ips, 0] } + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + nems_fe1_port_1: + type: OS::Neutron::Port + properties: + network_id: { get_resource: nems_traffic_net } + fixed_ips: [ + "ip_address": { get_param: [nems_fe_nems_traffic_net_ips, 0] } + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + nems_fe1_port_2: + type: OS::Neutron::Port + properties: + network_id: { get_resource: nems_user_web_net } + fixed_ips: [ + "ip_address": { get_param: [nems_fe_nems_user_web_net_ips, 0] } + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + nems_fe1_port_3: + type: OS::Neutron::Port + properties: + network_id: { get_resource: nems_internal_net } + fixed_ips: [ + "ip_address": { get_param: [nems_fe_nems_internal_net_ips, 0] } + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + nems_fe1_port_4: + type: OS::Neutron::Port + properties: + network_id: { get_resource: nems_imap_net } + fixed_ips: [ + "ip_address": { get_param: [nems_fe_nems_imap_net_ips, 0] } + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + server_nems_fe2: + type: OS::Nova::Server + properties: + name: { get_param: [nems_fe_names, 1] } + image: { get_param: nems_fe_image } + availability_zone: { get_param: availability_zone_0 } + flavor: { get_param: nems_fe_flavor } + networks: + - port: { get_resource: nems_fe2_port_0 } + - port: { get_resource: nems_fe2_port_1 } + - port: { get_resource: nems_fe2_port_2 } + - port: { get_resource: nems_fe2_port_3 } + - port: { get_resource: nems_fe2_port_4 } + metadata: + vnf_id: { get_param: vnf_id } + user_data: + str_replace: + template: | + nems.mgmt.ip=${nems.mgmt.ip} + nems.mgmt.netmask=${nems.mgmt.netmask} + nems.mgmt.gateway=${nems.mgmt.gateway} + nems.traffic.ip=${nems.traffic.ip} + nems.traffic.netmask=${nems.traffic.netmask} + nems.traffic.gateway=${nems.traffic.gateway} + nems.fe0.internal.ip=${nems.fe0.internal.ip} + nems.fe1.internal.ip=${nems.fe1.internal.ip} + nems.internal.netmask=${nems.internal.netmask} + nems.userweb.ip=${nems.userweb.ip} + nems.userweb.netmask=${nems.userweb.netmask} + nems.userweb.gateway=${nems.userweb.gateway} + nems.imap.ip=${nems.imap.ip} + nems.imap.netmask=${nems.imap.netmask} + nems.be.internal.ip=${nems.be.internal.ip} + nems.be.imap.ip=${nems.be.imap.ip} + nems.mgmt.route.1=${nems.mgmt.route.1} + nems.mgmt.route.2=${nems.mgmt.route.2} + nems.external.dns=${nems.external.dns} + nems.external.ntp=${nems.external.ntp} + nems.node=${nems.node} + nems.be0.host.name=${nems.be0.host.name} + nems.fe0.host.name=${nems.fe0.host.name} + nems.fe1.host.name=${nems.fe1.host.name} + nems.timezone=${nems.timezone} + params: + ${nems.mgmt.ip}: {get_param: [nems_fe_oam_ips, 1]} + ${nems.mgmt.netmask}: {get_param: oam_network_netmask} + ${nems.mgmt.gateway}: {get_param: oam_network_gateway} + ${nems.traffic.ip}: {get_param: [nems_fe_nems_traffic_net_ips, 1]} + ${nems.traffic.netmask}: {get_param: nems_traffic_netmask} + ${nems.traffic.gateway}: {get_param: nems_traffic_gateway} + ${nems.fe0.internal.ip}: {get_param: [nems_fe_nems_internal_net_ips, 0]} + ${nems.fe1.internal.ip}: {get_param: [nems_fe_nems_internal_net_ips, 1]} + ${nems.internal.netmask}: {get_param: nems_internal_netmask} + ${nems.userweb.ip}: {get_param: [nems_fe_nems_user_web_net_ips, 1]} + ${nems.userweb.netmask}: {get_param: nems_user_web_netmask} + ${nems.userweb.gateway}: {get_param: nems_user_web_gateway} + ${nems.imap.ip}: {get_param: [nems_fe_nems_imap_net_ips, 1]} + ${nems.imap.netmask}: {get_param: nems_imap_netmask} + ${nems.be.internal.ip}: {get_param: nems_be_nems_internal_net_ips} + ${nems.be.imap.ip}: {get_param: nems_be_nems_imap_net_ips} + ${nems.mgmt.route.1}: {get_param: oam_network_route_1} + ${nems.mgmt.route.2}: {get_param: oam_network_route_2} + ${nems.external.dns}: {get_param: external_dns} + ${nems.external.ntp}: {get_param: external_ntp} + ${nems.node}: {get_param: [nems_fe_node_roles, 1]} + ${nems.fe0.host.name}: {get_param: [nems_fe_names, 0]} + ${nems.fe1.host.name}: {get_param: [nems_fe_names, 1]} + ${nems.be0.host.name}: {get_param: nems_be_names} + ${nems.timezone}: {get_param: timezone} + user_data_format: RAW + + nems2_fe_volume: + type: OS::Cinder::Volume + properties: + size: {get_param: nems_volume_size} + volume_type: {get_param: NEMS_FE_volume_type} + + nems2_fe_volume_attachment: + type: OS::Cinder::VolumeAttachment + properties: + volume_id: {get_resource: nems2_fe_volume} + instance_uuid: {get_resource: server_nems_fe2} + + nems_fe2_port_0: + type: OS::Neutron::Port + properties: + network: {get_param: oam_net_name} + fixed_ips: [ + "ip_address": {get_param: [nems_fe_oam_ips, 1]} + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + nems_fe2_port_1: + type: OS::Neutron::Port + properties: + network_id: { get_resource: nems_traffic_net } + fixed_ips: [ + "ip_address": { get_param: [nems_fe_nems_traffic_net_ips, 1] } + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + nems_fe2_port_2: + type: OS::Neutron::Port + properties: + network_id: { get_resource: nems_user_web_net } + fixed_ips: [ + "ip_address": { get_param: [nems_fe_nems_user_web_net_ips, 1] } + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + nems_fe2_port_3: + type: OS::Neutron::Port + properties: + network_id: { get_resource: nems_internal_net } + fixed_ips: [ + "ip_address": { get_param: [nems_fe_nems_internal_net_ips, 1] } + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + + nems_fe2_port_4: + type: OS::Neutron::Port + properties: + network_id: { get_resource: nems_imap_net } + fixed_ips: [ + "ip_address": { get_param: [nems_fe_nems_imap_net_ips, 1] } + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + server_nems_be1: + type: OS::Nova::Server + properties: + name: { get_param: nems_be_names } + image: { get_param: nems_be_image } + availability_zone: { get_param: availability_zone_0 } + flavor: { get_param: nems_be_flavor } + networks: + - port: { get_resource: nems_be1_port_0 } + - port: { get_resource: nems_be1_port_1 } + - port: { get_resource: nems_be1_port_2 } + metadata: + vnf_id: { get_param: vnf_id } + user_data: + str_replace: + template: | + nems.be.mgmt.ip=${nems.be.mgmt.ip} + nems.mgmt.netmask=${nems.mgmt.netmask} + nems.mgmt.gateway=${nems.mgmt.gateway} + nems.be.internal.ip=${nems.be.internal.ip} + nems.internal.netmask=${nems.internal.netmask} + nems.imap.netmask=${nems.imap.netmask} + nems.fe0.internal.ip=${nems.fe0.internal.ip} + nems.fe1.internal.ip=${nems.fe1.internal.ip} + nems.be.imap.ip=${nems.be.imap.ip} + nems.mgmt.route.1=${nems.mgmt.route.1} + nems.mgmt.route.2=${nems.mgmt.route.2} + nems.external.dns=${nems.external.dns} + nems.external.ntp=${nems.external.ntp} + nems.node=${nems.node} + nems.be0.host.name=${nems.be0.host.name} + nems.fe0.host.name=${nems.fe0.host.name} + nems.fe1.host.name=${nems.fe1.host.name} + nems.timezone=${nems.timezone} + params: + ${nems.be.mgmt.ip}: {get_param: nems_be_oam_ips} + ${nems.mgmt.netmask}: {get_param: oam_network_netmask} + ${nems.mgmt.gateway}: {get_param: oam_network_gateway} + ${nems.fe0.internal.ip}: {get_param: [nems_fe_nems_internal_net_ips, 0]} + ${nems.fe1.internal.ip}: {get_param: [nems_fe_nems_internal_net_ips, 1]} + ${nems.be.internal.ip}: {get_param: nems_be_nems_internal_net_ips} + ${nems.internal.netmask}: {get_param: nems_internal_netmask} + ${nems.imap.netmask}: {get_param: nems_imap_netmask} + ${nems.be.imap.ip}: {get_param: nems_be_nems_imap_net_ips} + ${nems.mgmt.route.1}: {get_param: oam_network_route_1} + ${nems.mgmt.route.2}: {get_param: oam_network_route_2} + ${nems.external.dns}: {get_param: external_dns} + ${nems.external.ntp}: {get_param: external_ntp} + ${nems.node}: {get_param: nems_be_node_roles} + ${nems.be0.host.name}: {get_param: nems_be_names} + ${nems.fe0.host.name}: {get_param: [nems_fe_names, 0]} + ${nems.fe1.host.name}: {get_param: [nems_fe_names, 1]} + ${nems.timezone}: {get_param: timezone} + user_data_format: RAW + + nems_be_volume: + type: OS::Cinder::Volume + properties: + size: {get_param: nems_be_volume_size} + volume_type: {get_param: NEMS_BE_volume_type} + + nems_volume_attachment: + type: OS::Cinder::VolumeAttachment + properties: + volume_id: {get_resource: nems_be_volume} + instance_uuid: {get_resource: server_nems_be1} + + + nems_be1_port_0: + type: OS::Neutron::Port + properties: + network: {get_param: oam_net_name} + fixed_ips: [ + "ip_address": { get_param: nems_be_oam_ips} + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + nems_be1_port_1: + type: OS::Neutron::Port + properties: + network_id: { get_resource: nems_internal_net } + fixed_ips: [ + "ip_address": { get_param: nems_be_nems_internal_net_ips} + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + nems_be1_port_2: + type: OS::Neutron::Port + properties: + network_id: { get_resource: nems_imap_net } + fixed_ips: [ + "ip_address": { get_param: nems_be_nems_imap_net_ips} + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + server_eca_trx1: + type: OS::Nova::Server + properties: + name: { get_param: [eca_trx_names, 0]} + image: { get_param: eca_trx_image } + availability_zone: { get_param: availability_zone_0 } + flavor: { get_param: eca_trx_flavor } + networks: + - port: { get_resource: eca_trx1_port_0 } + - port: { get_resource: eca_trx1_port_1 } + - port: { get_resource: eca_trx1_port_2 } + metadata: + vnf_id: { get_param: vnf_id } + user_data: + str_replace: + template: | + #!/bin/bash + touch /tmp/user_data.log + sed -i s/HOSTNAME.*/"HOSTNAME=trx_hostname"/g /etc/sysconfig/network + echo "172.26.8.6 puppet" > /etc/hosts + eth0_ip_address='trx_traf_ip_address' + eth0_gateway='172.26.5.3' + echo "$eth0_ip_address" >>/tmp/user_data.log + for interface in $(ip addr show|perl -nle 's/\d:\s([a-z0-9]*?):/print $1/e') ; do + if [ "$interface" != "lo" ]; then + DEVICE_NAME=$interface + interface_ip_var="${DEVICE_NAME}_ip_address" + gateway_var="${DEVICE_NAME}_gateway" + var_name="$interface_ip_var" + var_gateway="$gateway_var" + if [ ! -z ${!var_name} ]; then + IPADDR=${!var_name} + BOOTPROTO="static" + GATEWAY=${!var_gateway} + IFCFG_TEMPLATE="DEVICE=$DEVICE_NAME\nNM_CONTROLLED=no\nONBOOT=yes\nUSERCTL=no" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nBOOTPROTO=$BOOTPROTO" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nIPADDR=$IPADDR" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nNETMASK=255.255.255.0" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nGATEWAY=$GATEWAY" + printf $IFCFG_TEMPLATE > /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME + else + if [ ! -f /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME ]; then + echo "Configuring $DEVICE_NAME to use DHCP" + IFCFG_TEMPLATE="DEVICE=$DEVICE_NAME\nNM_CONTROLLED=no\nONBOOT=yes" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nBOOTPROTO=dhcp\nUSERCTL=no" + printf $IFCFG_TEMPLATE > /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME + fi + fi + ifdown $DEVICE_NAME + ifup $DEVICE_NAME + printf "$DEVICE_NAME\n" >> /tmp/network_config + fi + done + puppet agent -t > /root/puppet-agent-t.out + params: + trx_hostname: {get_param: [eca_trx_names, 0]} + trx_traf_ip_address: {get_param: [eca_trx_eca_traffic_net_ips, 0]} + + eca_trx1_port_0: + type: OS::Neutron::Port + properties: + network: { get_param: oam_net_name } + fixed_ips: [ + "ip_address": { get_param: [eca_trx_oam_ips, 0] } + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + eca_trx1_port_1: + type: OS::Neutron::Port + properties: + network: { get_param: eca_mgmt_net_name } + fixed_ips: [ + "ip_address": { get_param: [eca_trx_mgmt_ips, 0] } + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + eca_trx1_port_2: + type: OS::Neutron::Port + properties: + network_id: { get_resource: eca_traffic_net } + fixed_ips: [ + "ip_address": { get_param: [eca_trx_eca_traffic_net_ips, 0] } + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + + server_eca_trx2: + type: OS::Nova::Server + properties: + name: { get_param: [eca_trx_names, 1]} + image: { get_param: eca_trx_image } + availability_zone: { get_param: availability_zone_0 } + flavor: { get_param: eca_trx_flavor } + networks: + - port: { get_resource: eca_trx2_port_0 } + - port: { get_resource: eca_trx2_port_1 } + - port: { get_resource: eca_trx2_port_2 } + metadata: + vnf_id: { get_param: vnf_id } + user_data: + str_replace: + template: | + #!/bin/bash + touch /tmp/user_data.log + sed -i s/HOSTNAME.*/"HOSTNAME=trx_hostname"/g /etc/sysconfig/network + echo "172.26.8.6 puppet" > /etc/hosts + eth0_ip_address='trx_traf_ip_address' + eth0_gateway='172.26.5.3' + echo "$eth0_ip_address" >>/tmp/user_data.log + for interface in $(ip addr show|perl -nle 's/\d:\s([a-z0-9]*?):/print $1/e') ; do + if [ "$interface" != "lo" ]; then + DEVICE_NAME=$interface + interface_ip_var="${DEVICE_NAME}_ip_address" + gateway_var="${DEVICE_NAME}_gateway" + var_name="$interface_ip_var" + var_gateway="$gateway_var" + if [ ! -z ${!var_name} ]; then + IPADDR=${!var_name} + BOOTPROTO="static" + GATEWAY=${!var_gateway} + IFCFG_TEMPLATE="DEVICE=$DEVICE_NAME\nNM_CONTROLLED=no\nONBOOT=yes\nUSERCTL=no" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nBOOTPROTO=$BOOTPROTO" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nIPADDR=$IPADDR" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nNETMASK=255.255.255.0" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nGATEWAY=$GATEWAY" + printf $IFCFG_TEMPLATE > /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME + else + if [ ! -f /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME ]; then + echo "Configuring $DEVICE_NAME to use DHCP" + IFCFG_TEMPLATE="DEVICE=$DEVICE_NAME\nNM_CONTROLLED=no\nONBOOT=yes" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nBOOTPROTO=dhcp\nUSERCTL=no" + printf $IFCFG_TEMPLATE > /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME + fi + fi + ifdown $DEVICE_NAME + ifup $DEVICE_NAME + printf "$DEVICE_NAME\n" >> /tmp/network_config + fi + done + puppet agent -t > /root/puppet-agent-t.out + params: + trx_hostname: {get_param: [eca_trx_names, 1]} + trx_traf_ip_address: {get_param: [eca_trx_eca_traffic_net_ips, 1]} + + eca_trx2_port_0: + type: OS::Neutron::Port + properties: + network: { get_param: oam_net_name } + fixed_ips: [ + "ip_address": { get_param: [eca_trx_oam_ips, 1] } + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + eca_trx2_port_1: + type: OS::Neutron::Port + properties: + network: { get_param: eca_mgmt_net_name } + fixed_ips: [ + "ip_address": { get_param: [eca_trx_mgmt_ips, 1] } + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + eca_trx2_port_2: + type: OS::Neutron::Port + properties: + network_id: { get_resource: eca_traffic_net } + fixed_ips: [ + "ip_address": { get_param: [eca_trx_eca_traffic_net_ips, 1] } + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + server_eca_trx3: + type: OS::Nova::Server + properties: + name: { get_param: [eca_trx_names, 2]} + image: { get_param: eca_trx_image } + availability_zone: { get_param: availability_zone_0 } + flavor: { get_param: eca_trx_flavor } + networks: + - port: { get_resource: eca_trx3_port_0 } + - port: { get_resource: eca_trx3_port_1 } + - port: { get_resource: eca_trx3_port_2 } + metadata: + vnf_id: { get_param: vnf_id } + user_data: + str_replace: + template: | + #!/bin/bash + touch /tmp/user_data.log + sed -i s/HOSTNAME.*/"HOSTNAME=trx_hostname"/g /etc/sysconfig/network + echo "172.26.8.6 puppet" > /etc/hosts + eth0_ip_address='trx_traf_ip_address' + eth0_gateway='172.26.5.3' + echo "$eth0_ip_address" >>/tmp/user_data.log + for interface in $(ip addr show|perl -nle 's/\d:\s([a-z0-9]*?):/print $1/e') ; do + if [ "$interface" != "lo" ]; then + DEVICE_NAME=$interface + interface_ip_var="${DEVICE_NAME}_ip_address" + gateway_var="${DEVICE_NAME}_gateway" + var_name="$interface_ip_var" + var_gateway="$gateway_var" + if [ ! -z ${!var_name} ]; then + IPADDR=${!var_name} + BOOTPROTO="static" + GATEWAY=${!var_gateway} + IFCFG_TEMPLATE="DEVICE=$DEVICE_NAME\nNM_CONTROLLED=no\nONBOOT=yes\nUSERCTL=no" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nBOOTPROTO=$BOOTPROTO" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nIPADDR=$IPADDR" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nNETMASK=255.255.255.0" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nGATEWAY=$GATEWAY" + printf $IFCFG_TEMPLATE > /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME + else + if [ ! -f /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME ]; then + echo "Configuring $DEVICE_NAME to use DHCP" + IFCFG_TEMPLATE="DEVICE=$DEVICE_NAME\nNM_CONTROLLED=no\nONBOOT=yes" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nBOOTPROTO=dhcp\nUSERCTL=no" + printf $IFCFG_TEMPLATE > /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME + fi + fi + ifdown $DEVICE_NAME + ifup $DEVICE_NAME + printf "$DEVICE_NAME\n" >> /tmp/network_config + fi + done + puppet agent -t > /root/puppet-agent-t.out + params: + trx_hostname: {get_param: [eca_trx_names, 2]} + trx_traf_ip_address: {get_param: [eca_trx_eca_traffic_net_ips, 2]} + + eca_trx3_port_0: + type: OS::Neutron::Port + properties: + network: { get_param: oam_net_name } + fixed_ips: [ + "ip_address": { get_param: [eca_trx_oam_ips, 2] } + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + eca_trx3_port_1: + type: OS::Neutron::Port + properties: + network: { get_param: eca_mgmt_net_name } + fixed_ips: [ + "ip_address": { get_param: [eca_trx_mgmt_ips, 2] } + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + eca_trx3_port_2: + type: OS::Neutron::Port + properties: + network_id: { get_resource: eca_traffic_net } + fixed_ips: [ + "ip_address": { get_param: [eca_trx_eca_traffic_net_ips, 2] } + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + server_eca_trx4: + type: OS::Nova::Server + properties: + name: { get_param: [eca_trx_names, 3]} + image: { get_param: eca_trx_image } + availability_zone: { get_param: availability_zone_0 } + flavor: { get_param: eca_trx_flavor } + networks: + - port: { get_resource: eca_trx4_port_0 } + - port: { get_resource: eca_trx4_port_1 } + - port: { get_resource: eca_trx4_port_2 } + metadata: + vnf_id: { get_param: vnf_id } + user_data: + str_replace: + template: | + #!/bin/bash + touch /tmp/user_data.log + sed -i s/HOSTNAME.*/"HOSTNAME=trx_hostname"/g /etc/sysconfig/network + echo "172.26.8.6 puppet" > /etc/hosts + eth0_ip_address='trx_traf_ip_address' + eth0_gateway='172.26.5.3' + echo "$eth0_ip_address" >>/tmp/user_data.log + for interface in $(ip addr show|perl -nle 's/\d:\s([a-z0-9]*?):/print $1/e') ; do + if [ "$interface" != "lo" ]; then + DEVICE_NAME=$interface + interface_ip_var="${DEVICE_NAME}_ip_address" + gateway_var="${DEVICE_NAME}_gateway" + var_name="$interface_ip_var" + var_gateway="$gateway_var" + if [ ! -z ${!var_name} ]; then + IPADDR=${!var_name} + BOOTPROTO="static" + GATEWAY=${!var_gateway} + IFCFG_TEMPLATE="DEVICE=$DEVICE_NAME\nNM_CONTROLLED=no\nONBOOT=yes\nUSERCTL=no" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nBOOTPROTO=$BOOTPROTO" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nIPADDR=$IPADDR" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nNETMASK=255.255.255.0" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nGATEWAY=$GATEWAY" + printf $IFCFG_TEMPLATE > /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME + else + if [ ! -f /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME ]; then + echo "Configuring $DEVICE_NAME to use DHCP" + IFCFG_TEMPLATE="DEVICE=$DEVICE_NAME\nNM_CONTROLLED=no\nONBOOT=yes" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nBOOTPROTO=dhcp\nUSERCTL=no" + printf $IFCFG_TEMPLATE > /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME + fi + fi + ifdown $DEVICE_NAME + ifup $DEVICE_NAME + printf "$DEVICE_NAME\n" >> /tmp/network_config + fi + done + puppet agent -t > /root/puppet-agent-t.out + params: + trx_hostname: {get_param: [eca_trx_names, 3]} + trx_traf_ip_address: {get_param: [eca_trx_eca_traffic_net_ips, 3]} + + eca_trx4_port_0: + type: OS::Neutron::Port + properties: + network: { get_param: oam_net_name } + fixed_ips: [ + "ip_address": { get_param: [eca_trx_oam_ips, 3] } + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + eca_trx4_port_1: + type: OS::Neutron::Port + properties: + network: { get_param: eca_mgmt_net_name } + fixed_ips: [ + "ip_address": { get_param: [eca_trx_mgmt_ips, 3] } + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + eca_trx4_port_2: + type: OS::Neutron::Port + properties: + network_id: { get_resource: eca_traffic_net } + fixed_ips: [ + "ip_address": { get_param: [eca_trx_eca_traffic_net_ips, 3] } + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + server_eca_trx5: + type: OS::Nova::Server + properties: + name: { get_param: [eca_trx_names, 4]} + image: { get_param: eca_trx_image } + availability_zone: { get_param: availability_zone_0 } + flavor: { get_param: eca_trx_flavor } + networks: + - port: { get_resource: eca_trx5_port_0 } + - port: { get_resource: eca_trx5_port_1 } + - port: { get_resource: eca_trx5_port_2 } + metadata: + vnf_id: { get_param: vnf_id } + user_data: + str_replace: + template: | + #!/bin/bash + touch /tmp/user_data.log + sed -i s/HOSTNAME.*/"HOSTNAME=trx_hostname"/g /etc/sysconfig/network + echo "172.26.8.6 puppet" > /etc/hosts + eth0_ip_address='trx_traf_ip_address' + eth0_gateway='172.26.5.3' + echo "$eth0_ip_address" >>/tmp/user_data.log + for interface in $(ip addr show|perl -nle 's/\d:\s([a-z0-9]*?):/print $1/e') ; do + if [ "$interface" != "lo" ]; then + DEVICE_NAME=$interface + interface_ip_var="${DEVICE_NAME}_ip_address" + gateway_var="${DEVICE_NAME}_gateway" + var_name="$interface_ip_var" + var_gateway="$gateway_var" + if [ ! -z ${!var_name} ]; then + IPADDR=${!var_name} + BOOTPROTO="static" + GATEWAY=${!var_gateway} + IFCFG_TEMPLATE="DEVICE=$DEVICE_NAME\nNM_CONTROLLED=no\nONBOOT=yes\nUSERCTL=no" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nBOOTPROTO=$BOOTPROTO" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nIPADDR=$IPADDR" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nNETMASK=255.255.255.0" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nGATEWAY=$GATEWAY" + printf $IFCFG_TEMPLATE > /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME + else + if [ ! -f /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME ]; then + echo "Configuring $DEVICE_NAME to use DHCP" + IFCFG_TEMPLATE="DEVICE=$DEVICE_NAME\nNM_CONTROLLED=no\nONBOOT=yes" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nBOOTPROTO=dhcp\nUSERCTL=no" + printf $IFCFG_TEMPLATE > /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME + fi + fi + ifdown $DEVICE_NAME + ifup $DEVICE_NAME + printf "$DEVICE_NAME\n" >> /tmp/network_config + fi + done + puppet agent -t > /root/puppet-agent-t.out + params: + trx_hostname: {get_param: [eca_trx_names, 4]} + trx_traf_ip_address: {get_param: [eca_trx_eca_traffic_net_ips, 4]} + + eca_trx5_port_0: + type: OS::Neutron::Port + properties: + network: { get_param: oam_net_name } + fixed_ips: [ + "ip_address": { get_param: [eca_trx_oam_ips, 4] } + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + eca_trx5_port_1: + type: OS::Neutron::Port + properties: + network: { get_param: eca_mgmt_net_name } + fixed_ips: [ + "ip_address": { get_param: [eca_trx_mgmt_ips, 4] } + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + eca_trx5_port_2: + type: OS::Neutron::Port + properties: + network_id: { get_resource: eca_traffic_net } + fixed_ips: [ + "ip_address": { get_param: [eca_trx_eca_traffic_net_ips, 4] } + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + server_eca_trx6: + type: OS::Nova::Server + properties: + name: { get_param: [eca_trx_names, 5]} + image: { get_param: eca_trx_image } + availability_zone: { get_param: availability_zone_0 } + flavor: { get_param: eca_trx_flavor } + networks: + - port: { get_resource: eca_trx6_port_0 } + - port: { get_resource: eca_trx6_port_1 } + - port: { get_resource: eca_trx6_port_2 } + metadata: + vnf_id: { get_param: vnf_id } + user_data: + str_replace: + template: | + #!/bin/bash + touch /tmp/user_data.log + sed -i s/HOSTNAME.*/"HOSTNAME=trx_hostname"/g /etc/sysconfig/network + echo "172.26.8.6 puppet" > /etc/hosts + eth0_ip_address='trx_traf_ip_address' + eth0_gateway='172.26.5.3' + echo "$eth0_ip_address" >>/tmp/user_data.log + for interface in $(ip addr show|perl -nle 's/\d:\s([a-z0-9]*?):/print $1/e') ; do + if [ "$interface" != "lo" ]; then + DEVICE_NAME=$interface + interface_ip_var="${DEVICE_NAME}_ip_address" + gateway_var="${DEVICE_NAME}_gateway" + var_name="$interface_ip_var" + var_gateway="$gateway_var" + if [ ! -z ${!var_name} ]; then + IPADDR=${!var_name} + BOOTPROTO="static" + GATEWAY=${!var_gateway} + IFCFG_TEMPLATE="DEVICE=$DEVICE_NAME\nNM_CONTROLLED=no\nONBOOT=yes\nUSERCTL=no" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nBOOTPROTO=$BOOTPROTO" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nIPADDR=$IPADDR" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nNETMASK=255.255.255.0" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nGATEWAY=$GATEWAY" + printf $IFCFG_TEMPLATE > /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME + else + if [ ! -f /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME ]; then + echo "Configuring $DEVICE_NAME to use DHCP" + IFCFG_TEMPLATE="DEVICE=$DEVICE_NAME\nNM_CONTROLLED=no\nONBOOT=yes" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nBOOTPROTO=dhcp\nUSERCTL=no" + printf $IFCFG_TEMPLATE > /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME + fi + fi + ifdown $DEVICE_NAME + ifup $DEVICE_NAME + printf "$DEVICE_NAME\n" >> /tmp/network_config + fi + done + puppet agent -t > /root/puppet-agent-t.out + params: + trx_hostname: {get_param: [eca_trx_names, 5]} + trx_traf_ip_address: {get_param: [eca_trx_eca_traffic_net_ips, 5]} + + eca_trx6_port_0: + type: OS::Neutron::Port + properties: + network: { get_param: oam_net_name } + fixed_ips: [ + "ip_address": { get_param: [eca_trx_oam_ips, 5] } + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + eca_trx6_port_1: + type: OS::Neutron::Port + properties: + network: { get_param: eca_mgmt_net_name } + fixed_ips: [ + "ip_address": { get_param: [eca_trx_mgmt_ips, 5] } + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + eca_trx6_port_2: + type: OS::Neutron::Port + properties: + network_id: { get_resource: eca_traffic_net } + fixed_ips: [ + "ip_address": { get_param: [eca_trx_eca_traffic_net_ips, 5] } + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + server_eca_trx7: + type: OS::Nova::Server + properties: + name: { get_param: [eca_trx_names, 6]} + image: { get_param: eca_trx_image } + availability_zone: { get_param: availability_zone_0 } + flavor: { get_param: eca_trx_flavor } + networks: + - port: { get_resource: eca_trx7_port_0 } + - port: { get_resource: eca_trx7_port_1 } + - port: { get_resource: eca_trx7_port_2 } + metadata: + vnf_id: { get_param: vnf_id } + user_data: + str_replace: + template: | + #!/bin/bash + touch /tmp/user_data.log + sed -i s/HOSTNAME.*/"HOSTNAME=trx_hostname"/g /etc/sysconfig/network + echo "172.26.8.6 puppet" > /etc/hosts + eth0_ip_address='trx_traf_ip_address' + eth0_gateway='172.26.5.3' + echo "$eth0_ip_address" >>/tmp/user_data.log + for interface in $(ip addr show|perl -nle 's/\d:\s([a-z0-9]*?):/print $1/e') ; do + if [ "$interface" != "lo" ]; then + DEVICE_NAME=$interface + interface_ip_var="${DEVICE_NAME}_ip_address" + gateway_var="${DEVICE_NAME}_gateway" + var_name="$interface_ip_var" + var_gateway="$gateway_var" + if [ ! -z ${!var_name} ]; then + IPADDR=${!var_name} + BOOTPROTO="static" + GATEWAY=${!var_gateway} + IFCFG_TEMPLATE="DEVICE=$DEVICE_NAME\nNM_CONTROLLED=no\nONBOOT=yes\nUSERCTL=no" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nBOOTPROTO=$BOOTPROTO" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nIPADDR=$IPADDR" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nNETMASK=255.255.255.0" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nGATEWAY=$GATEWAY" + printf $IFCFG_TEMPLATE > /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME + else + if [ ! -f /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME ]; then + echo "Configuring $DEVICE_NAME to use DHCP" + IFCFG_TEMPLATE="DEVICE=$DEVICE_NAME\nNM_CONTROLLED=no\nONBOOT=yes" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nBOOTPROTO=dhcp\nUSERCTL=no" + printf $IFCFG_TEMPLATE > /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME + fi + fi + ifdown $DEVICE_NAME + ifup $DEVICE_NAME + printf "$DEVICE_NAME\n" >> /tmp/network_config + fi + done + puppet agent -t > /root/puppet-agent-t.out + params: + trx_hostname: {get_param: [eca_trx_names, 6]} + trx_traf_ip_address: {get_param: [eca_trx_eca_traffic_net_ips, 6]} + + eca_trx7_port_0: + type: OS::Neutron::Port + properties: + network: { get_param: oam_net_name } + fixed_ips: [ + "ip_address": { get_param: [eca_trx_oam_ips, 6] } + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + eca_trx7_port_1: + type: OS::Neutron::Port + properties: + network: { get_param: eca_mgmt_net_name } + fixed_ips: [ + "ip_address": { get_param: [eca_trx_mgmt_ips, 6] } + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + eca_trx7_port_2: + type: OS::Neutron::Port + properties: + network_id: { get_resource: eca_traffic_net } + fixed_ips: [ + "ip_address": { get_param: [eca_trx_eca_traffic_net_ips, 6] } + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + server_eca_trx8: + type: OS::Nova::Server + properties: + name: { get_param: [eca_trx_names, 7]} + image: { get_param: eca_trx_image } + availability_zone: { get_param: availability_zone_0 } + flavor: { get_param: eca_trx_flavor } + networks: + - port: { get_resource: eca_trx8_port_0 } + - port: { get_resource: eca_trx8_port_1 } + - port: { get_resource: eca_trx8_port_2 } + metadata: + vnf_id: { get_param: vnf_id } + user_data: + str_replace: + template: | + #!/bin/bash + touch /tmp/user_data.log + sed -i s/HOSTNAME.*/"HOSTNAME=trx_hostname"/g /etc/sysconfig/network + echo "172.26.8.6 puppet" > /etc/hosts + eth0_ip_address='trx_traf_ip_address' + eth0_gateway='172.26.5.3' + echo "$eth0_ip_address" >>/tmp/user_data.log + for interface in $(ip addr show|perl -nle 's/\d:\s([a-z0-9]*?):/print $1/e') ; do + if [ "$interface" != "lo" ]; then + DEVICE_NAME=$interface + interface_ip_var="${DEVICE_NAME}_ip_address" + gateway_var="${DEVICE_NAME}_gateway" + var_name="$interface_ip_var" + var_gateway="$gateway_var" + if [ ! -z ${!var_name} ]; then + IPADDR=${!var_name} + BOOTPROTO="static" + GATEWAY=${!var_gateway} + IFCFG_TEMPLATE="DEVICE=$DEVICE_NAME\nNM_CONTROLLED=no\nONBOOT=yes\nUSERCTL=no" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nBOOTPROTO=$BOOTPROTO" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nIPADDR=$IPADDR" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nNETMASK=255.255.255.0" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nGATEWAY=$GATEWAY" + printf $IFCFG_TEMPLATE > /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME + else + if [ ! -f /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME ]; then + echo "Configuring $DEVICE_NAME to use DHCP" + IFCFG_TEMPLATE="DEVICE=$DEVICE_NAME\nNM_CONTROLLED=no\nONBOOT=yes" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nBOOTPROTO=dhcp\nUSERCTL=no" + printf $IFCFG_TEMPLATE > /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME + fi + fi + ifdown $DEVICE_NAME + ifup $DEVICE_NAME + printf "$DEVICE_NAME\n" >> /tmp/network_config + fi + done + puppet agent -t > /root/puppet-agent-t.out + params: + trx_hostname: {get_param: [eca_trx_names, 7]} + trx_traf_ip_address: {get_param: [eca_trx_eca_traffic_net_ips, 7]} + + eca_trx8_port_0: + type: OS::Neutron::Port + properties: + network: { get_param: oam_net_name } + fixed_ips: [ + "ip_address": { get_param: [eca_trx_oam_ips, 7] } + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + eca_trx8_port_1: + type: OS::Neutron::Port + properties: + network: { get_param: eca_mgmt_net_name } + fixed_ips: [ + "ip_address": { get_param: [eca_trx_mgmt_ips, 7] } + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + eca_trx8_port_2: + type: OS::Neutron::Port + properties: + network_id: { get_resource: eca_traffic_net } + fixed_ips: [ + "ip_address": { get_param: [eca_trx_eca_traffic_net_ips, 7] } + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + server_eca_trx9: + type: OS::Nova::Server + properties: + name: { get_param: [eca_trx_names, 8]} + image: { get_param: eca_trx_image } + availability_zone: { get_param: availability_zone_0 } + flavor: { get_param: eca_trx_flavor } + networks: + - port: { get_resource: eca_trx9_port_0 } + - port: { get_resource: eca_trx9_port_1 } + - port: { get_resource: eca_trx9_port_2 } + metadata: + vnf_id: { get_param: vnf_id } + user_data: + str_replace: + template: | + #!/bin/bash + touch /tmp/user_data.log + sed -i s/HOSTNAME.*/"HOSTNAME=trx_hostname"/g /etc/sysconfig/network + echo "172.26.8.6 puppet" > /etc/hosts + eth0_ip_address='trx_traf_ip_address' + eth0_gateway='172.26.5.3' + echo "$eth0_ip_address" >>/tmp/user_data.log + for interface in $(ip addr show|perl -nle 's/\d:\s([a-z0-9]*?):/print $1/e') ; do + if [ "$interface" != "lo" ]; then + DEVICE_NAME=$interface + interface_ip_var="${DEVICE_NAME}_ip_address" + gateway_var="${DEVICE_NAME}_gateway" + var_name="$interface_ip_var" + var_gateway="$gateway_var" + if [ ! -z ${!var_name} ]; then + IPADDR=${!var_name} + BOOTPROTO="static" + GATEWAY=${!var_gateway} + IFCFG_TEMPLATE="DEVICE=$DEVICE_NAME\nNM_CONTROLLED=no\nONBOOT=yes\nUSERCTL=no" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nBOOTPROTO=$BOOTPROTO" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nIPADDR=$IPADDR" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nNETMASK=255.255.255.0" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nGATEWAY=$GATEWAY" + printf $IFCFG_TEMPLATE > /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME + else + if [ ! -f /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME ]; then + echo "Configuring $DEVICE_NAME to use DHCP" + IFCFG_TEMPLATE="DEVICE=$DEVICE_NAME\nNM_CONTROLLED=no\nONBOOT=yes" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nBOOTPROTO=dhcp\nUSERCTL=no" + printf $IFCFG_TEMPLATE > /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME + fi + fi + ifdown $DEVICE_NAME + ifup $DEVICE_NAME + printf "$DEVICE_NAME\n" >> /tmp/network_config + fi + done + puppet agent -t > /root/puppet-agent-t.out + params: + trx_hostname: {get_param: [eca_trx_names, 8]} + trx_traf_ip_address: {get_param: [eca_trx_eca_traffic_net_ips, 8]} + + eca_trx9_port_0: + type: OS::Neutron::Port + properties: + network: { get_param: oam_net_name } + fixed_ips: [ + "ip_address": { get_param: [eca_trx_oam_ips, 8] } + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + eca_trx9_port_1: + type: OS::Neutron::Port + properties: + network: { get_param: eca_mgmt_net_name } + fixed_ips: [ + "ip_address": { get_param: [eca_trx_mgmt_ips, 8] } + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + eca_trx9_port_2: + type: OS::Neutron::Port + properties: + network_id: { get_resource: eca_traffic_net } + fixed_ips: [ + "ip_address": { get_param: [eca_trx_eca_traffic_net_ips, 8] } + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + server_eca_trx10: + type: OS::Nova::Server + properties: + name: { get_param: [eca_trx_names, 9]} + image: { get_param: eca_trx_image } + availability_zone: { get_param: availability_zone_0 } + flavor: { get_param: eca_trx_flavor } + networks: + - port: { get_resource: eca_trx10_port_0 } + - port: { get_resource: eca_trx10_port_1 } + - port: { get_resource: eca_trx10_port_2 } + metadata: + vnf_id: { get_param: vnf_id } + user_data: + str_replace: + template: | + #!/bin/bash + touch /tmp/user_data.log + sed -i s/HOSTNAME.*/"HOSTNAME=trx_hostname"/g /etc/sysconfig/network + echo "172.26.8.6 puppet" > /etc/hosts + eth0_ip_address='trx_traf_ip_address' + eth0_gateway='172.26.5.3' + echo "$eth0_ip_address" >>/tmp/user_data.log + for interface in $(ip addr show|perl -nle 's/\d:\s([a-z0-9]*?):/print $1/e') ; do + if [ "$interface" != "lo" ]; then + DEVICE_NAME=$interface + interface_ip_var="${DEVICE_NAME}_ip_address" + gateway_var="${DEVICE_NAME}_gateway" + var_name="$interface_ip_var" + var_gateway="$gateway_var" + if [ ! -z ${!var_name} ]; then + IPADDR=${!var_name} + BOOTPROTO="static" + GATEWAY=${!var_gateway} + IFCFG_TEMPLATE="DEVICE=$DEVICE_NAME\nNM_CONTROLLED=no\nONBOOT=yes\nUSERCTL=no" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nBOOTPROTO=$BOOTPROTO" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nIPADDR=$IPADDR" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nNETMASK=255.255.255.0" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nGATEWAY=$GATEWAY" + printf $IFCFG_TEMPLATE > /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME + else + if [ ! -f /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME ]; then + echo "Configuring $DEVICE_NAME to use DHCP" + IFCFG_TEMPLATE="DEVICE=$DEVICE_NAME\nNM_CONTROLLED=no\nONBOOT=yes" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nBOOTPROTO=dhcp\nUSERCTL=no" + printf $IFCFG_TEMPLATE > /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME + fi + fi + ifdown $DEVICE_NAME + ifup $DEVICE_NAME + printf "$DEVICE_NAME\n" >> /tmp/network_config + fi + done + puppet agent -t > /root/puppet-agent-t.out + params: + trx_hostname: {get_param: [eca_trx_names, 9]} + trx_traf_ip_address: {get_param: [eca_trx_eca_traffic_net_ips, 9]} + + eca_trx10_port_0: + type: OS::Neutron::Port + properties: + network: { get_param: oam_net_name } + fixed_ips: [ + "ip_address": { get_param: [eca_trx_oam_ips, 9] } + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + eca_trx10_port_1: + type: OS::Neutron::Port + properties: + network: { get_param: eca_mgmt_net_name } + fixed_ips: [ + "ip_address": { get_param: [eca_trx_mgmt_ips, 9] } + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + eca_trx10_port_2: + type: OS::Neutron::Port + properties: + network_id: { get_resource: eca_traffic_net } + fixed_ips: [ + "ip_address": { get_param: [eca_trx_eca_traffic_net_ips, 9] } + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + server_eca_trx11: + type: OS::Nova::Server + properties: + name: { get_param: [eca_trx_names, 10]} + image: { get_param: eca_trx_image } + availability_zone: { get_param: availability_zone_0 } + flavor: { get_param: eca_trx_flavor } + networks: + - port: { get_resource: eca_trx11_port_0 } + - port: { get_resource: eca_trx11_port_1 } + - port: { get_resource: eca_trx11_port_2 } + metadata: + vnf_id: { get_param: vnf_id } + user_data: + str_replace: + template: | + #!/bin/bash + touch /tmp/user_data.log + sed -i s/HOSTNAME.*/"HOSTNAME=trx_hostname"/g /etc/sysconfig/network + echo "172.26.8.6 puppet" > /etc/hosts + eth0_ip_address='trx_traf_ip_address' + eth0_gateway='172.26.5.3' + echo "$eth0_ip_address" >>/tmp/user_data.log + for interface in $(ip addr show|perl -nle 's/\d:\s([a-z0-9]*?):/print $1/e') ; do + if [ "$interface" != "lo" ]; then + DEVICE_NAME=$interface + interface_ip_var="${DEVICE_NAME}_ip_address" + gateway_var="${DEVICE_NAME}_gateway" + var_name="$interface_ip_var" + var_gateway="$gateway_var" + if [ ! -z ${!var_name} ]; then + IPADDR=${!var_name} + BOOTPROTO="static" + GATEWAY=${!var_gateway} + IFCFG_TEMPLATE="DEVICE=$DEVICE_NAME\nNM_CONTROLLED=no\nONBOOT=yes\nUSERCTL=no" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nBOOTPROTO=$BOOTPROTO" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nIPADDR=$IPADDR" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nNETMASK=255.255.255.0" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nGATEWAY=$GATEWAY" + printf $IFCFG_TEMPLATE > /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME + else + if [ ! -f /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME ]; then + echo "Configuring $DEVICE_NAME to use DHCP" + IFCFG_TEMPLATE="DEVICE=$DEVICE_NAME\nNM_CONTROLLED=no\nONBOOT=yes" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nBOOTPROTO=dhcp\nUSERCTL=no" + printf $IFCFG_TEMPLATE > /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME + fi + fi + ifdown $DEVICE_NAME + ifup $DEVICE_NAME + printf "$DEVICE_NAME\n" >> /tmp/network_config + fi + done + puppet agent -t > /root/puppet-agent-t.out + params: + trx_hostname: {get_param: [eca_trx_names, 10]} + trx_traf_ip_address: {get_param: [eca_trx_eca_traffic_net_ips, 10]} + + eca_trx11_port_0: + type: OS::Neutron::Port + properties: + network: { get_param: oam_net_name } + fixed_ips: [ + "ip_address": { get_param: [eca_trx_oam_ips, 10] } + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + eca_trx11_port_1: + type: OS::Neutron::Port + properties: + network: { get_param: eca_mgmt_net_name } + fixed_ips: [ + "ip_address": { get_param: [eca_trx_mgmt_ips, 10] } + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + eca_trx11_port_2: + type: OS::Neutron::Port + properties: + network_id: { get_resource: eca_traffic_net } + fixed_ips: [ + "ip_address": { get_param: [eca_trx_eca_traffic_net_ips, 10] } + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + + server_eca_trx12: + type: OS::Nova::Server + properties: + name: { get_param: [eca_trx_names, 11]} + image: { get_param: eca_trx_image } + availability_zone: { get_param: availability_zone_0 } + flavor: { get_param: eca_trx_flavor } + networks: + - port: { get_resource: eca_trx12_port_0 } + - port: { get_resource: eca_trx12_port_1 } + - port: { get_resource: eca_trx12_port_2 } + metadata: + vnf_id: { get_param: vnf_id } + user_data: + str_replace: + template: | + #!/bin/bash + touch /tmp/user_data.log + sed -i s/HOSTNAME.*/"HOSTNAME=trx_hostname"/g /etc/sysconfig/network + echo "172.26.8.6 puppet" > /etc/hosts + eth0_ip_address='trx_traf_ip_address' + eth0_gateway='172.26.5.3' + echo "$eth0_ip_address" >>/tmp/user_data.log + for interface in $(ip addr show|perl -nle 's/\d:\s([a-z0-9]*?):/print $1/e') ; do + if [ "$interface" != "lo" ]; then + DEVICE_NAME=$interface + interface_ip_var="${DEVICE_NAME}_ip_address" + gateway_var="${DEVICE_NAME}_gateway" + var_name="$interface_ip_var" + var_gateway="$gateway_var" + if [ ! -z ${!var_name} ]; then + IPADDR=${!var_name} + BOOTPROTO="static" + GATEWAY=${!var_gateway} + IFCFG_TEMPLATE="DEVICE=$DEVICE_NAME\nNM_CONTROLLED=no\nONBOOT=yes\nUSERCTL=no" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nBOOTPROTO=$BOOTPROTO" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nIPADDR=$IPADDR" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nNETMASK=255.255.255.0" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nGATEWAY=$GATEWAY" + printf $IFCFG_TEMPLATE > /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME + else + if [ ! -f /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME ]; then + echo "Configuring $DEVICE_NAME to use DHCP" + IFCFG_TEMPLATE="DEVICE=$DEVICE_NAME\nNM_CONTROLLED=no\nONBOOT=yes" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nBOOTPROTO=dhcp\nUSERCTL=no" + printf $IFCFG_TEMPLATE > /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME + fi + fi + ifdown $DEVICE_NAME + ifup $DEVICE_NAME + printf "$DEVICE_NAME\n" >> /tmp/network_config + fi + done + puppet agent -t > /root/puppet-agent-t.out + params: + trx_hostname: {get_param: [eca_trx_names, 11]} + trx_traf_ip_address: {get_param: [eca_trx_eca_traffic_net_ips, 11]} + + eca_trx12_port_0: + type: OS::Neutron::Port + properties: + network: { get_param: oam_net_name } + fixed_ips: [ + "ip_address": { get_param: [eca_trx_oam_ips, 11] } + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + eca_trx12_port_1: + type: OS::Neutron::Port + properties: + network: { get_param: eca_mgmt_net_name } + fixed_ips: [ + "ip_address": { get_param: [eca_trx_mgmt_ips, 11] } + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + eca_trx12_port_2: + type: OS::Neutron::Port + properties: + network_id: { get_resource: eca_traffic_net } + fixed_ips: [ + "ip_address": { get_param: [eca_trx_eca_traffic_net_ips, 11] } + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + server_eca_trx13: + type: OS::Nova::Server + properties: + name: { get_param: [eca_trx_names, 12]} + image: { get_param: eca_trx_image } + availability_zone: { get_param: availability_zone_0 } + flavor: { get_param: eca_trx_flavor } + networks: + - port: { get_resource: eca_trx13_port_0 } + - port: { get_resource: eca_trx13_port_1 } + - port: { get_resource: eca_trx13_port_2 } + metadata: + vnf_id: { get_param: vnf_id } + user_data: + str_replace: + template: | + #!/bin/bash + touch /tmp/user_data.log + sed -i s/HOSTNAME.*/"HOSTNAME=trx_hostname"/g /etc/sysconfig/network + echo "172.26.8.6 puppet" > /etc/hosts + eth0_ip_address='trx_traf_ip_address' + eth0_gateway='172.26.5.3' + echo "$eth0_ip_address" >>/tmp/user_data.log + for interface in $(ip addr show|perl -nle 's/\d:\s([a-z0-9]*?):/print $1/e') ; do + if [ "$interface" != "lo" ]; then + DEVICE_NAME=$interface + interface_ip_var="${DEVICE_NAME}_ip_address" + gateway_var="${DEVICE_NAME}_gateway" + var_name="$interface_ip_var" + var_gateway="$gateway_var" + if [ ! -z ${!var_name} ]; then + IPADDR=${!var_name} + BOOTPROTO="static" + GATEWAY=${!var_gateway} + IFCFG_TEMPLATE="DEVICE=$DEVICE_NAME\nNM_CONTROLLED=no\nONBOOT=yes\nUSERCTL=no" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nBOOTPROTO=$BOOTPROTO" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nIPADDR=$IPADDR" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nNETMASK=255.255.255.0" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nGATEWAY=$GATEWAY" + printf $IFCFG_TEMPLATE > /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME + else + if [ ! -f /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME ]; then + echo "Configuring $DEVICE_NAME to use DHCP" + IFCFG_TEMPLATE="DEVICE=$DEVICE_NAME\nNM_CONTROLLED=no\nONBOOT=yes" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nBOOTPROTO=dhcp\nUSERCTL=no" + printf $IFCFG_TEMPLATE > /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME + fi + fi + ifdown $DEVICE_NAME + ifup $DEVICE_NAME + printf "$DEVICE_NAME\n" >> /tmp/network_config + fi + done + puppet agent -t > /root/puppet-agent-t.out + params: + trx_hostname: {get_param: [eca_trx_names, 12]} + trx_traf_ip_address: {get_param: [eca_trx_eca_traffic_net_ips, 12]} + + eca_trx13_port_0: + type: OS::Neutron::Port + properties: + network: { get_param: oam_net_name } + fixed_ips: [ + "ip_address": { get_param: [eca_trx_oam_ips, 12] } + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + eca_trx13_port_1: + type: OS::Neutron::Port + properties: + network: { get_param: eca_mgmt_net_name } + fixed_ips: [ + "ip_address": { get_param: [eca_trx_mgmt_ips, 12] } + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + eca_trx13_port_2: + type: OS::Neutron::Port + properties: + network_id: { get_resource: eca_traffic_net } + fixed_ips: [ + "ip_address": { get_param: [eca_trx_eca_traffic_net_ips, 12] } + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + server_eca_trx14: + type: OS::Nova::Server + properties: + name: { get_param: [eca_trx_names, 13]} + image: { get_param: eca_trx_image } + availability_zone: { get_param: availability_zone_0 } + flavor: { get_param: eca_trx_flavor } + networks: + - port: { get_resource: eca_trx14_port_0 } + - port: { get_resource: eca_trx14_port_1 } + - port: { get_resource: eca_trx14_port_2 } + metadata: + vnf_id: { get_param: vnf_id } + user_data: + str_replace: + template: | + #!/bin/bash + touch /tmp/user_data.log + sed -i s/HOSTNAME.*/"HOSTNAME=trx_hostname"/g /etc/sysconfig/network + echo "172.26.8.6 puppet" > /etc/hosts + eth0_ip_address='trx_traf_ip_address' + eth0_gateway='172.26.5.3' + echo "$eth0_ip_address" >>/tmp/user_data.log + for interface in $(ip addr show|perl -nle 's/\d:\s([a-z0-9]*?):/print $1/e') ; do + if [ "$interface" != "lo" ]; then + DEVICE_NAME=$interface + interface_ip_var="${DEVICE_NAME}_ip_address" + gateway_var="${DEVICE_NAME}_gateway" + var_name="$interface_ip_var" + var_gateway="$gateway_var" + if [ ! -z ${!var_name} ]; then + IPADDR=${!var_name} + BOOTPROTO="static" + GATEWAY=${!var_gateway} + IFCFG_TEMPLATE="DEVICE=$DEVICE_NAME\nNM_CONTROLLED=no\nONBOOT=yes\nUSERCTL=no" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nBOOTPROTO=$BOOTPROTO" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nIPADDR=$IPADDR" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nNETMASK=255.255.255.0" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nGATEWAY=$GATEWAY" + printf $IFCFG_TEMPLATE > /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME + else + if [ ! -f /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME ]; then + echo "Configuring $DEVICE_NAME to use DHCP" + IFCFG_TEMPLATE="DEVICE=$DEVICE_NAME\nNM_CONTROLLED=no\nONBOOT=yes" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nBOOTPROTO=dhcp\nUSERCTL=no" + printf $IFCFG_TEMPLATE > /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME + fi + fi + ifdown $DEVICE_NAME + ifup $DEVICE_NAME + printf "$DEVICE_NAME\n" >> /tmp/network_config + fi + done + puppet agent -t > /root/puppet-agent-t.out + params: + trx_hostname: {get_param: [eca_trx_names, 13]} + trx_traf_ip_address: {get_param: [eca_trx_eca_traffic_net_ips, 13]} + + eca_trx14_port_0: + type: OS::Neutron::Port + properties: + network: { get_param: oam_net_name } + fixed_ips: [ + "ip_address": { get_param: [eca_trx_oam_ips, 13] } + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + eca_trx14_port_1: + type: OS::Neutron::Port + properties: + network: { get_param: eca_mgmt_net_name } + fixed_ips: [ + "ip_address": { get_param: [eca_trx_mgmt_ips, 13] } + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + eca_trx14_port_2: + type: OS::Neutron::Port + properties: + network_id: { get_resource: eca_traffic_net } + fixed_ips: [ + "ip_address": { get_param: [eca_trx_eca_traffic_net_ips, 13] } + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + server_eca_trx15: + type: OS::Nova::Server + properties: + name: { get_param: [eca_trx_names, 14]} + image: { get_param: eca_trx_image } + availability_zone: { get_param: availability_zone_0 } + flavor: { get_param: eca_trx_flavor } + networks: + - port: { get_resource: eca_trx15_port_0 } + - port: { get_resource: eca_trx15_port_1 } + - port: { get_resource: eca_trx15_port_2 } + metadata: + vnf_id: { get_param: vnf_id } + user_data: + str_replace: + template: | + #!/bin/bash + touch /tmp/user_data.log + sed -i s/HOSTNAME.*/"HOSTNAME=trx_hostname"/g /etc/sysconfig/network + echo "172.26.8.6 puppet" > /etc/hosts + eth0_ip_address='trx_traf_ip_address' + eth0_gateway='172.26.5.3' + echo "$eth0_ip_address" >>/tmp/user_data.log + for interface in $(ip addr show|perl -nle 's/\d:\s([a-z0-9]*?):/print $1/e') ; do + if [ "$interface" != "lo" ]; then + DEVICE_NAME=$interface + interface_ip_var="${DEVICE_NAME}_ip_address" + gateway_var="${DEVICE_NAME}_gateway" + var_name="$interface_ip_var" + var_gateway="$gateway_var" + if [ ! -z ${!var_name} ]; then + IPADDR=${!var_name} + BOOTPROTO="static" + GATEWAY=${!var_gateway} + IFCFG_TEMPLATE="DEVICE=$DEVICE_NAME\nNM_CONTROLLED=no\nONBOOT=yes\nUSERCTL=no" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nBOOTPROTO=$BOOTPROTO" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nIPADDR=$IPADDR" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nNETMASK=255.255.255.0" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nGATEWAY=$GATEWAY" + printf $IFCFG_TEMPLATE > /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME + else + if [ ! -f /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME ]; then + echo "Configuring $DEVICE_NAME to use DHCP" + IFCFG_TEMPLATE="DEVICE=$DEVICE_NAME\nNM_CONTROLLED=no\nONBOOT=yes" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nBOOTPROTO=dhcp\nUSERCTL=no" + printf $IFCFG_TEMPLATE > /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME + fi + fi + ifdown $DEVICE_NAME + ifup $DEVICE_NAME + printf "$DEVICE_NAME\n" >> /tmp/network_config + fi + done + puppet agent -t > /root/puppet-agent-t.out + params: + trx_hostname: {get_param: [eca_trx_names, 14]} + trx_traf_ip_address: {get_param: [eca_trx_eca_traffic_net_ips, 14]} + + eca_trx15_port_0: + type: OS::Neutron::Port + properties: + network: { get_param: oam_net_name } + fixed_ips: [ + "ip_address": { get_param: [eca_trx_oam_ips, 14] } + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + eca_trx15_port_1: + type: OS::Neutron::Port + properties: + network: { get_param: eca_mgmt_net_name } + fixed_ips: [ + "ip_address": { get_param: [eca_trx_mgmt_ips, 14] } + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + eca_trx15_port_2: + type: OS::Neutron::Port + properties: + network_id: { get_resource: eca_traffic_net } + fixed_ips: [ + "ip_address": { get_param: [eca_trx_eca_traffic_net_ips, 14] } + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + server_eca_trx16: + type: OS::Nova::Server + properties: + name: { get_param: [eca_trx_names, 15]} + image: { get_param: eca_trx_image } + availability_zone: { get_param: availability_zone_0 } + flavor: { get_param: eca_trx_flavor } + networks: + - port: { get_resource: eca_trx16_port_0 } + - port: { get_resource: eca_trx16_port_1 } + - port: { get_resource: eca_trx16_port_2 } + metadata: + vnf_id: { get_param: vnf_id } + user_data: + str_replace: + template: | + #!/bin/bash + touch /tmp/user_data.log + sed -i s/HOSTNAME.*/"HOSTNAME=trx_hostname"/g /etc/sysconfig/network + echo "172.26.8.6 puppet" > /etc/hosts + eth0_ip_address='trx_traf_ip_address' + eth0_gateway='172.26.5.3' + echo "$eth0_ip_address" >>/tmp/user_data.log + for interface in $(ip addr show|perl -nle 's/\d:\s([a-z0-9]*?):/print $1/e') ; do + if [ "$interface" != "lo" ]; then + DEVICE_NAME=$interface + interface_ip_var="${DEVICE_NAME}_ip_address" + gateway_var="${DEVICE_NAME}_gateway" + var_name="$interface_ip_var" + var_gateway="$gateway_var" + if [ ! -z ${!var_name} ]; then + IPADDR=${!var_name} + BOOTPROTO="static" + GATEWAY=${!var_gateway} + IFCFG_TEMPLATE="DEVICE=$DEVICE_NAME\nNM_CONTROLLED=no\nONBOOT=yes\nUSERCTL=no" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nBOOTPROTO=$BOOTPROTO" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nIPADDR=$IPADDR" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nNETMASK=255.255.255.0" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nGATEWAY=$GATEWAY" + printf $IFCFG_TEMPLATE > /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME + else + if [ ! -f /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME ]; then + echo "Configuring $DEVICE_NAME to use DHCP" + IFCFG_TEMPLATE="DEVICE=$DEVICE_NAME\nNM_CONTROLLED=no\nONBOOT=yes" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nBOOTPROTO=dhcp\nUSERCTL=no" + printf $IFCFG_TEMPLATE > /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME + fi + fi + ifdown $DEVICE_NAME + ifup $DEVICE_NAME + printf "$DEVICE_NAME\n" >> /tmp/network_config + fi + done + puppet agent -t > /root/puppet-agent-t.out + params: + trx_hostname: {get_param: [eca_trx_names, 15]} + trx_traf_ip_address: {get_param: [eca_trx_eca_traffic_net_ips, 15]} + + eca_trx16_port_0: + type: OS::Neutron::Port + properties: + network: { get_param: oam_net_name } + fixed_ips: [ + "ip_address": { get_param: [eca_trx_oam_ips, 15] } + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + eca_trx16_port_1: + type: OS::Neutron::Port + properties: + network: { get_param: eca_mgmt_net_name } + fixed_ips: [ + "ip_address": { get_param: [eca_trx_mgmt_ips, 15] } + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + eca_trx16_port_2: + type: OS::Neutron::Port + properties: + network_id: { get_resource: eca_traffic_net } + fixed_ips: [ + "ip_address": { get_param: [eca_trx_eca_traffic_net_ips, 15] } + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + + server_eca_trx17: + type: OS::Nova::Server + properties: + name: { get_param: [eca_trx_names, 16]} + image: { get_param: eca_trx_image } + availability_zone: { get_param: availability_zone_0 } + flavor: { get_param: eca_trx_flavor } + networks: + - port: { get_resource: eca_trx17_port_0 } + - port: { get_resource: eca_trx17_port_1 } + - port: { get_resource: eca_trx17_port_2 } + metadata: + vnf_id: { get_param: vnf_id } + user_data: + str_replace: + template: | + #!/bin/bash + touch /tmp/user_data.log + sed -i s/HOSTNAME.*/"HOSTNAME=trx_hostname"/g /etc/sysconfig/network + echo "172.26.8.6 puppet" > /etc/hosts + eth0_ip_address='trx_traf_ip_address' + eth0_gateway='172.26.5.3' + echo "$eth0_ip_address" >>/tmp/user_data.log + for interface in $(ip addr show|perl -nle 's/\d:\s([a-z0-9]*?):/print $1/e') ; do + if [ "$interface" != "lo" ]; then + DEVICE_NAME=$interface + interface_ip_var="${DEVICE_NAME}_ip_address" + gateway_var="${DEVICE_NAME}_gateway" + var_name="$interface_ip_var" + var_gateway="$gateway_var" + if [ ! -z ${!var_name} ]; then + IPADDR=${!var_name} + BOOTPROTO="static" + GATEWAY=${!var_gateway} + IFCFG_TEMPLATE="DEVICE=$DEVICE_NAME\nNM_CONTROLLED=no\nONBOOT=yes\nUSERCTL=no" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nBOOTPROTO=$BOOTPROTO" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nIPADDR=$IPADDR" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nNETMASK=255.255.255.0" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nGATEWAY=$GATEWAY" + printf $IFCFG_TEMPLATE > /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME + else + if [ ! -f /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME ]; then + echo "Configuring $DEVICE_NAME to use DHCP" + IFCFG_TEMPLATE="DEVICE=$DEVICE_NAME\nNM_CONTROLLED=no\nONBOOT=yes" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nBOOTPROTO=dhcp\nUSERCTL=no" + printf $IFCFG_TEMPLATE > /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME + fi + fi + ifdown $DEVICE_NAME + ifup $DEVICE_NAME + printf "$DEVICE_NAME\n" >> /tmp/network_config + fi + done + puppet agent -t > /root/puppet-agent-t.out + params: + trx_hostname: {get_param: [eca_trx_names, 16]} + trx_traf_ip_address: {get_param: [eca_trx_eca_traffic_net_ips, 16]} + + eca_trx17_port_0: + type: OS::Neutron::Port + properties: + network: { get_param: oam_net_name } + fixed_ips: [ + "ip_address": { get_param: [eca_trx_oam_ips, 16] } + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + eca_trx17_port_1: + type: OS::Neutron::Port + properties: + network: { get_param: eca_mgmt_net_name } + fixed_ips: [ + "ip_address": { get_param: [eca_trx_mgmt_ips, 16] } + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + eca_trx17_port_2: + type: OS::Neutron::Port + properties: + network_id: { get_resource: eca_traffic_net } + fixed_ips: [ + "ip_address": { get_param: [eca_trx_eca_traffic_net_ips, 16] } + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + server_eca_trx18: + type: OS::Nova::Server + properties: + name: { get_param: [eca_trx_names, 17]} + image: { get_param: eca_trx_image } + availability_zone: { get_param: availability_zone_0 } + flavor: { get_param: eca_trx_flavor } + networks: + - port: { get_resource: eca_trx18_port_0 } + - port: { get_resource: eca_trx18_port_1 } + - port: { get_resource: eca_trx18_port_2 } + metadata: + vnf_id: { get_param: vnf_id } + user_data: + str_replace: + template: | + #!/bin/bash + touch /tmp/user_data.log + sed -i s/HOSTNAME.*/"HOSTNAME=trx_hostname"/g /etc/sysconfig/network + echo "172.26.8.6 puppet" > /etc/hosts + eth0_ip_address='trx_traf_ip_address' + eth0_gateway='172.26.5.3' + echo "$eth0_ip_address" >>/tmp/user_data.log + for interface in $(ip addr show|perl -nle 's/\d:\s([a-z0-9]*?):/print $1/e') ; do + if [ "$interface" != "lo" ]; then + DEVICE_NAME=$interface + interface_ip_var="${DEVICE_NAME}_ip_address" + gateway_var="${DEVICE_NAME}_gateway" + var_name="$interface_ip_var" + var_gateway="$gateway_var" + if [ ! -z ${!var_name} ]; then + IPADDR=${!var_name} + BOOTPROTO="static" + GATEWAY=${!var_gateway} + IFCFG_TEMPLATE="DEVICE=$DEVICE_NAME\nNM_CONTROLLED=no\nONBOOT=yes\nUSERCTL=no" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nBOOTPROTO=$BOOTPROTO" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nIPADDR=$IPADDR" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nNETMASK=255.255.255.0" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nGATEWAY=$GATEWAY" + printf $IFCFG_TEMPLATE > /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME + else + if [ ! -f /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME ]; then + echo "Configuring $DEVICE_NAME to use DHCP" + IFCFG_TEMPLATE="DEVICE=$DEVICE_NAME\nNM_CONTROLLED=no\nONBOOT=yes" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nBOOTPROTO=dhcp\nUSERCTL=no" + printf $IFCFG_TEMPLATE > /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME + fi + fi + ifdown $DEVICE_NAME + ifup $DEVICE_NAME + printf "$DEVICE_NAME\n" >> /tmp/network_config + fi + done + puppet agent -t > /root/puppet-agent-t.out + params: + trx_hostname: {get_param: [eca_trx_names, 17]} + trx_traf_ip_address: {get_param: [eca_trx_eca_traffic_net_ips, 17]} + + eca_trx18_port_0: + type: OS::Neutron::Port + properties: + network: { get_param: oam_net_name } + fixed_ips: [ + "ip_address": { get_param: [eca_trx_oam_ips, 17] } + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + eca_trx18_port_1: + type: OS::Neutron::Port + properties: + network: { get_param: eca_mgmt_net_name } + fixed_ips: [ + "ip_address": { get_param: [eca_trx_mgmt_ips, 17] } + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + eca_trx18_port_2: + type: OS::Neutron::Port + properties: + network_id: { get_resource: eca_traffic_net } + fixed_ips: [ + "ip_address": { get_param: [eca_trx_eca_traffic_net_ips, 17] } + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + server_eca_trx19: + type: OS::Nova::Server + properties: + name: { get_param: [eca_trx_names, 18]} + image: { get_param: eca_trx_image } + availability_zone: { get_param: availability_zone_0 } + flavor: { get_param: eca_trx_flavor } + networks: + - port: { get_resource: eca_trx19_port_0 } + - port: { get_resource: eca_trx19_port_1 } + - port: { get_resource: eca_trx19_port_2 } + metadata: + vnf_id: { get_param: vnf_id } + user_data: + str_replace: + template: | + #!/bin/bash + touch /tmp/user_data.log + sed -i s/HOSTNAME.*/"HOSTNAME=trx_hostname"/g /etc/sysconfig/network + echo "172.26.8.6 puppet" > /etc/hosts + eth0_ip_address='trx_traf_ip_address' + eth0_gateway='172.26.5.3' + echo "$eth0_ip_address" >>/tmp/user_data.log + for interface in $(ip addr show|perl -nle 's/\d:\s([a-z0-9]*?):/print $1/e') ; do + if [ "$interface" != "lo" ]; then + DEVICE_NAME=$interface + interface_ip_var="${DEVICE_NAME}_ip_address" + gateway_var="${DEVICE_NAME}_gateway" + var_name="$interface_ip_var" + var_gateway="$gateway_var" + if [ ! -z ${!var_name} ]; then + IPADDR=${!var_name} + BOOTPROTO="static" + GATEWAY=${!var_gateway} + IFCFG_TEMPLATE="DEVICE=$DEVICE_NAME\nNM_CONTROLLED=no\nONBOOT=yes\nUSERCTL=no" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nBOOTPROTO=$BOOTPROTO" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nIPADDR=$IPADDR" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nNETMASK=255.255.255.0" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nGATEWAY=$GATEWAY" + printf $IFCFG_TEMPLATE > /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME + else + if [ ! -f /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME ]; then + echo "Configuring $DEVICE_NAME to use DHCP" + IFCFG_TEMPLATE="DEVICE=$DEVICE_NAME\nNM_CONTROLLED=no\nONBOOT=yes" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nBOOTPROTO=dhcp\nUSERCTL=no" + printf $IFCFG_TEMPLATE > /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME + fi + fi + ifdown $DEVICE_NAME + ifup $DEVICE_NAME + printf "$DEVICE_NAME\n" >> /tmp/network_config + fi + done + puppet agent -t > /root/puppet-agent-t.out + params: + trx_hostname: {get_param: [eca_trx_names, 8]} + trx_traf_ip_address: {get_param: [eca_trx_eca_traffic_net_ips, 18]} + + eca_trx19_port_0: + type: OS::Neutron::Port + properties: + network: { get_param: oam_net_name } + fixed_ips: [ + "ip_address": { get_param: [eca_trx_oam_ips, 18] } + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + eca_trx19_port_1: + type: OS::Neutron::Port + properties: + network: { get_param: eca_mgmt_net_name } + fixed_ips: [ + "ip_address": { get_param: [eca_trx_mgmt_ips, 18] } + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + eca_trx19_port_2: + type: OS::Neutron::Port + properties: + network_id: { get_resource: eca_traffic_net } + fixed_ips: [ + "ip_address": { get_param: [eca_trx_eca_traffic_net_ips, 18] } + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + server_eca_trx20: + type: OS::Nova::Server + properties: + name: { get_param: [eca_trx_names, 19]} + image: { get_param: eca_trx_image } + availability_zone: { get_param: availability_zone_0 } + flavor: { get_param: eca_trx_flavor } + networks: + - port: { get_resource: eca_trx20_port_0 } + - port: { get_resource: eca_trx20_port_1 } + - port: { get_resource: eca_trx20_port_2 } + metadata: + vnf_id: { get_param: vnf_id } + user_data: + str_replace: + template: | + #!/bin/bash + touch /tmp/user_data.log + sed -i s/HOSTNAME.*/"HOSTNAME=trx_hostname"/g /etc/sysconfig/network + echo "172.26.8.6 puppet" > /etc/hosts + eth0_ip_address='trx_traf_ip_address' + eth0_gateway='172.26.5.3' + echo "$eth0_ip_address" >>/tmp/user_data.log + for interface in $(ip addr show|perl -nle 's/\d:\s([a-z0-9]*?):/print $1/e') ; do + if [ "$interface" != "lo" ]; then + DEVICE_NAME=$interface + interface_ip_var="${DEVICE_NAME}_ip_address" + gateway_var="${DEVICE_NAME}_gateway" + var_name="$interface_ip_var" + var_gateway="$gateway_var" + if [ ! -z ${!var_name} ]; then + IPADDR=${!var_name} + BOOTPROTO="static" + GATEWAY=${!var_gateway} + IFCFG_TEMPLATE="DEVICE=$DEVICE_NAME\nNM_CONTROLLED=no\nONBOOT=yes\nUSERCTL=no" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nBOOTPROTO=$BOOTPROTO" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nIPADDR=$IPADDR" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nNETMASK=255.255.255.0" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nGATEWAY=$GATEWAY" + printf $IFCFG_TEMPLATE > /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME + else + if [ ! -f /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME ]; then + echo "Configuring $DEVICE_NAME to use DHCP" + IFCFG_TEMPLATE="DEVICE=$DEVICE_NAME\nNM_CONTROLLED=no\nONBOOT=yes" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nBOOTPROTO=dhcp\nUSERCTL=no" + printf $IFCFG_TEMPLATE > /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME + fi + fi + ifdown $DEVICE_NAME + ifup $DEVICE_NAME + printf "$DEVICE_NAME\n" >> /tmp/network_config + fi + done + puppet agent -t > /root/puppet-agent-t.out + params: + trx_hostname: {get_param: [eca_trx_names, 19]} + trx_traf_ip_address: {get_param: [eca_trx_eca_traffic_net_ips, 19]} + + eca_trx20_port_0: + type: OS::Neutron::Port + properties: + network: { get_param: oam_net_name } + fixed_ips: [ + "ip_address": { get_param: [eca_trx_oam_ips, 19] } + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + eca_trx20_port_1: + type: OS::Neutron::Port + properties: + network: { get_param: eca_mgmt_net_name } + fixed_ips: [ + "ip_address": { get_param: [eca_trx_mgmt_ips, 19] } + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + eca_trx20_port_2: + type: OS::Neutron::Port + properties: + network_id: { get_resource: eca_traffic_net } + fixed_ips: [ + "ip_address": { get_param: [eca_trx_eca_traffic_net_ips, 19] } + ] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO
\ No newline at end of file diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/invalidTypes/MMSC_Capacity_Line_1.env b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/invalidTypes/MMSC_Capacity_Line_1.env new file mode 100644 index 0000000000..b346d67d97 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/invalidTypes/MMSC_Capacity_Line_1.env @@ -0,0 +1,111 @@ +parameters: + oam_net_name: oam_protected_net_0 + oam_network_netmask: 255.255.254.0 + oam_network_gateway: 107.250.172.1 + oam_network_route_1: 155.165.201.250/32,107.250.172.1 + oam_network_route_2: 155.165.194.100/32,107.250.172.1 + external_dns: 155.165.194.100 + external_ntp: 155.165.201.250 + lb_oam_ips: 107.250.172.50,107.250.172.51 + dmz_protected_net_name: dmz_protected_net_0 + lb_dmz_protected_ips: 107.239.14.19,107.239.14.20 + cor_direct_net_name: cor_direct_net_0 + lb_cor_direct_ips: 172.31.10.19,172.31.10.20 + mms_traffic_net_name: int_mms_mms_traffic_net_2 + mms_traffic_net_cidr: 172.26.2.0/24 + mms_traffic_netmask: 255.255.255.0 + mms_traffic_net_gateway: 172.26.2.1 + mms_traffic_start: 172.26.2.3 + mms_traffic_end: 172.26.2.254 + mms_traffic_net_local_ip1: 172.26.2.3 + mms_traffic_net_local_ip2: 172.26.2.4 + mms_traffic_net_floating_ip: 172.26.2.5 + nems_internal_name: int_mms_nems_internal_net_2 + nems_internal_start: 172.26.6.3 + nems_internal_end: 172.26.6.254 + nems_internal_cidr: 172.26.6.0/24 + nems_internal_netmask: 255.255.255.0 + nems_internal_gateway: 172.26.6.1 + nems_traffic_name: int_mms_nems_traffic_net_2 + nems_traffic_start: 172.26.3.3 + nems_traffic_end: 172.26.3.254 + nems_traffic_cidr: 172.26.3.0/24 + nems_traffic_netmask: 255.255.255.0 + nems_traffic_gateway: 172.26.3.1 + nems_traffic_net_local_ip1: 172.26.3.3 + nems_traffic_net_local_ip2: 172.26.3.4 + nems_traffic_net_floating_ip: 172.26.3.5 + nems_user_web_name: int_mms_nems_web_net_2 + nems_user_web_start: 172.26.4.3 + nems_user_web_end: 172.26.4.254 + nems_user_web_cidr: 172.26.4.0/24 + nems_user_web_netmask: 255.255.255.0 + nems_user_web_gateway: 172.26.4.1 + nems_user_web_net_local_ip1: 172.26.4.3 + nems_user_web_net_local_ip2: 172.26.4.4 + nems_user_web_net_floating_ip: 172.26.4.5 + nems_imap_name: int_mms_nems_imap_net_2 + nems_imap_start: 172.26.7.3 + nems_imap_end: 172.26.7.254 + nems_imap_cidr: 172.26.7.0/24 + nems_imap_netmask: 255.255.255.0 + nems_imap_gateway: 172.26.7.1 + eca_traffic_name: int_mms_eca_traffic_net_2 + eca_traffic_cidr: 172.26.5.0/24 + eca_traffic_netmask: 255.255.255.0 + eca_traffic_net_gateway: 172.26.5.1 + eca_traffic_start: 172.26.5.3 + eca_traffic_end: 172.26.5.254 + eca_traffic_net_local_ip1: 172.26.5.3 + eca_traffic_net_local_ip2: 172.26.5.4 + eca_traffic_net_floating_ip: 172.26.5.5 + ha_net_name: int_mms_ha_net_2 + ha_net_cidr: 172.26.1.0/24 + ha_net_start: 172.26.1.3 + ha_net_end: 172.26.1.254 + ha_net_local_ip1: 172.26.1.3 + ha_net_local_ip2: 172.26.1.4 + lb_names: ZRDM1MMSC03ALB001,ZRDM1MMSC03ALB002 + lb_image_name: BIGIP-11.5.3.0.0.163 + lb_flavor_name: m1.xlarge + security_group_name: mmsc_security_group_1 + availability_zone_0: nova + mmsc_mms_traffic_net_ips: 172.26.2.11,172.26.2.12,172.26.2.13,172.26.2.14,172.26.2.15 + mmsc_oam_ips: 107.250.172.54,107.250.172.55,107.250.172.56,107.250.172.57,107.250.172.58 + mmsc_flavor: lc.4xlarge4 + mmsc_image: mmsc-6.0.2_v5 + mmsc_cinder_volume_size: 480 + nems_fe_flavor: m1.large2 + nems_fe_image: nems-2.1.2_v29 + nems_fe_names: ZRDM1MMSC03NFE001,ZRDM1MMSC03NFE002 + nems_fe_node_roles: FE0,FE1 + nems_fe_oam_ips: 107.250.172.64,107.250.172.65 + nems_fe_nems_traffic_net_ips: 172.26.3.11,172.26.3.12 + nems_fe_nems_user_web_net_ips: 172.26.4.11,172.26.4.12 + nems_fe_nems_internal_net_ips: 172.26.6.11,172.26.6.12 + nems_fe_nems_imap_net_ips: 172.26.7.11,172.26.7.12 + nems_be_names: ZRDM1MMSC03NBE001 + nems_be_node_roles: BE0 + nems_be_oam_ips: 107.250.172.66 + nems_be_nems_internal_net_ips: 172.26.6.13 + nems_be_nems_imap_net_ips: 172.26.7.13 + nems_be_flavor: m1.large2 + nems_be_image: nems-2.1.2_v29 + eca_trx_oam_ips: 107.250.172.70,107.250.172.71,107.250.172.72,107.250.172.73,107.250.172.74,107.250.172.75,107.250.172.76,107.250.172.77,107.250.172.78,107.250.172.79,107.250.172.80,107.250.172.81,107.250.172.82,107.250.172.83,107.250.172.84,107.250.172.85,107.250.172.86,107.250.172.87,107.250.172.88,107.250.172.89 + eca_trx_mgmt_ips: 172.25.137.202,172.25.137.203,172.25.137.204,172.25.137.205,172.25.137.206,172.25.137.207,172.25.137.208,172.25.137.209,172.25.137.210,172.25.137.211,172.25.137.212,172.25.137.213,172.25.137.214,172.25.137.215,172.25.137.216,172.25.137.217,172.25.137.218,172.25.137.219,172.25.137.220,172.25.137.221 + eca_trx_flavor: m1.xlarge + eca_trx_image: ECABASE + timezone: UTC + eca_trx_names: ZRDM1MMSC03TRX001,ZRDM1MMSC03TRX002,ZRDM1MMSC03TRX003,ZRDM1MMSC03TRX004,ZRDM1MMSC03TRX005,ZRDM1MMSC03TRX006,ZRDM1MMSC03TRX007,ZRDM1MMSC03TRX008,ZRDM1MMSC03TRX009,ZRDM1MMSC03TRX010,ZRDM1MMSC03TRX011,ZRDM1MMSC03TRX012,ZRDM1MMSC03TRX013,ZRDM1MMSC03TRX014,ZRDM1MMSC03TRX015,ZRDM1MMSC03TRX016,ZRDM1MMSC03TRX017,ZRDM1MMSC03TRX018,ZRDM1MMSC03TRX019,ZRDM1MMSC03TRX020 + eca_trx_eca_traffic_net_ips: 172.26.5.11,172.26.5.12,172.26.5.13,172.26.5.14,172.26.5.15,172.26.5.16,172.26.5.17,172.26.5.18,172.26.5.19,172.26.5.20,172.26.5.21,172.26.5.22,172.26.5.23,172.26.5.24,172.26.5.25,172.26.5.26,172.26.5.27,172.26.5.28,172.26.5.29,172.26.5.30 + mmsc_names: ZRDM1MMSC03MMS001,ZRDM1MMSC03MMS002,ZRDM1MMSC03MMS003,ZRDM1MMSC03MMS004,ZRDM1MMSC03MMS005 + nems_volume_size: 50 + nems_be_volume_size: 610 + MMSC_volume_type: Platinum + NEMS_FE_volume_type: Platinum + NEMS_BE_volume_type: Platinum + mmsc_core_virtual_server_ips: 172.31.10.21,172.31.10.22 + mmsc_core_snat_ips: 172.31.10.23,172.31.10.24,172.31.10.25,172.31.10.26,172.31.10.27 + mmsc_dmz_protected_virtual_server_ips: 107.239.14.21,107.239.14.22,107.239.14.23 + mmsc_dmz_protected_snat_ips: 107.239.14.24,107.239.14.25,107.239.14.26,107.239.14.27 + eca_mgmt_net_name: int_eca_mgmt_net_1
\ No newline at end of file diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/invalidTypes/SG_ECA_MGMT.yaml b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/invalidTypes/SG_ECA_MGMT.yaml new file mode 100644 index 0000000000..53efc5e36e --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/invalidTypes/SG_ECA_MGMT.yaml @@ -0,0 +1,76 @@ +heat_template_version: 2013-05-23 + +################################# +# +# Changes from MSO - 11/5/2015 +# - Parameter changes as below +# - CDLs for vmNames, IPs +# - aZone->availability_zone_0 +# - nwName->{nwRole}_net_name +# - nwID->{nwRole}_net_id +# - vmName->{vmType}_names +# - ips ->{vmType}_{nwRole}_ips +# - fips->{vmType}_{nwRole}_floating_ip +# - added replacement_policy: AUTO to all ports +# - added vnf_id for metadata to all servers +# - externalized security group resource +# - externalized eca_mgmt network +# +################################# + +description: > + HOT template that creates Security Group and ECA network + +parameters: + eca_mgmt_name: + type: string + label: eca management name + description: eca management name + eca_mgmt_start: + type: string + label: eca management start + description: eca management start + eca_mgmt_end: + type: string + label: eca management end + description: eca management end + eca_mgmt_cidr: + type: string + label: eca management cidr + description: eca management cidr + eca_mgmt_netmask: + type: string + label: ECA mgmt network subnet mask + description: ECA mgmt network subnet mask + security_group_name: + type: string + label: MMSC security group name + description: MMSC security group name + +resources: + mms_security_group: + type: OS::Neutron::SecurityGroup + properties: + description: mmsc security group + name: {get_param: security_group_name} + rules: [{"direction": egress, "ethertype": IPv4, "port_range_min": 1, "port_range_max": 65535, "protocol": tcp, "remote_ip_prefix": 0.0.0.0/0}, + {"direction": egress, "ethertype": IPv4, "port_range_min": 1, "port_range_max": 65535, "protocol": udp, "remote_ip_prefix": 0.0.0.0/0}, + {"direction": egress, "ethertype": IPv4, "protocol": icmp, "remote_ip_prefix": 0.0.0.0/0}, + {"direction": ingress, "ethertype": IPv4, "port_range_min": 1, "port_range_max": 65535, "protocol": tcp, "remote_ip_prefix": 0.0.0.0/0}, + {"direction": ingress, "ethertype": IPv4, "port_range_min": 1, "port_range_max": 65535, "protocol": udp, "remote_ip_prefix": 0.0.0.0/0}, + {"direction": ingress, "ethertype": IPv4, "protocol": icmp, "remote_ip_prefix": 0.0.0.0/0} + ] + eca_mgmt_net: + type: OS::Contrail::VirtualNetwork + properties: + name: {get_param: eca_mgmt_name} + + eca_mgmt_network_ip_subnet: + type: OS::Neutron::Subnet + properties: + name: {get_param: eca_mgmt_name} + allocation_pools: [{"start": {get_param: eca_mgmt_start}, "end": {get_param: eca_mgmt_end}}] + cidr: {get_param: eca_mgmt_cidr} + #enable_dhcp: false + #gateway_ip: null + network_id: {get_resource: eca_mgmt_net} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/invalidTypes/cmaui.env b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/invalidTypes/cmaui.env new file mode 100644 index 0000000000..d37e1eedc2 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/invalidTypes/cmaui.env @@ -0,0 +1,17 @@ +parameters: + cmaui_names: ZRDM1MMSC02CMI001,ZRDM1MMSC02CMI002 + cmaui_flavor: m1.large + cmaui_image: cmaui-5.0.2.5_v25 + cmaui_cinder_volume_size: 55 + oam_net_name: oam_protected_net_0 + oam_network_netmask: 255.255.254.0 + oam_network_gateway: 107.250.172.1 + oam_network_netmask: 255.255.255.192 + oam_network_gateway: 10.20.30.1 + external_dns: 155.165.201.250 + external_ntp: 155.165.194.100 + security_group_name: mmsc_security_group_1 + availability_zone_0: nova + timezone: UTC + cmaui_oam_ips: 107.250.172.42,107.250.172.43 + CMAUI_volume_type: Platinum
\ No newline at end of file diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/invalidTypes/cmaui.yml b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/invalidTypes/cmaui.yml new file mode 100644 index 0000000000..0b925e2d85 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/invalidTypes/cmaui.yml @@ -0,0 +1,202 @@ +heat_template_version: 2013-05-23 + +################################# +# +# Changes from MSO 01/26/2016 +# Updated per ECOMP feedback +# +################################# + +description: cmaui server template for vMMSC + +parameters: + vnf_id: + type: string + description: Unique ID for this VNF instance + default: This_is_ths_MMSC-CMAUI_id + cmaui_names: + type: comma_delimited_list + description: CMAUI1, CMAUI2 server names + cmaui_image: + type: string + description: Image for CMAUI server + cmaui_flavor: + type: string + description: Flavor for CMAUI server + cmaui_cinder_volume_size: + type: number + label: CMAUI Cinder volume size + description: the size of the CMAUI Cinder volume + availability_zone_0: + type: string + label: availabilityzone name + description: availabilityzone name + oam_net_name: + type: string + description: UID of OAM network + oam_network_netmask: + type: string + label: oam network netmask + description: oam network gateway + oam_network_gateway: + type: string + label: oam network gateway + description: oam network gateway + external_dns: + type: string + label: dns server + description: dns server + external_ntp: + type: string + label: ntp server + description: ntp server + security_group_name: + type: string + label: security group name + description: the name of security group + timezone: + type: string + label: timezone + description: timezone + cmaui_oam_ips: + type: comma_delimited_list + label: CMAUI oam_net IP addresses + description: CMAUI oam_net IP addresses + CMAUI_volume_type: + type: string + label: CMAUI vm volume type + description: the name of the target volume backend + +resources: + server_cmaui: + type: eca_oam.yaml + properties: + name: { get_param: [cmaui_names, 0]} + image: { get_param: cmaui_image } + availability_zone: { get_param: availability_zone_0 } + flavor: { get_param: cmaui_flavor } + networks: + - port: { get_resource: cmaui_port_0 } + metadata: + vnf_id: { get_param: vnf_id } + user_data: + str_replace: + template: | + cmaui.mgmt.ip=${cmaui.mgmt.ip} + cmaui.mgmt.netmask=${cmaui.mgmt.netmask} + cmaui.mgmt.gateway=${cmaui.mgmt.gateway} + cmaui.external.dns=${cmaui.external.dns} + cmaui.external.ntp=${cmaui.external.ntp} + cmaui.node=${cmaui.node} + cmaui.timezone=${cmaui.timezone} + params: + ${cmaui.mgmt.ip}: {get_param: [cmaui_oam_ips, 0]} + ${cmaui.mgmt.netmask}: {get_param: oam_network_netmask} + ${cmaui.mgmt.gateway}: {get_param: oam_network_gateway} + ${cmaui.external.dns}: {get_param: external_dns} + ${cmaui.external.ntp}: {get_param: external_ntp} + ${cmaui.node}: {get_param: [cmaui_names, 0]} + ${cmaui.timezone}: {get_param: timezone} + user_data_format: RAW + + server_cmaui_2: + type: eca_oam_2.yaml + properties: + name: { get_param: [cmaui_names, 0]} + image: { get_param: cmaui_image } + availability_zone: { get_param: availability_zone_0 } + flavor: { get_param: cmaui_flavor } + networks: + - port: { get_resource: cmaui_port_0 } + metadata: + vnf_id: { get_param: vnf_id } + user_data: + str_replace: + template: | + cmaui.mgmt.ip=${cmaui.mgmt.ip} + cmaui.mgmt.netmask=${cmaui.mgmt.netmask} + cmaui.mgmt.gateway=${cmaui.mgmt.gateway} + cmaui.external.dns=${cmaui.external.dns} + cmaui.external.ntp=${cmaui.external.ntp} + cmaui.node=${cmaui.node} + cmaui.timezone=${cmaui.timezone} + params: + ${cmaui.mgmt.ip}: {get_param: [cmaui_oam_ips, 0]} + ${cmaui.mgmt.netmask}: {get_param: oam_network_netmask} + ${cmaui.mgmt.gateway}: {get_param: oam_network_gateway} + ${cmaui.external.dns}: {get_param: external_dns} + ${cmaui.external.ntp}: {get_param: external_ntp} + ${cmaui.node}: {get_param: [cmaui_names, 0]} + ${cmaui.timezone}: {get_param: timezone} + user_data_format: RAW + + cmaui_volume: + type: OS::Cinder::Volume + properties: + size: {get_param: cmaui_cinder_volume_size} + volume_type: {get_param: CMAUI_volume_type} + + cmaui_volume_attachment: + type: OS::Cinder::VolumeAttachment + properties: + volume_id: {get_resource: cmaui_volume} + instance_uuid: {get_resource: server_cmaui} + + cmaui_port_0: + type: OS::Neutron::Port + properties: + network: { get_param: oam_net_name } + fixed_ips: [{"ip_address": {get_param: [cmaui_oam_ips, 0]}}] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + server_cmaui1: + type: OS::Nova::Server + properties: + name: { get_param: [cmaui_names, 1]} + image: { get_param: cmaui_image } + availability_zone: { get_param: availability_zone_0 } + flavor: { get_param: cmaui_flavor } + networks: + - port: { get_resource: cmaui1_port_0 } + metadata: + vnf_id: { get_param: vnf_id } + user_data: + str_replace: + template: | + cmaui.mgmt.ip=${cmaui.mgmt.ip} + cmaui.mgmt.netmask=${cmaui.mgmt.netmask} + cmaui.mgmt.gateway=${cmaui.mgmt.gateway} + cmaui.external.dns=${cmaui.external.dns} + cmaui.external.ntp=${cmaui.external.ntp} + cmaui.node=${cmaui.node} + cmaui.timezone=${cmaui.timezone} + params: + ${cmaui.mgmt.ip}: {get_param: [cmaui_oam_ips, 1]} + ${cmaui.mgmt.netmask}: {get_param: oam_network_netmask} + ${cmaui.mgmt.gateway}: {get_param: oam_network_gateway} + ${cmaui.external.dns}: {get_param: external_dns} + ${cmaui.external.ntp}: {get_param: external_ntp} + ${cmaui.node}: {get_param: [cmaui_names, 1]} + ${cmaui.timezone}: {get_param: timezone} + user_data_format: RAW + + cmaui1_volume: + type: OS::Cinder::Volume + properties: + size: {get_param: cmaui_cinder_volume_size} + volume_type: {get_param: CMAUI_volume_type} + + cmaui1_volume_attachment: + type: OS::Cinder::VolumeAttachment + properties: + volume_id: {get_resource: cmaui1_volume} + instance_uuid: {get_resource: server_cmaui1} + + cmaui1_port_0: + type: OS::Neutron::Port + properties: + network: { get_param: oam_net_name } + fixed_ips: [{"ip_address": {get_param: [cmaui_oam_ips, 1]}}] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/invalidTypes/eca_oam.env b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/invalidTypes/eca_oam.env new file mode 100644 index 0000000000..f9991722b3 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/invalidTypes/eca_oam.env @@ -0,0 +1,20 @@ +parameters: + eca_names: ZRDM1MMSC02OAM001,ZRDM1MMSC02OAM002 + arb_names: ZRDM1MMSC02ARB001 + oam_image_name: ECABASE + oam_flavor: lc.xlarge4 + arbiter_flavor: m1.large2 + availability_zone_0: nova + oam_net_name: oam_protected_net_0 + eca_mgmt_net_name: int_mms_eca_mgmt_net_1 + eca_oam_ips: 107.250.172.44,107.250.172.45 + eca_eca_mgmt_ips: 172.25.137.242,172.25.137.243 + eca_oam_gateway: 107.250.172.1 + arb_oam_ips: 107.250.172.46 + arb_eca_mgmt_ips: 172.25.137.244 + security_group_name: mmsc_security_group_1 + oam_volume_size: 1800 + arb_volume_size: 40 + swift_eca_url: http://object-store.rdm2.cci.com:8080/v1/AUTH_1bbab536a19b4756926e7d0ec1eb543c/eca + ECA_OAM_volume_type: Platinum + ARB_volume_type: Platinum diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/invalidTypes/eca_oam.yaml b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/invalidTypes/eca_oam.yaml new file mode 100644 index 0000000000..b9fa48615c --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/invalidTypes/eca_oam.yaml @@ -0,0 +1,383 @@ +heat_template_version: 2013-05-23 + +########################################################## +# +# Changes from MSO +# - Updated per ECOMP Feedback +# +# +########################################################## + +description: This stack creates two ECA OAM VM and one ARB VM + +parameters: + vnf_id: + type: string + description: Unique ID for this VNF instance + default: This_is_ths_MMSC-ECA_id + eca_names: + type: comma_delimited_list + label: oam servers names + description: the names of the OAM1,OAM2 VM instances + arb_names: + type: comma_delimited_list + label: arbiter server names + description: the names of the arbiter VM instances + oam_image_name: + type: string + label: image name + description: the OAM image name + oam_flavor: + type: string + label: flavor name + description: OAM flavor name + arbiter_flavor: + type: string + label: flavor name + description: arbiter flavor name + availability_zone_0: + type: string + label: availabilityzone name + description: availabilityzone name + oam_net_name: + type: string + label: oam network name + description: the name of the oam network + eca_mgmt_net_name: + type: string + label: internal network name + description: the name of the internal network + eca_oam_ips: + type: comma_delimited_list + label: oam network ips + description: the ips of oam networks for eca VM + eca_oam_gateway: + type: string + label: oam1 oam gateway + description: the ip of oam gateway + eca_eca_mgmt_ips: + type: comma_delimited_list + label: eca_mgmt network ips for eca VM + description: internal eca_mgmt network ips for eca VM + arb_oam_ips: + type: comma_delimited_list + label: oam network ips for arb VM + description: oam network ips for eca VM + arb_eca_mgmt_ips: + type: comma_delimited_list + label: eca_mgmt network ips + description: internal eca_mgmt network ips for arb VM + eca_oam_gateway: + type: string + label: oam network gateway + description: oam network gateway + security_group_name: + type: string + label: security group name + description: the name of security group + oam_volume_size: + type: number + label: volume size + description: the size of the OAM volume + arb_volume_size: + type: number + label: volume size + description: the size of the ARB volume + swift_eca_url: + type: string + label: Swift URL + description: Base URL for eca swift object store + ECA_OAM_volume_type: + type: string + label: eca oam vm volume type + description: the name of the target volume backend + ARB_volume_type: + type: string + label: arb vm volume type + description: the name of the target volume backend + +resources: + oam1_instance: + type: OS::Nova::Server + properties: + name: {get_param: [eca_names, 0]} + image: {get_param: oam_image_name} + flavor: {get_param: oam_flavor} + availability_zone: {get_param: availability_zone_0} + networks: + - port: {get_resource: oam1_int_port} + - port: {get_resource: oam1_mgmt_port} + metadata: + vnf_id: { get_param: vnf_id } + user_data: + str_replace: + template: | + #!/bin/bash + sed -i s/HOSTNAME.*/"HOSTNAME=oam1_hostname"/g /etc/sysconfig/network + eth1_ip_address='oam1_mgt_ip' + eth1_gateway='oam_gateway' + for interface in $(ip addr show|perl -nle 's/\d:\s([a-z0-9]*?):/print $1/e') ; do + if [ "$interface" != "lo" ]; then + DEVICE_NAME=$interface + interface_ip_var="${DEVICE_NAME}_ip_address" + gateway_var="${DEVICE_NAME}_gateway" + var_name="$interface_ip_var" + var_gateway="$gateway_var" + if [ ! -z ${!var_name} ]; then + IPADDR=${!var_name} + BOOTPROTO="static" + GATEWAY=${!var_gateway} + IFCFG_TEMPLATE="DEVICE=$DEVICE_NAME\nNM_CONTROLLED=no\nONBOOT=yes\nUSERCTL=no" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nBOOTPROTO=$BOOTPROTO" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nIPADDR=$IPADDR" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nNETMASK=255.255.255.0" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nGATEWAY=$GATEWAY" + printf $IFCFG_TEMPLATE > /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME + else + if [ ! -f /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME ]; then + echo "Configuring $DEVICE_NAME to use DHCP" + IFCFG_TEMPLATE="DEVICE=$DEVICE_NAME\nNM_CONTROLLED=no\nONBOOT=yes" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nBOOTPROTO=dhcp\nUSERCTL=no" + printf $IFCFG_TEMPLATE > /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME + fi + fi + ifdown $DEVICE_NAME + ifup $DEVICE_NAME + printf "$DEVICE_NAME\n" >> /tmp/network_config + fi + done + mkdir /etc/puppet/files/roles/transcoder + mkdir /etc/puppet/files/roles/oam_primary + curl swift_url/etc/puppet/manifests/roles/oam_primary.pp > /etc/puppet/manifests/roles/oam_primary.pp + curl swift_url/etc/puppet/manifests/roles/transcoder.pp > /etc/puppet/manifests/roles/transcoder.pp + curl swift_url/etc/puppet/files/roles/oam_primary/config.yaml > /etc/puppet/files/roles/oam_primary/config.yaml + curl swift_url/etc/puppet/files/roles/transcoder/config.yaml > /etc/puppet/files/roles/transcoder/config.yaml + curl swift_url/etc/puppet/files/roles/transcoder/hpm.conf > /etc/puppet/files/roles/transcoder/hpm.conf + curl swift_url/etc/puppet/files/roles/transcoder/trx.conf > /etc/puppet/files/roles/transcoder/trx.conf + curl swift_url/etc/puppet/files/roles/transcoder/plugins-mo.conf > /etc/puppet/files/roles/transcoder/plugins-mo.conf + curl swift_url/etc/puppet/files/global/11-customer.conf > /etc/puppet/files/global/11-customer.conf + curl swift_url/etc/puppet/manifests/site.pp > /etc/puppet/manifests/site.pp + curl swift_url/scripts/van-init-replicaset > /usr/sbin/van-init-replicaset + van-role oam_primary > /root/startup-van-role.out + curl swift_url/scripts/fdisk-keystrokes > /root/fdisk-keystrokes + fdisk /dev/vdb < /root/fdisk-keystrokes + curl swift_url/scripts/os-conf-cinder-vol > /root/os-conf-cinder-vol + chmod 755 /root/os-conf-cinder-vol + /root/os-conf-cinder-vol 2>> /tmp/cinder_volume.log + params: + oam1_mgt_ip: {get_param: [eca_oam_ips, 0] } + oam_gateway: {get_param: eca_oam_gateway } + oam1_hostname: {get_param: [eca_names, 0]} + swift_url: {get_param: swift_eca_url} + + oam1_mgmt_port: + type: OS::Neutron::Port + properties: + network: {get_param: oam_net_name} + fixed_ips: [{"ip_address": {get_param: [eca_oam_ips, 0]}}] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + oam1_int_port: + type: OS::Neutron::Port + properties: + network: {get_param: eca_mgmt_net_name} + fixed_ips: [{"ip_address": {get_param: [eca_eca_mgmt_ips, 0]}}] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + oam1_volume: + type: OS::Cinder::Volume + properties: + size: {get_param: oam_volume_size} + volume_type: {get_param: ECA_OAM_volume_type} + + oam1_volume_attachment: + type: OS::Cinder::VolumeAttachment + properties: + volume_id: {get_resource: oam1_volume} + instance_uuid: {get_resource: oam1_instance} + + oam2_instance: + type: OS::Nova::Server + properties: + name: {get_param: [eca_names, 1]} + image: {get_param: oam_image_name} + flavor: {get_param: oam_flavor} + availability_zone: {get_param: availability_zone_0} + networks: + - port: {get_resource: oam2_int_port} + - port: {get_resource: oam2_mgmt_port} + metadata: + vnf_id: { get_param: vnf_id } + user_data: + str_replace: + template: | + #!/bin/bash + sed -i s/HOSTNAME.*/"HOSTNAME=oam2_hostname"/g /etc/sysconfig/network + eth1_ip_address='oam2_mgt_ip' + eth1_gateway='oam_gateway' + for interface in $(ip addr show|perl -nle 's/\d:\s([a-z0-9]*?):/print $1/e') ; do + if [ "$interface" != "lo" ]; then + DEVICE_NAME=$interface + interface_ip_var="${DEVICE_NAME}_ip_address" + gateway_var="${DEVICE_NAME}_gateway" + var_name="$interface_ip_var" + var_gateway="$gateway_var" + if [ ! -z ${!var_name} ]; then + IPADDR=${!var_name} + BOOTPROTO="static" + GATEWAY=${!var_gateway} + IFCFG_TEMPLATE="DEVICE=$DEVICE_NAME\nNM_CONTROLLED=no\nONBOOT=yes\nUSERCTL=no" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nBOOTPROTO=$BOOTPROTO" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nIPADDR=$IPADDR" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nNETMASK=255.255.255.0" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nGATEWAY=$GATEWAY" + printf $IFCFG_TEMPLATE > /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME + else + if [ ! -f /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME ]; then + echo "Configuring $DEVICE_NAME to use DHCP" + IFCFG_TEMPLATE="DEVICE=$DEVICE_NAME\nNM_CONTROLLED=no\nONBOOT=yes" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nBOOTPROTO=dhcp\nUSERCTL=no" + printf $IFCFG_TEMPLATE > /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME + fi + fi + ifdown $DEVICE_NAME + ifup $DEVICE_NAME + printf "$DEVICE_NAME\n" >> /tmp/network_config + fi + done + curl swift_url/etc/puppet/manifests/roles/oam_secondary.pp > /etc/puppet/manifests/roles/oam_secondary.pp + curl swift_url/etc/puppet/files/global/config.yaml > /etc/puppet/files/global/config.yaml + curl swift_url/etc/puppet/files/global/11-customer.conf > /etc/puppet/files/global/11-customer.conf + van-role oam_secondary > /root/startup-van-role.out + curl swift_url/scripts/fdisk-keystrokes > /root/fdisk-keystrokes + fdisk /dev/vdb < /root/fdisk-keystrokes + curl swift_url/scripts/os-conf-cinder-vol > /root/os-conf-cinder-vol + chmod 755 /root/os-conf-cinder-vol + /root/os-conf-cinder-vol 2>> /tmp/cinder_volume.log + + params: + oam2_mgt_ip: {get_param: [eca_oam_ips, 1] } + oam2_hostname: {get_param: [eca_names, 1]} + swift_url: {get_param: swift_eca_url} + oam_gateway: {get_param: eca_oam_gateway } + + oam2_mgmt_port: + type: OS::Neutron::Port + properties: + network: {get_param: oam_net_name} + fixed_ips: [{"ip_address": {get_param: [eca_oam_ips, 1]}}] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + oam2_int_port: + type: OS::Neutron::Port + properties: + network: {get_param: eca_mgmt_net_name} + fixed_ips: [{"ip_address": {get_param: [eca_eca_mgmt_ips, 1]}}] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + oam2_volume: + type: OS::Cinder::Volume + properties: + size: {get_param: oam_volume_size} + volume_type: {get_param: ECA_OAM_volume_type} + + oam2_volume_attachment: + type: OS::Cinder::VolumeAttachment + properties: + volume_id: {get_resource: oam2_volume} + instance_uuid: {get_resource: oam2_instance} + + arb_instance: + type: OS::Nova::Server + properties: + name: {get_param: [arb_names, 0]} + image: {get_param: oam_image_name} + flavor: {get_param: arbiter_flavor} + availability_zone: {get_param: availability_zone_0} + networks: + - port: {get_resource: arb_int_port} + - port: {get_resource: arb_mgmt_port} + metadata: + vnf_id: { get_param: vnf_id } + user_data: + str_replace: + template: | + #!/bin/bash + sed -i s/HOSTNAME.*/"HOSTNAME=arb_hostname"/g /etc/sysconfig/network + eth1_ip_address='arb_mgt_ip' + eth1_gateway='oam_gateway' + for interface in $(ip addr show|perl -nle 's/\d:\s([a-z0-9]*?):/print $1/e') ; do + if [ "$interface" != "lo" ]; then + DEVICE_NAME=$interface + interface_ip_var="${DEVICE_NAME}_ip_address" + gateway_var="${DEVICE_NAME}_gateway" + var_name="$interface_ip_var" + var_gateway="$gateway_var" + if [ ! -z ${!var_name} ]; then + IPADDR=${!var_name} + BOOTPROTO="static" + GATEWAY=${!var_gateway} + IFCFG_TEMPLATE="DEVICE=$DEVICE_NAME\nNM_CONTROLLED=no\nONBOOT=yes\nUSERCTL=no" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nBOOTPROTO=$BOOTPROTO" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nIPADDR=$IPADDR" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nNETMASK=255.255.255.0" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nGATEWAY=$GATEWAY" + printf $IFCFG_TEMPLATE > /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME + else + if [ ! -f /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME ]; then + echo "Configuring $DEVICE_NAME to use DHCP" + IFCFG_TEMPLATE="DEVICE=$DEVICE_NAME\nNM_CONTROLLED=no\nONBOOT=yes" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nBOOTPROTO=dhcp\nUSERCTL=no" + printf $IFCFG_TEMPLATE > /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME + fi + fi + ifdown $DEVICE_NAME + ifup $DEVICE_NAME + printf "$DEVICE_NAME\n" >> /tmp/network_config + fi + done + curl swift_url/etc/puppet/manifests/roles/oam_arbiter.pp > /etc/puppet/manifests/roles/oam_arbiter.pp + curl swift_url/etc/puppet/files/global/config.yaml > /etc/puppet/files/global/config.yaml + curl swift_url/etc/puppet/files/global/11-customer.conf > /etc/puppet/files/global/11-customer.conf + van-role oam_arbiter > /root/startup-van-role.out + curl swift_url/scripts/fdisk-keystrokes > /root/fdisk-keystrokes + fdisk /dev/vdb < /root/fdisk-keystrokes + curl swift_url/scripts/os-conf-cinder-vol > /root/os-conf-cinder-vol + chmod 755 /root/os-conf-cinder-vol + /root/os-conf-cinder-vol 2>> /tmp/cinder_volume.log + params: + arb_mgt_ip: {get_param: [arb_oam_ips, 0] } + arb_hostname: {get_param: [arb_names, 0]} + swift_url: {get_param: swift_eca_url} + oam_gateway: {get_param: eca_oam_gateway } + + arb_mgmt_port: + type: OS::Neutron::Port + properties: + network: {get_param: oam_net_name} + fixed_ips: [{"ip_address": {get_param: [arb_oam_ips, 0]}}] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + arb_int_port: + type: OS::Neutron::Port + properties: + network: {get_param: eca_mgmt_net_name} + fixed_ips: [{"ip_address": {get_param: [arb_eca_mgmt_ips, 0]}}] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + arb_volume: + type: OS::Cinder::Volume + properties: + size: {get_param: arb_volume_size} + volume_type: {get_param: ARB_volume_type} + arb_volume_attachment: + type: OS::Cinder::VolumeAttachment + properties: + volume_id: {get_resource: arb_volume} + instance_uuid: {get_resource: arb_instance} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/invalidTypes/eca_oam_2.yaml b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/invalidTypes/eca_oam_2.yaml new file mode 100644 index 0000000000..b9fa48615c --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/invalidTypes/eca_oam_2.yaml @@ -0,0 +1,383 @@ +heat_template_version: 2013-05-23 + +########################################################## +# +# Changes from MSO +# - Updated per ECOMP Feedback +# +# +########################################################## + +description: This stack creates two ECA OAM VM and one ARB VM + +parameters: + vnf_id: + type: string + description: Unique ID for this VNF instance + default: This_is_ths_MMSC-ECA_id + eca_names: + type: comma_delimited_list + label: oam servers names + description: the names of the OAM1,OAM2 VM instances + arb_names: + type: comma_delimited_list + label: arbiter server names + description: the names of the arbiter VM instances + oam_image_name: + type: string + label: image name + description: the OAM image name + oam_flavor: + type: string + label: flavor name + description: OAM flavor name + arbiter_flavor: + type: string + label: flavor name + description: arbiter flavor name + availability_zone_0: + type: string + label: availabilityzone name + description: availabilityzone name + oam_net_name: + type: string + label: oam network name + description: the name of the oam network + eca_mgmt_net_name: + type: string + label: internal network name + description: the name of the internal network + eca_oam_ips: + type: comma_delimited_list + label: oam network ips + description: the ips of oam networks for eca VM + eca_oam_gateway: + type: string + label: oam1 oam gateway + description: the ip of oam gateway + eca_eca_mgmt_ips: + type: comma_delimited_list + label: eca_mgmt network ips for eca VM + description: internal eca_mgmt network ips for eca VM + arb_oam_ips: + type: comma_delimited_list + label: oam network ips for arb VM + description: oam network ips for eca VM + arb_eca_mgmt_ips: + type: comma_delimited_list + label: eca_mgmt network ips + description: internal eca_mgmt network ips for arb VM + eca_oam_gateway: + type: string + label: oam network gateway + description: oam network gateway + security_group_name: + type: string + label: security group name + description: the name of security group + oam_volume_size: + type: number + label: volume size + description: the size of the OAM volume + arb_volume_size: + type: number + label: volume size + description: the size of the ARB volume + swift_eca_url: + type: string + label: Swift URL + description: Base URL for eca swift object store + ECA_OAM_volume_type: + type: string + label: eca oam vm volume type + description: the name of the target volume backend + ARB_volume_type: + type: string + label: arb vm volume type + description: the name of the target volume backend + +resources: + oam1_instance: + type: OS::Nova::Server + properties: + name: {get_param: [eca_names, 0]} + image: {get_param: oam_image_name} + flavor: {get_param: oam_flavor} + availability_zone: {get_param: availability_zone_0} + networks: + - port: {get_resource: oam1_int_port} + - port: {get_resource: oam1_mgmt_port} + metadata: + vnf_id: { get_param: vnf_id } + user_data: + str_replace: + template: | + #!/bin/bash + sed -i s/HOSTNAME.*/"HOSTNAME=oam1_hostname"/g /etc/sysconfig/network + eth1_ip_address='oam1_mgt_ip' + eth1_gateway='oam_gateway' + for interface in $(ip addr show|perl -nle 's/\d:\s([a-z0-9]*?):/print $1/e') ; do + if [ "$interface" != "lo" ]; then + DEVICE_NAME=$interface + interface_ip_var="${DEVICE_NAME}_ip_address" + gateway_var="${DEVICE_NAME}_gateway" + var_name="$interface_ip_var" + var_gateway="$gateway_var" + if [ ! -z ${!var_name} ]; then + IPADDR=${!var_name} + BOOTPROTO="static" + GATEWAY=${!var_gateway} + IFCFG_TEMPLATE="DEVICE=$DEVICE_NAME\nNM_CONTROLLED=no\nONBOOT=yes\nUSERCTL=no" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nBOOTPROTO=$BOOTPROTO" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nIPADDR=$IPADDR" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nNETMASK=255.255.255.0" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nGATEWAY=$GATEWAY" + printf $IFCFG_TEMPLATE > /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME + else + if [ ! -f /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME ]; then + echo "Configuring $DEVICE_NAME to use DHCP" + IFCFG_TEMPLATE="DEVICE=$DEVICE_NAME\nNM_CONTROLLED=no\nONBOOT=yes" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nBOOTPROTO=dhcp\nUSERCTL=no" + printf $IFCFG_TEMPLATE > /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME + fi + fi + ifdown $DEVICE_NAME + ifup $DEVICE_NAME + printf "$DEVICE_NAME\n" >> /tmp/network_config + fi + done + mkdir /etc/puppet/files/roles/transcoder + mkdir /etc/puppet/files/roles/oam_primary + curl swift_url/etc/puppet/manifests/roles/oam_primary.pp > /etc/puppet/manifests/roles/oam_primary.pp + curl swift_url/etc/puppet/manifests/roles/transcoder.pp > /etc/puppet/manifests/roles/transcoder.pp + curl swift_url/etc/puppet/files/roles/oam_primary/config.yaml > /etc/puppet/files/roles/oam_primary/config.yaml + curl swift_url/etc/puppet/files/roles/transcoder/config.yaml > /etc/puppet/files/roles/transcoder/config.yaml + curl swift_url/etc/puppet/files/roles/transcoder/hpm.conf > /etc/puppet/files/roles/transcoder/hpm.conf + curl swift_url/etc/puppet/files/roles/transcoder/trx.conf > /etc/puppet/files/roles/transcoder/trx.conf + curl swift_url/etc/puppet/files/roles/transcoder/plugins-mo.conf > /etc/puppet/files/roles/transcoder/plugins-mo.conf + curl swift_url/etc/puppet/files/global/11-customer.conf > /etc/puppet/files/global/11-customer.conf + curl swift_url/etc/puppet/manifests/site.pp > /etc/puppet/manifests/site.pp + curl swift_url/scripts/van-init-replicaset > /usr/sbin/van-init-replicaset + van-role oam_primary > /root/startup-van-role.out + curl swift_url/scripts/fdisk-keystrokes > /root/fdisk-keystrokes + fdisk /dev/vdb < /root/fdisk-keystrokes + curl swift_url/scripts/os-conf-cinder-vol > /root/os-conf-cinder-vol + chmod 755 /root/os-conf-cinder-vol + /root/os-conf-cinder-vol 2>> /tmp/cinder_volume.log + params: + oam1_mgt_ip: {get_param: [eca_oam_ips, 0] } + oam_gateway: {get_param: eca_oam_gateway } + oam1_hostname: {get_param: [eca_names, 0]} + swift_url: {get_param: swift_eca_url} + + oam1_mgmt_port: + type: OS::Neutron::Port + properties: + network: {get_param: oam_net_name} + fixed_ips: [{"ip_address": {get_param: [eca_oam_ips, 0]}}] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + oam1_int_port: + type: OS::Neutron::Port + properties: + network: {get_param: eca_mgmt_net_name} + fixed_ips: [{"ip_address": {get_param: [eca_eca_mgmt_ips, 0]}}] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + oam1_volume: + type: OS::Cinder::Volume + properties: + size: {get_param: oam_volume_size} + volume_type: {get_param: ECA_OAM_volume_type} + + oam1_volume_attachment: + type: OS::Cinder::VolumeAttachment + properties: + volume_id: {get_resource: oam1_volume} + instance_uuid: {get_resource: oam1_instance} + + oam2_instance: + type: OS::Nova::Server + properties: + name: {get_param: [eca_names, 1]} + image: {get_param: oam_image_name} + flavor: {get_param: oam_flavor} + availability_zone: {get_param: availability_zone_0} + networks: + - port: {get_resource: oam2_int_port} + - port: {get_resource: oam2_mgmt_port} + metadata: + vnf_id: { get_param: vnf_id } + user_data: + str_replace: + template: | + #!/bin/bash + sed -i s/HOSTNAME.*/"HOSTNAME=oam2_hostname"/g /etc/sysconfig/network + eth1_ip_address='oam2_mgt_ip' + eth1_gateway='oam_gateway' + for interface in $(ip addr show|perl -nle 's/\d:\s([a-z0-9]*?):/print $1/e') ; do + if [ "$interface" != "lo" ]; then + DEVICE_NAME=$interface + interface_ip_var="${DEVICE_NAME}_ip_address" + gateway_var="${DEVICE_NAME}_gateway" + var_name="$interface_ip_var" + var_gateway="$gateway_var" + if [ ! -z ${!var_name} ]; then + IPADDR=${!var_name} + BOOTPROTO="static" + GATEWAY=${!var_gateway} + IFCFG_TEMPLATE="DEVICE=$DEVICE_NAME\nNM_CONTROLLED=no\nONBOOT=yes\nUSERCTL=no" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nBOOTPROTO=$BOOTPROTO" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nIPADDR=$IPADDR" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nNETMASK=255.255.255.0" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nGATEWAY=$GATEWAY" + printf $IFCFG_TEMPLATE > /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME + else + if [ ! -f /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME ]; then + echo "Configuring $DEVICE_NAME to use DHCP" + IFCFG_TEMPLATE="DEVICE=$DEVICE_NAME\nNM_CONTROLLED=no\nONBOOT=yes" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nBOOTPROTO=dhcp\nUSERCTL=no" + printf $IFCFG_TEMPLATE > /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME + fi + fi + ifdown $DEVICE_NAME + ifup $DEVICE_NAME + printf "$DEVICE_NAME\n" >> /tmp/network_config + fi + done + curl swift_url/etc/puppet/manifests/roles/oam_secondary.pp > /etc/puppet/manifests/roles/oam_secondary.pp + curl swift_url/etc/puppet/files/global/config.yaml > /etc/puppet/files/global/config.yaml + curl swift_url/etc/puppet/files/global/11-customer.conf > /etc/puppet/files/global/11-customer.conf + van-role oam_secondary > /root/startup-van-role.out + curl swift_url/scripts/fdisk-keystrokes > /root/fdisk-keystrokes + fdisk /dev/vdb < /root/fdisk-keystrokes + curl swift_url/scripts/os-conf-cinder-vol > /root/os-conf-cinder-vol + chmod 755 /root/os-conf-cinder-vol + /root/os-conf-cinder-vol 2>> /tmp/cinder_volume.log + + params: + oam2_mgt_ip: {get_param: [eca_oam_ips, 1] } + oam2_hostname: {get_param: [eca_names, 1]} + swift_url: {get_param: swift_eca_url} + oam_gateway: {get_param: eca_oam_gateway } + + oam2_mgmt_port: + type: OS::Neutron::Port + properties: + network: {get_param: oam_net_name} + fixed_ips: [{"ip_address": {get_param: [eca_oam_ips, 1]}}] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + oam2_int_port: + type: OS::Neutron::Port + properties: + network: {get_param: eca_mgmt_net_name} + fixed_ips: [{"ip_address": {get_param: [eca_eca_mgmt_ips, 1]}}] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + oam2_volume: + type: OS::Cinder::Volume + properties: + size: {get_param: oam_volume_size} + volume_type: {get_param: ECA_OAM_volume_type} + + oam2_volume_attachment: + type: OS::Cinder::VolumeAttachment + properties: + volume_id: {get_resource: oam2_volume} + instance_uuid: {get_resource: oam2_instance} + + arb_instance: + type: OS::Nova::Server + properties: + name: {get_param: [arb_names, 0]} + image: {get_param: oam_image_name} + flavor: {get_param: arbiter_flavor} + availability_zone: {get_param: availability_zone_0} + networks: + - port: {get_resource: arb_int_port} + - port: {get_resource: arb_mgmt_port} + metadata: + vnf_id: { get_param: vnf_id } + user_data: + str_replace: + template: | + #!/bin/bash + sed -i s/HOSTNAME.*/"HOSTNAME=arb_hostname"/g /etc/sysconfig/network + eth1_ip_address='arb_mgt_ip' + eth1_gateway='oam_gateway' + for interface in $(ip addr show|perl -nle 's/\d:\s([a-z0-9]*?):/print $1/e') ; do + if [ "$interface" != "lo" ]; then + DEVICE_NAME=$interface + interface_ip_var="${DEVICE_NAME}_ip_address" + gateway_var="${DEVICE_NAME}_gateway" + var_name="$interface_ip_var" + var_gateway="$gateway_var" + if [ ! -z ${!var_name} ]; then + IPADDR=${!var_name} + BOOTPROTO="static" + GATEWAY=${!var_gateway} + IFCFG_TEMPLATE="DEVICE=$DEVICE_NAME\nNM_CONTROLLED=no\nONBOOT=yes\nUSERCTL=no" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nBOOTPROTO=$BOOTPROTO" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nIPADDR=$IPADDR" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nNETMASK=255.255.255.0" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nGATEWAY=$GATEWAY" + printf $IFCFG_TEMPLATE > /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME + else + if [ ! -f /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME ]; then + echo "Configuring $DEVICE_NAME to use DHCP" + IFCFG_TEMPLATE="DEVICE=$DEVICE_NAME\nNM_CONTROLLED=no\nONBOOT=yes" + IFCFG_TEMPLATE="$IFCFG_TEMPLATE\nBOOTPROTO=dhcp\nUSERCTL=no" + printf $IFCFG_TEMPLATE > /etc/sysconfig/network-scripts/ifcfg-$DEVICE_NAME + fi + fi + ifdown $DEVICE_NAME + ifup $DEVICE_NAME + printf "$DEVICE_NAME\n" >> /tmp/network_config + fi + done + curl swift_url/etc/puppet/manifests/roles/oam_arbiter.pp > /etc/puppet/manifests/roles/oam_arbiter.pp + curl swift_url/etc/puppet/files/global/config.yaml > /etc/puppet/files/global/config.yaml + curl swift_url/etc/puppet/files/global/11-customer.conf > /etc/puppet/files/global/11-customer.conf + van-role oam_arbiter > /root/startup-van-role.out + curl swift_url/scripts/fdisk-keystrokes > /root/fdisk-keystrokes + fdisk /dev/vdb < /root/fdisk-keystrokes + curl swift_url/scripts/os-conf-cinder-vol > /root/os-conf-cinder-vol + chmod 755 /root/os-conf-cinder-vol + /root/os-conf-cinder-vol 2>> /tmp/cinder_volume.log + params: + arb_mgt_ip: {get_param: [arb_oam_ips, 0] } + arb_hostname: {get_param: [arb_names, 0]} + swift_url: {get_param: swift_eca_url} + oam_gateway: {get_param: eca_oam_gateway } + + arb_mgmt_port: + type: OS::Neutron::Port + properties: + network: {get_param: oam_net_name} + fixed_ips: [{"ip_address": {get_param: [arb_oam_ips, 0]}}] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + arb_int_port: + type: OS::Neutron::Port + properties: + network: {get_param: eca_mgmt_net_name} + fixed_ips: [{"ip_address": {get_param: [arb_eca_mgmt_ips, 0]}}] + security_groups: [{get_param: security_group_name}] + replacement_policy: AUTO + + arb_volume: + type: OS::Cinder::Volume + properties: + size: {get_param: arb_volume_size} + volume_type: {get_param: ARB_volume_type} + arb_volume_attachment: + type: OS::Cinder::VolumeAttachment + properties: + volume_id: {get_resource: arb_volume} + instance_uuid: {get_resource: arb_instance} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/invalidTypes/sg_eca_mgmt.env b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/invalidTypes/sg_eca_mgmt.env new file mode 100644 index 0000000000..8012063ac0 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/invalidTypes/sg_eca_mgmt.env @@ -0,0 +1,7 @@ +parameters: + eca_mgmt_name: int_eca_mgmt_net_1 + eca_mgmt_cidr: 172.25.137.192/26 + eca_mgmt_netmask: 255.255.255.192 + eca_mgmt_start: 172.25.137.195 + eca_mgmt_end: 172.25.137.254 + security_group_name: mmsc_security_group_1 diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/legalUpload/MANIFEST.json b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/legalUpload/MANIFEST.json new file mode 100644 index 0000000000..2ff7eec20e --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/legalUpload/MANIFEST.json @@ -0,0 +1,20 @@ +{ + "name": "vMME_Small", + "description": "HOT template to create vmme 2 fsb 2 ncb 2 gbp 2 vlc", + "version": "2013-05-23", + "data": [ + { + "file": "vmme_small_create_fsb.yml", + "type": "HEAT", + "data": [ + { + "file": "vmme_small_create_fsb.env", + "type": "HEAT_ENV" + } + ] + },{ + "file": "create_stack.sh", + "type": "SHELL" + } + ] +} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/legalUpload/create_stack.sh b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/legalUpload/create_stack.sh new file mode 100644 index 0000000000..186d1c34fb --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/legalUpload/create_stack.sh @@ -0,0 +1 @@ +heat stack-create vMME -e vmme_small.env -f vmme_small.yml diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/legalUpload/vmme_small_create_fsb.env b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/legalUpload/vmme_small_create_fsb.env new file mode 100644 index 0000000000..750bb2dd44 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/legalUpload/vmme_small_create_fsb.env @@ -0,0 +1,8 @@ +parameters: + volume_type: Gold + volume_size: 320 + FSB_1_image: MME_FSB1_15B-CP04-r5a01 + FSB_2_image: MME_FSB2_15B-CP04-r5a01 + FSB1_volume_name: vFSB1_1_Vol_1 + FSB2_volume_name: vFSB2_1_Vol_1 + diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/legalUpload/vmme_small_create_fsb.yml b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/legalUpload/vmme_small_create_fsb.yml new file mode 100644 index 0000000000..2d695a50c1 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/legalUpload/vmme_small_create_fsb.yml @@ -0,0 +1,54 @@ +heat_template_version: 2013-05-23 + +description: server template for vMME + +parameters: + + volume_type: + type: string + label: volume type + description: volume type Gold + + volume_size: + type: number + label: volume size + description: my volume size 320GB + + FSB_1_image: + type: string + label: MME_FSB1 + description: MME_FSB1_15B-CP04-r5a01 + + FSB_2_image: + type: string + label: MME_FSB2 + description: MME_FSB2_15B-CP04-r5a01 + + FSB1_volume_name: + type: string + label: FSB1_volume + description: FSB1_volume_1 + + FSB2_volume_name: + type: string + label: FSB2_volume + description: FSB2_volume_1 + +resources: + + FSB1_volume: + type: OS::Cinder::Volume + properties: + size: {get_param: volume_size} + volume_type: {get_param: volume_type} + name: {get_param: FSB1_volume_name} + image: {get_param: FSB_1_image} + + FSB2_volume: + type: OS::Cinder::Volume + properties: + size: {get_param: volume_size} + volume_type: {get_param: volume_type} + name: {get_param: FSB2_volume_name} + image: {get_param: FSB_2_image} + diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/legalUpload2/MANIFEST.json b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/legalUpload2/MANIFEST.json new file mode 100644 index 0000000000..02733a6e3f --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/legalUpload2/MANIFEST.json @@ -0,0 +1,29 @@ +{ + "name": "vMME_Small", + "description": "HOT template to create vmme 2 fsb 2 ncb 2 gbp 2 vlc", + "version": "2013-05-23", + "data": [ + { + "file": "vmme_small.yml", + "type": "HEAT", + "data": [ + { + "file": "vmme_small.env", + "type": "HEAT_ENV" + },{ + "file": "vmme_small_create_fsb.yml", + "type": "HEAT_NET", + "data":[ + { + "file": "vmme_small_create_fsb.env", + "type": "HEAT_ENV" + } + ] + } + ] + },{ + "file": "create_stack.sh", + "type": "SHELL" + } + ] +} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/legalUpload2/create_stack.sh b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/legalUpload2/create_stack.sh new file mode 100644 index 0000000000..186d1c34fb --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/legalUpload2/create_stack.sh @@ -0,0 +1 @@ +heat stack-create vMME -e vmme_small.env -f vmme_small.yml diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/legalUpload2/vmme_small.env b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/legalUpload2/vmme_small.env new file mode 100644 index 0000000000..e46cfd2a2d --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/legalUpload2/vmme_small.env @@ -0,0 +1,97 @@ +parameters: + oam_net_id: 47bf4cca-0961-422f-bcd6-d5a4fbb1a351 + fsb1-name: ZRDM1MMEX33FSB001 + fsb2-name: ZRDM1MMEX33FSB002 + ncb1-name: ZRDM1MMEX33NCB001 + ncb2-name: ZRDM1MMEX33NCB002 + vlc1-name: ZRDM1MMEX33VLC002 + vlc2-name: ZRDM1MMEX33VLC002 + gpb1-name: ZRDM1MMEX33GPB001 + gpb2-name: ZRDM1MMEX33GPB002 + epc-sctp-a-net-name: EPC-SCTP-A + epc-sctp-a-net-rt: 13979:105717 + epc-sctp-a-net-cidr: 107.243.37.0/27 + epc-sctp-a-net-gateway: 107.243.37.1 + epc-sctp-a-pool-start: 107.243.37.3 + epc-sctp-a-pool-end: 107.243.37.30 + epc-sctp-b-net-name: EPC-SCTP-B + epc-sctp-b-net-rt: 13979:105719 + epc-sctp-b-net-cidr: 107.243.37.32/24 + epc-sctp-b-net-gateway: 107.243.37.33 + epc-sctp-b-pool-start: 107.243.37.35 + epc-sctp-b-pool-end: 107.243.37.62 + epc-gtp-net-name: EPC-GTP + epc-gtp-net-rt: 13979:105715 + epc-gtp-net-cidr: 107.243.37.64/27 + epc-gtp-net-gateway: 107.243.37.65 + epc-gtp-pool-start: 107.243.37.67 + epc-gtp-pool-end: 107.243.37.94 + fsb1-image: MME_FSB1_15B-CP04-r5a01 + fsb2-image: MME_FSB2_15B-CP04-r5a01 + fsb1-flavor: m4.xlarge4 + fsb2-flavor: m4.xlarge4 + fsb_zone: nova + fsb1-Internal1-mac: 00:80:37:0E:0B:12 + fsb1-Internal2-mac: 00:81:37:0E:0B:12 + fsb1-oam-ip: 107.250.172.221 + fsb2-Internal1-mac: 00:80:37:0E:0D:12 + fsb2-Internal2-mac: 00:81:37:0E:0D:12 + fsb2-oam-ip: 107.250.172.222 + pxe-image: MME_PXE-BOOT_cxp9025898_2r5a01.qcow2 + ncb-flavor: m4.xlarge4 + ncb_zone: nova + ncb1-Internal1-mac: 00:80:37:0E:09:12 + ncb1-Internal2-mac: 00:81:37:0E:09:12 + ncb2-Internal1-mac: 00:80:37:0E:0F:12 + ncb2-Internal2-mac: 00:81:37:0E:0F:12 + gpb-flavor: m4.xlarge4 + gpb_zone: nova + gpb1-Internal1-mac: 00:80:37:0E:01:22 + gpb1-Internal1-ip: 169.254.0.101 + gpb1-Internal2-mac: 00:81:37:0E:01:22 + gpb2-Internal1-mac: 00:80:37:0E:02:22 + gpb2-Internal2-mac: 00:81:37:0E:02:22 + vlc-flavor: m4.xlarge4 + vlc_zone: nova + vlc1-sctp-a-ip: 107.243.37.3 + vlc1-sctp-b-ip: 107.243.37.35 + vlc1-gtp-ip: 107.243.37.67 + vlc1-oam-ip: 107.250.172.227 + vlc2-sctp-a-ip: 107.243.37.4 + vlc2-sctp-b-ip: 107.243.37.36 + vlc2-gtp-ip: 107.243.37.68 + vlc2-oam-ip: 107.250.172.228 + vlc1-Internal1-mac: 00:80:37:0E:01:12 + vlc1-Internal2-mac: 00:81:37:0E:01:12 + vlc2-Internal1-mac: 00:80:37:0E:02:12 + vlc2-Internal2-mac: 00:81:37:0E:02:12 + Internal1_net_name: vmme_int_int_1 + Internal1_subnet_name: vmme_int_int_sub_1 + Internal1_ipam_name: vmme_ipam_int1 + Internal1_cidr: 169.253.0.0/17 + Internal1_forwarding_mode: "l2" + Internal1_dhcp: "False" + Internal1_shared: "False" + Internal1_external: "False" + Internal1_name: "Internal1-subnet" + Internal1_default_gateway: 169.253.0.3 + Internal1_net_pool_start: 169.253.0.100 + Internal1_net_pool_end: 169.253.0.254 + Internal2_net_name: vmme_int_int_2 + Internal2_subnet_name: vmme_int_int_sub_2 + Internal2_ipam_name: vmme_ipam_int2 + Internal2_cidr: 169.255.0.0/17 + Internal2_shared: "False" + Internal2_external: "False" + Internal2_forwarding_mode: "l2" + Internal2_dhcp: "False" + Internal2_name: "Internal2-subnet" + Internal2_default_gateway: 169.255.0.3 + Internal2_net_pool_start: 169.255.0.100 + Internal2_net_pool_end: 169.255.0.254 + static_prefix_sctp_a_1: 107.239.40.32/30 + static_prefix_gtp_1: 107.239.40.96/30 + static_prefix_sctp_b_1: 107.239.40.64/30 + VMME_FSB1_boot_volume: 8248e794-6173-4b49-b9c3-8219b0b56f4e + VMME_FSB2_boot_volume: 089a0d11-4b15-4370-8343-3f90907b1221 + diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/legalUpload2/vmme_small.yml b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/legalUpload2/vmme_small.yml new file mode 100644 index 0000000000..ab76c1ce0a --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/legalUpload2/vmme_small.yml @@ -0,0 +1,661 @@ +heat_template_version: 2013-05-23 + +description: > + HOT template to create vmme 2 fsb 2 ncb 2 gbp 2 vlc + +parameters: + fsb1-oam-ip: + type: string + fsb2-oam-ip: + type: string + vlc1-oam-ip: + type: string + vlc2-oam-ip: + type: string + Internal1_net_pool_start: + type: string + Internal1_net_pool_end: + type: string + Internal2_net_pool_start: + type: string + Internal2_net_pool_end: + type: string + Internal1_default_gateway: + type: string + Internal2_default_gateway: + type: string + Internal1_shared: + type: string + Internal1_external: + type: string + Internal1_net_name: + type: string + Internal1_subnet_name: + type: string + Internal1_ipam_name: + type: string + Internal1_cidr: + type: string + Internal1_forwarding_mode: + type: string + Internal1_dhcp: + type: string + Internal1_name: + type: string + Internal2_net_name: + type: string + Internal2_subnet_name: + type: string + Internal2_ipam_name: + type: string + Internal2_cidr: + type: string + Internal2_forwarding_mode: + type: string + Internal2_dhcp: + type: string + Internal2_name: + type: string + Internal2_shared: + type: string + Internal2_external: + type: string + vlc1-sctp-a-ip: + type: string + vlc1-sctp-b-ip: + type: string + vlc1-gtp-ip: + type: string + vlc2-sctp-a-ip: + type: string + vlc2-sctp-b-ip: + type: string + vlc2-gtp-ip: + type: string + fsb1-name: + type: string + description: Name of fsb1 + fsb2-name: + type: string + description: Name of fsb1 + ncb1-name: + type: string + description: Name of ncb1 + ncb2-name: + type: string + description: Name of ncb2 + vlc1-name: + type: string + description: Name of vlc1 + vlc2-name: + type: string + description: Name of vlc2 + gpb1-name: + type: string + description: Name of gpb1 + gpb2-name: + type: string + description: Name of gpb2 + fsb_zone: + type: string + description: cluster for spawnning fsb instances + fsb1-image: + type: string + description: Name of image to use for server fsb1 + fsb1-flavor: + type: string + description: Flavor to use for servers fsb1 + oam_net_id: + type: string + description: uuid of oam network + fsb1-Internal1-mac: + type: string + description: static mac address assigned to fsb1-Internal1 + fsb1-Internal2-mac: + type: string + description: static mac address assigned to fsb1-Internal2 + fsb2-image: + type: string + description: Name of image to use for server fsb2 + fsb2-flavor: + type: string + description: Flavor to use for servers fsb2 + fsb2-Internal1-mac: + type: string + description: static mac address assigned to fsb2-Internal1 + fsb2-Internal2-mac: + type: string + description: static mac address assigned to fsb2-Internal2 + pxe-image: + type: string + description: Name of image to use for server ncb + ncb-flavor: + type: string + description: Flavor to use for servers ncb + ncb_zone: + type: string + description: cluster for spawnning ncb instances + ncb1-Internal1-mac: + type: string + description: static mac address assigned to ncb1-Internal1 + ncb1-Internal2-mac: + type: string + description: static mac address assigned to ncb1-Internal2 + ncb2-Internal1-mac: + type: string + description: static mac address assigned to ncb2-Internal1 + ncb2-Internal2-mac: + type: string + description: static mac address assigned to ncb2-Internal2 + gpb-flavor: + type: string + description: Flavor to use for servers gpb + gpb_zone: + type: string + description: cluster for spawnning gpb instances + gpb1-Internal1-ip: + type: string + gpb1-Internal1-mac: + type: string + description: static mac address assigned to gpb1-Internal1 + gpb1-Internal2-mac: + type: string + description: static mac address assigned to gpb1-Internal2 + gpb2-Internal1-mac: + type: string + description: static mac address assigned to gpb2-Internal1 + gpb2-Internal2-mac: + type: string + description: static mac address assigned to gpb2-Internal2 + vlc-flavor: + type: string + description: Flavor to use for servers vlc + vlc_zone: + type: string + description: cluster for spawnning vlc instances + vlc1-Internal1-mac: + type: string + description: static mac address assigned to vlc1-Internal1 + vlc1-Internal2-mac: + type: string + description: static mac address assigned to vlc1-Internal2 + vlc2-Internal1-mac: + type: string + description: static mac address assigned to vlc2-Internal1 + vlc2-Internal2-mac: + type: string + description: static mac address assigned to vlc2-Internal2 + epc-sctp-a-net-name: + type: string + description: epc-sctp-a net name + epc-sctp-a-net-rt: + type: string + description: epc-sctp-a route target + epc-sctp-a-net-cidr: + type: string + description: epc-sctp-a subnet + epc-sctp-a-net-gateway: + type: string + description: epc-sctp-a-net network gateway + epc-sctp-a-pool-start: + type: string + description: epc-sctp-a-net network ip pool start IP address + epc-sctp-a-pool-end: + type: string + description: epc-sctp-a-net network ip pool end IP address + epc-sctp-b-net-name: + type: string + description: epc-sctp-b net name + epc-sctp-b-net-rt: + type: string + description: epc-sctp-b route target + epc-sctp-b-net-cidr: + type: string + description: epc-sctp-b subnet + epc-sctp-b-net-gateway: + type: string + description: epc-sctp-b-net network gateway + epc-sctp-b-pool-start: + type: string + description: epc-sctp-b-net network ip pool start IP address + epc-sctp-b-pool-end: + type: string + description: epc-sctp-b-net network ip pool end IP address + epc-gtp-net-name: + type: string + description: gtp net name + epc-gtp-net-rt: + type: string + description: gtp route target + epc-gtp-net-cidr: + type: string + description: gtp stubnet + epc-gtp-net-gateway: + type: string + description: gtp network gateway + epc-gtp-pool-start: + type: string + description: gtp network ip pool start IP address + epc-gtp-pool-end: + type: string + description: gtp network ip pool end IP address + static_prefix_sctp_a_1: + type: string + description: Static Prefix + static_prefix_sctp_b_1: + type: string + description: Static Prefix + static_prefix_gtp_1: + type: string + description: Static Prefix + VMME_FSB1_boot_volume: + type: string + VMME_FSB2_boot_volume: + type: string + +resources: + Internal1_ipam: + type: OS::Contrail::NetworkIpam + properties: + name: { get_param: Internal1_ipam_name } + + Internal2_ipam: + type: OS::Contrail::NetworkIpam + properties: + name: { get_param: Internal2_ipam_name } + + Internal1-net: + type: OS::Contrail::VirtualNetwork + properties: + name: { get_param: Internal1_net_name } + template: { get_file: create_stack.sh } + forwarding_mode: { get_param: Internal1_forwarding_mode } + shared: { get_param: Internal1_shared } + external: true +# route_targets: { "Fn::Split" : [ ",", Ref: route_targets ] } + testConvertGetParamFunctions: + type: OS::Contrail::VirtualNetwork + properties: + name: { get_param: Internal1_net_name } + forwarding_mode: { get_param: Internal1_forwarding_mode } + shared: { get_param: Internal1_shared } + +# route_targets: { "Fn::Split" : [ ",", Ref: route_targets ] } + testConvertGetAttributeFunctions: + type: OS::Contrail::VirtualNetwork + properties: + name: { get_param: Internal1_net_name } + forwarding_mode: { get_param: Internal1_forwarding_mode } + shared: { get_param: Internal1_shared } + external: { get_param: Internal1_external } +# route_targets: { "Fn::Split" : [ ",", Ref: route_targets ] } + + Internal1-subnet: + type: OS::Neutron::Subnet + properties: + network_id: { get_resource: Internal1-net } + cidr: { get_param: Internal1_cidr } + gateway_ip: { get_param: Internal1_default_gateway } + enable_dhcp: { get_param: Internal1_dhcp } + + +# Internal1-subnet: +# type: OS::Contrail::VnSubnet +# properties: +# name: { get_param: Internal1_subnet_name } +# network: { get_resource: Internal1-net } +# ip_prefix: { get_param: Internal1_cidr } + # ipam: { get_resource: Internal1_ipam } + # enable_dhcp: { get_param: Internal1_dhcp } + # default_gateway: { get_param: Internal1_default_gateway } + # allocation_pools: + # - start: { get_param: Internal1_net_pool_start } + # end: { get_param: Internal1_net_pool_end } + + + + Internal2-net: + type: OS::Contrail::VirtualNetwork + properties: + name: { get_param: Internal2_name } + forwarding_mode: { get_param: Internal2_forwarding_mode } + shared: { get_param: Internal2_shared } + external: { get_param: Internal2_external } +# route_targets: { "Fn::Split" : [ ",", Ref: route_targets ] } + +# Internal2-subnet: +# type: OS::Contrail::VnSubnet +# properties: +# name: { get_param: Internal2_subnet_name } +# network: { get_resource: Internal2-net } +# ip_prefix: { get_param: Internal2_cidr } +# ipam: { get_resource: Internal2_ipam } +# enable_dhcp: { get_param: Internal2_dhcp } +# default_gateway: { get_param: Internal2_default_gateway } +# allocation_pools: +# - start: { get_param: Internal2_net_pool_start } +# end: { get_param: Internal2_net_pool_end } + + Internal2-subnet: + type: OS::Neutron::Subnet + properties: + network_id: { get_resource: Internal2-net } + cidr: { get_param: Internal2_cidr } + gateway_ip: { get_param: Internal2_default_gateway } + enable_dhcp: { get_param: Internal2_dhcp } + + epc-sctp-a-net: + type: OS::Contrail::VirtualNetwork + properties: + name: { get_param: epc-sctp-a-net-name } + route_targets: [ get_param: epc-sctp-a-net-rt ] + + + epc-sctp-a-subnet: + type: OS::Neutron::Subnet + properties: + network_id: { get_resource: epc-sctp-a-net } + cidr: { get_param: epc-sctp-a-net-cidr } + gateway_ip: { get_param: epc-sctp-a-net-gateway } + allocation_pools: + - start: { get_param: epc-sctp-a-pool-start } + end: { get_param: epc-sctp-a-pool-end } + + epc-sctp-b-net: + type: OS::Contrail::VirtualNetwork + properties: + name: { get_param: epc-sctp-b-net-name } + route_targets: [ get_param: epc-sctp-b-net-rt ] + + epc-sctp-b-subnet: + type: OS::Neutron::Subnet + properties: + network_id: { get_resource: epc-sctp-b-net } + cidr: { get_param: epc-sctp-b-net-cidr } + gateway_ip: { get_param: epc-sctp-b-net-gateway } + allocation_pools: + - start: { get_param: epc-sctp-b-pool-start } + end: { get_param: epc-sctp-b-pool-end } + + epc-gtp-net: + type: OS::Contrail::VirtualNetwork + properties: + name: { get_param: epc-gtp-net-name } + route_targets: [ get_param: epc-gtp-net-rt ] + + epc-gtp-subnet: + type: OS::Neutron::Subnet + properties: + network_id: { get_resource: epc-gtp-net } + cidr: { get_param: epc-gtp-net-cidr } + gateway_ip: { get_param: epc-gtp-net-gateway } + allocation_pools: + - start: { get_param: epc-gtp-pool-start } + end: { get_param: epc-gtp-pool-end } + + FSB1: + type: OS::Nova::Server + properties: + name: { get_param: fsb1-name } + block_device_mapping: [{device_name: "vda", volume_id : {get_param: VMME_FSB1_boot_volume }, delete_on_termination: "false" }] + flavor: { get_param: fsb1-flavor } + availability_zone: { get_param: fsb_zone } + networks: + - port: { get_resource: FSB1_Internal1 } + - port: { get_resource: FSB1_Internal2 } + - port: { get_resource: FSB1_OAM } + + FSB1_Internal1: + type: OS::Neutron::Port + properties: + network_id: { get_resource: Internal1-net } + mac_address: { get_param: fsb1-Internal1-mac } + + FSB1_Internal2: + type: OS::Neutron::Port + properties: + network_id: { get_resource: Internal2-net } + mac_address: { get_param: fsb1-Internal2-mac } + + FSB1_OAM: + type: OS::Neutron::Port + properties: + network_id: { get_param: oam_net_id } + fixed_ips: + - ip_address: { get_param: fsb1-oam-ip } + + FSB2: + type: OS::Nova::Server + properties: + name: { get_param: fsb2-name } + block_device_mapping: [{device_name: "vda", volume_id : {get_param: VMME_FSB2_boot_volume }, delete_on_termination: "false" }] + flavor: { get_param: fsb2-flavor } + availability_zone: { get_param: fsb_zone } + networks: + - port: { get_resource: FSB2_Internal1 } + - port: { get_resource: FSB2_Internal2 } + - port: { get_resource: FSB2_OAM } + + FSB2_Internal1: + type: OS::Neutron::Port + properties: + network_id: { get_resource: Internal1-net } + mac_address: { get_param: fsb2-Internal1-mac } + + + FSB2_Internal2: + type: OS::Neutron::Port + properties: + network_id: { get_resource: Internal2-net } + mac_address: { get_param: fsb2-Internal2-mac } + + FSB2_OAM: + type: OS::Neutron::Port + properties: + network_id: { get_param: oam_net_id } + fixed_ips: + - ip_address: { get_param: fsb2-oam-ip } + + NCB1: + type: OS::Nova::Server + properties: + name: { get_param: ncb1-name } + image: { get_param: pxe-image } + flavor: { get_param: ncb-flavor } + availability_zone: { get_param: ncb_zone } + networks: + - port: { get_resource: NCB1_Internal1 } + - port: { get_resource: NCB1_Internal2 } + + NCB1_Internal1: + type: OS::Neutron::Port + properties: + network_id: { get_resource: Internal1-net } + mac_address: { get_param: ncb1-Internal1-mac } + + NCB1_Internal2: + type: OS::Neutron::Port + properties: + network_id: { get_resource: Internal2-net } + mac_address: { get_param: ncb1-Internal2-mac } + + NCB2: + type: OS::Nova::Server + properties: + name: { get_param: ncb2-name } + image: { get_param: pxe-image } + flavor: { get_param: ncb-flavor } + availability_zone: { get_param: ncb_zone } + networks: + - port: { get_resource: NCB2_Internal1 } + - port: { get_resource: NCB2_Internal2 } + + NCB2_Internal1: + type: OS::Neutron::Port + properties: + network_id: { get_resource: Internal1-net } + mac_address: { get_param: ncb2-Internal1-mac } + + NCB2_Internal2: + type: OS::Neutron::Port + properties: + network_id: { get_resource: Internal2-net } + mac_address: { get_param: ncb2-Internal2-mac } + + GPB1: + type: OS::Nova::Server + properties: + name: { get_param: gpb1-name } + image: { get_param: pxe-image } + flavor: { get_param: gpb-flavor } + availability_zone: { get_param: gpb_zone } + networks: + - port: { get_resource: GPB1_Internal1 } + - port: { get_resource: GPB1_Internal2 } + + GPB1_Internal1: + type: OS::Neutron::Port + properties: + network_id: { get_resource: Internal1-net } + mac_address: { get_param: gpb1-Internal1-mac } + + GPB1_Internal2: + type: OS::Neutron::Port + properties: + network_id: { get_resource: Internal2-net } + mac_address: { get_param: gpb1-Internal2-mac } + + GPB2: + type: OS::Nova::Server + properties: + name: { get_param: gpb2-name } + image: { get_param: pxe-image } + flavor: { get_param: gpb-flavor } + availability_zone: { get_param: gpb_zone } + networks: + - port: { get_resource: GPB2_Internal1 } + - port: { get_resource: GPB2_Internal2 } + + GPB2_Internal1: + type: OS::Neutron::Port + properties: + network_id: { get_resource: Internal1-net } + mac_address: { get_param: gpb2-Internal1-mac } + + GPB2_Internal2: + type: OS::Neutron::Port + properties: + network_id: { get_resource: Internal2-net } + mac_address: { get_param: gpb2-Internal2-mac } + + VLC1: + type: OS::Nova::Server + properties: + name: { get_param: vlc1-name } + image: { get_param: pxe-image } + flavor: { get_param: vlc-flavor } + availability_zone: { get_param: vlc_zone } + networks: + - port: { get_resource: VLC1_Internal1 } + - port: { get_resource: VLC1_Internal2 } + - port: { get_resource: VLC1_OAM } + - port: { get_resource: VLC1_SCTP_A } + - port: { get_resource: VLC1_SCTP_B } + - port: { get_resource: VLC1_GTP } + + VLC1_Internal1: + type: OS::Neutron::Port + properties: + network_id: { get_resource: Internal1-net } + mac_address: { get_param: vlc1-Internal1-mac } + + VLC1_Internal2: + type: OS::Neutron::Port + properties: + network_id: { get_resource: Internal2-net } + mac_address: { get_param: vlc1-Internal2-mac } + + VLC1_OAM: + type: OS::Neutron::Port + properties: + network_id: { get_param: oam_net_id } + fixed_ips: + - ip_address: { get_param: vlc1-oam-ip } + + VLC1_SCTP_A: + type: OS::Neutron::Port + properties: + network_id: { get_resource: epc-sctp-a-net } + fixed_ips: + - ip_address: { get_param: vlc1-sctp-a-ip } + + VLC1_SCTP_B: + type: OS::Neutron::Port + properties: + network_id: { get_resource: epc-sctp-b-net } + fixed_ips: + - ip_address: { get_param: vlc1-sctp-b-ip } + + VLC1_GTP: + type: OS::Neutron::Port + properties: + network_id: { get_resource: epc-gtp-net } + fixed_ips: + - ip_address: { get_param: vlc1-gtp-ip } + + VLC2: + type: OS::Nova::Server + properties: + name: { get_param: vlc2-name } + image: { get_param: pxe-image } + flavor: { get_param: vlc-flavor } + availability_zone: { get_param: vlc_zone } + networks: + - port: { get_resource: VLC2_Internal1 } + - port: { get_resource: VLC2_Internal2 } + - port: { get_resource: VLC2_OAM } + - port: { get_resource: VLC2_SCTP_A } + - port: { get_resource: VLC2_SCTP_B } + - port: { get_resource: VLC2_GTP } + + + VLC2_Internal1: + type: OS::Neutron::Port + properties: + network_id: { get_resource: Internal1-net } + mac_address: { get_param: vlc2-Internal1-mac } + + VLC2_OAM: + type: OS::Neutron::Port + properties: + network_id: { get_param: oam_net_id } + fixed_ips: + - ip_address: { get_param: vlc2-oam-ip } + + VLC2_Internal2: + type: OS::Neutron::Port + properties: + network_id: { get_resource: Internal2-net } + mac_address: { get_param: vlc2-Internal2-mac } + + VLC2_SCTP_A: + type: OS::Neutron::Port + properties: + network_id: { get_resource: epc-sctp-a-net } + fixed_ips: + - ip_address: { get_param: vlc2-sctp-a-ip } + + VLC2_SCTP_B: + type: OS::Neutron::Port + properties: + network_id: { get_resource: epc-sctp-b-net } + fixed_ips: + - ip_address: { get_param: vlc2-sctp-b-ip } + + VLC2_GTP: + type: OS::Neutron::Port + properties: + network_id: { get_resource: epc-gtp-net } + fixed_ips: + - ip_address: { get_param: vlc2-gtp-ip } + diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/legalUpload2/vmme_small_create_fsb.env b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/legalUpload2/vmme_small_create_fsb.env new file mode 100644 index 0000000000..750bb2dd44 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/legalUpload2/vmme_small_create_fsb.env @@ -0,0 +1,8 @@ +parameters: + volume_type: Gold + volume_size: 320 + FSB_1_image: MME_FSB1_15B-CP04-r5a01 + FSB_2_image: MME_FSB2_15B-CP04-r5a01 + FSB1_volume_name: vFSB1_1_Vol_1 + FSB2_volume_name: vFSB2_1_Vol_1 + diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/legalUpload2/vmme_small_create_fsb.yml b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/legalUpload2/vmme_small_create_fsb.yml new file mode 100644 index 0000000000..2d695a50c1 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/legalUpload2/vmme_small_create_fsb.yml @@ -0,0 +1,54 @@ +heat_template_version: 2013-05-23 + +description: server template for vMME + +parameters: + + volume_type: + type: string + label: volume type + description: volume type Gold + + volume_size: + type: number + label: volume size + description: my volume size 320GB + + FSB_1_image: + type: string + label: MME_FSB1 + description: MME_FSB1_15B-CP04-r5a01 + + FSB_2_image: + type: string + label: MME_FSB2 + description: MME_FSB2_15B-CP04-r5a01 + + FSB1_volume_name: + type: string + label: FSB1_volume + description: FSB1_volume_1 + + FSB2_volume_name: + type: string + label: FSB2_volume + description: FSB2_volume_1 + +resources: + + FSB1_volume: + type: OS::Cinder::Volume + properties: + size: {get_param: volume_size} + volume_type: {get_param: volume_type} + name: {get_param: FSB1_volume_name} + image: {get_param: FSB_1_image} + + FSB2_volume: + type: OS::Cinder::Volume + properties: + size: {get_param: volume_size} + volume_type: {get_param: volume_type} + name: {get_param: FSB2_volume_name} + image: {get_param: FSB_2_image} + diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/missingYml/MANIFEST.json b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/missingYml/MANIFEST.json new file mode 100644 index 0000000000..2ff7eec20e --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/missingYml/MANIFEST.json @@ -0,0 +1,20 @@ +{ + "name": "vMME_Small", + "description": "HOT template to create vmme 2 fsb 2 ncb 2 gbp 2 vlc", + "version": "2013-05-23", + "data": [ + { + "file": "vmme_small_create_fsb.yml", + "type": "HEAT", + "data": [ + { + "file": "vmme_small_create_fsb.env", + "type": "HEAT_ENV" + } + ] + },{ + "file": "create_stack.sh", + "type": "SHELL" + } + ] +} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/missingYml/create_stack.sh b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/missingYml/create_stack.sh new file mode 100644 index 0000000000..186d1c34fb --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/missingYml/create_stack.sh @@ -0,0 +1 @@ +heat stack-create vMME -e vmme_small.env -f vmme_small.yml diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/missingYml/vmme_small_create_fsb.env b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/missingYml/vmme_small_create_fsb.env new file mode 100644 index 0000000000..750bb2dd44 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/missingYml/vmme_small_create_fsb.env @@ -0,0 +1,8 @@ +parameters: + volume_type: Gold + volume_size: 320 + FSB_1_image: MME_FSB1_15B-CP04-r5a01 + FSB_2_image: MME_FSB2_15B-CP04-r5a01 + FSB1_volume_name: vFSB1_1_Vol_1 + FSB2_volume_name: vFSB2_1_Vol_1 + diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/nimbus/HEAT.meta b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/nimbus/HEAT.meta new file mode 100644 index 0000000000..3981576218 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/nimbus/HEAT.meta @@ -0,0 +1,215 @@ +{ + "importStructure": [ + { + "HEAT": [ + { + "fileName": "hot-nimbus-oam_v1.0.yaml", + "env": "hot-nimbus-oam_v1.0.env", + "volume": [ + { + "fileName": "hot-nimbus-oam-volumes_v1.0.yaml", + "env": "hot-nimbus-oam-volumes_v1.0.env" + } + ], + "nested": [ + { + "fileName": "nested-oam_v1.0.yaml" + }, + { + "fileName": "nested-oam_v1.0.yaml" + } + ], + "artifacts": [ + { + "name": "mount_iso_script.sh", + "status": "OK" + }, + { + "name": "cloud-nimbus.sh", + "status": "OK" + }, + { + "name": "nimbus-ethernet", + "status": "OK" + }, + { + "name": "nimbus-ethernet-gw", + "status": "OK" + } + ] + }, + { + "fileName": "hot-nimbus-pps_v1.0.yaml", + "env": "hot-nimbus-pps_v1.0.env", + "nested": [ + { + "fileName": "nested-pps_v1.0.yaml" + }, + { + "fileName": "nested-pps_v1.0.yaml" + }, + { + "fileName": "nested-pps_v1.0.yaml" + }, + { + "fileName": "nested-pps_v1.0.yaml" + }, + { + "fileName": "nested-pps_v1.0.yaml" + }, + { + "fileName": "nested-pps_v1.0.yaml" + } + ], + "artifacts": [ + { + "name": "mount_iso_script.sh", + "status": "OK" + }, + { + "name": "cloud-nimbus.sh", + "status": "OK" + }, + { + "name": "nimbus-ethernet", + "status": "OK" + }, + { + "name": "nimbus-ethernet-gw", + "status": "OK" + } + ] + }, + { + "fileName": "hot-nimbus-psm_v1.0.yaml", + "env": "hot-nimbus-psm_v1.0.env", + "nested": [ + { + "fileName": "nested-psm_v1.0.yaml" + }, + { + "fileName": "nested-psm_v1.0.yaml" + }, + { + "fileName": "nested-psm_v1.0.yaml" + }, + { + "fileName": "nested-psm_v1.0.yaml" + }, + { + "fileName": "nested-psm_v1.0.yaml" + }, + { + "fileName": "nested-psm_v1.0.yaml" + }, + { + "fileName": "nested-psm_v1.0.yaml" + }, + { + "fileName": "nested-psm_v1.0.yaml" + }, + { + "fileName": "nested-psm_v1.0.yaml" + }, + { + "fileName": "nested-psm_v1.0.yaml" + }, + { + "fileName": "nested-psm_v1.0.yaml" + }, + { + "fileName": "nested-psm_v1.0.yaml" + } + ], + "artifacts": [ + { + "name": "mount_iso_script.sh", + "status": "OK" + }, + { + "name": "cloud-nimbus.sh", + "status": "OK" + }, + { + "name": "nimbus-ethernet", + "status": "OK" + }, + { + "name": "nimbus-ethernet-gw", + "status": "OK" + } + ] + }, + { + "fileName": "hot-nimbus-ppd_v1.0.yaml", + "env": "hot-nimbus-ppd_v1.1.env", + "nested": [ + { + "fileName": "nested-ppd_v1.0.yaml" + }, + { + "fileName": "nested-ppd_v1.0.yaml" + }, + { + "fileName": "nested-ppd_v1.0.yaml" + }, + { + "fileName": "nested-ppd_v1.0.yaml" + } + ], + "artifacts": [ + { + "name": "mount_iso_script.sh", + "status": "OK" + }, + { + "name": "cloud-nimbus.sh", + "status": "OK" + }, + { + "name": "nimbus-ethernet", + "status": "OK" + }, + { + "name": "nimbus-ethernet-gw", + "status": "OK" + } + ] + }, + { + "fileName": "hot-nimbus-pcm_v1.0.yaml", + "env": "hot-nimbus-pcm_v1.0.env", + "volume": [ + { + "fileName": "hot-nimbus-pcm-volumes_v1.0.yaml", + "env": "hot-nimbus-pcm-volumes_v1.0.env" + } + ], + "nested": [ + { + "fileName": "nested-pcm_v1.0.yaml" + } + ], + "artifacts": [ + { + "name": "mount_iso_script.sh", + "status": "OK" + }, + { + "name": "cloud-nimbus.sh", + "status": "OK" + }, + { + "name": "nimbus-ethernet", + "status": "OK" + }, + { + "name": "nimbus-ethernet-gw", + "status": "OK" + } + ] + } + ] + } + ] +}
\ No newline at end of file diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/nimbus/MANIFEST.json b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/nimbus/MANIFEST.json new file mode 100644 index 0000000000..d85265d118 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/nimbus/MANIFEST.json @@ -0,0 +1,113 @@ +{ + "name": "hot-mog", + "description": "HOT template to create hot mog server", + "version": "2013-05-23", + "data": [ + { + "file": "hot-nimbus-oam_v1.0.yaml", + "type": "HEAT", + "data": [ + { + "file": "hot-nimbus-oam_v1.0.env", + "type": "HEAT_ENV" + }, + { + "file": "hot-nimbus-oam-volumes_v1.0.yaml", + "type": "HEAT_VOL", + "data": [ + { + "file": "hot-nimbus-oam-volumes_v1.0.env", + "type": "HEAT_ENV" + } + ] + } + ] + }, + { + "file": "hot-nimbus-pcm_v1.0.yaml", + "type": "HEAT", + "data": [ + { + "file": "hot-nimbus-pcm_v1.0.env", + "type": "HEAT_ENV" + }, + { + "file": "hot-nimbus-pcm-volumes_v1.0.yaml", + "type": "HEAT_VOL", + "data": [ + { + "file": "hot-nimbus-pcm-volumes_v1.0.env", + "type": "HEAT_ENV" + } + ] + } + ] + }, + { + "file": "hot-nimbus-ppd_v1.0.yaml", + "type": "HEAT", + "data": [ + { + "file": "hot-nimbus-ppd_v1.1.env", + "type": "HEAT_ENV" + } + ] + }, + { + "file": "hot-nimbus-pps_v1.0.yaml", + "type": "HEAT", + "data": [ + { + "file": "hot-nimbus-pps_v1.0.env", + "type": "HEAT_ENV" + } + ] + }, + { + "file": "hot-nimbus-psm_v1.0.yaml", + "type": "HEAT", + "data": [ + { + "file": "hot-nimbus-psm_v1.0.env", + "type": "HEAT_ENV" + } + ] + }, + { + "file": "nested-oam_v1.0.yaml", + "type": "HEAT" + }, + { + "file": "nested-pcm_v1.0.yaml", + "type": "HEAT" + }, + { + "file": "nested-ppd_v1.0.yaml", + "type": "HEAT" + }, + { + "file": "nested-pps_v1.0.yaml", + "type": "HEAT" + }, + { + "file": "nested-psm_v1.0.yaml", + "type": "HEAT" + }, + { + "file": "mount_iso_script.sh", + "type": "SHELL" + }, + { + "file": "cloud-nimbus.sh", + "type": "SHELL" + }, + { + "file": "nimbus-ethernet", + "type": "OTHER" + }, + { + "file": "nimbus-ethernet-gw", + "type": "OTHER" + } + ] +}
\ No newline at end of file diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/nimbus/cloud-nimbus.sh b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/nimbus/cloud-nimbus.sh new file mode 100644 index 0000000000..8e5a486289 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/nimbus/cloud-nimbus.sh @@ -0,0 +1,12 @@ +#!/bin/bash +echo "Running first-boot script" +FLAG="first-boot.sh" +echo "First boot run" > ${FLAG} +echo "$vm_name" >> ${FLAG} +touch /var/lib/cloud/instance/payload/launch-params +chmod 644 /var/lib/cloud/instance/payload/launch-params +#for i in $(ls /sys/class/net); do +# echo "Restart $i" >> ${FLAG} +# ifdown ${i} +# ifup ${i} +#done diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/nimbus/hot-nimbus-oam-volumes_v1.0.env b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/nimbus/hot-nimbus-oam-volumes_v1.0.env new file mode 100644 index 0000000000..b494d8c270 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/nimbus/hot-nimbus-oam-volumes_v1.0.env @@ -0,0 +1,6 @@ +parameters: + pcrf_oam_vol_size: 500 + pcrf_oam_volume_silver-1: Silver + pcrf_oam_volume_silver-2: Silver + pcrf_oam_vol_name_1: sde1-pcrfx01-oam001-vol-1 + pcrf_oam_vol_name_2: sde1-pcrfx01-oam001-vol-2
\ No newline at end of file diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/nimbus/hot-nimbus-oam-volumes_v1.0.yaml b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/nimbus/hot-nimbus-oam-volumes_v1.0.yaml new file mode 100644 index 0000000000..9e120547b4 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/nimbus/hot-nimbus-oam-volumes_v1.0.yaml @@ -0,0 +1,45 @@ +heat_template_version: 2013-05-23 + +parameters: + pcrf_oam_vol_size: + type: number + label: Cinder volume size + description: the size of the Cinder volume + pcrf_oam_vol_name_1: + type: string + label: OAM volume name 1 + description: Assigning name to volume + pcrf_oam_vol_name_2: + type: string + label: OAM volume name 2 + description: Assigning name to volume + pcrf_oam_volume_silver-1: + type: string + label: vm volume type + description: the name of the target volume backend for OAM1 + pcrf_oam_volume_silver-2: + type: string + label: vm volume type + description: the name of the target volume backend for OAM2 + +resources: + pcrf_oam_volume_1: + type: OS::Cinder::Volume + properties: + size: {get_param: pcrf_oam_vol_size} + volume_type: {get_param: pcrf_oam_volume_silver-1} + name: {get_param: pcrf_oam_vol_name_1} + + pcrf_oam_volume_2: + type: OS::Cinder::Volume + properties: + size: {get_param: pcrf_oam_vol_size} + volume_type: {get_param: pcrf_oam_volume_silver-2} + name: {get_param: pcrf_oam_vol_name_2} +outputs: + pcrf_oam_volume_id_1: + description: the oam 001 volume id + value: { get_resource: pcrf_oam_volume_1 } + pcrf_oam_volume_id_2: + description: the oam 002 volume id + value: { get_resource: pcrf_oam_volume_2 }
\ No newline at end of file diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/nimbus/hot-nimbus-oam_v1.0.env b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/nimbus/hot-nimbus-oam_v1.0.env new file mode 100644 index 0000000000..138feb5822 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/nimbus/hot-nimbus-oam_v1.0.env @@ -0,0 +1,18 @@ +parameters: + pcrf_oam_server_names: ZRDM1PCRF01OAM001,ZRDM1PCRF01OAM002 + pcrf_oam_image_name: PCRF_8.995-ATTM1.0.3.qcow2 + pcrf_oam_flavor_name: lc.4xlarge4 + availabilityzone_name: nova + pcrf_cps_net_name: Mobisupport-25193-I-INT1_int_pcrf_net_0 + pcrf_cps_net_ips: 172.26.16.111,172.26.16.112 + pcrf_arbiter_vip: 172.26.16.115 + pcrf_cps_net_mask: 255.255.255.0 + pcrf_oam_net_name: MNS-25180-L-01_oam_protected_net_0 + pcrf_oam_net_ips: 107.239.64.117,107.239.64.118 + pcrf_oam_net_gw: 107.239.64.1 + pcrf_oam_net_mask: 255.255.248.0 + pcrf_oam_volume_id_1: a4aa05fb-fcdc-457b-8077-6845fdfc3257 + pcrf_oam_volume_id_2: 93d8fc1f-f1c3-4933-86b2-039881ee910f + pcrf_security_group_name: nimbus_security_group + pcrf_vnf_id: 730797234b4a40aa99335157b02871cd + diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/nimbus/hot-nimbus-oam_v1.0.yaml b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/nimbus/hot-nimbus-oam_v1.0.yaml new file mode 100644 index 0000000000..2aa1235de2 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/nimbus/hot-nimbus-oam_v1.0.yaml @@ -0,0 +1,109 @@ +heat_template_version: 2013-05-23 + +description: heat template that creates multiple PCRF OAM nodes stack + +parameters: + pcrf_oam_server_names: + type: comma_delimited_list + label: PCRF OAM server names + description: name of the PCRF OAM instance + pcrf_oam_image_name: + type: string + label: PCRF OAM image name + description: PCRF OAM image name + pcrf_oam_flavor_name: + type: string + label: PCRF OAM flavor name + description: flavor name of PCRF OAM instance + availabilityzone_name: + type: string + label: availabilityzone name + description: availabilityzone name + pcrf_cps_net_name: + type: string + label: CPS network name + description: CPS network name + pcrf_cps_net_ips: + type: comma_delimited_list + label: CPS network ips + description: CPS network ips + pcrf_cps_net_mask: + type: string + label: CPS network mask + description: CPS network mask + pcrf_arbiter_vip: + type: string + label: OAM Arbiter LB VIP + description: OAM Arbiter LB VIP + pcrf_oam_net_name: + type: string + label: OAM network name + description: OAM network name + pcrf_oam_net_ips: + type: comma_delimited_list + label: OAM network ips + description: OAM network ips + pcrf_oam_net_gw: + type: string + label: CPS network gateway + description: CPS network gateway + pcrf_oam_net_mask: + type: string + label: CPS network mask + description: CPS network mask + pcrf_oam_volume_id_1: + type: string + label: CPS OAM 001 Cinder Volume + description: CPS OAM 001 Cinder Volumes + pcrf_oam_volume_id_2: + type: string + label: CPS OAM 002 Cinder Volume + description: CPS OAM 002 Cinder Volumes + pcrf_security_group_name: + type: string + label: security group name + description: the name of security group + pcrf_vnf_id: + type: string + label: PCRF VNF Id + description: PCRF VNF Id + +resources: + server_pcrf_oam_001: + type: nested-oam_v1.0.yaml + properties: + pcrf_oam_server_name: { get_param: [pcrf_oam_server_names, 0] } + pcrf_oam_image_name: { get_param: pcrf_oam_image_name } + pcrf_oam_flavor_name: { get_param: pcrf_oam_flavor_name } + availabilityzone_name: { get_param: availabilityzone_name } + pcrf_security_group_name: { get_param: pcrf_security_group_name } + pcrf_oam_volume_id: { get_param: pcrf_oam_volume_id_1 } + pcrf_cps_net_name: { get_param: pcrf_cps_net_name } + pcrf_cps_net_ip: { get_param: [pcrf_cps_net_ips, 0] } + pcrf_cps_net_mask: { get_param: pcrf_cps_net_mask } + pcrf_oam_net_name: { get_param: pcrf_oam_net_name } + pcrf_oam_net_ip: { get_param: [pcrf_oam_net_ips, 0] } + pcrf_oam_net_mask: { get_param: pcrf_oam_net_mask } + pcrf_oam_net_gw: { get_param: pcrf_oam_net_gw } + pcrf_arbiter_vip: { get_param: pcrf_arbiter_vip } + pcrf_vnf_id: {get_param: pcrf_vnf_id} + + server_pcrf_oam_002: + type: nested-oam_v1.0.yaml + depends_on: [server_pcrf_oam_001] + properties: + pcrf_oam_server_name: { get_param: [pcrf_oam_server_names, 1] } + pcrf_oam_image_name: { get_param: pcrf_oam_image_name } + pcrf_oam_flavor_name: { get_param: pcrf_oam_flavor_name } + availabilityzone_name: { get_param: availabilityzone_name } + pcrf_security_group_name: { get_param: pcrf_security_group_name } + pcrf_oam_volume_id: { get_param: pcrf_oam_volume_id_2 } + pcrf_cps_net_name: { get_param: pcrf_cps_net_name } + pcrf_cps_net_ip: { get_param: [pcrf_cps_net_ips, 1] } + pcrf_cps_net_mask: { get_param: pcrf_cps_net_mask } + pcrf_oam_net_name: { get_param: pcrf_oam_net_name } + pcrf_oam_net_ip: { get_param: [pcrf_oam_net_ips, 1] } + pcrf_oam_net_mask: { get_param: pcrf_oam_net_mask } + pcrf_oam_net_gw: { get_param: pcrf_oam_net_gw } + pcrf_arbiter_vip: { get_param: pcrf_arbiter_vip } + pcrf_vnf_id: {get_param: pcrf_vnf_id} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/nimbus/hot-nimbus-pcm-volumes_v1.0.env b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/nimbus/hot-nimbus-pcm-volumes_v1.0.env new file mode 100644 index 0000000000..788365dcd3 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/nimbus/hot-nimbus-pcm-volumes_v1.0.env @@ -0,0 +1,4 @@ +parameters: + pcrf_pcm_vol_size: 50 + pcrf_pcm_volume_silver: Silver + pcrf_pcm_vol_name_1: sde1-pcrfx01-pcm001-vol-1 diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/nimbus/hot-nimbus-pcm-volumes_v1.0.yaml b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/nimbus/hot-nimbus-pcm-volumes_v1.0.yaml new file mode 100644 index 0000000000..bcc3e89f71 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/nimbus/hot-nimbus-pcm-volumes_v1.0.yaml @@ -0,0 +1,28 @@ +heat_template_version: 2013-05-23 + +parameters: + pcrf_pcm_vol_size: + type: number + label: Cinder volume size + description: the size of the Cinder volume + pcrf_pcm_vol_name_1: + type: string + label: PCM volume name + description: Assigning name to volume + pcrf_pcm_volume_silver: + type: string + label: vm volume type + description: the name of the target volume backend for PCM + +resources: + pcrf_pcm_volume_1: + type: OS::Cinder::Volume + properties: + size: { get_param: pcrf_pcm_vol_size } + volume_type: { get_param: pcrf_pcm_volume_silver } + name: { get_param: pcrf_pcm_vol_name_1 } + +outputs: + pcrf_pcm_volume_id_1: + description: the pcrf_pcm_volume_id + value: { get_resource: pcrf_pcm_volume_1 }
\ No newline at end of file diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/nimbus/hot-nimbus-pcm_v1.0.env b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/nimbus/hot-nimbus-pcm_v1.0.env new file mode 100644 index 0000000000..82fb510291 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/nimbus/hot-nimbus-pcm_v1.0.env @@ -0,0 +1,16 @@ +parameters: + pcrf_pcm_server_names: ZRDM1PCRF01PCM001 + pcrf_pcm_image_name: PCRF_8.995-ATTM1.0.3.qcow2 + pcrf_pcm_flavor_name: lc.2xlarge4 + availabilityzone_name: nova + pcrf_cps_net_name: Mobisupport-25193-I-INT1_int_pcrf_net_0 + pcrf_cps_net_ips: 172.26.16.113 + pcrf_cps_net_mask: 255.255.255.0 + pcrf_oam_net_name: MNS-25180-L-01_oam_protected_net_0 + pcrf_oam_net_ips: 107.239.64.121 + pcrf_oam_net_gw: 107.239.64.1 + pcrf_oam_net_mask: 255.255.248.0 + pcrf_pcm_volume_id_1: 3438a3fe-1241-4390-80f2-d0b86238c40e + pcrf_security_group_name: nimbus_security_group + pcrf_vnf_id: 730797234b4a40aa99335157b02871cd + diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/nimbus/hot-nimbus-pcm_v1.0.yaml b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/nimbus/hot-nimbus-pcm_v1.0.yaml new file mode 100644 index 0000000000..2dd7480bfc --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/nimbus/hot-nimbus-pcm_v1.0.yaml @@ -0,0 +1,80 @@ +heat_template_version: 2013-05-23 + +description: heat template that creates PCRF Cluman stack + +parameters: + pcrf_pcm_server_names: + type: comma_delimited_list + label: PCRF CM server names + description: name of the PCRF CM instance + pcrf_pcm_image_name: + type: string + label: PCRF CM image name + description: PCRF CM image name + pcrf_pcm_flavor_name: + type: string + label: PCRF CM flavor name + description: flavor name of PCRF CM instance + availabilityzone_name: + type: string + label: availabilityzone name + description: availabilityzone name + pcrf_cps_net_name: + type: string + label: CPS network name + description: CPS network name + pcrf_cps_net_ips: + type: comma_delimited_list + label: CPS network ips + description: CPS network ips + pcrf_cps_net_mask: + type: string + label: CPS network mask + description: CPS network mask + pcrf_oam_net_name: + type: string + label: OAM network name + description: OAM network name + pcrf_oam_net_ips: + type: comma_delimited_list + label: OAM network ips + description: OAM network ips + pcrf_oam_net_gw: + type: string + label: CPS network gateway + description: CPS network gateway + pcrf_oam_net_mask: + type: string + label: CPS network mask + description: CPS network mask + pcrf_pcm_volume_id_1: + type: string + label: CPS Cluman Cinder Volume + description: CPS Cluman Cinder Volume + pcrf_security_group_name: + type: string + label: security group name + description: the name of security group + pcrf_vnf_id: + type: string + label: PCRF VNF Id + description: PCRF VNF Id + +resources: + server_pcrf_pcm_001: + type: nested-pcm_v1.0.yaml + properties: + pcrf_pcm_server_name: { get_param: [pcrf_pcm_server_names, 0] } + pcrf_pcm_image_name: { get_param: pcrf_pcm_image_name } + pcrf_pcm_flavor_name: { get_param: pcrf_pcm_flavor_name } + availabilityzone_name: { get_param: availabilityzone_name } + pcrf_security_group_name: { get_param: pcrf_security_group_name } + pcrf_pcm_volume_id: { get_param: pcrf_pcm_volume_id_1 } + pcrf_cps_net_name: { get_param: pcrf_cps_net_name } + pcrf_cps_net_ip: { get_param: [pcrf_cps_net_ips, 0] } + pcrf_cps_net_mask: { get_param: pcrf_cps_net_mask } + pcrf_oam_net_name: { get_param: pcrf_oam_net_name } + pcrf_oam_net_ip: { get_param: [pcrf_oam_net_ips, 0] } + pcrf_oam_net_mask: { get_param: pcrf_oam_net_mask } + pcrf_oam_net_gw: { get_param: pcrf_oam_net_gw } + pcrf_vnf_id: {get_param: pcrf_vnf_id} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/nimbus/hot-nimbus-ppd_v1.0.yaml b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/nimbus/hot-nimbus-ppd_v1.0.yaml new file mode 100644 index 0000000000..2fffa0df8c --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/nimbus/hot-nimbus-ppd_v1.0.yaml @@ -0,0 +1,286 @@ +heat_template_version: 2013-05-23 + +description: heat template that creates PCRF Policy Director stack + +parameters: + pcrf_ppd_server_names: + type: comma_delimited_list + label: PCRF PD server names + description: name of the PCRF PD instance + pcrf_ppd_image_name: + type: string + label: PCRF PD image name + description: PCRF PD image name + pcrf_ppd_flavor_name: + type: string + label: PCRF PD flavor name + description: flavor name of PCRF PD instance + availabilityzone_name: + type: string + label: availabilityzone name + description: availabilityzone name + pcrf_cps_net_name: + type: string + label: CPS network name + description: CPS network name + pcrf_cps_net_ips: + type: comma_delimited_list + label: CPS network ips + description: CPS network ips + pcrf_cps_net_mask: + type: string + label: CPS network mask + description: CPS network mask + pcrf_lb_internal_vip: + type: string + label: CPS Internal LB VIP + description: CPS Internal LB VIP + pcrf_oam_net_name: + type: string + label: OAM network name + description: OAM network name + pcrf_oam_net_ips: + type: comma_delimited_list + label: OAM network ips + description: OAM network ips + pcrf_oam_net_gw: + type: string + label: CPS network gateway + description: CPS network gateway + pcrf_oam_net_mask: + type: string + label: CPS network mask + description: CPS network mask + pcrf_lb_management_vip: + type: string + label: CPS OAM LB VIP + description: CPS OAM LB VIP + pcrf_gx_net_name: + type: string + label: Gx network name + description: Gx network name + pcrf_gx_net_ips: + type: comma_delimited_list + label: Gx network ips + description: Gx network ips + pcrf_gx_net_mask: + type: string + label: Gx network mask + description: Gx network mask + pcrf_sp_net_name: + type: string + label: Sp network name + description: Sp network name + pcrf_sp_net_ips: + type: comma_delimited_list + label: Sp network ips + description: Sp network ips + pcrf_sp_net_mask: + type: string + label: Sp network mask + description: Sp network mask + pcrf_sy_net_name: + type: string + label: Sy network name + description: Sy network name + pcrf_sy_net_ips: + type: comma_delimited_list + label: Sy network ips + description: Sy network ips + pcrf_sy_net_mask: + type: string + label: Sy network mask + description: Sy network mask + pcrf_rx_net_name: + type: string + label: Rx network name + description: Rx network name + pcrf_rx_net_ips: + type: comma_delimited_list + label: Rx network ips + description: Rx network ips + pcrf_rx_net_mask: + type: string + label: Rx network mask + description: Rx network mask + pcrf_sd_net_name: + type: string + label: Sd network name + description: Sd network name + pcrf_sd_net_ips: + type: comma_delimited_list + label: Sd network ips + description: Sd network ips + pcrf_sd_net_mask: + type: string + label: Sd network mask + description: Sd network mask + pcrf_sgi_sy_net_name: + type: string + label: Sgi Sy network name + description: Sgi Sy network name + pcrf_sgi_sy_net_ips: + type: comma_delimited_list + label: Sgi Sy network ips + description: Sgi Sy network ips + pcrf_sgi_sy_net_mask: + type: string + label: Sgi Sy network mask + description: Sgi Sy network mask + pcrf_security_group_name: + type: string + label: security group name + description: the name of security group + pcrf_vnf_id: + type: string + label: PCRF VNF Id + description: PCRF VNF Id + +resources: + server_pcrf_ppd_001: + type: nested-ppd_v1.0.yaml + properties: + pcrf_ppd_server_name: { get_param: [pcrf_ppd_server_names, 0] } + pcrf_ppd_image_name: { get_param: pcrf_ppd_image_name } + pcrf_ppd_flavor_name: { get_param: pcrf_ppd_flavor_name } + availabilityzone_name: { get_param: availabilityzone_name } + pcrf_security_group_name: { get_param: pcrf_security_group_name } + pcrf_cps_net_name: { get_param: pcrf_cps_net_name } + pcrf_cps_net_ip: { get_param: [pcrf_cps_net_ips, 0] } + pcrf_cps_net_mask: { get_param: pcrf_cps_net_mask } + pcrf_lb_internal_vip: { get_param: pcrf_lb_internal_vip } + pcrf_oam_net_name: { get_param: pcrf_oam_net_name } + pcrf_oam_net_ip: { get_param: [pcrf_oam_net_ips, 0] } + pcrf_oam_net_mask: { get_param: pcrf_oam_net_mask } + pcrf_oam_net_gw: { get_param: pcrf_oam_net_gw } + pcrf_lb_management_vip: { get_param: pcrf_lb_management_vip } + pcrf_gx_net_name: { get_param: pcrf_gx_net_name } + pcrf_gx_net_ip: { get_param: [pcrf_gx_net_ips, 0] } + pcrf_gx_net_mask: { get_param: pcrf_gx_net_mask } + pcrf_sp_net_name: { get_param: pcrf_sp_net_name } + pcrf_sp_net_ip: { get_param: [pcrf_sp_net_ips, 0] } + pcrf_sp_net_mask: { get_param: pcrf_sp_net_mask } + pcrf_sy_net_name: { get_param: pcrf_sy_net_name } + pcrf_sy_net_ip: { get_param: [pcrf_sy_net_ips, 0] } + pcrf_sy_net_mask: { get_param: pcrf_sy_net_mask } + pcrf_rx_net_name: { get_param: pcrf_rx_net_name } + pcrf_rx_net_ip: { get_param: [pcrf_rx_net_ips, 0] } + pcrf_rx_net_mask: { get_param: pcrf_rx_net_mask } + pcrf_sd_net_name: { get_param: pcrf_sd_net_name } + pcrf_sd_net_ip: { get_param: [pcrf_sd_net_ips, 0] } + pcrf_sd_net_mask: { get_param: pcrf_sd_net_mask } + pcrf_sgi_sy_net_name: { get_param: pcrf_sgi_sy_net_name } + pcrf_sgi_sy_net_ip: { get_param: [pcrf_sgi_sy_net_ips, 0] } + pcrf_sgi_sy_net_mask: { get_param: pcrf_sgi_sy_net_mask } + pcrf_vnf_id: {get_param: pcrf_vnf_id} + + server_pcrf_ppd_002: + type: nested-ppd_v1.0.yaml + properties: + pcrf_ppd_server_name: { get_param: [pcrf_ppd_server_names, 1] } + pcrf_ppd_image_name: { get_param: pcrf_ppd_image_name } + pcrf_ppd_flavor_name: { get_param: pcrf_ppd_flavor_name } + availabilityzone_name: { get_param: availabilityzone_name } + pcrf_security_group_name: { get_param: pcrf_security_group_name } + pcrf_cps_net_name: { get_param: pcrf_cps_net_name } + pcrf_cps_net_ip: { get_param: [pcrf_cps_net_ips, 1] } + pcrf_cps_net_mask: { get_param: pcrf_cps_net_mask } + pcrf_lb_internal_vip: { get_param: pcrf_lb_internal_vip } + pcrf_oam_net_name: { get_param: pcrf_oam_net_name } + pcrf_oam_net_ip: { get_param: [pcrf_oam_net_ips, 1] } + pcrf_oam_net_mask: { get_param: pcrf_oam_net_mask } + pcrf_oam_net_gw: { get_param: pcrf_oam_net_gw } + pcrf_lb_management_vip: { get_param: pcrf_lb_management_vip } + pcrf_gx_net_name: { get_param: pcrf_gx_net_name } + pcrf_gx_net_ip: { get_param: [pcrf_gx_net_ips, 1] } + pcrf_gx_net_mask: { get_param: pcrf_gx_net_mask } + pcrf_sp_net_name: { get_param: pcrf_sp_net_name } + pcrf_sp_net_ip: { get_param: [pcrf_sp_net_ips, 1] } + pcrf_sp_net_mask: { get_param: pcrf_sp_net_mask } + pcrf_sy_net_name: { get_param: pcrf_sy_net_name } + pcrf_sy_net_ip: { get_param: [pcrf_sy_net_ips, 1] } + pcrf_sy_net_mask: { get_param: pcrf_sy_net_mask } + pcrf_rx_net_name: { get_param: pcrf_rx_net_name } + pcrf_rx_net_ip: { get_param: [pcrf_rx_net_ips, 1] } + pcrf_rx_net_mask: { get_param: pcrf_rx_net_mask } + pcrf_sd_net_name: { get_param: pcrf_sd_net_name } + pcrf_sd_net_ip: { get_param: [pcrf_sd_net_ips, 1] } + pcrf_sd_net_mask: { get_param: pcrf_sd_net_mask } + pcrf_sgi_sy_net_name: { get_param: pcrf_sgi_sy_net_name } + pcrf_sgi_sy_net_ip: { get_param: [pcrf_sgi_sy_net_ips, 1] } + pcrf_sgi_sy_net_mask: { get_param: pcrf_sgi_sy_net_mask } + pcrf_vnf_id: {get_param: pcrf_vnf_id} + + server_pcrf_ppd_003: + type: nested-ppd_v1.0.yaml + properties: + pcrf_ppd_server_name: { get_param: [pcrf_ppd_server_names, 2] } + pcrf_ppd_image_name: { get_param: pcrf_ppd_image_name } + pcrf_ppd_flavor_name: { get_param: pcrf_ppd_flavor_name } + availabilityzone_name: { get_param: availabilityzone_name } + pcrf_security_group_name: { get_param: pcrf_security_group_name } + pcrf_cps_net_name: { get_param: pcrf_cps_net_name } + pcrf_cps_net_ip: { get_param: [pcrf_cps_net_ips, 2] } + pcrf_cps_net_mask: { get_param: pcrf_cps_net_mask } + pcrf_lb_internal_vip: { get_param: pcrf_lb_internal_vip } + pcrf_oam_net_name: { get_param: pcrf_oam_net_name } + pcrf_oam_net_ip: { get_param: [pcrf_oam_net_ips, 2] } + pcrf_oam_net_mask: { get_param: pcrf_oam_net_mask } + pcrf_oam_net_gw: { get_param: pcrf_oam_net_gw } + pcrf_lb_management_vip: { get_param: pcrf_lb_management_vip } + pcrf_gx_net_name: { get_param: pcrf_gx_net_name } + pcrf_gx_net_ip: { get_param: [pcrf_gx_net_ips, 2] } + pcrf_gx_net_mask: { get_param: pcrf_gx_net_mask } + pcrf_sp_net_name: { get_param: pcrf_sp_net_name } + pcrf_sp_net_ip: { get_param: [pcrf_sp_net_ips, 2] } + pcrf_sp_net_mask: { get_param: pcrf_sp_net_mask } + pcrf_sy_net_name: { get_param: pcrf_sy_net_name } + pcrf_sy_net_ip: { get_param: [pcrf_sy_net_ips, 2] } + pcrf_sy_net_mask: { get_param: pcrf_sy_net_mask } + pcrf_rx_net_name: { get_param: pcrf_rx_net_name } + pcrf_rx_net_ip: { get_param: [pcrf_rx_net_ips, 2] } + pcrf_rx_net_mask: { get_param: pcrf_rx_net_mask } + pcrf_sd_net_name: { get_param: pcrf_sd_net_name } + pcrf_sd_net_ip: { get_param: [pcrf_sd_net_ips, 2] } + pcrf_sd_net_mask: { get_param: pcrf_sd_net_mask } + pcrf_sgi_sy_net_name: { get_param: pcrf_sgi_sy_net_name } + pcrf_sgi_sy_net_ip: { get_param: [pcrf_sgi_sy_net_ips, 2] } + pcrf_sgi_sy_net_mask: { get_param: pcrf_sgi_sy_net_mask } + pcrf_vnf_id: {get_param: pcrf_vnf_id} + + server_pcrf_ppd_004: + type: nested-ppd_v1.0.yaml + properties: + pcrf_ppd_server_name: { get_param: [pcrf_ppd_server_names, 3] } + pcrf_ppd_image_name: { get_param: pcrf_ppd_image_name } + pcrf_ppd_flavor_name: { get_param: pcrf_ppd_flavor_name } + availabilityzone_name: { get_param: availabilityzone_name } + pcrf_security_group_name: { get_param: pcrf_security_group_name } + pcrf_cps_net_name: { get_param: pcrf_cps_net_name } + pcrf_cps_net_ip: { get_param: [pcrf_cps_net_ips, 3] } + pcrf_cps_net_mask: { get_param: pcrf_cps_net_mask } + pcrf_lb_internal_vip: { get_param: pcrf_lb_internal_vip } + pcrf_oam_net_name: { get_param: pcrf_oam_net_name } + pcrf_oam_net_ip: { get_param: [pcrf_oam_net_ips, 3] } + pcrf_oam_net_mask: { get_param: pcrf_oam_net_mask } + pcrf_oam_net_gw: { get_param: pcrf_oam_net_gw } + pcrf_lb_management_vip: { get_param: pcrf_lb_management_vip } + pcrf_gx_net_name: { get_param: pcrf_gx_net_name } + pcrf_gx_net_ip: { get_param: [pcrf_gx_net_ips, 3] } + pcrf_gx_net_mask: { get_param: pcrf_gx_net_mask } + pcrf_sp_net_name: { get_param: pcrf_sp_net_name } + pcrf_sp_net_ip: { get_param: [pcrf_sp_net_ips, 3] } + pcrf_sp_net_mask: { get_param: pcrf_sp_net_mask } + pcrf_sy_net_name: { get_param: pcrf_sy_net_name } + pcrf_sy_net_ip: { get_param: [pcrf_sy_net_ips, 3] } + pcrf_sy_net_mask: { get_param: pcrf_sy_net_mask } + pcrf_rx_net_name: { get_param: pcrf_rx_net_name } + pcrf_rx_net_ip: { get_param: [pcrf_rx_net_ips, 3] } + pcrf_rx_net_mask: { get_param: pcrf_rx_net_mask } + pcrf_sd_net_name: { get_param: pcrf_sd_net_name } + pcrf_sd_net_ip: { get_param: [pcrf_sd_net_ips, 3] } + pcrf_sd_net_mask: { get_param: pcrf_sd_net_mask } + pcrf_sgi_sy_net_name: { get_param: pcrf_sgi_sy_net_name } + pcrf_sgi_sy_net_ip: { get_param: [pcrf_sgi_sy_net_ips, 3] } + pcrf_sgi_sy_net_mask: { get_param: pcrf_sgi_sy_net_mask } + pcrf_vnf_id: {get_param: pcrf_vnf_id} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/nimbus/hot-nimbus-ppd_v1.1.env b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/nimbus/hot-nimbus-ppd_v1.1.env new file mode 100644 index 0000000000..bb6dfe468c --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/nimbus/hot-nimbus-ppd_v1.1.env @@ -0,0 +1,35 @@ +parameters: + pcrf_ppd_server_names: ZRDM1PCRF01PPD001,ZRDM1PCRF01PPD002,ZRDM1PCRF01PPD003,ZRDM1PCRF01PPD004 + pcrf_ppd_image_name: PCRF_8.995-ATTM1.0.3.qcow2 + pcrf_ppd_flavor_name: lc.4xlarge4 + availabilityzone_name: nova + pcrf_cps_net_name: Mobisupport-25193-I-INT1_int_pcrf_net_0 + pcrf_cps_net_ips: 172.26.16.3,172.26.16.4,172.26.16.5,172.26.16.6 + pcrf_lb_internal_vip: 172.26.16.114 + pcrf_cps_net_mask: 255.255.255.0 + pcrf_oam_net_name: MNS-25180-L-01_oam_protected_net_0 + pcrf_oam_net_ips: 107.239.64.113,107.239.64.114,107.239.64.115,107.239.64.116 + pcrf_lb_management_vip: 107.239.64.123 + pcrf_oam_net_gw: 107.239.64.1 + pcrf_oam_net_mask: 255.255.248.0 + pcrf_gx_net_name: Mobisupport-25193-I-INT1_cor_pcrf_gx_net_0 + pcrf_gx_net_ips: 107.239.24.67,107.239.24.68,107.239.24.69,107.239.24.70 + pcrf_gx_net_mask: 255.255.255.248 + pcrf_sp_net_name: Mobisupport-25193-I-INT1_cor_pcrf_sp_net_0 + pcrf_sp_net_ips: 107.239.24.75,107.239.24.76,107.239.24.77,107.239.24.78 + pcrf_sp_net_mask: 255.255.255.248 + pcrf_sy_net_name: Mobisupport-25193-I-INT1_cor_pcrf_sy_net_0 + pcrf_sy_net_ips: 107.239.24.83,107.239.24.84,107.239.24.85,107.239.24.86 + pcrf_sy_net_mask: 255.255.255.248 + pcrf_rx_net_name: Mobisupport-25193-I-INT1_cor_pcrf_rx_net_0 + pcrf_rx_net_ips: 107.239.24.91,107.239.24.92,107.239.24.93,107.239.24.94 + pcrf_rx_net_mask: 255.255.255.248 + pcrf_sd_net_name: Mobisupport-25193-I-INT1_cor_pcrf_sd_net_0 + pcrf_sd_net_ips: 107.239.24.99,107.239.24.100,107.239.24.101,107.239.24.102 + pcrf_sd_net_mask: 255.255.255.248 + pcrf_sgi_sy_net_name: Mobisupport-25193-I-INT1_sgi_pcrf_sy_net_0 + pcrf_sgi_sy_net_ips: 107.239.26.131,107.239.26.132,107.239.26.133,107.239.26.134 + pcrf_sgi_sy_net_mask: 255.255.255.248 + pcrf_security_group_name: nimbus_security_group + pcrf_vnf_id: 730797234b4a40aa99335157b02871cd + diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/nimbus/hot-nimbus-pps_v1.0.env b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/nimbus/hot-nimbus-pps_v1.0.env new file mode 100644 index 0000000000..340be2b815 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/nimbus/hot-nimbus-pps_v1.0.env @@ -0,0 +1,11 @@ +parameters: + pcrf_pps_server_names: ZRDM1PCRF01PPS001,ZRDM1PCRF01PPS002,ZRDM1PCRF01PPS003,ZRDM1PCRF01PPS004,ZRDM1PCRF01PPS005,ZRDM1PCRF01PPS006 + pcrf_pps_image_name: PCRF_8.995-ATTM1.0.3.qcow2 + pcrf_pps_flavor_name: lc.3xlarge + availabilityzone_name: nova + pcrf_cps_net_name: Mobisupport-25193-I-INT1_int_pcrf_net_0 + pcrf_cps_net_ips: 172.26.16.7,172.26.16.8,172.26.16.9,172.26.16.10,172.26.16.11,172.26.16.12 + pcrf_cps_net_mask: 255.255.255.0 + pcrf_security_group_name: nimbus_security_group + pcrf_vnf_id: 730797234b4a40aa99335157b02871cd + diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/nimbus/hot-nimbus-pps_v1.0.yaml b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/nimbus/hot-nimbus-pps_v1.0.yaml new file mode 100644 index 0000000000..05bd6c9318 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/nimbus/hot-nimbus-pps_v1.0.yaml @@ -0,0 +1,121 @@ +heat_template_version: 2013-05-23 + +description: heat template that creates PCRF Policy Server stack + +parameters: + pcrf_pps_server_names: + type: comma_delimited_list + label: PCRF PS server names + description: PCRF PS server names + pcrf_pps_image_name: + type: string + label: PCRF PS image name + description: PCRF PS image name + pcrf_pps_flavor_name: + type: string + label: PCRF PS flavor name + description: flavor name of PCRF PS instance + availabilityzone_name: + type: string + label: availabilityzone name + description: availabilityzone name + pcrf_cps_net_name: + type: string + label: CPS network name + description: CPS network name + pcrf_cps_net_ips: + type: comma_delimited_list + label: CPS network ips + description: CPS network ips + pcrf_cps_net_mask: + type: string + label: CPS network mask + description: CPS network mask + pcrf_security_group_name: + type: string + label: security group name + description: the name of security group + pcrf_vnf_id: + type: string + label: PCRF VNF Id + description: PCRF VNF Id + +resources: + server_pcrf_pps_001: + type: nested-pps_v1.0.yaml + properties: + pcrf_pps_server_name: { get_param: [pcrf_pps_server_names, 0] } + pcrf_pps_image_name: { get_param: pcrf_pps_image_name } + pcrf_pps_flavor_name: { get_param: pcrf_pps_flavor_name } + availabilityzone_name: { get_param: availabilityzone_name } + pcrf_security_group_name: { get_param: pcrf_security_group_name } + pcrf_cps_net_name: { get_param: pcrf_cps_net_name } + pcrf_cps_net_ip: { get_param: [pcrf_cps_net_ips, 0] } + pcrf_cps_net_mask: { get_param: pcrf_cps_net_mask } + pcrf_vnf_id: {get_param: pcrf_vnf_id} + + server_pcrf_pps_002: + type: nested-pps_v1.0.yaml + properties: + pcrf_pps_server_name: { get_param: [pcrf_pps_server_names, 1] } + pcrf_pps_image_name: { get_param: pcrf_pps_image_name } + pcrf_pps_flavor_name: { get_param: pcrf_pps_flavor_name } + availabilityzone_name: { get_param: availabilityzone_name } + pcrf_security_group_name: { get_param: pcrf_security_group_name } + pcrf_cps_net_name: { get_param: pcrf_cps_net_name } + pcrf_cps_net_ip: { get_param: [pcrf_cps_net_ips, 1] } + pcrf_cps_net_mask: { get_param: pcrf_cps_net_mask } + pcrf_vnf_id: {get_param: pcrf_vnf_id} + + server_pcrf_pps_003: + type: nested-pps_v1.0.yaml + properties: + pcrf_pps_server_name: { get_param: [pcrf_pps_server_names, 2] } + pcrf_pps_image_name: { get_param: pcrf_pps_image_name } + pcrf_pps_flavor_name: { get_param: pcrf_pps_flavor_name } + availabilityzone_name: { get_param: availabilityzone_name } + pcrf_security_group_name: { get_param: pcrf_security_group_name } + pcrf_cps_net_name: { get_param: pcrf_cps_net_name } + pcrf_cps_net_ip: { get_param: [pcrf_cps_net_ips, 2] } + pcrf_cps_net_mask: { get_param: pcrf_cps_net_mask } + pcrf_vnf_id: {get_param: pcrf_vnf_id} + + server_pcrf_pps_004: + type: nested-pps_v1.0.yaml + properties: + pcrf_pps_server_name: { get_param: [pcrf_pps_server_names, 3] } + pcrf_pps_image_name: { get_param: pcrf_pps_image_name } + pcrf_pps_flavor_name: { get_param: pcrf_pps_flavor_name } + availabilityzone_name: { get_param: availabilityzone_name } + pcrf_security_group_name: { get_param: pcrf_security_group_name } + pcrf_cps_net_name: { get_param: pcrf_cps_net_name } + pcrf_cps_net_ip: { get_param: [pcrf_cps_net_ips, 3] } + pcrf_cps_net_mask: { get_param: pcrf_cps_net_mask } + pcrf_vnf_id: {get_param: pcrf_vnf_id} + + server_pcrf_pps_005: + type: nested-pps_v1.0.yaml + properties: + pcrf_pps_server_name: { get_param: [pcrf_pps_server_names, 4] } + pcrf_pps_image_name: { get_param: pcrf_pps_image_name } + pcrf_pps_flavor_name: { get_param: pcrf_pps_flavor_name } + availabilityzone_name: { get_param: availabilityzone_name } + pcrf_security_group_name: { get_param: pcrf_security_group_name } + pcrf_cps_net_name: { get_param: pcrf_cps_net_name } + pcrf_cps_net_ip: { get_param: [pcrf_cps_net_ips, 4] } + pcrf_cps_net_mask: { get_param: pcrf_cps_net_mask } + pcrf_vnf_id: {get_param: pcrf_vnf_id} + + server_pcrf_pps_006: + type: nested-pps_v1.0.yaml + properties: + pcrf_pps_server_name: { get_param: [pcrf_pps_server_names, 5] } + pcrf_pps_image_name: { get_param: pcrf_pps_image_name } + pcrf_pps_flavor_name: { get_param: pcrf_pps_flavor_name } + availabilityzone_name: { get_param: availabilityzone_name } + pcrf_security_group_name: { get_param: pcrf_security_group_name } + pcrf_cps_net_name: { get_param: pcrf_cps_net_name } + pcrf_cps_net_ip: { get_param: [pcrf_cps_net_ips, 5] } + pcrf_cps_net_mask: { get_param: pcrf_cps_net_mask } + pcrf_vnf_id: {get_param: pcrf_vnf_id} + diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/nimbus/hot-nimbus-psm_v1.0.env b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/nimbus/hot-nimbus-psm_v1.0.env new file mode 100644 index 0000000000..f24e4763c6 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/nimbus/hot-nimbus-psm_v1.0.env @@ -0,0 +1,10 @@ +parameters: + pcrf_psm_server_names: ZRDM1PCRF01PSM001,ZRDM1PCRF01PSM002,ZRDM1PCRF01PSM003,ZRDM1PCRF01PSM004,ZRDM1PCRF01PSM005,ZRDM1PCRF01PSM006,ZRDM1PCRF01PSM007,ZRDM1PCRF01PSM008,ZRDM1PCRF01PSM009,ZRDM1PCRF01PSM010,ZRDM1PCRF01PSM011,ZRDM1PCRF01PSM012 + pcrf_psm_image_name: PCRF_8.995-ATTM1.0.3.qcow2 + pcrf_psm_flavor_name: lc.4xlarge4 + availabilityzone_name: nova + pcrf_cps_net_name: Mobisupport-25193-I-INT1_int_pcrf_net_0 + pcrf_cps_net_ips: 172.26.16.63,172.26.16.64,172.26.16.65,172.26.16.66,172.26.16.67,172.26.16.68,172.26.16.69,172.26.16.70,172.26.16.71,172.26.16.72,172.26.16.73,172.26.16.74 + pcrf_cps_net_mask: 255.255.255.0 + pcrf_security_group_name: nimbus_security_group + pcrf_vnf_id: 730797234b4a40aa99335157b02871cd diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/nimbus/hot-nimbus-psm_v1.0.yaml b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/nimbus/hot-nimbus-psm_v1.0.yaml new file mode 100644 index 0000000000..c2d7b05ead --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/nimbus/hot-nimbus-psm_v1.0.yaml @@ -0,0 +1,199 @@ +heat_template_version: 2013-05-23 + +description: heat template that creates PCRF Session Manager stack + +parameters: + pcrf_psm_server_names: + type: comma_delimited_list + label: PCRF SM server names + description: name of the PCRF SM instance + pcrf_psm_image_name: + type: string + label: PCRF SM image name + description: PCRF SM image name + pcrf_psm_flavor_name: + type: string + label: PCRF SM flavor name + description: flavor name of PCRF SM instance + availabilityzone_name: + type: string + label: availabilityzone name + description: availabilityzone name + pcrf_cps_net_name: + type: string + label: CPS network name + description: CPS network name + pcrf_cps_net_ips: + type: comma_delimited_list + label: CPS network ips + description: CPS network ips + pcrf_cps_net_mask: + type: string + label: CPS network mask + description: CPS network mask + pcrf_security_group_name: + type: string + label: security group name + description: the name of security group + pcrf_vnf_id: + type: string + label: PCRF VNF Id + description: PCRF VNF Id + +resources: + server_pcrf_psm_001: + type: nested-psm_v1.0.yaml + properties: + pcrf_psm_server_name: { get_param: [pcrf_psm_server_names, 0] } + pcrf_psm_image_name: { get_param: pcrf_psm_image_name } + pcrf_psm_flavor_name: { get_param: pcrf_psm_flavor_name } + availabilityzone_name: { get_param: availabilityzone_name } + pcrf_security_group_name: { get_param: pcrf_security_group_name } + pcrf_cps_net_name: { get_param: pcrf_cps_net_name } + pcrf_cps_net_ip: { get_param: [pcrf_cps_net_ips, 0] } + pcrf_cps_net_mask: { get_param: pcrf_cps_net_mask } + pcrf_vnf_id: {get_param: pcrf_vnf_id} + + server_pcrf_psm_002: + type: nested-psm_v1.0.yaml + properties: + pcrf_psm_server_name: { get_param: [pcrf_psm_server_names, 1] } + pcrf_psm_image_name: { get_param: pcrf_psm_image_name } + pcrf_psm_flavor_name: { get_param: pcrf_psm_flavor_name } + availabilityzone_name: { get_param: availabilityzone_name } + pcrf_security_group_name: { get_param: pcrf_security_group_name } + pcrf_cps_net_name: { get_param: pcrf_cps_net_name } + pcrf_cps_net_ip: { get_param: [pcrf_cps_net_ips, 1] } + pcrf_cps_net_mask: { get_param: pcrf_cps_net_mask } + pcrf_vnf_id: {get_param: pcrf_vnf_id} + + server_pcrf_psm_003: + type: nested-psm_v1.0.yaml + properties: + pcrf_psm_server_name: { get_param: [pcrf_psm_server_names, 2] } + pcrf_psm_image_name: { get_param: pcrf_psm_image_name } + pcrf_psm_flavor_name: { get_param: pcrf_psm_flavor_name } + availabilityzone_name: { get_param: availabilityzone_name } + pcrf_security_group_name: { get_param: pcrf_security_group_name } + pcrf_cps_net_name: { get_param: pcrf_cps_net_name } + pcrf_cps_net_ip: { get_param: [pcrf_cps_net_ips, 2] } + pcrf_cps_net_mask: { get_param: pcrf_cps_net_mask } + pcrf_vnf_id: {get_param: pcrf_vnf_id} + + server_pcrf_psm_004: + type: nested-psm_v1.0.yaml + properties: + pcrf_psm_server_name: { get_param: [pcrf_psm_server_names, 3] } + pcrf_psm_image_name: { get_param: pcrf_psm_image_name } + pcrf_psm_flavor_name: { get_param: pcrf_psm_flavor_name } + availabilityzone_name: { get_param: availabilityzone_name } + pcrf_security_group_name: { get_param: pcrf_security_group_name } + pcrf_cps_net_name: { get_param: pcrf_cps_net_name } + pcrf_cps_net_ip: { get_param: [pcrf_cps_net_ips, 3] } + pcrf_cps_net_mask: { get_param: pcrf_cps_net_mask } + pcrf_vnf_id: {get_param: pcrf_vnf_id} + + server_pcrf_psm_005: + type: nested-psm_v1.0.yaml + properties: + pcrf_psm_server_name: { get_param: [pcrf_psm_server_names, 4] } + pcrf_psm_image_name: { get_param: pcrf_psm_image_name } + pcrf_psm_flavor_name: { get_param: pcrf_psm_flavor_name } + availabilityzone_name: { get_param: availabilityzone_name } + pcrf_security_group_name: { get_param: pcrf_security_group_name } + pcrf_cps_net_name: { get_param: pcrf_cps_net_name } + pcrf_cps_net_ip: { get_param: [pcrf_cps_net_ips, 4] } + pcrf_cps_net_mask: { get_param: pcrf_cps_net_mask } + pcrf_vnf_id: {get_param: pcrf_vnf_id} + + server_pcrf_psm_006: + type: nested-psm_v1.0.yaml + properties: + pcrf_psm_server_name: { get_param: [pcrf_psm_server_names, 5] } + pcrf_psm_image_name: { get_param: pcrf_psm_image_name } + pcrf_psm_flavor_name: { get_param: pcrf_psm_flavor_name } + availabilityzone_name: { get_param: availabilityzone_name } + pcrf_security_group_name: { get_param: pcrf_security_group_name } + pcrf_cps_net_name: { get_param: pcrf_cps_net_name } + pcrf_cps_net_ip: { get_param: [pcrf_cps_net_ips, 5] } + pcrf_cps_net_mask: { get_param: pcrf_cps_net_mask } + pcrf_vnf_id: {get_param: pcrf_vnf_id} + + server_pcrf_psm_007: + type: nested-psm_v1.0.yaml + properties: + pcrf_psm_server_name: { get_param: [pcrf_psm_server_names, 6] } + pcrf_psm_image_name: { get_param: pcrf_psm_image_name } + pcrf_psm_flavor_name: { get_param: pcrf_psm_flavor_name } + availabilityzone_name: { get_param: availabilityzone_name } + pcrf_security_group_name: { get_param: pcrf_security_group_name } + pcrf_cps_net_name: { get_param: pcrf_cps_net_name } + pcrf_cps_net_ip: { get_param: [pcrf_cps_net_ips, 6] } + pcrf_cps_net_mask: { get_param: pcrf_cps_net_mask } + pcrf_vnf_id: {get_param: pcrf_vnf_id} + + server_pcrf_psm_008: + type: nested-psm_v1.0.yaml + properties: + pcrf_psm_server_name: { get_param: [pcrf_psm_server_names, 7] } + pcrf_psm_image_name: { get_param: pcrf_psm_image_name } + pcrf_psm_flavor_name: { get_param: pcrf_psm_flavor_name } + availabilityzone_name: { get_param: availabilityzone_name } + pcrf_security_group_name: { get_param: pcrf_security_group_name } + pcrf_cps_net_name: { get_param: pcrf_cps_net_name } + pcrf_cps_net_ip: { get_param: [pcrf_cps_net_ips, 7] } + pcrf_cps_net_mask: { get_param: pcrf_cps_net_mask } + pcrf_vnf_id: {get_param: pcrf_vnf_id} + + server_pcrf_psm_009: + type: nested-psm_v1.0.yaml + properties: + pcrf_psm_server_name: { get_param: [pcrf_psm_server_names, 8] } + pcrf_psm_image_name: { get_param: pcrf_psm_image_name } + pcrf_psm_flavor_name: { get_param: pcrf_psm_flavor_name } + availabilityzone_name: { get_param: availabilityzone_name } + pcrf_security_group_name: { get_param: pcrf_security_group_name } + pcrf_cps_net_name: { get_param: pcrf_cps_net_name } + pcrf_cps_net_ip: { get_param: [pcrf_cps_net_ips, 8] } + pcrf_cps_net_mask: { get_param: pcrf_cps_net_mask } + pcrf_vnf_id: {get_param: pcrf_vnf_id} + + server_pcrf_psm_010: + type: nested-psm_v1.0.yaml + properties: + pcrf_psm_server_name: { get_param: [pcrf_psm_server_names, 9] } + pcrf_psm_image_name: { get_param: pcrf_psm_image_name } + pcrf_psm_flavor_name: { get_param: pcrf_psm_flavor_name } + availabilityzone_name: { get_param: availabilityzone_name } + pcrf_security_group_name: { get_param: pcrf_security_group_name } + pcrf_cps_net_name: { get_param: pcrf_cps_net_name } + pcrf_cps_net_ip: { get_param: [pcrf_cps_net_ips, 9] } + pcrf_cps_net_mask: { get_param: pcrf_cps_net_mask } + pcrf_vnf_id: {get_param: pcrf_vnf_id} + + server_pcrf_psm_011: + type: nested-psm_v1.0.yaml + properties: + pcrf_psm_server_name: { get_param: [pcrf_psm_server_names, 10] } + pcrf_psm_image_name: { get_param: pcrf_psm_image_name } + pcrf_psm_flavor_name: { get_param: pcrf_psm_flavor_name } + availabilityzone_name: { get_param: availabilityzone_name } + pcrf_security_group_name: { get_param: pcrf_security_group_name } + pcrf_cps_net_name: { get_param: pcrf_cps_net_name } + pcrf_cps_net_ip: { get_param: [pcrf_cps_net_ips, 10] } + pcrf_cps_net_mask: { get_param: pcrf_cps_net_mask } + pcrf_vnf_id: {get_param: pcrf_vnf_id} + + server_pcrf_psm_012: + type: nested-psm_v1.0.yaml + properties: + pcrf_psm_server_name: { get_param: [pcrf_psm_server_names, 11] } + pcrf_psm_image_name: { get_param: pcrf_psm_image_name } + pcrf_psm_flavor_name: { get_param: pcrf_psm_flavor_name } + availabilityzone_name: { get_param: availabilityzone_name } + pcrf_security_group_name: { get_param: pcrf_security_group_name } + pcrf_cps_net_name: { get_param: pcrf_cps_net_name } + pcrf_cps_net_ip: { get_param: [pcrf_cps_net_ips, 11] } + pcrf_cps_net_mask: { get_param: pcrf_cps_net_mask } + pcrf_vnf_id: {get_param: pcrf_vnf_id} + diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/nimbus/hot-nimbus-swift-container_v1.0.env b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/nimbus/hot-nimbus-swift-container_v1.0.env new file mode 100644 index 0000000000..5424c1bbf3 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/nimbus/hot-nimbus-swift-container_v1.0.env @@ -0,0 +1,3 @@ +parameters: + pcrf_swift_container_name_1: PCRF_Config_Container_1 + pcrf_swift_container_purge_on_delete_flag_1: false diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/nimbus/hot-nimbus-swift-container_v1.0.yaml b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/nimbus/hot-nimbus-swift-container_v1.0.yaml new file mode 100644 index 0000000000..9597f234b0 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/nimbus/hot-nimbus-swift-container_v1.0.yaml @@ -0,0 +1,30 @@ +heat_template_version: 2013-05-23 + +description: heat template that creates PCRF Session Manager stack + +parameters: + pcrf_swift_container_name_1: + type: string + label: Swift Container name + description: Swift Container Name + pcrf_swift_container_purge_on_delete_flag_1: + type: boolean + label: Purge on Delete Flag + description: Purge on Delete Flag + +resources: + pcrf_swift_container_1: + type: OS::Swift::Container + properties: + name: { get_param: pcrf_swift_container_name_1 } + PurgeOnDelete: { get_param: pcrf_swift_container_purge_on_delete_flag_1 } + X-Container-Read: ".r:*" + +outputs: + pcrf_swift_container_id_1: + description: the pcrf_swift_container_1 id + value: { get_resource: pcrf_swift_container_1 } + pcrf_swift_container_url_1: + description: the pcrf_swift_container_1 url + value: { get_attr: [ pcrf_swift_container_1, WebsiteURL ] } +
\ No newline at end of file diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/nimbus/mount_iso_script.sh b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/nimbus/mount_iso_script.sh new file mode 100644 index 0000000000..da5d9c4e9a --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/nimbus/mount_iso_script.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +#. .config +#following would be in the .config file + device_name="/dev/vde" + install_script="install_nimbus.sh" + enable_logic_flag_file=".flag" +#end of config file + +#get the semaphore, 0 - disbaled, 1- enabled +flag=$(cat ${enable_logic_flag_file}) + +#check if device is mounted already +test=$(mount | grep ${device_name}) +if [ "$flag" == "1" ]; then + if [ -e ${device_name} ] && [ ! "${test}" ]; then + #mount the iso image + mount -t iso9660 -v -o loop /dev/vde/ /mnt/iso + #if availabe run the install script (it contains the install.sh steps) + if [ -e "${install_script}" ] && [ -f "${install_script}" ]; then + ${install_script} + fi + #disable the script from attempting to + # mount and run install again until needed; + echo "0" > ${enable_logic_flag_file} + #if nedeed add step to comment out the crontab line here; + fi +else + echo "Auto mounting ISO & run install logic disabled!" +fi + +#cron job +# * * * * * /mount_iso_script.sh + diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/nimbus/nested-oam_v1.0.yaml b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/nimbus/nested-oam_v1.0.yaml new file mode 100644 index 0000000000..d3baf41da5 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/nimbus/nested-oam_v1.0.yaml @@ -0,0 +1,156 @@ +heat_template_version: 2013-05-23 + +description: nested heat template that creates a PCRF OAM node stack + +parameters: + pcrf_oam_server_name: + type: string + label: PCRF OAM server name + description: PCRF OAM server name + pcrf_oam_image_name: + type: string + label: image name + description: PCRF OAM image name + pcrf_oam_flavor_name: + type: string + label: PCRF OAM flavor name + description: flavor name of PCRF OAM instance + availabilityzone_name: + type: string + label: availabilityzone name + description: availabilityzone name + pcrf_cps_net_name: + type: string + label: CPS network name + description: CPS network name + pcrf_cps_net_ip: + type: string + label: CPS network ip + description: CPS network ip + pcrf_cps_net_mask: + type: string + label: CPS network mask + description: CPS network mask + pcrf_arbiter_vip: + type: string + label: OAM Arbiter LB VIP + description: OAM Arbiter LB VIP + pcrf_oam_net_name: + type: string + label: OAM network name + description: OAM network name + pcrf_oam_net_ip: + type: string + label: OAM network ip + description: OAM network ip + pcrf_oam_net_gw: + type: string + label: CPS network gateway + description: CPS network gateway + pcrf_oam_net_mask: + type: string + label: CPS network mask + description: CPS network mask + pcrf_oam_volume_id: + type: string + label: CPS OAM Cinder Volume + description: CPS OAM Cinder Volume + pcrf_security_group_name: + type: string + label: security group name + description: the name of security group + pcrf_vnf_id: + type: string + label: PCRF VNF Id + description: PCRF VNF Id + +resources: + network: + type: OS::Heat::CloudConfig + properties: + cloud_config: + write_files: + - path: /etc/sysconfig/network-scripts/ifcfg-eth0 + permissions: "0644" + content: + str_replace: + template: { get_file: nimbus-ethernet } + params: + $dev: eth0 + $ip: { get_param: pcrf_cps_net_ip } + $netmask: { get_param: pcrf_cps_net_mask } + - path: /etc/sysconfig/network-scripts/ifcfg-eth1 + permissions: "0644" + content: + str_replace: + template: { get_file: nimbus-ethernet-gw } + params: + $dev: eth1 + $ip: { get_param: pcrf_oam_net_ip } + $netmask: { get_param: pcrf_oam_net_mask } + $gateway: { get_param: pcrf_oam_net_gw } + runcmd: + - ifdown eth0 && ifup eth0 + - ifdown eth1 && ifup eth1 + script_init: + type: OS::Heat::SoftwareConfig + properties: + group: ungrouped + config: + str_replace: + template: { get_file: cloud-nimbus.sh } + params: + $vm_name: { get_param: pcrf_oam_server_name } + pcrf_server_init: + type: OS::Heat::MultipartMime + properties: + parts: + - config: { get_resource: network} + - config: { get_resource: script_init} + + pcrf_server_oam: + type: OS::Nova::Server + properties: + config_drive: "True" + name: { get_param: pcrf_oam_server_name } + image: { get_param: pcrf_oam_image_name } + flavor: { get_param: pcrf_oam_flavor_name } + availability_zone: { get_param: availabilityzone_name } + networks: + - port: { get_resource: pcrf_oam_port_0} + - port: { get_resource: pcrf_oam_port_1} + user_data_format: RAW + user_data: + get_resource: pcrf_server_init + metadata: + vnf_id: {get_param: pcrf_vnf_id} + + pcrf_oam_port_0: + type: OS::Neutron::Port + properties: + network: { get_param: pcrf_cps_net_name } + fixed_ips: + - ip_address: { get_param: pcrf_cps_net_ip } + allowed_address_pairs: + - ip_address: { get_param: pcrf_arbiter_vip } + security_groups: [{ get_param: pcrf_security_group_name }] + + pcrf_oam_port_1: + type: OS::Neutron::Port + properties: + network: { get_param: pcrf_oam_net_name } + fixed_ips: + - ip_address: { get_param: pcrf_oam_net_ip } + security_groups: [{ get_param: pcrf_security_group_name }] + + pcrf_oam_vol_attachment: + type: OS::Cinder::VolumeAttachment + properties: + volume_id: { get_param: pcrf_oam_volume_id } + mountpoint: /dev/vdd + instance_uuid: { get_resource: pcrf_server_oam } + +outputs: + pcrf_oam_vol_attachment_id: + description: the pcrf_oam_vol_attachment_id id + value: { get_resource: pcrf_oam_vol_attachment } diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/nimbus/nested-pcm_v1.0.yaml b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/nimbus/nested-pcm_v1.0.yaml new file mode 100644 index 0000000000..820d09b3dc --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/nimbus/nested-pcm_v1.0.yaml @@ -0,0 +1,150 @@ +heat_template_version: 2013-05-23 + +description: heat template that creates PCRF Cluman stack + +parameters: + pcrf_pcm_server_name: + type: string + label: PCRF CM server name + description: PCRF CM server name + pcrf_pcm_image_name: + type: string + label: image name + description: PCRF CM image name + pcrf_pcm_flavor_name: + type: string + label: PCRF CM flavor name + description: flavor name of PCRF CM instance + availabilityzone_name: + type: string + label: availabilityzone name + description: availabilityzone name + pcrf_cps_net_name: + type: string + label: CPS network name + description: CPS network name + pcrf_cps_net_ip: + type: string + label: CPS network ip + description: CPS network ip + pcrf_cps_net_mask: + type: string + label: CPS network mask + description: CPS network mask + pcrf_oam_net_name: + type: string + label: OAM network name + description: OAM network name + pcrf_oam_net_ip: + type: string + label: OAM network ip + description: OAM network ip + pcrf_oam_net_gw: + type: string + label: CPS network gateway + description: CPS network gateway + pcrf_oam_net_mask: + type: string + label: CPS network mask + description: CPS network mask + pcrf_pcm_volume_id: + type: string + label: CPS Cluman Cinder Volume + description: CPS Cluman Cinder Volume + pcrf_security_group_name: + type: string + label: security group name + description: the name of security group + pcrf_vnf_id: + type: string + label: PCRF VNF Id + description: PCRF VNF Id + +resources: + network: + type: OS::Heat::CloudConfig + properties: + cloud_config: + write_files: + - path: /etc/sysconfig/network-scripts/ifcfg-eth0 + permissions: "0644" + content: + str_replace: + template: { get_file: nimbus-ethernet } + params: + $dev: eth0 + $ip: { get_param: pcrf_cps_net_ip } + $netmask: { get_param: pcrf_cps_net_mask } + - path: /etc/sysconfig/network-scripts/ifcfg-eth1 + permissions: "0644" + content: + str_replace: + template: { get_file: nimbus-ethernet-gw } + params: + $dev: eth1 + $ip: { get_param: pcrf_oam_net_ip } + $netmask: { get_param: pcrf_oam_net_mask } + $gateway: { get_param: pcrf_oam_net_gw } + runcmd: + - ifdown eth0 && ifup eth0 + - ifdown eth1 && ifup eth1 + script_init: + type: OS::Heat::SoftwareConfig + properties: + group: ungrouped + config: + str_replace: + template: { get_file: cloud-nimbus.sh } + params: + $vm_name: { get_param: pcrf_pcm_server_name } + pcrf_server_init: + type: OS::Heat::MultipartMime + properties: + parts: + - config: { get_resource: network} + - config: { get_resource: script_init} + + pcrf_server_pcm: + type: OS::Nova::Server + properties: + config_drive: "True" + name: { get_param: pcrf_pcm_server_name } + image: { get_param: pcrf_pcm_image_name } + flavor: { get_param: pcrf_pcm_flavor_name } + availability_zone: { get_param: availabilityzone_name } + networks: + - port: { get_resource: pcrf_pcm_port_0} + - port: { get_resource: pcrf_pcm_port_1} + user_data_format: RAW + user_data: + get_resource: pcrf_server_init + metadata: + vnf_id: {get_param: pcrf_vnf_id} + + pcrf_pcm_port_0: + type: OS::Neutron::Port + properties: + network: { get_param: pcrf_cps_net_name } + fixed_ips: + - ip_address: { get_param: pcrf_cps_net_ip } + security_groups: [{ get_param: pcrf_security_group_name }] + + pcrf_pcm_port_1: + type: OS::Neutron::Port + properties: + network: { get_param: pcrf_oam_net_name } + fixed_ips: + - ip_address: { get_param: pcrf_oam_net_ip } + security_groups: [{ get_param: pcrf_security_group_name }] + + volume_attachment: + type: OS::Cinder::VolumeAttachment + properties: + volume_id: { get_param: pcrf_pcm_volume_id } + mountpoint: /dev/vdd + instance_uuid: { get_resource: pcrf_server_pcm } + +outputs: + pcrf_server_pcm_id: + description: the pcm server id + value: { get_resource: pcrf_server_pcm }
\ No newline at end of file diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/nimbus/nested-ppd_v1.0.yaml b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/nimbus/nested-ppd_v1.0.yaml new file mode 100644 index 0000000000..397e85c252 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/nimbus/nested-ppd_v1.0.yaml @@ -0,0 +1,333 @@ +heat_template_version: 2013-05-23 + +description: heat template that creates PCRF Policy Director stack + +parameters: + pcrf_ppd_server_name: + type: string + label: PCRF PD server name + description: PCRF PD server name + pcrf_ppd_image_name: + type: string + label: image name + description: PCRF PD image name + pcrf_ppd_flavor_name: + type: string + label: PCRF PD flavor name + description: flavor name of PCRF PD instance + availabilityzone_name: + type: string + label: availabilityzone name + description: availabilityzone name + pcrf_cps_net_name: + type: string + label: CPS network name + description: CPS network name + pcrf_cps_net_ip: + type: string + label: CPS network ip + description: CPS network ip + pcrf_cps_net_mask: + type: string + label: CPS network mask + description: CPS network mask + pcrf_lb_internal_vip: + type: string + label: CPS Internal LB VIP + description: CPS Internal LB VIP + pcrf_oam_net_name: + type: string + label: OAM network name + description: OAM network name + pcrf_oam_net_ip: + type: string + label: OAM network ip + description: OAM network ip + pcrf_oam_net_gw: + type: string + label: CPS network gateway + description: CPS network gateway + pcrf_oam_net_mask: + type: string + label: CPS network mask + description: CPS network mask + pcrf_lb_management_vip: + type: string + label: CPS OAM LB VIP + description: CPS OAM LB VIP + pcrf_gx_net_name: + type: string + label: Gx network name + description: Gx network name + pcrf_gx_net_ip: + type: string + label: Gx network ip + description: Gx network ip + pcrf_gx_net_mask: + type: string + label: Gx network mask + description: Gx network mask + pcrf_sp_net_name: + type: string + label: Sp network name + description: Sp network name + pcrf_sp_net_ip: + type: string + label: Sp network ip + description: Sp network ip + pcrf_sp_net_mask: + type: string + label: Sp network mask + description: Sp network mask + pcrf_sy_net_name: + type: string + label: Sy network name + description: Sy network name + pcrf_sy_net_ip: + type: string + label: Sy network ip + description: Sy network ip + pcrf_sy_net_mask: + type: string + label: Sy network mask + description: Sy network mask + pcrf_rx_net_name: + type: string + label: Rx network name + description: Rx network name + pcrf_rx_net_ip: + type: string + label: Rx network ip + description: Rx network ip + pcrf_rx_net_mask: + type: string + label: Rx network mask + description: Rx network mask + pcrf_sd_net_name: + type: string + label: Sd network name + description: Sd network name + pcrf_sd_net_ip: + type: string + label: Sd network ip + description: Sd network ip + pcrf_sd_net_mask: + type: string + label: Sd network mask + description: Sd network mask + pcrf_sgi_sy_net_name: + type: string + label: Sgi Sy network name + description: Sgi Sy network name + pcrf_sgi_sy_net_ip: + type: string + label: Sgi Sy network ip + description: Sgi Sy network ip + pcrf_sgi_sy_net_mask: + type: string + label: Sgi Sy network mask + description: Sgi Sy network mask + pcrf_security_group_name: + type: string + label: security group name + description: the name of security group + pcrf_vnf_id: + type: string + label: PCRF VNF Id + description: PCRF VNF Id + +resources: + network: + type: OS::Heat::CloudConfig + properties: + cloud_config: + write_files: + - path: /etc/sysconfig/network-scripts/ifcfg-eth0 + permissions: "0644" + content: + str_replace: + template: { get_file: nimbus-ethernet } + params: + $dev: eth0 + $ip: { get_param: pcrf_cps_net_ip } + $netmask: { get_param: pcrf_cps_net_mask } + - path: /etc/sysconfig/network-scripts/ifcfg-eth1 + permissions: "0644" + content: + str_replace: + template: { get_file: nimbus-ethernet-gw } + params: + $dev: eth1 + $ip: { get_param: pcrf_oam_net_ip } + $netmask: { get_param: pcrf_oam_net_mask } + $gateway: { get_param: pcrf_oam_net_gw } + - path: /etc/sysconfig/network-scripts/ifcfg-eth2 + permissions: "0644" + content: + str_replace: + template: { get_file: nimbus-ethernet } + params: + $dev: eth2 + $ip: { get_param: pcrf_gx_net_ip } + $netmask: { get_param: pcrf_gx_net_mask } + - path: /etc/sysconfig/network-scripts/ifcfg-eth3 + permissions: "0644" + content: + str_replace: + template: { get_file: nimbus-ethernet } + params: + $dev: eth3 + $ip: { get_param: pcrf_sp_net_ip } + $netmask: { get_param: pcrf_sp_net_mask } + - path: /etc/sysconfig/network-scripts/ifcfg-eth4 + permissions: "0644" + content: + str_replace: + template: { get_file: nimbus-ethernet } + params: + $dev: eth4 + $ip: { get_param: pcrf_sy_net_ip } + $netmask: { get_param: pcrf_sy_net_mask } + - path: /etc/sysconfig/network-scripts/ifcfg-eth5 + permissions: "0644" + content: + str_replace: + template: { get_file: nimbus-ethernet } + params: + $dev: eth5 + $ip: { get_param: pcrf_rx_net_ip } + $netmask: { get_param: pcrf_rx_net_mask } + - path: /etc/sysconfig/network-scripts/ifcfg-eth6 + permissions: "0644" + content: + str_replace: + template: { get_file: nimbus-ethernet } + params: + $dev: eth6 + $ip: { get_param: pcrf_sd_net_ip } + $netmask: { get_param: pcrf_sd_net_mask } + - path: /etc/sysconfig/network-scripts/ifcfg-eth7 + permissions: "0644" + content: + str_replace: + template: { get_file: nimbus-ethernet } + params: + $dev: eth7 + $ip: { get_param: pcrf_sgi_sy_net_ip } + $netmask: { get_param: pcrf_sgi_sy_net_mask } + runcmd: + - ifdown eth0 && ifup eth0 + - ifdown eth1 && ifup eth1 + - ifdown eth2 && ifup eth2 + - ifdown eth3 && ifup eth3 + - ifdown eth4 && ifup eth4 + - ifdown eth5 && ifup eth5 + - ifdown eth6 && ifup eth6 + - ifdown eth7 && ifup eth7 + script_init: + type: OS::Heat::SoftwareConfig + properties: + group: ungrouped + config: + str_replace: + template: { get_file: cloud-nimbus.sh } + params: + $vm_name: { get_param: pcrf_ppd_server_name } + pcrf_server_init: + type: OS::Heat::MultipartMime + properties: + parts: + - config: { get_resource: network} + - config: { get_resource: script_init} + + pcrf_server_ppd: + type: OS::Nova::Server + properties: + config_drive: "True" + name: { get_param: pcrf_ppd_server_name } + image: { get_param: pcrf_ppd_image_name } + flavor: { get_param: pcrf_ppd_flavor_name } + availability_zone: { get_param: availabilityzone_name } + networks: + - port: { get_resource: pcrf_ppd_port_0} + - port: { get_resource: pcrf_ppd_port_1} + - port: { get_resource: pcrf_ppd_port_2} + - port: { get_resource: pcrf_ppd_port_3} + - port: { get_resource: pcrf_ppd_port_4} + - port: { get_resource: pcrf_ppd_port_5} + - port: { get_resource: pcrf_ppd_port_6} + - port: { get_resource: pcrf_ppd_port_7} + user_data_format: RAW + user_data: + get_resource: pcrf_server_init + metadata: + vnf_id: {get_param: pcrf_vnf_id} + + pcrf_ppd_port_0: + type: OS::Neutron::Port + properties: + network: { get_param: pcrf_cps_net_name } + fixed_ips: + - ip_address: { get_param: pcrf_cps_net_ip } + security_groups: [{ get_param: pcrf_security_group_name }] + allowed_address_pairs: + - ip_address: { get_param: pcrf_lb_internal_vip } + + pcrf_ppd_port_1: + type: OS::Neutron::Port + properties: + network: { get_param: pcrf_oam_net_name } + fixed_ips: + - ip_address: { get_param: pcrf_oam_net_ip } + security_groups: [{ get_param: pcrf_security_group_name }] + allowed_address_pairs: + - ip_address: { get_param: pcrf_lb_management_vip } + + pcrf_ppd_port_2: + type: OS::Neutron::Port + properties: + network: { get_param: pcrf_gx_net_name } + fixed_ips: + - ip_address: { get_param: pcrf_gx_net_ip } + security_groups: [{ get_param: pcrf_security_group_name }] + + pcrf_ppd_port_3: + type: OS::Neutron::Port + properties: + network: { get_param: pcrf_sp_net_name } + fixed_ips: + - ip_address: { get_param: pcrf_sp_net_ip } + security_groups: [{ get_param: pcrf_security_group_name }] + + pcrf_ppd_port_4: + type: OS::Neutron::Port + properties: + network: { get_param: pcrf_sy_net_name } + fixed_ips: + - ip_address: { get_param: pcrf_sy_net_ip } + security_groups: [{ get_param: pcrf_security_group_name }] + + pcrf_ppd_port_5: + type: OS::Neutron::Port + properties: + network: { get_param: pcrf_rx_net_name } + fixed_ips: + - ip_address: { get_param: pcrf_rx_net_ip } + security_groups: [{ get_param: pcrf_security_group_name }] + + pcrf_ppd_port_6: + type: OS::Neutron::Port + properties: + network: { get_param: pcrf_sd_net_name } + fixed_ips: + - ip_address: { get_param: pcrf_sd_net_ip } + security_groups: [{ get_param: pcrf_security_group_name }] + + pcrf_ppd_port_7: + type: OS::Neutron::Port + properties: + network: { get_param: pcrf_sgi_sy_net_name } + fixed_ips: + - ip_address: { get_param: pcrf_sgi_sy_net_ip } + security_groups: [{ get_param: pcrf_security_group_name }] + diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/nimbus/nested-pps_v1.0.yaml b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/nimbus/nested-pps_v1.0.yaml new file mode 100644 index 0000000000..fc5b6f74c3 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/nimbus/nested-pps_v1.0.yaml @@ -0,0 +1,99 @@ +heat_template_version: 2013-05-23 + +description: heat template that creates PCRF Policy Server stack + +parameters: + pcrf_pps_server_name: + type: string + label: PCRF PS server name + description: PCRF PS server name + pcrf_pps_image_name: + type: string + label: PCRF PS image name + description: PCRF PS image name + pcrf_pps_flavor_name: + type: string + label: PCRF PS flavor name + description: flavor name of PCRF PS instance + availabilityzone_name: + type: string + label: availabilityzone name + description: availabilityzone name + pcrf_cps_net_name: + type: string + label: CPS network name + description: CPS network name + pcrf_cps_net_ip: + type: string + label: CPS network ip + description: CPS network ip + pcrf_cps_net_mask: + type: string + label: CPS network mask + description: CPS network mask + pcrf_security_group_name: + type: string + label: security group name + description: the name of security group + pcrf_vnf_id: + type: string + label: PCRF VNF Id + description: PCRF VNF Id + +resources: + script_init: + type: OS::Heat::SoftwareConfig + properties: + group: ungrouped + config: + str_replace: + template: { get_file: cloud-nimbus.sh } + params: + $vm_name: { get_param: pcrf_pps_server_name } + network: + type: OS::Heat::CloudConfig + properties: + cloud_config: + write_files: + - path: /etc/sysconfig/network-scripts/ifcfg-eth0 + permissions: "0644" + content: + str_replace: + template: { get_file: nimbus-ethernet } + params: + $dev: eth0 + $ip: { get_param: pcrf_cps_net_ip } + $netmask: { get_param: pcrf_cps_net_mask } + runcmd: + - ifdown eth0 && ifup eth0 + + pcrf_server_init: + type: OS::Heat::MultipartMime + properties: + parts: + - config: { get_resource: network} + - config: { get_resource: script_init} + + pcrf_server_pps: + type: OS::Nova::Server + properties: + config_drive: "True" + name: { get_param: pcrf_pps_server_name } + image: { get_param: pcrf_pps_image_name } + flavor: { get_param: pcrf_pps_flavor_name } + availability_zone: { get_param: availabilityzone_name } + networks: + - port: { get_resource: pcrf_pps_port_0} + user_data_format: RAW + user_data: + get_resource: pcrf_server_init + metadata: + vnf_id: {get_param: pcrf_vnf_id} + + pcrf_pps_port_0: + type: OS::Neutron::Port + properties: + network: { get_param: pcrf_cps_net_name } + fixed_ips: + - ip_address: { get_param: pcrf_cps_net_ip } + security_groups: [{ get_param: pcrf_security_group_name }] diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/nimbus/nested-psm_v1.0.yaml b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/nimbus/nested-psm_v1.0.yaml new file mode 100644 index 0000000000..c86aa34713 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/nimbus/nested-psm_v1.0.yaml @@ -0,0 +1,99 @@ +heat_template_version: 2013-05-23 + +description: heat template that creates PCRF Session Manager stack + +parameters: + pcrf_psm_server_name: + type: string + label: PCRF SM server name + description: PCRF SM server name + pcrf_psm_image_name: + type: string + label: image name + description: PCRF SM image name + pcrf_psm_flavor_name: + type: string + label: PCRF SM flavor name + description: flavor name of PCRF SM instance + availabilityzone_name: + type: string + label: availabilityzone name + description: availabilityzone name + pcrf_cps_net_name: + type: string + label: CPS network name + description: CPS network name + pcrf_cps_net_ip: + type: string + label: CPS network ip + description: CPS network ip + pcrf_cps_net_mask: + type: string + label: CPS network mask + description: CPS network mask + pcrf_security_group_name: + type: string + label: security group name + description: the name of security group + pcrf_vnf_id: + type: string + label: PCRF VNF Id + description: PCRF VNF Id + +resources: + network: + type: OS::Heat::CloudConfig + properties: + cloud_config: + write_files: + - path: /etc/sysconfig/network-scripts/ifcfg-eth0 + permissions: "0644" + content: + str_replace: + template: { get_file: nimbus-ethernet } + params: + $dev: eth0 + $ip: { get_param: pcrf_cps_net_ip } + $netmask: { get_param: pcrf_cps_net_mask } + runcmd: + - ifdown eth0 && ifup eth0 + script_init: + type: OS::Heat::SoftwareConfig + properties: + group: ungrouped + config: + str_replace: + template: { get_file: cloud-nimbus.sh } + params: + $vm_name: { get_param: pcrf_psm_server_name } + pcrf_server_init: + type: OS::Heat::MultipartMime + properties: + parts: + - config: { get_resource: network} + - config: { get_resource: script_init} + + pcrf_server_psm: + type: OS::Nova::Server + properties: + config_drive: "True" + name: { get_param: pcrf_psm_server_name } + image: { get_param: pcrf_psm_image_name } + flavor: { get_param: pcrf_psm_flavor_name } + availability_zone: { get_param: availabilityzone_name } + networks: + - port: { get_resource: psm01_port_0} + user_data_format: RAW + user_data: + get_resource: pcrf_server_init + metadata: + vnf_id: {get_param: pcrf_vnf_id} + #scheduler_hints: {group: { get_resource: servergroup_nimbus }} + + psm01_port_0: + type: OS::Neutron::Port + properties: + network: { get_param: pcrf_cps_net_name } + fixed_ips: + - ip_address: { get_param: pcrf_cps_net_ip } + security_groups: [{ get_param: pcrf_security_group_name }]
\ No newline at end of file diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/nimbus/nimbus-ethernet b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/nimbus/nimbus-ethernet new file mode 100644 index 0000000000..51250a7b82 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/nimbus/nimbus-ethernet @@ -0,0 +1,5 @@ +DEVICE=$dev +BOOTPROTO=none +NM_CONTROLLED=no +IPADDR=$ip +NETMASK=$netmask diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/nimbus/nimbus-ethernet-gw b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/nimbus/nimbus-ethernet-gw new file mode 100644 index 0000000000..3e08d643bb --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/nimbus/nimbus-ethernet-gw @@ -0,0 +1,6 @@ +DEVICE=$dev +BOOTPROTO=none +NM_CONTROLLED=no +IPADDR=$ip +NETMASK=$netmask +GATEWAY=$gateway diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/notZipFile b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/notZipFile new file mode 100644 index 0000000000..0f0f2a483c --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/notZipFile @@ -0,0 +1 @@ +test text file
\ No newline at end of file diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/quesionnaire/invalidComponent.json b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/quesionnaire/invalidComponent.json new file mode 100644 index 0000000000..9b10297572 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/quesionnaire/invalidComponent.json @@ -0,0 +1,34 @@ +{ + "general": { + "hypervisor": { + "hypervisor": "KVM", + "containerFeaturesDescription": "Nn8XhahKjo,FapqJ4Ale11LkO-f3,TlCJ2d0S Q B1w0JJwZgWo MeqEk85utsaM tdM33ZmAiAKp__c_PRBt_5-24gBU21unWme", + "drivers": ",Lz-m3R7iwRREmjBA3Ss6b0K8YBcH4SS66UJSG8OGTlaMs6Be" + }, + "image": { + "ephemeralDiskSizePerVM": 8, + "format": "iso", + "bootDiskSizePerVM": 100, + "providedBy": "Vendor" + }, + "dnsConfiguration": "dolore adipisicing proident aute amet", + "recovery": { + "vmProcessFailuresHandling": "in ad est ut", + "pointObjective": 20 + } + }, + "network": {}, + "highAvailabilityAndLoadBalancing": { + "architectureChoice": "nostrud eu culpa velit Lorem", + "slaRequirements": "est esse Excepteur eu", + "failureLoadDistribution": "velit reprehenderit aute dolor in", + "loadDistributionMechanism": "quis fugiat veniam cillum" + }, + "storage": { + "backup": { + "backupType": "On Site", + "backupStorageSize": 9, + "backupSolution": "fugiat tempor" + } + } +}
\ No newline at end of file diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/quesionnaire/invalidNic.json b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/quesionnaire/invalidNic.json new file mode 100644 index 0000000000..7297cdcc84 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/quesionnaire/invalidNic.json @@ -0,0 +1,36 @@ +{ + "ipConfiguration": { + "ipv6Required": false + }, + "protocols": { + "protocolWithHighestTrafficProfile": "TCP" + }, + "network": { + "networkDescription": "mLRqrnteBeIIUQsuvZEetXjllKPnYvbG" + }, + "sizing": { + "describeQualityOfService": "adipisicing voluptate aute", + "acceptableJitter": { + "mean": "98690087997256150885582732516496929349161209784564642159997681825133065" + }, + "flowLength": { + "packets": {}, + "bytes": {} + }, + "outflowTrafficPerSecond": { + "packets": {} + }, + "acceptablePacketLoss": "15", + "inflowTrafficPerSecond": { + "bytes": {} + } + }, + "describeQualityOfService": "minim dolore", + "acceptablePacketLoss": "4", + "flowLength": {}, + "acceptableJitter": { + "mean": "61827261335222870878257995122569227177432366697624312367018960696207118652325834319325112734287", + "max": "498307229580528005673649352861421755", + "variable": "5085363947608755025538570280250262251802454469028997134802881591362" + } +} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/quesionnaire/validComponent.json b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/quesionnaire/validComponent.json new file mode 100644 index 0000000000..4e9e9aa6c0 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/quesionnaire/validComponent.json @@ -0,0 +1,34 @@ +{ + "general": { + "hypervisor": { + "hypervisor": "KVM", + "containerFeaturesDescription": "Nn8XhahKjo,FapqJ4Ale11LkO-f3,TlCJ2d0S Q B1w0JJwZgWo MeqEk85utsaM tdM33ZmAiAKp__c_PRBt_5-24gBU21unWme", + "drivers": ",Lz-m3R7iwRREmjBA3Ss6b0K8YBcH4SS66UJSG8OGTlaMs6Be" + }, + "image": { + "ephemeralDiskSizePerVM": 8, + "format": "iso", + "bootDiskSizePerVM": 100, + "providedBy": "Vendor" + }, + "dnsConfiguration": "dolore adipisicing proident aute amet", + "recovery": { + "vmProcessFailuresHandling": "in ad est ut", + "pointObjective": 6 + } + }, + "network": {}, + "highAvailabilityAndLoadBalancing": { + "architectureChoice": "nostrud eu culpa velit Lorem", + "slaRequirements": "est esse Excepteur eu", + "failureLoadDistribution": "velit reprehenderit aute dolor in", + "loadDistributionMechanism": "quis fugiat veniam cillum" + }, + "storage": { + "backup": { + "backupType": "On Site", + "backupStorageSize": 9, + "backupSolution": "fugiat tempor" + } + } +}
\ No newline at end of file diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/quesionnaire/validNic.json b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/quesionnaire/validNic.json new file mode 100644 index 0000000000..e30dcfd668 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/quesionnaire/validNic.json @@ -0,0 +1,30 @@ +{ + "ipConfiguration": { + "ipv6Required": false + }, + "protocols": { + "protocolWithHighestTrafficProfile": "TCP" + }, + "network": { + "networkDescription": "mLRqrnteBeIIUQsuvZEetXjllKPnYvbG" + }, + "sizing": { + "describeQualityOfService": "adipisicing voluptate aute", + "flowLength": { + "packets": {}, + "bytes": {} + }, + "outflowTrafficPerSecond": { + "packets": {} + }, + "acceptablePacketLoss": 15, + "inflowTrafficPerSecond": { + "bytes": {} + }, + "acceptableJitter": { + "mean": 2000, + "max": 3000, + "variable": 4000 + } + } +} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/tree/missing_manifest/input/heat_missing_from_manifast.yaml b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/tree/missing_manifest/input/heat_missing_from_manifast.yaml new file mode 100644 index 0000000000..d5608abfb4 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/tree/missing_manifest/input/heat_missing_from_manifast.yaml @@ -0,0 +1,250 @@ +### Heat Template ### +description: Generated template +heat_template_version: 2013-05-23 +parameters: {} +resources: + network_0: + properties: + admin_state_up: true + name: NET_167 + shared: true + type: OS::Neutron::Net + network_1: + properties: + admin_state_up: true + name: NET_169 + shared: true + type: OS::Neutron::Net + network_2: + properties: + admin_state_up: true + name: NET_166 + shared: true + type: OS::Neutron::Net + network_3: + properties: + admin_state_up: true + name: NET_168 + shared: true + type: OS::Neutron::Net + network_4: + properties: + admin_state_up: true + name: NET_169 + shared: true + type: OS::Neutron::Net + network_5: + properties: + admin_state_up: true + name: NET_170 + shared: true + type: OS::Neutron::Net + network_6: + properties: + admin_state_up: true + name: NET_168 + shared: true + type: OS::Neutron::Net + network_7: + properties: + admin_state_up: true + name: NET_170 + shared: true + type: OS::Neutron::Net + network_8: + properties: + admin_state_up: true + name: NET_166 + shared: true + type: OS::Neutron::Net + network_9: + properties: + admin_state_up: true + name: NET_167 + shared: true + type: OS::Neutron::Net + security_group_0: + properties: + description: Default security group + name: _default + rules: + - direction: ingress + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + - direction: egress + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + type: OS::Neutron::SecurityGroup + security_group_1: + properties: + description: Default security group + name: _default + rules: + - direction: egress + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + - direction: ingress + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + type: OS::Neutron::SecurityGroup + subnet_0: + properties: + allocation_pools: + - end: 10.147.32.254 + start: 10.147.32.130 + cidr: 10.147.32.128/25 + dns_nameservers: + - 10.147.4.18 + - 10.247.5.11 + enable_dhcp: true + host_routes: [] + ip_version: 4 + name: NET_167 + network_id: + get_resource: network_9 + type: OS::Neutron::Subnet + subnet_1: + properties: + allocation_pools: + - end: 10.147.32.254 + start: 10.147.32.130 + cidr: 10.147.32.128/25 + dns_nameservers: + - 10.147.4.18 + - 10.247.5.11 + enable_dhcp: true + host_routes: [] + ip_version: 4 + name: NET_167 + network_id: + get_resource: network_0 + type: OS::Neutron::Subnet + subnet_2: + properties: + allocation_pools: + - end: 10.147.32.126 + start: 10.147.32.2 + cidr: 10.147.32.0/25 + dns_nameservers: + - 10.147.4.18 + - 10.247.5.11 + enable_dhcp: true + host_routes: [] + ip_version: 4 + name: NET_166 + network_id: + get_resource: network_8 + type: OS::Neutron::Subnet + subnet_3: + properties: + allocation_pools: + - end: 10.147.32.126 + start: 10.147.32.2 + cidr: 10.147.32.0/25 + dns_nameservers: + - 10.147.4.18 + - 10.247.5.11 + enable_dhcp: true + host_routes: [] + ip_version: 4 + name: NET_166 + network_id: + get_resource: network_2 + type: OS::Neutron::Subnet + subnet_4: + properties: + allocation_pools: + - end: 10.147.34.126 + start: 10.147.34.2 + cidr: 10.147.34.0/25 + dns_nameservers: + - 10.147.4.18 + - 10.247.5.11 + enable_dhcp: true + host_routes: [] + ip_version: 4 + name: NET_170 + network_id: + get_resource: network_5 + type: OS::Neutron::Subnet + subnet_5: + properties: + allocation_pools: + - end: 10.147.33.126 + start: 10.147.33.2 + cidr: 10.147.33.0/25 + dns_nameservers: + - 10.147.4.18 + - 10.247.5.11 + enable_dhcp: true + host_routes: [] + ip_version: 4 + name: NET_168 + network_id: + get_resource: network_6 + type: OS::Neutron::Subnet + subnet_6: + properties: + allocation_pools: + - end: 10.147.33.126 + start: 10.147.33.2 + cidr: 10.147.33.0/25 + dns_nameservers: + - 10.147.4.18 + - 10.247.5.11 + enable_dhcp: true + host_routes: [] + ip_version: 4 + name: NET_168 + network_id: + get_resource: network_3 + type: OS::Neutron::Subnet + subnet_7: + properties: + allocation_pools: + - end: 10.147.33.254 + start: 10.147.33.130 + cidr: 10.147.33.128/25 + dns_nameservers: + - 10.147.4.18 + - 10.247.5.11 + enable_dhcp: true + host_routes: [] + ip_version: 4 + name: NET_169 + network_id: + get_resource: network_1 + type: OS::Neutron::Subnet + subnet_8: + properties: + allocation_pools: + - end: 10.147.33.254 + start: 10.147.33.130 + cidr: 10.147.33.128/25 + dns_nameservers: + - 10.147.4.18 + - 10.247.5.11 + enable_dhcp: true + host_routes: [] + ip_version: 4 + name: NET_169 + network_id: + get_resource: network_4 + type: OS::Neutron::Subnet + subnet_9: + properties: + allocation_pools: + - end: 10.147.34.126 + start: 10.147.34.2 + cidr: 10.147.34.0/25 + dns_nameservers: + - 10.147.4.18 + - 10.247.5.11 + enable_dhcp: true + host_routes: [] + ip_version: 4 + name: NET_170 + network_id: + get_resource: network_7 + type: OS::Neutron::Subnet + diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/tree/missing_manifest/input/mainValid.yaml b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/tree/missing_manifest/input/mainValid.yaml new file mode 100644 index 0000000000..318c8f1283 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/tree/missing_manifest/input/mainValid.yaml @@ -0,0 +1,250 @@ +### Heat Template ### +description: Generated template +heat_template_version: 2013-05-23 +parameters: {} +resources: + network_0: + properties: + admin_state_up: true + name: NET_167 + shared: true + type: OS::Neutron::Net + network_1: + properties: + admin_state_up: true + name: NET_169 + shared: true + type: OS::Neutron::Net + network_2: + properties: + admin_state_up: true + name: NET_166 + shared: true + type: OS::Neutron::Net + network_3: + properties: + admin_state_up: true + name: NET_168 + shared: true + type: missingNested.yaml + network_4: + properties: + admin_state_up: true + name: { get_file: missing-artifact } + shared: true + type: OS::Neutron::Net + network_5: + properties: + admin_state_up: true + name: NET_170 + shared: true + type: OS::Neutron::Net + network_6: + properties: + admin_state_up: true + name: NET_168 + shared: true + type: OS::Neutron::Net + network_7: + properties: + admin_state_up: true + name: NET_170 + shared: true + type: OS::Neutron::Net + network_8: + properties: + admin_state_up: true + name: NET_166 + shared: true + type: OS::Neutron::Net + network_9: + properties: + admin_state_up: true + name: NET_167 + shared: true + type: OS::Neutron::Net + security_group_0: + properties: + description: Default security group + name: _default + rules: + - direction: ingress + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + - direction: egress + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + type: OS::Neutron::SecurityGroup + security_group_1: + properties: + description: Default security group + name: _default + rules: + - direction: egress + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + - direction: ingress + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + type: OS::Neutron::SecurityGroup + subnet_0: + properties: + allocation_pools: + - end: 10.147.32.254 + start: 10.147.32.130 + cidr: 10.147.32.128/25 + dns_nameservers: + - 10.147.4.18 + - 10.247.5.11 + enable_dhcp: true + host_routes: [] + ip_version: 4 + name: NET_167 + network_id: + get_resource: network_9 + type: OS::Neutron::Subnet + subnet_1: + properties: + allocation_pools: + - end: 10.147.32.254 + start: 10.147.32.130 + cidr: 10.147.32.128/25 + dns_nameservers: + - 10.147.4.18 + - 10.247.5.11 + enable_dhcp: true + host_routes: [] + ip_version: 4 + name: NET_167 + network_id: + get_resource: network_0 + type: OS::Neutron::Subnet + subnet_2: + properties: + allocation_pools: + - end: 10.147.32.126 + start: 10.147.32.2 + cidr: 10.147.32.0/25 + dns_nameservers: + - 10.147.4.18 + - 10.247.5.11 + enable_dhcp: true + host_routes: [] + ip_version: 4 + name: NET_166 + network_id: + get_resource: network_8 + type: OS::Neutron::Subnet + subnet_3: + properties: + allocation_pools: + - end: 10.147.32.126 + start: 10.147.32.2 + cidr: 10.147.32.0/25 + dns_nameservers: + - 10.147.4.18 + - 10.247.5.11 + enable_dhcp: true + host_routes: [] + ip_version: 4 + name: NET_166 + network_id: + get_resource: network_2 + type: OS::Neutron::Subnet + subnet_4: + properties: + allocation_pools: + - end: 10.147.34.126 + start: 10.147.34.2 + cidr: 10.147.34.0/25 + dns_nameservers: + - 10.147.4.18 + - 10.247.5.11 + enable_dhcp: true + host_routes: [] + ip_version: 4 + name: NET_170 + network_id: + get_resource: network_5 + type: OS::Neutron::Subnet + subnet_5: + properties: + allocation_pools: + - end: 10.147.33.126 + start: 10.147.33.2 + cidr: 10.147.33.0/25 + dns_nameservers: + - 10.147.4.18 + - 10.247.5.11 + enable_dhcp: true + host_routes: [] + ip_version: 4 + name: NET_168 + network_id: + get_resource: network_6 + type: OS::Neutron::Subnet + subnet_6: + properties: + allocation_pools: + - end: 10.147.33.126 + start: 10.147.33.2 + cidr: 10.147.33.0/25 + dns_nameservers: + - 10.147.4.18 + - 10.247.5.11 + enable_dhcp: true + host_routes: [] + ip_version: 4 + name: NET_168 + network_id: + get_resource: network_3 + type: OS::Neutron::Subnet + subnet_7: + properties: + allocation_pools: + - end: 10.147.33.254 + start: 10.147.33.130 + cidr: 10.147.33.128/25 + dns_nameservers: + - 10.147.4.18 + - 10.247.5.11 + enable_dhcp: true + host_routes: [] + ip_version: 4 + name: NET_169 + network_id: + get_resource: network_1 + type: OS::Neutron::Subnet + subnet_8: + properties: + allocation_pools: + - end: 10.147.33.254 + start: 10.147.33.130 + cidr: 10.147.33.128/25 + dns_nameservers: + - 10.147.4.18 + - 10.247.5.11 + enable_dhcp: true + host_routes: [] + ip_version: 4 + name: NET_169 + network_id: + get_resource: network_4 + type: OS::Neutron::Subnet + subnet_9: + properties: + allocation_pools: + - end: 10.147.34.126 + start: 10.147.34.2 + cidr: 10.147.34.0/25 + dns_nameservers: + - 10.147.4.18 + - 10.247.5.11 + enable_dhcp: true + host_routes: [] + ip_version: 4 + name: NET_170 + network_id: + get_resource: network_7 + type: OS::Neutron::Subnet + diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/tree/missing_manifest/input/validHeat.yaml b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/tree/missing_manifest/input/validHeat.yaml new file mode 100644 index 0000000000..d5608abfb4 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/tree/missing_manifest/input/validHeat.yaml @@ -0,0 +1,250 @@ +### Heat Template ### +description: Generated template +heat_template_version: 2013-05-23 +parameters: {} +resources: + network_0: + properties: + admin_state_up: true + name: NET_167 + shared: true + type: OS::Neutron::Net + network_1: + properties: + admin_state_up: true + name: NET_169 + shared: true + type: OS::Neutron::Net + network_2: + properties: + admin_state_up: true + name: NET_166 + shared: true + type: OS::Neutron::Net + network_3: + properties: + admin_state_up: true + name: NET_168 + shared: true + type: OS::Neutron::Net + network_4: + properties: + admin_state_up: true + name: NET_169 + shared: true + type: OS::Neutron::Net + network_5: + properties: + admin_state_up: true + name: NET_170 + shared: true + type: OS::Neutron::Net + network_6: + properties: + admin_state_up: true + name: NET_168 + shared: true + type: OS::Neutron::Net + network_7: + properties: + admin_state_up: true + name: NET_170 + shared: true + type: OS::Neutron::Net + network_8: + properties: + admin_state_up: true + name: NET_166 + shared: true + type: OS::Neutron::Net + network_9: + properties: + admin_state_up: true + name: NET_167 + shared: true + type: OS::Neutron::Net + security_group_0: + properties: + description: Default security group + name: _default + rules: + - direction: ingress + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + - direction: egress + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + type: OS::Neutron::SecurityGroup + security_group_1: + properties: + description: Default security group + name: _default + rules: + - direction: egress + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + - direction: ingress + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + type: OS::Neutron::SecurityGroup + subnet_0: + properties: + allocation_pools: + - end: 10.147.32.254 + start: 10.147.32.130 + cidr: 10.147.32.128/25 + dns_nameservers: + - 10.147.4.18 + - 10.247.5.11 + enable_dhcp: true + host_routes: [] + ip_version: 4 + name: NET_167 + network_id: + get_resource: network_9 + type: OS::Neutron::Subnet + subnet_1: + properties: + allocation_pools: + - end: 10.147.32.254 + start: 10.147.32.130 + cidr: 10.147.32.128/25 + dns_nameservers: + - 10.147.4.18 + - 10.247.5.11 + enable_dhcp: true + host_routes: [] + ip_version: 4 + name: NET_167 + network_id: + get_resource: network_0 + type: OS::Neutron::Subnet + subnet_2: + properties: + allocation_pools: + - end: 10.147.32.126 + start: 10.147.32.2 + cidr: 10.147.32.0/25 + dns_nameservers: + - 10.147.4.18 + - 10.247.5.11 + enable_dhcp: true + host_routes: [] + ip_version: 4 + name: NET_166 + network_id: + get_resource: network_8 + type: OS::Neutron::Subnet + subnet_3: + properties: + allocation_pools: + - end: 10.147.32.126 + start: 10.147.32.2 + cidr: 10.147.32.0/25 + dns_nameservers: + - 10.147.4.18 + - 10.247.5.11 + enable_dhcp: true + host_routes: [] + ip_version: 4 + name: NET_166 + network_id: + get_resource: network_2 + type: OS::Neutron::Subnet + subnet_4: + properties: + allocation_pools: + - end: 10.147.34.126 + start: 10.147.34.2 + cidr: 10.147.34.0/25 + dns_nameservers: + - 10.147.4.18 + - 10.247.5.11 + enable_dhcp: true + host_routes: [] + ip_version: 4 + name: NET_170 + network_id: + get_resource: network_5 + type: OS::Neutron::Subnet + subnet_5: + properties: + allocation_pools: + - end: 10.147.33.126 + start: 10.147.33.2 + cidr: 10.147.33.0/25 + dns_nameservers: + - 10.147.4.18 + - 10.247.5.11 + enable_dhcp: true + host_routes: [] + ip_version: 4 + name: NET_168 + network_id: + get_resource: network_6 + type: OS::Neutron::Subnet + subnet_6: + properties: + allocation_pools: + - end: 10.147.33.126 + start: 10.147.33.2 + cidr: 10.147.33.0/25 + dns_nameservers: + - 10.147.4.18 + - 10.247.5.11 + enable_dhcp: true + host_routes: [] + ip_version: 4 + name: NET_168 + network_id: + get_resource: network_3 + type: OS::Neutron::Subnet + subnet_7: + properties: + allocation_pools: + - end: 10.147.33.254 + start: 10.147.33.130 + cidr: 10.147.33.128/25 + dns_nameservers: + - 10.147.4.18 + - 10.247.5.11 + enable_dhcp: true + host_routes: [] + ip_version: 4 + name: NET_169 + network_id: + get_resource: network_1 + type: OS::Neutron::Subnet + subnet_8: + properties: + allocation_pools: + - end: 10.147.33.254 + start: 10.147.33.130 + cidr: 10.147.33.128/25 + dns_nameservers: + - 10.147.4.18 + - 10.247.5.11 + enable_dhcp: true + host_routes: [] + ip_version: 4 + name: NET_169 + network_id: + get_resource: network_4 + type: OS::Neutron::Subnet + subnet_9: + properties: + allocation_pools: + - end: 10.147.34.126 + start: 10.147.34.2 + cidr: 10.147.34.0/25 + dns_nameservers: + - 10.147.4.18 + - 10.247.5.11 + enable_dhcp: true + host_routes: [] + ip_version: 4 + name: NET_170 + network_id: + get_resource: network_7 + type: OS::Neutron::Subnet + diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/tree/nested_resource_group/MANIFEST.json b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/tree/nested_resource_group/MANIFEST.json new file mode 100644 index 0000000000..522029634e --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/tree/nested_resource_group/MANIFEST.json @@ -0,0 +1,17 @@ +{ + "name": "vMME_Small", + "description": "HOT template to create 2 cinder volume attachment", + "version": "2013-05-23", + "data": [ + { + "file": "nested.yml", + "type": "HEAT", + "isBase": "false" + }, + { + "file": "addOn.yml", + "type": "HEAT", + "isBase": "false" + } + ] +} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/tree/nested_resource_group/addOn.yml b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/tree/nested_resource_group/addOn.yml new file mode 100644 index 0000000000..39c34742a4 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/tree/nested_resource_group/addOn.yml @@ -0,0 +1,31 @@ +heat_template_version: 2013-05-23 + +description: > + Version 2.0 02-09-2016 (Authors: John Doe, user PROD) + +parameters: + shared_security_group_id1: + type: string + description: network name of jsa log network + shared_security_group_id2: + type: string + description: network name of jsa log network + jsa_net_name: + type: string + description: network name of jsa log network + security_group_name: + type: string + label: security group name + description: the name of security group + +resources: + mvs_modules: + type: OS::Heat::ResourceGroup + properties: + count: 3 + index_var: "%index%" + resource_def: + type: nested.yml + properties: + p1: { get_param: shared_security_group_id1} + p2: { get_param: shared_security_group_id2} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/tree/nested_resource_group/nested.yml b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/tree/nested_resource_group/nested.yml new file mode 100644 index 0000000000..4614bdce93 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/tree/nested_resource_group/nested.yml @@ -0,0 +1,56 @@ +heat_template_version: 2013-05-23 + +description: cmaui server template for vMMSC + +parameters: + p1: + type: string + description: UID of OAM network + p2: + type: string + description: UID of OAM network + net: + type: string + description: UID of OAM network + cmaui_names: + type: comma_delimited_list + description: CMAUI1, CMAUI2 server names + cmaui_image: + type: string + description: Image for CMAUI server + availability_zone_0: + type: string + label: availabilityzone name + description: availabilityzone name + cmaui_flavor: + type: string + description: Flavor for CMAUI server + +resources: + + cmaui_port_1: + type: OS::Neutron::Port + properties: + network: { get_param: net } + fixed_ips: [{"ip_address": {get_param: [cmaui_oam_ips, 0]}}] + security_groups: [{get_param: p1}, {get_param: p2}] + replacement_policy: AUTO + + cmaui_port_2: + type: OS::Neutron::Port + properties: + network: { get_param: net } + fixed_ips: [{"ip_address": {get_param: [cmaui_oam_ips, 0]}}] + security_groups: [{get_param: p1}] + replacement_policy: AUTO + + server_cmaui: + type: OS::Nova::Server + properties: + name: { get_param: [cmaui_names, 0]} + image: { get_param: cmaui_image } + availability_zone: { get_param: availability_zone_0 } + flavor: { get_param: cmaui_flavor } + networks: + - port: { get_resource: cmaui_port_1 } + - port: { get_resource: cmaui_port_2 }
\ No newline at end of file diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/tree/nested_volume/MANIFEST.json b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/tree/nested_volume/MANIFEST.json new file mode 100644 index 0000000000..1e2b0c7997 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/tree/nested_volume/MANIFEST.json @@ -0,0 +1,16 @@ +{ + "name": "", + "description": "", + "data": [ + { + "file": "hot_mobt_volume_attach_nested.yaml", + "type": "HEAT_VOL", + "isBase": "false" + }, + { + "file": "base_mobt.yaml", + "type": "HEAT", + "isBase": "true" + } + ] +}
\ No newline at end of file diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/tree/nested_volume/base_mobt.yaml b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/tree/nested_volume/base_mobt.yaml new file mode 100644 index 0000000000..c3be156e38 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/tree/nested_volume/base_mobt.yaml @@ -0,0 +1,26 @@ +heat_template_version: 2014-10-16 + +description: heat template that creates additional MOBT nodes in stack + +parameters: + mobt_vol_count: + type: number + label: MOBT OAM server count + description: MOBT OAM server instance count + default: 2 + constraints: + - range: { min: 2, max: 2 } + +resources: + server_volume_attach_group: + type: OS::Heat::ResourceGroup + properties: + count: { get_param: mobt_vol_count } + resource_def: + type: hot_mobt_volume_attach_nested.yaml + properties: + mobt_vol_index: "%index%" + server_mobt_group_ids: { get_attr: [ server_mobt_group_data, mobt_server_adm_x_id ] } + update_policy: + batch_create: + max_batch_size: 1 diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/tree/nested_volume/hot_mobt_volume_attach_nested.yaml b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/tree/nested_volume/hot_mobt_volume_attach_nested.yaml new file mode 100644 index 0000000000..8e6d07f899 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/tree/nested_volume/hot_mobt_volume_attach_nested.yaml @@ -0,0 +1,28 @@ +heat_template_version: 2014-10-16 + +description: nested heat template that associtate the cinder volumes to OAM nodes stack + +parameters: + mobt_volume_ids: + type: comma_delimited_list + label: MOBT OAM Cinder Volumes + description: MOBT OAM Cinder Volumes + + server_mobt_group_ids: + type: comma_delimited_list + label: MOBT OAM Resource Group + description: MOBT OAM Resource Group + + mobt_vol_index: + type: number + label: ADM volume index + description: ADM volume UUID in list + +resources: + mobt_adm_vol_attachment_x: + type: OS::Cinder::VolumeAttachment + properties: + volume_id: { get_param: [ mobt_volume_ids, get_param: mobt_vol_index ]} + mountpoint: /dev/vdb + instance_uuid: { get_param: [ server_mobt_group_ids, get_param: mobt_vol_index ]} + diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/tree/valid_tree/input/MANIFEST.json b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/tree/valid_tree/input/MANIFEST.json new file mode 100644 index 0000000000..a4065d0b68 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/tree/valid_tree/input/MANIFEST.json @@ -0,0 +1,39 @@ +{ + "data": [ + { + "file": "validHeat.yaml", + "type": "HEAT", + "data": [ + { + "file": "hot-nimbus-oam_v1.0.env", + "type": "HEAT_ENV" + }, + { + "file": "hot-nimbus-oam-volumes_v1.0", + "type": "HEAT_VOL", + "data": [{ + "file": "hot-nimbus-oam-volumes_v1.0.env", + "type": "HEAT_ENV" + }] + } + ] + }, + { + "file": "mainValid.yaml", + "type": "HEAT", + "data": [ + { + "file": "hot-nimbus-oam-networks_v1.0", + "type": "HEAT_NET" + } + ] + }, + { + "file": "missingHeatFromZip.yaml.yaml", + "type": "HEAT" + } + ], + "description": "RXAEmleoRDWLeWVvmXUJxDKCItgjkMEXuKJcUWyVUZrCUiMzZSyHPzhqLcJSIUNBzohsIGXLBIwstuVDEuFtxuLIwWgCCdjprtvzruHIUKdVnCyifJQUJjqSCoKKKyVaWFTFKzHNhTZNlZTYaMKGEpIMXOpIxSyTZZCgVsGkItQelBbFVrmCltTgkuppYMrEfvwqNBLVRSGCucNwliWFZUuXloXBiZaqtodZjyFpqBNqhlpcrARmMpvLiz", + "name": "FCTRQGcMevNngRDvECQYfiEXCYbGeAWRHdaGggLUgyOnssHAiU", + "version": "2013-05-23" +}
\ No newline at end of file diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/tree/valid_tree/input/heat_missing_from_manifast.yaml b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/tree/valid_tree/input/heat_missing_from_manifast.yaml new file mode 100644 index 0000000000..d5608abfb4 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/tree/valid_tree/input/heat_missing_from_manifast.yaml @@ -0,0 +1,250 @@ +### Heat Template ### +description: Generated template +heat_template_version: 2013-05-23 +parameters: {} +resources: + network_0: + properties: + admin_state_up: true + name: NET_167 + shared: true + type: OS::Neutron::Net + network_1: + properties: + admin_state_up: true + name: NET_169 + shared: true + type: OS::Neutron::Net + network_2: + properties: + admin_state_up: true + name: NET_166 + shared: true + type: OS::Neutron::Net + network_3: + properties: + admin_state_up: true + name: NET_168 + shared: true + type: OS::Neutron::Net + network_4: + properties: + admin_state_up: true + name: NET_169 + shared: true + type: OS::Neutron::Net + network_5: + properties: + admin_state_up: true + name: NET_170 + shared: true + type: OS::Neutron::Net + network_6: + properties: + admin_state_up: true + name: NET_168 + shared: true + type: OS::Neutron::Net + network_7: + properties: + admin_state_up: true + name: NET_170 + shared: true + type: OS::Neutron::Net + network_8: + properties: + admin_state_up: true + name: NET_166 + shared: true + type: OS::Neutron::Net + network_9: + properties: + admin_state_up: true + name: NET_167 + shared: true + type: OS::Neutron::Net + security_group_0: + properties: + description: Default security group + name: _default + rules: + - direction: ingress + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + - direction: egress + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + type: OS::Neutron::SecurityGroup + security_group_1: + properties: + description: Default security group + name: _default + rules: + - direction: egress + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + - direction: ingress + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + type: OS::Neutron::SecurityGroup + subnet_0: + properties: + allocation_pools: + - end: 10.147.32.254 + start: 10.147.32.130 + cidr: 10.147.32.128/25 + dns_nameservers: + - 10.147.4.18 + - 10.247.5.11 + enable_dhcp: true + host_routes: [] + ip_version: 4 + name: NET_167 + network_id: + get_resource: network_9 + type: OS::Neutron::Subnet + subnet_1: + properties: + allocation_pools: + - end: 10.147.32.254 + start: 10.147.32.130 + cidr: 10.147.32.128/25 + dns_nameservers: + - 10.147.4.18 + - 10.247.5.11 + enable_dhcp: true + host_routes: [] + ip_version: 4 + name: NET_167 + network_id: + get_resource: network_0 + type: OS::Neutron::Subnet + subnet_2: + properties: + allocation_pools: + - end: 10.147.32.126 + start: 10.147.32.2 + cidr: 10.147.32.0/25 + dns_nameservers: + - 10.147.4.18 + - 10.247.5.11 + enable_dhcp: true + host_routes: [] + ip_version: 4 + name: NET_166 + network_id: + get_resource: network_8 + type: OS::Neutron::Subnet + subnet_3: + properties: + allocation_pools: + - end: 10.147.32.126 + start: 10.147.32.2 + cidr: 10.147.32.0/25 + dns_nameservers: + - 10.147.4.18 + - 10.247.5.11 + enable_dhcp: true + host_routes: [] + ip_version: 4 + name: NET_166 + network_id: + get_resource: network_2 + type: OS::Neutron::Subnet + subnet_4: + properties: + allocation_pools: + - end: 10.147.34.126 + start: 10.147.34.2 + cidr: 10.147.34.0/25 + dns_nameservers: + - 10.147.4.18 + - 10.247.5.11 + enable_dhcp: true + host_routes: [] + ip_version: 4 + name: NET_170 + network_id: + get_resource: network_5 + type: OS::Neutron::Subnet + subnet_5: + properties: + allocation_pools: + - end: 10.147.33.126 + start: 10.147.33.2 + cidr: 10.147.33.0/25 + dns_nameservers: + - 10.147.4.18 + - 10.247.5.11 + enable_dhcp: true + host_routes: [] + ip_version: 4 + name: NET_168 + network_id: + get_resource: network_6 + type: OS::Neutron::Subnet + subnet_6: + properties: + allocation_pools: + - end: 10.147.33.126 + start: 10.147.33.2 + cidr: 10.147.33.0/25 + dns_nameservers: + - 10.147.4.18 + - 10.247.5.11 + enable_dhcp: true + host_routes: [] + ip_version: 4 + name: NET_168 + network_id: + get_resource: network_3 + type: OS::Neutron::Subnet + subnet_7: + properties: + allocation_pools: + - end: 10.147.33.254 + start: 10.147.33.130 + cidr: 10.147.33.128/25 + dns_nameservers: + - 10.147.4.18 + - 10.247.5.11 + enable_dhcp: true + host_routes: [] + ip_version: 4 + name: NET_169 + network_id: + get_resource: network_1 + type: OS::Neutron::Subnet + subnet_8: + properties: + allocation_pools: + - end: 10.147.33.254 + start: 10.147.33.130 + cidr: 10.147.33.128/25 + dns_nameservers: + - 10.147.4.18 + - 10.247.5.11 + enable_dhcp: true + host_routes: [] + ip_version: 4 + name: NET_169 + network_id: + get_resource: network_4 + type: OS::Neutron::Subnet + subnet_9: + properties: + allocation_pools: + - end: 10.147.34.126 + start: 10.147.34.2 + cidr: 10.147.34.0/25 + dns_nameservers: + - 10.147.4.18 + - 10.247.5.11 + enable_dhcp: true + host_routes: [] + ip_version: 4 + name: NET_170 + network_id: + get_resource: network_7 + type: OS::Neutron::Subnet + diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/tree/valid_tree/input/mainValid.yaml b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/tree/valid_tree/input/mainValid.yaml new file mode 100644 index 0000000000..318c8f1283 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/tree/valid_tree/input/mainValid.yaml @@ -0,0 +1,250 @@ +### Heat Template ### +description: Generated template +heat_template_version: 2013-05-23 +parameters: {} +resources: + network_0: + properties: + admin_state_up: true + name: NET_167 + shared: true + type: OS::Neutron::Net + network_1: + properties: + admin_state_up: true + name: NET_169 + shared: true + type: OS::Neutron::Net + network_2: + properties: + admin_state_up: true + name: NET_166 + shared: true + type: OS::Neutron::Net + network_3: + properties: + admin_state_up: true + name: NET_168 + shared: true + type: missingNested.yaml + network_4: + properties: + admin_state_up: true + name: { get_file: missing-artifact } + shared: true + type: OS::Neutron::Net + network_5: + properties: + admin_state_up: true + name: NET_170 + shared: true + type: OS::Neutron::Net + network_6: + properties: + admin_state_up: true + name: NET_168 + shared: true + type: OS::Neutron::Net + network_7: + properties: + admin_state_up: true + name: NET_170 + shared: true + type: OS::Neutron::Net + network_8: + properties: + admin_state_up: true + name: NET_166 + shared: true + type: OS::Neutron::Net + network_9: + properties: + admin_state_up: true + name: NET_167 + shared: true + type: OS::Neutron::Net + security_group_0: + properties: + description: Default security group + name: _default + rules: + - direction: ingress + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + - direction: egress + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + type: OS::Neutron::SecurityGroup + security_group_1: + properties: + description: Default security group + name: _default + rules: + - direction: egress + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + - direction: ingress + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + type: OS::Neutron::SecurityGroup + subnet_0: + properties: + allocation_pools: + - end: 10.147.32.254 + start: 10.147.32.130 + cidr: 10.147.32.128/25 + dns_nameservers: + - 10.147.4.18 + - 10.247.5.11 + enable_dhcp: true + host_routes: [] + ip_version: 4 + name: NET_167 + network_id: + get_resource: network_9 + type: OS::Neutron::Subnet + subnet_1: + properties: + allocation_pools: + - end: 10.147.32.254 + start: 10.147.32.130 + cidr: 10.147.32.128/25 + dns_nameservers: + - 10.147.4.18 + - 10.247.5.11 + enable_dhcp: true + host_routes: [] + ip_version: 4 + name: NET_167 + network_id: + get_resource: network_0 + type: OS::Neutron::Subnet + subnet_2: + properties: + allocation_pools: + - end: 10.147.32.126 + start: 10.147.32.2 + cidr: 10.147.32.0/25 + dns_nameservers: + - 10.147.4.18 + - 10.247.5.11 + enable_dhcp: true + host_routes: [] + ip_version: 4 + name: NET_166 + network_id: + get_resource: network_8 + type: OS::Neutron::Subnet + subnet_3: + properties: + allocation_pools: + - end: 10.147.32.126 + start: 10.147.32.2 + cidr: 10.147.32.0/25 + dns_nameservers: + - 10.147.4.18 + - 10.247.5.11 + enable_dhcp: true + host_routes: [] + ip_version: 4 + name: NET_166 + network_id: + get_resource: network_2 + type: OS::Neutron::Subnet + subnet_4: + properties: + allocation_pools: + - end: 10.147.34.126 + start: 10.147.34.2 + cidr: 10.147.34.0/25 + dns_nameservers: + - 10.147.4.18 + - 10.247.5.11 + enable_dhcp: true + host_routes: [] + ip_version: 4 + name: NET_170 + network_id: + get_resource: network_5 + type: OS::Neutron::Subnet + subnet_5: + properties: + allocation_pools: + - end: 10.147.33.126 + start: 10.147.33.2 + cidr: 10.147.33.0/25 + dns_nameservers: + - 10.147.4.18 + - 10.247.5.11 + enable_dhcp: true + host_routes: [] + ip_version: 4 + name: NET_168 + network_id: + get_resource: network_6 + type: OS::Neutron::Subnet + subnet_6: + properties: + allocation_pools: + - end: 10.147.33.126 + start: 10.147.33.2 + cidr: 10.147.33.0/25 + dns_nameservers: + - 10.147.4.18 + - 10.247.5.11 + enable_dhcp: true + host_routes: [] + ip_version: 4 + name: NET_168 + network_id: + get_resource: network_3 + type: OS::Neutron::Subnet + subnet_7: + properties: + allocation_pools: + - end: 10.147.33.254 + start: 10.147.33.130 + cidr: 10.147.33.128/25 + dns_nameservers: + - 10.147.4.18 + - 10.247.5.11 + enable_dhcp: true + host_routes: [] + ip_version: 4 + name: NET_169 + network_id: + get_resource: network_1 + type: OS::Neutron::Subnet + subnet_8: + properties: + allocation_pools: + - end: 10.147.33.254 + start: 10.147.33.130 + cidr: 10.147.33.128/25 + dns_nameservers: + - 10.147.4.18 + - 10.247.5.11 + enable_dhcp: true + host_routes: [] + ip_version: 4 + name: NET_169 + network_id: + get_resource: network_4 + type: OS::Neutron::Subnet + subnet_9: + properties: + allocation_pools: + - end: 10.147.34.126 + start: 10.147.34.2 + cidr: 10.147.34.0/25 + dns_nameservers: + - 10.147.4.18 + - 10.247.5.11 + enable_dhcp: true + host_routes: [] + ip_version: 4 + name: NET_170 + network_id: + get_resource: network_7 + type: OS::Neutron::Subnet + diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/tree/valid_tree/input/validHeat.yaml b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/tree/valid_tree/input/validHeat.yaml new file mode 100644 index 0000000000..d5608abfb4 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/tree/valid_tree/input/validHeat.yaml @@ -0,0 +1,250 @@ +### Heat Template ### +description: Generated template +heat_template_version: 2013-05-23 +parameters: {} +resources: + network_0: + properties: + admin_state_up: true + name: NET_167 + shared: true + type: OS::Neutron::Net + network_1: + properties: + admin_state_up: true + name: NET_169 + shared: true + type: OS::Neutron::Net + network_2: + properties: + admin_state_up: true + name: NET_166 + shared: true + type: OS::Neutron::Net + network_3: + properties: + admin_state_up: true + name: NET_168 + shared: true + type: OS::Neutron::Net + network_4: + properties: + admin_state_up: true + name: NET_169 + shared: true + type: OS::Neutron::Net + network_5: + properties: + admin_state_up: true + name: NET_170 + shared: true + type: OS::Neutron::Net + network_6: + properties: + admin_state_up: true + name: NET_168 + shared: true + type: OS::Neutron::Net + network_7: + properties: + admin_state_up: true + name: NET_170 + shared: true + type: OS::Neutron::Net + network_8: + properties: + admin_state_up: true + name: NET_166 + shared: true + type: OS::Neutron::Net + network_9: + properties: + admin_state_up: true + name: NET_167 + shared: true + type: OS::Neutron::Net + security_group_0: + properties: + description: Default security group + name: _default + rules: + - direction: ingress + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + - direction: egress + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + type: OS::Neutron::SecurityGroup + security_group_1: + properties: + description: Default security group + name: _default + rules: + - direction: egress + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + - direction: ingress + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + type: OS::Neutron::SecurityGroup + subnet_0: + properties: + allocation_pools: + - end: 10.147.32.254 + start: 10.147.32.130 + cidr: 10.147.32.128/25 + dns_nameservers: + - 10.147.4.18 + - 10.247.5.11 + enable_dhcp: true + host_routes: [] + ip_version: 4 + name: NET_167 + network_id: + get_resource: network_9 + type: OS::Neutron::Subnet + subnet_1: + properties: + allocation_pools: + - end: 10.147.32.254 + start: 10.147.32.130 + cidr: 10.147.32.128/25 + dns_nameservers: + - 10.147.4.18 + - 10.247.5.11 + enable_dhcp: true + host_routes: [] + ip_version: 4 + name: NET_167 + network_id: + get_resource: network_0 + type: OS::Neutron::Subnet + subnet_2: + properties: + allocation_pools: + - end: 10.147.32.126 + start: 10.147.32.2 + cidr: 10.147.32.0/25 + dns_nameservers: + - 10.147.4.18 + - 10.247.5.11 + enable_dhcp: true + host_routes: [] + ip_version: 4 + name: NET_166 + network_id: + get_resource: network_8 + type: OS::Neutron::Subnet + subnet_3: + properties: + allocation_pools: + - end: 10.147.32.126 + start: 10.147.32.2 + cidr: 10.147.32.0/25 + dns_nameservers: + - 10.147.4.18 + - 10.247.5.11 + enable_dhcp: true + host_routes: [] + ip_version: 4 + name: NET_166 + network_id: + get_resource: network_2 + type: OS::Neutron::Subnet + subnet_4: + properties: + allocation_pools: + - end: 10.147.34.126 + start: 10.147.34.2 + cidr: 10.147.34.0/25 + dns_nameservers: + - 10.147.4.18 + - 10.247.5.11 + enable_dhcp: true + host_routes: [] + ip_version: 4 + name: NET_170 + network_id: + get_resource: network_5 + type: OS::Neutron::Subnet + subnet_5: + properties: + allocation_pools: + - end: 10.147.33.126 + start: 10.147.33.2 + cidr: 10.147.33.0/25 + dns_nameservers: + - 10.147.4.18 + - 10.247.5.11 + enable_dhcp: true + host_routes: [] + ip_version: 4 + name: NET_168 + network_id: + get_resource: network_6 + type: OS::Neutron::Subnet + subnet_6: + properties: + allocation_pools: + - end: 10.147.33.126 + start: 10.147.33.2 + cidr: 10.147.33.0/25 + dns_nameservers: + - 10.147.4.18 + - 10.247.5.11 + enable_dhcp: true + host_routes: [] + ip_version: 4 + name: NET_168 + network_id: + get_resource: network_3 + type: OS::Neutron::Subnet + subnet_7: + properties: + allocation_pools: + - end: 10.147.33.254 + start: 10.147.33.130 + cidr: 10.147.33.128/25 + dns_nameservers: + - 10.147.4.18 + - 10.247.5.11 + enable_dhcp: true + host_routes: [] + ip_version: 4 + name: NET_169 + network_id: + get_resource: network_1 + type: OS::Neutron::Subnet + subnet_8: + properties: + allocation_pools: + - end: 10.147.33.254 + start: 10.147.33.130 + cidr: 10.147.33.128/25 + dns_nameservers: + - 10.147.4.18 + - 10.247.5.11 + enable_dhcp: true + host_routes: [] + ip_version: 4 + name: NET_169 + network_id: + get_resource: network_4 + type: OS::Neutron::Subnet + subnet_9: + properties: + allocation_pools: + - end: 10.147.34.126 + start: 10.147.34.2 + cidr: 10.147.34.0/25 + dns_nameservers: + - 10.147.4.18 + - 10.247.5.11 + enable_dhcp: true + host_routes: [] + ip_version: 4 + name: NET_170 + network_id: + get_resource: network_7 + type: OS::Neutron::Subnet + diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation/zips/emptyZip.zip b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation/zips/emptyZip.zip Binary files differnew file mode 100644 index 0000000000..15cb0ecb3e --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation/zips/emptyZip.zip diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation/zips/missingManifestInZip.zip b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation/zips/missingManifestInZip.zip Binary files differnew file mode 100644 index 0000000000..1d1e626efe --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation/zips/missingManifestInZip.zip diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation/zips/various/710-ResourceGroup.zip b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation/zips/various/710-ResourceGroup.zip Binary files differnew file mode 100644 index 0000000000..3bc82994c7 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation/zips/various/710-ResourceGroup.zip diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation/zips/various/MMSC.zip b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation/zips/various/MMSC.zip Binary files differnew file mode 100644 index 0000000000..8d8e669a87 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation/zips/various/MMSC.zip diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation/zips/various/MNS OAM FW.zip b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation/zips/various/MNS OAM FW.zip Binary files differnew file mode 100644 index 0000000000..d96a5b6e16 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation/zips/various/MNS OAM FW.zip diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation/zips/various/VOTA.zip b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation/zips/various/VOTA.zip Binary files differnew file mode 100644 index 0000000000..b224e3c6a4 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation/zips/various/VOTA.zip diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation/zips/various/base_module_mns_oam.zip b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation/zips/various/base_module_mns_oam.zip Binary files differnew file mode 100644 index 0000000000..6fa54ce544 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation/zips/various/base_module_mns_oam.zip diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation/zips/various/cmd-frwl-v302.zip b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation/zips/various/cmd-frwl-v302.zip Binary files differnew file mode 100644 index 0000000000..e169a8c0c3 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation/zips/various/cmd-frwl-v302.zip diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation/zips/various/noError/GWv12.zip b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation/zips/various/noError/GWv12.zip Binary files differnew file mode 100644 index 0000000000..cbf0adff5b --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation/zips/various/noError/GWv12.zip diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation/zips/various/noError/MNS OAM FW fix.zip b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation/zips/various/noError/MNS OAM FW fix.zip Binary files differnew file mode 100644 index 0000000000..6dfb222ba2 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation/zips/various/noError/MNS OAM FW fix.zip diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation/zips/various/noError/base_module_mns_oam_fixed.zip b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation/zips/various/noError/base_module_mns_oam_fixed.zip Binary files differnew file mode 100644 index 0000000000..5c25590a9b --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation/zips/various/noError/base_module_mns_oam_fixed.zip diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation/zips/various/noError/cmd-frwl-v302.zip b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation/zips/various/noError/cmd-frwl-v302.zip Binary files differnew file mode 100644 index 0000000000..02ce760ce2 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation/zips/various/noError/cmd-frwl-v302.zip diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation/zips/various/noError/vDBE_fix_with_warr.zip b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation/zips/various/noError/vDBE_fix_with_warr.zip Binary files differnew file mode 100644 index 0000000000..3ecde1ba3c --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation/zips/various/noError/vDBE_fix_with_warr.zip diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation/zips/various/noError/vDNS.zip b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation/zips/various/noError/vDNS.zip Binary files differnew file mode 100644 index 0000000000..0bd8efbec8 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation/zips/various/noError/vDNS.zip diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation/zips/various/segw_heat_c3-base.zip b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation/zips/various/segw_heat_c3-base.zip Binary files differnew file mode 100644 index 0000000000..cfc49b003f --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation/zips/various/segw_heat_c3-base.zip diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation/zips/various/vDBE.zip b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation/zips/various/vDBE.zip Binary files differnew file mode 100644 index 0000000000..10ee113631 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation/zips/various/vDBE.zip diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation/zips/various/vDNS.zip b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation/zips/various/vDNS.zip Binary files differnew file mode 100644 index 0000000000..c5fcf72d64 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation/zips/various/vDNS.zip diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation/zips/various/vDNS_21_8.zip b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation/zips/various/vDNS_21_8.zip Binary files differnew file mode 100644 index 0000000000..c5fcf72d64 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation/zips/various/vDNS_21_8.zip diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation/zips/various/vProb.zip b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation/zips/various/vProb.zip Binary files differnew file mode 100644 index 0000000000..86472e23fd --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation/zips/various/vProb.zip diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation/zips/various/vProbe_FE_081816.zip b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation/zips/various/vProbe_FE_081816.zip Binary files differnew file mode 100644 index 0000000000..578c561e4c --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation/zips/various/vProbe_FE_081816.zip diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation/zips/various/vid_test_pcrf_base_template.zip b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation/zips/various/vid_test_pcrf_base_template.zip Binary files differnew file mode 100644 index 0000000000..49c16f6774 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation/zips/various/vid_test_pcrf_base_template.zip diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation/zips/zipFileWithFolder.zip b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation/zips/zipFileWithFolder.zip Binary files differnew file mode 100644 index 0000000000..9d2fb1e8ab --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation/zips/zipFileWithFolder.zip diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager/zips/emptyComposition.zip b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager/zips/emptyComposition.zip Binary files differnew file mode 100644 index 0000000000..76b3bfd873 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager/zips/emptyComposition.zip diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager/zips/emptyZip.zip b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager/zips/emptyZip.zip Binary files differnew file mode 100644 index 0000000000..15cb0ecb3e --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager/zips/emptyZip.zip diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager/zips/fullComposition.zip b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager/zips/fullComposition.zip Binary files differnew file mode 100644 index 0000000000..027f2c039a --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager/zips/fullComposition.zip diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager/zips/invalidTypes.zip b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager/zips/invalidTypes.zip Binary files differnew file mode 100644 index 0000000000..5addd97cd3 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager/zips/invalidTypes.zip diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager/zips/legalUpload.zip b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager/zips/legalUpload.zip Binary files differnew file mode 100644 index 0000000000..b4396f834d --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager/zips/legalUpload.zip diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager/zips/legalUpload2.zip b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager/zips/legalUpload2.zip Binary files differnew file mode 100644 index 0000000000..1f264c3bd7 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager/zips/legalUpload2.zip diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager/zips/missingYml.zip b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager/zips/missingYml.zip Binary files differnew file mode 100644 index 0000000000..5bc0bea15d --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager/zips/missingYml.zip diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager/zips/nimbus.zip b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager/zips/nimbus.zip Binary files differnew file mode 100644 index 0000000000..000b154ceb --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager/zips/nimbus.zip diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager/zips/vDNS.zip b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager/zips/vDNS.zip Binary files differnew file mode 100644 index 0000000000..c5fcf72d64 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager/zips/vDNS.zip diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager/zips/withoutManifest.zip b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager/zips/withoutManifest.zip Binary files differnew file mode 100644 index 0000000000..6b52cf6065 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager/zips/withoutManifest.zip diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager/zips/zipFileWithFolder.zip b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager/zips/zipFileWithFolder.zip Binary files differnew file mode 100644 index 0000000000..9d2fb1e8ab --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager/zips/zipFileWithFolder.zip diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/withNetwork/MANIFEST.json b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/withNetwork/MANIFEST.json new file mode 100644 index 0000000000..3d7004f8c0 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/withNetwork/MANIFEST.json @@ -0,0 +1,21 @@ +{ + "name": "hot-mog", + "description": "HOT template to create hot mog server", + "version": "2013-05-23", + "data": [ + { + "file": "hot-mog-0108-bs1271.yml", + "type": "HEAT", + "data": [ + { + "file": "hot-mog-0108-bs1271.env", + "type": "HEAT_ENV" + } + ] + }, + { + "file": "network.yml", + "type": "HEAT_NET" + } + ] +} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/withNetwork/hot-mog-0108-bs1271.env b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/withNetwork/hot-mog-0108-bs1271.env new file mode 100644 index 0000000000..407bc8db30 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/withNetwork/hot-mog-0108-bs1271.env @@ -0,0 +1,60 @@ +parameters: + pd_server_names: ZRDM1MOGX01MPD001,ZRDM1MOGX01MPD002 + pd_image_name: MOG_BASE_8.0 + pd_flavor_name: m3.xlarge + oam_server_names: ZRDM1MOGX01OAM001,ZRDM1MOGX01OAM002 + oam_image_name: MOG_BASE_8.0 + oam_flavor_name: m3.xlarge + sm_server_names: ZRDM1MOGX01MSM001,ZRDM1MOGX01MSM002 + sm_image_name: MOG_BASE_8.0 + sm_flavor_name: m2.xlarge4 + ps_server_names: ZRDM1MOGX01MPS001,ZRDM1MOGX01MPS002,ZRDM1MOGX01MPS003,ZRDM1MOGX01MPS004 + ps_image_name: MOG_BASE_8.0 + ps_flavor_name: m3.xlarge + cm_server_names: ZRDM1MOGX01MCM001 + cm_image_name: MOG_BASE_8.0 + cm_flavor_name: m3.xlarge + availabilityzone_name: nova + oam_net_name: oam_protected_net_0 + oam_net_ips: 107.250.172.213,107.250.172.214,107.250.172.215,107.250.172.216,107.250.172.217 + #internet_net_name: dmz_protected_net_0 + #internet_net_ips: 107.239.53.4,107.239.53.5 + # internet_net_floating_ip: 107.239.53.6 + sl_net_name: exn_protected_net_0 + sl_net_ips: 107.239.45.4,107.239.45.5 + sl_net_floating_ip: 107.239.45.6 + repl_net_name: cor_direct_net_0 + repl_net_ips: 107.239.33.57,107.239.33.58 + rx_net_name: cor_direct_net_1 + rx_net_ips: 107.239.34.3,107.239.34.4 + rx_net_floating_ip: 107.239.34.5 + ran_net_name: gn_direct_net_0 + ran_net_ips: 107.239.36.3,107.239.36.4 + ran_net_floating_ip: 107.239.36.5 + dummy_net_name_0: mog_dummy_0 + dummy_net_start_0: 169.254.1.4 + dummy_net_end_0: 169.254.1.254 + dummy_net_cidr_0: 169.254.1.0/24 + dummy_net_netmask_0: 255.255.255.0 + dummy_net_name_1: mog_dummy_1 + dummy_net_start_1: 169.254.2.4 + dummy_net_end_1: 169.254.2.254 + dummy_net_cidr_1: 169.254.2.0/24 + dummy_net_netmask_1: 255.255.255.0 + csb_net_name: int_mog_csb_net + csb_net_ips: 172.26.0.10,172.26.0.11,172.26.0.12,172.26.0.13,172.26.0.14,172.26.0.15,172.26.0.16,172.26.0.17,172.26.0.18,172.26.0.19,172.26.0.20 + csb_net_start: 172.26.0.1 + csb_net_end: 172.26.0.254 + csb_net_cidr: 172.26.0.0/24 + csb_net_netmask: 255.255.255.0 + security_group_name: mog_security_group + mog_swift_container: http://10.147.38.210:8080/v1/AUTH_8e501b8121f34a6eaaf526d3305985cc/mogtestcontainer + mog_script_dir: /root + mog_script_name: http://10.147.38.210:8080/v1/AUTH_8e501b8121f34a6eaaf526d3305985cc/mogtestcontainer/mog-cloudinit.sh + mog_parameter_name: http://10.147.38.210:8080/v1/AUTH_8e501b8121f34a6eaaf526d3305985cc/mogtestcontainer + cluster-manager-vol-1: 43ccf5ba-2d50-427b-a38f-e8c7d8670eee + session-manager-vol-1: 49201898-333d-4c88-b58d-cf573b091633 + session-manager-vol-2: 4c35b5f1-ce99-4220-a6e2-cda6e2d713a0 + oam-vol-1: 0a7fcd9e-2624-401d-ac21-b0191f85ec77 + oam-vol-2: 6d169cb6-6ddc-41dc-920c-2839898a2924 + cluster-manager-vol-2: 6f92e211-2d61-487d-8f84-d2d00cea3698 diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/withNetwork/hot-mog-0108-bs1271.yml b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/withNetwork/hot-mog-0108-bs1271.yml new file mode 100644 index 0000000000..f069d4dd23 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/withNetwork/hot-mog-0108-bs1271.yml @@ -0,0 +1,733 @@ +heat_template_version: 2013-05-23 + +description: heat template that creates MOG stack + +parameters: + pd_server_names: + type: comma_delimited_list + label: PD server names + description: name of the PD instance + pd_image_name: + type: string + label: image name + description: PD image name + pd_flavor_name: + type: string + label: PD flavor name + description: flavor name of PD instance + oam_server_names: + type: comma_delimited_list + label: OAM server names + description: name of the OAM instance + oam_image_name: + type: string + label: image name + description: OAM image name + oam_flavor_name: + type: string + label: OAM flavor name + description: flavor name of OAM instance + sm_server_names: + type: comma_delimited_list + label: SM server names + description: name of the SM instance + sm_image_name: + type: string + label: image name + description: SM image name + sm_flavor_name: + type: string + label: SM flavor name + description: flavor name of SM instance + ps_server_names: + type: comma_delimited_list + label: PS server names + description: name of the PS instance + ps_image_name: + type: string + label: PS image name + description: PS image name + ps_flavor_name: + type: string + label: PS flavor name + description: flavor name of PS instance + cm_server_names: + type: comma_delimited_list + label: CM server names + description: name of the CM instance + cm_image_name: + type: string + label: image name + description: CM image name + cm_flavor_name: + type: string + label: CM flavor name + description: flavor name of CM instance + availabilityzone_name: + type: string + label: availabilityzone name + description: availabilityzone name + oam_net_name: + type: string + label: oam network name + description: name of the oam network + oam_net_ips: + type: comma_delimited_list + label: internet network ips + description: ip of the OAM network + # internet_net_name: + # type: string + # label: internet network name + # description: id of the internet network + # internet_net_ips: + # type: comma_delimited_list + # label: internet network ips + # description: ip of the internet network + # internet_net_floating_ip: + # type: string + # label: mog internet virtual ip + # description: mog internet virtual ip + sl_net_name: + type: string + label: silver lining network name + description: id of the sl network + sl_net_ips: + type: comma_delimited_list + label: silver lining network ips + description: ips of the sl network + sl_net_floating_ip: + type: string + label: mog sl net virtual ip + description: mog sl net virtual ip + repl_net_name: + type: string + label: Replication network name + description: name of the replication network + repl_net_ips: + type: comma_delimited_list + label: repl network ips + description: ips of repl network + rx_net_name: + type: string + label: Rx network name + description: Rx network name + rx_net_ips: + type: comma_delimited_list + label: Rx network ips + description: Rx network ips + rx_net_floating_ip: + type: string + label: mog rx net virtual ip + description: mog rx net virtual ip + ran_net_name: + type: string + label: RAN network name + description: RAN network name + ran_net_ips: + type: comma_delimited_list + label: RAN network ips + description: RAN network ip + ran_net_floating_ip: + type: string + label: mog ran net virtual ip + description: mog ran net virtual ip + csb_net_name: + type: string + label: csb internal network name + description: csb internal network name + csb_net_start: + type: string + label: csb internal start + description: csb internal start + csb_net_end: + type: string + label: csb internal end + description: csb internal end + csb_net_cidr: + type: string + label: csb ineternal cidr + description: csb internal cidr + csb_net_netmask: + type: string + description: CSB internal network subnet mask + csb_net_ips: + type: comma_delimited_list + description: mog_csb_net IP addresses + dummy_net_name_0: + type: string + label: csb internal network name + description: csb internal network name + dummy_net_start_0: + type: string + label: csb internal start + description: csb internal start + dummy_net_end_0: + type: string + label: csb internal end + description: csb internal end + dummy_net_cidr_0: + type: string + label: csb ineternal cidr + description: csb internal cidr + dummy_net_netmask_0: + type: string + description: CSB internal network subnet mask + dummy_net_name_1: + type: string + label: csb internal network name + description: csb internal network name + dummy_net_start_1: + type: string + label: csb internal start + description: csb internal start + dummy_net_end_1: + type: string + label: csb internal end + description: csb internal end + dummy_net_cidr_1: + type: string + label: csb ineternal cidr + description: csb internal cidr + dummy_net_netmask_1: + type: string + description: CSB internal network subnet mask + + security_group_name: + type: string + label: security group name + description: the name of security group + cluster-manager-vol-1: + type: string + label: mog-cm-vol-1 + description: Cluster Manager volume 1 + session-manager-vol-1: + type: string + label: mog-sm-vol-1 + description: Session Manager volume 1 + session-manager-vol-2: + type: string + label: mog-sm-vol-2 + description: Session Manager volume 2 + oam-vol-1: + type: string + label: mog-oam-vol-1 + description: OAM volume 1 + oam-vol-2: + type: string + label: mog-oam-vol-2 + description: OAM volume 2 + mog_swift_container: + type: string + label: mog Config URL + description: Config URL + mog_script_dir: + type: string + label: mog Config script directory + description: Config script directory + mog_script_name: + type: string + label: mog Config script name + description: Config script name + mog_parameter_name: + type: string + label: mog script parameter name + description: Config script parameter csv file name + cluster-manager-vol-2: + type: string + label: mog-cm-vol-2 + description: Cluster Manager volume 2 with ISO image + +resources: + mog_security_group: + type: OS::Neutron::SecurityGroup + properties: + description: mog security group + name: {get_param: security_group_name} + rules: [{"direction": egress, "ethertype": IPv4, "port_range_min": 1, "port_range_max": 65535, "protocol": tcp, "remote_ip_prefix": 0.0.0.0/0}, + {"direction": egress, "ethertype": IPv4, "port_range_min": 1, "port_range_max": 65535, "protocol": udp, "remote_ip_prefix": 0.0.0.0/0}, + {"direction": egress, "ethertype": IPv4, "protocol": icmp, "remote_ip_prefix": 0.0.0.0/0}, + {"direction": ingress, "ethertype": IPv4, "port_range_min": 1, "port_range_max": 65535, "protocol": tcp, "remote_ip_prefix": 0.0.0.0/0}, + {"direction": ingress, "ethertype": IPv4, "port_range_min": 1, "port_range_max": 65535, "protocol": udp, "remote_ip_prefix": 0.0.0.0/0}, + {"direction": ingress, "ethertype": IPv4, "protocol": icmp, "remote_ip_prefix": 0.0.0.0/0} + ] + + csb_net: + type: OS::Contrail::VirtualNetwork + properties: + name: { get_param: csb_net_name} + + csb_ip_subnet: + type: OS::Neutron::Subnet + properties: + name: {get_param: csb_net_name} + network_id: { get_resource: csb_net } + cidr: { get_param: csb_net_cidr } + allocation_pools: [{"start": {get_param: csb_net_start}, "end": {get_param: csb_net_end}}] + enable_dhcp: true + + dummy_net_0: + type: OS::Contrail::VirtualNetwork + properties: + name: { get_param: dummy_net_name_0} + + dummy_ip_subnet_0: + type: OS::Neutron::Subnet + properties: + name: {get_param: dummy_net_name_0} + network_id: { get_resource: dummy_net_0 } + cidr: { get_param: dummy_net_cidr_0 } + allocation_pools: [{"start": {get_param: dummy_net_start_0}, "end": {get_param: dummy_net_end_0}}] + enable_dhcp: true + + dummy_net_1: + type: OS::Contrail::VirtualNetwork + properties: + name: { get_param: dummy_net_name_1} + + dummy_ip_subnet_1: + type: OS::Neutron::Subnet + properties: + name: {get_param: dummy_net_name_1} + network_id: { get_resource: dummy_net_1 } + cidr: { get_param: dummy_net_cidr_1 } + allocation_pools: [{"start": {get_param: dummy_net_start_1}, "end": {get_param: dummy_net_end_1}}] + enable_dhcp: true + + + mogconfig: + type: OS::Heat::SoftwareConfig + properties: + group: ungrouped + config: + str_replace: + template: | + #!/bin/bash + wget -P script_dir swift_container/script_name + wget -P script_dir swift_container/parameter_name + chmod 755 script_dir/script_name + script_dir/script_name + params: + swift_container: {get_param: mog_swift_container} + script_dir: {get_param: mog_script_dir} + script_name: {get_param: mog_script_name} + #parameter_name: {get_param: mog_parameter_name} + + + servergroup_mog01: + type: OS::Nova::ServerGroup + properties: + policies: + - anti-affinity + server_pd_01: + type: OS::Nova::Server + properties: +# config_drive: "True" + name: {get_param: [pd_server_names, 0]} + image: {get_param: pd_image_name} + flavor: {get_param: pd_flavor_name} + availability_zone: {get_param: availabilityzone_name} + networks: + - port: {get_resource: pd01_port_0} + - port: {get_resource: pd01_port_1} + - port: {get_resource: pd01_port_2} + - port: {get_resource: pd01_port_3} + - port: {get_resource: pd01_port_4} + - port: {get_resource: pd01_port_5} + - port: {get_resource: pd01_port_6} + # - port: {get_resource: pd01_port_7} + user_data: + scheduler_hints: {group: {get_resource: servergroup_mog01}} + user_data_format: RAW + + + pd01_port_0: + type: OS::Neutron::Port + properties: + network: {get_resource: csb_net} + security_groups: [{get_resource: mog_security_group}] + pd01_port_1: + type: OS::Neutron::Port + properties: + network: {get_param: oam_net_name} + fixed_ips: [{"ip_address": {get_param: [oam_net_ips, 0]}}] + security_groups: [{get_resource: mog_security_group}] + pd01_port_2: + type: OS::Neutron::Port + properties: + network: {get_resource: dummy_net_0} + security_groups: [{get_resource: mog_security_group}] + pd01_port_3: + type: OS::Neutron::Port + properties: + network: {get_param: rx_net_name} + fixed_ips: [{"ip_address": {get_param: [rx_net_ips, 0]}}] + allowed_address_pairs: [{"ip_address": {get_param: rx_net_floating_ip} }] + security_groups: [{get_resource: mog_security_group}] + pd01_port_4: + type: OS::Neutron::Port + properties: + network: {get_resource: dummy_net_1} + security_groups: [{get_resource: mog_security_group}] + pd01_port_5: + type: OS::Neutron::Port + properties: + network: {get_param: ran_net_name} + fixed_ips: [{"ip_address": {get_param: [ran_net_ips, 0]}}] + allowed_address_pairs: [{"ip_address": {get_param: ran_net_floating_ip} }] + security_groups: [{get_resource: mog_security_group}] + + pd01_port_6: + type: OS::Neutron::Port + properties: + network: {get_param: sl_net_name} + fixed_ips: [{"ip_address": {get_param: [sl_net_ips, 0]}}] + allowed_address_pairs: [{"ip_address": {get_param: sl_net_floating_ip}}] + security_groups: [{get_resource: mog_security_group}] + + # pd01_port_7: + #j type: OS::Neutron::Port + # properties: + # network: {get_param: internet_net_name} + # fixed_ips: [{"ip_address": {get_param: [internet_net_ips, 0]}}] + # allowed_address_pairs: [{"ip_address": {get_param: internet_net_floating_ip} }] + # security_groups: [{get_resource: mog_security_group}] + + server_pd_02: + type: OS::Nova::Server + properties: +# config_drive: "True" + name: {get_param: [pd_server_names, 1]} + image: {get_param: pd_image_name} + flavor: {get_param: pd_flavor_name} + availability_zone: {get_param: availabilityzone_name} + networks: + - port: {get_resource: pd02_port_0} + - port: {get_resource: pd02_port_1} + - port: {get_resource: pd01_port_2} + - port: {get_resource: pd01_port_3} + - port: {get_resource: pd02_port_4} + - port: {get_resource: pd02_port_5} + - port: {get_resource: pd02_port_6} + # - port: {get_resource: pd02_port_7} + + user_data: + scheduler_hints: {group: {get_resource: servergroup_mog01}} + user_data_format: RAW + + pd02_port_0: + type: OS::Neutron::Port + properties: + network: {get_resource: csb_net} + security_groups: [{get_resource: mog_security_group}] + + pd02_port_1: + type: OS::Neutron::Port + properties: + network: {get_param: oam_net_name} + fixed_ips: [{"ip_address": {get_param: [oam_net_ips, 1]}}] + security_groups: [{get_resource: mog_security_group}] + + pd02_port_2: + type: OS::Neutron::Port + properties: + network: {get_resource: dummy_net_0} + security_groups: [{get_resource: mog_security_group}] + + pd02_port_3: + type: OS::Neutron::Port + properties: + network: {get_param: rx_net_name} + fixed_ips: [{"ip_address": {get_param: [rx_net_ips, 1]}}] + allowed_address_pairs: [{"ip_address": {get_param: rx_net_floating_ip} }] + security_groups: [{get_resource: mog_security_group}] + + pd02_port_4: + type: OS::Neutron::Port + properties: + network: {get_resource: dummy_net_1} + security_groups: [{get_resource: mog_security_group}] + + pd02_port_5: + type: OS::Neutron::Port + properties: + network: {get_param: ran_net_name} + fixed_ips: [{"ip_address": {get_param: [ran_net_ips, 1]}}] + allowed_address_pairs: [{"ip_address": {get_param: ran_net_floating_ip} }] + security_groups: [{get_resource: mog_security_group}] + + pd02_port_6: + type: OS::Neutron::Port + properties: + network: {get_param: sl_net_name} + fixed_ips: [{"ip_address": {get_param: [sl_net_ips, 1]}}] + allowed_address_pairs: [{"ip_address": {get_param: sl_net_floating_ip}}] + security_groups: [{get_resource: mog_security_group}] + + # pd02_port_7: + # type: OS::Neutron::Port + # properties: + # network: {get_param: internet_net_name} + # fixed_ips: [{"ip_address": {get_param: [internet_net_ips, 1]}}] + # allowed_address_pairs: [{"ip_address": {get_param: internet_net_floating_ip} }] + # security_groups: [{get_resource: mog_security_group}] + + servergroup_mog02: + type: OS::Nova::ServerGroup + properties: + policies: + - anti-affinity + server_oam01: + type: OS::Nova::Server + properties: +# config_drive: "True" + name: {get_param: [oam_server_names, 0]} + image: {get_param: oam_image_name} + flavor: {get_param: oam_flavor_name} + availability_zone: {get_param: availabilityzone_name} + networks: + - port: {get_resource: oam01_port_0} + - port: {get_resource: oam01_port_1} +# block_device_mapping: +# - device_name: vdd +# volume_id: { get_param: oam-vol-1 } + user_data: + scheduler_hints: {group: {get_resource: servergroup_mog02}} + user_data_format: RAW + + oam01_port_0: + type: OS::Neutron::Port + properties: + network: {get_resource: csb_net} + security_groups: [{get_resource: mog_security_group}] + + oam01_port_1: + type: OS::Neutron::Port + properties: + network: {get_param: oam_net_name} + fixed_ips: [{"ip_address": {get_param: [oam_net_ips, 2]}}] + security_groups: [{get_resource: mog_security_group}] + + + server_oam02: + type: OS::Nova::Server + properties: +# config_drive: "True" + name: {get_param: [oam_server_names, 1]} + image: {get_param: oam_image_name} + flavor: {get_param: oam_flavor_name} + availability_zone: {get_param: availabilityzone_name} + networks: + - port: {get_resource: oam02_port_0} + - port: {get_resource: oam02_port_1} +# block_device_mapping: +# - device_name: vdd +# volume_id: { get_param: oam-vol-2 } + user_data: + scheduler_hints: {group: {get_resource: servergroup_mog02}} + user_data_format: RAW + + oam02_port_0: + type: OS::Neutron::Port + properties: + network: {get_resource: csb_net} + security_groups: [{get_resource: mog_security_group}] + + oam02_port_1: + type: OS::Neutron::Port + properties: + network: {get_param: oam_net_name} + fixed_ips: [{"ip_address": {get_param: [oam_net_ips, 3]}}] + security_groups: [{get_resource: mog_security_group}] + + + server_sm01: + type: OS::Nova::Server + properties: +# config_drive: "True" + name: {get_param: [sm_server_names, 0]} + image: {get_param: sm_image_name} + flavor: {get_param: sm_flavor_name} + availability_zone: {get_param: availabilityzone_name} + networks: + - port: {get_resource: sm01_port_0} + - port: {get_resource: sm01_port_1} +# block_device_mapping: +# - device_name: vdd +# volume_id: { get_param: session-manager-vol-1 } + user_data: + scheduler_hints: {group: {get_resource: servergroup_mog02}} + user_data_format: RAW + + sm01_port_0: + type: OS::Neutron::Port + properties: + network: {get_resource: csb_net} + security_groups: [{get_resource: mog_security_group}] + + sm01_port_1: + type: OS::Neutron::Port + properties: + network: {get_resource: dummy_net_0} + security_groups: [{get_resource: mog_security_group}] + + sm01_port_2: + type: OS::Neutron::Port + properties: + network: {get_param: repl_net_name} + fixed_ips: [{"ip_address": {get_param: [repl_net_ips, 0]}}] + security_groups: [{get_resource: mog_security_group}] + + server_sm02: + type: OS::Nova::Server + properties: +# config_drive: "True" + name: {get_param: [sm_server_names, 1]} + image: {get_param: sm_image_name} + flavor: {get_param: sm_flavor_name} + availability_zone: {get_param: availabilityzone_name} +# block_device_mapping: +# - device_name: vdd +# volume_id: { get_param: session-manager-vol-2 } + networks: + - port: {get_resource: sm02_port_0} + - port: {get_resource: sm02_port_1} + user_data: + scheduler_hints: {group: {get_resource: servergroup_mog02}} + user_data_format: RAW + + sm02_port_0: + type: OS::Neutron::Port + properties: + network: {get_resource: csb_net} + security_groups: [{get_resource: mog_security_group}] + + sm02_port_1: + type: OS::Neutron::Port + properties: + network: {get_resource: dummy_net_0} + security_groups: [{get_resource: mog_security_group}] + + sm02_port_2: + type: OS::Neutron::Port + properties: + network: {get_param: repl_net_name} + fixed_ips: [{"ip_address": {get_param: [repl_net_ips, 1]}}] + security_groups: [{get_resource: mog_security_group}] + + servergroup_mog03: + type: OS::Nova::ServerGroup + properties: + policies: + - anti-affinity + server_ps01: + type: OS::Nova::Server + properties: +# config_drive: "True" + name: {get_param: [ps_server_names, 0]} + image: {get_param: ps_image_name} + flavor: {get_param: ps_flavor_name} + availability_zone: {get_param: availabilityzone_name} + networks: + - port: {get_resource: ps01_port_0} + user_data: + scheduler_hints: {group: {get_resource: servergroup_mog03}} + user_data_format: RAW + + ps01_port_0: + type: OS::Neutron::Port + properties: + network: {get_resource: csb_net} + security_groups: [{get_resource: mog_security_group}] + + server_ps02: + type: OS::Nova::Server + properties: +# config_drive: "True" + name: {get_param: [ps_server_names, 1]} + image: {get_param: ps_image_name} + flavor: {get_param: ps_flavor_name} + availability_zone: {get_param: availabilityzone_name} + networks: + - port: {get_resource: ps02_port_0} + user_data: + scheduler_hints: {group: {get_resource: servergroup_mog03}} + user_data_format: RAW + + ps02_port_0: + type: OS::Neutron::Port + properties: + network: {get_resource: csb_net} + security_groups: [{get_resource: mog_security_group}] + + server_ps03: + type: OS::Nova::Server + properties: + name: {get_param: [ps_server_names, 2]} + image: {get_param: ps_image_name} + flavor: {get_param: ps_flavor_name} + availability_zone: {get_param: availabilityzone_name} + networks: + - port: {get_resource: ps03_port_0} + user_data: + scheduler_hints: {group: {get_resource: servergroup_mog03}} + user_data_format: RAW + + ps03_port_0: + type: OS::Neutron::Port + properties: + network: {get_resource: csb_net} + security_groups: [{get_resource: mog_security_group}] + + server_ps04: + type: OS::Nova::Server + properties: + name: {get_param: [ps_server_names, 3]} + image: {get_param: ps_image_name} + flavor: {get_param: ps_flavor_name} + availability_zone: {get_param: availabilityzone_name} + networks: + - port: {get_resource: ps04_port_0} + user_data: + scheduler_hints: {group: {get_resource: servergroup_mog03}} + user_data_format: RAW + + ps04_port_0: + type: OS::Neutron::Port + properties: + network: {get_resource: csb_net} + security_groups: [{get_resource: mog_security_group}] + + server_cm01: + type: OS::Nova::Server + properties: +# config_drive: "True" + name: {get_param: [cm_server_names, 0]} + image: {get_param: cm_image_name} + flavor: {get_param: cm_flavor_name} + availability_zone: {get_param: availabilityzone_name} + networks: + - port: {get_resource: cm01_port_0} + - port: {get_resource: cm01_port_1} +# block_device_mapping: +# - device_name: vdd +# volume_id: { get_param: cluster-manager-vol-2 } +# - device_name: vde +# volume_id: { get_param: cluster-manager-vol-1 } + user_data: + scheduler_hints: {group: {get_resource: servergroup_mog03}} + user_data_format: RAW + + cm01_port_0: + type: OS::Neutron::Port + properties: + network: {get_resource: csb_net} + fixed_ips: [{"ip_address": {get_param: [csb_net_ips, 10]}}] + security_groups: [{get_resource: mog_security_group}] + + cm01_port_1: + type: OS::Neutron::Port + properties: + network: {get_param: oam_net_name} + fixed_ips: [{"ip_address": {get_param: [oam_net_ips, 4]}}] + security_groups: [{get_resource: mog_security_group}] + diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/withNetwork/network.yml b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/withNetwork/network.yml new file mode 100644 index 0000000000..f069d4dd23 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/withNetwork/network.yml @@ -0,0 +1,733 @@ +heat_template_version: 2013-05-23 + +description: heat template that creates MOG stack + +parameters: + pd_server_names: + type: comma_delimited_list + label: PD server names + description: name of the PD instance + pd_image_name: + type: string + label: image name + description: PD image name + pd_flavor_name: + type: string + label: PD flavor name + description: flavor name of PD instance + oam_server_names: + type: comma_delimited_list + label: OAM server names + description: name of the OAM instance + oam_image_name: + type: string + label: image name + description: OAM image name + oam_flavor_name: + type: string + label: OAM flavor name + description: flavor name of OAM instance + sm_server_names: + type: comma_delimited_list + label: SM server names + description: name of the SM instance + sm_image_name: + type: string + label: image name + description: SM image name + sm_flavor_name: + type: string + label: SM flavor name + description: flavor name of SM instance + ps_server_names: + type: comma_delimited_list + label: PS server names + description: name of the PS instance + ps_image_name: + type: string + label: PS image name + description: PS image name + ps_flavor_name: + type: string + label: PS flavor name + description: flavor name of PS instance + cm_server_names: + type: comma_delimited_list + label: CM server names + description: name of the CM instance + cm_image_name: + type: string + label: image name + description: CM image name + cm_flavor_name: + type: string + label: CM flavor name + description: flavor name of CM instance + availabilityzone_name: + type: string + label: availabilityzone name + description: availabilityzone name + oam_net_name: + type: string + label: oam network name + description: name of the oam network + oam_net_ips: + type: comma_delimited_list + label: internet network ips + description: ip of the OAM network + # internet_net_name: + # type: string + # label: internet network name + # description: id of the internet network + # internet_net_ips: + # type: comma_delimited_list + # label: internet network ips + # description: ip of the internet network + # internet_net_floating_ip: + # type: string + # label: mog internet virtual ip + # description: mog internet virtual ip + sl_net_name: + type: string + label: silver lining network name + description: id of the sl network + sl_net_ips: + type: comma_delimited_list + label: silver lining network ips + description: ips of the sl network + sl_net_floating_ip: + type: string + label: mog sl net virtual ip + description: mog sl net virtual ip + repl_net_name: + type: string + label: Replication network name + description: name of the replication network + repl_net_ips: + type: comma_delimited_list + label: repl network ips + description: ips of repl network + rx_net_name: + type: string + label: Rx network name + description: Rx network name + rx_net_ips: + type: comma_delimited_list + label: Rx network ips + description: Rx network ips + rx_net_floating_ip: + type: string + label: mog rx net virtual ip + description: mog rx net virtual ip + ran_net_name: + type: string + label: RAN network name + description: RAN network name + ran_net_ips: + type: comma_delimited_list + label: RAN network ips + description: RAN network ip + ran_net_floating_ip: + type: string + label: mog ran net virtual ip + description: mog ran net virtual ip + csb_net_name: + type: string + label: csb internal network name + description: csb internal network name + csb_net_start: + type: string + label: csb internal start + description: csb internal start + csb_net_end: + type: string + label: csb internal end + description: csb internal end + csb_net_cidr: + type: string + label: csb ineternal cidr + description: csb internal cidr + csb_net_netmask: + type: string + description: CSB internal network subnet mask + csb_net_ips: + type: comma_delimited_list + description: mog_csb_net IP addresses + dummy_net_name_0: + type: string + label: csb internal network name + description: csb internal network name + dummy_net_start_0: + type: string + label: csb internal start + description: csb internal start + dummy_net_end_0: + type: string + label: csb internal end + description: csb internal end + dummy_net_cidr_0: + type: string + label: csb ineternal cidr + description: csb internal cidr + dummy_net_netmask_0: + type: string + description: CSB internal network subnet mask + dummy_net_name_1: + type: string + label: csb internal network name + description: csb internal network name + dummy_net_start_1: + type: string + label: csb internal start + description: csb internal start + dummy_net_end_1: + type: string + label: csb internal end + description: csb internal end + dummy_net_cidr_1: + type: string + label: csb ineternal cidr + description: csb internal cidr + dummy_net_netmask_1: + type: string + description: CSB internal network subnet mask + + security_group_name: + type: string + label: security group name + description: the name of security group + cluster-manager-vol-1: + type: string + label: mog-cm-vol-1 + description: Cluster Manager volume 1 + session-manager-vol-1: + type: string + label: mog-sm-vol-1 + description: Session Manager volume 1 + session-manager-vol-2: + type: string + label: mog-sm-vol-2 + description: Session Manager volume 2 + oam-vol-1: + type: string + label: mog-oam-vol-1 + description: OAM volume 1 + oam-vol-2: + type: string + label: mog-oam-vol-2 + description: OAM volume 2 + mog_swift_container: + type: string + label: mog Config URL + description: Config URL + mog_script_dir: + type: string + label: mog Config script directory + description: Config script directory + mog_script_name: + type: string + label: mog Config script name + description: Config script name + mog_parameter_name: + type: string + label: mog script parameter name + description: Config script parameter csv file name + cluster-manager-vol-2: + type: string + label: mog-cm-vol-2 + description: Cluster Manager volume 2 with ISO image + +resources: + mog_security_group: + type: OS::Neutron::SecurityGroup + properties: + description: mog security group + name: {get_param: security_group_name} + rules: [{"direction": egress, "ethertype": IPv4, "port_range_min": 1, "port_range_max": 65535, "protocol": tcp, "remote_ip_prefix": 0.0.0.0/0}, + {"direction": egress, "ethertype": IPv4, "port_range_min": 1, "port_range_max": 65535, "protocol": udp, "remote_ip_prefix": 0.0.0.0/0}, + {"direction": egress, "ethertype": IPv4, "protocol": icmp, "remote_ip_prefix": 0.0.0.0/0}, + {"direction": ingress, "ethertype": IPv4, "port_range_min": 1, "port_range_max": 65535, "protocol": tcp, "remote_ip_prefix": 0.0.0.0/0}, + {"direction": ingress, "ethertype": IPv4, "port_range_min": 1, "port_range_max": 65535, "protocol": udp, "remote_ip_prefix": 0.0.0.0/0}, + {"direction": ingress, "ethertype": IPv4, "protocol": icmp, "remote_ip_prefix": 0.0.0.0/0} + ] + + csb_net: + type: OS::Contrail::VirtualNetwork + properties: + name: { get_param: csb_net_name} + + csb_ip_subnet: + type: OS::Neutron::Subnet + properties: + name: {get_param: csb_net_name} + network_id: { get_resource: csb_net } + cidr: { get_param: csb_net_cidr } + allocation_pools: [{"start": {get_param: csb_net_start}, "end": {get_param: csb_net_end}}] + enable_dhcp: true + + dummy_net_0: + type: OS::Contrail::VirtualNetwork + properties: + name: { get_param: dummy_net_name_0} + + dummy_ip_subnet_0: + type: OS::Neutron::Subnet + properties: + name: {get_param: dummy_net_name_0} + network_id: { get_resource: dummy_net_0 } + cidr: { get_param: dummy_net_cidr_0 } + allocation_pools: [{"start": {get_param: dummy_net_start_0}, "end": {get_param: dummy_net_end_0}}] + enable_dhcp: true + + dummy_net_1: + type: OS::Contrail::VirtualNetwork + properties: + name: { get_param: dummy_net_name_1} + + dummy_ip_subnet_1: + type: OS::Neutron::Subnet + properties: + name: {get_param: dummy_net_name_1} + network_id: { get_resource: dummy_net_1 } + cidr: { get_param: dummy_net_cidr_1 } + allocation_pools: [{"start": {get_param: dummy_net_start_1}, "end": {get_param: dummy_net_end_1}}] + enable_dhcp: true + + + mogconfig: + type: OS::Heat::SoftwareConfig + properties: + group: ungrouped + config: + str_replace: + template: | + #!/bin/bash + wget -P script_dir swift_container/script_name + wget -P script_dir swift_container/parameter_name + chmod 755 script_dir/script_name + script_dir/script_name + params: + swift_container: {get_param: mog_swift_container} + script_dir: {get_param: mog_script_dir} + script_name: {get_param: mog_script_name} + #parameter_name: {get_param: mog_parameter_name} + + + servergroup_mog01: + type: OS::Nova::ServerGroup + properties: + policies: + - anti-affinity + server_pd_01: + type: OS::Nova::Server + properties: +# config_drive: "True" + name: {get_param: [pd_server_names, 0]} + image: {get_param: pd_image_name} + flavor: {get_param: pd_flavor_name} + availability_zone: {get_param: availabilityzone_name} + networks: + - port: {get_resource: pd01_port_0} + - port: {get_resource: pd01_port_1} + - port: {get_resource: pd01_port_2} + - port: {get_resource: pd01_port_3} + - port: {get_resource: pd01_port_4} + - port: {get_resource: pd01_port_5} + - port: {get_resource: pd01_port_6} + # - port: {get_resource: pd01_port_7} + user_data: + scheduler_hints: {group: {get_resource: servergroup_mog01}} + user_data_format: RAW + + + pd01_port_0: + type: OS::Neutron::Port + properties: + network: {get_resource: csb_net} + security_groups: [{get_resource: mog_security_group}] + pd01_port_1: + type: OS::Neutron::Port + properties: + network: {get_param: oam_net_name} + fixed_ips: [{"ip_address": {get_param: [oam_net_ips, 0]}}] + security_groups: [{get_resource: mog_security_group}] + pd01_port_2: + type: OS::Neutron::Port + properties: + network: {get_resource: dummy_net_0} + security_groups: [{get_resource: mog_security_group}] + pd01_port_3: + type: OS::Neutron::Port + properties: + network: {get_param: rx_net_name} + fixed_ips: [{"ip_address": {get_param: [rx_net_ips, 0]}}] + allowed_address_pairs: [{"ip_address": {get_param: rx_net_floating_ip} }] + security_groups: [{get_resource: mog_security_group}] + pd01_port_4: + type: OS::Neutron::Port + properties: + network: {get_resource: dummy_net_1} + security_groups: [{get_resource: mog_security_group}] + pd01_port_5: + type: OS::Neutron::Port + properties: + network: {get_param: ran_net_name} + fixed_ips: [{"ip_address": {get_param: [ran_net_ips, 0]}}] + allowed_address_pairs: [{"ip_address": {get_param: ran_net_floating_ip} }] + security_groups: [{get_resource: mog_security_group}] + + pd01_port_6: + type: OS::Neutron::Port + properties: + network: {get_param: sl_net_name} + fixed_ips: [{"ip_address": {get_param: [sl_net_ips, 0]}}] + allowed_address_pairs: [{"ip_address": {get_param: sl_net_floating_ip}}] + security_groups: [{get_resource: mog_security_group}] + + # pd01_port_7: + #j type: OS::Neutron::Port + # properties: + # network: {get_param: internet_net_name} + # fixed_ips: [{"ip_address": {get_param: [internet_net_ips, 0]}}] + # allowed_address_pairs: [{"ip_address": {get_param: internet_net_floating_ip} }] + # security_groups: [{get_resource: mog_security_group}] + + server_pd_02: + type: OS::Nova::Server + properties: +# config_drive: "True" + name: {get_param: [pd_server_names, 1]} + image: {get_param: pd_image_name} + flavor: {get_param: pd_flavor_name} + availability_zone: {get_param: availabilityzone_name} + networks: + - port: {get_resource: pd02_port_0} + - port: {get_resource: pd02_port_1} + - port: {get_resource: pd01_port_2} + - port: {get_resource: pd01_port_3} + - port: {get_resource: pd02_port_4} + - port: {get_resource: pd02_port_5} + - port: {get_resource: pd02_port_6} + # - port: {get_resource: pd02_port_7} + + user_data: + scheduler_hints: {group: {get_resource: servergroup_mog01}} + user_data_format: RAW + + pd02_port_0: + type: OS::Neutron::Port + properties: + network: {get_resource: csb_net} + security_groups: [{get_resource: mog_security_group}] + + pd02_port_1: + type: OS::Neutron::Port + properties: + network: {get_param: oam_net_name} + fixed_ips: [{"ip_address": {get_param: [oam_net_ips, 1]}}] + security_groups: [{get_resource: mog_security_group}] + + pd02_port_2: + type: OS::Neutron::Port + properties: + network: {get_resource: dummy_net_0} + security_groups: [{get_resource: mog_security_group}] + + pd02_port_3: + type: OS::Neutron::Port + properties: + network: {get_param: rx_net_name} + fixed_ips: [{"ip_address": {get_param: [rx_net_ips, 1]}}] + allowed_address_pairs: [{"ip_address": {get_param: rx_net_floating_ip} }] + security_groups: [{get_resource: mog_security_group}] + + pd02_port_4: + type: OS::Neutron::Port + properties: + network: {get_resource: dummy_net_1} + security_groups: [{get_resource: mog_security_group}] + + pd02_port_5: + type: OS::Neutron::Port + properties: + network: {get_param: ran_net_name} + fixed_ips: [{"ip_address": {get_param: [ran_net_ips, 1]}}] + allowed_address_pairs: [{"ip_address": {get_param: ran_net_floating_ip} }] + security_groups: [{get_resource: mog_security_group}] + + pd02_port_6: + type: OS::Neutron::Port + properties: + network: {get_param: sl_net_name} + fixed_ips: [{"ip_address": {get_param: [sl_net_ips, 1]}}] + allowed_address_pairs: [{"ip_address": {get_param: sl_net_floating_ip}}] + security_groups: [{get_resource: mog_security_group}] + + # pd02_port_7: + # type: OS::Neutron::Port + # properties: + # network: {get_param: internet_net_name} + # fixed_ips: [{"ip_address": {get_param: [internet_net_ips, 1]}}] + # allowed_address_pairs: [{"ip_address": {get_param: internet_net_floating_ip} }] + # security_groups: [{get_resource: mog_security_group}] + + servergroup_mog02: + type: OS::Nova::ServerGroup + properties: + policies: + - anti-affinity + server_oam01: + type: OS::Nova::Server + properties: +# config_drive: "True" + name: {get_param: [oam_server_names, 0]} + image: {get_param: oam_image_name} + flavor: {get_param: oam_flavor_name} + availability_zone: {get_param: availabilityzone_name} + networks: + - port: {get_resource: oam01_port_0} + - port: {get_resource: oam01_port_1} +# block_device_mapping: +# - device_name: vdd +# volume_id: { get_param: oam-vol-1 } + user_data: + scheduler_hints: {group: {get_resource: servergroup_mog02}} + user_data_format: RAW + + oam01_port_0: + type: OS::Neutron::Port + properties: + network: {get_resource: csb_net} + security_groups: [{get_resource: mog_security_group}] + + oam01_port_1: + type: OS::Neutron::Port + properties: + network: {get_param: oam_net_name} + fixed_ips: [{"ip_address": {get_param: [oam_net_ips, 2]}}] + security_groups: [{get_resource: mog_security_group}] + + + server_oam02: + type: OS::Nova::Server + properties: +# config_drive: "True" + name: {get_param: [oam_server_names, 1]} + image: {get_param: oam_image_name} + flavor: {get_param: oam_flavor_name} + availability_zone: {get_param: availabilityzone_name} + networks: + - port: {get_resource: oam02_port_0} + - port: {get_resource: oam02_port_1} +# block_device_mapping: +# - device_name: vdd +# volume_id: { get_param: oam-vol-2 } + user_data: + scheduler_hints: {group: {get_resource: servergroup_mog02}} + user_data_format: RAW + + oam02_port_0: + type: OS::Neutron::Port + properties: + network: {get_resource: csb_net} + security_groups: [{get_resource: mog_security_group}] + + oam02_port_1: + type: OS::Neutron::Port + properties: + network: {get_param: oam_net_name} + fixed_ips: [{"ip_address": {get_param: [oam_net_ips, 3]}}] + security_groups: [{get_resource: mog_security_group}] + + + server_sm01: + type: OS::Nova::Server + properties: +# config_drive: "True" + name: {get_param: [sm_server_names, 0]} + image: {get_param: sm_image_name} + flavor: {get_param: sm_flavor_name} + availability_zone: {get_param: availabilityzone_name} + networks: + - port: {get_resource: sm01_port_0} + - port: {get_resource: sm01_port_1} +# block_device_mapping: +# - device_name: vdd +# volume_id: { get_param: session-manager-vol-1 } + user_data: + scheduler_hints: {group: {get_resource: servergroup_mog02}} + user_data_format: RAW + + sm01_port_0: + type: OS::Neutron::Port + properties: + network: {get_resource: csb_net} + security_groups: [{get_resource: mog_security_group}] + + sm01_port_1: + type: OS::Neutron::Port + properties: + network: {get_resource: dummy_net_0} + security_groups: [{get_resource: mog_security_group}] + + sm01_port_2: + type: OS::Neutron::Port + properties: + network: {get_param: repl_net_name} + fixed_ips: [{"ip_address": {get_param: [repl_net_ips, 0]}}] + security_groups: [{get_resource: mog_security_group}] + + server_sm02: + type: OS::Nova::Server + properties: +# config_drive: "True" + name: {get_param: [sm_server_names, 1]} + image: {get_param: sm_image_name} + flavor: {get_param: sm_flavor_name} + availability_zone: {get_param: availabilityzone_name} +# block_device_mapping: +# - device_name: vdd +# volume_id: { get_param: session-manager-vol-2 } + networks: + - port: {get_resource: sm02_port_0} + - port: {get_resource: sm02_port_1} + user_data: + scheduler_hints: {group: {get_resource: servergroup_mog02}} + user_data_format: RAW + + sm02_port_0: + type: OS::Neutron::Port + properties: + network: {get_resource: csb_net} + security_groups: [{get_resource: mog_security_group}] + + sm02_port_1: + type: OS::Neutron::Port + properties: + network: {get_resource: dummy_net_0} + security_groups: [{get_resource: mog_security_group}] + + sm02_port_2: + type: OS::Neutron::Port + properties: + network: {get_param: repl_net_name} + fixed_ips: [{"ip_address": {get_param: [repl_net_ips, 1]}}] + security_groups: [{get_resource: mog_security_group}] + + servergroup_mog03: + type: OS::Nova::ServerGroup + properties: + policies: + - anti-affinity + server_ps01: + type: OS::Nova::Server + properties: +# config_drive: "True" + name: {get_param: [ps_server_names, 0]} + image: {get_param: ps_image_name} + flavor: {get_param: ps_flavor_name} + availability_zone: {get_param: availabilityzone_name} + networks: + - port: {get_resource: ps01_port_0} + user_data: + scheduler_hints: {group: {get_resource: servergroup_mog03}} + user_data_format: RAW + + ps01_port_0: + type: OS::Neutron::Port + properties: + network: {get_resource: csb_net} + security_groups: [{get_resource: mog_security_group}] + + server_ps02: + type: OS::Nova::Server + properties: +# config_drive: "True" + name: {get_param: [ps_server_names, 1]} + image: {get_param: ps_image_name} + flavor: {get_param: ps_flavor_name} + availability_zone: {get_param: availabilityzone_name} + networks: + - port: {get_resource: ps02_port_0} + user_data: + scheduler_hints: {group: {get_resource: servergroup_mog03}} + user_data_format: RAW + + ps02_port_0: + type: OS::Neutron::Port + properties: + network: {get_resource: csb_net} + security_groups: [{get_resource: mog_security_group}] + + server_ps03: + type: OS::Nova::Server + properties: + name: {get_param: [ps_server_names, 2]} + image: {get_param: ps_image_name} + flavor: {get_param: ps_flavor_name} + availability_zone: {get_param: availabilityzone_name} + networks: + - port: {get_resource: ps03_port_0} + user_data: + scheduler_hints: {group: {get_resource: servergroup_mog03}} + user_data_format: RAW + + ps03_port_0: + type: OS::Neutron::Port + properties: + network: {get_resource: csb_net} + security_groups: [{get_resource: mog_security_group}] + + server_ps04: + type: OS::Nova::Server + properties: + name: {get_param: [ps_server_names, 3]} + image: {get_param: ps_image_name} + flavor: {get_param: ps_flavor_name} + availability_zone: {get_param: availabilityzone_name} + networks: + - port: {get_resource: ps04_port_0} + user_data: + scheduler_hints: {group: {get_resource: servergroup_mog03}} + user_data_format: RAW + + ps04_port_0: + type: OS::Neutron::Port + properties: + network: {get_resource: csb_net} + security_groups: [{get_resource: mog_security_group}] + + server_cm01: + type: OS::Nova::Server + properties: +# config_drive: "True" + name: {get_param: [cm_server_names, 0]} + image: {get_param: cm_image_name} + flavor: {get_param: cm_flavor_name} + availability_zone: {get_param: availabilityzone_name} + networks: + - port: {get_resource: cm01_port_0} + - port: {get_resource: cm01_port_1} +# block_device_mapping: +# - device_name: vdd +# volume_id: { get_param: cluster-manager-vol-2 } +# - device_name: vde +# volume_id: { get_param: cluster-manager-vol-1 } + user_data: + scheduler_hints: {group: {get_resource: servergroup_mog03}} + user_data_format: RAW + + cm01_port_0: + type: OS::Neutron::Port + properties: + network: {get_resource: csb_net} + fixed_ips: [{"ip_address": {get_param: [csb_net_ips, 10]}}] + security_groups: [{get_resource: mog_security_group}] + + cm01_port_1: + type: OS::Neutron::Port + properties: + network: {get_param: oam_net_name} + fixed_ips: [{"ip_address": {get_param: [oam_net_ips, 4]}}] + security_groups: [{get_resource: mog_security_group}] + diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/withNetwork/zip/withNetwork.zip b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/withNetwork/zip/withNetwork.zip Binary files differnew file mode 100644 index 0000000000..7cd81437d3 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/withNetwork/zip/withNetwork.zip diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/withoutManifest/create_stack.sh b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/withoutManifest/create_stack.sh new file mode 100644 index 0000000000..186d1c34fb --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/withoutManifest/create_stack.sh @@ -0,0 +1 @@ +heat stack-create vMME -e vmme_small.env -f vmme_small.yml diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/withoutManifest/vmme_small_create_fsb.env b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/withoutManifest/vmme_small_create_fsb.env new file mode 100644 index 0000000000..750bb2dd44 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/withoutManifest/vmme_small_create_fsb.env @@ -0,0 +1,8 @@ +parameters: + volume_type: Gold + volume_size: 320 + FSB_1_image: MME_FSB1_15B-CP04-r5a01 + FSB_2_image: MME_FSB2_15B-CP04-r5a01 + FSB1_volume_name: vFSB1_1_Vol_1 + FSB2_volume_name: vFSB2_1_Vol_1 + diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/withoutManifest/vmme_small_create_fsb.yml b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/withoutManifest/vmme_small_create_fsb.yml new file mode 100644 index 0000000000..2d695a50c1 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/withoutManifest/vmme_small_create_fsb.yml @@ -0,0 +1,54 @@ +heat_template_version: 2013-05-23 + +description: server template for vMME + +parameters: + + volume_type: + type: string + label: volume type + description: volume type Gold + + volume_size: + type: number + label: volume size + description: my volume size 320GB + + FSB_1_image: + type: string + label: MME_FSB1 + description: MME_FSB1_15B-CP04-r5a01 + + FSB_2_image: + type: string + label: MME_FSB2 + description: MME_FSB2_15B-CP04-r5a01 + + FSB1_volume_name: + type: string + label: FSB1_volume + description: FSB1_volume_1 + + FSB2_volume_name: + type: string + label: FSB2_volume + description: FSB2_volume_1 + +resources: + + FSB1_volume: + type: OS::Cinder::Volume + properties: + size: {get_param: volume_size} + volume_type: {get_param: volume_type} + name: {get_param: FSB1_volume_name} + image: {get_param: FSB_1_image} + + FSB2_volume: + type: OS::Cinder::Volume + properties: + size: {get_param: volume_size} + volume_type: {get_param: volume_type} + name: {get_param: FSB2_volume_name} + image: {get_param: FSB_2_image} + |