diff --git a/.gitignore b/.gitignore index a8e24a136c..deee135e48 100644 --- a/ .gitignore+++ b/ .gitignore@@ -1,20 +1,68 @@ +# Eclipse IDE +#------------------------------------------------------------ +**/.classpath +**/.project +**/.tern-project +**/.settings/** +**/bin/ + + +# IntelliJ IDE +#------------------------------------------------------------ +**/.idea/ +/out/ +*.iml + +# IntelliJ IDE +#------------------------------------------------------------ +**/.idea/ +/out/ +*.iml !catalog-fe/src/main/webapp/META-INF/ !catalog-fe/src/main/webapp/WEB-INF/ # Eclipse # Maven -# Package Files # +#------------------------------------------------------------ +**/target/ +pom.xml.tag +pom.xml.releaseBackup +pom.xml.versionsBackup +version.properties +dependency-reduced-pom.xml + ## sdc-os-chef *.class +# Package Files + +# Package Files +#------------------------------------------------------------ *.ear *.iml *.jar +#Gradle +build.gradle +.gradle/* + +/log +#Gradle +build.gradle +.gradle/* + +/log *.kpf *.orig *.war .classpath .delivery .idea/* + + +# catalog-ui +#------------------------------------------------------------ + + +catalog-ui/app/dist/* .metadata/ .metadata/* .project @@ -39,6 +87,7 @@ catalog-fe/bin catalog-fe/src/main/webapp/* catalog-ui/*.tmp.txt catalog-ui/.* +catalog-ui/app/dist/* catalog-ui/.editorconfig catalog-ui/.jshintrc catalog-ui/.yo-rc.json @@ -53,7 +102,16 @@ catalog-ui/app/scripts/references.ts catalog-ui/app/scripts/tsconfig.json catalog-ui/app/tsconfig.json catalog-ui/bower_components/ +catalog-ui/package-lock.json catalog-ui/dist +catalog-ui/*.tmp.txt +catalog-ui/tests/Coverage/* +catalog-ui/Chrome* +catalog-ui/PhantomJS_1.9.8_(Windows_7_0.0.0)/* +catalog-ui/*.tmp.txt +catalog-ui/tests/Coverage/* +catalog-ui/Chrome* +catalog-ui/PhantomJS_1.9.8_(Windows_7_0.0.0)/* catalog-ui/node/* catalog-ui/node_modules/ catalog-ui/npm-debug.log @@ -81,6 +139,7 @@ data/root.png data/router.png data/software.png data/volume.png + distribution-ci/logs/wordnik.log distribution-ci/logs/wordnik.log.1 distribution-ci/logs/wordnik.log.10 @@ -93,6 +152,7 @@ distribution-ci/logs/wordnik.log.7 distribution-ci/logs/wordnik.log.8 distribution-ci/logs/wordnik.log.9 dox-sequence-diagram-ui/node/* + log.home_IS_UNDEFINED/ASDC/ASDC-BE/Error.log log.home_IS_UNDEFINED/ASDC/ASDC-BE/audit.log log.home_IS_UNDEFINED/ASDC/ASDC-BE/debug.log @@ -147,3 +207,11 @@ ui-ci/test-output/testng-failed.xml ui-ci/test-output/testng-results.xml utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/files/default/logback.xml vagrant-asdc-all-in-one/ + + +sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/testSuites/* +/asdctool/*.xls + +/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/files/default/tools/build/scripts/* + +sdc-os-chef/sdc-sanity/chef-repo/cookbooks/sdc-sanity/files/default/testSuites/* @@ -18,4 +18,5 @@ * limitations under the License. * ============LICENSE_END============================================ * ECOMP is a trademark and service mark of AT&T Intellectual Property. -*/
\ No newline at end of file + +*/ @@ -47,8 +47,7 @@ <dependency> <groupId>org.mockito</groupId> - <artifactId>mockito-all</artifactId> - <version>1.10.19</version> + <artifactId>mockito-core</artifactId> <scope>compile</scope> </dependency> @@ -20,8 +20,6 @@ package org.openecomp.sdc.ci.tests.api; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import java.io.File; @@ -43,8 +41,8 @@ import org.openecomp.sdc.ci.tests.rules.MyTestWatcher; import org.openecomp.sdc.ci.tests.run.StartTest; import org.openecomp.sdc.ci.tests.utils.Utils; import org.openecomp.sdc.ci.tests.utils.general.FileUtils; -import org.slf4j.LoggerFactory; import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import com.google.gson.Gson; import com.google.gson.GsonBuilder; @@ -76,7 +76,6 @@ import org.testng.annotations.BeforeSuite; import com.relevantcodes.extentreports.ExtentReports; import com.relevantcodes.extentreports.ExtentTest; import com.relevantcodes.extentreports.LogStatus; -import com.relevantcodes.extentreports.NetworkMode; import com.thinkaurelius.titan.core.TitanFactory; import com.thinkaurelius.titan.core.TitanGraph; import com.thinkaurelius.titan.core.TitanVertex; @@ -46,7 +46,7 @@ import org.openecomp.sdc.be.model.CapabilityDefinition; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.Product; -import org.openecomp.sdc.be.model.RequirementAndRelationshipPair; +import org.openecomp.sdc.be.model.RelationshipInfo; import org.openecomp.sdc.be.model.RequirementCapabilityRelDef; import org.openecomp.sdc.be.model.RequirementDefinition; import org.openecomp.sdc.be.model.Resource; @@ -683,7 +683,7 @@ public class ComponentInstanceBaseTest extends ComponentBaseTest { private void deleteAssociatedFromExpected(RequirementCapabilityRelDef requirementDef) { // removing from requirements - RequirementAndRelationshipPair relationship = requirementDef.getRelationships().get(0); + RelationshipInfo relationship = requirementDef.getRelationships().get(0).getRelation(); String type = relationship.getRelationship().getType(); String fromId = requirementDef.getFromNode(); List<RequirementDefinition> reqList = expectedContainerRequirements.get(type); @@ -771,7 +771,7 @@ public class ComponentInstanceBaseTest extends ComponentBaseTest { private void addDissociatedToExpected(RequirementCapabilityRelDef requirementDef) { // adding to requirements - RequirementAndRelationshipPair relationship = requirementDef.getRelationships().get(0); + RelationshipInfo relationship = requirementDef.getRelationships().get(0).getRelation(); String type = relationship.getRelationship().getType(); String fromId = requirementDef.getFromNode(); Map<String, List<RequirementDefinition>> map = removedRequirements.get(fromId); @@ -22,7 +22,6 @@ package org.openecomp.sdc.ci.tests.datatypes; import java.util.List; -import org.openecomp.sdc.be.model.ArtifactDefinition; import org.openecomp.sdc.be.model.HeatParameterDefinition; public class ArtifactReqDetails { @@ -32,12 +32,9 @@ import java.io.InputStream; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; -import java.util.HashSet; import java.util.Iterator; -import java.util.LinkedHashSet; import java.util.List; import java.util.Map; -import java.util.Set; import org.codehaus.jackson.map.ObjectMapper; import org.codehaus.jettison.json.JSONArray; @@ -23,7 +23,6 @@ package org.openecomp.sdc.ci.tests.datatypes; import java.util.List; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; -import org.openecomp.sdc.be.model.Resource; public class ResourceExternalReqDetails extends ComponentReqDetails { String vendorName; @@ -29,6 +29,7 @@ public class ServiceReqDetails extends ComponentReqDetails { String serviceType; String serviceRole; + String environmentContext; public ServiceReqDetails(String serviceName, String category, ArrayList<String> tags, String description, String contactId, String icon) { @@ -45,7 +46,7 @@ public class ServiceReqDetails extends ComponentReqDetails { categoryDefinition.setName(category); categories = new ArrayList<>(); categories.add(categoryDefinition); - + this.environmentContext = ""; } public ServiceReqDetails(Service service) { @@ -63,7 +64,7 @@ public class ServiceReqDetails extends ComponentReqDetails { this.version = service.getVersion(); this.serviceType = service.getServiceType(); this.serviceRole = service.getServiceRole(); - + this.environmentContext = service.getEnvironmentContext(); } public ServiceReqDetails() { @@ -95,4 +96,11 @@ public class ServiceReqDetails extends ComponentReqDetails { return null; } + public String getEnvironmentContext() { + return environmentContext; + } + + public void setEnvironmentContext(String environmentContext) { + this.environmentContext = environmentContext; + } } @@ -20,8 +20,6 @@ package org.openecomp.sdc.ci.tests.datatypes.enums; -import java.util.List; - public enum LifeCycleStatesEnum { CHECKOUT("checkout", "NOT_CERTIFIED_CHECKOUT"), @@ -20,7 +20,6 @@ package org.openecomp.sdc.ci.tests.datatypes.enums; -import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; import org.openecomp.sdc.be.datatypes.elements.SchemaDefinition; import org.openecomp.sdc.be.model.PropertyDefinition; import org.openecomp.sdc.be.model.tosca.ToscaPropertyType; @@ -20,9 +20,6 @@ package org.openecomp.sdc.ci.tests.execute.TODO; -import org.testng.annotations.AfterClass; -import org.testng.annotations.Test; -import org.testng.AssertJUnit; import java.io.File; import java.io.IOException; @@ -36,8 +33,11 @@ import org.apache.tinkerpop.gremlin.structure.Vertex; import org.openecomp.sdc.ci.tests.api.Urls; import org.openecomp.sdc.ci.tests.config.Config; import org.openecomp.sdc.ci.tests.utils.DbUtils; -import org.openecomp.sdc.ci.tests.utils.Utils; import org.openecomp.sdc.ci.tests.utils.DbUtils.TitanState; +import org.openecomp.sdc.ci.tests.utils.Utils; +import org.testng.AssertJUnit; +import org.testng.annotations.AfterClass; +import org.testng.annotations.Test; import fj.data.Either; @@ -61,10 +61,8 @@ import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.datatypes.http.HttpHeaderEnum; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; -import org.openecomp.sdc.ci.tests.utils.Utils; import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; -import org.openecomp.sdc.ci.tests.utils.general.FileUtils; import org.openecomp.sdc.ci.tests.utils.rest.ArtifactRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils; @@ -39,20 +39,15 @@ import org.javatuples.Pair; import org.junit.Rule; import org.junit.rules.TestName; import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.model.ArtifactDefinition; import org.openecomp.sdc.be.model.Component; -import org.openecomp.sdc.be.model.Product; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.ci.tests.api.ComponentBaseTest; import org.openecomp.sdc.ci.tests.datatypes.ArtifactReqDetails; -import org.openecomp.sdc.ci.tests.datatypes.ComponentInstanceReqDetails; -import org.openecomp.sdc.ci.tests.datatypes.ProductReqDetails; import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; -import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.ErrorInfo; import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum; @@ -68,14 +63,11 @@ import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.openecomp.sdc.ci.tests.utils.general.FileUtils; import org.openecomp.sdc.ci.tests.utils.rest.ArtifactRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils; -import org.openecomp.sdc.ci.tests.utils.rest.ComponentInstanceRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.LifecycleRestUtils; -import org.openecomp.sdc.ci.tests.utils.rest.ProductRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; import org.openecomp.sdc.ci.tests.utils.rest.ServiceRestUtils; import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils; -import org.openecomp.sdc.exception.ResponseFormat; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.testng.annotations.BeforeMethod; @@ -20,6 +20,13 @@ package org.openecomp.sdc.ci.tests.execute.artifacts; +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + import org.junit.Rule; import org.junit.rules.TestName; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; @@ -45,13 +52,6 @@ import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; import org.yaml.snakeyaml.Yaml; -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - public class ValidateArtResponse extends ComponentBaseTest { @Rule @@ -20,7 +20,11 @@ package org.openecomp.sdc.ci.tests.execute.category; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.json.simple.JSONArray; import org.json.simple.JSONObject; @@ -34,7 +38,11 @@ import org.openecomp.sdc.ci.tests.api.Urls; import org.openecomp.sdc.ci.tests.config.Config; import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; -import org.openecomp.sdc.ci.tests.datatypes.enums.*; +import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum; +import org.openecomp.sdc.ci.tests.datatypes.enums.OriginTypeEnum; +import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum; +import org.openecomp.sdc.ci.tests.datatypes.enums.ServiceCategoriesEnum; +import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.datatypes.http.HttpHeaderEnum; import org.openecomp.sdc.ci.tests.datatypes.http.HttpRequest; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; @@ -54,7 +54,6 @@ import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.datatypes.expected.ExpectedCategoryAudit; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; import org.openecomp.sdc.ci.tests.utils.DbUtils; -import org.openecomp.sdc.ci.tests.utils.Utils; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.CategoryRestUtils; @@ -62,7 +61,6 @@ import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; import org.openecomp.sdc.ci.tests.utils.validation.AuditValidationUtils; import org.openecomp.sdc.ci.tests.utils.validation.CategoryValidationUtils; import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils; -import org.testng.SkipException; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; @@ -26,7 +26,6 @@ import static org.testng.AssertJUnit.assertNotNull; import java.util.HashMap; import java.util.Map; -import org.apache.log4j.lf5.util.ResourceUtils; import org.json.simple.JSONArray; import org.json.simple.JSONObject; import org.json.simple.JSONValue; @@ -32,9 +32,6 @@ import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.STATUS_CODE_RE import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.STATUS_CODE_SUCCESS; import static org.testng.AssertJUnit.assertEquals; -import java.util.ArrayList; -import java.util.List; - import org.junit.Rule; import org.junit.rules.TestName; import org.openecomp.sdc.be.dao.api.ActionStatus; @@ -47,7 +44,6 @@ import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.datatypes.expected.ExpectedCategoryAudit; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; import org.openecomp.sdc.ci.tests.utils.DbUtils; -import org.openecomp.sdc.ci.tests.utils.Utils; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.openecomp.sdc.ci.tests.utils.rest.CategoryRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; @@ -47,7 +47,6 @@ import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.datatypes.expected.ExpectedCategoryAudit; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; import org.openecomp.sdc.ci.tests.utils.DbUtils; -import org.openecomp.sdc.ci.tests.utils.Utils; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.openecomp.sdc.ci.tests.utils.rest.CategoryRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; @@ -20,6 +20,8 @@ package org.openecomp.sdc.ci.tests.execute.devCI; +import static java.util.Arrays.asList; + import java.io.IOException; import java.io.UnsupportedEncodingException; import java.util.Arrays; @@ -99,9 +101,6 @@ import com.relevantcodes.extentreports.LogStatus; import fj.data.Either; - -import static java.util.Arrays.asList; - public class CRUDExternalAPI extends ComponentBaseTest { private static Logger log = LoggerFactory.getLogger(CRUDExternalAPI.class.getName()); @@ -4,7 +4,6 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; -import java.util.List; import java.util.Map; import java.util.stream.Collectors; @@ -14,8 +13,8 @@ import org.openecomp.sdc.ci.tests.api.ComponentBaseTest; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.CommonRestUtils; +import org.openecomp.sdc.common.api.Constants; import org.openecomp.sdc.common.api.HealthCheckInfo; -import org.openecomp.sdc.common.api.HealthCheckInfo.HealthCheckComponent; import org.openecomp.sdc.common.api.HealthCheckInfo.HealthCheckStatus; import org.openecomp.sdc.common.api.HealthCheckWrapper; import org.testng.annotations.Test; @@ -27,8 +26,6 @@ public class HealthCheckAPI extends ComponentBaseTest { @Rule public static TestName name = new TestName(); - private static final int STATUS_CODE_GET_SUCCESS = 200; - public HealthCheckAPI() { super(name, HealthCheckAPI.class.getName()); } @@ -41,18 +38,36 @@ public class HealthCheckAPI extends ComponentBaseTest { Gson gson = new Gson(); HealthCheckWrapper healthCheckInfo = gson.fromJson(healthCheckInfoResponse.getResponse(), HealthCheckWrapper.class); assertNotNull("Health check not contains components info", healthCheckInfo.getComponentsInfo()); - HealthCheckInfo amdocsHC = healthCheckInfo.getComponentsInfo().stream().filter(x -> x.getHealthCheckComponent() == HealthCheckInfo.HealthCheckComponent.ON_BOARDING).findFirst().orElse(null); + HealthCheckInfo amdocsHC = healthCheckInfo.getComponentsInfo().stream().filter(x -> x.getHealthCheckComponent().equals(Constants.HC_COMPONENT_ON_BOARDING)).findFirst().orElse(null); assertNotNull("Amdocs health check not exists in Health Check info", amdocsHC); assertEquals("Amdocs health check is down", HealthCheckInfo.HealthCheckStatus.UP, amdocsHC.getHealthCheckStatus()); - assertNotNull("Amdocs additionalInfo not exists in health check", amdocsHC.getComponentsInfo()); - Map<HealthCheckComponent, HealthCheckStatus> amdocsHCComponents = amdocsHC.getComponentsInfo().stream().collect(Collectors.toMap(HealthCheckInfo::getHealthCheckComponent, HealthCheckInfo::getHealthCheckStatus)); + assertNotNull("Amdocs componentsInfo not exists in health check", amdocsHC.getComponentsInfo()); + Map<String, HealthCheckStatus> amdocsHCComponents = amdocsHC.getComponentsInfo().stream().collect(Collectors.toMap(HealthCheckInfo::getHealthCheckComponent, HealthCheckInfo::getHealthCheckStatus)); assertNotNull(amdocsHCComponents); - assertTrue("Amdocs health check ZU component is down or not exists", amdocsHCComponents.get(HealthCheckComponent.ZU) != null && amdocsHCComponents.get(HealthCheckComponent.ZU).equals(HealthCheckStatus.UP)); - assertTrue("Amdocs health check BE component is down or not exists", amdocsHCComponents.get(HealthCheckComponent.BE) != null && amdocsHCComponents.get(HealthCheckComponent.BE).equals(HealthCheckStatus.UP)); - assertTrue("Amdocs health check CAS component is down or not exists", amdocsHCComponents.get(HealthCheckComponent.CAS) != null && amdocsHCComponents.get(HealthCheckComponent.CAS).equals(HealthCheckStatus.UP)); - assertTrue("Amdocs health check FE component is down or not exists", amdocsHCComponents.get(HealthCheckComponent.FE) != null && amdocsHCComponents.get(HealthCheckComponent.FE).equals(HealthCheckStatus.UP)); + assertTrue("Amdocs health check ZU component is down or not exists", amdocsHCComponents.get("ZU") != null && amdocsHCComponents.get("ZU").equals(HealthCheckStatus.UP)); + assertTrue("Amdocs health check BE component is down or not exists", amdocsHCComponents.get("BE") != null && amdocsHCComponents.get("BE").equals(HealthCheckStatus.UP)); + assertTrue("Amdocs health check CAS component is down or not exists", amdocsHCComponents.get("CAS") != null && amdocsHCComponents.get("CAS").equals(HealthCheckStatus.UP)); + assertTrue("Amdocs health check FE component is down or not exists", amdocsHCComponents.get("FE") != null && amdocsHCComponents.get("FE").equals(HealthCheckStatus.UP)); } - + + @Test + public void checkDcaeHealthCheckAPI() throws Exception { + RestResponse healthCheckInfoResponse = CommonRestUtils.getHealthCheck(); + BaseRestUtils.checkSuccess(healthCheckInfoResponse); + + Gson gson = new Gson(); + HealthCheckWrapper healthCheckInfo = gson.fromJson(healthCheckInfoResponse.getResponse(), HealthCheckWrapper.class); + assertNotNull("Health check not contains components info", healthCheckInfo.getComponentsInfo()); + HealthCheckInfo dcaeHC = healthCheckInfo.getComponentsInfo().stream().filter(x -> x.getHealthCheckComponent().equals(Constants.HC_COMPONENT_DCAE)).findFirst().orElse(null); + assertNotNull("DCAE health check not exists in Health Check info", dcaeHC); + assertEquals("DCAE health check is down", HealthCheckInfo.HealthCheckStatus.UP, dcaeHC.getHealthCheckStatus()); + assertNotNull("DCAE componentsInfo not exists in health check", dcaeHC.getComponentsInfo()); + Map<String, HealthCheckStatus> dcaeHCComponents = dcaeHC.getComponentsInfo().stream().collect(Collectors.toMap(HealthCheckInfo::getHealthCheckComponent, HealthCheckInfo::getHealthCheckStatus)); + assertNotNull(dcaeHCComponents); + assertTrue("DCAE health check BE component is down or not exists", dcaeHCComponents.get("BE") != null && dcaeHCComponents.get("BE").equals(HealthCheckStatus.UP)); + assertTrue("DCAE health check FE component is down or not exists", dcaeHCComponents.get("FE") != null && dcaeHCComponents.get("FE").equals(HealthCheckStatus.UP)); + } + @Test public void checkCassandraHealthCheck() throws Exception { RestResponse healthCheckInfoResponse = CommonRestUtils.getHealthCheck(); @@ -61,7 +76,7 @@ public class HealthCheckAPI extends ComponentBaseTest { Gson gson = new Gson(); HealthCheckWrapper healthCheckInfo = gson.fromJson(healthCheckInfoResponse.getResponse(), HealthCheckWrapper.class); assertNotNull("Health check not contains components info", healthCheckInfo.getComponentsInfo()); - HealthCheckInfo cassandraHC = healthCheckInfo.getComponentsInfo().stream().filter(x -> x.getHealthCheckComponent() == HealthCheckInfo.HealthCheckComponent.CASSANDRA).findFirst().orElse(null); + HealthCheckInfo cassandraHC = healthCheckInfo.getComponentsInfo().stream().filter(x -> x.getHealthCheckComponent().equals(Constants.HC_COMPONENT_CASSANDRA)).findFirst().orElse(null); assertNotNull("Cassandra health check not exists in Health Check info", cassandraHC); assertEquals("Cassandra health check is down", HealthCheckInfo.HealthCheckStatus.UP, cassandraHC.getHealthCheckStatus()); } @@ -20,20 +20,15 @@ package org.openecomp.sdc.ci.tests.execute.devCI; -import static org.testng.AssertJUnit.assertTrue; - import org.junit.Rule; import org.junit.rules.TestName; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.Resource; -import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.ci.tests.api.ComponentBaseTest; import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; -import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum; -import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; import org.openecomp.sdc.ci.tests.execute.imports.ImportCsarResourceTest; @@ -42,7 +37,6 @@ import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; -import org.openecomp.sdc.ci.tests.utils.validation.CsarValidationUtils; import org.testng.annotations.AfterTest; import org.testng.annotations.BeforeTest; import org.testng.annotations.DataProvider; @@ -25,16 +25,11 @@ import static org.testng.AssertJUnit.assertTrue; import org.junit.Rule; import org.junit.rules.TestName; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; -import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.Resource; -import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.ci.tests.api.ComponentBaseTest; import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; -import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum; -import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; -import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils; @@ -20,15 +20,11 @@ package org.openecomp.sdc.ci.tests.execute.devCI; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertTrue; - import org.junit.Rule; import org.junit.rules.TestName; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.be.utils.CommonBeUtils; import org.openecomp.sdc.ci.tests.api.ComponentBaseTest; import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum; @@ -37,11 +33,8 @@ import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils; -import org.openecomp.sdc.ci.tests.utils.rest.ComponentRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; import org.openecomp.sdc.ci.tests.utils.rest.ServiceRestUtils; -import org.testng.annotations.AfterTest; -import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; public class OpsRejectDistribution extends ComponentBaseTest { @@ -20,13 +20,6 @@ package org.openecomp.sdc.ci.tests.execute.devCI; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.util.Base64.Decoder; - -import javax.json.Json; - import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; @@ -34,75 +27,33 @@ import java.util.List; import java.util.Map; import java.util.Random; -import org.apache.cassandra.cli.CliParser.operator_return; -import org.apache.http.HttpEntity; -import org.apache.http.HttpResponse; -import org.apache.http.client.HttpResponseException; -import org.apache.http.client.methods.CloseableHttpResponse; -import org.apache.http.client.methods.HttpDelete; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.entity.StringEntity; -import org.apache.http.impl.client.BasicResponseHandler; -import org.apache.http.util.EntityUtils; -import org.codehaus.jackson.map.ObjectMapper; -import org.json.simple.JSONObject; import org.json.simple.parser.JSONParser; -import org.json.simple.parser.ParseException; import org.junit.Rule; import org.junit.rules.TestName; import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.dao.graph.datatype.ActionEnum; import org.openecomp.sdc.be.datatypes.enums.AssetTypeEnum; -import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; -import org.openecomp.sdc.be.model.ArtifactDefinition; -import org.openecomp.sdc.be.model.ArtifactUiDownloadData; -import org.openecomp.sdc.be.model.Component; -import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.Resource; -import org.openecomp.sdc.be.model.Service; -import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.model.category.CategoryDefinition; import org.openecomp.sdc.be.model.category.SubCategoryDefinition; import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; import org.openecomp.sdc.ci.tests.api.ComponentBaseTest; -import org.openecomp.sdc.ci.tests.api.Urls; import org.openecomp.sdc.ci.tests.config.Config; -import org.openecomp.sdc.ci.tests.datatypes.ArtifactReqDetails; -import org.openecomp.sdc.ci.tests.datatypes.ResourceDetailedAssetStructure; import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; -import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; -import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum; -import org.openecomp.sdc.ci.tests.datatypes.enums.DistributionNotificationStatusEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.ErrorInfo; -import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.SearchCriteriaEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.datatypes.expected.ExpectedExternalAudit; -import org.openecomp.sdc.ci.tests.datatypes.expected.ExpectedResourceAuditJavaObject; -import org.openecomp.sdc.ci.tests.datatypes.http.HttpHeaderEnum; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; -import org.openecomp.sdc.ci.tests.utils.Utils; import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; -import org.openecomp.sdc.ci.tests.utils.rest.ArtifactRestUtils; -import org.openecomp.sdc.ci.tests.utils.rest.AssetRestUtils; -import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.CategoryRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils; -import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; import org.openecomp.sdc.ci.tests.utils.validation.AuditValidationUtils; -import org.openecomp.sdc.ci.tests.utils.validation.DistributionValidationUtils; import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils; -import org.openecomp.sdc.common.api.ApplicationErrorCodesEnum; -import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum; -import org.openecomp.sdc.common.api.Constants; -import org.openecomp.sdc.common.api.UploadArtifactInfo; import org.openecomp.sdc.common.datastructure.AuditingFieldsKeysEnum; -import org.openecomp.sdc.common.util.GeneralUtility; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.testng.Assert; @@ -110,20 +61,10 @@ import org.testng.annotations.BeforeMethod; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; -import org.openecomp.sdc.utils.Pair; -import com.google.common.base.CaseFormat; import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonElement; -import com.google.gson.JsonObject; import com.google.gson.JsonParser; -import com.relevantcodes.extentreports.LogStatus; - -import fj.P; -import fj.data.Either; -import it.unimi.dsi.fastutil.bytes.ByteSortedSets.SynchronizedSortedSet; - -import static java.util.Arrays.asList; public class SearchFilterCategoryExternalAPI extends ComponentBaseTest { @@ -20,8 +20,6 @@ package org.openecomp.sdc.ci.tests.execute.devCI; -import static org.testng.AssertJUnit.assertEquals; - import java.util.HashMap; import java.util.Map; @@ -22,7 +22,6 @@ package org.openecomp.sdc.ci.tests.execute.devCI; import static java.util.Arrays.asList; -import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -63,7 +62,6 @@ import org.testng.annotations.BeforeMethod; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; -import com.google.common.util.concurrent.ListeningExecutorService; import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonElement; @@ -20,7 +20,6 @@ package org.openecomp.sdc.ci.tests.execute.devCI; -import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertTrue; import org.junit.Rule; @@ -28,7 +27,6 @@ import org.junit.rules.TestName; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.be.utils.CommonBeUtils; import org.openecomp.sdc.ci.tests.api.ComponentBaseTest; import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum; @@ -40,8 +38,6 @@ import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ComponentRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; import org.openecomp.sdc.ci.tests.utils.rest.ServiceRestUtils; -import org.testng.annotations.AfterTest; -import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; public class ValidateConformanceLevel extends ComponentBaseTest { @@ -20,10 +20,6 @@ package org.openecomp.sdc.ci.tests.execute.devCI; -import static org.testng.AssertJUnit.assertNotNull; - -import java.io.IOException; -import java.text.ParseException; import java.util.Arrays; import java.util.List; import java.util.Map; @@ -44,14 +40,11 @@ import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.ServiceCategoriesEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; -import org.openecomp.sdc.ci.tests.utils.DistributionUtils; import org.openecomp.sdc.ci.tests.utils.Utils; import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils; import org.openecomp.sdc.ci.tests.utils.validation.DistributionValidationUtils; import org.testng.annotations.Test; -import org.openecomp.sdc.utils.DistributionStatusEnum; - import fj.data.Either; public class test1 extends ComponentBaseTest{ @@ -20,7 +20,8 @@ package org.openecomp.sdc.ci.tests.execute.externalapi; -import static org.testng.AssertJUnit.*; +import static org.testng.AssertJUnit.assertFalse; +import static org.testng.AssertJUnit.assertTrue; import java.io.IOException; import java.lang.reflect.Type; @@ -47,18 +48,12 @@ import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.EcompUserRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils; -import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; import org.openecomp.sdc.ci.tests.utils.rest.UserRestUtils; -import org.testng.annotations.DataProvider; import org.testng.annotations.Test; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; -import fj.data.Either; - -import org.testng.Assert; - public class UserAPIs extends ComponentBaseTest { @Rule @@ -52,7 +52,6 @@ import org.openecomp.sdc.ci.tests.datatypes.expected.ExpectedAuthenticationAudit import org.openecomp.sdc.ci.tests.datatypes.http.HttpHeaderEnum; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; import org.openecomp.sdc.ci.tests.utils.DbUtils; -import org.openecomp.sdc.ci.tests.utils.Utils; import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.openecomp.sdc.ci.tests.utils.rest.ArtifactRestUtils; @@ -35,7 +35,6 @@ import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.datatypes.expected.ExpectedEcomConsumerAudit; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; import org.openecomp.sdc.ci.tests.utils.DbUtils; -import org.openecomp.sdc.ci.tests.utils.Utils; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.openecomp.sdc.ci.tests.utils.rest.ConsumerRestUtils; import org.openecomp.sdc.ci.tests.utils.validation.AuditValidationUtils; @@ -26,8 +26,6 @@ import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.openecomp.sdc.ci.tests.utils.ToscaParserUtils.downloadAndParseToscaTemplate; -import java.io.ByteArrayInputStream; -import java.io.InputStream; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; @@ -36,17 +34,14 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; -import java.util.stream.Collectors; import java.util.Optional; +import java.util.stream.Collectors; import org.apache.commons.codec.binary.Base64; import org.junit.Rule; import org.junit.rules.TestName; -import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.model.ArtifactDefinition; -import org.openecomp.sdc.be.model.ArtifactUiDownloadData; -import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentInstInputsMap; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.ComponentInstanceInput; @@ -68,10 +63,7 @@ import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.ServiceCategoriesEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; -import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; -import org.openecomp.sdc.ci.tests.utils.general.ImportUtils; -import org.openecomp.sdc.ci.tests.utils.rest.ArtifactRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ComponentInstanceRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.InputsRestUtils; @@ -83,7 +75,6 @@ import org.openecomp.sdc.ci.tests.utils.validation.BaseValidationUtils; import org.openecomp.sdc.common.api.Constants; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; -import org.yaml.snakeyaml.Yaml; import com.google.gson.Gson; import com.google.gson.JsonParser; @@ -22,28 +22,19 @@ package org.openecomp.sdc.ci.tests.execute.imports; import static org.testng.AssertJUnit.assertEquals; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; import java.util.ArrayList; -import java.util.Collections; import java.util.List; -import org.apache.commons.codec.binary.Base64; import org.junit.rules.TestName; -import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.model.ArtifactDefinition; -import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.ui.model.UiComponentDataTransfer; import org.openecomp.sdc.be.ui.model.UiResourceDataTransfer; import org.openecomp.sdc.ci.tests.api.ComponentBaseTest; -import org.openecomp.sdc.ci.tests.datatypes.ImportReqDetails; import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; -import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; import org.testng.annotations.Test; @@ -39,8 +39,6 @@ import java.util.stream.Collectors; import org.apache.commons.codec.binary.Base64; import org.apache.commons.lang.WordUtils; -import org.apache.commons.lang3.tuple.ImmutablePair; -import org.apache.tinkerpop.gremlin.process.traversal.P; import org.junit.Rule; import org.junit.rules.TestName; import org.openecomp.sdc.be.dao.api.ActionStatus; @@ -48,14 +46,12 @@ import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.model.ArtifactDefinition; import org.openecomp.sdc.be.model.CapabilityDefinition; import org.openecomp.sdc.be.model.ComponentInstance; -import org.openecomp.sdc.be.model.ComponentInstanceProperty; import org.openecomp.sdc.be.model.GroupDefinition; import org.openecomp.sdc.be.model.GroupProperty; import org.openecomp.sdc.be.model.RequirementCapabilityRelDef; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.be.model.tosca.ToscaPropertyType; import org.openecomp.sdc.ci.tests.api.ComponentBaseTest; import org.openecomp.sdc.ci.tests.api.Urls; import org.openecomp.sdc.ci.tests.config.Config; @@ -82,7 +78,6 @@ import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; import org.openecomp.sdc.ci.tests.utils.rest.ServiceRestUtils; import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils; -import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum; import org.openecomp.sdc.common.util.ValidationUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -1502,8 +1497,8 @@ public class ImportCsarResourceTest extends ComponentBaseTest { String cp1Uid = nodes.get("cp1node").getUniqueId(); String cp2Uid = nodes.get("cp2node").getUniqueId(); Map<String, List<RequirementCapabilityRelDef>> mappedByReqOwner = resource.getComponentInstancesRelations().stream().collect(Collectors.groupingBy(e -> e.getFromNode())); - assertEquals(mappedByReqOwner.get(cp1Uid).get(0).getRelationships().get(0).getCapabilityUid(), capabilities.get("virtual_linkable").getUniqueId()); - assertEquals(mappedByReqOwner.get(cp2Uid).get(0).getRelationships().get(0).getCapabilityUid(), capabilities.get("link").getUniqueId()); + assertEquals(mappedByReqOwner.get(cp1Uid).get(0).getRelationships().get(0).getRelation().getCapabilityUid(), capabilities.get("virtual_linkable").getUniqueId()); + assertEquals(mappedByReqOwner.get(cp2Uid).get(0).getRelationships().get(0).getRelation().getCapabilityUid(), capabilities.get("link").getUniqueId()); } @Test(enabled = true) @@ -46,7 +46,6 @@ import org.apache.http.entity.mime.content.FileBody; import org.apache.http.entity.mime.content.StringBody; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; - import org.junit.Rule; import org.junit.rules.TestName; import org.openecomp.sdc.be.model.LifecycleStateEnum; @@ -66,7 +65,6 @@ import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; import org.openecomp.sdc.ci.tests.execute.TODO.ImportCapabilityTypeCITest; import org.openecomp.sdc.ci.tests.utils.DbUtils; import org.openecomp.sdc.ci.tests.utils.Utils; -import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ImportRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; @@ -33,7 +33,6 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; -import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; @@ -48,11 +47,12 @@ import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.model.CapReqDef; import org.openecomp.sdc.be.model.CapabilityDefinition; +import org.openecomp.sdc.be.model.CapabilityRequirementRelationship; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.LifecycleStateEnum; import org.openecomp.sdc.be.model.PropertyDefinition; import org.openecomp.sdc.be.model.RelationshipImpl; -import org.openecomp.sdc.be.model.RequirementAndRelationshipPair; +import org.openecomp.sdc.be.model.RelationshipInfo; import org.openecomp.sdc.be.model.RequirementCapabilityRelDef; import org.openecomp.sdc.be.model.RequirementDefinition; import org.openecomp.sdc.be.model.Resource; @@ -94,8 +94,6 @@ import org.testng.annotations.BeforeMethod; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; -import aj.org.objectweb.asm.Attribute; - /** * * @author Andrey + Pavel + Shay @@ -115,7 +113,6 @@ public class ImportToscaResourceTest extends ComponentBaseTest { protected static User testerUser; protected String testResourcesPath; protected ResourceReqDetails resourceDetails; - private HashSet<String> capabilitySources; private int actualNumOfReqOrCap; @Rule @@ -130,7 +127,6 @@ public class ImportToscaResourceTest extends ComponentBaseTest { String sourceDir = config.getResourceConfigDir(); final String workDir = "importToscaResourceByCreateUrl"; testResourcesPath = sourceDir + File.separator + workDir; - capabilitySources = new HashSet<String>(); actualNumOfReqOrCap = 0; } @@ -1341,7 +1337,7 @@ public class ImportToscaResourceTest extends ComponentBaseTest { requirementDef.setFromNode(riReq.getUniqueId()); requirementDef.setToNode(riCap.getUniqueId()); - RequirementAndRelationshipPair pair = new RequirementAndRelationshipPair(); + RelationshipInfo pair = new RelationshipInfo(); pair.setRequirementOwnerId(riReq.getUniqueId()); pair.setCapabilityOwnerId(riCap.getUniqueId()); pair.setRequirement("VirtualBinding"); @@ -1350,8 +1346,10 @@ public class ImportToscaResourceTest extends ComponentBaseTest { pair.setRelationships(relationship); pair.setCapabilityUid(capbilityUid); pair.setRequirementUid(requirementUid); - List<RequirementAndRelationshipPair> relationships = new ArrayList<>(); - relationships.add(pair); + CapabilityRequirementRelationship capReqRel = new CapabilityRequirementRelationship(); + capReqRel.setRelation(pair); + List<CapabilityRequirementRelationship> relationships = new ArrayList<>(); + relationships.add(capReqRel); requirementDef.setRelationships(relationships); RestResponse associateInstances = ComponentInstanceRestUtils.associateInstances(requirementDef, sdncUserDetails, @@ -21,7 +21,6 @@ package org.openecomp.sdc.ci.tests.execute.imports; import static org.testng.AssertJUnit.assertTrue; -import static org.testng.AssertJUnit.assertEquals; import java.nio.file.Files; import java.nio.file.Path; @@ -1,10 +1,14 @@ package org.openecomp.sdc.ci.tests.execute.imports; +import static org.junit.Assert.assertEquals; + +import java.nio.file.Paths; +import java.util.Map; + import org.junit.rules.TestName; import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.ci.tests.api.ComponentBaseTest; -import org.openecomp.sdc.ci.tests.config.Config; import org.openecomp.sdc.ci.tests.datatypes.ImportReqDetails; import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.enums.ServiceCategoriesEnum; @@ -20,12 +24,6 @@ import org.openecomp.sdc.ci.tests.utils.rest.ServiceRestUtils; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; -import java.io.File; -import java.nio.file.Paths; -import java.util.Map; - -import static org.junit.Assert.assertEquals; - public class ToscaTemplateVersionTest extends ComponentBaseTest { private static final String EXPECTED_EXPORT_TOSCA_VERSION = "tosca_simple_yaml_1_1"; @@ -49,7 +49,6 @@ import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ComponentInstanceRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.PropertyRestUtils; -import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; import org.openecomp.sdc.ci.tests.utils.rest.ServiceRestUtils; import org.testng.annotations.BeforeMethod; @@ -28,7 +28,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import org.apache.log4j.lf5.util.ResourceUtils; import org.json.simple.JSONObject; import org.json.simple.JSONValue; import org.junit.Rule; @@ -46,7 +45,6 @@ import org.openecomp.sdc.ci.tests.datatypes.http.HttpHeaderEnum; import org.openecomp.sdc.ci.tests.datatypes.http.HttpRequest; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; import org.openecomp.sdc.ci.tests.preRequisites.SimpleOneRsrcOneServiceTest; -import org.openecomp.sdc.ci.tests.utils.Utils; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.openecomp.sdc.ci.tests.utils.rest.PropertyRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils; @@ -57,8 +55,6 @@ import org.testng.AssertJUnit; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; -import com.google.gson.Gson; - public class PropertyApisTest extends SimpleOneRsrcOneServiceTest { protected static final String RESOURCE_CATEGORY = "Generic/Databases"; @@ -25,7 +25,6 @@ import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; import org.openecomp.sdc.common.util.SerializationUtils; -import org.testng.annotations.Test; import fj.data.Either; @@ -39,9 +39,10 @@ import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.model.CapReqDef; import org.openecomp.sdc.be.model.CapabilityDefinition; +import org.openecomp.sdc.be.model.CapabilityRequirementRelationship; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.RelationshipImpl; -import org.openecomp.sdc.be.model.RequirementAndRelationshipPair; +import org.openecomp.sdc.be.model.RelationshipInfo; import org.openecomp.sdc.be.model.RequirementCapabilityRelDef; import org.openecomp.sdc.be.model.RequirementDefinition; import org.openecomp.sdc.be.model.Resource; @@ -71,16 +72,12 @@ public class ComponentRelationshipInVfTest extends ComponentBaseTest { private ResourceReqDetails resourceDetailsVF; private User designerUser; - private User adminUser; - private User testerUser; private ResourceReqDetails resourceDetailsReq; private ResourceReqDetails resourceDetailsCap; @BeforeMethod public void before() throws Exception { designerUser = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER); - adminUser = ElementFactory.getDefaultUser(UserRoleEnum.ADMIN); - testerUser = ElementFactory.getDefaultUser(UserRoleEnum.TESTER); resourceDetailsVF = ElementFactory.getDefaultResourceByType("VF100", NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_INFRASTRUCTURE, designerUser.getUserId(), ResourceTypeEnum.VF.toString()); @@ -119,7 +116,7 @@ public class ComponentRelationshipInVfTest extends ComponentBaseTest { requirementDef.setFromNode(riReq.getUniqueId()); requirementDef.setToNode(riCap.getUniqueId()); - RequirementAndRelationshipPair pair = new RequirementAndRelationshipPair(); + RelationshipInfo pair = new RelationshipInfo(); pair.setRequirementOwnerId(riReq.getUniqueId()); pair.setCapabilityOwnerId(riCap.getUniqueId()); pair.setRequirement("host"); @@ -128,8 +125,10 @@ public class ComponentRelationshipInVfTest extends ComponentBaseTest { pair.setRelationships(relationship); pair.setCapabilityUid(capbilityUid); pair.setRequirementUid(requirementUid); - List<RequirementAndRelationshipPair> relationships = new ArrayList<>(); - relationships.add(pair); + List<CapabilityRequirementRelationship> relationships = new ArrayList<>(); + CapabilityRequirementRelationship capReqRel = new CapabilityRequirementRelationship(); + capReqRel.setRelation(pair); + relationships.add(capReqRel); requirementDef.setRelationships(relationships); return requirementDef; } @@ -179,7 +178,7 @@ public class ComponentRelationshipInVfTest extends ComponentBaseTest { requirementDef.setFromNode(riReq.getUniqueId()); requirementDef.setToNode(riCap.getUniqueId()); - RequirementAndRelationshipPair pair = new RequirementAndRelationshipPair(); + RelationshipInfo pair = new RelationshipInfo(); pair.setRequirementOwnerId(riReq.getUniqueId()); pair.setCapabilityOwnerId(riCap.getUniqueId()); pair.setRequirement("host"); @@ -188,8 +187,10 @@ public class ComponentRelationshipInVfTest extends ComponentBaseTest { pair.setRelationships(relationship); pair.setCapabilityUid(capList.get(0).getUniqueId()); pair.setRequirementUid(reqList.get(0).getUniqueId()); - List<RequirementAndRelationshipPair> relationships = new ArrayList<>(); - relationships.add(pair); + List<CapabilityRequirementRelationship> relationships = new ArrayList<>(); + CapabilityRequirementRelationship capReqRel = new CapabilityRequirementRelationship(); + capReqRel.setRelation(pair); + relationships.add(capReqRel); requirementDef.setRelationships(relationships); RestResponse associateInstances = ComponentInstanceRestUtils.associateInstances(requirementDef, designerUser, @@ -367,10 +368,8 @@ public class ComponentRelationshipInVfTest extends ComponentBaseTest { public void associateCpToVfTest() throws Exception { createTwoAtomicResourcesByType(ResourceTypeEnum.CP.toString(), ResourceTypeEnum.VL.toString()); - ComponentInstance riCapInVfInstance = createComponentInstance(resourceDetailsCap, designerUser, - resourceDetailsVF); - ComponentInstance riReqInVfInstance = createComponentInstance(resourceDetailsReq, designerUser, - resourceDetailsVF); + createComponentInstance(resourceDetailsCap, designerUser, resourceDetailsVF); + createComponentInstance(resourceDetailsReq, designerUser, resourceDetailsVF); ResourceReqDetails vfHigh = new ResourceReqDetails(resourceDetailsVF, "0.1"); vfHigh.setName("vfHigh"); @@ -510,10 +509,6 @@ public class ComponentRelationshipInVfTest extends ComponentBaseTest { ComponentInstance riCap = createComponentInstance(resourceDetailsCap); CapReqDef capReqDefBeforeAssociate = getResourceReqCap(); - Map<String, List<CapabilityDefinition>> capabilitiesBeforeAssociate = capReqDefBeforeAssociate - .getCapabilities(); - Map<String, List<RequirementDefinition>> requirementsBeforeAssociate = capReqDefBeforeAssociate - .getRequirements(); RequirementCapabilityRelDef requirementDef = setRelationshipBetweenInstances(riReq, riCap, capReqDefBeforeAssociate); @@ -544,10 +539,6 @@ public class ComponentRelationshipInVfTest extends ComponentBaseTest { ComponentInstance riCap = createComponentInstance(resourceDetailsCap); CapReqDef capReqDefBeforeAssociate = getResourceReqCap(); - Map<String, List<CapabilityDefinition>> capabilitiesBeforeAssociate = capReqDefBeforeAssociate - .getCapabilities(); - Map<String, List<RequirementDefinition>> requirementsBeforeAssociate = capReqDefBeforeAssociate - .getRequirements(); RequirementCapabilityRelDef requirementDef = setRelationshipBetweenInstances(riReq, riCap, capReqDefBeforeAssociate); @@ -979,7 +970,7 @@ public class ComponentRelationshipInVfTest extends ComponentBaseTest { RequirementCapabilityRelDef requirementDef = setRelationshipBetweenInstances(riReq, riCap, capReqDefBeforeAssociate); assertTrue(requirementDef.getRelationships().size() == 1); - String requirement = requirementDef.getRelationships().get(0).getRequirement(); + String requirement = requirementDef.getRelationships().get(0).getRelation().getRequirement(); RestResponse associateInstances = ComponentInstanceRestUtils.associateInstances(requirementDef, designerUser, resourceDetailsVF.getUniqueId(), ComponentTypeEnum.RESOURCE); assertEquals("Check response code ", 404, associateInstances.getErrorCode().intValue()); @@ -1122,7 +1113,7 @@ public class ComponentRelationshipInVfTest extends ComponentBaseTest { .getCapabilities(); Map<String, List<RequirementDefinition>> requirementsBeforeAssociate = capReqDefBeforeAssociate .getRequirements(); - String requirementName = requirementDef.getRelationships().get(0).getRequirement(); + String requirementName = requirementDef.getRelationships().get(0).getRelation().getRequirement(); RestResponse dissociateInstances = ComponentInstanceRestUtils.dissociateInstances(requirementDef, designerUser, resourceDetailsVF.getUniqueId(), ComponentTypeEnum.RESOURCE); @@ -1152,10 +1143,6 @@ public class ComponentRelationshipInVfTest extends ComponentBaseTest { RequirementCapabilityRelDef requirementDef = setRelationshipBetweenInstances(riReq, riCap, capReqDefBeforeAssociate); - Map<String, List<CapabilityDefinition>> capabilitiesBeforeAssociate = capReqDefBeforeAssociate - .getCapabilities(); - Map<String, List<RequirementDefinition>> requirementsBeforeAssociate = capReqDefBeforeAssociate - .getRequirements(); String uidNotFound = "123"; RestResponse dissociateInstances = ComponentInstanceRestUtils.dissociateInstances(requirementDef, designerUser, @@ -1326,7 +1313,7 @@ public class ComponentRelationshipInVfTest extends ComponentBaseTest { Map<String, List<RequirementDefinition>> requirementsBeforeAssociate = capReqDefBeforeAssociate .getRequirements(); - RestResponse associateInstances = ComponentInstanceRestUtils.associateInstances(requirementDef, designerUser, + ComponentInstanceRestUtils.associateInstances(requirementDef, designerUser, resourceDetailsVF.getUniqueId(), ComponentTypeEnum.RESOURCE); RestResponse deleteResourceResponse = ResourceRestUtils.deleteResource(resourceDetailsCap.getUniqueId(), @@ -23,7 +23,6 @@ package org.openecomp.sdc.ci.tests.execute.resource; import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.STATUS_CODE_SUCCESS; import static org.testng.AssertJUnit.assertEquals; import static org.testng.AssertJUnit.assertNotNull; -import static org.testng.AssertJUnit.assertTrue; import java.util.ArrayList; import java.util.Arrays; @@ -31,18 +30,13 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import javax.validation.constraints.AssertTrue; - -import org.apache.log4j.lf5.util.ResourceUtils; import org.junit.Rule; import org.junit.rules.TestName; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; -import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.LifecycleStateEnum; import org.openecomp.sdc.be.model.Resource; -import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.ci.tests.api.ComponentBaseTest; import org.openecomp.sdc.ci.tests.api.Urls; @@ -52,7 +46,6 @@ import org.openecomp.sdc.ci.tests.datatypes.ComponentInstanceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.ResourceRespJavaObject; import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; -import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.ErrorInfo; import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum; @@ -65,7 +58,6 @@ import org.openecomp.sdc.ci.tests.datatypes.http.HttpRequest; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; import org.openecomp.sdc.ci.tests.utils.DbUtils; import org.openecomp.sdc.ci.tests.utils.Utils; -import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils; import org.openecomp.sdc.ci.tests.utils.general.Convertor; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.openecomp.sdc.ci.tests.utils.rest.ArtifactRestUtils; @@ -78,7 +70,6 @@ import org.openecomp.sdc.ci.tests.utils.rest.ServiceRestUtils; import org.openecomp.sdc.ci.tests.utils.validation.AuditValidationUtils; import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils; import org.openecomp.sdc.ci.tests.utils.validation.ResourceValidationUtils; -import org.openecomp.sdc.ci.tests.utils.validation.ServiceValidationUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.testng.annotations.Test; @@ -27,7 +27,6 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.Map; -import org.apache.log4j.lf5.util.ResourceUtils; import org.junit.rules.TestName; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.User; @@ -38,7 +37,6 @@ import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; import org.openecomp.sdc.ci.tests.utils.DbUtils; -import org.openecomp.sdc.ci.tests.utils.Utils; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.openecomp.sdc.ci.tests.utils.rest.LifecycleRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils; @@ -1,5 +1,10 @@ package org.openecomp.sdc.ci.tests.execute.resource; +import static org.testng.AssertJUnit.assertTrue; + +import java.io.IOException; +import java.util.Arrays; + import org.json.simple.JSONArray; import org.json.simple.JSONObject; import org.json.simple.JSONValue; @@ -19,15 +24,10 @@ import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.testng.AssertJUnit; -import org.testng.annotations.BeforeClass; import org.testng.annotations.AfterClass; +import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; -import java.io.IOException; -import java.util.Arrays; - -import static org.testng.AssertJUnit.assertTrue; - /** * Created by chaya on 6/15/2017. */ @@ -30,7 +30,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import org.apache.log4j.lf5.util.ResourceUtils; import org.junit.Rule; import org.junit.rules.TestName; import org.openecomp.sdc.be.model.User; @@ -45,7 +44,6 @@ import org.openecomp.sdc.ci.tests.datatypes.http.HttpHeaderEnum; import org.openecomp.sdc.ci.tests.datatypes.http.HttpRequest; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; import org.openecomp.sdc.ci.tests.execute.imports.ImportGenericResourceCITest; -import org.openecomp.sdc.ci.tests.utils.Utils; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils; import org.slf4j.Logger; @@ -33,7 +33,6 @@ import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.util.EntityUtils; -import org.apache.log4j.lf5.util.ResourceUtils; import org.json.simple.JSONArray; import org.json.simple.JSONObject; import org.json.simple.JSONValue; @@ -40,7 +40,6 @@ import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.model.LifecycleStateEnum; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.be.model.category.CategoryDefinition; import org.openecomp.sdc.ci.tests.api.ComponentBaseTest; import org.openecomp.sdc.ci.tests.api.Urls; import org.openecomp.sdc.ci.tests.config.Config; @@ -57,7 +57,6 @@ import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils; import org.testng.annotations.BeforeMethod; -import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; import com.google.gson.Gson; @@ -23,7 +23,6 @@ package org.openecomp.sdc.ci.tests.execute.resource; import static org.testng.AssertJUnit.assertNotNull; import static org.testng.AssertJUnit.assertTrue; -import java.io.IOException; import java.util.List; import org.json.simple.JSONArray; @@ -32,8 +31,6 @@ import org.json.simple.JSONValue; import org.junit.Rule; import org.junit.rules.TestName; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; -import org.openecomp.sdc.be.model.ArtifactDefinition; -import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.User; @@ -46,7 +43,6 @@ import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; -import org.openecomp.sdc.ci.tests.execute.lifecycle.LCSbaseTest; import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.openecomp.sdc.ci.tests.utils.rest.LifecycleRestUtils; @@ -40,10 +40,11 @@ import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.model.CapReqDef; import org.openecomp.sdc.be.model.CapabilityDefinition; +import org.openecomp.sdc.be.model.CapabilityRequirementRelationship; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.LifecycleStateEnum; import org.openecomp.sdc.be.model.RelationshipImpl; -import org.openecomp.sdc.be.model.RequirementAndRelationshipPair; +import org.openecomp.sdc.be.model.RelationshipInfo; import org.openecomp.sdc.be.model.RequirementCapabilityRelDef; import org.openecomp.sdc.be.model.RequirementDefinition; import org.openecomp.sdc.be.model.Resource; @@ -1686,7 +1687,7 @@ public class VfComponentInstanceCRUDTest extends ComponentInstanceBaseTest { requirementDef.setFromNode(riReq.getUniqueId()); requirementDef.setToNode(riCap.getUniqueId()); - RequirementAndRelationshipPair pair = new RequirementAndRelationshipPair(); + RelationshipInfo pair = new RelationshipInfo(); pair.setRequirementOwnerId(riReq.getUniqueId()); pair.setCapabilityOwnerId(riCap.getUniqueId()); pair.setRequirement("host"); @@ -1695,8 +1696,10 @@ public class VfComponentInstanceCRUDTest extends ComponentInstanceBaseTest { pair.setRelationships(relationship); pair.setCapabilityUid(capList.get(0).getUniqueId()); pair.setRequirementUid(reqList.get(0).getUniqueId()); - List<RequirementAndRelationshipPair> relationships = new ArrayList<>(); - relationships.add(pair); + List<CapabilityRequirementRelationship> relationships = new ArrayList<>(); + CapabilityRequirementRelationship capReqRel = new CapabilityRequirementRelationship(); + relationships.add(capReqRel); + capReqRel.setRelation(pair); requirementDef.setRelationships(relationships); RestResponse associateInstances = ComponentInstanceRestUtils.associateInstances(requirementDef, @@ -32,7 +32,6 @@ import org.junit.Rule; import org.junit.rules.TestName; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; -import org.openecomp.sdc.be.model.ArtifactDefinition; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.DistributionStatusEnum; import org.openecomp.sdc.be.model.LifecycleStateEnum; @@ -45,7 +44,6 @@ import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.ErrorInfo; import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum; -import org.openecomp.sdc.ci.tests.datatypes.enums.ServiceCategoriesEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.datatypes.expected.ExpectedResourceAuditJavaObject; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; @@ -61,8 +59,6 @@ import org.openecomp.sdc.ci.tests.utils.validation.ServiceValidationUtils; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; -import fj.data.Either; - public class ChangeServiceDistributionStatusApiTest extends ComponentBaseTest { protected ResourceReqDetails resourceDetails; @@ -20,7 +20,6 @@ package org.openecomp.sdc.ci.tests.execute.service; -import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.STATUS_CODE_SUCCESS; import static org.testng.AssertJUnit.assertEquals; import static org.testng.AssertJUnit.assertNotNull; @@ -37,7 +36,6 @@ import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.LifecycleStateEnum; -import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.ci.tests.api.ComponentBaseTest; @@ -49,7 +47,6 @@ import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.ErrorInfo; import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum; -import org.openecomp.sdc.ci.tests.datatypes.enums.ServiceCategoriesEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.datatypes.expected.ExpectedResourceAuditJavaObject; import org.openecomp.sdc.ci.tests.datatypes.http.HttpHeaderEnum; @@ -63,7 +60,6 @@ import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ComponentInstanceRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.LifecycleRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ProductRestUtils; -import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; import org.openecomp.sdc.ci.tests.utils.rest.ServiceRestUtils; import org.openecomp.sdc.ci.tests.utils.validation.AuditValidationUtils; @@ -28,7 +28,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import org.apache.cassandra.transport.Event.SchemaChange.Target; import org.junit.Rule; import org.junit.rules.TestName; import org.openecomp.sdc.be.dao.api.ActionStatus; @@ -27,10 +27,8 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.stream.Collectors; import org.apache.http.HttpStatus; -import org.apache.log4j.lf5.util.ResourceUtils; import org.junit.Rule; import org.junit.rules.TestName; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; @@ -67,7 +65,6 @@ import org.testng.annotations.Test; import com.google.gson.JsonArray; import com.google.gson.JsonElement; -import com.google.gson.JsonObject; import fj.data.Either; @@ -46,7 +46,6 @@ import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.ServiceCategoriesEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; -import org.openecomp.sdc.ci.tests.utils.Utils; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.openecomp.sdc.ci.tests.utils.rest.ArtifactRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.LifecycleRestUtils; @@ -39,10 +39,11 @@ import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.model.CapReqDef; import org.openecomp.sdc.be.model.CapabilityDefinition; +import org.openecomp.sdc.be.model.CapabilityRequirementRelationship; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.RelationshipImpl; -import org.openecomp.sdc.be.model.RequirementAndRelationshipPair; +import org.openecomp.sdc.be.model.RelationshipInfo; import org.openecomp.sdc.be.model.RequirementCapabilityRelDef; import org.openecomp.sdc.be.model.RequirementDefinition; import org.openecomp.sdc.be.model.Resource; @@ -1045,7 +1046,7 @@ public class ReqCapOccurrencesTest extends ComponentInstanceBaseTest { requirementDef.setFromNode(riReq.getUniqueId()); requirementDef.setToNode(riCap.getUniqueId()); - RequirementAndRelationshipPair pair = new RequirementAndRelationshipPair(); + RelationshipInfo pair = new RelationshipInfo(); pair.setRequirementOwnerId(riReq.getUniqueId()); pair.setCapabilityOwnerId(riCap.getUniqueId()); pair.setRequirement("host"); @@ -1054,8 +1055,10 @@ public class ReqCapOccurrencesTest extends ComponentInstanceBaseTest { pair.setRelationships(relationship); pair.setCapabilityUid(capbilityUid); pair.setRequirementUid(requirementUid); - List<RequirementAndRelationshipPair> relationships = new ArrayList<>(); - relationships.add(pair); + List<CapabilityRequirementRelationship> relationships = new ArrayList<>(); + CapabilityRequirementRelationship capReqRel = new CapabilityRequirementRelationship(); + relationships.add(capReqRel); + capReqRel.setRelation(pair); requirementDef.setRelationships(relationships); return requirementDef; } @@ -34,9 +34,14 @@ import org.json.JSONArray; import org.junit.rules.TestName; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; -import org.openecomp.sdc.be.model.*; +import org.openecomp.sdc.be.model.CapReqDef; +import org.openecomp.sdc.be.model.CapabilityDefinition; +import org.openecomp.sdc.be.model.Component; +import org.openecomp.sdc.be.model.ComponentInstance; +import org.openecomp.sdc.be.model.RequirementCapabilityRelDef; +import org.openecomp.sdc.be.model.RequirementDefinition; +import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.ci.tests.api.ComponentInstanceBaseTest; -import org.openecomp.sdc.ci.tests.api.Urls; import org.openecomp.sdc.ci.tests.datatypes.ArtifactReqDetails; import org.openecomp.sdc.ci.tests.datatypes.ComponentInstanceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.ComponentReqDetails; @@ -44,10 +49,8 @@ import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum; -import org.openecomp.sdc.ci.tests.datatypes.enums.ServiceCategoriesEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; -import org.openecomp.sdc.ci.tests.utils.Utils; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.openecomp.sdc.ci.tests.utils.rest.ArtifactRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ComponentInstanceRestUtils; @@ -45,7 +45,6 @@ import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum; -import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.ServiceCategoriesEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; @@ -523,6 +522,15 @@ public class UpdateServiceMetadataTest extends ComponentBaseTest { getServiceAndValidate(serviceDetails, LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT); } + @Test + public void environmentContextService() throws Exception { + updatedServiceDetails.setEnvironmentContext("General_Revenue-Bearing"); + RestResponse updateServiceResponse = ServiceRestUtils.updateService(updatedServiceDetails, sdncDesignerDetails); + validateResponse(updateServiceResponse, 200, null, listForMessage); + Service actualService = ResponseParser.convertServiceResponseToJavaObject(updateServiceResponse.getResponse()); + assertEquals(updatedServiceDetails.getEnvironmentContext(), actualService.getEnvironmentContext()); + } + // TODO Irrelevant @Test(enabled = false) public void missingProjectCodeTest1() throws Exception { @@ -47,9 +47,7 @@ import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; -import org.openecomp.sdc.ci.tests.execute.lifecycle.LCSbaseTest; import org.openecomp.sdc.ci.tests.utils.DbUtils; -import org.openecomp.sdc.ci.tests.utils.Utils; import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.openecomp.sdc.ci.tests.utils.rest.ArtifactRestUtils; @@ -20,11 +20,11 @@ package org.openecomp.sdc.ci.tests.migration.v1707; -import com.thinkaurelius.titan.core.TitanGraph; - import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertNull; +import com.thinkaurelius.titan.core.TitanGraph; + public class CommonMigrationUtils { public static void assertKeyNotExist(TitanGraph graph, String key) { @@ -20,7 +20,16 @@ package org.openecomp.sdc.ci.tests.migration.v1707.postupgrade; -import com.thinkaurelius.titan.core.TitanVertex; +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertNotNull; +import static org.testng.Assert.assertNull; +import static org.testng.Assert.assertTrue; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + import org.junit.Rule; import org.junit.rules.TestName; import org.openecomp.sdc.ci.tests.api.ComponentBaseTest; @@ -28,12 +37,7 @@ import org.openecomp.sdc.ci.tests.migration.v1707.CommonMigrationUtils; import org.openecomp.sdc.ci.tests.utils.graph.GraphFileUtils; import org.testng.annotations.Test; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import static org.testng.Assert.*; +import com.thinkaurelius.titan.core.TitanVertex; public class AttKeyPropertiesRenameTest extends ComponentBaseTest { @@ -20,7 +20,10 @@ package org.openecomp.sdc.ci.tests.migration.v1707.preupgrade; -import com.thinkaurelius.titan.core.TitanVertex; +import static org.testng.Assert.assertTrue; + +import java.io.IOException; + import org.junit.Rule; import org.junit.rules.TestName; import org.openecomp.sdc.ci.tests.api.ComponentBaseTest; @@ -28,9 +31,7 @@ import org.openecomp.sdc.ci.tests.migration.v1707.CommonMigrationUtils; import org.openecomp.sdc.ci.tests.utils.graph.GraphFileUtils; import org.testng.annotations.Test; -import java.io.IOException; - -import static org.testng.Assert.assertTrue; +import com.thinkaurelius.titan.core.TitanVertex; public class AttKeyPropertiesBeforeRenameTest extends ComponentBaseTest { @@ -20,14 +20,14 @@ package org.openecomp.sdc.ci.tests.sanity; +import static org.testng.AssertJUnit.assertTrue; + import java.util.ArrayList; import java.util.List; -import java.util.Map; import org.junit.Rule; import org.junit.rules.TestName; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; -import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.ci.tests.api.ComponentBaseTest; @@ -43,7 +43,6 @@ import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.openecomp.sdc.ci.tests.utils.rest.ComponentInstanceRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ProductRestUtils; import org.testng.annotations.Test; -import static org.testng.AssertJUnit.assertTrue; public class MultipleResourceUpdate extends ComponentBaseTest { @@ -29,7 +29,15 @@ import java.util.Map.Entry; import java.util.Set; import org.apache.tinkerpop.gremlin.structure.Edge; +import org.apache.tinkerpop.gremlin.structure.Element; import org.apache.tinkerpop.gremlin.structure.Vertex; +import org.apache.tinkerpop.gremlin.structure.util.ElementHelper; +import org.openecomp.sdc.ci.tests.api.Urls; +import org.openecomp.sdc.ci.tests.config.Config; +import org.openecomp.sdc.ci.tests.datatypes.http.HttpRequest; +import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; +import org.openecomp.sdc.ci.tests.users.UserAuditJavaObject; +import org.openecomp.sdc.ci.tests.utils.cassandra.CassandraUtils; import com.google.gson.Gson; import com.google.gson.JsonArray; @@ -43,19 +51,6 @@ import com.thinkaurelius.titan.core.TitanVertex; import fj.data.Either; -import org.apache.tinkerpop.gremlin.structure.Direction; -import org.apache.tinkerpop.gremlin.structure.Edge; -import org.apache.tinkerpop.gremlin.structure.Vertex; -import org.apache.tinkerpop.gremlin.structure.util.ElementHelper; -import org.openecomp.sdc.ci.tests.api.Urls; -import org.openecomp.sdc.ci.tests.config.Config; -import org.openecomp.sdc.ci.tests.datatypes.http.HttpRequest; -import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; -import org.openecomp.sdc.ci.tests.users.UserAuditJavaObject; -import org.openecomp.sdc.ci.tests.utils.cassandra.CassandraUtils; -import org.apache.tinkerpop.gremlin.structure.Element; -import org.apache.tinkerpop.gremlin.structure.Property; - public class DbUtils { private static String titanConfigFilePath; @@ -42,7 +42,7 @@ import org.openecomp.sdc.be.model.CapabilityDefinition; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.Product; -import org.openecomp.sdc.be.model.RequirementAndRelationshipPair; +import org.openecomp.sdc.be.model.RelationshipInfo; import org.openecomp.sdc.be.model.RequirementCapabilityRelDef; import org.openecomp.sdc.be.model.RequirementDefinition; import org.openecomp.sdc.be.model.Resource; @@ -580,7 +580,7 @@ public class ReqCap { private static void deleteAssociatedFromExpected(RequirementCapabilityRelDef requirementDef) { // removing from requirements - RequirementAndRelationshipPair relationship = requirementDef.getRelationships().get(0); + RelationshipInfo relationship = requirementDef.getRelationships().get(0).getRelation(); String type = relationship.getRelationship().getType(); String fromId = requirementDef.getFromNode(); List<RequirementDefinition> reqList = expectedContainerRequirements.get(type); @@ -612,7 +612,7 @@ public class ReqCap { private static void addDissociatedToExpected(RequirementCapabilityRelDef requirementDef) { // adding to requirements - RequirementAndRelationshipPair relationship = requirementDef.getRelationships().get(0); + RelationshipInfo relationship = requirementDef.getRelationships().get(0).getRelation(); String type = relationship.getRelationship().getType(); String fromId = requirementDef.getFromNode(); String key = type + " " + fromId; @@ -20,10 +20,10 @@ package org.openecomp.sdc.ci.tests.utils.cassandra; -import com.datastax.driver.core.*; -import com.datastax.driver.core.querybuilder.QueryBuilder; -import com.datastax.driver.core.querybuilder.Select; -import com.datastax.driver.core.querybuilder.Select.Where; +import java.io.FileNotFoundException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; import org.javatuples.Pair; import org.openecomp.sdc.be.resources.data.auditing.AuditingTypesConstants; @@ -32,10 +32,15 @@ import org.openecomp.sdc.common.datastructure.AuditingFieldsKeysEnum; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.io.FileNotFoundException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; +import com.datastax.driver.core.Cluster; +import com.datastax.driver.core.KeyspaceMetadata; +import com.datastax.driver.core.Metadata; +import com.datastax.driver.core.Row; +import com.datastax.driver.core.Session; +import com.datastax.driver.core.TableMetadata; +import com.datastax.driver.core.querybuilder.QueryBuilder; +import com.datastax.driver.core.querybuilder.Select; +import com.datastax.driver.core.querybuilder.Select.Where; public final class CassandraUtils { private static Logger logger = LoggerFactory.getLogger(CassandraUtils.class.getName()); @@ -20,10 +20,10 @@ package org.openecomp.sdc.ci.tests.utils.cassandra; -import com.datastax.driver.core.*; -import com.datastax.driver.core.querybuilder.QueryBuilder; -import com.datastax.driver.core.querybuilder.Select; -import com.datastax.driver.core.querybuilder.Select.Where; +import java.io.FileNotFoundException; +import java.util.Collection; +import java.util.List; + import org.javatuples.Pair; import org.openecomp.sdc.be.resources.data.auditing.AuditingTypesConstants; import org.openecomp.sdc.ci.tests.utils.Utils; @@ -31,9 +31,15 @@ import org.openecomp.sdc.common.datastructure.AuditingFieldsKeysEnum; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.io.FileNotFoundException; -import java.util.Collection; -import java.util.List; +import com.datastax.driver.core.Cluster; +import com.datastax.driver.core.KeyspaceMetadata; +import com.datastax.driver.core.Metadata; +import com.datastax.driver.core.Row; +import com.datastax.driver.core.Session; +import com.datastax.driver.core.TableMetadata; +import com.datastax.driver.core.querybuilder.QueryBuilder; +import com.datastax.driver.core.querybuilder.Select; +import com.datastax.driver.core.querybuilder.Select.Where; public final class CassandraUtils2 { private static Logger logger = LoggerFactory.getLogger(CassandraUtils2.class.getName()); @@ -29,7 +29,6 @@ import java.util.List; import org.apache.commons.lang3.StringUtils; import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.model.DistributionStatusEnum; import org.openecomp.sdc.be.model.LifecycleStateEnum; import org.openecomp.sdc.be.model.Product; import org.openecomp.sdc.be.model.User; @@ -40,12 +39,10 @@ import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.ResourceRespJavaObject; import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.enums.ErrorInfo; -import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.datatypes.expected.ExpectedProductAudit; import org.openecomp.sdc.ci.tests.datatypes.expected.ExpectedResourceAuditJavaObject; import org.openecomp.sdc.ci.tests.datatypes.expected.ExpectedUserCRUDAudit; -import org.openecomp.sdc.ci.tests.utils.Utils; import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils; import org.openecomp.sdc.common.api.Constants; @@ -33,10 +33,11 @@ import org.openecomp.sdc.be.datatypes.enums.AssetTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.model.ArtifactDefinition; import org.openecomp.sdc.be.model.CapabilityDefinition; +import org.openecomp.sdc.be.model.CapabilityRequirementRelationship; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.LifecycleStateEnum; import org.openecomp.sdc.be.model.RelationshipImpl; -import org.openecomp.sdc.be.model.RequirementAndRelationshipPair; +import org.openecomp.sdc.be.model.RelationshipInfo; import org.openecomp.sdc.be.model.RequirementCapabilityRelDef; import org.openecomp.sdc.be.model.RequirementDefinition; import org.openecomp.sdc.be.model.Resource; @@ -51,7 +52,6 @@ import org.openecomp.sdc.ci.tests.datatypes.ComponentReqDetails; import org.openecomp.sdc.ci.tests.datatypes.ImportReqDetails; import org.openecomp.sdc.ci.tests.datatypes.ProductReqDetails; import org.openecomp.sdc.ci.tests.datatypes.PropertyReqDetails; -import org.openecomp.sdc.ci.tests.datatypes.ResourceAssetStructure; import org.openecomp.sdc.ci.tests.datatypes.ResourceExternalReqDetails; import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; @@ -71,8 +71,6 @@ import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils; import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum; import org.openecomp.sdc.common.util.ValidationUtils; -import com.google.common.base.CaseFormat; - public class ElementFactory { private static final String JH0003 = "jh0003"; @@ -915,7 +913,7 @@ public class ElementFactory { RequirementCapabilityRelDef requirementDef = new RequirementCapabilityRelDef(); requirementDef.setFromNode(fromCompInstId); requirementDef.setToNode(toCompInstId); - RequirementAndRelationshipPair pair = new RequirementAndRelationshipPair(); + RelationshipInfo pair = new RelationshipInfo(); pair.setRequirementOwnerId(reqOwnerId); pair.setCapabilityOwnerId(capOwnerId); pair.setRequirement(reqCapName); @@ -924,8 +922,10 @@ public class ElementFactory { pair.setRelationships(relationship); pair.setCapabilityUid(capList.get(0).getUniqueId()); pair.setRequirementUid(reqList.get(0).getUniqueId()); - List<RequirementAndRelationshipPair> relationships = new ArrayList<>(); - relationships.add(pair); + List<CapabilityRequirementRelationship> relationships = new ArrayList<>(); + CapabilityRequirementRelationship capReqRel = new CapabilityRequirementRelationship(); + relationships.add(capReqRel); + capReqRel.setRelation(pair); requirementDef.setRelationships(relationships); return requirementDef; } @@ -20,16 +20,10 @@ package org.openecomp.sdc.ci.tests.utils.general; -import java.io.File; import java.io.IOException; import java.util.List; -import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.ci.tests.config.Config; import org.openecomp.sdc.ci.tests.datatypes.ImportReqDetails; -import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; -import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; -import org.openecomp.sdc.ci.tests.utils.Utils; public class ImportUtils { @@ -20,10 +20,6 @@ package org.openecomp.sdc.ci.tests.utils.graph; -import com.thinkaurelius.titan.core.TitanVertex; -import org.apache.commons.io.FileUtils; -import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; - import java.io.IOException; import java.nio.charset.Charset; import java.nio.file.Files; @@ -32,6 +28,11 @@ import java.nio.file.Paths; import java.util.ArrayList; import java.util.List; +import org.apache.commons.io.FileUtils; +import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; + +import com.thinkaurelius.titan.core.TitanVertex; + public class GraphFileUtils { public static final String TEMP_FILES_PATH = "src/main/resources/ci/tempFiles/%s.txt"; @@ -24,7 +24,6 @@ import static org.testng.AssertJUnit.assertNotNull; import static org.testng.AssertJUnit.assertTrue; import java.io.IOException; -import java.net.URLEncoder; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -44,7 +43,6 @@ import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.Service; -import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.ci.tests.api.Urls; import org.openecomp.sdc.ci.tests.config.Config; import org.openecomp.sdc.ci.tests.datatypes.ArtifactAssetStructure; @@ -21,7 +21,11 @@ package org.openecomp.sdc.ci.tests.utils.rest; import java.io.IOException; -import java.util.*; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; import org.openecomp.sdc.ci.tests.api.Urls; import org.openecomp.sdc.ci.tests.config.Config; @@ -2,12 +2,11 @@ package org.openecomp.sdc.ci.tests.utils.rest; import org.openecomp.sdc.ci.tests.api.Urls; import org.openecomp.sdc.ci.tests.config.Config; +import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; import org.openecomp.sdc.ci.tests.utils.Utils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; - public class CommonRestUtils extends BaseRestUtils { private static Logger logger = LoggerFactory.getLogger(CommonRestUtils.class.getName()); @@ -34,7 +34,6 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Properties; import org.apache.commons.io.IOUtils; @@ -22,8 +22,6 @@ package org.openecomp.sdc.ci.tests.utils.rest; import java.io.IOException; -import com.google.gson.Gson; - import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.model.LifecycleStateEnum; import org.openecomp.sdc.be.model.Product; @@ -39,6 +37,8 @@ import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.google.gson.Gson; + public class ProductRestUtils extends BaseRestUtils { private static Gson gson = new Gson(); private static Logger logger = LoggerFactory.getLogger(ProductRestUtils.class.getName()); @@ -59,13 +59,13 @@ import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; import org.openecomp.sdc.ci.tests.utils.Utils; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.openecomp.sdc.common.util.GeneralUtility; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonParser; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; public class ResourceRestUtils extends BaseRestUtils { @@ -26,7 +26,6 @@ import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.ci.tests.api.Urls; import org.openecomp.sdc.ci.tests.config.Config; import org.openecomp.sdc.ci.tests.datatypes.ResourceExternalReqDetails; -import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.http.HttpHeaderEnum; import org.openecomp.sdc.ci.tests.datatypes.http.HttpRequest; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; @@ -31,10 +31,8 @@ import java.util.Map; import org.apache.commons.codec.binary.Base64; import org.apache.log4j.Logger; -import org.codehaus.jackson.JsonParseException; import org.codehaus.jackson.Version; import org.codehaus.jackson.map.JsonDeserializer; -import org.codehaus.jackson.map.JsonMappingException; import org.codehaus.jackson.map.ObjectMapper; import org.codehaus.jackson.map.module.SimpleModule; import org.json.JSONArray; @@ -44,9 +44,7 @@ import org.openecomp.sdc.ci.tests.utils.Utils; import org.openecomp.sdc.ci.tests.utils.general.FileUtils; import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum; -import com.google.gson.Gson; import com.google.gson.JsonElement; -import com.google.gson.JsonObject; import com.google.gson.JsonParser; public class ArtifactValidationUtils { @@ -28,7 +28,6 @@ import java.util.Arrays; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.ci.tests.datatypes.enums.ErrorInfo; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; -import org.openecomp.sdc.ci.tests.utils.Utils; import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; import org.openecomp.sdc.exception.ResponseFormat; import org.testng.Assert; @@ -20,9 +20,10 @@ package org.openecomp.sdc.ci.tests.utils.validation; +import static org.testng.AssertJUnit.assertEquals; import static org.testng.AssertJUnit.assertNotNull; import static org.testng.AssertJUnit.assertTrue; -import static org.testng.AssertJUnit.assertEquals; + import org.json.JSONObject; import org.openecomp.sdc.be.model.category.CategoryDefinition; import org.openecomp.sdc.be.model.category.GroupingDefinition; @@ -29,7 +29,6 @@ import java.io.InputStream; import java.util.List; import java.util.Map; -import org.yaml.snakeyaml.Yaml; import org.codehaus.jettison.json.JSONException; import org.codehaus.jettison.json.JSONObject; import org.openecomp.sdc.ci.tests.config.Config; @@ -38,6 +37,7 @@ import org.openecomp.sdc.ci.tests.datatypes.enums.ExceptionEnumType; import org.openecomp.sdc.ci.tests.utils.Utils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.yaml.snakeyaml.Yaml; public class ErrorValidationUtils { @@ -20,8 +20,9 @@ package org.openecomp.sdc.ci.tests.utils.validation; -import static org.testng.AssertJUnit.assertFalse; import static org.testng.AssertJUnit.assertEquals; +import static org.testng.AssertJUnit.assertFalse; + import java.util.LinkedHashSet; import java.util.List; import java.util.Set; @@ -31,9 +31,7 @@ import java.util.Set; import org.junit.Rule; import org.junit.rules.TestName; -import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.ci.tests.api.ComponentBaseTest; -import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaDefinition; import org.openecomp.sdc.common.util.ZipUtil; import org.testng.annotations.Test; import org.yaml.snakeyaml.Yaml; @@ -20,8 +20,8 @@ package org.openecomp.sdc.ci.tests.utils.validation; -import static org.testng.AssertJUnit.assertTrue; import static org.testng.AssertJUnit.assertEquals; +import static org.testng.AssertJUnit.assertTrue; import java.util.List; @@ -516,8 +516,7 @@ <dependency> <groupId>org.mockito</groupId> - <artifactId>mockito-all</artifactId> - <version>${mockito.version}</version> + <artifactId>mockito-core</artifactId> <scope>test</scope> </dependency> <!-- testing end --> @@ -525,6 +524,7 @@ </dependencies> <build> + <finalName>${project.artifactId}-${project.version}-jar-with-dependencies</finalName> <plugins> <plugin> @@ -539,19 +539,7 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-assembly-plugin</artifactId> - <executions> - <execution> - <id>create.jar.with.dependencies</id> - <phase>package</phase> - <goals> - <goal>single</goal> - </goals> - <configuration> - <descriptorRefs> - <descriptorRef>jar-with-dependencies</descriptorRef> - </descriptorRefs> - </configuration> - </execution> + <executions> <execution> <configuration> <finalName>sdctool</finalName> @@ -559,7 +547,7 @@ <descriptor>${project.basedir}/tarball.xml</descriptor> </configuration> <id>assemble-file</id> - <phase>package</phase> + <phase>install</phase> <goals> <goal>single</goal> </goals> @@ -567,32 +555,89 @@ </executions> </plugin> + + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-shade-plugin</artifactId> + <version>3.1.0</version> + <executions> + <execution> + <phase>package</phase> + <goals> + <goal>shade</goal> + </goals> + <configuration> + <filters> + <filter> + <artifact>org.openecomp.sdc:*</artifact> + <excludes> + <exclude>**/elasticsearch.yml</exclude> + </excludes> + </filter> + <filter> + <artifact>*:*</artifact> + <excludes> + <exclude>META-INF/*.SF</exclude> + <exclude>META-INF/*.DSA</exclude> + <exclude>META-INF/*.RSA</exclude> + </excludes> + </filter> + </filters> + <transformers> + <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/> + </transformers> + </configuration> + </execution> + </executions> + </plugin> + + <plugin> + <artifactId>maven-clean-plugin</artifactId> + <version>3.0.0</version> + <executions> + <execution> + <id>clean-static-files</id> + <phase>clean</phase> + <goals> + <goal>clean</goal> + </goals> + <configuration> + <filesets> + <!-- tosca files --> + <fileset> + <directory>${project.parent.basedir}/asdctool/tosca</directory> + <followSymlinks>false</followSymlinks> + </fileset> + </filesets> + </configuration> + </execution> + </executions> + </plugin> + <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-resources-plugin</artifactId> <version>3.0.2</version> - <executions> - - <execution> - <id>copy-sdctool</id> - <phase>install</phase> - <goals> - <goal>copy-resources</goal> - </goals> - <configuration> - <outputDirectory>${project.parent.basedir}/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/files/default</outputDirectory> - <resources> - <resource> - <directory>./target</directory> - <includes> - <include>sdctool.tar</include> - </includes> - </resource> - </resources> - </configuration> - </execution> - + + <execution> + <id>copy-tosca-folder</id> + <!-- here the phase you need --> + <phase>compile</phase> + <goals> + <goal>copy-resources</goal> + </goals> + <configuration> + <outputDirectory>${project.parent.basedir}/asdctool/tosca</outputDirectory> + <resources> + <resource> + <directory>${project.parent.basedir}/catalog-be/src/main/resources/import/tosca</directory> + <filtering>true</filtering> + </resource> + </resources> + </configuration> + </execution> + </executions> </plugin> </plugins> @@ -0,0 +1,327 @@ +package org.openecomp.sdc.asdctool.configuration; + +import org.openecomp.sdc.asdctool.impl.ArtifactUuidFix; +import org.openecomp.sdc.be.auditing.impl.AuditingManager; +import org.openecomp.sdc.be.components.ArtifactsResolver; +import org.openecomp.sdc.be.components.distribution.engine.DistributionEngine; +import org.openecomp.sdc.be.components.distribution.engine.ServiceDistributionArtifactsBuilder; +import org.openecomp.sdc.be.components.impl.AdditionalInformationBusinessLogic; +import org.openecomp.sdc.be.components.impl.ArtifactResolverImpl; +import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic; +import org.openecomp.sdc.be.components.impl.CompositionBusinessLogic; +import org.openecomp.sdc.be.components.impl.GroupBusinessLogic; +import org.openecomp.sdc.be.components.impl.InputsBusinessLogic; +import org.openecomp.sdc.be.components.impl.ProductBusinessLogic; +import org.openecomp.sdc.be.components.impl.ResourceBusinessLogic; +import org.openecomp.sdc.be.components.impl.ResourceImportManager; +import org.openecomp.sdc.be.components.impl.ServiceBusinessLogic; +import org.openecomp.sdc.be.components.impl.ServiceComponentInstanceBusinessLogic; +import org.openecomp.sdc.be.components.impl.VFComponentInstanceBusinessLogic; +import org.openecomp.sdc.be.components.impl.generic.GenericTypeBusinessLogic; +import org.openecomp.sdc.be.components.lifecycle.LifecycleBusinessLogic; +import org.openecomp.sdc.be.components.merge.heat.HeatEnvArtifactsMergeBusinessLogic; +import org.openecomp.sdc.be.components.merge.input.InputsValuesMergingBusinessLogic; +import org.openecomp.sdc.be.components.merge.instance.ComponentInstanceMergeDataBusinessLogic; +import org.openecomp.sdc.be.components.merge.property.DataDefinitionsValuesMergingBusinessLogic; +import org.openecomp.sdc.be.dao.DAOTitanStrategy; +import org.openecomp.sdc.be.dao.TitanClientStrategy; +import org.openecomp.sdc.be.dao.cassandra.AuditCassandraDao; +import org.openecomp.sdc.be.dao.cassandra.CassandraClient; +import org.openecomp.sdc.be.dao.config.DAOSpringConfig; +import org.openecomp.sdc.be.dao.es.ElasticSearchClient; +import org.openecomp.sdc.be.dao.impl.AuditingDao; +import org.openecomp.sdc.be.dao.jsongraph.TitanDao; +import org.openecomp.sdc.be.dao.titan.TitanGenericDao; +import org.openecomp.sdc.be.dao.titan.TitanGraphClient; +import org.openecomp.sdc.be.impl.ComponentsUtils; +import org.openecomp.sdc.be.model.cache.ComponentCache; +import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.operations.impl.CapabilityTypeOperation; +import org.openecomp.sdc.be.model.operations.impl.ComponentInstanceOperation; +import org.openecomp.sdc.be.model.operations.impl.CsarOperation; +import org.openecomp.sdc.be.model.operations.impl.ElementOperation; +import org.openecomp.sdc.be.model.operations.impl.GraphLockOperation; +import org.openecomp.sdc.be.model.operations.impl.GroupInstanceOperation; +import org.openecomp.sdc.be.model.operations.impl.GroupOperation; +import org.openecomp.sdc.be.model.operations.impl.GroupTypeOperation; +import org.openecomp.sdc.be.model.operations.impl.PropertyOperation; +import org.openecomp.sdc.be.tosca.CsarUtils; +import org.openecomp.sdc.be.tosca.ToscaExportHandler; +import org.openecomp.sdc.be.user.UserBusinessLogic; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.beans.factory.config.PropertiesFactoryBean; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Import; +import org.springframework.core.io.FileSystemResource; + +@Configuration +@Import(DAOSpringConfig.class) +@ComponentScan({ + "org.openecomp.sdc.be.model.operations.impl", + "org.openecomp.sdc.be.model.cache", + "org.openecomp.sdc.be.dao.titan", + "org.openecomp.sdc.be.dao.cassandra", + "org.openecomp.sdc.be.model.jsontitan.operations", + "org.openecomp.sdc.be.dao.jsongraph", + "org.openecomp.sdc.be.tosca", + "org.openecomp.sdc.be.components.merge", + }) +public class ArtifactUUIDFixConfiguration { + + @Bean + public ArtifactUuidFix artifactUuidFix() { + return new ArtifactUuidFix(); + } + + @Bean(name = "cassandra-client") + public CassandraClient cassandraClient() { + return new CassandraClient(); + } + + + @Bean(name = "dao-titan-strategy") + public TitanClientStrategy daoStrategy() { + return new DAOTitanStrategy(); + } + + @Bean(name = "titan-dao") + public TitanDao titanDao(@Qualifier("titan-client") TitanGraphClient titanGraphClient) { + return new TitanDao(titanGraphClient); + } + + @Bean(name = "titan-client", initMethod = "createGraph") + public TitanGraphClient titanClient(@Qualifier("dao-titan-strategy") TitanClientStrategy titanClientStrategy) { + return new TitanGraphClient(titanClientStrategy); + } + + @Bean(name = "resource-business-logic") + public ResourceBusinessLogic resourceBusinessLogic() { + return new ResourceBusinessLogic(); + } + +// @Bean(name = "healthCheckBusinessLogic") +// public HealthCheckBusinessLogic healthCheckBusinessLogic() { +// return new HealthCheckBusinessLogic(); +// } +// +// @Bean(name = "distribution-engine-cluster-health") +// public DistributionEngineClusterHealth distributionEngineClusterHealth() { +// return new DistributionEngineClusterHealth(); +// } +// +// @Bean(name = "cassandra-health-check") +// public CassandraHealthCheck cassandraHealthCheck() { +// return new CassandraHealthCheck(); +// } + +// @Bean(name = "switchover-detector") +// public SwitchoverDetector switchoverDetector() { +// return new SwitchoverDetector(); +// } + + @Bean(name = "service-business-logic") + public ServiceBusinessLogic serviceBusinessLogic() { + return new ServiceBusinessLogic(); + } + + @Bean(name = "capability-type-operation") + public CapabilityTypeOperation CapabilityTypeOperation() { + return new CapabilityTypeOperation(); + } + + @Bean(name = "lifecycle-business-logic") + public LifecycleBusinessLogic lifecycleBusinessLogic() { + return new LifecycleBusinessLogic(); + } + + @Bean(name = "property-operation") + public PropertyOperation propertyOperation(@Qualifier("titan-generic-dao") TitanGenericDao titanGenericDao) { + return new PropertyOperation(titanGenericDao); + } + + @Bean(name = "csar-operation") + public CsarOperation csarOperation() { + return new CsarOperation(); + } + + @Bean(name = "vf-component-instance-business-logic") + public VFComponentInstanceBusinessLogic vFComponentInstanceBusinessLogic() { + return new VFComponentInstanceBusinessLogic(); + } + + @Bean(name = "resource-import-manager") + public ResourceImportManager resourceImportManager() { + return new ResourceImportManager(); + } + + @Bean(name = "group-business-logic") + public GroupBusinessLogic groupBusinessLogic() { + return new GroupBusinessLogic(); + } + + @Bean(name = "inputs-business-logic") + public InputsBusinessLogic inputsBusinessLogic() { + return new InputsBusinessLogic(); + } + + @Bean(name = "composition-business-logic") + public CompositionBusinessLogic compositionBusinessLogic() { + return new CompositionBusinessLogic(); + } + + @Bean(name = "artifacts-business-logic") + public ArtifactsBusinessLogic artifactsBusinessLogic() { + return new ArtifactsBusinessLogic(); + } + + @Bean(name = "component-cache") + public ComponentCache componentCache() { + return new ComponentCache(); + } + + @Bean(name = "componentUtils") + public ComponentsUtils componentsUtils() { + return new ComponentsUtils(); + } + + @Bean(name = "user-business-logic") + public UserBusinessLogic userBusinessLogic() { + return new UserBusinessLogic(); + } + + @Bean(name = "graph-lock-operation") + public GraphLockOperation graphLockOperation() { + return new GraphLockOperation(); + } + + @Bean(name = "titan-generic-dao") + public TitanGenericDao titanGenericDao(@Qualifier("titan-client") TitanGraphClient titanGraphClient) { + return new TitanGenericDao(titanGraphClient); + } + + @Bean(name = "element-operation") + public ElementOperation elementOperation(@Qualifier("titan-generic-dao") TitanGenericDao titanGenericDao) { + return new ElementOperation(titanGenericDao); + } + + @Bean(name = "group-operation") + public GroupOperation groupOperation() { + return new GroupOperation(); + } + + @Bean(name = "group-instance-operation") + public GroupInstanceOperation groupInstanceOperation() { + return new GroupInstanceOperation(); + } + + @Bean(name = "group-type-operation") + public GroupTypeOperation groupTypeOperation(@Qualifier("titan-generic-dao") TitanGenericDao titanGenericDao, @Qualifier("property-operation") PropertyOperation propertyOperation) { + return new GroupTypeOperation(titanGenericDao, propertyOperation); + } + + @Bean(name = "tosca-operation-facade") + public ToscaOperationFacade toscaOperationFacade() { + return new ToscaOperationFacade(); + } + + @Bean(name = "distribution-engine") + public DistributionEngine distributionEngine() { + return null; + } + + @Bean(name = "audit-cassandra-dao") + public AuditCassandraDao auditCassandraDao() { + return new AuditCassandraDao(); + } + + @Bean(name = "service-component-instance-business-logic") + public ServiceComponentInstanceBusinessLogic serviceComponentInstanceBusinessLogic() { + return new ServiceComponentInstanceBusinessLogic(); + } + + @Bean("tosca-export-handler") + public ToscaExportHandler toscaExportHandler() { + return new ToscaExportHandler(); + } + + @Bean(name = "component-instance-operation") + public ComponentInstanceOperation componentInstanceOperation() { + return new ComponentInstanceOperation(); + } + + @Bean(name = "additional-information-business-logic") + public AdditionalInformationBusinessLogic additionalInformationBusinessLogic() { + return new AdditionalInformationBusinessLogic(); + } + + @Bean(name = "auditing-manager") + public AuditingManager auditingManager() { + return new AuditingManager(); + } + + @Bean(name = "auditing-dao") + public AuditingDao auditingDao() { + return new AuditingDao(); + } + + @Bean(name = "elasticsearch-client", initMethod = "initialize") + public ElasticSearchClient elasticSearchClient() { + return new ElasticSearchClient(); + } + + @Bean(name = "csar-utils") + public CsarUtils csarUtils() { + return new CsarUtils(); + } + + @Bean(name = "service-distribution-artifacts-builder") + public ServiceDistributionArtifactsBuilder serviceDistributionArtifactsBuilder() { + return new ServiceDistributionArtifactsBuilder(); + } + + @Bean(name = "product-business-logic") + public ProductBusinessLogic productBusinessLogic() { + return null; + } + + @Bean(name = "dataDefinitionsValuesMergingBusinessLogic") + public DataDefinitionsValuesMergingBusinessLogic dataDefinitionsValuesMergingBusinessLogic() { + return new DataDefinitionsValuesMergingBusinessLogic(); + } + + @Bean(name = "artifacts-resolver") + public ArtifactsResolver artifactsResolver() { + return new ArtifactResolverImpl(); + } + + @Bean(name = "InputsValuesMergingBusinessLogic") + public InputsValuesMergingBusinessLogic InputsValuesMergingBusinessLogic(){ + return new InputsValuesMergingBusinessLogic(); + } + + @Bean(name = "GenericTypeBusinessLogic") + public GenericTypeBusinessLogic genericTypeBusinessLogic(){ + return new GenericTypeBusinessLogic(); + } + + @Bean(name ="componentInstanceMergeDataBusinessLogic") + public ComponentInstanceMergeDataBusinessLogic componentInstanceMergeDataBusinessLogic(){ + return new ComponentInstanceMergeDataBusinessLogic(); + } + + @Bean(name ="heatEnvArtifactsMergeBusinessLogic") + public HeatEnvArtifactsMergeBusinessLogic heatEnvArtifactsMergeBusinessLogic(){ + return new HeatEnvArtifactsMergeBusinessLogic(); + } + + @Bean(name = "elasticsearchConfig") + public PropertiesFactoryBean mapper() { + String configHome = System.getProperty("config.home"); + PropertiesFactoryBean bean = new PropertiesFactoryBean(); + bean.setLocation(new FileSystemResource(configHome + "/elasticsearch.yml")); + return bean; + } + +} @@ -0,0 +1,28 @@ +package org.openecomp.sdc.asdctool.configuration; + +import java.io.File; + +import org.openecomp.sdc.be.config.ConfigurationManager; +import org.openecomp.sdc.common.api.ConfigurationSource; +import org.openecomp.sdc.common.impl.ExternalConfiguration; +import org.openecomp.sdc.common.impl.FSConfigurationSource; + +public class ConfigurationUploader { + + public static void uploadConfigurationFiles(String appConfigDir) { + ConfigurationSource configurationSource = new FSConfigurationSource(ExternalConfiguration.getChangeListener(), appConfigDir); + new ConfigurationManager(configurationSource); + ExternalConfiguration.setAppVersion(ConfigurationManager.getConfigurationManager().getConfiguration().getAppVersion()); + System.setProperty("config.home", appConfigDir); + System.setProperty("artifactgenerator.config", buildArtifactGeneratorPath(appConfigDir)); + } + + private static String buildArtifactGeneratorPath(String appConfigDir) { + StringBuilder artifactGeneratorPath = new StringBuilder(appConfigDir); + if(!appConfigDir.endsWith(File.separator)){ + artifactGeneratorPath.append(File.separator); + } + artifactGeneratorPath.append(ConfigurationManager.getConfigurationManager().getConfiguration().getArtifactGeneratorConfig()); + return artifactGeneratorPath.toString(); + } +} @@ -0,0 +1,1202 @@ +package org.openecomp.sdc.asdctool.impl; + +import java.io.BufferedWriter; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.io.Writer; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import java.util.stream.Collectors; + +import org.openecomp.sdc.be.components.distribution.engine.VfModuleArtifactPayload; +import org.openecomp.sdc.be.dao.cassandra.ArtifactCassandraDao; +import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; +import org.openecomp.sdc.be.dao.jsongraph.TitanDao; +import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum; +import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum; +import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum; +import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; +import org.openecomp.sdc.be.datatypes.elements.ArtifactDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.GroupDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.MapArtifactDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.MapGroupsDataDefinition; +import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; +import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum; +import org.openecomp.sdc.be.datatypes.enums.OriginTypeEnum; +import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; +import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; +import org.openecomp.sdc.be.model.ArtifactDefinition; +import org.openecomp.sdc.be.model.Component; +import org.openecomp.sdc.be.model.ComponentInstance; +import org.openecomp.sdc.be.model.ComponentParametersView; +import org.openecomp.sdc.be.model.DistributionStatusEnum; +import org.openecomp.sdc.be.model.GroupDefinition; +import org.openecomp.sdc.be.model.GroupInstance; +import org.openecomp.sdc.be.model.LifecycleStateEnum; +import org.openecomp.sdc.be.model.Resource; +import org.openecomp.sdc.be.model.Service; +import org.openecomp.sdc.be.model.jsontitan.datamodel.TopologyTemplate; +import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElement; +import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsontitan.utils.ModelConverter; +import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; +import org.openecomp.sdc.be.resources.data.ESArtifactData; +import org.openecomp.sdc.be.tosca.CsarUtils; +import org.openecomp.sdc.be.tosca.ToscaError; +import org.openecomp.sdc.be.tosca.ToscaExportHandler; +import org.openecomp.sdc.be.tosca.ToscaRepresentation; +import org.openecomp.sdc.common.api.ArtifactTypeEnum; +import org.openecomp.sdc.common.api.Constants; +import org.openecomp.sdc.common.util.GeneralUtility; +import org.openecomp.sdc.exception.ResponseFormat; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; + +import fj.data.Either; + +@org.springframework.stereotype.Component("artifactUuidFix") +public class ArtifactUuidFix { + + @Autowired + private TitanDao titanDao; + + @Autowired + private ToscaOperationFacade toscaOperationFacade; + @Autowired + private ToscaExportHandler toscaExportUtils; + @Autowired + private ArtifactCassandraDao artifactCassandraDao; + + @Autowired + private CsarUtils csarUtils; + + private static Logger log = LoggerFactory.getLogger(ArtifactUuidFix.class.getName()); + + public boolean doFix(String fixComponent, String runMode) { + List<Resource> vfLst = new ArrayList<>(); + List<Service> serviceList = new ArrayList<>(); + Map<String, List<Component>> nodeToFixTosca = new HashMap<>(); + Map<String, List<Component>> vfToFixTosca = new HashMap<>(); + Map<String, List<Component>> serviceToFixTosca = new HashMap<>(); + + long time = System.currentTimeMillis(); + + doFixTosca(nodeToFixTosca, vfToFixTosca, serviceToFixTosca); + + if (fixComponent.equals("vf_only")) { + if (fetchFaultVf(fixComponent, vfLst, time) == false) { + return false; + } + } else { + if (fetchServices(fixComponent, serviceList, time) == false) { + return false; + } + } + if (runMode.equals("service_vf") || runMode.equals("fix")) { + log.info("Mode {}. Find problem VFs", runMode); + if (fetchVf(serviceList, vfLst, time) == false) { + log.info("Mode {}. Find problem VFs finished with failure", runMode); + return false; + } + log.info("Mode {}. Find problem VFs finished with success", runMode); + } + if (runMode.equals("fix") || runMode.equals("fix_only_services")) { + log.info("Mode {}. Start fix", runMode); + if (fix(vfLst, serviceList, nodeToFixTosca, vfToFixTosca, serviceToFixTosca) == false) { + log.info("Mode {}. Fix finished with failure", runMode); + return false; + } + log.info("Mode {}. Fix finished with success", runMode); + } + + return true; + } + + private boolean fetchFaultVf(String fixComponent, List<Resource> vfLst, long time) { + log.info("Find fault VF "); + Writer writer = null; + try { + String fileName = "fault_" + time + ".csv"; + writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(fileName), "utf-8")); + writer.write("vf name, vf id, state, version\n"); + + Map<GraphPropertyEnum, Object> hasProps = new HashMap<>(); + hasProps.put(GraphPropertyEnum.COMPONENT_TYPE, ComponentTypeEnum.RESOURCE.name()); + hasProps.put(GraphPropertyEnum.RESOURCE_TYPE, ResourceTypeEnum.VF.name()); + + Map<GraphPropertyEnum, Object> hasNotProps = new HashMap<>(); + hasNotProps.put(GraphPropertyEnum.IS_DELETED, true); + log.info("Try to fetch resources with properties {} and not {}", hasProps, hasNotProps); + + Either<List<GraphVertex>, TitanOperationStatus> servicesByCriteria = titanDao + .getByCriteria(VertexTypeEnum.TOPOLOGY_TEMPLATE, hasProps, hasNotProps, JsonParseFlagEnum.ParseAll); + if (servicesByCriteria.isRight()) { + log.info("Failed to fetch resources {}", servicesByCriteria.right().value()); + return false; + } + List<GraphVertex> resources = servicesByCriteria.left().value(); + for (GraphVertex gv : resources) { + ComponentParametersView filter = new ComponentParametersView(true); + filter.setIgnoreComponentInstances(false); + filter.setIgnoreArtifacts(false); + filter.setIgnoreGroups(false); + + Either<Resource, StorageOperationStatus> toscaElement = toscaOperationFacade + .getToscaElement(gv.getUniqueId()); + if (toscaElement.isRight()) { + log.info("Failed to fetch resources {} {}", gv.getUniqueId(), toscaElement.right().value()); + return false; + } + + Resource resource = toscaElement.left().value(); + String resourceName = resource.getName(); + Map<String, ArtifactDefinition> deploymentArtifacts = resource.getDeploymentArtifacts(); + List<GroupDefinition> groups = resource.getGroups(); + if (groups == null || groups.isEmpty()) { + log.info("No groups for resource {} id {} ", resourceName, gv.getUniqueId()); + continue; + } + boolean isProblematic = false; + for (GroupDefinition gr : groups) { + if (gr.getType().equals(Constants.DEFAULT_GROUP_VF_MODULE)) { + if (isProblematicGroup(gr, resourceName, deploymentArtifacts)) { + isProblematic = true; + break; + } + } + } + if (isProblematic) { + vfLst.add(resource); + writeModuleResultToFile(writer, resource, null); + writer.flush(); + } + titanDao.commit(); + } + + } catch (Exception e) { + log.info("Failed to fetch vf resources ", e); + return false; + } finally { + titanDao.commit(); + try { + writer.flush(); + writer.close(); + } catch (Exception ex) { + /* ignore */ + } + } + return true; + } + + private boolean fetchVf(List<Service> serviceList, List<Resource> vfLst, long time) { + log.info("Find problem VF "); + if (serviceList.isEmpty()) { + log.info("No services as input"); + return true; + } + Writer writer = null; + try { + String fileName = "problemVf_" + time + ".csv"; + writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(fileName), "utf-8")); + writer.write("vf name, vf id, state, version, example service name\n"); + Set<String> vfIds = new HashSet<>(); + for (Service service : serviceList) { + List<ComponentInstance> componentInstances = service.getComponentInstances().stream() + .filter(ci -> ci.getOriginType().equals(OriginTypeEnum.VF)).collect(Collectors.toList()); + for (ComponentInstance ci : componentInstances) { + if (!vfIds.contains(ci.getComponentUid())) { + vfIds.add(ci.getComponentUid()); + Either<Resource, StorageOperationStatus> toscaElement = toscaOperationFacade + .getToscaElement(ci.getComponentUid()); + if (toscaElement.isRight()) { + log.info("Failed to fetch resource {} {}", ci.getComponentUid(), + toscaElement.right().value()); + return false; + } + Resource resource = toscaElement.left().value(); + if (resource.getResourceType().equals(ResourceTypeEnum.VF)) { + vfLst.add(resource); + writeModuleResultToFile(writer, resource, service); + writer.flush(); + titanDao.commit(); + } + } + } + } + log.info("output file with list of Vf : {}", fileName); + } catch (Exception e) { + log.info("Failed to fetch services ", e); + return false; + } finally { + titanDao.commit(); + try { + writer.flush(); + writer.close(); + } catch (Exception ex) { + /* ignore */ + } + } + return true; + } + + private boolean fetchServices(String fixServices, List<Service> serviceList, long time) { + log.info("Find problem Services {}", fixServices); + Writer writer = null; + + try { + String fileName = "problemService_" + time + ".csv"; + writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(fileName), "utf-8")); + writer.write("service name, service id, state, version\n"); + + Map<GraphPropertyEnum, Object> hasProps = new HashMap<>(); + hasProps.put(GraphPropertyEnum.COMPONENT_TYPE, ComponentTypeEnum.SERVICE.name()); + if (fixServices.equals("distributed_only")) { + hasProps.put(GraphPropertyEnum.STATE, LifecycleStateEnum.CERTIFIED.name()); + hasProps.put(GraphPropertyEnum.DISTRIBUTION_STATUS, DistributionStatusEnum.DISTRIBUTED.name()); + } + + Map<GraphPropertyEnum, Object> hasNotProps = new HashMap<>(); + hasNotProps.put(GraphPropertyEnum.IS_DELETED, true); + log.info("Try to fetch services with properties {} and not {}", hasProps, hasNotProps); + + Either<List<GraphVertex>, TitanOperationStatus> servicesByCriteria = titanDao + .getByCriteria(VertexTypeEnum.TOPOLOGY_TEMPLATE, hasProps, hasNotProps, JsonParseFlagEnum.ParseAll); + if (servicesByCriteria.isRight()) { + log.info("Failed to fetch services {}", servicesByCriteria.right().value()); + return false; + } + List<GraphVertex> services = servicesByCriteria.left().value(); + for (GraphVertex gv : services) { + ComponentParametersView filter = new ComponentParametersView(true); + filter.setIgnoreComponentInstances(false); + filter.setIgnoreArtifacts(false); + filter.setIgnoreGroups(false); + + Either<Service, StorageOperationStatus> toscaElement = toscaOperationFacade + .getToscaElement(gv.getUniqueId()); + if (toscaElement.isRight()) { + log.info("Failed to fetch service {} {}", gv.getUniqueId(), toscaElement.right().value()); + continue; + } + Service service = toscaElement.left().value(); + List<ComponentInstance> componentInstances = service.getComponentInstances(); + boolean isProblematic = false; + if (componentInstances == null) { + log.info("No instances for service {} ", gv.getUniqueId()); + continue; + } + String serviceName = (String) gv.getMetadataProperty(GraphPropertyEnum.NAME); + + for (ComponentInstance ci : componentInstances) { + Map<String, ArtifactDefinition> deploymentArtifacts = ci.getDeploymentArtifacts(); + List<GroupInstance> groupInstances = ci.getGroupInstances(); + if (groupInstances == null || groupInstances.isEmpty()) { + log.info("No instance groups for instance {} in service {} id {} ", ci.getName(), serviceName, + gv.getUniqueId()); + continue; + } + + for (GroupInstance gi : groupInstances) { + if (gi.getType().equals(Constants.DEFAULT_GROUP_VF_MODULE)) { + if (isProblematicGroupInstance(gi, ci.getName(), serviceName, deploymentArtifacts)) { + isProblematic = true; + break; + } + } + } + if (isProblematic) { + serviceList.add(service); + writeModuleResultToFile(writer, service, null); + writer.flush(); + break; + } + } + titanDao.commit(); + } + log.info("output file with list of services : {}", fileName); + } catch (Exception e) { + log.info("Failed to fetch services ", e); + return false; + } finally { + titanDao.commit(); + try { + writer.flush(); + writer.close(); + } catch (Exception ex) { + /* ignore */ + } + } + return true; + } + + private boolean isProblematicGroup(GroupDefinition gr, String resourceName, + Map<String, ArtifactDefinition> deploymentArtifacts) { + List<String> artifacts = gr.getArtifacts(); + List<String> artifactsUuid = gr.getArtifactsUuid(); + Set<String> artifactsSet = new HashSet<>(); + + if ((artifactsUuid == null || artifactsUuid.isEmpty()) && (artifacts == null || artifacts.isEmpty())) { + log.info("No groups in resource {} ", resourceName); + return true; + } + artifactsSet.addAll(artifacts); + if (artifactsSet.size() < artifacts.size()) { + log.info(" artifactsSet.size() < artifacts.size() group {} in resource {} ", gr.getName(), resourceName); + return true; + } + + if (artifacts.size() < artifactsUuid.size()) { + log.info(" artifacts.size() < artifactsUuid.size() group {} in resource {} ", gr.getName(), resourceName); + return true; + } + if (artifacts.size() > 0 && (artifactsUuid == null || artifactsUuid.isEmpty())) { + log.info( + " artifacts.size() > 0 && (artifactsUuid == null || artifactsUuid.isEmpty() group {} in resource {} ", + gr.getName(), resourceName); + return true; + } + if (artifactsUuid.contains(null)) { + log.info(" artifactsUuid.contains(null) group {} in resource {} ", gr.getName(), resourceName); + return true; + } + + for (String artifactId : artifacts) { + String artifactlabel = findArtifactLabelFromArtifactId(artifactId); + ArtifactDefinition artifactDefinition = deploymentArtifacts.get(artifactlabel); + if (artifactDefinition == null) { + log.info(" artifactDefinition == null label {} group {} in resource {} ", artifactlabel, gr.getName(), + resourceName); + return true; + } + ArtifactTypeEnum artifactType = ArtifactTypeEnum.findType(artifactDefinition.getArtifactType()); + if (artifactType != ArtifactTypeEnum.HEAT_ENV) { + if (!artifactId.equals(artifactDefinition.getUniqueId())) { + log.info( + " !artifactId.equals(artifactDefinition.getUniqueId() artifact {} artId {} group {} in resource {} ", + artifactlabel, artifactId, gr.getName(), resourceName); + return true; + } + if (!artifactsUuid.contains(artifactDefinition.getArtifactUUID())) { + log.info( + " artifactsUuid.contains(artifactDefinition.getArtifactUUID() label {} group {} in resource {} ", + artifactlabel, gr.getName(), resourceName); + return true; + } + } + } + for (String artifactUUID : artifactsUuid) { + String label = findArtifactLabelFromArtifactId(artifactUUID); + if (label != null && !label.isEmpty() && !label.equals("")) { + return true; + } + } + + return false; + } + + private boolean isProblematicGroupInstance(GroupInstance gi, String instName, String servicename, + Map<String, ArtifactDefinition> deploymentArtifacts) { + List<String> artifacts = gi.getArtifacts(); + List<String> artifactsUuid = gi.getArtifactsUuid(); + List<String> instArtifactsUuid = gi.getGroupInstanceArtifactsUuid(); + List<String> instArtifactsId = gi.getGroupInstanceArtifacts(); + Set<String> instArtifatIdSet = new HashSet<>(); + Set<String> artifactsSet = new HashSet<>(); + + if ((artifactsUuid == null || artifactsUuid.isEmpty()) && (artifacts == null || artifacts.isEmpty())) { + log.info("No instance groups for instance {} in service {} ", instName, servicename); + return true; + } + artifactsSet.addAll(artifacts); + if (artifactsSet.size() < artifacts.size()) { + log.info(" artifactsSet.size() < artifacts.size() group {} in resource {} ", instName, servicename); + return true; + } + + if (instArtifactsId != null && !instArtifactsId.isEmpty()) { + instArtifatIdSet.addAll(instArtifactsId); + } + + if (artifacts.size() < artifactsUuid.size()) { + log.info(" artifacts.size() < artifactsUuid.size() inst {} in service {} ", instName, servicename); + return true; + } + if (!artifacts.isEmpty() && (artifactsUuid == null || artifactsUuid.isEmpty())) { + log.info( + " artifacts.size() > 0 && (artifactsUuid == null || artifactsUuid.isEmpty() inst {} in service {} ", + instName, servicename); + return true; + } + if (artifactsUuid.contains(null)) { + log.info(" artifactsUuid.contains(null) inst {} in service {} ", instName, servicename); + return true; + } + if (instArtifactsId != null && instArtifatIdSet.size() < instArtifactsId.size()) { + log.info(" instArtifatIdSet.size() < instArtifactsId.size() inst {} in service {} ", instName, servicename); + return true; + } + + if ((instArtifactsId != null && instArtifactsUuid != null) + && instArtifactsId.size() != instArtifactsUuid.size()) { + log.info(" instArtifactsId.size() != instArtifactsUuid.size() inst {} in service {} ", instName, + servicename); + return true; + } + + for (String artifactId : artifacts) { + String artifactlabel = findArtifactLabelFromArtifactId(artifactId); + ArtifactDefinition artifactDefinition = deploymentArtifacts.get(artifactlabel); + if (artifactDefinition == null) { + log.info(" artifactDefinition == null label {} inst {} in service {} ", artifactlabel, instName, + servicename); + return true; + } + ArtifactTypeEnum artifactType = ArtifactTypeEnum.findType(artifactDefinition.getArtifactType()); + if (artifactType != ArtifactTypeEnum.HEAT_ENV) { + if (!artifactId.equals(artifactDefinition.getUniqueId())) { + log.info( + " !artifactId.equals(artifactDefinition.getUniqueId() artifact {} artId {} inst {} in service {} ", + artifactlabel, artifactId, instName, servicename); + return true; + } + if (!artifactsUuid.contains(artifactDefinition.getArtifactUUID())) { + log.info( + " artifactsUuid.contains(artifactDefinition.getArtifactUUID() label {} inst {} in service {} ", + artifactlabel, instName, servicename); + return true; + } + } else { + if (instArtifactsUuid == null || instArtifactsUuid.isEmpty()) { + log.info(" instArtifactsUuid empty. label {} inst {} in service {} ", artifactlabel, instName, + servicename); + return true; + } + if (!instArtifactsUuid.contains(artifactDefinition.getArtifactUUID())) { + log.info( + " instArtifactsUuid.contains(artifactDefinition.getArtifactUUID() label {} inst {} in service {} ", + artifactlabel, instName, servicename); + return true; + } + } + } + for (String artifactUUID : artifactsUuid) { + String label = findArtifactLabelFromArtifactId(artifactUUID); + if (label != null && !label.isEmpty() && !label.equals("")) { + return true; + } + } + return false; + } + + private boolean fix(List<Resource> vfLst, List<Service> serviceList, Map<String, List<Component>> nodesToFixTosca, + Map<String, List<Component>> vfToFixTosca, Map<String, List<Component>> servicesToFixTosca) { + boolean res = true; + log.info(" Fix started ***** "); + if (vfLst != null && !vfLst.isEmpty()) { + res = fixVf(vfLst); + + } + + if (res && serviceList != null && !serviceList.isEmpty()) { + res = fixServices(serviceList); + + } + + Set<String> fixedIds = new HashSet<>(); + if (res && nodesToFixTosca != null && !nodesToFixTosca.isEmpty()) { + + generateAndSaveToscaArtifacts(nodesToFixTosca, fixedIds, null); + + for (Map.Entry<String, List<Component>> entry : nodesToFixTosca.entrySet()) { + List<Component> components = entry.getValue(); + for (Component c : components) { + + ToscaElement topologyTemplate = ModelConverter.convertToToscaElement(c); + Map<String, ArtifactDataDefinition> arifacts = topologyTemplate.getToscaArtifacts(); + res = fixDataOnGraph(c.getUniqueId(), VertexTypeEnum.TOSCA_ARTIFACTS, EdgeLabelEnum.TOSCA_ARTIFACTS, + arifacts); + titanDao.commit(); + } + } + + } + if (res && vfToFixTosca != null && !vfToFixTosca.isEmpty()) { + + generateAndSaveToscaArtifacts(vfToFixTosca, fixedIds, vfLst); + + for (Map.Entry<String, List<Component>> entry : vfToFixTosca.entrySet()) { + List<Component> components = entry.getValue(); + for (Component c : components) { + TopologyTemplate topologyTemplate = ModelConverter.convertToToscaElement(c); + Map<String, ArtifactDataDefinition> arifacts = topologyTemplate.getToscaArtifacts(); + res = fixDataOnGraph(c.getUniqueId(), VertexTypeEnum.TOSCA_ARTIFACTS, EdgeLabelEnum.TOSCA_ARTIFACTS, + arifacts); + titanDao.commit(); + } + } + + } + + if (res && servicesToFixTosca != null && !servicesToFixTosca.isEmpty()) { + generateAndSaveToscaArtifacts(servicesToFixTosca, fixedIds, serviceList); + + for (Map.Entry<String, List<Component>> entry : servicesToFixTosca.entrySet()) { + List<Component> components = entry.getValue(); + for (Component c : components) { + TopologyTemplate topologyTemplate = ModelConverter.convertToToscaElement(c); + Map<String, ArtifactDataDefinition> arifacts = topologyTemplate.getToscaArtifacts(); + res = fixDataOnGraph(c.getUniqueId(), VertexTypeEnum.TOSCA_ARTIFACTS, EdgeLabelEnum.TOSCA_ARTIFACTS, + arifacts); + titanDao.commit(); + } + } + + } + + if (res) { + + for (Component component : vfLst) { + generateToscaPerComponent(fixedIds, component); + + TopologyTemplate topologyTemplate = ModelConverter.convertToToscaElement(component); + Map<String, GroupDataDefinition> groups = topologyTemplate.getGroups(); + res = fixDataOnGraph(component.getUniqueId(), VertexTypeEnum.GROUPS, EdgeLabelEnum.GROUPS, groups); + if (res) { + Map<String, ArtifactDataDefinition> arifacts = topologyTemplate.getDeploymentArtifacts(); + res = fixDataOnGraph(component.getUniqueId(), VertexTypeEnum.DEPLOYMENT_ARTIFACTS, + EdgeLabelEnum.DEPLOYMENT_ARTIFACTS, arifacts); + } + if (res) { + Map<String, ArtifactDataDefinition> arifacts = topologyTemplate.getToscaArtifacts(); + res = fixDataOnGraph(component.getUniqueId(), VertexTypeEnum.TOSCA_ARTIFACTS, + EdgeLabelEnum.TOSCA_ARTIFACTS, arifacts); + } + titanDao.commit(); + } + } + + if (res) { + + for (Component component : serviceList) { + generateToscaPerComponent(fixedIds, component); + + TopologyTemplate topologyTemplate = ModelConverter.convertToToscaElement(component); + Map<String, MapGroupsDataDefinition> groups = topologyTemplate.getInstGroups(); + res = fixDataOnGraph(component.getUniqueId(), VertexTypeEnum.INST_GROUPS, EdgeLabelEnum.INST_GROUPS, + groups); + + if (res) { + Map<String, MapArtifactDataDefinition> artifacts = topologyTemplate.getInstDeploymentArtifacts(); + res = fixDataOnGraph(component.getUniqueId(), VertexTypeEnum.INST_DEPLOYMENT_ARTIFACTS, + EdgeLabelEnum.INST_DEPLOYMENT_ARTIFACTS, artifacts); + } + if (res) { + Map<String, ArtifactDataDefinition> arifacts = topologyTemplate.getToscaArtifacts(); + res = fixDataOnGraph(component.getUniqueId(), VertexTypeEnum.TOSCA_ARTIFACTS, + EdgeLabelEnum.TOSCA_ARTIFACTS, arifacts); + } + titanDao.commit(); + } + + } + log.info(" Fix finished with res {} ***** ", res); + return res; + } + + private boolean generateAndSaveToscaArtifacts(Map<String, List<Component>> nodesToFixTosca, Set<String> fixedIds, + List<? extends Component> componentsWithFailedGroups) { + boolean res = true; + log.debug("Migration1707ArtifactUuidFix generateAndSaveToscaArtifacts started "); + for (Map.Entry<String, List<Component>> entry : nodesToFixTosca.entrySet()) { + + List<Component> component = entry.getValue(); + for (Component c : component) { + log.debug("Migration1707ArtifactUuidFix fix tosca on component : id {}, name {} ", c.getUniqueId(), + c.getName()); + if (componentsWithFailedGroups != null) { + Optional<Component> op = (Optional<Component>) componentsWithFailedGroups.stream() + .filter(cg -> cg.getUniqueId().equals(c.getUniqueId())).findAny(); + if (!op.isPresent()) + res = generateToscaPerComponent(fixedIds, c); + } else + res = generateToscaPerComponent(fixedIds, c); + } + } + log.debug("Migration1707ArtifactUuidFix generateAndSaveToscaArtifacts finished with res {} ", res); + return res; + } + + private boolean generateToscaPerComponent(Set<String> fixedIds, Component c) { + boolean res = true; + log.debug("Migration1707ArtifactUuidFix generateToscaPerComponent started component name {} id {}", + c.getName(), c.getUniqueId()); + try { + Either<Component, StorageOperationStatus> toscaElement = toscaOperationFacade + .getToscaFullElement(c.getUniqueId()); + if (toscaElement.isRight()) { + log.info("Failed to fetch resources {} {}", c.getUniqueId(), toscaElement.right().value()); + return false; + } + Component toscaElementFull = toscaElement.left().value(); + toscaElementFull.setGroups(c.getGroups()); + List<ComponentInstance> ciListFull = toscaElementFull.getComponentInstances(); + List<ComponentInstance> ciList = c.getComponentInstances(); + if (ciListFull != null && !ciListFull.isEmpty()) { + ciListFull.forEach(ciFull -> { + ComponentInstance compInst = ciList.stream() + .filter(ci -> ci.getUniqueId().equals(ciFull.getUniqueId())).findAny().get(); + ciFull.setGroupInstances(compInst.getGroupInstances()); + }); + } + + Map<String, ArtifactDefinition> toscaArtifacts = c.getToscaArtifacts(); + log.debug("Migration1707ArtifactUuidFix generateToscaPerComponent tocsa artifacts size {}", + toscaArtifacts.size()); + + Either<ArtifactDefinition, ToscaError> either = Either.right(ToscaError.GENERAL_ERROR); + ArtifactDefinition toscaArtifact = null; + Optional<ArtifactDefinition> op = toscaArtifacts.values().stream() + .filter(p -> p.getArtifactType().equals(ArtifactTypeEnum.TOSCA_TEMPLATE.getType())).findAny(); + + if (op.isPresent()) { + toscaArtifact = op.get(); + } + + if (toscaArtifact != null) { + log.debug("Migration1707ArtifactUuidFix generateToscaPerComponent artifact name {} id {} esId {}", + toscaArtifact.getArtifactName(), toscaArtifact.getUniqueId(), toscaArtifact.getEsId()); + either = generateToscaArtifact(toscaElementFull, toscaArtifact); + if (either.isRight()) { + log.error("Couldn't generate and save tosca template component unique id {}, name {} error: {}", + toscaElementFull.getUniqueId(), toscaElementFull.getName(), either.right().value()); + res = false; + + } + } + if (res) { + + ArtifactDefinition csarArtifact = null; + op = toscaArtifacts.values().stream() + .filter(p -> p.getArtifactType().equals(ArtifactTypeEnum.TOSCA_CSAR.getType())).findAny(); + + if (op.isPresent()) { + csarArtifact = op.get(); + } + + if (csarArtifact != null) { + log.debug("Migration1707ArtifactUuidFix generateToscaPerComponent artifact name {} id {} esId {}", + csarArtifact.getArtifactName(), csarArtifact.getUniqueId(), csarArtifact.getEsId()); + either = generateToscaArtifact(toscaElementFull, csarArtifact); + if (either.isRight()) { + log.error("Couldn't generate and save tosca csar for component uuid {}, id {}, name {}. error: {}", + toscaElementFull.getUUID(), toscaElementFull.getUniqueId(), toscaElementFull.getName(), either.right().value()); + res = false; + + } + } + } + c.setToscaArtifacts(toscaArtifacts); + + if (res) { + fixedIds.add(toscaElementFull.getUniqueId()); + } + } finally { + titanDao.commit(); + } + log.debug("Migration1707ArtifactUuidFix generateToscaPerComponent finished component name {} id {} res {}", + c.getName(), c.getUniqueId(), res); + return res; + } + + private <T extends ToscaDataDefinition> boolean fixDataOnGraph(String componentId, VertexTypeEnum vertexTypeEnum, + EdgeLabelEnum edgeLabelEnum, Map<String, T> groups) { + log.debug("amount groups to update: VertexTypeEnum {} EdgeLabelEnum {} data size {}", vertexTypeEnum.getName(), + edgeLabelEnum, groups.size()); + boolean res = true; + Either<GraphVertex, TitanOperationStatus> getResponse = titanDao.getVertexById(componentId, + JsonParseFlagEnum.NoParse); + if (getResponse.isRight()) { + log.debug("Couldn't fetch component unique id {}, error: {}", componentId, getResponse.right().value()); + res = false; + + } + if (res) { + GraphVertex componentVertex = getResponse.left().value(); + + GraphVertex toscaDataVertex = null; + Either<GraphVertex, TitanOperationStatus> groupVertexEither = titanDao.getChildVertex(componentVertex, + edgeLabelEnum, JsonParseFlagEnum.ParseJson); + if (groupVertexEither.isRight() && groupVertexEither.right().value() == TitanOperationStatus.NOT_FOUND) { + log.debug("no child {} vertex for component unique id {}, error: {}", edgeLabelEnum, componentId, + groupVertexEither.right().value()); + return true; + } + if (groupVertexEither.isRight()) { + res = false; + log.debug("failed to get child {} vertex for component unique id {}, error: {}", edgeLabelEnum, + componentId, groupVertexEither.right().value()); + } + if (res) { + toscaDataVertex = groupVertexEither.left().value(); + toscaDataVertex.setJson(groups); + Either<GraphVertex, TitanOperationStatus> updatevertexEither = titanDao.updateVertex(toscaDataVertex); + if (updatevertexEither.isRight()) { + log.debug("failed to update vertex for component unique id {}, error: {}", componentId, + updatevertexEither.right().value()); + titanDao.rollback(); + return false; + } + } + } + log.debug("Fix data on graph finished: VertexTypeEnum {} EdgeLabelEnum {} res {}", vertexTypeEnum.getName(), + res); + return res; + } + + private boolean fixServices(List<Service> serviceList) { + for (Service service : serviceList) { + log.debug("Migration1707ArtifactUuidFix fix service: id {}, name {} ", service.getUniqueId(), + service.getName()); + List<ComponentInstance> instances = service.getComponentInstances(); + for (ComponentInstance instance : instances) { + fixComponentInstances(service, instance); + } + + } + return true; + + } + + private void fixComponentInstances(Service service, ComponentInstance instance) { + Map<String, ArtifactDefinition> artifactsMap = instance.getDeploymentArtifacts(); + List<GroupInstance> groupsList = instance.getGroupInstances(); + if (groupsList != null && artifactsMap != null) { + List<GroupInstance> groupsToDelete = new ArrayList<>(); + for (GroupInstance group : groupsList) { + fixGroupInstances(service, artifactsMap, groupsToDelete, group); + + } + + if (!groupsToDelete.isEmpty()) { + log.debug("Migration1707ArtifactUuidFix delete group: resource id {}, group instance to delete {} ", + service.getUniqueId(), groupsToDelete); + groupsList.removeAll(groupsToDelete); + + } + + Optional<ArtifactDefinition> optionalVfModuleArtifact = artifactsMap.values().stream() + .filter(p -> p.getArtifactType().equals(ArtifactTypeEnum.VF_MODULES_METADATA.name())).findAny(); + if (optionalVfModuleArtifact.isPresent()) { + ArtifactDefinition vfModuleAertifact = optionalVfModuleArtifact.get(); + fillVfModuleInstHeatEnvPayload(groupsList, vfModuleAertifact); + } + } + } + + private void fixGroupInstances(Service service, Map<String, ArtifactDefinition> artifactsMap, + List<GroupInstance> groupsToDelete, GroupInstance group) { + if (group.getType().equals(Constants.DEFAULT_GROUP_VF_MODULE)) { + log.debug("Migration1707ArtifactUuidFix fix group: resource id {}, group name {} ", service.getUniqueId(), + group.getName()); + List<String> groupArtifacts = new ArrayList<String>(group.getArtifacts()); + + group.getArtifacts().clear(); + group.getArtifactsUuid().clear(); + group.getGroupInstanceArtifacts().clear(); + group.getGroupInstanceArtifactsUuid().clear(); + + for (String artifactId : groupArtifacts) { + fixArtifactUndergroupInstances(artifactsMap, group, groupArtifacts, artifactId); + } + if (group.getArtifacts() == null || group.getArtifacts().isEmpty()) { + log.debug( + "Migration1707ArtifactUuidFix fix groupInstance add to delete list: resource id {} name {} , group name {} ", + service.getUniqueId(), service.getName(), group.getName()); + groupsToDelete.add(group); + } + } + } + + private void fixArtifactUndergroupInstances(Map<String, ArtifactDefinition> artifactsMap, GroupInstance group, + List<String> groupArtifacts, String artifactId) { + String artifactlabel = findArtifactLabelFromArtifactId(artifactId); + log.debug("Migration1707ArtifactUuidFix fix group: group name {} artifactId for fix {} artifactlabel {} ", + group.getName(), artifactId, artifactlabel); + if (!artifactlabel.isEmpty() && artifactsMap.containsKey(artifactlabel)) { + ArtifactDefinition artifact = artifactsMap.get(artifactlabel); + ArtifactTypeEnum artifactType = ArtifactTypeEnum.findType(artifact.getArtifactType()); + String correctArtifactId = artifact.getUniqueId(); + String correctArtifactUUID = artifact.getArtifactUUID(); + if (artifactType != ArtifactTypeEnum.HEAT_ENV) { + boolean isAddToGroup = true; + if (groupArtifacts.size() == 1) { + + if (artifactType == ArtifactTypeEnum.HEAT_ARTIFACT) { + isAddToGroup = false; + artifact.setArtifactType(ArtifactTypeEnum.OTHER.getType()); + } + } + if (isAddToGroup) { + log.debug( + "Migration1707ArtifactUuidFix fix group: group name {} correct artifactId {} artifactUUID {} ", + group.getName(), correctArtifactId, correctArtifactUUID); + group.getArtifacts().add(correctArtifactId); + if (correctArtifactUUID != null && !correctArtifactUUID.isEmpty()) { + group.getArtifactsUuid().add(correctArtifactUUID); + } + } + } else { + log.debug( + "Migration1707ArtifactUuidFix fix group: group name {} correct artifactId {} artifactUUID {} ", + group.getName(), correctArtifactId, correctArtifactUUID); + group.getGroupInstanceArtifacts().add(correctArtifactId); + if (correctArtifactUUID != null && !correctArtifactUUID.isEmpty()) { + group.getGroupInstanceArtifactsUuid().add(correctArtifactUUID); + } + } + } + } + + private boolean fixVf(List<Resource> vfLst) { + for (Resource resource : vfLst) { + log.debug("Migration1707ArtifactUuidFix fix resource: id {}, name {} ", resource.getUniqueId(), + resource.getName()); + Map<String, ArtifactDefinition> artifactsMap = resource.getDeploymentArtifacts(); + List<GroupDefinition> groupsList = resource.getGroups(); + List<GroupDefinition> groupsToDelete = new ArrayList<>(); + if (groupsList != null && artifactsMap != null) { + for (GroupDefinition group : groupsList) { + if (group.getType().equals(Constants.DEFAULT_GROUP_VF_MODULE) && group.getArtifacts() != null) { + fixVfGroup(resource, artifactsMap, group); + } + if (group.getType().equals(Constants.DEFAULT_GROUP_VF_MODULE) + && (group.getArtifacts() == null || group.getArtifacts().isEmpty())) { + log.debug( + "Migration1707ArtifactUuidFix add group to delete list fix resource: id {}, name {} ", + resource.getUniqueId(), resource.getName(), group.getName()); + groupsToDelete.add(group); + } + } + + if (!groupsToDelete.isEmpty()) { + groupsList.removeAll(groupsToDelete); + + } + } + + } + + return true; + } + + private void fixVfGroup(Resource resource, Map<String, ArtifactDefinition> artifactsMap, GroupDefinition group) { + log.debug("Migration1707ArtifactUuidFix fix group: resource id {}, group name {} ", resource.getUniqueId(), + group.getName()); + List<String> groupArtifacts = new ArrayList<>(group.getArtifacts()); + + for (String artifactId : groupArtifacts) { + fixArtifactUnderGroup(artifactsMap, group, groupArtifacts, artifactId); + } + } + + private void fixArtifactUnderGroup(Map<String, ArtifactDefinition> artifactsMap, GroupDefinition group, + List<String> groupArtifacts, String artifactId) { + group.getArtifacts().clear(); + group.getArtifactsUuid().clear(); + String artifactlabel = findArtifactLabelFromArtifactId(artifactId); + log.debug("Migration1707ArtifactUuidFix fix group: group name {} artifactId for fix {} artifactlabel {} ", + group.getName(), artifactId, artifactlabel); + if (!artifactlabel.isEmpty() && artifactsMap.containsKey(artifactlabel)) { + ArtifactDefinition artifact = artifactsMap.get(artifactlabel); + String correctArtifactId = artifact.getUniqueId(); + String correctArtifactUUID = artifact.getArtifactUUID(); + boolean isAddToGroup = true; + if (groupArtifacts.size() == 1) { + ArtifactTypeEnum artifactType = ArtifactTypeEnum.findType(artifact.getArtifactType()); + if (artifactType == ArtifactTypeEnum.HEAT_ARTIFACT) { + isAddToGroup = false; + artifact.setArtifactType(ArtifactTypeEnum.OTHER.getType()); + } + } + if (isAddToGroup) { + log.debug( + "Migration1707ArtifactUuidFix fix group: group name {} correct artifactId {} artifactUUID {} ", + group.getName(), correctArtifactId, correctArtifactUUID); + group.getArtifacts().add(correctArtifactId); + if (correctArtifactUUID != null && !correctArtifactUUID.isEmpty()) { + group.getArtifactsUuid().add(correctArtifactUUID); + } + } + + } + } + + private String findArtifactLabelFromArtifactId(String artifactId) { + String artifactLabel = ""; + + int index = artifactId.lastIndexOf('.'); + if (index > 0 && index + 1 < artifactId.length()) + artifactLabel = artifactId.substring(index + 1); + return artifactLabel; + } + + private void writeModuleResultToFile(Writer writer, org.openecomp.sdc.be.model.Component component, + Service service) { + try { + // "service name, service id, state, version + StringBuilder sb = new StringBuilder(component.getName()); + sb.append(",").append(component.getUniqueId()).append(",").append(component.getLifecycleState()).append(",") + .append(component.getVersion()); + if (service != null) { + sb.append(",").append(service.getName()); + } + sb.append("\n"); + writer.write(sb.toString()); + } catch (IOException e) { + log.error(e.getMessage()); + } + } + + private void writeModuleResultToFile(Writer writer, List<Component> components) { + try { + // "service name, service id, state, version + for (Component component : components) { + StringBuilder sb = new StringBuilder(component.getName()); + sb.append(",").append(component.getUniqueId()).append(",").append(component.getInvariantUUID()) + .append(",").append(component.getLifecycleState()).append(",").append(component.getVersion()); + + sb.append("\n"); + writer.write(sb.toString()); + } + } catch (IOException e) { + + log.error(e.getMessage()); + } + } + + public boolean doFixTosca(Map<String, List<Component>> nodeToFix, Map<String, List<Component>> vfToFix, + Map<String, List<Component>> serviceToFix) { + + Map<GraphPropertyEnum, Object> hasProps = new HashMap<>(); + hasProps.put(GraphPropertyEnum.COMPONENT_TYPE, ComponentTypeEnum.RESOURCE.name()); + hasProps.put(GraphPropertyEnum.STATE, LifecycleStateEnum.CERTIFIED.name()); + + Map<String, List<Component>> vertices = getVerticesToValidate(VertexTypeEnum.NODE_TYPE, hasProps); + boolean result = validateTosca(vertices, nodeToFix, "RESOURCE_TOSCA_ARTIFACTS");// + + hasProps.clear(); + hasProps.put(GraphPropertyEnum.COMPONENT_TYPE, ComponentTypeEnum.RESOURCE.name()); + hasProps.put(GraphPropertyEnum.RESOURCE_TYPE, ResourceTypeEnum.VF); + hasProps.put(GraphPropertyEnum.STATE, LifecycleStateEnum.CERTIFIED.name()); + + vertices = getVerticesToValidate(VertexTypeEnum.TOPOLOGY_TEMPLATE, hasProps); + result = validateTosca(vertices, vfToFix, "VF_TOSCA_ARTIFACTS"); + + hasProps.clear(); + hasProps.put(GraphPropertyEnum.COMPONENT_TYPE, ComponentTypeEnum.SERVICE.name()); + hasProps.put(GraphPropertyEnum.STATE, LifecycleStateEnum.CERTIFIED.name()); + + vertices = getVerticesToValidate(VertexTypeEnum.TOPOLOGY_TEMPLATE, hasProps); + result = validateTosca(vertices, serviceToFix, "SERVICE_TOSCA_ARTIFACTS"); + + return result; + } + + public Map<String, List<Component>> getVerticesToValidate(VertexTypeEnum type, + Map<GraphPropertyEnum, Object> hasProps) { + + Map<String, List<Component>> result = new HashMap<>(); + try { + + Either<List<GraphVertex>, TitanOperationStatus> resultsEither = titanDao.getByCriteria(type, hasProps); + if (resultsEither.isRight()) { + System.out.println("getVerticesToValidate failed " + resultsEither.right().value()); + return result; + } + System.out.println("getVerticesToValidate: " + resultsEither.left().value().size() + " vertices to scan"); + List<GraphVertex> componentsList = resultsEither.left().value(); + componentsList.forEach(vertex -> { + String ivariantUuid = (String) vertex.getMetadataProperty(GraphPropertyEnum.INVARIANT_UUID); + if (!result.containsKey(ivariantUuid)) { + List<Component> compList = new ArrayList<Component>(); + result.put(ivariantUuid, compList); + } + List<Component> compList = result.get(ivariantUuid); + + ComponentParametersView filter = new ComponentParametersView(true); + filter.setIgnoreArtifacts(false); + + Either<Component, StorageOperationStatus> toscaElement = toscaOperationFacade + .getToscaElement(vertex.getUniqueId(), filter); + if (toscaElement.isRight()) { + System.out.println("getVerticesToValidate: failed to find element" + vertex.getUniqueId() + + " staus is" + toscaElement.right().value()); + } else { + compList.add(toscaElement.left().value()); + } + titanDao.commit(); + + }); + + } catch (Exception e) { + log.info("Failed to fetch vf resources ", e); + + } finally { + titanDao.commit(); + + } + return result; + } + + public boolean validateTosca(Map<String, List<Component>> vertices, Map<String, List<Component>> compToFix, + String name) { + boolean result = true; + long time = System.currentTimeMillis(); + String fileName = name + "_" + time + ".csv"; + Writer writer = null; + try { + writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(fileName), "utf-8")); + writer.write("name, UUID, invariantUUID, state, version\n"); + for (Map.Entry<String, List<Component>> entry : vertices.entrySet()) { + List<Component> compList = entry.getValue(); + Set<String> artifactEsId = new HashSet<>(); + for (Component component : compList) { + Map<String, ArtifactDefinition> toscaArtifacts = component.getToscaArtifacts(); + Optional<ArtifactDefinition> op = toscaArtifacts.values().stream() + .filter(a -> artifactEsId.contains(a.getEsId()) && a.getEsId() != null).findAny(); + if (op.isPresent()) { + result = false; + writeModuleResultToFile(writer, compList); + writer.flush(); + break; + } else { + artifactEsId.addAll(toscaArtifacts.values().stream().map(ArtifactDefinition::getEsId) + .collect(Collectors.toList())); + } + } + if (!result) { + List<Component> compListfull = new ArrayList<>(); + for (Component c : compList) { + ComponentParametersView filter = new ComponentParametersView(true); + filter.setIgnoreComponentInstances(false); + filter.setIgnoreArtifacts(false); + filter.setIgnoreGroups(false); + + Either<Component, StorageOperationStatus> toscaElement = toscaOperationFacade + .getToscaElement(c.getUniqueId(), filter); + if (toscaElement.isRight()) { + System.out.println("getVerticesToValidate: failed to find element" + c.getUniqueId() + + " staus is" + toscaElement.right().value()); + } else { + compListfull.add(toscaElement.left().value()); + } + this.titanDao.commit(); + } + + compToFix.put(entry.getKey(), compListfull); + result = true; + } + + } + + } catch (Exception e) { + log.info("Failed to fetch vf resources ", e); + return false; + } finally { + titanDao.commit(); + try { + writer.flush(); + writer.close(); + } catch (Exception ex) { + /* ignore */} + } + return result; + } + + private Either<ArtifactDefinition, ToscaError> generateToscaArtifact(Component parent, + ArtifactDefinition artifactInfo) { + log.debug("tosca artifact generation"); + try { + if (artifactInfo.getArtifactType().equals(ArtifactTypeEnum.TOSCA_CSAR.getType())) { + Either<byte[], ResponseFormat> generated = csarUtils.createCsar(parent, true, true); + + if (generated.isRight()) { + log.debug("Failed to export tosca csar for component {} error {}", parent.getUniqueId(), + generated.right().value()); + + return Either.right(ToscaError.GENERAL_ERROR); + } + byte[] value = generated.left().value(); + artifactInfo.setPayload(value); + + } else { + Either<ToscaRepresentation, ToscaError> exportComponent = toscaExportUtils.exportComponent(parent); + if (exportComponent.isRight()) { + log.debug("Failed export tosca yaml for component {} error {}", parent.getUniqueId(), + exportComponent.right().value()); + + return Either.right(exportComponent.right().value()); + } + log.debug("Tosca yaml exported for component {} ", parent.getUniqueId()); + String payload = exportComponent.left().value().getMainYaml(); + + artifactInfo.setPayloadData(payload); + } + + byte[] decodedPayload = artifactInfo.getPayloadData(); + artifactInfo.setEsId(artifactInfo.getUniqueId()); + artifactInfo.setArtifactChecksum(GeneralUtility.calculateMD5Base64EncodedByByteArray(decodedPayload)); + ESArtifactData artifactData = new ESArtifactData(artifactInfo.getEsId(), decodedPayload); + artifactCassandraDao.saveArtifact(artifactData); + log.debug("Tosca yaml artifact esId ", artifactInfo.getEsId()); + } catch (Exception ex) { + log.error("Failed to generate tosca atifact id {} component id {} component name {} error {}",artifactInfo.getUniqueId(), + parent.getUniqueId(), parent.getName(), ex.getMessage() ); + + return Either.right(ToscaError.GENERAL_ERROR); + } + + return Either.left(artifactInfo); + } + + private void fillVfModuleInstHeatEnvPayload(List<GroupInstance> groupsForCurrVF, + ArtifactDefinition vfModuleArtifact) { + + List<VfModuleArtifactPayload> vfModulePayloadForCurrVF = new ArrayList<VfModuleArtifactPayload>(); + if (groupsForCurrVF != null) { + for (GroupInstance groupInstance : groupsForCurrVF) { + VfModuleArtifactPayload modulePayload = new VfModuleArtifactPayload(groupInstance); + vfModulePayloadForCurrVF.add(modulePayload); + } + Collections.sort(vfModulePayloadForCurrVF, + (art1, art2) -> VfModuleArtifactPayload.compareByGroupName(art1, art2)); + + final Gson gson = new GsonBuilder().setPrettyPrinting().create(); + + String vfModulePayloadString = gson.toJson(vfModulePayloadForCurrVF); + if (vfModulePayloadString != null) { + String newCheckSum = GeneralUtility + .calculateMD5Base64EncodedByByteArray(vfModulePayloadString.getBytes()); + vfModuleArtifact.setArtifactChecksum(newCheckSum); + + ESArtifactData artifactData = new ESArtifactData(vfModuleArtifact.getEsId(), + vfModulePayloadString.getBytes()); + artifactCassandraDao.saveArtifact(artifactData); + + } + + } + + } +} @@ -0,0 +1,38 @@ +package org.openecomp.sdc.asdctool.impl.validator; + +import java.util.List; + +import org.openecomp.sdc.asdctool.impl.validator.executers.IArtifactValidatorExecuter; +import org.openecomp.sdc.asdctool.impl.validator.utils.ReportManager; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; + +public class ArtifactToolBL { + + private static Logger log = LoggerFactory.getLogger(ValidationToolBL.class.getName()); + + @Autowired + protected List<IArtifactValidatorExecuter> validators; + + @Autowired + protected ReportManager reportManager; + + private boolean allValid = true; + + + public boolean validateAll() { + for (IArtifactValidatorExecuter validatorExec: validators) { + System.out.println("ValidatorExecuter "+validatorExec.getName()+" started"); + if (!validatorExec.executeValidations()) { + allValid = false; + System.out.println("ValidatorExecuter "+validatorExec.getName()+" finished with warnings"); + } + else { + System.out.println("ValidatorExecuter "+validatorExec.getName()+" finished successfully"); + } + } + return allValid; + } + +} @@ -11,16 +11,22 @@ import java.util.Properties; public class ValidationConfigManager { private static Properties prop = new Properties(); + private static String outputFullFilePath; + private static String outputFilePath; + public static String getOutputFullFilePath() { + return outputFullFilePath; + } public static String getOutputFilePath() { return outputFilePath; } - public static void setOutputFilePath(String outputPath) { - ValidationConfigManager.outputFilePath = outputPath+ "/reportOutput.txt"; + public static void setOutputFullFilePath(String outputPath) { + ValidationConfigManager.outputFilePath = outputPath; + ValidationConfigManager.outputFullFilePath = outputPath+ "/reportOutput.txt"; } - private static String outputFilePath; + public static String getCsvReportFilePath() { return csvReportFilePath; @@ -1,7 +1,11 @@ package org.openecomp.sdc.asdctool.impl.validator.config; +import org.openecomp.sdc.asdctool.impl.validator.ArtifactToolBL; import org.openecomp.sdc.asdctool.impl.validator.ValidationToolBL; +import org.openecomp.sdc.asdctool.impl.validator.executers.NodeToscaArtifactsValidatorExecuter; +import org.openecomp.sdc.asdctool.impl.validator.executers.ServiceToscaArtifactsValidatorExecutor; import org.openecomp.sdc.asdctool.impl.validator.executers.ServiceValidatorExecuter; +import org.openecomp.sdc.asdctool.impl.validator.executers.VFToscaArtifactValidatorExecutor; import org.openecomp.sdc.asdctool.impl.validator.executers.VfValidatorExecuter; import org.openecomp.sdc.asdctool.impl.validator.tasks.artifacts.ArtifactValidationUtils; import org.openecomp.sdc.asdctool.impl.validator.tasks.artifacts.ServiceArtifactValidationTask; @@ -37,6 +41,15 @@ public class ValidationToolConfiguration { @Bean public ServiceValidatorExecuter basicServiceValidator() { return new ServiceValidatorExecuter();} + + @Bean + public NodeToscaArtifactsValidatorExecuter NodeToscaArtifactsValidatorValidator() { return new NodeToscaArtifactsValidatorExecuter();} + + @Bean + public ServiceToscaArtifactsValidatorExecutor ServiceToscaArtifactsValidator() { return new ServiceToscaArtifactsValidatorExecutor();} + + @Bean + public VFToscaArtifactValidatorExecutor VFToscaArtifactValidator() { return new VFToscaArtifactValidatorExecutor();} @Bean public VfArtifactValidationTask vfArtifactValidationTask() { return new VfArtifactValidationTask(); } @@ -51,6 +64,11 @@ public class ValidationToolConfiguration { public ValidationToolBL validationToolBL() { return new ValidationToolBL(); } + + @Bean + public ArtifactToolBL artifactToolBL() { + return new ArtifactToolBL(); + } @Bean public VfValidatorExecuter basicVfValidator() { return new VfValidatorExecuter();} @@ -0,0 +1,145 @@ +package org.openecomp.sdc.asdctool.impl.validator.executers; + +import java.io.BufferedWriter; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.io.Writer; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import java.util.stream.Collectors; + +import org.openecomp.sdc.asdctool.impl.validator.config.ValidationConfigManager; +import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; +import org.openecomp.sdc.be.dao.jsongraph.TitanDao; +import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum; +import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; +import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum; +import org.openecomp.sdc.be.model.ArtifactDefinition; +import org.openecomp.sdc.be.model.Component; +import org.openecomp.sdc.be.model.ComponentParametersView; +import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; + +import fj.data.Either; + +public class ArtifactValidatorExecuter{ + + @Autowired + protected TitanDao titanDao; + + @Autowired + private ToscaOperationFacade toscaOperationFacade; + private static Logger log = LoggerFactory.getLogger(ArtifactValidatorExecuter.class.getName()); + + protected String name; + + public void setName(String name) { + this.name = name; + } + + public String getName() { + return name; + } + + + + public Map<String, List<Component>> getVerticesToValidate(VertexTypeEnum type, Map<GraphPropertyEnum, Object> hasProps){ + Map<String, List<Component>> result = new HashMap<>(); + Either<List<GraphVertex>, TitanOperationStatus> resultsEither = titanDao.getByCriteria(type, hasProps); + if (resultsEither.isRight()) { + System.out.println("getVerticesToValidate failed "+ resultsEither.right().value()); + return result; + } + System.out.println("getVerticesToValidate: "+resultsEither.left().value().size()+" vertices to scan"); + List<GraphVertex> componentsList = resultsEither.left().value(); + componentsList.forEach(vertex -> { + String ivariantUuid = (String)vertex.getMetadataProperty(GraphPropertyEnum.INVARIANT_UUID); + if(!result.containsKey(ivariantUuid)){ + List<Component> compList = new ArrayList<Component>(); + result.put(ivariantUuid, compList); + } + List<Component> compList = result.get(ivariantUuid); + + ComponentParametersView filter = new ComponentParametersView(true); + filter.setIgnoreArtifacts(false); + + Either<Component, StorageOperationStatus> toscaElement = toscaOperationFacade.getToscaElement(vertex.getUniqueId(), filter); + if (toscaElement.isRight()) { + System.out.println("getVerticesToValidate: failed to find element"+ vertex.getUniqueId()+" staus is" + toscaElement.right().value()); + }else{ + compList.add(toscaElement.left().value()); + } + + }); + + return result; + } + + public boolean validate( Map<String, List<Component>> vertices) { + boolean result = true; + long time = System.currentTimeMillis(); + String fileName = ValidationConfigManager.getOutputFilePath() + this.getName() + "_"+ time + ".csv"; + Writer writer = null; + try { + writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(fileName), "utf-8")); + writer.write("name, UUID, invariantUUID, state, version\n"); + Collection<List<Component>> collection = vertices.values(); + for(List<Component> compList: collection ){ + Set<String> artifactEsId = new HashSet<>(); + for(Component component: compList ){ + Map<String, ArtifactDefinition> toscaArtifacts = component.getToscaArtifacts(); + Optional<ArtifactDefinition> op = toscaArtifacts.values(). + stream().filter(a -> artifactEsId.contains(a.getEsId())).findAny(); + if(op.isPresent()){ + result = false; + writeModuleResultToFile(writer, compList); + writer.flush(); + break; + }else{ + artifactEsId.addAll(toscaArtifacts.values().stream().map(ArtifactDefinition::getEsId).collect(Collectors.toList())) ; + } + } + + } + + } catch (Exception e) { + log.info("Failed to fetch vf resources ", e); + return false; + } finally { + titanDao.commit(); + try { + writer.flush(); + writer.close(); + } catch (Exception ex) { + /* ignore */} + } + return result; + } + + private void writeModuleResultToFile(Writer writer, List<Component> components) { + try { + // "service name, service id, state, version + for(Component component: components ){ + StringBuffer sb = new StringBuffer(component.getName()); + sb.append(",").append(component.getUniqueId()).append(",").append(component.getInvariantUUID()).append(",").append(component.getLifecycleState()).append(",").append(component.getVersion()); + + sb.append("\n"); + writer.write(sb.toString()); + } + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + +} @@ -0,0 +1,9 @@ +package org.openecomp.sdc.asdctool.impl.validator.executers; + +public interface IArtifactValidatorExecuter { + boolean executeValidations(); + String getName(); + + + +} @@ -0,0 +1,41 @@ +package org.openecomp.sdc.asdctool.impl.validator.executers; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum; +import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; +import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum; +import org.openecomp.sdc.be.model.Component; +import org.openecomp.sdc.be.model.LifecycleStateEnum; + +public class NodeToscaArtifactsValidatorExecuter extends ArtifactValidatorExecuter implements IArtifactValidatorExecuter{ + protected String name; + + public NodeToscaArtifactsValidatorExecuter() { + setName("RESOURCE_TOSCA_ARTIFACTS"); + } + @Override + public boolean executeValidations() { + + Map<GraphPropertyEnum, Object> hasProps = new HashMap<>(); + hasProps.put(GraphPropertyEnum.COMPONENT_TYPE, ComponentTypeEnum.RESOURCE.name()); + hasProps.put(GraphPropertyEnum.STATE, LifecycleStateEnum.CERTIFIED.name()); + + Map<String, List<Component>> vertices = getVerticesToValidate(VertexTypeEnum.NODE_TYPE, hasProps); + return validate(vertices); + + } + + @Override + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + +} @@ -0,0 +1,39 @@ +package org.openecomp.sdc.asdctool.impl.validator.executers; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum; +import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; +import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum; +import org.openecomp.sdc.be.model.Component; +import org.openecomp.sdc.be.model.LifecycleStateEnum; + +public class ServiceToscaArtifactsValidatorExecutor extends ArtifactValidatorExecuter implements IArtifactValidatorExecuter{ + + + public ServiceToscaArtifactsValidatorExecutor() { + setName("SERVICE_TOSCA_ARTIFACTS"); + } + @Override + public boolean executeValidations() { + Map<GraphPropertyEnum, Object> hasProps = new HashMap<>(); + hasProps.put(GraphPropertyEnum.COMPONENT_TYPE, ComponentTypeEnum.SERVICE.name()); + hasProps.put(GraphPropertyEnum.STATE, LifecycleStateEnum.CERTIFIED.name()); + + Map<String, List<Component>> vertices = getVerticesToValidate(VertexTypeEnum.TOPOLOGY_TEMPLATE, hasProps); + return validate(vertices); + } + + @Override + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + +} @@ -0,0 +1,43 @@ +package org.openecomp.sdc.asdctool.impl.validator.executers; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum; +import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; +import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum; +import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; +import org.openecomp.sdc.be.model.Component; +import org.openecomp.sdc.be.model.LifecycleStateEnum; + +public class VFToscaArtifactValidatorExecutor extends ArtifactValidatorExecuter implements IArtifactValidatorExecuter{ + + public VFToscaArtifactValidatorExecutor() { + setName("VF_TOSCA_ARTIFACTS"); + } + @Override + public boolean executeValidations() { + + Map<GraphPropertyEnum, Object> hasProps = new HashMap<>(); + hasProps.put(GraphPropertyEnum.COMPONENT_TYPE, ComponentTypeEnum.RESOURCE.name()); + hasProps.put(GraphPropertyEnum.RESOURCE_TYPE, ResourceTypeEnum.VF); + hasProps.put(GraphPropertyEnum.STATE, LifecycleStateEnum.CERTIFIED.name()); + + Map<String, List<Component>> vertices = getVerticesToValidate(VertexTypeEnum.TOPOLOGY_TEMPLATE, hasProps); + return validate( vertices); + + } + + @Override + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + +} @@ -34,7 +34,7 @@ public class ReportManager { } private void initReportFile() throws IOException { - reportOutputFilePath = ValidationConfigManager.getOutputFilePath(); + reportOutputFilePath = ValidationConfigManager.getOutputFullFilePath(); StrBuilder sb = new StrBuilder(); sb.appendln("-----------------------Validation Tool Results:-------------------------"); Files.write(Paths.get(reportOutputFilePath), sb.toString().getBytes()); @@ -0,0 +1,45 @@ +package org.openecomp.sdc.asdctool.main; + +import org.openecomp.sdc.asdctool.configuration.ArtifactUUIDFixConfiguration; +import org.openecomp.sdc.asdctool.configuration.ConfigurationUploader; +import org.openecomp.sdc.asdctool.impl.ArtifactUuidFix; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.context.annotation.AnnotationConfigApplicationContext; + +public class ArtifactUUIDFixMenu { + + private static Logger log = LoggerFactory.getLogger(ArtifactUUIDFixMenu.class); + + public static void main(String[] args) { + if (args == null || args.length < 3) { + System.out.println("Usage: <configuration dir> <all/distributed_only> <services/service_vf/fix/fix_only_services>"); + System.exit(1); + } + String fixServices = args[1]; + String runMode = args[2]; + // String fixTosca = args[3]; + log.info("Start fixing artifact UUID after 1707 migration with arguments run with configuration [{}] , for [{}] services", runMode, fixServices); + String appConfigDir = args[0]; + ConfigurationUploader.uploadConfigurationFiles(appConfigDir); + AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(ArtifactUUIDFixConfiguration.class); + ArtifactUuidFix artifactUuidFix = context.getBean(ArtifactUuidFix.class); + boolean isSuccessful = artifactUuidFix.doFix(fixServices, runMode); + if (isSuccessful) { + log.info("Fixing artifacts UUID for 1707 was finished successfully"); + /* isSuccessful = artifactUuidFix.doFixTosca(fixTosca, fixServices, runMode); + if (isSuccessful) { + log.info("Fixing tosca artifacts was finished successfully"); + isSuccessful = artifactUuidFix.doFixTosca(fixTosca, fixServices, runMode); + } else{ + log.info("Fixing tosca artifacts has failed"); + System.exit(2); + }*/ + } else{ + log.info("Fixing artifacts UUID for 1707 has failed"); + System.exit(2); + } + System.exit(0); + } + +} @@ -0,0 +1,46 @@ +package org.openecomp.sdc.asdctool.main; + +import org.openecomp.sdc.asdctool.impl.validator.ArtifactToolBL; +import org.openecomp.sdc.asdctool.impl.validator.config.ValidationConfigManager; +import org.openecomp.sdc.asdctool.impl.validator.config.ValidationToolConfiguration; +import org.openecomp.sdc.be.config.ConfigurationManager; +import org.openecomp.sdc.common.api.ConfigurationSource; +import org.openecomp.sdc.common.impl.ExternalConfiguration; +import org.openecomp.sdc.common.impl.FSConfigurationSource; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.context.annotation.AnnotationConfigApplicationContext; + +public class ArtifactValidatorTool { + private static Logger log = LoggerFactory.getLogger(ValidationTool.class.getName()); + + public static void main(String[] args) throws Exception { + + String outputPath = args[0]; + ValidationConfigManager.setOutputFullFilePath(outputPath); + ValidationConfigManager.setCsvReportFilePath(outputPath); + + String appConfigDir = args[1]; + AnnotationConfigApplicationContext context = initContext(appConfigDir); + ArtifactToolBL validationToolBL = context.getBean(ArtifactToolBL.class); + + System.out.println("Start ArtifactValidation Tool"); + Boolean result = validationToolBL.validateAll(); + // ReportManager.reportEndOfToolRun(); + if (result) { + System.out.println("ArtifactValidation finished successfully"); + System.exit(0); + } else { + System.out.println("ArtifactValidation finished with warnings"); + System.exit(2); + } + } + + private static AnnotationConfigApplicationContext initContext(String appConfigDir) { + ConfigurationSource configurationSource = new FSConfigurationSource(ExternalConfiguration.getChangeListener(), appConfigDir); + ConfigurationManager configurationManager = new ConfigurationManager(configurationSource); + AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(ValidationToolConfiguration.class); + return context; + } + +} @@ -25,7 +25,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import org.apache.commons.lang3.tuple.ImmutablePair; import org.openecomp.sdc.asdctool.impl.UpdatePropertyOnVertex; import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; @@ -22,7 +22,7 @@ public class ValidationTool { public static void main(String[] args) throws Exception { String outputPath = args[0]; - ValidationConfigManager.setOutputFilePath(outputPath); + ValidationConfigManager.setOutputFullFilePath(outputPath); ValidationConfigManager.setCsvReportFilePath(outputPath); String appConfigDir = args[1]; @@ -1,21 +1,70 @@ package org.openecomp.sdc.asdctool.migration.config; +import java.util.ArrayList; +import java.util.List; + import org.openecomp.sdc.asdctool.migration.core.SdcMigrationTool; import org.openecomp.sdc.asdctool.migration.core.task.Migration; +import org.openecomp.sdc.asdctool.migration.core.task.PostMigration; +import org.openecomp.sdc.asdctool.migration.dao.MigrationTasksDao; import org.openecomp.sdc.asdctool.migration.resolver.MigrationResolver; import org.openecomp.sdc.asdctool.migration.resolver.SpringBeansMigrationResolver; import org.openecomp.sdc.asdctool.migration.service.SdcRepoService; +import org.openecomp.sdc.be.auditing.impl.AuditingManager; +import org.openecomp.sdc.be.components.ArtifactsResolver; +import org.openecomp.sdc.be.components.distribution.engine.DistributionEngine; +import org.openecomp.sdc.be.components.distribution.engine.ServiceDistributionArtifactsBuilder; +import org.openecomp.sdc.be.components.impl.AdditionalInformationBusinessLogic; +import org.openecomp.sdc.be.components.impl.ArtifactResolverImpl; +import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic; +import org.openecomp.sdc.be.components.impl.CompositionBusinessLogic; +import org.openecomp.sdc.be.components.impl.GroupBusinessLogic; +import org.openecomp.sdc.be.components.impl.InputsBusinessLogic; +import org.openecomp.sdc.be.components.impl.ProductBusinessLogic; +import org.openecomp.sdc.be.components.impl.ResourceBusinessLogic; +import org.openecomp.sdc.be.components.impl.ResourceImportManager; +import org.openecomp.sdc.be.components.impl.ServiceBusinessLogic; +import org.openecomp.sdc.be.components.impl.ServiceComponentInstanceBusinessLogic; +import org.openecomp.sdc.be.components.impl.VFComponentInstanceBusinessLogic; +import org.openecomp.sdc.be.components.impl.generic.GenericTypeBusinessLogic; +import org.openecomp.sdc.be.components.lifecycle.LifecycleBusinessLogic; +import org.openecomp.sdc.be.components.merge.heat.HeatEnvArtifactsMergeBusinessLogic; +import org.openecomp.sdc.be.components.merge.input.InputsValuesMergingBusinessLogic; +import org.openecomp.sdc.be.components.merge.instance.ComponentInstanceMergeDataBusinessLogic; +import org.openecomp.sdc.be.components.merge.property.DataDefinitionsValuesMergingBusinessLogic; +import org.openecomp.sdc.be.dao.DAOTitanStrategy; +import org.openecomp.sdc.be.dao.TitanClientStrategy; +import org.openecomp.sdc.be.dao.cassandra.AuditCassandraDao; import org.openecomp.sdc.be.dao.cassandra.CassandraClient; -import org.openecomp.sdc.asdctool.migration.dao.MigrationTasksDao; import org.openecomp.sdc.be.dao.config.DAOSpringConfig; +import org.openecomp.sdc.be.dao.es.ElasticSearchClient; +import org.openecomp.sdc.be.dao.impl.AuditingDao; +import org.openecomp.sdc.be.dao.jsongraph.TitanDao; +import org.openecomp.sdc.be.dao.titan.TitanGenericDao; +import org.openecomp.sdc.be.dao.titan.TitanGraphClient; +import org.openecomp.sdc.be.impl.ComponentsUtils; +import org.openecomp.sdc.be.model.cache.ComponentCache; +import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.operations.impl.CapabilityTypeOperation; +import org.openecomp.sdc.be.model.operations.impl.ComponentInstanceOperation; +import org.openecomp.sdc.be.model.operations.impl.CsarOperation; +import org.openecomp.sdc.be.model.operations.impl.ElementOperation; +import org.openecomp.sdc.be.model.operations.impl.GraphLockOperation; +import org.openecomp.sdc.be.model.operations.impl.GroupInstanceOperation; +import org.openecomp.sdc.be.model.operations.impl.GroupOperation; +import org.openecomp.sdc.be.model.operations.impl.GroupTypeOperation; +import org.openecomp.sdc.be.model.operations.impl.PropertyOperation; +import org.openecomp.sdc.be.tosca.CsarUtils; +import org.openecomp.sdc.be.tosca.ToscaExportHandler; +import org.openecomp.sdc.be.user.UserBusinessLogic; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.beans.factory.config.PropertiesFactoryBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; - -import java.util.ArrayList; -import java.util.List; +import org.springframework.core.io.FileSystemResource; @Configuration @Import(DAOSpringConfig.class) @@ -23,13 +72,19 @@ import java.util.List; "org.openecomp.sdc.be.model.operations.impl", "org.openecomp.sdc.be.model.cache", "org.openecomp.sdc.be.dao.titan", + "org.openecomp.sdc.be.components.validation", "org.openecomp.sdc.be.dao.cassandra", "org.openecomp.sdc.be.model.jsontitan.operations", - "org.openecomp.sdc.be.dao.jsongraph"}) + "org.openecomp.sdc.be.dao.jsongraph", + "org.openecomp.sdc.be.components.merge", + "org.openecomp.sdc.be.impl"}) public class MigrationSpringConfig { @Autowired(required=false) private List<Migration> migrations = new ArrayList<>(); + + @Autowired(required=false) + private List<PostMigration> postMigrations = new ArrayList<>(); @Bean(name = "sdc-migration-tool") public SdcMigrationTool sdcMigrationTool(MigrationResolver migrationResolver, SdcRepoService sdcRepoService) { @@ -38,7 +93,7 @@ public class MigrationSpringConfig { @Bean(name = "spring-migrations-resolver") public SpringBeansMigrationResolver migrationResolver(SdcRepoService sdcRepoService) { - return new SpringBeansMigrationResolver(migrations, sdcRepoService); + return new SpringBeansMigrationResolver(migrations, postMigrations, sdcRepoService); } @Bean(name = "sdc-repo-service") @@ -57,5 +112,247 @@ public class MigrationSpringConfig { } + @Bean(name = "dao-titan-strategy") + public TitanClientStrategy daoStrategy() { + return new DAOTitanStrategy(); + } + + @Bean(name = "titan-dao") + public TitanDao titanDao(@Qualifier("titan-client") TitanGraphClient titanGraphClient) { + return new TitanDao(titanGraphClient); + } + + @Bean(name = "titan-client", initMethod = "createGraph") + public TitanGraphClient titanClient(@Qualifier("dao-titan-strategy") TitanClientStrategy titanClientStrategy) { + return new TitanGraphClient(titanClientStrategy); + } + + @Bean(name = "resource-business-logic") + public ResourceBusinessLogic resourceBusinessLogic() { + return new ResourceBusinessLogic(); + } + +// @Bean(name = "healthCheckBusinessLogic") +// public HealthCheckBusinessLogic healthCheckBusinessLogic() { +// return new HealthCheckBusinessLogic(); +// } +// +// @Bean(name = "distribution-engine-cluster-health") +// public DistributionEngineClusterHealth distributionEngineClusterHealth() { +// return new DistributionEngineClusterHealth(); +// } +// +// @Bean(name = "cassandra-health-check") +// public CassandraHealthCheck cassandraHealthCheck() { +// return new CassandraHealthCheck(); +// } + +// @Bean(name = "switchover-detector") +// public SwitchoverDetector switchoverDetector() { +// return new SwitchoverDetector(); +// } + + @Bean(name = "service-business-logic") + public ServiceBusinessLogic serviceBusinessLogic() { + return new ServiceBusinessLogic(); + } + + @Bean(name = "capability-type-operation") + public CapabilityTypeOperation CapabilityTypeOperation() { + return new CapabilityTypeOperation(); + } + + @Bean(name = "lifecycle-business-logic") + public LifecycleBusinessLogic lifecycleBusinessLogic() { + return new LifecycleBusinessLogic(); + } + + @Bean(name = "property-operation") + public PropertyOperation propertyOperation(@Qualifier("titan-generic-dao") TitanGenericDao titanGenericDao) { + return new PropertyOperation(titanGenericDao); + } + + @Bean(name = "csar-operation") + public CsarOperation csarOperation() { + return new CsarOperation(); + } + + @Bean(name = "vf-component-instance-business-logic") + public VFComponentInstanceBusinessLogic vFComponentInstanceBusinessLogic() { + return new VFComponentInstanceBusinessLogic(); + } + + @Bean(name = "resource-import-manager") + public ResourceImportManager resourceImportManager() { + return new ResourceImportManager(); + } + + @Bean(name = "group-business-logic") + public GroupBusinessLogic groupBusinessLogic() { + return new GroupBusinessLogic(); + } + + @Bean(name = "inputs-business-logic") + public InputsBusinessLogic inputsBusinessLogic() { + return new InputsBusinessLogic(); + } + + @Bean(name = "composition-business-logic") + public CompositionBusinessLogic compositionBusinessLogic() { + return new CompositionBusinessLogic(); + } + + @Bean(name = "artifacts-business-logic") + public ArtifactsBusinessLogic artifactsBusinessLogic() { + return new ArtifactsBusinessLogic(); + } + + @Bean(name = "component-cache") + public ComponentCache componentCache() { + return new ComponentCache(); + } + + @Bean(name = "componentUtils") + public ComponentsUtils componentsUtils() { + return new ComponentsUtils(); + } + + @Bean(name = "user-business-logic") + public UserBusinessLogic userBusinessLogic() { + return new UserBusinessLogic(); + } + + @Bean(name = "graph-lock-operation") + public GraphLockOperation graphLockOperation() { + return new GraphLockOperation(); + } + + @Bean(name = "titan-generic-dao") + public TitanGenericDao titanGenericDao(@Qualifier("titan-client") TitanGraphClient titanGraphClient) { + return new TitanGenericDao(titanGraphClient); + } + + @Bean(name = "element-operation") + public ElementOperation elementOperation(@Qualifier("titan-generic-dao") TitanGenericDao titanGenericDao) { + return new ElementOperation(titanGenericDao); + } + + @Bean(name = "group-operation") + public GroupOperation groupOperation() { + return new GroupOperation(); + } + + @Bean(name = "group-instance-operation") + public GroupInstanceOperation groupInstanceOperation() { + return new GroupInstanceOperation(); + } + + @Bean(name = "group-type-operation") + public GroupTypeOperation groupTypeOperation(@Qualifier("titan-generic-dao") TitanGenericDao titanGenericDao, @Qualifier("property-operation") PropertyOperation propertyOperation) { + return new GroupTypeOperation(titanGenericDao, propertyOperation); + } + + @Bean(name = "tosca-operation-facade") + public ToscaOperationFacade toscaOperationFacade() { + return new ToscaOperationFacade(); + } + + @Bean(name = "distribution-engine") + public DistributionEngine distributionEngine() { + return null; + } + + @Bean(name = "audit-cassandra-dao") + public AuditCassandraDao auditCassandraDao() { + return new AuditCassandraDao(); + } + + @Bean(name = "service-component-instance-business-logic") + public ServiceComponentInstanceBusinessLogic serviceComponentInstanceBusinessLogic() { + return new ServiceComponentInstanceBusinessLogic(); + } + + @Bean("tosca-export-handler") + public ToscaExportHandler toscaExportHandler() { + return new ToscaExportHandler(); + } + + @Bean(name = "component-instance-operation") + public ComponentInstanceOperation componentInstanceOperation() { + return new ComponentInstanceOperation(); + } + + @Bean(name = "additional-information-business-logic") + public AdditionalInformationBusinessLogic additionalInformationBusinessLogic() { + return new AdditionalInformationBusinessLogic(); + } + + @Bean(name = "auditing-manager") + public AuditingManager auditingManager() { + return new AuditingManager(); + } + + @Bean(name = "auditing-dao") + public AuditingDao auditingDao() { + return new AuditingDao(); + } + + @Bean(name = "elasticsearch-client", initMethod = "initialize") + public ElasticSearchClient elasticSearchClient() { + return new ElasticSearchClient(); + } + + @Bean(name = "csar-utils") + public CsarUtils csarUtils() { + return new CsarUtils(); + } + + @Bean(name = "service-distribution-artifacts-builder") + public ServiceDistributionArtifactsBuilder serviceDistributionArtifactsBuilder() { + return new ServiceDistributionArtifactsBuilder(); + } + + @Bean(name = "product-business-logic") + public ProductBusinessLogic productBusinessLogic() { + return null; + } + + @Bean(name = "dataDefinitionsValuesMergingBusinessLogic") + public DataDefinitionsValuesMergingBusinessLogic dataDefinitionsValuesMergingBusinessLogic() { + return new DataDefinitionsValuesMergingBusinessLogic(); + } + + @Bean(name = "artifacts-resolver") + public ArtifactsResolver artifactsResolver() { + return new ArtifactResolverImpl(); + } + + @Bean(name = "InputsValuesMergingBusinessLogic") + public InputsValuesMergingBusinessLogic InputsValuesMergingBusinessLogic(){ + return new InputsValuesMergingBusinessLogic(); + } + + @Bean(name = "GenericTypeBusinessLogic") + public GenericTypeBusinessLogic genericTypeBusinessLogic(){ + return new GenericTypeBusinessLogic(); + } + + @Bean(name ="componentInstanceMergeDataBusinessLogic") + public ComponentInstanceMergeDataBusinessLogic componentInstanceMergeDataBusinessLogic(){ + return new ComponentInstanceMergeDataBusinessLogic(); + } + + @Bean(name ="heatEnvArtifactsMergeBusinessLogic") + public HeatEnvArtifactsMergeBusinessLogic heatEnvArtifactsMergeBusinessLogic(){ + return new HeatEnvArtifactsMergeBusinessLogic(); + } + + @Bean(name = "elasticsearchConfig") + public PropertiesFactoryBean mapper() { + String configHome = System.getProperty("config.home"); + PropertiesFactoryBean bean = new PropertiesFactoryBean(); + bean.setLocation(new FileSystemResource(configHome + "/elasticsearch.yml")); + return bean; + } } @@ -4,7 +4,8 @@ import java.util.List; import org.openecomp.sdc.asdctool.migration.core.execution.MigrationExecutionResult; import org.openecomp.sdc.asdctool.migration.core.execution.MigrationExecutorImpl; -import org.openecomp.sdc.asdctool.migration.core.task.Migration; +import org.openecomp.sdc.asdctool.migration.core.task.IMigrationStage; +import org.openecomp.sdc.asdctool.migration.core.task.IMigrationStage.AspectMigrationEnum; import org.openecomp.sdc.asdctool.migration.core.task.MigrationResult; import org.openecomp.sdc.asdctool.migration.resolver.MigrationResolver; import org.openecomp.sdc.asdctool.migration.service.SdcRepoService; @@ -30,16 +31,17 @@ public class SdcMigrationTool { public boolean migrate(boolean enforceAll) { LOGGER.info("starting migration process"); handleEnforceMigrationFlag(enforceAll); - List<Migration> migrations = migrationsResolver.resolveMigrations(); + List<IMigrationStage> migrations = migrationsResolver.resolveMigrations(); LOGGER.info("there are {} migrations task to execute", migrations.size()); - for (Migration migration : migrations) { + for (IMigrationStage migration : migrations) { try { MigrationExecutionResult executionResult = new MigrationExecutorImpl().execute(migration); if (migrationHasFailed(executionResult)) { LOGGER.error("migration {} with version {} has failed. error msg: {}", migration.getClass().getName(), migration.getVersion().toString(), executionResult.getMsg()); return false; } - sdcRepoService.createMigrationTask(executionResult.toMigrationTaskEntry()); + if(migration.getAspectMigration() == AspectMigrationEnum.MIGRATION) + sdcRepoService.createMigrationTask(executionResult.toMigrationTaskEntry()); } catch (RuntimeException e) { LOGGER.error("migration {} with version {} has failed. error msg: {}", migration.getClass().getName(), migration.getVersion().toString(), e); return false; @@ -1,11 +1,11 @@ package org.openecomp.sdc.asdctool.migration.core.execution; +import java.util.Date; + import org.openecomp.sdc.asdctool.migration.core.DBVersion; import org.openecomp.sdc.asdctool.migration.core.task.MigrationResult; import org.openecomp.sdc.be.resources.data.MigrationTaskEntry; -import java.util.Date; - public class MigrationExecutionResult { private MigrationResult.MigrationStatus migrationStatus; @@ -1,7 +1,7 @@ package org.openecomp.sdc.asdctool.migration.core.execution; import org.openecomp.sdc.asdctool.migration.core.MigrationException; -import org.openecomp.sdc.asdctool.migration.core.task.Migration; +import org.openecomp.sdc.asdctool.migration.core.task.IMigrationStage; public interface MigrationExecutor { @@ -10,6 +10,6 @@ public interface MigrationExecutor { * @return a {@link MigrationExecutionResult} with the relevant data on the current migration execution; * @throws MigrationException in case there was an unexpected exception during migration */ - MigrationExecutionResult execute(Migration migration) throws MigrationException; + MigrationExecutionResult execute(IMigrationStage migration) throws MigrationException; } @@ -1,7 +1,7 @@ package org.openecomp.sdc.asdctool.migration.core.execution; import org.openecomp.sdc.asdctool.migration.core.MigrationException; -import org.openecomp.sdc.asdctool.migration.core.task.Migration; +import org.openecomp.sdc.asdctool.migration.core.task.IMigrationStage; import org.openecomp.sdc.asdctool.migration.core.task.MigrationResult; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -13,7 +13,7 @@ public class MigrationExecutorImpl implements MigrationExecutor { private static final Logger LOGGER = LoggerFactory.getLogger(MigrationExecutorImpl.class); @Override - public MigrationExecutionResult execute(Migration migration) throws MigrationException { + public MigrationExecutionResult execute(IMigrationStage migration) throws MigrationException { try { LOGGER.info("starting migration {}. description: {}. version {}", migration.getClass().getName(), migration.description(), migration.getVersion().toString()); StopWatch stopWatch = new StopWatch(); @@ -29,12 +29,12 @@ public class MigrationExecutorImpl implements MigrationExecutor { } } - private MigrationExecutionResult logAndCreateExecutionResult(Migration migration, MigrationResult migrationResult, double executionTime) { + private MigrationExecutionResult logAndCreateExecutionResult(IMigrationStage migration, MigrationResult migrationResult, double executionTime) { LOGGER.info("finished migration {}. with version {}. migration status: {}, migration message: {}, execution time: {}", migration.getClass().getName(), migration.getVersion().toString(), migrationResult.getMigrationStatus().name(), migrationResult.getMsg(), executionTime); return createMigrationTask(migration, migrationResult, executionTime); } - private MigrationExecutionResult createMigrationTask(Migration migration, MigrationResult migrationResult, double totalTimeSeconds) { + private MigrationExecutionResult createMigrationTask(IMigrationStage migration, MigrationResult migrationResult, double totalTimeSeconds) { MigrationExecutionResult migrationExecutionResult = new MigrationExecutionResult(); migrationExecutionResult.setExecutionTime(totalTimeSeconds); migrationExecutionResult.setMigrationStatus(migrationResult.getMigrationStatus()); @@ -0,0 +1,20 @@ +package org.openecomp.sdc.asdctool.migration.core.task; + +import org.openecomp.sdc.asdctool.migration.core.DBVersion; + +public interface IMigrationStage { + + String description(); + + DBVersion getVersion(); + + MigrationResult migrate(); + + AspectMigrationEnum getAspectMigration(); + + public enum AspectMigrationEnum { + BEFORE_MIGRATION, + MIGRATION, + AFTER_MIGRATION; + } +} @@ -1,14 +1,10 @@ package org.openecomp.sdc.asdctool.migration.core.task; - -import org.openecomp.sdc.asdctool.migration.core.DBVersion; - -public interface Migration { - - String description(); - - DBVersion getVersion(); - - MigrationResult migrate(); +public interface Migration extends IMigrationStage{ + @Override + default + AspectMigrationEnum getAspectMigration(){ + return AspectMigrationEnum.MIGRATION; + } } @@ -0,0 +1,19 @@ +package org.openecomp.sdc.asdctool.migration.core.task; + +import org.openecomp.sdc.asdctool.migration.core.DBVersion; + +public interface PostMigration extends IMigrationStage { + + @Override + default + public DBVersion getVersion() { + return DBVersion.CURRENT_VERSION; + } + + @Override + default + AspectMigrationEnum getAspectMigration(){ + return AspectMigrationEnum.AFTER_MIGRATION; + } + +} @@ -1,11 +1,9 @@ package org.openecomp.sdc.asdctool.migration.dao; -import com.datastax.driver.core.ResultSet; -import com.datastax.driver.core.Row; -import com.datastax.driver.core.Session; -import com.datastax.driver.mapping.Mapper; -import com.datastax.driver.mapping.MappingManager; -import fj.data.Either; +import java.math.BigInteger; + +import javax.annotation.PostConstruct; + import org.apache.commons.lang3.tuple.ImmutablePair; import org.openecomp.sdc.be.dao.cassandra.CassandraDao; import org.openecomp.sdc.be.dao.cassandra.CassandraOperationStatus; @@ -13,10 +11,14 @@ import org.openecomp.sdc.be.resources.data.MigrationTaskEntry; import org.openecomp.sdc.be.resources.data.auditing.AuditingTypesConstants; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Component; -import javax.annotation.PostConstruct; -import java.math.BigInteger; +import com.datastax.driver.core.ResultSet; +import com.datastax.driver.core.Row; +import com.datastax.driver.core.Session; +import com.datastax.driver.mapping.Mapper; +import com.datastax.driver.mapping.MappingManager; + +import fj.data.Either; public class MigrationTasksDao extends CassandraDao { @@ -7,12 +7,9 @@ import org.apache.commons.cli.HelpFormatter; import org.apache.commons.cli.Option; import org.apache.commons.cli.Options; import org.apache.commons.cli.ParseException; +import org.openecomp.sdc.asdctool.configuration.ConfigurationUploader; import org.openecomp.sdc.asdctool.migration.config.MigrationSpringConfig; import org.openecomp.sdc.asdctool.migration.core.SdcMigrationTool; -import org.openecomp.sdc.be.config.ConfigurationManager; -import org.openecomp.sdc.common.api.ConfigurationSource; -import org.openecomp.sdc.common.impl.ExternalConfiguration; -import org.openecomp.sdc.common.impl.FSConfigurationSource; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.context.annotation.AnnotationConfigApplicationContext; @@ -25,7 +22,7 @@ public class MigrationMenu { CommandLine commandLine = initCmdLineOptions(args); String appConfigDir = commandLine.getOptionValue("c"); boolean enforceAll = commandLine.hasOption("e"); - uploadConfiguration(appConfigDir); + ConfigurationUploader.uploadConfigurationFiles(appConfigDir); AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(MigrationSpringConfig.class); doMigrate(enforceAll, context); @@ -91,10 +88,4 @@ public class MigrationMenu { .build(); } - private static void uploadConfiguration(String appConfigDir) { - ConfigurationSource configurationSource = new FSConfigurationSource(ExternalConfiguration.getChangeListener(), appConfigDir); - ConfigurationManager configurationManager = new ConfigurationManager(configurationSource); - } - - } @@ -1,16 +1,16 @@ package org.openecomp.sdc.asdctool.migration.resolver; -import org.openecomp.sdc.asdctool.migration.core.task.Migration; - import java.util.List; +import org.openecomp.sdc.asdctool.migration.core.task.IMigrationStage; + public interface MigrationResolver { /** * * @return a list of {@code T} */ - List<Migration> resolveMigrations(); + List<IMigrationStage> resolveMigrations(); } @@ -1,38 +1,49 @@ package org.openecomp.sdc.asdctool.migration.resolver; -import org.openecomp.sdc.asdctool.migration.core.DBVersion; -import org.openecomp.sdc.asdctool.migration.core.task.Migration; -import org.openecomp.sdc.asdctool.migration.service.SdcRepoService; - import java.util.ArrayList; import java.util.Comparator; import java.util.List; import java.util.stream.Collectors; +import org.openecomp.sdc.asdctool.migration.core.DBVersion; +import org.openecomp.sdc.asdctool.migration.core.task.IMigrationStage; +import org.openecomp.sdc.asdctool.migration.core.task.Migration; +import org.openecomp.sdc.asdctool.migration.core.task.PostMigration; +import org.openecomp.sdc.asdctool.migration.service.SdcRepoService; + public class SpringBeansMigrationResolver implements MigrationResolver { private List<Migration> migrations = new ArrayList<>(); - + private List<PostMigration> postMigrations = new ArrayList<>(); + private SdcRepoService sdcRepoService; - public SpringBeansMigrationResolver(List<Migration> migrations, SdcRepoService sdcRepoService) { + public SpringBeansMigrationResolver(List<Migration> migrations, List<PostMigration> postMigrations, SdcRepoService sdcRepoService) { this.migrations = migrations; + this.postMigrations = postMigrations; this.sdcRepoService = sdcRepoService; } @Override - public List<Migration> resolveMigrations() { + public List<IMigrationStage> resolveMigrations() { migrations.sort(Comparator.comparing(Migration::getVersion)); - return resolveNonExecutedMigrations(); + List<IMigrationStage> allTasks = resolveNonExecutedMigrations(); + allTasks.addAll(postMigrations); + return allTasks; } //package private for testing void setMigrations(List<Migration> migrations) { this.migrations = migrations; } + + //package private for testing + void setPostMigrations(List<PostMigration> postMigrations) { + this.postMigrations = postMigrations; + } - private List<Migration> resolveNonExecutedMigrations() { + private List<IMigrationStage> resolveNonExecutedMigrations() { DBVersion latestDBVersion = sdcRepoService.getLatestDBVersion(); return migrations.stream() .filter(mig -> isMigrationVersionGreaterThanLatestVersion(latestDBVersion, mig)) @@ -1,11 +1,11 @@ package org.openecomp.sdc.asdctool.migration.service; +import java.math.BigInteger; + import org.openecomp.sdc.asdctool.migration.core.DBVersion; import org.openecomp.sdc.asdctool.migration.dao.MigrationTasksDao; import org.openecomp.sdc.be.resources.data.MigrationTaskEntry; -import java.math.BigInteger; - public class SdcRepoService { private MigrationTasksDao migrationTasksDao; @@ -0,0 +1,9 @@ +package org.openecomp.sdc.asdctool.migration.tasks.handlers; + +public interface OutputHandler { + + public void initiate(Object... title); + public void addRecord(Object... record); + public boolean writeOutput(); + +} @@ -0,0 +1,66 @@ +package org.openecomp.sdc.asdctool.migration.tasks.handlers; + +import java.io.FileOutputStream; +import java.text.DateFormat; +import java.text.SimpleDateFormat; + +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.ss.usermodel.Cell; +import org.apache.poi.ss.usermodel.Row; +import org.apache.poi.ss.usermodel.Sheet; +import org.apache.poi.ss.usermodel.Workbook; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class XlsOutputHandler implements OutputHandler { + + private final static Logger LOGGER = LoggerFactory.getLogger(XlsOutputHandler.class); + + private Workbook workbook; + private Sheet activeSheet; + private Row currentRow; + int rowCount = 0; + + public XlsOutputHandler(Object... title){ + initiate(title); + } + + @Override + public void initiate(Object... title) { + LOGGER.info("Starting to initiate xls output handler. "); + workbook = new HSSFWorkbook(); + activeSheet = workbook.createSheet("Upgrade Migration 1710.0 results"); + addRecord(title); + LOGGER.info("Xls output handler has been initiated. "); + } + + @Override + public void addRecord(Object... record) { + LOGGER.debug("Going to add record {} to output. ", record); + currentRow = activeSheet.createRow(rowCount++); + LOGGER.debug("A new row has been created"); + int columnCount = 0; + Cell cell; + for(Object cellValue : record){ + cell = currentRow.createCell(columnCount++); + if(cellValue != null) + cell.setCellValue(cellValue.toString()); + } + } + + @Override + public boolean writeOutput() { + try { + DateFormat df = new SimpleDateFormat("yyyyMMdd_HHmmss"); + String fileName = "UpgradeMigration1710Results_" + df.format(System.currentTimeMillis()) + ".xls"; + LOGGER.info("Going to write xls output file {}. ", fileName); + workbook.write(new FileOutputStream(fileName)); + return true; + } catch (Exception e) { + LOGGER.error("Failed to write an output file upon Upgrade migration 1710. Exception {} occured. ", e.getMessage()); + e.printStackTrace(); + return false; + } + } + +} @@ -0,0 +1,739 @@ +package org.openecomp.sdc.asdctool.migration.tasks.mig1710; + +import java.util.ArrayList; +import java.util.EnumMap; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.stream.Collectors; + +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import org.openecomp.sdc.asdctool.migration.core.task.MigrationResult; +import org.openecomp.sdc.asdctool.migration.core.task.PostMigration; +import org.openecomp.sdc.asdctool.migration.tasks.handlers.XlsOutputHandler; +import org.openecomp.sdc.be.components.impl.ResourceBusinessLogic; +import org.openecomp.sdc.be.components.impl.ServiceComponentInstanceBusinessLogic; +import org.openecomp.sdc.be.components.lifecycle.LifecycleBusinessLogic; +import org.openecomp.sdc.be.components.lifecycle.LifecycleChangeInfoWithAction; +import org.openecomp.sdc.be.components.lifecycle.LifecycleChangeInfoWithAction.LifecycleChanceActionEnum; +import org.openecomp.sdc.be.config.ConfigurationManager; +import org.openecomp.sdc.be.dao.api.ActionStatus; +import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; +import org.openecomp.sdc.be.dao.jsongraph.TitanDao; +import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum; +import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum; +import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum; +import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; +import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; +import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum; +import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; +import org.openecomp.sdc.be.datatypes.enums.OriginTypeEnum; +import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; +import org.openecomp.sdc.be.impl.ComponentsUtils; +import org.openecomp.sdc.be.model.ComponentInstance; +import org.openecomp.sdc.be.model.LifeCycleTransitionEnum; +import org.openecomp.sdc.be.model.LifecycleStateEnum; +import org.openecomp.sdc.be.model.Resource; +import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.jsontitan.utils.ModelConverter; +import org.openecomp.sdc.be.model.operations.api.IUserAdminOperation; +import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; +import org.openecomp.sdc.be.model.operations.impl.CsarOperation; +import org.openecomp.sdc.be.model.operations.impl.DaoStatusConverter; +import org.openecomp.sdc.exception.ResponseFormat; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import fj.data.Either; + +@Component +public class UpgradeMigration1710 implements PostMigration { + + private static final String UNKNOWN = "UNKNOWN"; + + private static final String CHECKOUT_MESSAGE = "checkout upon upgrade migration"; + + private static final String FAILED_TO_CHANGE_STATE_OF_COMPONENT = "Failed to change state of component with name {}, invariantUUID {}, version {} to {}. "; + + private static final String FAILED_TO_UPGRADE_COMPONENT = "Failed to upgrade {} with name {}, invariantUUID {}, version {}. Operation {}. The reason for failure: {}. "; + + private static final String UPGRADE_COMPONENT_SUCCEEDED = "Upgrade of {} with name {}, invariantUUID {}, version {} finished successfully. "; + + private static final String UPGRADE_VFS_FAILED = "Upgrade VFs upon upgrade migration 1710 process failed. "; + + private static final Logger LOGGER = LoggerFactory.getLogger(UpgradeMigration1710.class); + + @Autowired + private TitanDao titanDao; + + @Autowired + private ToscaOperationFacade toscaOperationFacade; + + @Autowired + private LifecycleBusinessLogic lifecycleBusinessLogic; + + @Autowired + private IUserAdminOperation userAdminOperation; + + @Autowired + private ResourceBusinessLogic resourceBusinessLogic; + + @Autowired + private CsarOperation csarOperation; + + @Autowired + private ServiceComponentInstanceBusinessLogic componentInstanceBusinessLogic; + + @Autowired + private ComponentsUtils componentsUtils; + + private final XlsOutputHandler outputHandler = new XlsOutputHandler("COMPONENT TYPE", "COMPONENT NAME", "COMPONENT UUID", "COMPONENT UNIQUE_ID", "UPGRADE STATUS", "DESCRIPTION"); + + private User user = null; + + private final LifecycleChangeInfoWithAction changeInfo = new LifecycleChangeInfoWithAction(CHECKOUT_MESSAGE, LifecycleChanceActionEnum.UPGRADE_MIGRATION); + + private final Map<String,GraphVertex> latestGenericTypes = new HashMap<>(); + + private boolean isVfcUpgradeRequired = false; + + private boolean skipIfUpgradeVfFailed = true; + + /** below methods is defined on package level for testing + * where Spring object injection is not used **/ + void setUserAdminOperation(IUserAdminOperation userAdminOperation) { this.userAdminOperation = userAdminOperation; } + + void setTitanDao(TitanDao titanDao) { this.titanDao = titanDao; } + + void setTosckaOperationFacade(ToscaOperationFacade toscaOperationFacade) { this.toscaOperationFacade = toscaOperationFacade; } + + void setLifecycleBusinessLogic(LifecycleBusinessLogic lifecycleBusinessLogic) { this.lifecycleBusinessLogic = lifecycleBusinessLogic; } + + void setComponentsUtils(ComponentsUtils componentsUtils) { this.componentsUtils = componentsUtils; } + + + /***********************************************/ + + @Override + public String description() { + return "Upgrade migration 1710 - post migration task, which is dedicated to upgrade all latest certified (and not checked out) Node types, VFs and Services. "; + } + + private enum UpgradeStatus{ + UPGRADED, + NOT_UPGRADED + } + + @Override + public MigrationResult migrate() { + LOGGER.info("Starting upgrade migration 1710 process. "); + MigrationResult migrationResult = new MigrationResult(); + + try{ + boolean result = true; + + isVfcUpgradeRequired = !ConfigurationManager.getConfigurationManager().getConfiguration().getSkipUpgradeVSPsFlag(); + skipIfUpgradeVfFailed = ConfigurationManager.getConfigurationManager().getConfiguration().getSkipUpgradeFailedVfs(); + final String userId = ConfigurationManager.getConfigurationManager().getConfiguration().getAutoHealingOwner(); + + Either<User, ActionStatus> userReq = userAdminOperation.getUserData(userId, false); + if (userReq.isRight()) { + result = false; + LOGGER.error("Upgrade migration was failed. User {} resolve failed: {} ", userId, userReq.right().value()); + } + else { + user = userReq.left().value(); + LOGGER.info("User {} will perform upgrade operation", user.toString()); + } + + if(result){ + result = upgradeNodeTypes(); + } + if(result){ + result = upgradeVFs(); + } + if(result){ + upgradeServices(); + } + if(result){ + LOGGER.info("Upgrade migration 1710 has been successfully finished. "); + titanDao.commit(); + migrationResult.setMigrationStatus(MigrationResult.MigrationStatus.COMPLETED); + } else { + LOGGER.info("Upgrade migration 1710 was failed. "); + titanDao.rollback(); + migrationResult.setMigrationStatus(MigrationResult.MigrationStatus.FAILED); + } + } catch(Exception e){ + LOGGER.error("Upgrade migration 1710 was failed. ", e); + titanDao.rollback(); + migrationResult.setMigrationStatus(MigrationResult.MigrationStatus.FAILED); + } finally { + outputHandler.writeOutput(); + } + return migrationResult; + } + + private StorageOperationStatus upgradeServices() { + LOGGER.info("Starting upgrade services upon upgrade migration 1710 process. "); + Map<String, String> latestOriginResourceVersions = new HashMap<>(); + Either<List<String>, TitanOperationStatus> getServicesRes = getAllLatestCertifiedComponentUids(VertexTypeEnum.TOPOLOGY_TEMPLATE, ComponentTypeEnum.SERVICE); + if(getServicesRes.isRight()){ + return StorageOperationStatus.GENERAL_ERROR; + } + for(String currUid : getServicesRes.left().value()){ + try{ + if(handleService(currUid, latestOriginResourceVersions)){ + titanDao.commit(); + } else { + processComponentUpgradeFailure(ComponentTypeEnum.SERVICE.name(), currUid, ""); + } + } catch(Exception e){ + processComponentUpgradeFailure(ComponentTypeEnum.SERVICE.name(), currUid, e.getMessage()); + } + } + return StorageOperationStatus.OK; + } + + private void processComponentUpgradeFailure(final String name, final String currUid, final String reason) { + LOGGER.error("Failed to upgrade {} with uniqueId {} due to a reason {}. ", name, currUid, reason); + titanDao.rollback(); + } + + private boolean handleService(String uniqueId, Map<String, String> latestOriginResourceVersions) { + LOGGER.info("Starting upgrade Service with uniqueId {} upon upgrade migration 1710 process. ", uniqueId); + Either<org.openecomp.sdc.be.model.Component, StorageOperationStatus> getServiceRes = toscaOperationFacade.getToscaElement(uniqueId); + if(getServiceRes.isRight()){ + LOGGER.error("Failed to upgrade service with uniqueId {} due to {}. ", uniqueId, getServiceRes.right().value()); + outputHandler.addRecord(ComponentTypeEnum.SERVICE.name(), UNKNOWN, UNKNOWN, uniqueId, MigrationResult.MigrationStatus.FAILED.name(), getServiceRes.right().value()); + return false; + } + String derivedFromGenericType = getServiceRes.left().value().getDerivedFromGenericType(); + LOGGER.debug("derivedFromGenericType: {}", derivedFromGenericType ); + if (derivedFromGenericType == null) { + //malformed field value, upgrade required + return upgradeService(getServiceRes.left().value()); + } + if(!latestGenericTypes.containsKey(derivedFromGenericType)){ + Either<List<GraphVertex>, TitanOperationStatus> getDerivedRes = findDerivedResources(derivedFromGenericType); + if(getDerivedRes.isRight()){ + LOGGER.error(FAILED_TO_UPGRADE_COMPONENT, getServiceRes.left().value().getComponentType().getValue(), getServiceRes.left().value().getName(), getServiceRes.left().value().getInvariantUUID(), getServiceRes.left().value().getVersion(), "findDerivedResources", getDerivedRes.right().value()); + outputHandler.addRecord( getServiceRes.left().value().getComponentType().name(),getServiceRes.left().value().getName(), getServiceRes.left().value().getInvariantUUID(), getServiceRes.left().value().getUniqueId(), MigrationResult.MigrationStatus.FAILED.name(), getDerivedRes.right().value()); + return false; + } + latestGenericTypes.put(derivedFromGenericType, getDerivedRes.left().value().get(0)); + } + if(latestVersionExists(latestGenericTypes.get(derivedFromGenericType), getServiceRes.left().value().getDerivedFromGenericVersion())){ + return upgradeService(getServiceRes.left().value()); + } + if(!collectLatestOriginResourceVersions(getServiceRes.left().value(), latestOriginResourceVersions)){ + return false; + } + if(shouldUpgrade(getServiceRes.left().value(), latestOriginResourceVersions)){ + return upgradeService(getServiceRes.left().value()); + } + outputHandler.addRecord(getServiceRes.left().value().getComponentType().name(), getServiceRes.left().value().getName(), getServiceRes.left().value().getInvariantUUID(), getServiceRes.left().value().getUniqueId(), MigrationResult.MigrationStatus.COMPLETED.name(), UpgradeStatus.NOT_UPGRADED); + return true; + } + + private boolean collectLatestOriginResourceVersions(org.openecomp.sdc.be.model.Component component, Map<String, String> latestOriginResourceVersions) { + if(CollectionUtils.isNotEmpty(component.getComponentInstances())){ + for(ComponentInstance instance : component.getComponentInstances()){ + if(instance.getOriginType() != OriginTypeEnum.ServiceProxy && !latestOriginResourceVersions.containsKey(instance.getToscaComponentName())){ + VertexTypeEnum vertexType = ModelConverter.getVertexType(instance.getOriginType().name()); + Either<Resource, StorageOperationStatus> getOriginRes = toscaOperationFacade.getLatestCertifiedByToscaResourceName(instance.getToscaComponentName(), vertexType, JsonParseFlagEnum.ParseMetadata); + if(getOriginRes.isRight()){ + LOGGER.error(FAILED_TO_UPGRADE_COMPONENT, component.getComponentType().getValue(), component.getName(), component.getInvariantUUID(), component.getVersion(), "toscaOperationFacade.getLatestCertifiedByToscaResourceName", getOriginRes.right().value()); + outputHandler.addRecord( component.getComponentType().name(), component.getName(), component.getInvariantUUID(), component.getUniqueId(), MigrationResult.MigrationStatus.FAILED.name(), getOriginRes.right().value()); + return false; + } + latestOriginResourceVersions.put(instance.getToscaComponentName(), getOriginRes.left().value().getVersion()); + } + } + } + return true; + } + + private boolean shouldUpgrade(org.openecomp.sdc.be.model.Component component, Map<String, String> latestOriginResources) { + boolean shouldUpgrade = false; + if(CollectionUtils.isNotEmpty(component.getComponentInstances())){ + for(ComponentInstance instance : component.getComponentInstances()){ + if(instance.getOriginType() == OriginTypeEnum.ServiceProxy){ + LOGGER.info("The service with name {}, invariantUUID {}, version {}, contains Service proxy instance {}, than the service should be upgraded. ", component.getName(), component.getInvariantUUID(), component.getVersion(), instance.getName()); + shouldUpgrade = true; + } + if(isGreater(latestOriginResources.get(instance.getToscaComponentName()), instance.getComponentVersion())){ + LOGGER.info("The service with name {}, invariantUUID {}, version {}, contains instance {} from outdated version of origin {} {} , than the service should be upgraded. ", component.getName(), component.getInvariantUUID(), component.getVersion(), instance.getName(), instance.getComponentName(), instance.getComponentVersion()); + shouldUpgrade = true; + } + } + } + return shouldUpgrade; + } + + private boolean upgradeService(org.openecomp.sdc.be.model.Component service) { + String serviceName = service.getName(); + String serviceUuid = service.getUUID(); + LOGGER.info("Starting upgrade Service with name {}, invariantUUID {}, version {} upon upgrade migration 1710 process. ", serviceName, service.getInvariantUUID(), service.getVersion()); + LOGGER.info("Starting to perform check out of service {}. ", serviceName); + Either<? extends org.openecomp.sdc.be.model.Component, ResponseFormat> checkouRes = lifecycleBusinessLogic.changeComponentState(service.getComponentType(), service.getUniqueId(), user, LifeCycleTransitionEnum.CHECKOUT, changeInfo, true, false); + if(checkouRes.isRight()){ + LOGGER.error(FAILED_TO_UPGRADE_COMPONENT, service.getComponentType().getValue(), serviceName, service.getInvariantUUID(), service.getVersion(), "lifecycleBusinessLogic.changeComponentState", checkouRes.right().value().getFormattedMessage()); + outputHandler.addRecord(service.getComponentType().name(), serviceName, serviceUuid, service.getUniqueId(), MigrationResult.MigrationStatus.FAILED.name(), checkouRes.right().value().getFormattedMessage()); + return false; + } + Either<org.openecomp.sdc.be.model.Component, ResponseFormat> updateCompositionRes = updateComposition(checkouRes.left().value()); + if(updateCompositionRes.isRight()){ + LOGGER.error(FAILED_TO_UPGRADE_COMPONENT, service.getComponentType().getValue(), serviceName, service.getInvariantUUID(), service.getVersion(), "updateComposition", updateCompositionRes.right().value().getFormattedMessage()); + outputHandler.addRecord(checkouRes.left().value().getComponentType().name(), checkouRes.left().value().getName(), checkouRes.left().value().getUUID(), checkouRes.left().value().getUniqueId(), MigrationResult.MigrationStatus.FAILED.name(), updateCompositionRes.right().value().getFormattedMessage()); + return false; + } + Either<? extends org.openecomp.sdc.be.model.Component, ResponseFormat> certifyRes = performFullCertification(checkouRes.left().value()); + if(certifyRes.isRight()){ + LOGGER.error(FAILED_TO_UPGRADE_COMPONENT, service.getComponentType().getValue(), serviceName, service.getInvariantUUID(), service.getVersion(), "performFullCertification", certifyRes.right().value().getFormattedMessage()); + outputHandler.addRecord(checkouRes.left().value().getComponentType().name(), checkouRes.left().value().getName(), checkouRes.left().value().getInvariantUUID(), checkouRes.left().value().getUniqueId(), MigrationResult.MigrationStatus.FAILED.name(), certifyRes.right().value().getFormattedMessage()); + return false; + } + outputHandler.addRecord(checkouRes.left().value().getComponentType().name(), checkouRes.left().value().getName(), serviceUuid, checkouRes.left().value().getUniqueId(), MigrationResult.MigrationStatus.COMPLETED.name(), UpgradeStatus.UPGRADED); + return true; + } + + private Either<org.openecomp.sdc.be.model.Component, ResponseFormat> updateComposition(org.openecomp.sdc.be.model.Component component) { + Either<ComponentInstance, ResponseFormat> upgradeInstanceRes; + for(ComponentInstance instance : component.getComponentInstances()){ + upgradeInstanceRes = upgradeInstance(component, instance); + if(upgradeInstanceRes.isRight()) { + LOGGER.error(FAILED_TO_UPGRADE_COMPONENT, component.getComponentType().getValue(), component.getName(), component.getInvariantUUID(), component.getVersion(), "upgradeInstance", upgradeInstanceRes.right().value().getFormattedMessage()); + outputHandler.addRecord(component.getComponentType().name(), component.getName(), component.getUUID(), component.getUniqueId(), MigrationResult.MigrationStatus.FAILED.name(), upgradeInstanceRes.right().value().getFormattedMessage()); + return Either.right(upgradeInstanceRes.right().value()); + } + } + return Either.left(component); + } + + private Either<ComponentInstance, ResponseFormat> upgradeInstance(org.openecomp.sdc.be.model.Component component, ComponentInstance instance) { + LOGGER.info("Starting upgrade {} instance {} upon upgrade migration 1710 process. ", component.getComponentType().getValue(), instance.getName()); + ComponentInstance newComponentInstance = new ComponentInstance(instance); + if(instance.getOriginType() == OriginTypeEnum.ServiceProxy){ + return upgradeServiceProxyInstance(component, instance, newComponentInstance); + } + return upgradeResourceInstance(component, instance, newComponentInstance); + } + + private Either<ComponentInstance, ResponseFormat> upgradeResourceInstance(org.openecomp.sdc.be.model.Component component, + ComponentInstance instance, ComponentInstance newComponentInstance) { + LOGGER.info("Starting upgrade {} instance {} upon upgrade migration 1710 process. ", component.getComponentType().getValue(), instance.getName()); + VertexTypeEnum vertexType = ModelConverter.getVertexType(instance.getOriginType().name()); + Either<Resource, StorageOperationStatus> getOriginRes = toscaOperationFacade.getLatestCertifiedByToscaResourceName(instance.getToscaComponentName(), vertexType, JsonParseFlagEnum.ParseMetadata); + if(getOriginRes.isRight()){ + LOGGER.info("Upgrade of {} instance {} upon upgrade migration 1710 process failed due to a reason {}. ", + component.getComponentType().getValue(), instance.getName(), getOriginRes.right().value()); + return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(getOriginRes.right().value(), instance.getOriginType().getComponentType()))); + } + newComponentInstance.setComponentName(getOriginRes.left().value().getName()); + newComponentInstance.setComponentUid(getOriginRes.left().value().getUniqueId()); + newComponentInstance.setComponentVersion(getOriginRes.left().value().getVersion()); + newComponentInstance.setToscaComponentName(((Resource)getOriginRes.left().value()).getToscaResourceName()); + if(isGreater(getOriginRes.left().value().getVersion(), instance.getComponentVersion())){ + return changeAssetVersion(component, instance, newComponentInstance); + } + + //upgrade nodes contained by CVFC + if(isVfcUpgradeRequired && newComponentInstance.getOriginType() == OriginTypeEnum.CVFC && + !upgradeVf(getOriginRes.left().value().getUniqueId())) { + return Either.right(componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR)); + } + LOGGER.info("Upgrade of {} instance {} upon upgrade migration 1710 process finished successfully. ", + component.getComponentType().getValue(), instance.getName()); + return Either.left(instance); + } + + private Either<ComponentInstance, ResponseFormat> upgradeServiceProxyInstance(org.openecomp.sdc.be.model.Component component, ComponentInstance instance, ComponentInstance newComponentInstance) { + Either<List<GraphVertex>, TitanOperationStatus> getLatestOriginServiceRes = getLatestCertifiedService(instance.getSourceModelInvariant()); + if(getLatestOriginServiceRes.isRight()){ + return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertTitanStatusToStorageStatus(getLatestOriginServiceRes.right().value()), instance.getOriginType().getComponentType()))); + } + newComponentInstance.setComponentVersion((String) getLatestOriginServiceRes.left().value().get(0).getJsonMetadataField(JsonPresentationFields.VERSION)); + newComponentInstance.setSourceModelUid((String) getLatestOriginServiceRes.left().value().get(0).getJsonMetadataField(JsonPresentationFields.UNIQUE_ID)); + newComponentInstance.setSourceModelName((String) getLatestOriginServiceRes.left().value().get(0).getJsonMetadataField(JsonPresentationFields.NAME)); + newComponentInstance.setSourceModelUuid((String) getLatestOriginServiceRes.left().value().get(0).getJsonMetadataField(JsonPresentationFields.UUID)); + return changeAssetVersion(component, instance, newComponentInstance); + } + + private Either<List<GraphVertex>, TitanOperationStatus> getLatestCertifiedService(String invariantUUID) { + + Map<GraphPropertyEnum, Object> propertiesToMatch = new EnumMap<>(GraphPropertyEnum.class); + propertiesToMatch.put(GraphPropertyEnum.COMPONENT_TYPE, ComponentTypeEnum.SERVICE.name()); + propertiesToMatch.put(GraphPropertyEnum.IS_HIGHEST_VERSION, true); + propertiesToMatch.put(GraphPropertyEnum.STATE, LifecycleStateEnum.CERTIFIED.name()); + propertiesToMatch.put(GraphPropertyEnum.INVARIANT_UUID, invariantUUID); + Map<GraphPropertyEnum, Object> propertiesNotToMatch = new EnumMap<>(GraphPropertyEnum.class); + propertiesNotToMatch.put(GraphPropertyEnum.IS_DELETED, true); + return titanDao.getByCriteria(VertexTypeEnum.TOPOLOGY_TEMPLATE, propertiesToMatch, propertiesNotToMatch, JsonParseFlagEnum.ParseMetadata); + } + + private Either<ComponentInstance, ResponseFormat> changeAssetVersion(org.openecomp.sdc.be.model.Component containerComponent, ComponentInstance instance, ComponentInstance newComponentInstance) { + return componentInstanceBusinessLogic.changeComponentInstanceVersion(ComponentTypeEnum.SERVICE_PARAM_NAME, containerComponent.getUniqueId(), instance.getUniqueId(), user.getUserId(), newComponentInstance); + } + + private boolean upgradeNodeTypes() { + LOGGER.info("Starting upgrade node types upon upgrade migration 1710 process. "); + String toscaConformanceLevel = ConfigurationManager.getConfigurationManager().getConfiguration().getToscaConformanceLevel(); + Map<String, List<String>> resourcesForUpgrade = ConfigurationManager.getConfigurationManager().getConfiguration().getResourcesForUpgrade(); + Map<String, org.openecomp.sdc.be.model.Component> upgradedNodeTypesMap = new HashMap<> (); + List<String> nodeTypes; + if(resourcesForUpgrade.containsKey(toscaConformanceLevel)){ + nodeTypes = resourcesForUpgrade.get(toscaConformanceLevel); + if(nodeTypes !=null && !nodeTypes.isEmpty()){ + Either<List<String>, TitanOperationStatus> getRes = getAllLatestCertifiedComponentUids(VertexTypeEnum.NODE_TYPE, ComponentTypeEnum.RESOURCE); + if(getRes.isRight()){ + return false; + } + List<String> allNodeTypes = getRes.left().value(); + + for(String toscaResourceName: nodeTypes){ + Either<List<GraphVertex>, StorageOperationStatus> status = getLatestByName(GraphPropertyEnum.TOSCA_RESOURCE_NAME, toscaResourceName); + if (status.isRight()) { + LOGGER.error("Failed to find node type {} ", toscaResourceName); + return false; + } + List<GraphVertex> vList = status.left().value(); + for (GraphVertex vertex : vList) { + StorageOperationStatus updateRes = upgradeNodeType(vertex, upgradedNodeTypesMap, allNodeTypes, nodeTypes); + if (updateRes != StorageOperationStatus.OK) { + return false; + } + } + } + } + } + return true; + } + + private boolean upgradeVFs() { + LOGGER.info("Starting upgrade VFs upon upgrade migration 1710 process. "); + Either<List<String>, TitanOperationStatus> getVfsRes = getAllLatestCertifiedComponentUids(VertexTypeEnum.TOPOLOGY_TEMPLATE, ComponentTypeEnum.RESOURCE); + if(getVfsRes.isRight()){ + LOGGER.info(UPGRADE_VFS_FAILED); + return false; + } + for (String currUid : getVfsRes.left().value()) { + try { + if (!upgradeVf(currUid)) { + processComponentUpgradeFailure(ComponentTypeEnum.RESOURCE.name(), currUid, ""); + if (!skipIfUpgradeVfFailed) { + LOGGER.info(UPGRADE_VFS_FAILED); + return false; + } + } + titanDao.commit(); + } catch (Exception e) { + processComponentUpgradeFailure(ComponentTypeEnum.RESOURCE.name(), currUid, e.getMessage()); + if (!skipIfUpgradeVfFailed) { + LOGGER.info(UPGRADE_VFS_FAILED); + return false; + } + } + } + LOGGER.info("Upgrade VFs upon upgrade migration 1710 process finished successfully. "); + return true; + } + + private boolean upgradeVf(String uniqueId) { + LOGGER.info("Starting upgrade VF with uniqueId {} upon upgrade migration 1710 process. ", uniqueId); + Either<String, StorageOperationStatus> latestVersionRes; + Either<org.openecomp.sdc.be.model.Component, StorageOperationStatus> getRes = toscaOperationFacade.getToscaElement(uniqueId); + if(getRes.isRight()){ + LOGGER.debug("Failed to fetch VF with uniqueId {} upon upgrade migration 1710 process. ", uniqueId); + outputHandler.addRecord(ComponentTypeEnum.RESOURCE.name(), UNKNOWN, UNKNOWN, uniqueId, MigrationResult.MigrationStatus.FAILED.name(), getRes.right().value()); + return false; + } + if(StringUtils.isNotEmpty(getRes.left().value().getCsarUUID())){ + LOGGER.info("Going to fetch the latest version of VSP with csarUUID {} upon upgrade migration 1710 process. ", getRes.left().value().getCsarUUID()); + latestVersionRes = csarOperation.getCsarLatestVersion(getRes.left().value().getCsarUUID(), user); + if(latestVersionRes.isRight()){ + LOGGER.debug("Failed to fetch the latest version of VSP with csarUUID {} upon upgrade migration 1710 process. ", getRes.left().value().getCsarUUID()); + outputHandler.addRecord(getRes.left().value().getComponentType().name(), getRes.left().value().getName(), getRes.left().value().getUUID(), getRes.left().value().getUniqueId(), MigrationResult.MigrationStatus.FAILED.name(),latestVersionRes.right().value()); + return false; + } + if(isGreater(latestVersionRes.left().value(), getRes.left().value().getCsarVersion())){ + return upgradeVfWithLatestVsp(getRes.left().value(), latestVersionRes); + } + if (!isVfcUpgradeRequired){ + LOGGER.warn("Warning: No need to upgrade VF with name {}, invariantUUID {}, version {} and VSP version {}. No new version of VSP. ", getRes.left().value().getName(), getRes.left().value().getInvariantUUID(), getRes.left().value().getVersion(), getRes.left().value().getCsarVersion()); + } + } + return upgradeComponentWithLatestGeneric(getRes.left().value()); + } + + private boolean upgradeVfWithLatestVsp(org.openecomp.sdc.be.model.Component vf, Either<String, StorageOperationStatus> latestVersionRes) { + LOGGER.info("Starting upgrade vf with name {}, invariantUUID {}, version {} and latest VSP version {} upon upgrade migration 1710 process. ", vf.getName(), vf.getInvariantUUID(), vf.getVersion(), latestVersionRes.left().value()); + LOGGER.info("Starting to perform check out of vf with name {}, invariantUUID {}, version {}. ", vf.getName(),vf.getInvariantUUID(), vf.getVersion()); + Either<? extends org.openecomp.sdc.be.model.Component, ResponseFormat> checkouRes = lifecycleBusinessLogic.changeComponentState(vf.getComponentType(), vf.getUniqueId(), user, LifeCycleTransitionEnum.CHECKOUT, changeInfo, true, false); + if(checkouRes.isRight()){ + outputHandler.addRecord(vf.getComponentType().name(), vf.getName(), vf.getUUID(), vf.getUniqueId(), MigrationResult.MigrationStatus.FAILED.name(), checkouRes.right().value().getFormattedMessage()); + return false; + } + LOGGER.info("Starting update vf with name {}, invariantUUID {}, version {} and latest VSP {}. ", vf.getName(), vf.getInvariantUUID(), vf.getVersion(), latestVersionRes.left().value()); + Resource resourceToUpdate = new Resource(((Resource) checkouRes.left().value()).getComponentMetadataDefinition()); + resourceToUpdate.setDerivedFromGenericType(((Resource) checkouRes.left().value()).getDerivedFromGenericType()); + resourceToUpdate.setDerivedFromGenericVersion(((Resource) checkouRes.left().value()).getDerivedFromGenericVersion()); + resourceToUpdate.setCsarVersion(Double.toString(Double.parseDouble(latestVersionRes.left().value()))); + Either<Resource, ResponseFormat> updateResourceFromCsarRes = resourceBusinessLogic.validateAndUpdateResourceFromCsar(resourceToUpdate, user, null, null, resourceToUpdate.getUniqueId()); + if(updateResourceFromCsarRes.isRight()){ + outputHandler.addRecord(resourceToUpdate.getComponentType().name(), resourceToUpdate.getName(), resourceToUpdate.getUUID(), resourceToUpdate.getUniqueId(), MigrationResult.MigrationStatus.FAILED.name(), updateResourceFromCsarRes.right().value().getFormattedMessage()); + LOGGER.info("Failed to update vf with name {}, invariantUUID {}, version {} and latest VSP {}. ", vf.getName(), vf.getInvariantUUID(), vf.getVersion(), latestVersionRes.left().value()); + return false; + } + Either<? extends org.openecomp.sdc.be.model.Component, ResponseFormat> certifyRes = performFullCertification(checkouRes.left().value()); + if(certifyRes.isRight()){ + LOGGER.info(FAILED_TO_CHANGE_STATE_OF_COMPONENT, checkouRes.left().value().getName(), checkouRes.left().value().getInvariantUUID(), checkouRes.left().value().getVersion(), LifeCycleTransitionEnum.CERTIFY); + outputHandler.addRecord(checkouRes.left().value().getComponentType().name(), checkouRes.left().value().getName(), checkouRes.left().value().getInvariantUUID(), checkouRes.left().value().getUniqueId(), MigrationResult.MigrationStatus.FAILED.name(), certifyRes.right().value().getFormattedMessage()); + return false; + } + LOGGER.info("Full certification of vf with name {}, invariantUUID {}, version {} finished . ", vf.getName(), vf.getInvariantUUID(), vf.getVersion(), latestVersionRes.left().value()); + outputHandler.addRecord(certifyRes.left().value().getComponentType().name(), certifyRes.left().value().getName(), certifyRes.left().value().getUUID(), certifyRes.left().value().getUniqueId(), MigrationResult.MigrationStatus.COMPLETED.name(), UpgradeStatus.UPGRADED); + return true; + } + + private boolean upgradeComponentWithLatestGeneric(org.openecomp.sdc.be.model.Component component) { + String derivedFromGenericType = component.getDerivedFromGenericType(); + String derivedFromGenericVersion = component.getDerivedFromGenericVersion(); + org.openecomp.sdc.be.model.Component updatedComponent = component; + if(StringUtils.isNotEmpty(derivedFromGenericType) && !latestGenericTypes.containsKey(derivedFromGenericType)){ + LOGGER.info("Starting upgrade vf with name {}, invariantUUID {}, version {}, latest derived from generic type {}, latest derived from generic version {}. ", component.getName(), component.getInvariantUUID(), component.getVersion(), derivedFromGenericType, derivedFromGenericVersion); + LOGGER.info("Starting to fetch latest generic node type {}. ", derivedFromGenericType); + Either<List<GraphVertex>, TitanOperationStatus> getDerivedRes = findDerivedResources(derivedFromGenericType); + if(getDerivedRes.isRight()){ + outputHandler.addRecord(component.getComponentType().name(), component.getName(), component.getInvariantUUID(), component.getUniqueId(), MigrationResult.MigrationStatus.FAILED.name(), getDerivedRes.right().value()); + LOGGER.info("Failed to upgrade component with name {}, invariantUUID {}, version {} and latest generic. Status is {}. ", component.getName(), component.getInvariantUUID(), component.getVersion(), derivedFromGenericType); + return false; + } + latestGenericTypes.put(derivedFromGenericType, getDerivedRes.left().value().get(0)); + } + if(StringUtils.isEmpty(derivedFromGenericType) || + latestVersionExists(latestGenericTypes.get(derivedFromGenericType), derivedFromGenericVersion) || + isVfcUpgradeRequired){ + if(StringUtils.isNotEmpty(derivedFromGenericType)) + LOGGER.info("Newer version {} of derived from generic type {} exists. ", latestGenericTypes.get(derivedFromGenericType).getJsonMetadataField(JsonPresentationFields.VERSION), derivedFromGenericType); + else + LOGGER.info("The vf resource with name {}, invariantUUID {}, version {}, has an empty derivedFromGenericType field. ", component.getName(), component.getInvariantUUID(), component.getVersion()); + + LOGGER.info("Starting to perform check out of vf with name {}, invariantUUID {}, version {}. ", component.getName(), component.getInvariantUUID(), component.getVersion()); + Either<? extends org.openecomp.sdc.be.model.Component, ResponseFormat> checkouRes = lifecycleBusinessLogic.changeComponentState(component.getComponentType(), component.getUniqueId(), user, LifeCycleTransitionEnum.CHECKOUT, changeInfo, true, false); + if(checkouRes.isRight()){ + LOGGER.info(FAILED_TO_CHANGE_STATE_OF_COMPONENT, component.getName(), component.getInvariantUUID(), component.getVersion(), LifeCycleTransitionEnum.CHECKOUT); + outputHandler.addRecord(component.getComponentType().name(), component.getName(), component.getInvariantUUID(), component.getUniqueId(), MigrationResult.MigrationStatus.FAILED.name(), checkouRes.right().value().getFormattedMessage()); + return false; + } + //update included VFCs, if it is required as per configuration + if(isVfcUpgradeRequired && CollectionUtils.isNotEmpty(checkouRes.left().value().getComponentInstances())){ + LOGGER.info("VFC upgrade is required: updating components of vf with name {}, invariantUUID {}, version {}. ", component.getName(), component.getInvariantUUID(), component.getVersion()); + Either<org.openecomp.sdc.be.model.Component, ResponseFormat> updateCompositionRes = + updateComposition(checkouRes.left().value()); + if(updateCompositionRes.isRight()){ + LOGGER.error(FAILED_TO_UPGRADE_COMPONENT, checkouRes.left().value().getComponentType().name(), checkouRes.left().value().getName(), checkouRes.left().value().getInvariantUUID(), checkouRes.left().value().getVersion(), "updateComposition", updateCompositionRes.right().value().getFormattedMessage()); + outputHandler.addRecord(checkouRes.left().value().getComponentType().name(), checkouRes.left().value().getName(), checkouRes.left().value().getUUID(), checkouRes.left().value().getUniqueId(), MigrationResult.MigrationStatus.FAILED.name(), updateCompositionRes.right().value().getFormattedMessage()); + return false; + } + } + Either<? extends org.openecomp.sdc.be.model.Component, ResponseFormat> certifyRes = performFullCertification(checkouRes.left().value()); + if(certifyRes.isRight()){ + LOGGER.info(FAILED_TO_CHANGE_STATE_OF_COMPONENT, component.getName(), component.getInvariantUUID(), component.getVersion(), LifeCycleTransitionEnum.CERTIFY); + outputHandler.addRecord(checkouRes.left().value().getComponentType().name(), checkouRes.left().value().getName(), checkouRes.left().value().getInvariantUUID(), checkouRes.left().value().getUniqueId(), MigrationResult.MigrationStatus.FAILED.name(), certifyRes.right().value().getFormattedMessage()); + return false; + } + updatedComponent = certifyRes.left().value(); + } else { + LOGGER.info("The version {} of derived from generic type {} is up to date. No need to upgrade component with name {}, invariantUUID {} and version {}. ", latestGenericTypes.get(derivedFromGenericType), derivedFromGenericType,component.getName(), component.getInvariantUUID(), component.getVersion()); + } + LOGGER.info(UPGRADE_COMPONENT_SUCCEEDED, component.getComponentType().getValue(), component.getName(), component.getInvariantUUID(), component.getVersion()); + outputHandler.addRecord(updatedComponent.getComponentType().name(), updatedComponent.getName(), updatedComponent.getUUID(), updatedComponent.getUniqueId(), MigrationResult.MigrationStatus.COMPLETED.name(), updatedComponent.equals(component) ? UpgradeStatus.NOT_UPGRADED : UpgradeStatus.UPGRADED); + return true; + } + + private StorageOperationStatus upgradeNodeType(GraphVertex nodeTypeV, Map<String, org.openecomp.sdc.be.model.Component> upgradedNodeTypesMap, List<String> allCertifiedUids, List<String> nodeTypes) { + StorageOperationStatus result = StorageOperationStatus.OK; + LOGGER.info("Starting upgrade node type with name {}, invariantUUID {}, version{}. ", nodeTypeV.getMetadataProperty(GraphPropertyEnum.NAME), nodeTypeV.getMetadataProperty(GraphPropertyEnum.INVARIANT_UUID), nodeTypeV.getMetadataProperty(GraphPropertyEnum.VERSION)); + LOGGER.info("Starting to find derived to for node type with name {}, invariantUUID {}, version{}. ", nodeTypeV.getMetadataProperty(GraphPropertyEnum.NAME), nodeTypeV.getMetadataProperty(GraphPropertyEnum.INVARIANT_UUID), nodeTypeV.getMetadataProperty(GraphPropertyEnum.VERSION)); + Either<List<GraphVertex>, TitanOperationStatus> parentResourceRes = titanDao.getParentVertecies(nodeTypeV, EdgeLabelEnum.DERIVED_FROM, JsonParseFlagEnum.ParseMetadata); + if(parentResourceRes.isRight() && parentResourceRes.right().value() != TitanOperationStatus.NOT_FOUND ){ + return DaoStatusConverter.convertTitanStatusToStorageStatus(parentResourceRes.right().value()); + + } + List<GraphVertex> derivedResourcesUid = new ArrayList<>(); + if(parentResourceRes.isLeft()){ + for(GraphVertex chV: parentResourceRes.left().value()){ + Optional<String> op = allCertifiedUids.stream().filter(id -> id.equals((String)chV.getJsonMetadataField(JsonPresentationFields.UNIQUE_ID))).findAny(); + if(op.isPresent()){ + derivedResourcesUid.add(chV); + } + } + } + String uniqueId = (String)nodeTypeV.getJsonMetadataField(JsonPresentationFields.UNIQUE_ID); + Either<org.openecomp.sdc.be.model.Component, StorageOperationStatus> getRes = toscaOperationFacade.getToscaElement(uniqueId); + if(getRes.isRight()){ + LOGGER.info("failed to fetch element with uniqueId {} ", uniqueId); + return getRes.right().value(); + } + + org.openecomp.sdc.be.model.Resource nt = (Resource)getRes.left().value(); + boolean isNeedToUpgrade = true; + if(upgradedNodeTypesMap.containsKey(nt.getToscaResourceName()) || nodeTypes.stream().filter( p -> p.equals(nt.getToscaResourceName())).findAny().isPresent()){ + isNeedToUpgrade = false; + } + if(isNeedToUpgrade){ + LOGGER.info("Starting to perform check out of node type with name {}, invariantUUID {}, version {}. ", nt.getName(), nt.getInvariantUUID(), nt.getVersion()); + Either<? extends org.openecomp.sdc.be.model.Component, ResponseFormat> checkouRes = lifecycleBusinessLogic.changeComponentState(nt.getComponentType(), nt.getUniqueId(), user, LifeCycleTransitionEnum.CHECKOUT, changeInfo, true, false); + if(checkouRes.isRight()){ + return StorageOperationStatus.GENERAL_ERROR; + } + org.openecomp.sdc.be.model.Component upgradetComp = checkouRes.left().value(); + boolean res = performFullCertification(upgradetComp).isLeft(); + if(!res){ + return StorageOperationStatus.GENERAL_ERROR; + } + upgradedNodeTypesMap.put(nt.getToscaResourceName(), upgradetComp); + titanDao.commit(); + } + for(GraphVertex chV: derivedResourcesUid){ + result = upgradeNodeType(chV, upgradedNodeTypesMap, allCertifiedUids, nodeTypes); + LOGGER.info("Upgrade node type with name {}, invariantUUID {}, version {} has been finished with the status {}", chV.getMetadataProperty(GraphPropertyEnum.NAME), chV.getMetadataProperty(GraphPropertyEnum.INVARIANT_UUID), chV.getMetadataProperty(GraphPropertyEnum.VERSION), result); + } + return result; + } + + private Either<? extends org.openecomp.sdc.be.model.Component, ResponseFormat> performFullCertification(org.openecomp.sdc.be.model.Component component) { + LOGGER.info("Starting to perform full certification of {} with name {}, invariantUUID {}, version {}. ", + component.getComponentType().getValue(), component.getName(), component.getInvariantUUID(), component.getVersion()); + + Either<? extends org.openecomp.sdc.be.model.Component, ResponseFormat> changeStateEither = lifecycleBusinessLogic.changeComponentState(component.getComponentType(), component.getUniqueId(), user, LifeCycleTransitionEnum.CERTIFICATION_REQUEST, changeInfo, true, false); + if(changeStateEither.isRight()){ + LOGGER.info(FAILED_TO_CHANGE_STATE_OF_COMPONENT, component.getName(), component.getInvariantUUID(), component.getVersion(), LifeCycleTransitionEnum.CERTIFICATION_REQUEST); + return changeStateEither; + } + changeStateEither = lifecycleBusinessLogic.changeComponentState(component.getComponentType(), changeStateEither.left().value().getUniqueId(), user, LifeCycleTransitionEnum.START_CERTIFICATION, changeInfo, true, false); + if(changeStateEither.isRight()){ + LOGGER.info(FAILED_TO_CHANGE_STATE_OF_COMPONENT, component.getName(), component.getInvariantUUID(), component.getVersion(), LifeCycleTransitionEnum.START_CERTIFICATION); + return changeStateEither; + } + changeStateEither = lifecycleBusinessLogic.changeComponentState(component.getComponentType(), changeStateEither.left().value().getUniqueId(), user, LifeCycleTransitionEnum.CERTIFY, changeInfo, true, false); + if(changeStateEither.isRight()){ + LOGGER.info(FAILED_TO_CHANGE_STATE_OF_COMPONENT, component.getName(), component.getInvariantUUID(), component.getVersion(), LifeCycleTransitionEnum.CERTIFY); + } + else { + LOGGER.info("Full certification of {} with name {}, invariantUUID {}, version {} finished successfully", + changeStateEither.left().value().getComponentType().getValue(), changeStateEither.left().value().getName(), + changeStateEither.left().value().getInvariantUUID(), changeStateEither.left().value().getVersion()); + } + return changeStateEither; + } + + private Either<List<GraphVertex>, TitanOperationStatus> findDerivedResources(String parentResource) { + Map<GraphPropertyEnum, Object> propertiesToMatch = new EnumMap<>(GraphPropertyEnum.class); + propertiesToMatch.put(GraphPropertyEnum.STATE, LifecycleStateEnum.CERTIFIED.name()); + + propertiesToMatch.put(GraphPropertyEnum.TOSCA_RESOURCE_NAME, parentResource); + propertiesToMatch.put(GraphPropertyEnum.IS_HIGHEST_VERSION, true); + + return titanDao.getByCriteria(VertexTypeEnum.NODE_TYPE, propertiesToMatch, JsonParseFlagEnum.ParseMetadata); + } + + private boolean latestVersionExists(GraphVertex latestDerivedFrom, String currentVersion) { + return isGreater((String)latestDerivedFrom.getJsonMetadataField(JsonPresentationFields.VERSION), currentVersion); + } + + private boolean isGreater(String latestVersion, String currentVersion) { + if(latestVersion != null && currentVersion == null) + return true; + if(latestVersion == null) + return false; + return Double.parseDouble(latestVersion) > Double.parseDouble(currentVersion); + } + + private Either<List<String>, TitanOperationStatus> getAllLatestCertifiedComponentUids(VertexTypeEnum vertexType, ComponentTypeEnum componentType) { + LOGGER.info("Starting to fetch all latest certified not checked out components with type {} upon upgrade migration 1710 process", componentType); + Either<List<String>, TitanOperationStatus> result = null; + Map<String, String> latestCertifiedMap = new HashMap<>(); + Map<String, String> latestNotCertifiedMap = new HashMap<>(); + + Either<List<GraphVertex>, TitanOperationStatus> getComponentsRes = getAllLatestCertifiedComponents(vertexType, componentType); + if(getComponentsRes.isRight() && getComponentsRes.right().value() != TitanOperationStatus.NOT_FOUND){ + LOGGER.error("Failed to fetch all latest certified not checked out components with type {}. Status is {}. ", componentType, getComponentsRes.right().value()); + result = Either.right(getComponentsRes.right().value()); + } + if(getComponentsRes.isRight()){ + result = Either.left(new ArrayList<>()); + } + if(result == null){ + for(GraphVertex component : getComponentsRes.left().value()){ + String invariantUUID = (String)component.getJsonMetadataField(JsonPresentationFields.INVARIANT_UUID); + if(((String)component.getJsonMetadataField(JsonPresentationFields.LIFECYCLE_STATE)).equals(LifecycleStateEnum.CERTIFIED.name())){ + latestCertifiedMap.put(invariantUUID, (String)component.getJsonMetadataField(JsonPresentationFields.UNIQUE_ID)); + } else { + latestNotCertifiedMap.put(invariantUUID, (String)component.getJsonMetadataField(JsonPresentationFields.UNIQUE_ID)); + } + } + result = Either.left(latestCertifiedMap.entrySet().stream().filter(e->!latestNotCertifiedMap.containsKey(e.getKey())).map(e->e.getValue()).collect(Collectors.toList())); + } + return result; + } + + private Either<List<GraphVertex>, TitanOperationStatus> getAllLatestCertifiedComponents(VertexTypeEnum vertexType, ComponentTypeEnum componentType){ + + Map<GraphPropertyEnum, Object> propertiesToMatch = new EnumMap<>(GraphPropertyEnum.class); + propertiesToMatch.put(GraphPropertyEnum.COMPONENT_TYPE, componentType.name()); + propertiesToMatch.put(GraphPropertyEnum.IS_HIGHEST_VERSION, true); + + Map<GraphPropertyEnum, Object> propertiesNotToMatch = new EnumMap<>(GraphPropertyEnum.class); + propertiesNotToMatch.put(GraphPropertyEnum.IS_DELETED, true); + if(vertexType == VertexTypeEnum.TOPOLOGY_TEMPLATE && componentType == ComponentTypeEnum.RESOURCE) + propertiesNotToMatch.put(GraphPropertyEnum.RESOURCE_TYPE, ResourceTypeEnum.CVFC.name()); + return titanDao.getByCriteria(vertexType, propertiesToMatch, propertiesNotToMatch, JsonParseFlagEnum.ParseMetadata); + } + + protected Either<List<String>, TitanOperationStatus> findResourcesPathRecursively(GraphVertex nodeTypeV, List<String> allCertifiedUids) { + Either<List<GraphVertex>, TitanOperationStatus> parentResourceRes = titanDao.getParentVertecies(nodeTypeV, EdgeLabelEnum.DERIVED_FROM, JsonParseFlagEnum.ParseMetadata); + if(parentResourceRes.isRight()){ + return Either.right(parentResourceRes.right().value()); + } + List<GraphVertex> derivedResourcesUid = new ArrayList<>(); + for(GraphVertex chV: parentResourceRes.left().value()){ + Optional<String> op = allCertifiedUids.stream().filter(id -> id.equals((String)chV.getJsonMetadataField(JsonPresentationFields.UNIQUE_ID))).findAny(); + if(op.isPresent()){ + derivedResourcesUid.add(chV); + } + } + return null; + } + + private Either<List<GraphVertex>, StorageOperationStatus> getLatestByName(GraphPropertyEnum property, String nodeName){ + + Map<GraphPropertyEnum, Object> propertiesToMatch = new EnumMap<>(GraphPropertyEnum.class); + Map<GraphPropertyEnum, Object> propertiesNotToMatch = new EnumMap<>(GraphPropertyEnum.class); + + propertiesToMatch.put(property, nodeName); + propertiesNotToMatch.put(GraphPropertyEnum.IS_DELETED, true); + + Either<List<GraphVertex>, TitanOperationStatus> highestResources = titanDao.getByCriteria(null, propertiesToMatch, propertiesNotToMatch, JsonParseFlagEnum.ParseMetadata); + if (highestResources.isRight()) { + TitanOperationStatus status = highestResources.right().value(); + LOGGER.debug("Failed to fetch resource with name {}. Status is {} ", nodeName, status); + return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status)); + } + List<GraphVertex> resources = highestResources.left().value(); + List<GraphVertex> result = new ArrayList<>(); + for(GraphVertex component:resources){ + if(((String)component.getJsonMetadataField(JsonPresentationFields.LIFECYCLE_STATE)).equals(LifecycleStateEnum.CERTIFIED.name())){ + result.add(component); + } + } + return Either.left(result); + } + +} @@ -24,13 +24,11 @@ import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.ByteArrayOutputStream; import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; import java.io.FileReader; import java.io.IOException; import java.io.OutputStream; -import java.util.Properties; import java.util.Map.Entry; +import java.util.Properties; import javax.ws.rs.Consumes; import javax.ws.rs.GET; @@ -0,0 +1,264 @@ +#action widget details +AAI.model-version-id.action=fd7fb09e-d930-41b9-b83f-cfde9df48640 +AAI.model-invariant-id.action=af593b4b-490e-4665-ad74-2f6351c0a7ce +#action-data widget details +AAI.model-invariant-id.action-data=9551346c-7d8b-4daf-9926-b93e96e2344a +AAI.model-version-id.action-data=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd +#allotted-resource widget details +AAI.model-invariant-id.allotted-resource=f6d6a23d-a1a9-48ff-8419-b6530da2d381 +AAI.model-version-id.allotted-resource=7ad0915f-25c0-4a70-b9bc-185a75f87564 +#availability-zone widget details +AAI.model-version-id.availability-zone=6c092fb1-21b2-456b-9e01-67fb4de1896e +AAI.model-invariant-id.availability-zone=61b88c01-d819-41c0-8e21-7fd7ba47148e +#az-and-dvs-switches widget details +AAI.model-version-id.az-and-dvs-switches=b2dea88d-78a0-49bf-95c9-5819df08e966 +AAI.model-invariant-id.az-and-dvs-switches=53dc00d4-e6d9-48ec-b6cc-3d3797e9b896 +#class-of-service widget details +AAI.model-version-id.class-of-service=d2fb27cc-15eb-4c4e-828e-71d41aaecc5b +AAI.model-invariant-id.class-of-service=18094b19-d16d-4822-8acf-e92c6aefa178 +#cloud-region widget details +AAI.model-version-id.cloud-region=2a160989-b202-47dd-874b-4a0f275998f7 +AAI.model-invariant-id.cloud-region=425b2158-e51d-4509-9945-dad4556474a3 +#complex widget details +AAI.model-invariant-id.complex=af91c2f7-35fc-43cf-a13d-443f385b2353 +AAI.model-version-id.complex=3a8ab1ee-9220-4fe8-b89c-9251d160ddc2 +#connector widget details +AAI.model-version-id.connector=22104c9f-29fd-462f-be07-96cd6b46dd33 +AAI.model-invariant-id.connector=4c01c948-7607-4d66-8a6c-99c2c2717936 +#constrained-element-set widget details +AAI.model-invariant-id.constrained-element-set=c0292b4f-ee97-40cc-8c2e-f967c48f5701 +AAI.model-version-id.constrained-element-set=01102126-9c04-4a89-945b-b131e61e95d7 +#ctag-assignment widget details +AAI.model-version-id.ctag-assignment=44e5cb1f-0938-41aa-b766-d4595109fe89 +AAI.model-invariant-id.ctag-assignment=fcb8d46b-b656-4ad6-8fa4-22cef74b443f +#ctag-pool widget details +AAI.model-invariant-id.ctag-pool=46c51d4e-d67e-4a9c-b1f5-49b1e9c6fcaa +AAI.model-version-id.ctag-pool=2056c41f-23b9-4de7-9f50-819adad37d76 +#customer widget details +AAI.model-invariant-id.customer=c1d4305f-cdbd-4bbe-9069-a2f4978fd89e +AAI.model-version-id.customer=d4df5c27-98a1-4812-a8aa-c17f055b7a3f +#cvlan-tag-entry widget details +AAI.model-version-id.cvlan-tag-entry=c3878ffb-8d85-4114-bee6-e4074a9db10b +AAI.model-invariant-id.cvlan-tag-entry=245cf4b0-7cc5-4eea-bbd9-753e939adcab +#dvs-switch widget details +AAI.model-invariant-id.dvs-switch=98fbb471-1f86-428e-bd8a-c8a25de6fa23 +AAI.model-version-id.dvs-switch=4cb44ae8-e3ab-452a-9f95-bcc8a44c55ea +#edge-prop-names widget details +AAI.model-invariant-id.edge-prop-names=7a08cad4-8759-46a5-8245-095d1ba57ac6 +AAI.model-version-id.edge-prop-names=f0442326-8201-4d0e-857c-74b4ddcbfc9f +#element-choice-set widget details +AAI.model-invariant-id.element-choice-set=9a011958-7165-47a3-b872-00951d1f09ae +AAI.model-version-id.element-choice-set=af27fbfd-598d-44da-aeae-0f9d3a5fcd6a +#entitlement widget details +AAI.model-version-id.entitlement=7e27ba2e-b7db-4e13-9fae-d142152ef98a +AAI.model-invariant-id.entitlement=ae75b5a0-d5e1-4f3a-b8fb-37626a753da3 +#flavor widget details +AAI.model-invariant-id.flavor=bace8d1c-a261-4041-9e37-823117415d0f +AAI.model-version-id.flavor=36200fb5-f251-4f5d-a520-7c5ad5c2cd4b +#generic-vnf widget details +AAI.model-version-id.generic-vnf=93a6166f-b3d5-4f06-b4ba-aed48d009ad9 +AAI.model-invariant-id.generic-vnf=acc6edd8-a8d4-4b93-afaa-0994068be14c +#group-assignment widget details +AAI.model-invariant-id.group-assignment=7cc05f25-7ba2-42b7-a237-c5662a1689e1 +AAI.model-version-id.group-assignment=fe578080-ce19-4604-8760-fc264fbb2565 +#image widget details +AAI.model-version-id.image=f6a038c2-820c-42ba-8c2b-375e24e8f932 +AAI.model-invariant-id.image=3f4c7204-739b-4bbb-87a7-8a6856439c90 +#include-node-filter widget details +AAI.model-invariant-id.include-node-filter=2a2d8ad2-af0a-4e1f-9982-0c899e7dc827 +AAI.model-version-id.include-node-filter=f05f804d-7057-4ffe-bdc5-39f2f0c9c9fd +#instance-group widget details +AAI.model-version-id.instance-group=8e6ee9dc-9017-444a-83b3-219edb018128 +AAI.model-invariant-id.instance-group=3bf1e610-45f7-4ad6-b833-ca4c5ee6a3fd +#inventory-item widget details +AAI.model-invariant-id.inventory-item=cd57d844-9017-4078-aa19-926935a3d77c +AAI.model-version-id.inventory-item=69957f4a-2155-4b95-8d72-d6dd9b88b27b +#inventory-item-data widget details +AAI.model-version-id.inventory-item-data=0e54bb87-bd6e-4a2b-ad1c-6d935b87ae51 +AAI.model-invariant-id.inventory-item-data=87a383ae-cf03-432e-a9de-04e6a622d0fd +#ipsec-configuration widget details +AAI.model-invariant-id.ipsec-configuration=aca4c310-cb45-42bd-9f88-73e40ba7b962 +AAI.model-version-id.ipsec-configuration=d949fd10-36bf-408a-ac7a-cad5004d2e0d +#key-data widget details +AAI.model-version-id.key-data=c23ea04d-1a3b-453d-bc49-a6c783a5e92b +AAI.model-invariant-id.key-data=f5faa464-c2f2-4cc3-89d2-a90452dc3a07 +#l3-interface-ipv4-address-list widget details +AAI.model-version-id.l3-interface-ipv4-address-list=41e76b6f-1e06-4fd4-82cd-81c50fc4574b +AAI.model-invariant-id.l3-interface-ipv4-address-list=aad85df2-09be-40fa-b867-16415e4e10e2 +#l3-interface-ipv6-address-list widget details +AAI.model-invariant-id.l3-interface-ipv6-address-list=82966045-43ee-4982-8307-7e9610866140 +AAI.model-version-id.l3-interface-ipv6-address-list=d040621d-541a-477b-bb1b-a2b61b14e295 +#l3-network widget details +AAI.model-version-id.l3-network=9111f20f-e680-4001-b83f-19a2fc23bfc1 +AAI.model-invariant-id.l3-network=3d560d81-57d0-438b-a2a1-5334dba0651a +#lag-interface widget details +AAI.model-version-id.lag-interface=ce95f7c3-b61b-4758-ae9e-7e943b1c103d +AAI.model-invariant-id.lag-interface=e0ee9bde-c1fc-4651-a95d-8e0597bf7d70 +#lag-link widget details +AAI.model-version-id.lag-link=d29a087a-af59-4053-a3f8-0f95a92faa75 +AAI.model-invariant-id.lag-link=86ffe6e5-4d0e-4cec-80b5-5c38aa3eff98 +#license widget details +AAI.model-invariant-id.license=b9a9b337-1f86-42d3-b9f9-f987a089507c +AAI.model-version-id.license=6889274b-a1dc-40ab-9090-93677e13e2e6 +#license-key-resource widget details +AAI.model-invariant-id.license-key-resource=9022ebfe-b54f-4911-a6b2-8c3f5ec189b7 +AAI.model-version-id.license-key-resource=24b25f8c-b8bd-4c62-9421-87c12667aac9 +#l-interface widget details +AAI.model-version-id.l-interface=a32613fd-18b9-459e-aab8-fffb3912966a +AAI.model-invariant-id.l-interface=cea0a982-8d55-4093-921e-418fbccf7060 +#logical-link widget details +AAI.model-version-id.logical-link=a1481a38-f8ba-4ae4-bdf1-06c2c6af4c54 +AAI.model-invariant-id.logical-link=fe012535-2c31-4a39-a739-612374c638a0 +#metadatum widget details +AAI.model-invariant-id.metadatum=86dbb63a-265e-4614-993f-6771c30b56a5 +AAI.model-version-id.metadatum=6bae950e-8939-41d3-a6a7-251b03e4c1fc +#model widget details +AAI.model-invariant-id.model=06d1418a-5faa-452d-a94b-a2829df5f67b +AAI.model-version-id.model=1f51c05c-b164-4c27-9c03-5cbb239fd6be +#model-constraint widget details +AAI.model-invariant-id.model-constraint=c28966f3-e758-4483-b37b-a90b05d3dd33 +AAI.model-version-id.model-constraint=ad70dd19-f156-4fb5-a865-97b5563b0d37 +#model-element widget details +AAI.model-invariant-id.model-element=2076e726-3577-477a-a300-7fa65cd4df11 +AAI.model-version-id.model-element=753e813a-ba9e-4a1d-ab34-b2f6dc6eec0c +#multicast-configuration widget details +AAI.model-invariant-id.multicast-configuration=ea78c9e3-514d-4a0a-9162-13837fa54c35 +AAI.model-version-id.multicast-configuration=666a06ee-4b57-46df-bacf-908da8f10c3f +#named-query widget details +AAI.model-version-id.named-query=5c3b7c33-afa3-4be5-8da7-1a5ac6f99896 +AAI.model-invariant-id.named-query=80b712fd-0ad3-4180-a99c-8c995cf1cc32 +#named-query-element widget details +AAI.model-version-id.named-query-element=204c641a-3494-48c8-979a-86856f5fd32a +AAI.model-invariant-id.named-query-element=3c504d40-b847-424c-9d25-4fb7e0a3e994 +#network-policy widget details +AAI.model-invariant-id.network-policy=6aa05779-94d7-4d8b-9bee-59ef2ab0c246 +AAI.model-version-id.network-policy=a0ccd9dc-7062-4940-9bcc-e91dd28af510 +#network-profile widget details +AAI.model-version-id.network-profile=01f45471-4240-498c-a9e1-235dc0b8b4a6 +AAI.model-invariant-id.network-profile=2734b44a-b8a2-40f6-957d-6256589e5d00 +#newvce widget details +AAI.model-version-id.newvce=7c79e11f-a408-4593-aa86-ba948a1236af +AAI.model-invariant-id.newvce=4b05ec9c-c55d-4987-83ff-e08d6ddb694f +#oam-network widget details +AAI.model-invariant-id.oam-network=2851cf01-9c40-4064-87d4-6184a6fcff35 +AAI.model-version-id.oam-network=f4fb34f3-fd6e-4a8f-a3fb-4ab61a343b79 +#physical-link widget details +AAI.model-invariant-id.physical-link=c822d81f-822f-4304-9623-1025b53da568 +AAI.model-version-id.physical-link=9c523936-95b4-4d7f-9f53-6bdfe0cf2c05 +#p-interface widget details +AAI.model-invariant-id.p-interface=94043c37-4e73-439c-a790-0fdd697924cd +AAI.model-version-id.p-interface=d2cdb2d0-fc1f-4a57-a89e-591b1c4e3754 +#pnf widget details +AAI.model-version-id.pnf=e9f1fa7d-c839-418a-9601-03dc0d2ad687 +AAI.model-invariant-id.pnf=862b25a1-262a-4961-bdaa-cdc55d69785a +#port-group widget details +AAI.model-version-id.port-group=03e8bb6b-b48a-46ae-b5d4-e5af577e6844 +AAI.model-invariant-id.port-group=8ce940fb-55d7-4230-9e7f-a56cc2741f77 +#property-constraint widget details +AAI.model-version-id.property-constraint=81706bbd-981e-4362-ae20-995cbcb2d995 +AAI.model-invariant-id.property-constraint=f4a863c3-6886-470a-a6ae-05723837ea45 +#pserver widget details +AAI.model-invariant-id.pserver=6d932c8f-463b-4e76-83fb-87acfbaa2e2d +AAI.model-version-id.pserver=72f0d495-bc27-4653-9e1a-eef76bd34bc9 +#related-lookup widget details +AAI.model-invariant-id.related-lookup=468f6f5b-2996-41bb-b2a3-7cf9613ebb9b +AAI.model-version-id.related-lookup=0988bab5-bf4f-4938-a419-ab249867d12a +#reserved-prop-names widget details +AAI.model-invariant-id.reserved-prop-names=0c3e0ba3-618c-498d-9127-c8d42b00170f +AAI.model-version-id.reserved-prop-names=ac49d26d-9163-430e-934a-13b738a04f5c +#result-data widget details +AAI.model-version-id.result-data=4e9b50aa-5227-4f6f-b489-62e6bbc03c79 +AAI.model-invariant-id.result-data=ff656f23-6185-406f-9006-4b26834f3e1c +#route-table-reference widget details +AAI.model-version-id.route-table-reference=fed7e326-03a7-45ff-a3f2-471470d268c4 +AAI.model-invariant-id.route-table-reference=a8614b63-2636-4c4f-98df-fd448c4241db +#routing-instance widget details +AAI.model-invariant-id.routing-instance=1c2ded4f-8b01-4193-829c-966847dfec3e +AAI.model-version-id.routing-instance=3ccbcbc7-d19e-44d5-a52f-7e18aa8d69fa +#secondary-filter widget details +AAI.model-version-id.secondary-filter=1380619d-dd1a-4cec-b755-c6407833e065 +AAI.model-invariant-id.secondary-filter=738ff299-6290-4c00-8998-bd0e96a07b93 +#segmentation-assignment widget details +AAI.model-invariant-id.segmentation-assignment=6e814aee-46e1-4583-a9d4-0049bfd2b59b +AAI.model-version-id.segmentation-assignment=c5171ae0-44fb-4c04-b482-d56702241a44 +#service widget details +AAI.model-version-id.service=ecce2c42-3957-4ae0-9442-54bc6afe27b6 +AAI.model-invariant-id.service=07a3a60b-1b6c-4367-8173-8014386f89e3 +#service-capability widget details +AAI.model-invariant-id.service-capability=b1a7cc05-d19d-443b-a5d1-733e325c4232 +AAI.model-version-id.service-capability=f9cfec1b-18da-4bba-bd83-4b26cca115cd +#service-instance widget details +AAI.model-invariant-id.service-instance=82194af1-3c2c-485a-8f44-420e22a9eaa4 +AAI.model-version-id.service-instance=46b92144-923a-4d20-b85a-3cbd847668a9 +#service-subscription widget details +AAI.model-invariant-id.service-subscription=2e1a602a-acd8-4f78-94ff-618b802a303b +AAI.model-version-id.service-subscription=5e68299a-79f2-4bfb-8fbc-2bae877a2459 +#site-pair widget details +AAI.model-version-id.site-pair=7106bc02-6552-4fc3-8a56-4f3df9034531 +AAI.model-invariant-id.site-pair=db63f3e6-f8d1-484e-8d5e-191600b7914b +#site-pair-set widget details +AAI.model-invariant-id.site-pair-set=5d4dae3e-b402-4bfd-909e-ece12ff75d26 +AAI.model-version-id.site-pair-set=a5c6c1bc-dc38-468e-9459-bb08f87247df +#snapshot widget details +AAI.model-version-id.snapshot=962a7c8b-687f-4d32-a775-fe098e214bcd +AAI.model-invariant-id.snapshot=24de00ef-aead-4b52-995b-0adf8d4bd90d +#sriov-vf widget details +AAI.model-version-id.sriov-vf=1e8b331f-3d4a-4160-b7aa-f4d5a8916625 +AAI.model-invariant-id.sriov-vf=04b2935f-33c4-40a9-8af0-8b52690042dc +#start-node-filter widget details +AAI.model-version-id.start-node-filter=aad96fd3-e75f-42fc-9777-3450c36f1168 +AAI.model-invariant-id.start-node-filter=083093a3-e407-447a-ba5d-7583e4d23e1d +#subnet widget details +AAI.model-version-id.subnet=f902a6bc-6be4-4fe5-8458-a6ec0056b374 +AAI.model-invariant-id.subnet=1b2c9ba7-e449-4831-ba15-3073672f5ef2 +#tagged-inventory-item-list widget details +AAI.model-invariant-id.tagged-inventory-item-list=e78a7eaa-f65d-4919-9c2b-5b258c8c4d7e +AAI.model-version-id.tagged-inventory-item-list=c246f6e2-e3a1-4697-94c0-5672a7fbbf04 +#tenant widget details +AAI.model-invariant-id.tenant=97c26c99-6870-44c1-8a07-1d900d3f4ce6 +AAI.model-version-id.tenant=abcc54bc-bb74-49dc-9043-7f7171707545 +#tunnel-xconnect widget details +AAI.model-invariant-id.tunnel-xconnect=50b9e2fa-005c-4bbe-b651-3251dece4cd8 +AAI.model-version-id.tunnel-xconnect=e7cb4ca8-e1a5-4487-a716-4ae0bcd8aef5 +#update-node-key widget details +AAI.model-version-id.update-node-key=6004cfa6-eb6d-4062-971f-b1fde6b74aa0 +AAI.model-invariant-id.update-node-key=fe81c801-f65d-408a-b2b7-a729a18f8154 +#vce widget details +AAI.model-version-id.vce=b6cf54b5-ec45-43e1-be64-97b4e1513333 +AAI.model-invariant-id.vce=bab6dceb-e7e6-4301-a5e0-a7399b48d792 +#vf-module widget details +AAI.model-invariant-id.vf-module=ef86f9c5-2165-44f3-8fc3-96018b609ea5 +AAI.model-version-id.vf-module=c00563ae-812b-4e62-8330-7c4d0f47088a +#vig-server widget details +AAI.model-version-id.vig-server=8e8c22f1-fbdf-48ea-844c-8bdeb44e7b16 +AAI.model-invariant-id.vig-server=bed7c3b7-35d0-4cd9-abde-41b20e68b28e +#virtual-data-center widget details +AAI.model-invariant-id.virtual-data-center=5150abcf-0c5f-4593-9afe-a19c48fc4824 +AAI.model-version-id.virtual-data-center=6dd43ced-d789-47af-a759-d3abc14e3ac1 +#vlan widget details +AAI.model-version-id.vlan=257d88a5-a269-4c35-944f-aca04fbdb791 +AAI.model-invariant-id.vlan=d2b1eaf1-ae59-4116-9ee4-aa0179faa4f8 +#vnfc widget details +AAI.model-invariant-id.vnfc=96129eb9-f0de-4e05-8af2-73146473f766 +AAI.model-version-id.vnfc=5761e0a7-c6df-4d8a-9ebd-b8f445054dec +#vnf-image widget details +AAI.model-invariant-id.vnf-image=f9a628ff-7aa0-40e2-a93d-02d91c950982 +AAI.model-version-id.vnf-image=c4d3e747-ba4a-4b17-9896-94c6f18c19d3 +#volume widget details +AAI.model-version-id.volume=0fbe2e8f-4d91-4415-a772-88387049b38d +AAI.model-invariant-id.volume=ddd739b4-2b25-46c4-affc-41a32af5cc42 +#volume-group widget details +AAI.model-invariant-id.volume-group=fcec1b02-b2d0-4834-aef8-d71be04717dd +AAI.model-version-id.volume-group=99d44c90-1f61-4418-b9a6-56586bf38c79 +#vpe widget details +AAI.model-invariant-id.vpe=053ec3a7-5b72-492d-b54d-123805a9b967 +AAI.model-version-id.vpe=203817d3-829c-42d4-942d-2a935478e993 +#vpls-pe widget details +AAI.model-version-id.vpls-pe=b1566228-6785-4ce1-aea2-053736f80341 +AAI.model-invariant-id.vpls-pe=457ba89b-334c-4fbd-acc4-160ac0e0cdc0 +#vpn-binding widget details +AAI.model-invariant-id.vpn-binding=9e23b675-db2b-488b-b459-57aa9857baa0 +AAI.model-version-id.vpn-binding=21a146e5-9901-448c-9197-723076770119 +#vserver widget details +AAI.model-invariant-id.vserver=ff69d4e0-a8e8-4108-bdb0-dd63217e63c7 +AAI.model-version-id.vserver=8ecb2c5d-7176-4317-a255-26274edfdd53
\ No newline at end of file @@ -5,10 +5,9 @@ identificationHeaderFields: - HTTP_IV_REMOTE_ADDRESS - HTTP_CSP_WSTYPE - - # catalog backend hostname -beFqdn: sdccatalog.att.com +beFqdn: localhost +# sdccatalog.att.com # catalog backend http port beHttpPort: 8080 @@ -24,25 +23,43 @@ beSslPort: 8443 version: 1.0 released: 2012-11-30 -toscaConformanceLevel: 3.0 +toscaConformanceLevel: 5.0 minToscaConformanceLevel: 3.0 -titanCfgFile: src\main\resources\config\titan.properties +# These values are necessary for running upgrade migration 1710.0 process +appVersion: 1.1.0 +artifactGeneratorConfig: Artifact-Generator.properties +resourcesForUpgrade: + 5.0: + - org.openecomp.resource.cp.extCP + - tosca.nodes.network.Network + - tosca.nodes.network.Port + - org.openecomp.resource.cp.nodes.network.SubInterface +skipUpgradeFailedVfs: true +skipUpgradeVSPs: true +autoHealingOwner: jh0003 + +titanCfgFile: C:\Users\im453s\git\sdc\asdctool\src\main\resources\config\titan.properties titanMigrationKeySpaceCfgFile: src\main\resources\config\titan-migration.properties titanInMemoryGraph: false titanLockTimeout: 1800 + +# The interval to try and reconnect to titan DB when it is down during ASDC startup: titanReconnectIntervalInSeconds: 3 + +# The read timeout towards Titan DB when health check is invoked: titanHealthCheckReadTimeout: 1 + +# The interval to try and reconnect to Elasticsearch when it is down during ASDC startup: esReconnectIntervalInSeconds: 3 uebHealthCheckReconnectIntervalInSeconds: 15 uebHealthCheckReadTimeout: 4 - # Protocols protocols: - http - https - + # Default imports defaultImports: - nodes: @@ -62,13 +79,28 @@ defaultImports: users: tom: passwd bob: passwd - + neo4j: host: neo4jhost port: 7474 user: neo4j password: "12345" - + +cassandraConfig: + cassandraHosts: ['localhost'] + localDataCenter: datacenter1 + reconnectTimeout : 30000 + authenticate: false + username: koko + password: bobo + ssl: false + truststorePath : /path/path + truststorePassword : 123123 + keySpaces: + - { name: sdcaudit, replicationStrategy: SimpleStrategy, replicationInfo: ['1']} + - { name: sdcartifact, replicationStrategy: SimpleStrategy, replicationInfo: ['1']} + - { name: sdccomponent, replicationStrategy: SimpleStrategy, replicationInfo: ['1']} + - { name: sdcrepository, replicationStrategy: SimpleStrategy, replicationInfo: ['1']} #Application-specific settings of ES elasticSearch: @@ -86,7 +118,7 @@ elasticSearch: # Legal values for creationPeriod - year, month, day, hour, minute, none (meaning no time-based behaviour). # # If no creationPeriod is configured for indexPrefix, default behavour is creationPeriod: month. - + indicesTimeFrequency: - indexPrefix: auditingevents creationPeriod: month @@ -128,7 +160,9 @@ resourceTypes: &allResourceTypes - VL - VF - VFCMT - + - Abstract + - CVFC + # validForResourceTypes usage # validForResourceTypes: # - VF @@ -146,7 +180,7 @@ deploymentResourceArtifacts: # displayName: "Network HEAT Template" # type: HEAT_NET # validForResourceTypes: *allResourceTypes - + deploymentResourceInstanceArtifacts: heatEnv: displayName: "HEAT ENV" @@ -176,6 +210,8 @@ toscaArtifacts: #Informational artifacts placeHolder excludeResourceCategory: - Generic +excludeResourceType: + - PNF informationalResourceArtifacts: features: displayName: Features @@ -198,7 +234,7 @@ informationalResourceArtifacts: resourceSecurityTemplate: displayName: Resource Security Template type: OTHER - + excludeServiceCategory: informationalServiceArtifacts: @@ -241,7 +277,7 @@ informationalServiceArtifacts: serviceSecurityTemplate: displayName: Service Security Template type: OTHER - + serviceApiArtifacts: configuration: displayName: Configuration @@ -262,7 +298,6 @@ serviceApiArtifacts: displayName: Testing type: OTHER - additionalInformationMaxNumberOfKeys: 50 systemMonitoring: @@ -285,6 +320,10 @@ serviceDeploymentArtifacts: MODEL_QUERY_SPEC: acceptedTypes: - xml + UCPE_LAYER_2_CONFIGURATION: + acceptedTypes: + - xml + #AAI Artifacts AAI_SERVICE_MODEL: acceptedTypes: @@ -309,19 +348,19 @@ resourceDeploymentArtifacts: - yaml - yml validForResourceTypes: *allResourceTypes - HEAT_NESTED: + HEAT_NET: acceptedTypes: - yaml - yml validForResourceTypes: *allResourceTypes - HEAT_ARTIFACT: - acceptedTypes: - validForResourceTypes: *allResourceTypes - HEAT_NET: + HEAT_NESTED: acceptedTypes: - yaml - yml validForResourceTypes: *allResourceTypes + HEAT_ARTIFACT: + acceptedTypes: + validForResourceTypes: *allResourceTypes YANG_XML: acceptedTypes: - xml @@ -346,37 +385,55 @@ resourceDeploymentArtifacts: acceptedTypes: - xml validForResourceTypes: *allResourceTypes - #APPC Artifatcs + LIFECYCLE_OPERATIONS: + acceptedTypes: + - yaml + - yml + validForResourceTypes: + - VF + - VFC + VES_EVENTS: + acceptedTypes: + - yaml + - yml + validForResourceTypes: *allResourceTypes + PERFORMANCE_COUNTER: + acceptedTypes: + - csv + validForResourceTypes: *allResourceTypes APPC_CONFIG: acceptedTypes: validForResourceTypes: - VF - #DCAE Artifacts DCAE_TOSCA: acceptedTypes: - yml - yaml validForResourceTypes: - VF + - VFCMT DCAE_JSON: acceptedTypes: - json validForResourceTypes: - VF + - VFCMT DCAE_POLICY: acceptedTypes: - emf validForResourceTypes: - VF + - VFCMT DCAE_DOC: acceptedTypes: validForResourceTypes: - - VF + - VF + - VFCMT DCAE_EVENT: acceptedTypes: validForResourceTypes: - VF -#AAI Artifacts + - VFCMT AAI_VF_MODEL: acceptedTypes: - xml @@ -390,14 +447,13 @@ resourceDeploymentArtifacts: OTHER: acceptedTypes: validForResourceTypes: *allResourceTypes -#MIB artifacts SNMP_POLL: acceptedTypes: validForResourceTypes: *allResourceTypes SNMP_TRAP: acceptedTypes: validForResourceTypes: *allResourceTypes - + resourceInstanceDeploymentArtifacts: HEAT_ENV: acceptedTypes: @@ -405,7 +461,13 @@ resourceInstanceDeploymentArtifacts: VF_MODULES_METADATA: acceptedTypes: - json -#DCAE_VF Instance Artifacts + VES_EVENTS: + acceptedTypes: + - yaml + - yml + PERFORMANCE_COUNTER: + acceptedTypes: + - csv DCAE_INVENTORY_TOSCA: acceptedTypes: - yml @@ -422,14 +484,12 @@ resourceInstanceDeploymentArtifacts: acceptedTypes: DCAE_INVENTORY_EVENT: acceptedTypes: -#MIB artifacts SNMP_POLL: acceptedTypes: validForResourceTypes: *allResourceTypes SNMP_TRAP: acceptedTypes: validForResourceTypes: *allResourceTypes - resourceInformationalArtifacts: CHEF: @@ -461,7 +521,15 @@ resourceInformationalArtifacts: validForResourceTypes: *allResourceTypes OTHER: acceptedTypes: - validForResourceTypes: *allResourceTypes + validForResourceTypes: + - VFC + - CVFC + - CP + - VL + - VF + - VFCMT + - Abstract + - PNF SNMP_POLL: acceptedTypes: validForResourceTypes: *allResourceTypes @@ -473,15 +541,14 @@ resourceInformationalArtifacts: validForResourceTypes: - VF - VFC - + - CVFC resourceInformationalDeployedArtifacts: - requirementsToFulfillBeforeCert: capabilitiesToConsumeBeforeCert: - + unLoggedUrls: - /sdc2/rest/healthCheck @@ -493,26 +560,19 @@ cleanComponentsConfiguration: artifactsIndex: resources -cassandraConfig: - cassandraHosts: ['localhost'] - localDataCenter: - reconnectTimeout : 30000 - authenticate: true - username: asdc_user - password: Aa1234%^! - ssl: false - truststorePath : /path/path - truststorePassword : 123123 - keySpaces: - - { name: sdcaudit, replicationStrategy: SimpleStrategy, replicationInfo: ['1']} - - { name: sdcartifact, replicationStrategy: SimpleStrategy, replicationInfo: ['1']} - - { name: sdccomponent, replicationStrategy: SimpleStrategy, replicationInfo: ['1']} - - { name: sdcrepository, replicationStrategy: SimpleStrategy, replicationInfo: ['1']} - - +heatEnvArtifactHeader: "" +heatEnvArtifactFooter: "" + +onboarding: + protocol: http + host: localhost + port: 8080 + downloadCsarUri: "/onboarding-api/v1.0/vendor-software-products/packages" + healthCheckUri: "/onboarding-api/v1.0/healthcheck" + switchoverDetector: - gBeFqdn: AIO-BE.ecomp.idns.cip - gFeFqdn: AIO-FE.ecomp.idns.cip + gBeFqdn: AIO-BE.ecomp.idns.cip.com + gFeFqdn: AIO-FE.ecomp.idns.cip.com beVip: 0.0.0.0 feVip: 0.0.0.0 beResolveAttempts: 3 @@ -521,24 +581,14 @@ switchoverDetector: interval: 60 changePriorityUser: ecompasdc changePriorityPassword: ecompasdc123 - publishNetworkUrl: "http://xxxxxx.com/crt/CipDomain.ECOMP-ASDC-DEVST/config/update_network?user=root" + publishNetworkUrl: "http://xxx.com/crt/CipDomain.ECOMP-ASDC-DEVST/config/update_network?user=root" publishNetworkBody: '{"note":"publish network"}' groups: - beSet: { changePriorityUrl: "http://xxxxxxx.com/crt/CipDomain.ECOMP-ASDC-DEVST/config/sites/AIO-BE.ecomp.idns.com?user=root", + beSet: { changePriorityUrl: "http://xxx.com/crt/CipDomain.ECOMP-ASDC-DEVST/config/sites/AIO-BE.ecomp.idns.com?user=root", changePriorityBody: '{"name":"AIO-BE.ecomp.idns.com","uri":"/crt/CipDomain.ECOMP-ASDC-DEVST/config/sites/AIO-BE.ecomp.idns.com","no_ad_redirection":false,"v4groups":{"failover_groups":["/crt/CipDomain.ECOMP-ASDC-DEVST/config/groups/group_mg_be","/crt/CipDomain.ECOMP-ASDC-DEVST/config/groups/group_bs_be"],"failover_policy":["FAILALL"]},"comment":"AIO BE G-fqdn","intended_app_proto":"DNS"}'} - feSet: { changePriorityUrl: "http://cora.web.att.com/crt/CipDomain.ECOMP-ASDC-DEVST/config/sites/AIO-FE.ecomp.idns.cip.att.com?user=root", + feSet: { changePriorityUrl: "http://xxx.com/crt/CipDomain.ECOMP-ASDC-DEVST/config/sites/AIO-FE.ecomp.idns.com?user=root", changePriorityBody: '{"comment":"AIO G-fqdn","name":"AIO-FE.ecomp.idns.com","v4groups":{"failover_groups":["/crt/CipDomain.ECOMP-ASDC-DEVST/config/groups/group_mg_fe","/crt/CipDomain.ECOMP-ASDC-DEVST/config/groups/group_bs_fe"],"failover_policy":["FAILALL"]},"no_ad_redirection":false,"intended_app_proto":"DNS","uri":"/crt/CipDomain.ECOMP-ASDC-DEVST/config/sites/AIO-FE.ecomp.idns.com"}'} - - -heatEnvArtifactHeader: "" -heatEnvArtifactFooter: "" -onboarding: - protocol: http - host: localhost - port: 8080 - downloadCsarUri: "/onboarding-api/v1.0/vendor-software-products/packages" - applicationL1Cache: datatypes: enabled: true @@ -546,9 +596,9 @@ applicationL1Cache: pollIntervalInSec: 60 applicationL2Cache: - enabled: false + enabled: true catalogL1Cache: - enabled: false + enabled: true resourcesSizeInCache: 300 servicesSizeInCache: 200 productsSizeInCache: 100 @@ -558,7 +608,8 @@ applicationL2Cache: numberOfCacheWorkers: 4 toscaValidators: - stringMaxLength: 65536 + stringMaxLength: 2500 + disableAudit: false vfModuleProperties: @@ -574,4 +625,10 @@ vfModuleProperties: vf_module_type: forBaseModule: Base forNonBaseModule: Expansion -
\ No newline at end of file + +genericAssetNodeTypes: + VFC: org.openecomp.resource.abstract.nodes.VFC + CVFC: org.openecomp.resource.abstract.nodes.VFC + VF : org.openecomp.resource.abstract.nodes.VF + PNF: org.openecomp.resource.abstract.nodes.PNF + Service: org.openecomp.resource.abstract.nodes.service
\ No newline at end of file @@ -1,14 +1,15 @@ elasticSearch.local: true elasticSearch.transportclient: false -cluster.name: elasticsearch_1_5_2222 +cluster.name: elasticsearch discovery.zen.ping.multicast.enabled: false discovery.zen.ping.unicast.enabled: true -discovery.zen.ping.unicast.hosts: 1.2.3.4 +discovery.zen.ping.unicast.hosts: elasticsearch_host transport.client.initial_nodes: - - 1.2.3.4:9300 + - elasticsearch_host:9300 +http.cors.enabled: true #plugin.types: "DeleteByQueryPlugin" @@ -1,4 +1,11 @@ storage.backend=cassandra storage.hostname=localhost storage.port=9160 -storage.cassandra.keyspace=titan
\ No newline at end of file + +cache.db-cache = false +cache.db-cache-clean-wait = 20 +cache.db-cache-time = 180000 +cache.db-cache-size = 0.5 + +cache.tx-cache-size = 500000 +storage.cassandra.keyspace=sdctitan @@ -0,0 +1,399 @@ + +cluster.name: elasticsearch + +discovery.zen.ping.multicast.enabled: false +discovery.zen.ping.unicast.enabled: true +discovery.zen.ping.unicast.hosts: elasticsearch_host + +http.cors.enabled: true + +path.home: "/home/vagrant/catalog-be/config" + +elasticSearch.transportclient: true + +transport.client.initial_nodes: + - elasticsearch_host:9300 + +#shield.user: asdc:Aa12345 +#shield.ssl.keystore.path: "/vagrant/install/resources/catalog-be/keystore/es-client.jks" +#shield.ssl.keystore.password: Aa123456 +#shield.transport.ssl: true + +##################### Elasticsearch Configuration Example ##################### + +# This file contains an overview of various configuration settings, +# targeted at operations staff. Application developers should +# consult the guide at <http://elasticsearch.org/guide>. +# +# The installation procedure is covered at +# <http://elasticsearch.org/guide/en/elasticsearch/reference/current/setup.html>. +# +# Elasticsearch comes with reasonable defaults for most settings, +# so you can try it out without bothering with configuration. +# +# Most of the time, these defaults are just fine for running a production +# cluster. If you're fine-tuning your cluster, or wondering about the +# effect of certain configuration option, please _do ask_ on the +# mailing list or IRC channel [http://elasticsearch.org/community]. + +# Any element in the configuration can be replaced with environment variables +# by placing them in ${...} notation. For example: +# +# node.rack: ${RACK_ENV_VAR} + +# For information on supported formats and syntax for the config file, see +# <http://elasticsearch.org/guide/en/elasticsearch/reference/current/setup-configuration.html> + + +################################### Cluster ################################### + +# Cluster name identifies your cluster for auto-discovery. If you're running +# multiple clusters on the same network, make sure you're using unique names. +# +# cluster.name: elasticsearch + + +#################################### Node ##################################### + +# Node names are generated dynamically on startup, so you're relieved +# from configuring them manually. You can tie this node to a specific name: +# +# node.name: "Franz Kafka" + +# Every node can be configured to allow or deny being eligible as the master, +# and to allow or deny to store the data. +# +# Allow this node to be eligible as a master node (enabled by default): +# +# node.master: true +# +# Allow this node to store data (enabled by default): +# +# node.data: true + +# You can exploit these settings to design advanced cluster topologies. +# +# 1. You want this node to never become a master node, only to hold data. +# This will be the "workhorse" of your cluster. +# +# node.master: false +# node.data: true +# +# 2. You want this node to only serve as a master: to not store any data and +# to have free resources. This will be the "coordinator" of your cluster. +# +# node.master: true +# node.data: false +# +# 3. You want this node to be neither master nor data node, but +# to act as a "search load balancer" (fetching data from nodes, +# aggregating results, etc.) +# +# node.master: false +# node.data: false + +# Use the Cluster Health API [http://localhost:9200/_cluster/health], the +# Node Info API [http://localhost:9200/_nodes] or GUI tools +# such as <http://www.elasticsearch.org/overview/marvel/>, +# <http://github.com/karmi/elasticsearch-paramedic>, +# <http://github.com/lukas-vlcek/bigdesk> and +# <http://mobz.github.com/elasticsearch-head> to inspect the cluster state. + +# A node can have generic attributes associated with it, which can later be used +# for customized shard allocation filtering, or allocation awareness. An attribute +# is a simple key value pair, similar to node.key: value, here is an example: +# +# node.rack: rack314 + +# By default, multiple nodes are allowed to start from the same installation location +# to disable it, set the following: +# node.max_local_storage_nodes: 1 + + +#################################### Index #################################### + +# You can set a number of options (such as shard/replica options, mapping +# or analyzer definitions, translog settings, ...) for indices globally, +# in this file. +# +# Note, that it makes more sense to configure index settings specifically for +# a certain index, either when creating it or by using the index templates API. +# +# See <http://elasticsearch.org/guide/en/elasticsearch/reference/current/index-modules.html> and +# <http://elasticsearch.org/guide/en/elasticsearch/reference/current/indices-create-index.html> +# for more information. + +# Set the number of shards (splits) of an index (5 by default): +# +# index.number_of_shards: 5 + +# Set the number of replicas (additional copies) of an index (1 by default): +# +# index.number_of_replicas: 1 + +# Note, that for development on a local machine, with small indices, it usually +# makes sense to "disable" the distributed features: +# +index.number_of_shards: 1 +index.number_of_replicas: 0 + +# These settings directly affect the performance of index and search operations +# in your cluster. Assuming you have enough machines to hold shards and +# replicas, the rule of thumb is: +# +# 1. Having more *shards* enhances the _indexing_ performance and allows to +# _distribute_ a big index across machines. +# 2. Having more *replicas* enhances the _search_ performance and improves the +# cluster _availability_. +# +# The "number_of_shards" is a one-time setting for an index. +# +# The "number_of_replicas" can be increased or decreased anytime, +# by using the Index Update Settings API. +# +# Elasticsearch takes care about load balancing, relocating, gathering the +# results from nodes, etc. Experiment with different settings to fine-tune +# your setup. + +# Use the Index Status API (<http://localhost:9200/A/_status>) to inspect +# the index status. + + +#################################### Paths #################################### + +# Path to directory containing configuration (this file and logging.yml): +# +path.conf: /src/test/resources + +# Path to directory where to store index data allocated for this node. +# +path.data: target/esdata +# +# Can optionally include more than one location, causing data to be striped across +# the locations (a la RAID 0) on a file level, favouring locations with most free +# space on creation. For example: +# +# path.data: /path/to/data1,/path/to/data2 + +# Path to temporary files: +# +path.work: /target/eswork + +# Path to log files: +# +path.logs: /target/eslogs + +# Path to where plugins are installed: +# +# path.plugins: /path/to/plugins + + +#################################### Plugin ################################### + +# If a plugin listed here is not installed for current node, the node will not start. +# +# plugin.mandatory: mapper-attachments,lang-groovy + + +################################### Memory #################################### + +# Elasticsearch performs poorly when JVM starts swapping: you should ensure that +# it _never_ swaps. +# +# Set this property to true to lock the memory: +# +# bootstrap.mlockall: true + +# Make sure that the ES_MIN_MEM and ES_MAX_MEM environment variables are set +# to the same value, and that the machine has enough memory to allocate +# for Elasticsearch, leaving enough memory for the operating system itself. +# +# You should also make sure that the Elasticsearch process is allowed to lock +# the memory, eg. by using `ulimit -l unlimited`. + + +############################## Network And HTTP ############################### + +# Elasticsearch, by default, binds itself to the 0.0.0.0 address, and listens +# on port [9200-9300] for HTTP traffic and on port [9300-9400] for node-to-node +# communication. (the range means that if the port is busy, it will automatically +# try the next port). + +# Set the bind address specifically (IPv4 or IPv6): +# +# network.bind_host: 192.168.0.1 + +# Set the address other nodes will use to communicate with this node. If not +# set, it is automatically derived. It must point to an actual IP address. +# +# network.publish_host: 192.168.0.1 + +# Set both 'bind_host' and 'publish_host': +# +# network.host: 192.168.0.1 + +# Set a custom port for the node to node communication (9300 by default): +# +# transport.tcp.port: 9300 + +# Enable compression for all communication between nodes (disabled by default): +# +# transport.tcp.compress: true + +# Set a custom port to listen for HTTP traffic: +# +# http.port: 9200 + +# Set a custom allowed content length: +# +# http.max_content_length: 100mb + +# Disable HTTP completely: +# +# http.enabled: false + + +################################### Gateway ################################### + +# The gateway allows for persisting the cluster state between full cluster +# restarts. Every change to the state (such as adding an index) will be stored +# in the gateway, and when the cluster starts up for the first time, +# it will read its state from the gateway. + +# There are several types of gateway implementations. For more information, see +# <http://elasticsearch.org/guide/en/elasticsearch/reference/current/modules-gateway.html>. + +# The default gateway type is the "local" gateway (recommended): +# +# gateway.type: local + +# Settings below control how and when to start the initial recovery process on +# a full cluster restart (to reuse as much local data as possible when using shared +# gateway). + +# Allow recovery process after N nodes in a cluster are up: +# +gateway.recover_after_nodes: 1 + +# Set the timeout to initiate the recovery process, once the N nodes +# from previous setting are up (accepts time value): +# +# gateway.recover_after_time: 5m + +# Set how many nodes are expected in this cluster. Once these N nodes +# are up (and recover_after_nodes is met), begin recovery process immediately +# (without waiting for recover_after_time to expire): +# +gateway.expected_nodes: 1 + + +############################# Recovery Throttling ############################# + +# These settings allow to control the process of shards allocation between +# nodes during initial recovery, replica allocation, rebalancing, +# or when adding and removing nodes. + +# Set the number of concurrent recoveries happening on a node: +# +# 1. During the initial recovery +# +# cluster.routing.allocation.node_initial_primaries_recoveries: 4 +# +# 2. During adding/removing nodes, rebalancing, etc +# +# cluster.routing.allocation.node_concurrent_recoveries: 2 + +# Set to throttle throughput when recovering (eg. 100mb, by default 20mb): +# +# indices.recovery.max_bytes_per_sec: 20mb + +# Set to limit the number of open concurrent streams when +# recovering a shard from a peer: +# +# indices.recovery.concurrent_streams: 5 + + +################################## Discovery ################################## + +# Discovery infrastructure ensures nodes can be found within a cluster +# and master node is elected. Multicast discovery is the default. + +# Set to ensure a node sees N other master eligible nodes to be considered +# operational within the cluster. Its recommended to set it to a higher value +# than 1 when running more than 2 nodes in the cluster. +# +# discovery.zen.minimum_master_nodes: 1 + +# Set the time to wait for ping responses from other nodes when discovering. +# Set this option to a higher value on a slow or congested network +# to minimize discovery failures: +# +# discovery.zen.ping.timeout: 3s + +# For more information, see +# <http://elasticsearch.org/guide/en/elasticsearch/reference/current/modules-discovery-zen.html> + +# Unicast discovery allows to explicitly control which nodes will be used +# to discover the cluster. It can be used when multicast is not present, +# or to restrict the cluster communication-wise. +# +# 1. Disable multicast discovery (enabled by default): +# +# discovery.zen.ping.multicast.enabled: false +# +# 2. Configure an initial list of master nodes in the cluster +# to perform discovery when new nodes (master or data) are started: +# +# discovery.zen.ping.unicast.hosts: ["host1", "host2:port"] + +# EC2 discovery allows to use AWS EC2 API in order to perform discovery. +# +# You have to install the cloud-aws plugin for enabling the EC2 discovery. +# +# For more information, see +# <http://elasticsearch.org/guide/en/elasticsearch/reference/current/modules-discovery-ec2.html> +# +# See <http://elasticsearch.org/tutorials/elasticsearch-on-ec2/> +# for a step-by-step tutorial. + +# GCE discovery allows to use Google Compute Engine API in order to perform discovery. +# +# You have to install the cloud-gce plugin for enabling the GCE discovery. +# +# For more information, see <https://github.com/elasticsearch/elasticsearch-cloud-gce>. + +# Azure discovery allows to use Azure API in order to perform discovery. +# +# You have to install the cloud-azure plugin for enabling the Azure discovery. +# +# For more information, see <https://github.com/elasticsearch/elasticsearch-cloud-azure>. + +################################## Slow Log ################################## + +# Shard level query and fetch threshold logging. + +#index.search.slowlog.threshold.query.warn: 10s +#index.search.slowlog.threshold.query.info: 5s +#index.search.slowlog.threshold.query.debug: 2s +#index.search.slowlog.threshold.query.trace: 500ms + +#index.search.slowlog.threshold.fetch.warn: 1s +#index.search.slowlog.threshold.fetch.info: 800ms +#index.search.slowlog.threshold.fetch.debug: 500ms +#index.search.slowlog.threshold.fetch.trace: 200ms + +#index.indexing.slowlog.threshold.index.warn: 10s +#index.indexing.slowlog.threshold.index.info: 5s +#index.indexing.slowlog.threshold.index.debug: 2s +#index.indexing.slowlog.threshold.index.trace: 500ms + +################################## GC Logging ################################ + +#monitor.jvm.gc.young.warn: 1000ms +#monitor.jvm.gc.young.info: 700ms +#monitor.jvm.gc.young.debug: 400ms + +#monitor.jvm.gc.old.warn: 10s +#monitor.jvm.gc.old.info: 5s +#monitor.jvm.gc.old.debug: 2s + @@ -16,9 +16,9 @@ fi source ${FULL_PATH}/baseOperation.sh -mainClass="org.openecomp.sdc.asdctool.main.MigrationMenu" +mainClass="org.openecomp.sdc.asdctool.main.ArtifactUUIDFixMenu" -command="java $JVM_LOG_FILE -cp $JARS $mainClass fix-UUID-1707 1707 $@" +command="java $JVM_LOG_FILE -cp $JARS $mainClass $@" echo $command $command @@ -0,0 +1,32 @@ +#!/bin/bash + +############################## +# Artifact Validator Tool # +############################## + +CURRENT_DIR=`pwd` +BASEDIR=$(dirname $0) + +if [ ${BASEDIR:0:1} = "/" ] +then + FULL_PATH=$BASEDIR +else + FULL_PATH=$CURRENT_DIR/$BASEDIR +fi + +source ${FULL_PATH}/baseOperation.sh + +mainClass="org.openecomp.sdc.asdctool.main.ArtifactValidatorTool" + +command="java $JVM_LOG_FILE -cp $JARS $mainClass /var/tmp/ /home/vagrant/catalog-be/config/catalog-be/" +#command="java $JVM_LOG_FILE -cp $JARS $mainClass . /apps/jetty/base/be/config/catalog-be/" +echo $command + +$command +result=$? + +echo "***********************************" +echo "***** $result *********************" +echo "***********************************" + +exit $result
\ No newline at end of file @@ -4,6 +4,9 @@ # Data Migration ############################## +# in 1802E we do not want to execute automatic post process +exit 0 + CURRENT_DIR=`pwd` BASEDIR=$(dirname $0) @@ -0,0 +1,33 @@ +#!/bin/bash + +############################## +# Data Migration: Upgrade Post Migration 1710 +############################## + +CURRENT_DIR=`pwd` +BASEDIR=$(dirname $0) + +if [ ${BASEDIR:0:1} = "/" ] +then + FULL_PATH=$BASEDIR +else + FULL_PATH=$CURRENT_DIR/$BASEDIR +fi + +source ${FULL_PATH}/baseOperation.sh + +mainClass="org.openecomp.sdc.asdctool.migration.main.MigrationMenu" + +command="java $JVM_LOG_FILE -cp $JARS $mainClass -c $@" +echo $command + +$command +result=$? + +echo "***********************************" +echo "***** $result *********************" +echo "***********************************" + +exit $result + + @@ -1,7 +1,5 @@ package org.openecomp.sdc.asdctool.enums; -import javax.annotation.Generated; - import org.junit.Test; @@ -2,8 +2,6 @@ package org.openecomp.sdc.asdctool.impl.validator.config; import java.util.Properties; -import javax.annotation.Generated; - import org.junit.Test; @@ -21,16 +19,6 @@ public class ValidationConfigManagerTest { // default test result = ValidationConfigManager.getOutputFilePath(); } - - - @Test - public void testSetOutputFilePath() throws Exception { - String outputPath = ""; - - // default test - ValidationConfigManager.setOutputFilePath(outputPath); - } - @Test public void testGetCsvReportFilePath() throws Exception { @@ -1,7 +1,5 @@ package org.openecomp.sdc.asdctool.impl.validator.config; -import javax.annotation.Generated; - import org.junit.Test; import org.openecomp.sdc.asdctool.impl.validator.ValidationToolBL; import org.openecomp.sdc.asdctool.impl.validator.executers.ServiceValidatorExecuter; @@ -10,7 +8,6 @@ import org.openecomp.sdc.asdctool.impl.validator.tasks.artifacts.ArtifactValidat import org.openecomp.sdc.asdctool.impl.validator.tasks.artifacts.ServiceArtifactValidationTask; import org.openecomp.sdc.asdctool.impl.validator.tasks.artifacts.VfArtifactValidationTask; import org.openecomp.sdc.asdctool.impl.validator.tasks.moduleJson.ModuleJsonTask; -import org.openecomp.sdc.asdctool.impl.validator.utils.ReportManager; import org.openecomp.sdc.be.dao.TitanClientStrategy; import org.openecomp.sdc.be.dao.cassandra.ArtifactCassandraDao; import org.openecomp.sdc.be.dao.cassandra.CassandraClient; @@ -20,7 +17,6 @@ import org.openecomp.sdc.be.model.DerivedNodeTypeResolver; import org.openecomp.sdc.be.model.jsontitan.operations.ArtifactsOperations; import org.openecomp.sdc.be.model.jsontitan.operations.CategoryOperation; import org.openecomp.sdc.be.model.jsontitan.operations.GroupsOperation; -import org.openecomp.sdc.be.model.jsontitan.operations.NodeTemplateOperation; import org.openecomp.sdc.be.model.jsontitan.operations.NodeTypeOperation; import org.openecomp.sdc.be.model.jsontitan.operations.TopologyTemplateOperation; import org.openecomp.sdc.be.model.jsontitan.operations.ToscaDataOperation; @@ -99,18 +95,6 @@ public class ValidationToolConfigurationTest { testSubject = createTestSubject(); result = testSubject.basicVfValidator(); } - - - @Test - public void testReportManager() throws Exception { - ValidationToolConfiguration testSubject; - ReportManager result; - - // default test - testSubject = createTestSubject(); - result = testSubject.reportManager(); - } - @Test public void testArtifactCassandraDao() throws Exception { @@ -1,7 +1,5 @@ package org.openecomp.sdc.asdctool.impl.validator.executers; -import javax.annotation.Generated; - import org.junit.Test; @@ -1,11 +1,6 @@ package org.openecomp.sdc.asdctool.impl.validator.executers; -import java.util.List; - import org.junit.Test; -import org.openecomp.sdc.asdctool.impl.validator.tasks.TopologyTemplateValidationTask; -import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; -import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; public class TopologyTemplateValidatorExecuterTest { @@ -1,7 +1,5 @@ package org.openecomp.sdc.asdctool.impl.validator.executers; -import javax.annotation.Generated; - import org.junit.Test; @@ -1,7 +1,5 @@ package org.openecomp.sdc.asdctool.impl.validator.tasks.artifacts; -import javax.annotation.Generated; - import org.junit.Test; @@ -1,11 +1,5 @@ package org.openecomp.sdc.asdctool.impl.validator.tasks.artifacts; -import javax.annotation.Generated; - -import org.junit.Test; -import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; - - public class ServiceArtifactValidationTaskTest { private ServiceArtifactValidationTask createTestSubject() { @@ -1,12 +1,5 @@ package org.openecomp.sdc.asdctool.impl.validator.tasks.artifacts; -import javax.annotation.Generated; - -import org.junit.Test; -import org.openecomp.sdc.asdctool.impl.validator.utils.VertexResult; -import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; - - public class VfArtifactValidationTaskTest { private VfArtifactValidationTask createTestSubject() { @@ -2,8 +2,6 @@ package org.openecomp.sdc.asdctool.impl.validator.utils; import java.util.List; -import javax.annotation.Generated; - import org.junit.Test; @@ -1,7 +1,5 @@ package org.openecomp.sdc.asdctool.impl.validator.utils; -import javax.annotation.Generated; - import org.junit.Test; import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; @@ -1,7 +1,5 @@ package org.openecomp.sdc.asdctool.impl.validator.utils; -import javax.annotation.Generated; - import org.junit.Test; @@ -1,7 +1,5 @@ package org.openecomp.sdc.asdctool.migration.config; -import javax.annotation.Generated; - import org.junit.Test; import org.openecomp.sdc.asdctool.migration.core.SdcMigrationTool; import org.openecomp.sdc.asdctool.migration.dao.MigrationTasksDao; @@ -1,10 +1,10 @@ package org.openecomp.sdc.asdctool.migration.core; +import static org.testng.Assert.assertEquals; + import org.testng.annotations.DataProvider; import org.testng.annotations.Test; -import static org.testng.Assert.assertEquals; - public class DBVersionTest { @@ -1,5 +1,12 @@ package org.openecomp.sdc.asdctool.migration.core; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import java.util.Arrays; +import java.util.Collections; + import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; @@ -12,13 +19,6 @@ import org.openecomp.sdc.asdctool.migration.service.SdcRepoService; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; -import java.util.Arrays; -import java.util.Collections; - -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - public class SdcMigrationToolTest { @InjectMocks @@ -1,14 +1,13 @@ package org.openecomp.sdc.asdctool.migration.core.execution; +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertNotNull; + import org.openecomp.sdc.asdctool.migration.DummyMigrationFactory; -import org.openecomp.sdc.asdctool.migration.core.DBVersion; import org.openecomp.sdc.asdctool.migration.core.task.Migration; import org.openecomp.sdc.asdctool.migration.core.task.MigrationResult; import org.testng.annotations.Test; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertNotNull; - public class MigrationExecutorImplTest { @Test @@ -1,7 +1,5 @@ package org.openecomp.sdc.asdctool.migration.core.task; -import javax.annotation.Generated; - import org.junit.Test; import org.openecomp.sdc.asdctool.migration.core.task.MigrationResult.MigrationStatus; @@ -1,23 +1,24 @@ package org.openecomp.sdc.asdctool.migration.resolver; +import static org.mockito.Mockito.when; +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertTrue; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.openecomp.sdc.asdctool.migration.core.DBVersion; +import org.openecomp.sdc.asdctool.migration.core.task.IMigrationStage; import org.openecomp.sdc.asdctool.migration.core.task.Migration; import org.openecomp.sdc.asdctool.migration.core.task.MigrationResult; import org.openecomp.sdc.asdctool.migration.service.SdcRepoService; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -import static org.mockito.Mockito.when; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertTrue; - public class SpringBeansMigrationResolverTest { @InjectMocks @@ -38,7 +39,8 @@ public class SpringBeansMigrationResolverTest { @Test public void testResolveMigrations_getMigrationsWithVersionGreaterThanLatest() throws Exception { when(sdcRepoServiceMock.getLatestDBVersion()).thenReturn(DBVersion.fromString("1710.2")); - List<Migration> resolvedMigrations = testInstance.resolveMigrations(); + testInstance.setPostMigrations(Collections.emptyList()); + List<IMigrationStage> resolvedMigrations = testInstance.resolveMigrations(); assertEquals(resolvedMigrations.size(), 2); assertEquals(resolvedMigrations.get(0).getVersion(), DBVersion.fromString("1710.3")); assertEquals(resolvedMigrations.get(1).getVersion(), DBVersion.fromString("1710.22")); @@ -47,7 +49,8 @@ public class SpringBeansMigrationResolverTest { @Test public void testResolveMigration_noLatestVersionForCurrentMajorVersion() throws Exception { when(sdcRepoServiceMock.getLatestDBVersion()).thenReturn(DBVersion.fromString("1710.-1")); - List<Migration> resolvedMigrations = testInstance.resolveMigrations(); + testInstance.setPostMigrations(Collections.emptyList()); + List<IMigrationStage> resolvedMigrations = testInstance.resolveMigrations(); assertEquals(resolvedMigrations.size(), 3); assertEquals(resolvedMigrations.get(0).getVersion(), DBVersion.fromString("1710.1")); assertEquals(resolvedMigrations.get(1).getVersion(), DBVersion.fromString("1710.3")); @@ -57,8 +60,9 @@ public class SpringBeansMigrationResolverTest { @Test public void testResolveMigrations_emptyMigrationsList() throws Exception { testInstance.setMigrations(Collections.emptyList()); + testInstance.setPostMigrations(Collections.emptyList()); when(sdcRepoServiceMock.getLatestDBVersion()).thenReturn(DBVersion.fromString("1710.-1")); - List<Migration> resolvedMigrations = testInstance.resolveMigrations(); + List<IMigrationStage> resolvedMigrations = testInstance.resolveMigrations(); assertTrue(resolvedMigrations.isEmpty()); } @@ -1,8 +1,5 @@ package org.openecomp.sdc.asdctool.migration.scanner; -import org.apache.commons.io.FileUtils; -import org.openecomp.sdc.asdctool.migration.core.MigrationException; - import java.io.File; import java.lang.reflect.Modifier; import java.net.URL; @@ -12,6 +9,9 @@ import java.util.Collections; import java.util.List; import java.util.Optional; +import org.apache.commons.io.FileUtils; +import org.openecomp.sdc.asdctool.migration.core.MigrationException; + /** * scan and instantiate classes of given type in the class path */ @@ -1,5 +1,11 @@ package org.openecomp.sdc.asdctool.migration.service; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; +import static org.testng.Assert.assertEquals; + +import java.math.BigInteger; + import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.MockitoAnnotations; @@ -10,12 +16,6 @@ import org.openecomp.sdc.be.resources.data.MigrationTaskEntry; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; -import java.math.BigInteger; - -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; -import static org.testng.Assert.assertEquals; - public class SdcRepoServiceTest { @InjectMocks @@ -1,5 +1,11 @@ package org.openecomp.sdc.asdctool.migration.task; +import java.util.Collection; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; + import org.apache.commons.lang.StringUtils; import org.openecomp.sdc.asdctool.migration.core.DBVersion; import org.openecomp.sdc.asdctool.migration.core.task.Migration; @@ -9,13 +15,6 @@ import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; -import java.util.Collection; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.stream.Collectors; - - public class MigrationTasksTest { public static final String MIGRATIONS_BASE_PACKAGE = "org.openecomp.sdc.asdctool.migration.tasks"; @@ -0,0 +1,265 @@ +package org.openecomp.sdc.asdctool.migration.tasks.mig1710; + + +import static org.junit.Assert.assertEquals; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.when; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnitRunner; +import org.openecomp.sdc.asdctool.migration.core.task.MigrationResult; +import org.openecomp.sdc.be.components.lifecycle.LifecycleBusinessLogic; +import org.openecomp.sdc.be.config.Configuration; +import org.openecomp.sdc.be.config.ConfigurationManager; +import org.openecomp.sdc.be.dao.api.ActionStatus; +import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; +import org.openecomp.sdc.be.dao.jsongraph.TitanDao; +import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; +import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; +import org.openecomp.sdc.be.datatypes.enums.OriginTypeEnum; +import org.openecomp.sdc.be.impl.ComponentsUtils; +import org.openecomp.sdc.be.model.Component; +import org.openecomp.sdc.be.model.ComponentInstance; +import org.openecomp.sdc.be.model.LifecycleStateEnum; +import org.openecomp.sdc.be.model.Resource; +import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.operations.api.IUserAdminOperation; +import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; +import org.openecomp.sdc.common.api.ConfigurationSource; +import org.openecomp.sdc.exception.ResponseFormat; + +import com.google.common.collect.Lists; + +import fj.data.Either; + +@RunWith(MockitoJUnitRunner.class) +public class UpgradeMigration1710Test { + + private final static String USER = "jh0003"; + private final static String CONF_LEVEL = "5.0"; + + private final User user = new User(); + private UpgradeMigration1710 migration; + @Mock + private IUserAdminOperation userAdminOperation; + @Mock + private ToscaOperationFacade toscaOperationFacade; + @Mock + private LifecycleBusinessLogic lifecycleBusinessLogic; + @Mock + private TitanDao titanDao; + @Mock + private ComponentsUtils componentUtils; + @Mock + private ConfigurationSource configurationSource; + private static ConfigurationManager configurationManager; + private static List<String> resources = Stream.of("org.openecomp.resource.cp.extCP").collect(Collectors.toList()); + private static Map<String, List<String>> resourcesForUpgrade; + + @BeforeClass + public static void setUpClass() { + resourcesForUpgrade = new HashMap<>(); + resourcesForUpgrade.put(CONF_LEVEL, resources); + } + + @Before + public void setUp() { + migration = new UpgradeMigration1710(); + migration.setUserAdminOperation(userAdminOperation); + migration.setTitanDao(titanDao); + migration.setTosckaOperationFacade(toscaOperationFacade); + migration.setLifecycleBusinessLogic(lifecycleBusinessLogic); + + user.setUserId(USER); + configurationManager = new ConfigurationManager(configurationSource); + configurationManager.setConfiguration(new Configuration()); + configurationManager.getConfiguration().setSkipUpgradeVSPs(true); + configurationManager.getConfiguration().setSkipUpgradeFailedVfs(true); + configurationManager.getConfiguration().setAutoHealingOwner(USER); + + } + + @Test + public void nodeTypesUpgradeFailed() { + resolveUserAndDefineUpgradeLevel(); + when(titanDao.getByCriteria(any(), any(), any(), any())) + .thenReturn(Either.right(TitanOperationStatus.NOT_FOUND)); + assertEquals(MigrationResult.MigrationStatus.FAILED, migration.migrate().getMigrationStatus()); + } + + @Test + public void nodeTypesUpgradePassedAndVFsUpgradeFailedWhenSkipFailedVFsIsNotSupported() { + final boolean failOnVfUpgrade = true; + final boolean upgradeServices = false; + final boolean exceptionOnVfUpgrade = false; + final boolean upgradeFVC = false; + configurationManager.getConfiguration().setSkipUpgradeFailedVfs(false); + resolveUserAndDefineUpgradeLevel(); + upgradeRules(failOnVfUpgrade, exceptionOnVfUpgrade, upgradeServices, upgradeFVC); + assertEquals(MigrationResult.MigrationStatus.FAILED, migration.migrate().getMigrationStatus()); + } + + @Test + public void upgradeAllVFsUpgradeFailedOnExceptionWhenSkipFailedVFsIsNotSupported() { + final boolean failOnVfUpgrade = false; + final boolean upgradeServices = false; + final boolean exceptionOnVfUpgrade = true; + final boolean upgradeFVC = false; + configurationManager.getConfiguration().setSkipUpgradeFailedVfs(false); + resolveUserAndDefineUpgradeLevel(); + upgradeRules(failOnVfUpgrade, exceptionOnVfUpgrade, upgradeServices, upgradeFVC); + assertEquals(MigrationResult.MigrationStatus.FAILED, migration.migrate().getMigrationStatus()); + } + + @Test + public void upgradeAllIfVFsUpgradeFailedOnExceptionWhenSkipFailedVFsIsSupported() { + final boolean failOnVfUpgrade = false; + final boolean upgradeServices = true; + final boolean exceptionOnFvUpgrade = true; + final boolean upgradeFVC = false; + configurationManager.getConfiguration().setSkipUpgradeFailedVfs(true); + resolveUserAndDefineUpgradeLevel(); + upgradeRules(failOnVfUpgrade, exceptionOnFvUpgrade, upgradeServices, upgradeFVC); + assertEquals(MigrationResult.MigrationStatus.COMPLETED, migration.migrate().getMigrationStatus()); + } + + + @Test + public void upgradeAll() { + final boolean failOnVfUpgrade = false; + final boolean upgradeServices = true; + final boolean exceptionOnFvUpgrade = false; + final boolean upgradeFVC = false; + resolveUserAndDefineUpgradeLevel(); + upgradeRules(failOnVfUpgrade, exceptionOnFvUpgrade, upgradeServices, upgradeFVC); + assertEquals(MigrationResult.MigrationStatus.COMPLETED, migration.migrate().getMigrationStatus()); + } + + @Test + public void upgradeAllWhenVspUpgradeIsRequired() { + final boolean failOnVfUpgrade = false; + final boolean upgradeServices = true; + final boolean exceptionOnFvUpgrade = false; + final boolean upgradeFVC = true; + resolveUserAndDefineUpgradeLevel(); + upgradeRules(failOnVfUpgrade, exceptionOnFvUpgrade, upgradeServices, upgradeFVC); + configurationManager.getConfiguration().setSkipUpgradeVSPs(false); + migration.setComponentsUtils(componentUtils); + assertEquals(MigrationResult.MigrationStatus.COMPLETED, migration.migrate().getMigrationStatus()); + } + + @Test + public void migrationFailedWhenUserNotResolved() { + when(userAdminOperation.getUserData(anyString(), eq(false))).thenReturn(Either.right(ActionStatus.MISSING_INFORMATION)); + when(titanDao.rollback()).thenReturn(TitanOperationStatus.OK); + assertEquals(MigrationResult.MigrationStatus.FAILED, migration.migrate().getMigrationStatus()); + } + + private void resolveUserAndDefineUpgradeLevel() { + when(userAdminOperation.getUserData(anyString(), eq(false))).thenReturn(Either.left(user)); + configurationManager.getConfiguration().setToscaConformanceLevel(CONF_LEVEL); + configurationManager.getConfiguration().setResourcesForUpgrade(resourcesForUpgrade); + } + + private void upgradeRules(boolean failedVfUpgrade, boolean exceptionOnVfUpgrade, boolean upgradeService, boolean upgradeVFCs) { + GraphVertex component = new GraphVertex(); + component.setJsonMetadataField(JsonPresentationFields.LIFECYCLE_STATE, LifecycleStateEnum.CERTIFIED.name()); + component.setJsonMetadataField(JsonPresentationFields.UNIQUE_ID, "12345"); + List<GraphVertex> components = Lists.newArrayList(); + components.add(component); + + Resource resource = new Resource(); + Either<Component, StorageOperationStatus> foundResource = Either.left(resource); + + when(titanDao.getByCriteria(any(), any(), any(), any())) + .thenReturn(Either.left(components)); + when(titanDao.getParentVertecies(any(), any(), any())) + //1th node to upgrade + .thenReturn(Either.left(components)) + //parent of the 1th node - stop recursion + .thenReturn(Either.right(TitanOperationStatus.NOT_FOUND)); + if (failedVfUpgrade) { + Either<Component, StorageOperationStatus> getToscaForVF = Either.right(StorageOperationStatus.NOT_FOUND); + when(toscaOperationFacade.getToscaElement(anyString())).thenReturn(foundResource) + .thenReturn(foundResource) + .thenReturn(getToscaForVF); + } + else { + if (exceptionOnVfUpgrade) { + when(toscaOperationFacade.getToscaElement(anyString())).thenReturn(foundResource) + .thenReturn(foundResource) + .thenThrow(new RuntimeException()); + } + else { + when(toscaOperationFacade.getToscaElement(anyString())).thenReturn(foundResource); + //happy flow + if (upgradeService) { + Either<Resource, StorageOperationStatus> service = Either.left(resource); + if (upgradeVFCs) { + when(componentUtils.convertFromStorageResponse(any(), any())).thenCallRealMethod(); + when(componentUtils.getResponseFormat(any(ActionStatus.class),any())).thenCallRealMethod(); + when(toscaOperationFacade.getLatestCertifiedByToscaResourceName(any(), any(), any())) + .thenReturn(service) + .thenReturn(Either.right(StorageOperationStatus.NOT_FOUND)) + .thenReturn(service) + .thenReturn(Either.right(StorageOperationStatus.NOT_FOUND)); + } + else { + when(toscaOperationFacade.getLatestCertifiedByToscaResourceName(any(), any(), any())) + .thenReturn(service); + } + } + } + } + List<ComponentInstance> instances = Lists.newArrayList(); + instances.add(createComponentInstance()); + resource.setComponentInstances(instances); + Either<Resource, ResponseFormat> fromLifeCycle = Either.left(resource); + doReturn(fromLifeCycle).when(lifecycleBusinessLogic) + .changeComponentState(any(), any(), any(), any(), any(),eq(true), eq(false)); + + } + + private ComponentInstance createComponentInstance() { + ComponentInstance instance = new ComponentInstance(); + instance.setIcon(""); + instance.setUniqueId(""); + instance.setName(""); + instance.setComponentUid(""); + instance.setCreationTime(1L); + instance.setModificationTime(2L); + instance.setDescription(""); + instance.setPosX(""); + instance.setPosY(""); + instance.setPropertyValueCounter(1); + instance.setNormalizedName(""); + instance.setOriginType(OriginTypeEnum.CVFC); + instance.setCustomizationUUID(""); + instance.setComponentName(""); + instance.setComponentVersion(""); + instance.setToscaComponentName(""); + instance.setInvariantName(""); + instance.setSourceModelInvariant(""); + instance.setSourceModelName(""); + instance.setSourceModelUuid(""); + instance.setSourceModelUid(""); + instance.setIsProxy(false); + return instance; + } + + +} @@ -1,7 +1,5 @@ package org.openecomp.sdc.asdctool.servlets; -import javax.annotation.Generated; - import org.junit.Test; diff --git a/catalog-be/.gitignore b/catalog-be/.gitignore deleted file mode 100644 index fbfe5d3901..0000000000 --- a/ catalog-be/.gitignore+++ /dev/null @@ -1,8 +0,0 @@ -/target -/target -/target - -/target -/target -/target -/build @@ -1,6 +1,5 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> <artifactId>catalog-be</artifactId> @@ -16,10 +15,7 @@ <swagger-ui-version>2.1.0-M2</swagger-ui-version> </properties> - <dependencies> - - <!--JSON and YAML Parsing--> <dependency> <groupId>com.fasterxml.jackson.dataformat</groupId> @@ -556,9 +552,13 @@ <dependency> <groupId>org.mockito</groupId> - <artifactId>mockito-all</artifactId> - <version>${mockito.version}</version> - <!--<version>1.10.19</version>--> + <artifactId>mockito-core</artifactId> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.assertj</groupId> + <artifactId>assertj-core</artifactId> <scope>test</scope> </dependency> @@ -624,53 +624,6 @@ </plugin> <plugin> - <artifactId>maven-resources-plugin</artifactId> - <version>2.6</version> - <executions> - <execution> - <id>copy-tosca-folder</id> - <!-- here the phase you need --> - <phase>install</phase> - <goals> - <goal>copy-resources</goal> - </goals> - <configuration> - <outputDirectory>${project.parent.basedir}/asdctool/tosca</outputDirectory> - <resources> - <resource> - <directory>${project.parent.basedir}/catalog-be/src/main/resources/import/tosca</directory> - <filtering>true</filtering> - </resource> - </resources> - </configuration> - </execution> - </executions> - </plugin> - - <plugin> - <artifactId>maven-clean-plugin</artifactId> - <version>3.0.0</version> - <executions> - <execution> - <id>clean-static-files</id> - <phase>clean</phase> - <goals> - <goal>clean</goal> - </goals> - <configuration> - <filesets> - <!-- tosca files --> - <fileset> - <directory>${project.parent.basedir}/asdctool/tosca</directory> - <followSymlinks>false</followSymlinks> - </fileset> - </filesets> - </configuration> - </execution> - </executions> - </plugin> - - <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-assembly-plugin</artifactId> <executions> @@ -22,8 +22,6 @@ package org.openecomp.sdc.be.auditing.api; import java.util.EnumMap; -import javax.servlet.ServletContext; - import org.openecomp.sdc.common.datastructure.AuditingFieldsKeysEnum; public interface IAuditingManager { @@ -20,14 +20,13 @@ package org.openecomp.sdc.be.auditing.impl; -import org.apache.commons.lang3.StringUtils; -import org.openecomp.sdc.be.components.impl.ImportUtils; -import org.openecomp.sdc.be.model.LifecycleStateEnum; import org.openecomp.sdc.common.datastructure.AuditingFieldsKeysEnum; -public interface AuditingLogFormatConstants { +class AuditingLogFormatConstants { - static AuditingFieldsKeysEnum[] DISTRIBUTION_REGISTRATION_TEMPLATE_ARRAY = { + private AuditingLogFormatConstants() {} + + static final AuditingFieldsKeysEnum[] DISTRIBUTION_REGISTRATION_TEMPLATE_ARRAY = { AuditingFieldsKeysEnum.AUDIT_ACTION, AuditingFieldsKeysEnum.AUDIT_DISTRIBUTION_CONSUMER_ID, AuditingFieldsKeysEnum.AUDIT_DISTRIBUTION_API_KEY, @@ -37,7 +36,7 @@ public interface AuditingLogFormatConstants { AuditingFieldsKeysEnum.AUDIT_DISTRIBUTION_NOTIFICATION_TOPIC_NAME, AuditingFieldsKeysEnum.AUDIT_DISTRIBUTION_STATUS_TOPIC_NAME}; - static AuditingFieldsKeysEnum[] DISTRIBUTION_DOWNLOAD_TEMPLATE_ARRAY = { + static final AuditingFieldsKeysEnum[] DISTRIBUTION_DOWNLOAD_TEMPLATE_ARRAY = { AuditingFieldsKeysEnum.AUDIT_ACTION, AuditingFieldsKeysEnum.AUDIT_DISTRIBUTION_CONSUMER_ID, AuditingFieldsKeysEnum.AUDIT_DISTRIBUTION_RESOURCE_URL, @@ -45,7 +44,7 @@ public interface AuditingLogFormatConstants { AuditingFieldsKeysEnum.AUDIT_DESC }; - static AuditingFieldsKeysEnum[] GET_UEB_CLUSTER_ARRAY = { + static final AuditingFieldsKeysEnum[] GET_UEB_CLUSTER_ARRAY = { AuditingFieldsKeysEnum.AUDIT_ACTION, AuditingFieldsKeysEnum.AUDIT_DISTRIBUTION_CONSUMER_ID, AuditingFieldsKeysEnum.AUDIT_DISTRIBUTION_STATUS_TIME, @@ -53,7 +52,7 @@ public interface AuditingLogFormatConstants { AuditingFieldsKeysEnum.AUDIT_DISTRIBUTION_STATUS_DESC }; - static AuditingFieldsKeysEnum[] DISTRIBUTION_DEPLOY_ARRAY = { + static final AuditingFieldsKeysEnum[] DISTRIBUTION_DEPLOY_ARRAY = { AuditingFieldsKeysEnum.AUDIT_ACTION, AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, AuditingFieldsKeysEnum.AUDIT_RESOURCE_TYPE, @@ -65,7 +64,7 @@ public interface AuditingLogFormatConstants { AuditingFieldsKeysEnum.AUDIT_DESC }; - static AuditingFieldsKeysEnum[] DISTRIBUTION_STATUS_TEMPLATE_ARRAY = { + static final AuditingFieldsKeysEnum[] DISTRIBUTION_STATUS_TEMPLATE_ARRAY = { AuditingFieldsKeysEnum.AUDIT_ACTION, AuditingFieldsKeysEnum.AUDIT_DISTRIBUTION_ID, AuditingFieldsKeysEnum.AUDIT_DISTRIBUTION_CONSUMER_ID, @@ -76,7 +75,7 @@ public interface AuditingLogFormatConstants { AuditingFieldsKeysEnum.AUDIT_DESC }; - static AuditingFieldsKeysEnum[] DISTRIBUTION_NOTIFY_ARRAY = { + static final AuditingFieldsKeysEnum[] DISTRIBUTION_NOTIFY_ARRAY = { AuditingFieldsKeysEnum.AUDIT_ACTION, AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, AuditingFieldsKeysEnum.AUDIT_RESOURCE_TYPE, @@ -90,7 +89,7 @@ public interface AuditingLogFormatConstants { AuditingFieldsKeysEnum.AUDIT_DESC }; - static AuditingFieldsKeysEnum[] ADD_REMOVE_TOPIC_KEY_ACL_TEMPLATE_ARRAY = { + static final AuditingFieldsKeysEnum[] ADD_REMOVE_TOPIC_KEY_ACL_TEMPLATE_ARRAY = { AuditingFieldsKeysEnum.AUDIT_ACTION, AuditingFieldsKeysEnum.AUDIT_DISTRIBUTION_ENVRIONMENT_NAME, AuditingFieldsKeysEnum.AUDIT_DISTRIBUTION_TOPIC_NAME, @@ -99,14 +98,14 @@ public interface AuditingLogFormatConstants { AuditingFieldsKeysEnum.AUDIT_STATUS }; - static AuditingFieldsKeysEnum[] CREATE_TOPIC_TEMPLATE_ARRAY = { + static final AuditingFieldsKeysEnum[] CREATE_TOPIC_TEMPLATE_ARRAY = { AuditingFieldsKeysEnum.AUDIT_ACTION, AuditingFieldsKeysEnum.AUDIT_DISTRIBUTION_ENVRIONMENT_NAME, AuditingFieldsKeysEnum.AUDIT_DISTRIBUTION_TOPIC_NAME, AuditingFieldsKeysEnum.AUDIT_STATUS }; - static AuditingFieldsKeysEnum[] ACTIVATE_DISTRIBUTION_ARRAY ={ + static final AuditingFieldsKeysEnum[] ACTIVATE_DISTRIBUTION_ARRAY ={ AuditingFieldsKeysEnum.AUDIT_ACTION, AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, AuditingFieldsKeysEnum.AUDIT_RESOURCE_TYPE, @@ -121,7 +120,7 @@ public interface AuditingLogFormatConstants { AuditingFieldsKeysEnum.AUDIT_DESC }; - static AuditingFieldsKeysEnum[] CHANGE_DISTRIBUTION_STATUS_ARRAY = { + static final AuditingFieldsKeysEnum[] CHANGE_DISTRIBUTION_STATUS_ARRAY = { AuditingFieldsKeysEnum.AUDIT_ACTION, AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, AuditingFieldsKeysEnum.AUDIT_RESOURCE_TYPE, @@ -136,12 +135,12 @@ public interface AuditingLogFormatConstants { AuditingFieldsKeysEnum.AUDIT_RESOURCE_COMMENT }; - static AuditingFieldsKeysEnum[] CREATE_RESOURCE_TEMPLATE_SUFFIX_ARRAY = { + static final AuditingFieldsKeysEnum[] CREATE_RESOURCE_TEMPLATE_SUFFIX_ARRAY = { AuditingFieldsKeysEnum.AUDIT_STATUS, AuditingFieldsKeysEnum.AUDIT_DESC }; - static AuditingFieldsKeysEnum[] CREATE_RESOURCE_TEMPLATE_PREFIX_ARRAY = { + static final AuditingFieldsKeysEnum[] CREATE_RESOURCE_TEMPLATE_PREFIX_ARRAY = { AuditingFieldsKeysEnum.AUDIT_ACTION, AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, AuditingFieldsKeysEnum.AUDIT_RESOURCE_TYPE, @@ -155,14 +154,14 @@ public interface AuditingLogFormatConstants { }; - static AuditingFieldsKeysEnum[] USER_ACCESS_TEMPLATE_ARRAY = { + static final AuditingFieldsKeysEnum[] USER_ACCESS_TEMPLATE_ARRAY = { AuditingFieldsKeysEnum.AUDIT_ACTION, AuditingFieldsKeysEnum.AUDIT_USER_UID, AuditingFieldsKeysEnum.AUDIT_STATUS, AuditingFieldsKeysEnum.AUDIT_DESC }; - static AuditingFieldsKeysEnum[] USER_TEMPLATE_ARRAY = { + static final AuditingFieldsKeysEnum[] USER_TEMPLATE_ARRAY = { AuditingFieldsKeysEnum.AUDIT_ACTION, AuditingFieldsKeysEnum.AUDIT_MODIFIER_UID, AuditingFieldsKeysEnum.AUDIT_USER_UID, @@ -170,7 +169,7 @@ public interface AuditingLogFormatConstants { AuditingFieldsKeysEnum.AUDIT_DESC }; - static AuditingFieldsKeysEnum[] AUTH_TEMPLATE_ARRAY = { + static final AuditingFieldsKeysEnum[] AUTH_TEMPLATE_ARRAY = { AuditingFieldsKeysEnum.AUDIT_ACTION, AuditingFieldsKeysEnum.AUDIT_AUTH_URL, AuditingFieldsKeysEnum.AUDIT_AUTH_USER, @@ -178,7 +177,7 @@ public interface AuditingLogFormatConstants { AuditingFieldsKeysEnum.AUDIT_AUTH_REALM }; - static AuditingFieldsKeysEnum[] ECOMP_USER_TEMPLATE_ARRAY = { + static final AuditingFieldsKeysEnum[] ECOMP_USER_TEMPLATE_ARRAY = { AuditingFieldsKeysEnum.AUDIT_ACTION, AuditingFieldsKeysEnum.AUDIT_MODIFIER_UID, AuditingFieldsKeysEnum.AUDIT_ECOMP_USER, @@ -186,7 +185,7 @@ public interface AuditingLogFormatConstants { AuditingFieldsKeysEnum.AUDIT_DESC }; - static AuditingFieldsKeysEnum[] CATEGORY_TEMPLATE_ARRAY = { + static final AuditingFieldsKeysEnum[] CATEGORY_TEMPLATE_ARRAY = { AuditingFieldsKeysEnum.AUDIT_ACTION, AuditingFieldsKeysEnum.AUDIT_MODIFIER_UID, AuditingFieldsKeysEnum.AUDIT_CATEGORY_NAME, @@ -197,7 +196,7 @@ public interface AuditingLogFormatConstants { AuditingFieldsKeysEnum.AUDIT_DESC }; - static AuditingFieldsKeysEnum[] GET_USERS_LIST_TEMPLATE_ARRAY = { + static final AuditingFieldsKeysEnum[] GET_USERS_LIST_TEMPLATE_ARRAY = { AuditingFieldsKeysEnum.AUDIT_ACTION, AuditingFieldsKeysEnum.AUDIT_MODIFIER_UID, AuditingFieldsKeysEnum.AUDIT_USER_DETAILS, @@ -205,14 +204,14 @@ public interface AuditingLogFormatConstants { AuditingFieldsKeysEnum.AUDIT_DESC }; - static AuditingFieldsKeysEnum[] GET_CATEGORY_HIERARCHY_TEMPLATE_ARRAY = { + static final AuditingFieldsKeysEnum[] GET_CATEGORY_HIERARCHY_TEMPLATE_ARRAY = { AuditingFieldsKeysEnum.AUDIT_ACTION, AuditingFieldsKeysEnum.AUDIT_MODIFIER_UID, AuditingFieldsKeysEnum.AUDIT_DETAILS, AuditingFieldsKeysEnum.AUDIT_STATUS, AuditingFieldsKeysEnum.AUDIT_DESC }; - static AuditingFieldsKeysEnum[] USER_ADMIN_TEMPLATE_ARRAY = { + static final AuditingFieldsKeysEnum[] USER_ADMIN_TEMPLATE_ARRAY = { AuditingFieldsKeysEnum.AUDIT_ACTION, AuditingFieldsKeysEnum.AUDIT_MODIFIER_UID, AuditingFieldsKeysEnum.AUDIT_USER_BEFORE, @@ -220,14 +219,14 @@ public interface AuditingLogFormatConstants { AuditingFieldsKeysEnum.AUDIT_STATUS, AuditingFieldsKeysEnum.AUDIT_DESC }; - static AuditingFieldsKeysEnum[] EXTERNAL_GET_ASSET_LIST_TEMPLATE_ARRAY = { + static final AuditingFieldsKeysEnum[] EXTERNAL_GET_ASSET_LIST_TEMPLATE_ARRAY = { AuditingFieldsKeysEnum.AUDIT_ACTION, AuditingFieldsKeysEnum.AUDIT_DISTRIBUTION_CONSUMER_ID, AuditingFieldsKeysEnum.AUDIT_DISTRIBUTION_RESOURCE_URL, AuditingFieldsKeysEnum.AUDIT_STATUS, AuditingFieldsKeysEnum.AUDIT_DESC }; - static AuditingFieldsKeysEnum[] EXTERNAL_GET_ASSET_TEMPLATE_ARRAY = { + static final AuditingFieldsKeysEnum[] EXTERNAL_GET_ASSET_TEMPLATE_ARRAY = { AuditingFieldsKeysEnum.AUDIT_ACTION, AuditingFieldsKeysEnum.AUDIT_DISTRIBUTION_CONSUMER_ID, AuditingFieldsKeysEnum.AUDIT_DISTRIBUTION_RESOURCE_URL, @@ -237,13 +236,13 @@ public interface AuditingLogFormatConstants { AuditingFieldsKeysEnum.AUDIT_STATUS, AuditingFieldsKeysEnum.AUDIT_DESC }; - static AuditingFieldsKeysEnum[] EXTERNAL_DOWNLOAD_ARTIFACT_ARRAY = { + static final AuditingFieldsKeysEnum[] EXTERNAL_DOWNLOAD_ARTIFACT_ARRAY = { AuditingFieldsKeysEnum.AUDIT_DISTRIBUTION_CONSUMER_ID, AuditingFieldsKeysEnum.AUDIT_DISTRIBUTION_RESOURCE_URL, AuditingFieldsKeysEnum.AUDIT_STATUS, AuditingFieldsKeysEnum.AUDIT_DESC }; - static AuditingFieldsKeysEnum[] EXTERNAL_CRUD_API_ARTIFACT_ARRAY = { + static final AuditingFieldsKeysEnum[] EXTERNAL_CRUD_API_ARTIFACT_ARRAY = { AuditingFieldsKeysEnum.AUDIT_ACTION, AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, AuditingFieldsKeysEnum.AUDIT_RESOURCE_TYPE, @@ -257,7 +256,7 @@ public interface AuditingLogFormatConstants { AuditingFieldsKeysEnum.AUDIT_DESC }; - static AuditingFieldsKeysEnum[] EXTERNAL_CRUD_API_ARRAY = { + static final AuditingFieldsKeysEnum[] EXTERNAL_CRUD_API_ARRAY = { AuditingFieldsKeysEnum.AUDIT_ACTION, AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, AuditingFieldsKeysEnum.AUDIT_RESOURCE_TYPE, @@ -278,7 +277,7 @@ public interface AuditingLogFormatConstants { AuditingFieldsKeysEnum.AUDIT_DESC }; - static AuditingFieldsKeysEnum[] EXTERNAL_LYFECYCLE_API_ARRAY = { + static final AuditingFieldsKeysEnum[] EXTERNAL_LYFECYCLE_API_ARRAY = { AuditingFieldsKeysEnum.AUDIT_ACTION, AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, AuditingFieldsKeysEnum.AUDIT_RESOURCE_TYPE, @@ -24,9 +24,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.EnumMap; import java.util.Formatter; -import java.util.HashSet; import java.util.Locale; -import java.util.Set; import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; import org.openecomp.sdc.common.api.Constants; @@ -162,7 +162,7 @@ public class AsdcComponentsCleanerTask implements Runnable { public void run() { try { componentsCleanBusinessLogic.cleanComponents(componentsToClean); - } catch (Throwable e) { + } catch (Exception e) { log.error("unexpected error occured", e); String methodName = new Object() { }.getClass().getEnclosingMethod().getName(); @@ -25,14 +25,12 @@ import java.net.MalformedURLException; import java.security.GeneralSecurityException; import java.util.ArrayList; import java.util.Collection; -import java.util.Iterator; import java.util.List; import java.util.Set; import java.util.concurrent.TimeUnit; import java.util.regex.Matcher; import java.util.regex.Pattern; -import com.att.nsa.cambria.client.*; import org.apache.http.HttpStatus; import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.config.ConfigurationManager; @@ -43,189 +41,34 @@ import org.slf4j.LoggerFactory; import com.att.nsa.apiClient.http.HttpException; import com.att.nsa.apiClient.http.HttpObjectNotFoundException; +import com.att.nsa.cambria.client.CambriaBatchingPublisher; +import com.att.nsa.cambria.client.CambriaClient; import com.att.nsa.cambria.client.CambriaClient.CambriaApiException; -import com.att.nsa.cambria.client.CambriaClientBuilders.TopicManagerBuilder; -import com.att.nsa.cambria.client.CambriaClientBuilders.PublisherBuilder; +import com.att.nsa.cambria.client.CambriaClientBuilders; import com.att.nsa.cambria.client.CambriaClientBuilders.ConsumerBuilder; import com.att.nsa.cambria.client.CambriaClientBuilders.IdentityManagerBuilder; +import com.att.nsa.cambria.client.CambriaClientBuilders.PublisherBuilder; +import com.att.nsa.cambria.client.CambriaClientBuilders.TopicManagerBuilder; +import com.att.nsa.cambria.client.CambriaConsumer; +import com.att.nsa.cambria.client.CambriaIdentityManager; import com.att.nsa.cambria.client.CambriaPublisher.message; +import com.att.nsa.cambria.client.CambriaTopicManager; import com.google.gson.Gson; import fj.data.Either; -import jline.internal.Log; public class CambriaHandler { private static Logger logger = LoggerFactory.getLogger(CambriaHandler.class.getName()); - public static String PARTITION_KEY = "asdc" + "aa"; + private static final String PARTITION_KEY = "asdc" + "aa"; + + private final String SEND_NOTIFICATION = "send notification"; private Gson gson = new Gson(); public static boolean useHttpsWithDmaap = ConfigurationManager.getConfigurationManager().getDistributionEngineConfiguration().isUseHttpsWithDmaap(); - public static void main(String[] args) { - - // String userBodyJson ="{\"artifactName\":\"myartifact\", - // \"artifactType\":\"MURANO-PKG\", - // \"artifactDescription\":\"description\", - // \"payloadData\":\"UEsDBAoAAAAIAAeLb0bDQz\", \"Content-MD5\": - // \"YTg2Mjg4MWJhNmI5NzBiNzdDFkMWI=\" }"; - // System.out.println(userBodyJson); - // String encodeBase64Str = GeneralUtililty.calculateMD5 (userBodyJson); - // System.out.println(encodeBase64Str); - - CambriaTopicManager createTopicManager = null; - try { - List<String> servers = new ArrayList<String>(); - // servers.add("uebsb91kcdc.it.sdc.com:3904"); - // servers.add("uebsb92kcdc.it.sdc.com:3904"); - // servers.add("uebsb93kcdc.it.sdc.com:3904"); - servers.add("uebsb91sfdc.it.att.com:3904"); - servers.add("uebsb92sfdc.it.att.com:3904"); - - String key = "sSJc5qiBnKy2qrlc"; - String secret = "4ZRPzNJfEUK0sSNBvccd2m7X"; - - createTopicManager = buildCambriaClient(new TopicManagerBuilder().usingHosts(servers).authenticatedBy(key, secret)); - - String topicName = "ASDC-DISTR-NOTIF-TOPIC-PRODesofer"; - - String clientKey1 = "CGGoorrGPXPx2B1C"; - String clientSecret1 = "OTHk2mcCSbskEtHhDw8h5oUa"; - - CambriaTopicManager createStatusTopicManager = buildCambriaClient(new TopicManagerBuilder().usingHosts(servers).authenticatedBy(key, secret)); - String reportTopic = "ASDC-DISTR-STATUS-TOPIC-PRODESOFER"; - createStatusTopicManager.allowProducer(reportTopic, clientKey1); - - CambriaBatchingPublisher createSimplePublisher = new PublisherBuilder().onTopic(reportTopic).usingHttps(useHttpsWithDmaap).usingHosts(servers).build(); - createSimplePublisher.setApiCredentials(clientKey1, clientSecret1); - - DistributionStatusNotification distributionStatusNotification = new DistributionStatusNotification(); - distributionStatusNotification.setStatus(DistributionStatusNotificationEnum.DEPLOY_OK); - distributionStatusNotification.setArtifactURL("Ssssssss url"); - distributionStatusNotification.setDistributionID("idddddddddddddd"); - distributionStatusNotification.setTimestamp(System.currentTimeMillis()); - distributionStatusNotification.setConsumerID("my consumer id"); - - Gson gson = new Gson(); - int result = createSimplePublisher.send(PARTITION_KEY, gson.toJson(distributionStatusNotification)); - - List<message> messagesInQ = createSimplePublisher.close(20, TimeUnit.SECONDS); - System.out.println(messagesInQ == null ? 0 : messagesInQ.size()); - - // createTopicManager.createTopic(topicName, "my test topic", 1, 1); - - /* - * - * { "secret": "OTHk2mcCSbskEtHhDw8h5oUa", "aux": { "email": "esofer@intl.sdc.com", "description": "test-keys" }, "key": "CGGoorrGPXPx2B1C" } - * - * - * { "secret": "FSlNJbmGWWBvBLJetQMYxPP6", "aux": { "email": "esofer@intl.sdc.com", "description": "test-keys" }, "key": "TAIEPO0aDU4VzM0G" } - * - */ - - String clientKey2 = "TAIEPO0aDU4VzM0G"; - - CambriaConsumer createConsumer1 = new ConsumerBuilder().authenticatedBy("asdc1", "consumerId1").onTopic(topicName).usingHttps(useHttpsWithDmaap).usingHosts(servers).build(); - createConsumer1.setApiCredentials(clientKey1, "OTHk2mcCSbskEtHhDw8h5oUa"); - - createTopicManager.allowConsumer(topicName, clientKey1); - - CambriaConsumer createConsumer2 = null; - if (true) { - createConsumer2 = new ConsumerBuilder().authenticatedBy("asdc2", "consumerId3").onTopic(topicName).usingHttps(useHttpsWithDmaap).usingHosts(servers).build(); - createConsumer2.setApiCredentials(clientKey2, "FSlNJbmGWWBvBLJetQMYxPP6"); - - createTopicManager.allowConsumer(topicName, clientKey2); - } - - createSimplePublisher = new PublisherBuilder().onTopic(topicName).usingHttps(useHttpsWithDmaap).usingHosts(servers).build(); - createSimplePublisher.setApiCredentials(key, secret); - createTopicManager.allowProducer(topicName, key); - - createSimplePublisher.send("aaaa", "{ my testttttttttttttttt }"); - - while (true) { - - Iterable<String> fetch1 = createConsumer1.fetch(); - - Iterator<String> iterator1 = fetch1.iterator(); - while (iterator1.hasNext()) { - System.out.println("***********************************************"); - System.out.println("client 1" + iterator1.next()); - System.out.println("***********************************************"); - } - - if (createConsumer2 != null) { - Iterable<String> fetch2 = createConsumer2.fetch(); - - Iterator<String> iterator2 = fetch2.iterator(); - while (iterator2.hasNext()) { - System.out.println("***********************************************"); - System.out.println("client 2" + iterator2.next()); - System.out.println("***********************************************"); - } - } - Thread.sleep(1000 * 20); - } - - // createTopicManager = CambriaClientFactory.createTopicManager( - // servers, "8F3MDAtMSBwwpSMy", "gzFmsTxSCtO5RQfAccM6PqqX"); - - // createTopicManager.deleteTopic("ASDC-DISTR-NOTIF-TOPIC-PROD"); - // createTopicManager.deleteTopic("ASDC-DISTR-NOTIF-TOPIC-PROD1"); - - // CambriaIdentityManager createIdentityManager = - // CambriaClientFactory.createIdentityManager(null, null, null); - // createIdentityManager.setApiCredentials(arg0, arg1); - // createIdentityManager.cl - - // String topicName = " "; - // createTopicManager.createTopic(topicName, - // "ASDC distribution notification topic", 1, 1); - // - // Thread.sleep(10 * 1000); - // - // for (int i = 0; i < 5; i++) { - // try { - // boolean openForProducing = createTopicManager - // .isOpenForProducing(topicName); - // - // System.out.println("openForProducing=" + openForProducing); - // createTopicManager.allowProducer(topicName, - // "8F3MDAtMSBwwpSMy"); - // Set<String> allowedProducers = createTopicManager - // .getAllowedProducers(topicName); - // System.out.println(allowedProducers); - // - // } catch (Exception e) { - // e.printStackTrace(); - // } - // } - - // createTopicManager.createTopic("", "", 0, 0); - // createTopicManager.allowProducer(arg0, arg1); - // createTopicManager.getTopics(); - // createTopicManager.close(); - // CambriaClientFactory. - // CambriaBatchingPublisher createSimplePublisher = - // CambriaClientFactory.createSimplePublisher("hostlist", "topic"); - - // CambriaIdentityManager createIdentityManager = - // CambriaClientFactory.createIdentityManager(null, "apiKey", - // "apiSecret"); - // createIdentityManager. - - } catch (Exception e) { - Log.debug("Exception in main test of Cambria Handler: {}", e.getMessage(), e); - e.printStackTrace(); - } finally { - if (createTopicManager != null) { - createTopicManager.close(); - } - } - } /** * process the response error from Cambria client @@ -403,7 +246,8 @@ public class CambriaHandler { BeEcompErrorManager.getInstance().processEcompError(EcompErrorName.BeUebSystemError, methodName, operationDesc); BeEcompErrorManager.getInstance().logBeUebSystemError(methodName, operationDesc); break; - + default: + break; } } @@ -661,7 +505,7 @@ public class CambriaHandler { CambriaErrorResponse cambriaErrorResponse = processError(e); - writeErrorToLog(cambriaErrorResponse, e.getMessage(), methodName, "send notification"); + writeErrorToLog(cambriaErrorResponse, e.getMessage(), methodName, SEND_NOTIFICATION); return cambriaErrorResponse; } finally { @@ -719,7 +563,7 @@ public class CambriaHandler { response = processError(e); - writeErrorToLog(response, e.getMessage(), methodName, "send notification"); + writeErrorToLog(response, e.getMessage(), methodName, SEND_NOTIFICATION); return response; @@ -733,7 +577,7 @@ public class CambriaHandler { response = new CambriaErrorResponse(CambriaOperationStatus.INTERNAL_SERVER_ERROR, 500); String methodName = new Object() { }.getClass().getEnclosingMethod().getName(); - writeErrorToLog(response, "closing publisher returned non sent messages", methodName, "send notification"); + writeErrorToLog(response, "closing publisher returned non sent messages", methodName, SEND_NOTIFICATION); } else { logger.debug("No message left in the queue after closing cambria publisher"); response = new CambriaErrorResponse(CambriaOperationStatus.OK, 200); @@ -743,7 +587,7 @@ public class CambriaHandler { response = new CambriaErrorResponse(CambriaOperationStatus.INTERNAL_SERVER_ERROR, 500); String methodName = new Object() { }.getClass().getEnclosingMethod().getName(); - writeErrorToLog(response, "closing publisher returned non sent messages", methodName, "send notification"); + writeErrorToLog(response, "closing publisher returned non sent messages", methodName, SEND_NOTIFICATION); } logger.debug("After closing publisher"); @@ -34,7 +34,6 @@ import javax.annotation.PreDestroy; import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.config.DistributionEngineConfiguration; -import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; @@ -39,8 +39,8 @@ import javax.annotation.PreDestroy; import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.config.DistributionEngineConfiguration; +import org.openecomp.sdc.common.api.Constants; import org.openecomp.sdc.common.api.HealthCheckInfo; -import org.openecomp.sdc.common.api.HealthCheckInfo.HealthCheckComponent; import org.openecomp.sdc.common.api.HealthCheckInfo.HealthCheckStatus; import org.openecomp.sdc.common.config.EcompErrorName; import org.slf4j.Logger; @@ -72,10 +72,10 @@ public class DistributionEngineClusterHealth { public enum HealthCheckInfoResult { - OK(new HealthCheckInfo(HealthCheckComponent.DE, HealthCheckStatus.UP, null, ClusterStatusDescription.OK.getDescription())), - UNAVAILABLE(new HealthCheckInfo(HealthCheckComponent.DE, HealthCheckStatus.DOWN, null, ClusterStatusDescription.UNAVAILABLE.getDescription())), - NOT_CONFIGURED(new HealthCheckInfo(HealthCheckComponent.DE, HealthCheckStatus.DOWN, null, ClusterStatusDescription.NOT_CONFIGURED.getDescription())), - DISABLED(new HealthCheckInfo(HealthCheckComponent.DE, HealthCheckStatus.DOWN, null, ClusterStatusDescription.DISABLED.getDescription())); + OK(new HealthCheckInfo(Constants.HC_COMPONENT_DISTRIBUTION_ENGINE, HealthCheckStatus.UP, null, ClusterStatusDescription.OK.getDescription())), + UNAVAILABLE(new HealthCheckInfo(Constants.HC_COMPONENT_DISTRIBUTION_ENGINE, HealthCheckStatus.DOWN, null, ClusterStatusDescription.UNAVAILABLE.getDescription())), + NOT_CONFIGURED(new HealthCheckInfo(Constants.HC_COMPONENT_DISTRIBUTION_ENGINE, HealthCheckStatus.DOWN, null, ClusterStatusDescription.NOT_CONFIGURED.getDescription())), + DISABLED(new HealthCheckInfo(Constants.HC_COMPONENT_DISTRIBUTION_ENGINE, HealthCheckStatus.DOWN, null, ClusterStatusDescription.DISABLED.getDescription())); private HealthCheckInfo healthCheckInfo; @@ -64,6 +64,8 @@ public interface INotificationData { /** List of the artifacts */ List<ArtifactInfoImpl> getServiceArtifacts(); + String getWorkloadContext(); + void setDistributionID(String distributionId); /** Logical Service Name. */ @@ -99,4 +101,6 @@ public interface INotificationData { /** List of the Resource Instances */ void setServiceArtifacts(List<ArtifactInfoImpl> artifacts); + void setWorkloadContext(String workloadContext); + } @@ -32,6 +32,7 @@ public class NotificationDataImpl implements INotificationData { private String serviceInvariantUUID; private List<JsonContainerResourceInstance> resources; private List<ArtifactInfoImpl> serviceArtifacts; + private String workloadContext; @Override public String getDistributionID() { @@ -76,12 +77,25 @@ public class NotificationDataImpl implements INotificationData { public void setServiceDescription(String serviceDescription) { this.serviceDescription = serviceDescription; } + @Override + public String getWorkloadContext() { return workloadContext; } + + @Override + public void setWorkloadContext(String workloadContext) { this.workloadContext = workloadContext; } - @Override public String toString() { - return "NotificationDataImpl [distributionID=" + distributionID + ", serviceName=" + serviceName + ", serviceVersion=" + serviceVersion + ", serviceUUID=" + serviceUUID + ", serviceDescription=" + serviceDescription - + ", serviceInvariantUUID=" + serviceInvariantUUID + ", resources=" + resources + ", serviceArtifacts=" + serviceArtifacts + "]"; + return "NotificationDataImpl{" + + "distributionID='" + distributionID + '\'' + + ", serviceName='" + serviceName + '\'' + + ", serviceVersion='" + serviceVersion + '\'' + + ", serviceUUID='" + serviceUUID + '\'' + + ", serviceDescription='" + serviceDescription + '\'' + + ", serviceInvariantUUID='" + serviceInvariantUUID + '\'' + + ", resources=" + resources + + ", serviceArtifacts=" + serviceArtifacts + + ", workloadContext='" + workloadContext + '\'' + + '}'; } @Override @@ -101,7 +101,10 @@ public class ServiceDistributionArtifactsBuilder { notificationData.setServiceUUID(service.getUUID()); notificationData.setServiceDescription(service.getDescription()); notificationData.setServiceInvariantUUID(service.getInvariantUUID()); - + String workloadContext= ConfigurationManager.getConfigurationManager().getConfiguration().getWorkloadContext(); + if(workloadContext!=null){ + notificationData.setWorkloadContext(workloadContext); + } logger.debug("Before returning notification data object {}", notificationData); return notificationData; @@ -198,7 +201,7 @@ public class ServiceDistributionArtifactsBuilder { } JsonContainerResourceInstance jsonContainer = new JsonContainerResourceInstance(resourceInstance, resoucreType, - artifacts); + rebuildArtifactswith120TimeoutInsteadOf60(artifacts)/*TODO used to send artifacts, the function is a fix to the short timeout bug in distribution*/); jsonContainer.setResourceInvariantUUID(resourceInvariantUUID); jsonContainer.setCategory(resourceCategory); jsonContainer.setSubcategory(resourceSubcategory); @@ -208,6 +211,15 @@ public class ServiceDistributionArtifactsBuilder { return ret; } + private List<ArtifactInfoImpl> rebuildArtifactswith120TimeoutInsteadOf60(List<ArtifactInfoImpl> artifacts) { + for(ArtifactInfoImpl artifact : artifacts){ + if(artifact.getArtifactTimeout().equals(60)){ + artifact.setArtifactTimeout(120); + } + } + return artifacts; + } + private List<ArtifactDefinition> getArtifactsWithPayload(ComponentInstance resourceInstance) { List<ArtifactDefinition> ret = new ArrayList<ArtifactDefinition>(); @@ -20,13 +20,11 @@ package org.openecomp.sdc.be.components.distribution.engine; -import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Optional; import java.util.stream.Collectors; -import org.apache.commons.collections.CollectionUtils; import org.openecomp.sdc.be.model.GroupDefinition; import org.openecomp.sdc.be.model.GroupInstance; import org.openecomp.sdc.be.model.GroupInstanceProperty; @@ -20,13 +20,6 @@ package org.openecomp.sdc.be.components.impl; -import org.openecomp.sdc.be.components.ArtifactsResolver; -import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; -import org.openecomp.sdc.be.model.ArtifactDefinition; -import org.openecomp.sdc.be.model.Component; -import org.openecomp.sdc.be.model.ComponentInstance; -import org.openecomp.sdc.be.model.Service; - import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -34,6 +27,13 @@ import java.util.List; import java.util.Map; import java.util.Optional; +import org.openecomp.sdc.be.components.ArtifactsResolver; +import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; +import org.openecomp.sdc.be.model.ArtifactDefinition; +import org.openecomp.sdc.be.model.Component; +import org.openecomp.sdc.be.model.ComponentInstance; +import org.openecomp.sdc.be.model.Service; + @org.springframework.stereotype.Component("artifact-resolver") public class ArtifactResolverImpl implements ArtifactsResolver { @@ -63,6 +63,7 @@ import org.openecomp.sdc.be.datatypes.elements.GroupDataDefinition; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; +import org.openecomp.sdc.be.info.ArtifactTemplateInfo; import org.openecomp.sdc.be.model.ArtifactDefinition; import org.openecomp.sdc.be.model.ArtifactType; import org.openecomp.sdc.be.model.Component; @@ -111,12 +112,19 @@ import org.openecomp.sdc.exception.ResponseFormat; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import org.xml.sax.*; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; +import org.xml.sax.SAXNotRecognizedException; +import org.xml.sax.SAXNotSupportedException; +import org.xml.sax.XMLReader; import org.yaml.snakeyaml.Yaml; import com.google.gson.Gson; import com.google.gson.GsonBuilder; -import com.sun.org.apache.xerces.internal.parsers.SAXParser; + +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.parsers.SAXParser; +import javax.xml.parsers.SAXParserFactory; import fj.data.Either; @@ -142,7 +150,7 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic { // private static final Integer NON_HEAT_TIMEOUT = 0; private static Logger log = LoggerFactory.getLogger(ArtifactsBusinessLogic.class.getName()); private Gson gson = new GsonBuilder().setPrettyPrinting().create(); - + private static XMLReader parser; @javax.annotation.Resource private IInterfaceLifecycleOperation interfaceLifecycleOperation; @javax.annotation.Resource @@ -198,7 +206,30 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic { } } + + //SAX XML Parser initialization + static { + SAXParserFactory spf = SAXParserFactory.newInstance(); + SAXParser newSAXParser = null; + + try { + newSAXParser = spf.newSAXParser(); + parser = newSAXParser.getXMLReader(); + } catch (ParserConfigurationException | SAXException e1) { + log.debug("SAX XML Parser could not been initialized", e1); + } + + try { + parser.setFeature("http://apache.org/xml/features/validation/schema", false); + } catch (SAXNotRecognizedException e) { + log.debug("SAX Xml parser couldn't set feature: \"http://apache.org/xml/features/validation/schema\", false", e.getMessage(), e); + + } catch (SAXNotSupportedException e) { + log.debug("SAX Xml parser couldn't set feature: \"http://apache.org/xml/features/validation/schema\", false", e.getMessage(), e); + } + } + public class ArtifactOperationInfo { private ArtifactOperationEnum artifactOperationEnum; @@ -438,8 +469,10 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic { } } return result; - case Create: - return handleCreate(componentId, artifactInfo, operation, auditingAction, user, componentType, parent, origMd5, originData, interfaceName, operationName, shouldLock, inTransaction); + case Create: + return handleCreate(componentId, artifactInfo, operation, auditingAction, user, componentType, parent, origMd5, originData, interfaceName, operationName, shouldLock, inTransaction); + case Link: + return handleLink(componentId, artifactInfo, operation, auditingAction, user, componentType, parent, origMd5, originData, interfaceName, operationName, shouldLock, inTransaction); } return null; } @@ -603,16 +636,6 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic { } } - /** - * - * @param componentId - * @param artifactId - * @param userId - * @param componentType - * @param parentId - * @return - */ - public Either<ImmutablePair<String, byte[]>, ResponseFormat> handleDownloadToscaModelRequest(Component component, ArtifactDefinition csarArtifact) { if (artifactGenerationRequired(component, csarArtifact)) { Either<byte[], ResponseFormat> generated = csarUtils.createCsar(component, false, false); @@ -839,6 +862,30 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic { } + private Either<Either<ArtifactDefinition, Operation>, ResponseFormat> handleLink(String componentId, ArtifactDefinition artifactInfo, ArtifactOperationInfo operation, AuditingActionEnum auditingAction, User user, ComponentTypeEnum componentType, + org.openecomp.sdc.be.model.Component parent, String origMd5, String originData, String interfaceType, String operationName, boolean shouldLock, boolean inTransaction) { + + if (shouldLock) { + Either<Boolean, ResponseFormat> lockComponent = lockComponent(parent, "Upload Artifact - lock "); + if (lockComponent.isRight()) { + handleAuditing(auditingAction, parent, componentId, user, null, null, null, lockComponent.right().value(), componentType, null); + return Either.right(lockComponent.right().value()); + } + } + Either<Either<ArtifactDefinition, Operation>, ResponseFormat> resultOp = null; + + try { + resultOp = createAndLinkArtifact(parent, componentId, artifactInfo, user, componentType, auditingAction); + return resultOp; + } finally { + if (shouldLock) { + unlockComponent(resultOp, parent, inTransaction); + } + + } + + } + private Either<Either<ArtifactDefinition, Operation>, ResponseFormat> lockComponentAndUpdateArtifact(String parentId, ArtifactDefinition artifactInfo, AuditingActionEnum auditingAction, String artifactId, User user, ComponentTypeEnum componentType, org.openecomp.sdc.be.model.Component parent, byte[] decodedPayload, String interfaceType, String operationName, boolean shouldLock, boolean inTransaction) { @@ -920,9 +967,9 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic { public void handleAuditing(AuditingActionEnum auditingActionEnum, Component component, String componentId, User user, ArtifactDefinition artifactDefinition, String prevArtifactUuid, String currentArtifactUuid, ResponseFormat responseFormat, ComponentTypeEnum componentTypeEnum, String resourceInstanceName) { - if (auditingActionEnum.getAuditingEsType().equals(AuditingTypesConstants.EXTERNAL_API_EVENT_TYPE)) { + if (auditingActionEnum != null && auditingActionEnum.getAuditingEsType().equals(AuditingTypesConstants.EXTERNAL_API_EVENT_TYPE)) { return; - } + } EnumMap<AuditingFieldsKeysEnum, Object> auditingFields = createArtifactAuditingFields(artifactDefinition, prevArtifactUuid, currentArtifactUuid); @@ -1019,9 +1066,11 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic { return Either.right(componentsUtils.getResponseFormat(ActionStatus.ARTIFACT_INVALID_MD5)); } } else { - if (operation.getArtifactOperationEnum() == ArtifactOperationEnum.Create) { - log.debug("Missing md5 header during artifact create"); - return Either.right(componentsUtils.getResponseFormat(ActionStatus.ARTIFACT_INVALID_MD5)); + if (ArtifactOperationEnum.isCreateOrLink(operation.getArtifactOperationEnum())) { + if (payload!=null && payload.length != 0) { + log.debug("Missing md5 header during artifact create"); + return Either.right(componentsUtils.getResponseFormat(ActionStatus.ARTIFACT_INVALID_MD5)); + } } // Update metadata if (payload != null && payload.length != 0) { @@ -1061,7 +1110,7 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic { // This is a patch to block possibility of updating service api fields // through other artifacts flow - if (operation.getArtifactOperationEnum() != ArtifactOperationEnum.Create) { + if (!ArtifactOperationEnum.isCreateOrLink(operation.getArtifactOperationEnum())) { checkAndSetUnUpdatableFields(user, artifactInfo, currentArtifactInfo, (operationName != null ? ArtifactGroupTypeEnum.LIFE_CYCLE : ArtifactGroupTypeEnum.INFORMATIONAL)); } else { checkCreateFields(user, artifactInfo, (operationName != null ? ArtifactGroupTypeEnum.LIFE_CYCLE : ArtifactGroupTypeEnum.INFORMATIONAL)); @@ -1073,7 +1122,7 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic { } // artifactGroupType is not allowed to be updated - if (operation.getArtifactOperationEnum() != ArtifactOperationEnum.Create) { + if (!ArtifactOperationEnum.isCreateOrLink(operation.getArtifactOperationEnum())) { Either<ArtifactDefinition, ResponseFormat> validateGroupType = validateOrSetArtifactGroupType(artifactInfo, currentArtifactInfo); if (validateGroupType.isRight()) { return Either.right(validateGroupType.right().value()); @@ -1083,7 +1132,7 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic { NodeTypeEnum parentType = convertParentType(componentType); // TODO TEMP !!! - boolean isCreate = operation.getArtifactOperationEnum() == ArtifactOperationEnum.Create; + boolean isCreate = ArtifactOperationEnum.isCreateOrLink(operation.getArtifactOperationEnum()); if (isDeploymentArtifact(artifactInfo)) { Either<Boolean, ResponseFormat> deploymentValidationResult = validateDeploymentArtifact(parentComponent, componentId, user.getUserId(), isCreate, artifactInfo, currentArtifactInfo, parentType); @@ -1159,11 +1208,11 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic { if (StringUtils.isNotEmpty(artifactId)) { foundArtifact = findArtifact(parentComponent, componentType, parentId, artifactId); } - if (foundArtifact != null && operation.getArtifactOperationEnum() == ArtifactOperationEnum.Create) { + if (foundArtifact != null && ArtifactOperationEnum.isCreateOrLink(operation.getArtifactOperationEnum())) { log.debug("Artifact {} already exist", artifactId); result = Either.right(componentsUtils.getResponseFormat(ActionStatus.ARTIFACT_EXIST, foundArtifact.getArtifactLabel())); } - if (foundArtifact == null && operation.getArtifactOperationEnum() != ArtifactOperationEnum.Create) { + if (foundArtifact == null && !ArtifactOperationEnum.isCreateOrLink(operation.getArtifactOperationEnum())) { log.debug("The artifact {} was not found on parent {}. ", artifactId, parentId); result = Either.right(componentsUtils.getResponseFormat(ActionStatus.ARTIFACT_NOT_FOUND, "")); } @@ -1272,7 +1321,22 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic { resultOp = Either.right(responseFormat); } } + boolean isNeedToDeleteArtifactFromDB = true; if (resultOp == null) { + + if(componentType == ComponentTypeEnum.RESOURCE_INSTANCE){ + String instanceId = parentId; + Either<Boolean, ActionStatus> isOnlyResourceInstanceArtifact = isArtifactOnlyResourceInstanceArtifact(foundArtifact, fetchedContainerComponent, instanceId); + + if (isOnlyResourceInstanceArtifact.isRight()) { + log.debug("Failed to delete or update the artifact {}. Parent uniqueId is {}", artifactId, parentId); + responseFormat = componentsUtils.getResponseFormatByArtifactId(isOnlyResourceInstanceArtifact.right().value(), foundArtifact.getArtifactDisplayName()); + handleAuditing(auditingAction, parent, parentId, user, null, null, artifactId, responseFormat, componentType, null); + resultOp = Either.right(responseFormat); + } + isNeedToDeleteArtifactFromDB = isOnlyResourceInstanceArtifact.left().value(); + } + Either<ArtifactDataDefinition, StorageOperationStatus> updatedArtifactRes = deleteOrUpdateArtifactOnGraph(parent, parentId, artifactId, parentType, foundArtifact, needCloneRes.left().value()); if (updatedArtifactRes.isRight()) { log.debug("Failed to delete or update the artifact {}. Parent uniqueId is {}", artifactId, parentId); @@ -1285,13 +1349,16 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic { } if (resultOp == null && (!needCloneRes.left().value() && !isDuplicated)) { - log.debug("Going to delete the artifact {} from the database. ", artifactId); - CassandraOperationStatus cassandraStatus = artifactCassandraDao.deleteArtifact(esId); - if (cassandraStatus != CassandraOperationStatus.OK) { - log.debug("Failed to delete the artifact {} from the database. ", artifactId); - responseFormat = componentsUtils.getResponseFormatByArtifactId(componentsUtils.convertFromStorageResponse(convertToStorageOperationStatus(cassandraStatus)), foundArtifact.getArtifactDisplayName()); - handleAuditing(auditingAction, parent, parentId, user, null, null, artifactId, responseFormat, componentType, null); - resultOp = Either.right(responseFormat); + + if(isNeedToDeleteArtifactFromDB){ + log.debug("Going to delete the artifact {} from the database. ", artifactId); + CassandraOperationStatus cassandraStatus = artifactCassandraDao.deleteArtifact(esId); + if (cassandraStatus != CassandraOperationStatus.OK) { + log.debug("Failed to delete the artifact {} from the database. ", artifactId); + responseFormat = componentsUtils.getResponseFormatByArtifactId(componentsUtils.convertFromStorageResponse(convertToStorageOperationStatus(cassandraStatus)), foundArtifact.getArtifactDisplayName()); + handleAuditing(auditingAction, parent, parentId, user, null, null, artifactId, responseFormat, componentType, null); + resultOp = Either.right(responseFormat); + } } } if (resultOp == null && componentType == ComponentTypeEnum.RESOURCE_INSTANCE) { @@ -1340,6 +1407,40 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic { } } + private Either<Boolean, ActionStatus> isArtifactOnlyResourceInstanceArtifact( ArtifactDefinition foundArtifact, Component parent, String instanceId) { + Either<Boolean, ActionStatus> result = Either.left(true); + ComponentInstance foundInstance = null; + Optional<ComponentInstance> componentInstanceOpt = parent.getComponentInstances().stream().filter(i -> i.getUniqueId().equals(instanceId)).findFirst(); + if (!componentInstanceOpt.isPresent()) { + result = Either.right(ActionStatus.COMPONENT_INSTANCE_NOT_FOUND_ON_CONTAINER); + } else { + foundInstance = componentInstanceOpt.get(); + String componentUid = foundInstance.getComponentUid(); + Either<Component, StorageOperationStatus> getContainerRes = toscaOperationFacade.getToscaElement(parent.getUniqueId()); + if (getContainerRes.isRight()) { + log.debug("Failed to fetch the container component {}. ", componentUid); + result = Either.right(componentsUtils.convertFromStorageResponse(getContainerRes.right().value())); + } + Component origComponent = getContainerRes.left().value(); + Map<String, ArtifactDefinition> deploymentArtifacts = origComponent.getDeploymentArtifacts(); + if( deploymentArtifacts!= null && !deploymentArtifacts.isEmpty()){ + Optional<String> op = deploymentArtifacts.keySet().stream().filter(a -> a.equals(foundArtifact.getArtifactLabel())).findAny(); + if(op.isPresent()){ + return Either.left(false); + } + } + Map<String, ArtifactDefinition> artifacts = origComponent.getArtifacts(); + if( artifacts!= null && !artifacts.isEmpty()){ + Optional<String> op = artifacts.keySet().stream().filter(a -> a.equals(foundArtifact.getArtifactLabel())).findAny(); + if(op.isPresent()){ + return Either.left(false); + } + } + + } + return result; + } + private List<GroupDataDefinition> getUpdatedGroups(String artifactId, ArtifactDefinition foundArtifact, List<GroupDefinition> groups) { List<GroupDataDefinition> updatedGroups = new ArrayList<>(); boolean isUpdated = false; @@ -1393,7 +1494,7 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic { if (isMandatory) { log.debug("Going to update mandatory artifact {} from the component {}", artifactId, parentId); resetMandatoryArtifactFields(foundArtifact); - result = artifactToscaOperation.updateArtifactOnGraph(componentId, foundArtifact, parentType, artifactId, instanceId, true); + result = artifactToscaOperation.updateArtifactOnGraph(componentId, foundArtifact, parentType, artifactId, instanceId, true, true); } else if (cloneIsNeeded) { log.debug("Going to clone artifacts and to delete the artifact {} from the component {}", artifactId, parentId); result = artifactToscaOperation.deleteArtifactWithClonnigOnGraph(componentId, foundArtifact, parentType, instanceId, false); @@ -1540,13 +1641,13 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic { private Either<ArtifactDefinition, ResponseFormat> fetchCurrentArtifact(String parentId, ArtifactOperationInfo operation, String artifactId) { Either<ArtifactDefinition, StorageOperationStatus> artifactById = artifactToscaOperation.getArtifactById(parentId, artifactId); - if (!(operation.getArtifactOperationEnum() == ArtifactOperationEnum.Create) && artifactById.isRight()) { + if (!(ArtifactOperationEnum.isCreateOrLink(operation.getArtifactOperationEnum())) && artifactById.isRight()) { // in case of update artifact must be BeEcompErrorManager.getInstance().logBeArtifactMissingError("Artifact Update / Upload", artifactId); log.debug("Failed to fetch artifact {}. error: {}", artifactId, artifactById.right().value()); return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(artifactById.right().value()), artifactId)); } - if (operation.getArtifactOperationEnum() == ArtifactOperationEnum.Create && artifactById.isLeft()) { + if (ArtifactOperationEnum.isCreateOrLink(operation.getArtifactOperationEnum()) && artifactById.isLeft()) { log.debug("Artifact {} already exist", artifactId); return Either.right(componentsUtils.getResponseFormat(ActionStatus.ARTIFACT_EXIST, artifactById.left().value().getArtifactLabel())); } @@ -1567,7 +1668,7 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic { log.debug("missing artifact logical name for component {}", componentId); return Either.right(componentsUtils.getResponseFormat(ActionStatus.MISSING_DATA, ARTIFACT_LABEL)); } - if (operation.getArtifactOperationEnum() == ArtifactOperationEnum.Create && !artifactInfo.getMandatory()) { + if (ArtifactOperationEnum.isCreateOrLink(operation.getArtifactOperationEnum()) && !artifactInfo.getMandatory()) { if (operationName != null) { if (artifactInfo.getArtifactLabel() != null && !operationName.equals(artifactInfo.getArtifactLabel())) { @@ -1647,6 +1748,52 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic { // *************************************************************** + private Either<Either<ArtifactDefinition, Operation>, ResponseFormat> createAndLinkArtifact(org.openecomp.sdc.be.model.Component parent, String parentId, ArtifactDefinition artifactInfo, User user, + ComponentTypeEnum componentTypeEnum, AuditingActionEnum auditingActionEnum) { + Either<Either<ArtifactDefinition, Operation>, ResponseFormat> resultOp = null; + Either<ArtifactDefinition, Operation> insideEither = null; + ComponentInstance foundInstance = findComponentInstance(parentId, parent); + String instanceId = null; + String instanceName = null; + if (foundInstance != null) { + instanceId = foundInstance.getUniqueId(); + instanceName = foundInstance.getName(); + } + boolean isLeft = false; + String artifactUniqueId = null; + StorageOperationStatus error = null; + // information/deployment/api aritfacts + log.trace("Try to create entry on graph"); + NodeTypeEnum nodeType = convertParentType(componentTypeEnum); + Either<ArtifactDefinition, StorageOperationStatus> result = artifactToscaOperation.addArifactToComponent(artifactInfo, parent.getUniqueId(), nodeType, true, instanceId); + + isLeft = result.isLeft(); + if (isLeft) { + artifactUniqueId = result.left().value().getUniqueId(); + result.left().value(); + + insideEither = Either.left(result.left().value()); + resultOp = Either.left(insideEither); + + error = generateCustomizationUUIDOnInstance(parent.getUniqueId(), parentId, componentTypeEnum); + if (error != StorageOperationStatus.OK) { + isLeft = false; + } + + } if (isLeft) { + ResponseFormat responseFormat = componentsUtils.getResponseFormat(ActionStatus.OK); + handleAuditing(auditingActionEnum, parent, parentId, user, artifactInfo, artifactUniqueId, artifactUniqueId, responseFormat, componentTypeEnum, instanceName); + return resultOp; + } else{ + log.debug("Failed to create entry on graph for artifact {}", artifactInfo.getArtifactName()); + ResponseFormat responseFormat = componentsUtils.getResponseFormatByArtifactId(componentsUtils.convertFromStorageResponse(error), artifactInfo.getArtifactDisplayName()); + handleAuditing(auditingActionEnum, parent, parentId, user, artifactInfo, null, null, responseFormat, componentTypeEnum, instanceName); + resultOp = Either.right(responseFormat); + return resultOp; + + } + } + private Either<Either<ArtifactDefinition, Operation>, ResponseFormat> createArtifact(org.openecomp.sdc.be.model.Component parent, String parentId, ArtifactDefinition artifactInfo, byte[] decodedPayload, User user, ComponentTypeEnum componentTypeEnum, AuditingActionEnum auditingActionEnum, String interfaceType, String operationName) { @@ -2039,27 +2186,20 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic { } } - @SuppressWarnings("restriction") public boolean isValidXml(byte[] xmlToParse) { - XMLReader parser = new SAXParser(); - try { - parser.setFeature("http://apache.org/xml/features/validation/schema", false); - } catch (SAXNotRecognizedException e) { - e.printStackTrace(); - log.debug("Xml parser couldn't set feature: \"http://apache.org/xml/features/validation/schema\", false", e.getMessage(), e); - - } catch (SAXNotSupportedException e) { - e.printStackTrace(); - log.debug("Xml parser couldn't set feature: \"http://apache.org/xml/features/validation/schema\", false", e.getMessage(), e); - + if(parser == null) { + log.debug("SAX XML Parser have not been initialized"); + return false; } boolean isXmlValid = true; + try { parser.parse(new InputSource(new ByteArrayInputStream(xmlToParse))); } catch (IOException | SAXException e) { log.debug("Xml is invalid : {}", e.getMessage(), e); isXmlValid = false; } + return isXmlValid; } @@ -2898,22 +3038,6 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic { } - public StorageOperationStatus deleteAllComponentArtifactsIfNotOnGraph(List<ArtifactDefinition> artifacts) { - - if (artifacts != null && !artifacts.isEmpty()) { - for (ArtifactDefinition artifactDefinition : artifacts) { - String esId = artifactDefinition.getEsId(); - if (esId != null && !esId.isEmpty()) { - StorageOperationStatus deleteIfNotOnGraph = deleteIfNotOnGraph(artifactDefinition.getUniqueId(), esId, false); - if (!deleteIfNotOnGraph.equals(StorageOperationStatus.OK)) { - return deleteIfNotOnGraph; - } - } - } - } - return StorageOperationStatus.OK; - } - private Operation convertToOperation(ArtifactDefinition artifactInfo, String operationName) { Operation op = new Operation(); long time = System.currentTimeMillis(); @@ -2933,31 +3057,6 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic { return newArtifactName; } - public StorageOperationStatus deleteIfNotOnGraph(String artifactId, String artifactEsId, boolean deleteOnlyPayload) { - log.debug("deleteIfNotOnGraph: delete only payload = {}", deleteOnlyPayload); - // Either<ArtifactData, TitanOperationStatus> checkArtifactNode = titanDao.getNode(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.ArtifactRef), artifactId, ArtifactData.class); - // if ((artifactEsId != null && !artifactEsId.isEmpty())) { - // boolean isNotExistOnGraph = checkArtifactNode.isRight() && checkArtifactNode.right().value().equals(TitanOperationStatus.NOT_FOUND); - // - // if ((isNotExistOnGraph) || (checkArtifactNode.left().value().getArtifactDataDefinition().getMandatory() && deleteOnlyPayload) - // || (ArtifactGroupTypeEnum.SERVICE_API.equals(checkArtifactNode.left().value().getArtifactDataDefinition().getArtifactGroupType()) && deleteOnlyPayload)) { - // // last one. need to delete in ES - // log.debug("Entry on graph is deleted. Delete artifact in ES for id = {}", artifactEsId); - // artifactCassandraDao.deleteArtifact(artifactEsId); - // return StorageOperationStatus.OK; - // // return - // // componentsUtils.getResponseFormatByResourceId(ActionStatus.OK, - // // resourceId); - // - // } else { - // log.debug("Entry on graph is deleted. Exist more connections on this artifact. Don't delete artifact in ES for id = {}", artifactEsId); - // return StorageOperationStatus.OK; - // } - // - // } - return StorageOperationStatus.OK; - } - // download by MSO public Either<byte[], ResponseFormat> downloadRsrcArtifactByNames(String serviceName, String serviceVersion, String resourceName, String resourceVersion, String artifactName) { @@ -3512,35 +3611,46 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic { String payload = generateHeatEnvPayload(artifactDefinition); String prevUUID = artifactDefinition.getArtifactUUID(); ArtifactDefinition clonedBeforeGenerate = new ArtifactDefinition(artifactDefinition); - Either<ArtifactDefinition, ResponseFormat> generateResult = generateAndSaveHeatEnvArtifact(artifactDefinition, payload, componentType, component, resourceInstanceName, modifier, shouldLock, instanceId); - if (generateResult.isLeft()) { - ArtifactDefinition updatedArtDef = generateResult.left().value(); - if (!prevUUID.equals(updatedArtDef.getArtifactUUID())) { - List<ComponentInstance> componentInstances = component.getComponentInstances(); - if (componentInstances != null) { - Optional<ComponentInstance> findFirst = componentInstances.stream().filter(ci -> ci.getUniqueId().equals(instanceId)).findFirst(); - if (findFirst.isPresent()) { - ComponentInstance relevantInst = findFirst.get(); - List<GroupInstance> updatedGroupInstances = getUpdatedGroupInstances(updatedArtDef.getUniqueId(), clonedBeforeGenerate, relevantInst.getGroupInstances()); - - if (CollectionUtils.isNotEmpty(updatedGroupInstances)) { - updatedGroupInstances.forEach(gi -> { - gi.getGroupInstanceArtifacts().add(updatedArtDef.getUniqueId()); - gi.getGroupInstanceArtifactsUuid().add(updatedArtDef.getArtifactUUID()); - }); - Either<List<GroupInstance>, StorageOperationStatus> status = toscaOperationFacade.updateGroupInstancesOnComponent(component, componentType, instanceId, updatedGroupInstances); - if (status.isRight()) { - log.debug("Failed to update groups of the component {}. ", component.getUniqueId()); - ResponseFormat responseFormat = componentsUtils.getResponseFormatByArtifactId(componentsUtils.convertFromStorageResponse(status.right().value()), clonedBeforeGenerate.getArtifactDisplayName()); - return Either.right(responseFormat); - } - } - } - } - } - } + return generateAndSaveHeatEnvArtifact(artifactDefinition, payload, componentType, component, resourceInstanceName, modifier, shouldLock, instanceId) + .left() + .bind(artifactDef -> updateArtifactOnGroupInstance(componentType, component, instanceId, prevUUID, clonedBeforeGenerate, artifactDef)); + } - return generateResult; + public Either<ArtifactDefinition, ResponseFormat> forceGenerateHeatEnvArtifact(ArtifactDefinition artifactDefinition, ComponentTypeEnum componentType, org.openecomp.sdc.be.model.Component component, String resourceInstanceName, User modifier, + boolean shouldLock, String instanceId) { + String payload = generateHeatEnvPayload(artifactDefinition); + String prevUUID = artifactDefinition.getArtifactUUID(); + ArtifactDefinition clonedBeforeGenerate = new ArtifactDefinition(artifactDefinition); + return forceGenerateAndSaveHeatEnvArtifact(artifactDefinition, payload, componentType, component, resourceInstanceName, modifier, shouldLock, instanceId) + .left() + .bind(artifactDef -> updateArtifactOnGroupInstance(componentType, component, instanceId, prevUUID, clonedBeforeGenerate, artifactDef)); + } + + private Either<ArtifactDefinition, ResponseFormat> updateArtifactOnGroupInstance(ComponentTypeEnum componentType, Component component, String instanceId, String prevUUID, ArtifactDefinition clonedBeforeGenerate, ArtifactDefinition updatedArtDef) { + if (!prevUUID.equals(updatedArtDef.getArtifactUUID())) { + List<ComponentInstance> componentInstances = component.getComponentInstances(); + if (componentInstances != null) { + Optional<ComponentInstance> findFirst = componentInstances.stream().filter(ci -> ci.getUniqueId().equals(instanceId)).findFirst(); + if (findFirst.isPresent()) { + ComponentInstance relevantInst = findFirst.get(); + List<GroupInstance> updatedGroupInstances = getUpdatedGroupInstances(updatedArtDef.getUniqueId(), clonedBeforeGenerate, relevantInst.getGroupInstances()); + + if (CollectionUtils.isNotEmpty(updatedGroupInstances)) { + updatedGroupInstances.forEach(gi -> { + gi.getGroupInstanceArtifacts().add(updatedArtDef.getUniqueId()); + gi.getGroupInstanceArtifactsUuid().add(updatedArtDef.getArtifactUUID()); + }); + Either<List<GroupInstance>, StorageOperationStatus> status = toscaOperationFacade.updateGroupInstancesOnComponent(component, componentType, instanceId, updatedGroupInstances); + if (status.isRight()) { + log.debug("Failed to update groups of the component {}. ", component.getUniqueId()); + ResponseFormat responseFormat = componentsUtils.getResponseFormatByArtifactId(componentsUtils.convertFromStorageResponse(status.right().value()), clonedBeforeGenerate.getArtifactDisplayName()); + return Either.right(responseFormat); + } + } + } + } + } + return Either.left(updatedArtDef); } private String generateHeatEnvPayload(ArtifactDefinition artifactDefinition) { @@ -3628,6 +3738,13 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic { } + public Either<ArtifactDefinition, ResponseFormat> forceGenerateAndSaveHeatEnvArtifact(ArtifactDefinition artifactDefinition, String payload, ComponentTypeEnum componentType, org.openecomp.sdc.be.model.Component component, String resourceInstanceName, + User modifier, boolean shouldLock, String instanceId) { + return generateArtifactPayload(artifactDefinition, componentType, component, resourceInstanceName, modifier, shouldLock, System::currentTimeMillis, + () -> createEsHeatEnvArtifactDataFromString(artifactDefinition, payload), instanceId); + + } + protected Either<ArtifactDefinition, ResponseFormat> generateArtifactPayload(ArtifactDefinition artifactDefinition, ComponentTypeEnum componentType, org.openecomp.sdc.be.model.Component component, String resourceInstanceName, User modifier, boolean shouldLock, Supplier<Long> payloadUpdateDateGen, Supplier<Either<ESArtifactData, ResponseFormat>> esDataCreator, String instanceId) { @@ -3743,6 +3860,57 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic { return Either.left(artifactDefinition); } + + public Map<String, Object> buildJsonForUpdateArtifact(ArtifactDefinition artifactDef, ArtifactGroupTypeEnum artifactGroupType, List<ArtifactTemplateInfo> updatedRequiredArtifacts) { + return this.buildJsonForUpdateArtifact(artifactDef.getUniqueId(), artifactDef.getArtifactName(), artifactDef.getArtifactType(), artifactGroupType, artifactDef.getArtifactLabel(), artifactDef.getArtifactDisplayName(), + artifactDef.getDescription(), artifactDef.getPayloadData(), updatedRequiredArtifacts, artifactDef.getListHeatParameters()); + + } + + public Map<String, Object> buildJsonForUpdateArtifact(String artifactId, String artifactName, String artifactType, ArtifactGroupTypeEnum artifactGroupType, String label, String displayName, String description, byte[] artifactContent, + List<ArtifactTemplateInfo> updatedRequiredArtifacts, List<HeatParameterDefinition> heatParameters) { + + Map<String, Object> json = new HashMap<String, Object>(); + if (artifactId != null && !artifactId.isEmpty()) + json.put(Constants.ARTIFACT_ID, artifactId); + + json.put(Constants.ARTIFACT_NAME, artifactName); + json.put(Constants.ARTIFACT_TYPE, artifactType); + json.put(Constants.ARTIFACT_DESCRIPTION, description); + + if (artifactContent != null) { + String encodedPayload = new String(artifactContent); + + // boolean isEncoded = GeneralUtility.isBase64Encoded(artifactContentent); + // if (!isEncoded) { + log.debug("payload is encoded. perform decode"); + encodedPayload = Base64.encodeBase64String(artifactContent); + json.put(Constants.ARTIFACT_PAYLOAD_DATA, encodedPayload); + } + // } + json.put(Constants.ARTIFACT_DISPLAY_NAME, displayName); + json.put(Constants.ARTIFACT_LABEL, label); + json.put(Constants.ARTIFACT_GROUP_TYPE, artifactGroupType.getType()); + json.put(Constants.REQUIRED_ARTIFACTS, (updatedRequiredArtifacts == null || updatedRequiredArtifacts.isEmpty()) ? new ArrayList<>() + : updatedRequiredArtifacts.stream().filter(e -> e.getType().equals(ArtifactTypeEnum.HEAT_ARTIFACT.getType()) || e.getType().equals(ArtifactTypeEnum.HEAT_NESTED.getType())).map(e -> e.getFileName()).collect(Collectors.toList())); + json.put(Constants.ARTIFACT_HEAT_PARAMS, (heatParameters == null || heatParameters.isEmpty()) ? new ArrayList<>() + : heatParameters); + return json; + } + + public Either<Either<ArtifactDefinition, Operation>, ResponseFormat> updateResourceInstanceArtifactNoContent(String resourceId, Component containerComponent, User user, Map<String, Object> json, ArtifactOperationInfo operation, ArtifactDefinition artifactInfo) { + + String jsonStr = gson.toJson(json); + ArtifactDefinition artifactDefinitionFromJson = artifactInfo == null? RepresentationUtils.convertJsonToArtifactDefinition(jsonStr, ArtifactDefinition.class) : artifactInfo; + String artifactUniqueId = artifactDefinitionFromJson == null ? null : artifactDefinitionFromJson.getUniqueId(); + Either<Either<ArtifactDefinition, Operation>, ResponseFormat> uploadArtifactToService = validateAndHandleArtifact(resourceId, ComponentTypeEnum.RESOURCE_INSTANCE, operation, artifactUniqueId, + artifactDefinitionFromJson, null, jsonStr, null, null, null, user, containerComponent, false, false, true); + if (uploadArtifactToService.isRight()) + return Either.right(uploadArtifactToService.right().value()); + + return Either.left(uploadArtifactToService.left().value()); + } + private Either<Either<ArtifactDefinition, Operation>, ResponseFormat> handleUpdateHeatEnv(String componentId, ArtifactDefinition artifactInfo, AuditingActionEnum auditingAction, String artifactId, User user, ComponentTypeEnum componentType, org.openecomp.sdc.be.model.Component parent, String originData, String origMd5, ArtifactOperationInfo operation, boolean shouldLock, boolean inTransaction) { convertParentType(componentType); @@ -3789,7 +3957,7 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic { } Either<Either<ArtifactDefinition, Operation>, ResponseFormat> resultOp = null; try { - resultOp = updateHeatEnvParams(componentId, artifactId, artifactInfo, user, auditingAction, parent, componentType, currArtifact, origMd5, inTransaction); + resultOp = updateHeatEnvParams(componentId, artifactId, artifactInfo, user, auditingAction, parent, componentType, origMd5); return resultOp; } finally { @@ -3812,7 +3980,7 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic { } private Either<Either<ArtifactDefinition, Operation>, ResponseFormat> updateHeatEnvParams(String componentId, String artifactId, ArtifactDefinition artifactInfo, User user, AuditingActionEnum auditingAction, Component parent, - ComponentTypeEnum componentType, ArtifactDefinition currArtifact1, String origMd5, boolean inTransaction) { + ComponentTypeEnum componentType, String origMd5) { Either<Either<ArtifactDefinition, Operation>, ResponseFormat> resultOp = null; Either<ArtifactDefinition, Operation> insideEither = null; @@ -3859,22 +4027,9 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic { } if (updatedHeatEnvParams != null && !updatedHeatEnvParams.isEmpty()) { - String paramName; // fill reduced heat env parameters List for updating - for (HeatParameterDefinition heatEnvParam : updatedHeatEnvParams) { - paramName = heatEnvParam.getName(); - for (HeatParameterDefinition currHeatParam : currentHeatEnvParams) { - if (paramName.equalsIgnoreCase(currHeatParam.getName())) { - String updatedParamValue = heatEnvParam.getCurrentValue(); - if (updatedParamValue != null && updatedParamValue.equals("")) { // reset - currHeatParam.setCurrentValue(heatEnvParam.getDefaultValue()); - } else if (updatedParamValue != null) { - currHeatParam.setCurrentValue(updatedParamValue); - } - } - } - } - //currArtifact.setHeatParamsUpdateDate(System.currentTimeMillis()); + replaceCurrHeatValueWithUpdatedValue(currentHeatEnvParams, updatedHeatEnvParams); + currArtifact.setHeatParamsUpdateDate(System.currentTimeMillis()); currArtifact.setListHeatParameters(currentHeatEnvParams); Either<ArtifactDefinition, StorageOperationStatus> updateArifactRes = artifactToscaOperation.updateArifactOnResource(currArtifact, parent.getUniqueId(), currArtifact.getUniqueId(), componentType.getNodeType(), componentId); @@ -3899,8 +4054,6 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic { } } - // } - insideEither = Either.left(currArtifact); resultOp = Either.left(insideEither); ResponseFormat responseFormat = componentsUtils.getResponseFormat(ActionStatus.OK); @@ -3908,6 +4061,18 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic { return resultOp; } + private void replaceCurrHeatValueWithUpdatedValue(List<HeatParameterDefinition> currentHeatEnvParams, List<HeatParameterDefinition> updatedHeatEnvParams) { + for (HeatParameterDefinition heatEnvParam : updatedHeatEnvParams) { + String paramName = heatEnvParam.getName(); + for (HeatParameterDefinition currHeatParam : currentHeatEnvParams) { + if (paramName.equalsIgnoreCase(currHeatParam.getName())) { + String updatedParamValue = heatEnvParam.getCurrentValue(); + currHeatParam.setCurrentValue(updatedParamValue); + } + } + } + } + private Either<Either<ArtifactDefinition, Operation>, ResponseFormat> updateHeatParams(String componentId, String artifactId, ArtifactDefinition artifactEnvInfo, User user, AuditingActionEnum auditingAction, Component parent, ComponentTypeEnum componentType, ArtifactDefinition currHeatArtifact, String origMd5, boolean needToUpdateGroup) { @@ -3929,9 +4094,6 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic { } ESArtifactData esArtifactData = artifactfromES.left().value(); - byte[] data = esArtifactData.getDataAsArray(); - - ArtifactDefinition updatedHeatArt = currHeatArtifact; List<HeatParameterDefinition> updatedHeatEnvParams = artifactEnvInfo.getListHeatParameters(); @@ -4149,7 +4311,7 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic { * * @param componentType * @param componentUuid - * @param resourceName + * @param resourceInstanceName * @param artifactUUID * @param auditAdditionalParam * @return @@ -4574,15 +4736,9 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic { return artifactId; } - public Either<ArtifactDefinition, ResponseFormat> createHeatEnvPlaceHolder(ArtifactDefinition artifact, String envType, String parentId, NodeTypeEnum parentType, String parentName, User user, Component component, - Map<String, String> existingEnvVersions) { - return createHeatEnvPlaceHolder(artifact, envType, parentId, parentType, parentName, user, component, existingEnvVersions, true); - - } - @SuppressWarnings("unchecked") - public Either<ArtifactDefinition, ResponseFormat> createHeatEnvPlaceHolder(ArtifactDefinition artifact, String envType, String parentId, NodeTypeEnum parentType, String parentName, User user, Component component, - Map<String, String> existingEnvVersions, boolean overrideId) { + public Either<ArtifactDefinition, ResponseFormat> createHeatEnvPlaceHolder(ArtifactDefinition heatArtifact, String envType, String parentId, NodeTypeEnum parentType, String parentName, User user, Component component, + Map<String, String> existingEnvVersions) { Map<String, Object> deploymentResourceArtifacts = ConfigurationManager.getConfigurationManager().getConfiguration().getDeploymentResourceInstanceArtifacts(); if (deploymentResourceArtifacts == null) { log.debug("no deployment artifacts are configured for generated artifacts"); @@ -4594,64 +4750,55 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic { return Either.right(componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR)); } - String envLabel = (artifact.getArtifactLabel() + HEAT_ENV_SUFFIX).toLowerCase(); - String parentIdParam = parentId; - if (!overrideId) { - parentIdParam = null; - } - Either<ArtifactDefinition, ResponseFormat> createArtifactPlaceHolder = createArtifactPlaceHolderInfo(parentIdParam, envLabel, placeHolderData, user.getUserId(), ArtifactGroupTypeEnum.DEPLOYMENT, true); + String envLabel = (heatArtifact.getArtifactLabel() + HEAT_ENV_SUFFIX).toLowerCase(); + Either<ArtifactDefinition, ResponseFormat> createArtifactPlaceHolder = createArtifactPlaceHolderInfo(parentId, envLabel, placeHolderData, user.getUserId(), ArtifactGroupTypeEnum.DEPLOYMENT, true); if (createArtifactPlaceHolder.isRight()) { return Either.right(createArtifactPlaceHolder.right().value()); } ArtifactDefinition artifactHeatEnv = createArtifactPlaceHolder.left().value(); - if (!overrideId) { - // fix for migration only!!!! create heat env placeholder according to heat id. - artifactHeatEnv.setUniqueId(artifact.getUniqueId() + HEAT_ENV_SUFFIX); - } - - artifactHeatEnv.setGeneratedFromId(artifact.getUniqueId()); + artifactHeatEnv.setGeneratedFromId(heatArtifact.getUniqueId()); artifactHeatEnv.setHeatParamsUpdateDate(System.currentTimeMillis()); artifactHeatEnv.setTimeout(0); - buildHeatEnvFileName(artifact, artifactHeatEnv, placeHolderData); + buildHeatEnvFileName(heatArtifact, artifactHeatEnv, placeHolderData); // rbetzer - keep env artifactVersion - changeComponentInstanceVersion flow handleEnvArtifactVersion(artifactHeatEnv, existingEnvVersions); - // clone heat parameters in case of heat env only not VF heat env - if (envType.equals(HEAT_ENV_NAME)) { - artifactHeatEnv.setHeatParameters(artifact.getHeatParameters()); - } - ArtifactDefinition artifactDefinition; + ArtifactDefinition heatEnvPlaceholder; // Evg : for resource instance artifact will be added later as block with other env artifacts from BL if (parentType != NodeTypeEnum.ResourceInstance) { - Either<ArtifactDefinition, StorageOperationStatus> addHeatEnvArtifact = addHeatEnvArtifact(artifactHeatEnv, artifact, component.getUniqueId(), parentType, parentId); + Either<ArtifactDefinition, StorageOperationStatus> addHeatEnvArtifact = addHeatEnvArtifact(artifactHeatEnv, heatArtifact, component.getUniqueId(), parentType, parentId); if (addHeatEnvArtifact.isRight()) { log.debug("failed to create heat env artifact on resource instance"); return Either.right(componentsUtils.getResponseFormatForResourceInstance(componentsUtils.convertFromStorageResponseForResourceInstance(addHeatEnvArtifact.right().value(), false), "", null)); } - artifactDefinition = createArtifactPlaceHolder.left().value(); + heatEnvPlaceholder = createArtifactPlaceHolder.left().value(); } else { - artifactDefinition = artifactHeatEnv; - artifactToscaOperation.generateUUID(artifactDefinition, artifactDefinition.getArtifactVersion()); - } - - if (artifact.getHeatParameters() != null) { - List<HeatParameterDefinition> heatEnvParameters = new ArrayList<HeatParameterDefinition>(); - for (HeatParameterDefinition parameter : artifact.getListHeatParameters()) { - HeatParameterDefinition heatEnvParameter = new HeatParameterDefinition(parameter); - heatEnvParameter.setDefaultValue(parameter.getCurrentValue()); - heatEnvParameters.add(heatEnvParameter); - } - artifactDefinition.setListHeatParameters(heatEnvParameters); + heatEnvPlaceholder = artifactHeatEnv; + artifactToscaOperation.generateUUID(heatEnvPlaceholder, heatEnvPlaceholder.getArtifactVersion()); + setHeatCurrentValuesOnHeatEnvDefaultValues(heatArtifact, heatEnvPlaceholder); } - // audit - EnumMap<AuditingFieldsKeysEnum, Object> artifactAuditingFields = createArtifactAuditingFields(artifactDefinition, "", artifactDefinition.getUniqueId()); + EnumMap<AuditingFieldsKeysEnum, Object> artifactAuditingFields = createArtifactAuditingFields(heatEnvPlaceholder, "", heatEnvPlaceholder.getUniqueId()); artifactAuditingFields.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME, parentName); ComponentTypeEnum componentType = component.getComponentType(); if (parentType == NodeTypeEnum.ResourceInstance) { componentType = ComponentTypeEnum.RESOURCE_INSTANCE; } componentsUtils.auditComponent(componentsUtils.getResponseFormat(ActionStatus.OK), user, component, "", "", AuditingActionEnum.ARTIFACT_UPLOAD, componentType, artifactAuditingFields); - return Either.left(artifactDefinition); + return Either.left(heatEnvPlaceholder); + } + + private void setHeatCurrentValuesOnHeatEnvDefaultValues(ArtifactDefinition artifact, ArtifactDefinition artifactDefinition) { + if (artifact.getListHeatParameters() == null) { + return; + } + List<HeatParameterDefinition> heatEnvParameters = new ArrayList<>(); + for (HeatParameterDefinition parameter : artifact.getListHeatParameters()) { + HeatParameterDefinition heatEnvParameter = new HeatParameterDefinition(parameter); + heatEnvParameter.setDefaultValue(parameter.getCurrentValue()); + heatEnvParameter.setCurrentValue(null); + heatEnvParameters.add(heatEnvParameter); + } + artifactDefinition.setListHeatParameters(heatEnvParameters); } private void buildHeatEnvFileName(ArtifactDefinition heatArtifact, ArtifactDefinition heatEnvArtifact, Map<String, Object> placeHolderData) { @@ -4707,7 +4854,7 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic { if (actionResult.isRight()) { log.debug("Failed to upload artifact to component with type {} and name {}. Status is {}. ", componentType, component.getName(), actionResult.right().value()); errorWrapper.setInnerElement(actionResult.right().value()); - if (operation.getArtifactOperationEnum() == ArtifactOperationEnum.Create) { + if (ArtifactOperationEnum.isCreateOrLink(operation.getArtifactOperationEnum())) { vfcsNewCreatedArtifacts.addAll(uploadedArtifacts); } break; @@ -34,7 +34,6 @@ import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.utils.ComponentValidationUtils; - import org.openecomp.sdc.exception.ResponseFormat; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -20,8 +20,12 @@ package org.openecomp.sdc.be.components.impl; -import com.google.gson.JsonElement; -import fj.data.Either; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.function.Function; + import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.tuple.ImmutablePair; import org.openecomp.sdc.be.config.BeEcompErrorManager; @@ -36,7 +40,16 @@ import org.openecomp.sdc.be.datatypes.elements.SchemaDefinition; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; import org.openecomp.sdc.be.impl.ComponentsUtils; -import org.openecomp.sdc.be.model.*; +import org.openecomp.sdc.be.model.Component; +import org.openecomp.sdc.be.model.ComponentInstanceInput; +import org.openecomp.sdc.be.model.ComponentInstanceProperty; +import org.openecomp.sdc.be.model.ComponentParametersView; +import org.openecomp.sdc.be.model.DataTypeDefinition; +import org.openecomp.sdc.be.model.GroupProperty; +import org.openecomp.sdc.be.model.IComplexDefaultValue; +import org.openecomp.sdc.be.model.IPropertyInputCommon; +import org.openecomp.sdc.be.model.LifecycleStateEnum; +import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.model.cache.ApplicationDataTypeCache; import org.openecomp.sdc.be.model.jsontitan.operations.ArtifactsOperations; import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; @@ -65,11 +78,9 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.function.Function; +import com.google.gson.JsonElement; + +import fj.data.Either; public abstract class BaseBusinessLogic { @@ -287,34 +298,6 @@ public abstract class BaseBusinessLogic { return Either.left(componentFound.left().value()); } -// protected Either<? extends org.openecomp.sdc.be.model.Component, ResponseFormat> validateComponentExists(String componentId, ComponentTypeEnum componentType, ComponentParametersView componentParametersView, String userId, -// AuditingActionEnum auditingAction, User user) { -// -// ComponentOperation componentOperation = getComponentOperation(componentType); -// -// if (componentOperation == null) { -// ResponseFormat responseFormat = componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR); -// log.debug("addGroup - not supported component type {}", componentType); -// return Either.right(responseFormat); -// } -// Either<? extends org.openecomp.sdc.be.model.Component, StorageOperationStatus> componentResult = componentOperation.getComponent(componentId, componentParametersView, true); -// -// if (componentResult.isRight()) { -// ActionStatus status = (componentType.equals(ComponentTypeEnum.RESOURCE)) ? ActionStatus.RESOURCE_NOT_FOUND : ActionStatus.SERVICE_NOT_FOUND; -// -// ResponseFormat responseFormat = componentsUtils.getResponseFormat(status, componentId); -// -// log.debug("Service not found, serviceId {}", componentId); -// // ComponentTypeEnum componentForAudit = -// // (componentType.equals(ComponentTypeEnum.RESOURCE)) ? -// // ComponentTypeEnum.RESOURCE : ComponentTypeEnum.SERVICE; -// // handleAuditing(auditingAction, null, componentId, user, null, -// // null, artifactId, responseFormat, componentForAudit, null); -// return Either.right(responseFormat); -// } -// return Either.left(componentResult.left().value()); -// } - public Either<Boolean, ResponseFormat> validateCanWorkOnComponent(Component component, String userId) { Either<Boolean, ResponseFormat> canWork = Either.right(componentsUtils.getResponseFormat(ActionStatus.RESTRICTED_OPERATION)); if (component.getLifecycleState() != LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT) { @@ -1,8 +1,6 @@ package org.openecomp.sdc.be.components.impl; import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.Collections; @@ -31,8 +31,6 @@ import java.util.stream.Collectors; import javax.annotation.Resource; -import jersey.repackaged.com.google.common.base.Function; - import org.apache.commons.lang3.tuple.ImmutablePair; import org.openecomp.sdc.be.components.impl.ImportUtils.ResultStatusEnum; import org.openecomp.sdc.be.config.BeEcompErrorManager; @@ -52,6 +50,7 @@ import org.springframework.stereotype.Component; import org.yaml.snakeyaml.Yaml; import fj.data.Either; +import jersey.repackaged.com.google.common.base.Function; @Component("commonImportManager") public class CommonImportManager { @@ -31,14 +31,21 @@ import java.util.stream.Collectors; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.tuple.ImmutablePair; +import org.openecomp.sdc.be.components.impl.generic.GenericTypeBusinessLogic; import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum; +import org.openecomp.sdc.be.dao.utils.MapUtil; import org.openecomp.sdc.be.datamodel.api.HighestFilterEnum; import org.openecomp.sdc.be.datatypes.components.ServiceMetadataDataDefinition; import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; -import org.openecomp.sdc.be.datatypes.enums.*; +import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; +import org.openecomp.sdc.be.datatypes.enums.FilterKeyEnum; +import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum; +import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; +import org.openecomp.sdc.be.datatypes.enums.OriginTypeEnum; +import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; import org.openecomp.sdc.be.model.ArtifactDefinition; import org.openecomp.sdc.be.model.CapReqDef; @@ -82,6 +89,12 @@ public abstract class ComponentBusinessLogic extends BaseBusinessLogic { @Autowired protected ComponentCache componentCache; + @Autowired + private GenericTypeBusinessLogic genericTypeBusinessLogic; + + public void setGenericTypeBusinessLogic(GenericTypeBusinessLogic genericTypeBusinessLogic) { + this.genericTypeBusinessLogic = genericTypeBusinessLogic; + } private static Logger log = LoggerFactory.getLogger(ComponentBusinessLogic.class.getName()); @@ -116,7 +129,6 @@ public abstract class ComponentBusinessLogic extends BaseBusinessLogic { componentsUtils.auditComponentAdmin(responseFormat, user, component, "", "", auditAction, component.getComponentType()); return Either.right(responseFormat); } - user = userResult.left().value(); return userResult; } @@ -502,17 +514,6 @@ public abstract class ComponentBusinessLogic extends BaseBusinessLogic { return Either.left(true); } - /*** - * Fetches Component From the DB - * - * @param componentId - * @param componentTypeEnum - * @return - */ - public <R extends Component> Either<R, StorageOperationStatus> getComponent(String componentId, ComponentTypeEnum componentTypeEnum) { - return toscaOperationFacade.getToscaElement(componentId); - } - public Either<CapReqDef, ResponseFormat> getRequirementsAndCapabilities(String componentId, ComponentTypeEnum componentTypeEnum, String userId) { Either<User, ResponseFormat> resp = validateUserExists(userId, "create Component Instance", false); @@ -545,7 +546,7 @@ public abstract class ComponentBusinessLogic extends BaseBusinessLogic { List<String> componentsUidToFetch = new ArrayList<>(); componentsUidToFetch.addAll(componentUids); - if (componentsUidToFetch.size() > 0) { + if (!componentsUidToFetch.isEmpty()) { log.debug("Number of Components to fetch from graph is {}", componentsUidToFetch.size()); Boolean isHighest = isHighest(highestFilter); Either<List<Component>, StorageOperationStatus> nonCheckoutCompResponse = toscaOperationFacade.getLatestVersionNotAbstractComponents(isAbstractAbstract, isHighest, componentTypeEnum, internalComponentType, componentsUidToFetch); @@ -617,7 +618,7 @@ public abstract class ComponentBusinessLogic extends BaseBusinessLogic { public void setToscaArtifactsPlaceHolders(Component component, User user) { Map<String, ArtifactDefinition> artifactMap = component.getToscaArtifacts(); if (artifactMap == null) { - artifactMap = new HashMap<String, ArtifactDefinition>(); + artifactMap = new HashMap<>(); } String componentUniqueId = component.getUniqueId(); String componentSystemName = component.getSystemName(); @@ -628,7 +629,7 @@ public abstract class ComponentBusinessLogic extends BaseBusinessLogic { for (Entry<String, Object> artifactInfoMap : toscaArtifacts.entrySet()) { Map<String, Object> artifactInfo = (Map<String, Object>) artifactInfoMap.getValue(); ArtifactDefinition artifactDefinition = artifactsBusinessLogic.createArtifactPlaceHolderInfo(componentUniqueId, artifactInfoMap.getKey(), artifactInfo, user, ArtifactGroupTypeEnum.TOSCA); - artifactDefinition.setArtifactName(componentType + "-" + componentSystemName + artifactInfo.get("artifactName")); + artifactDefinition.setArtifactName(ValidationUtils.normalizeFileName(componentType + "-" + componentSystemName + artifactInfo.get("artifactName"))); artifactMap.put(artifactDefinition.getArtifactLabel(), artifactDefinition); } } @@ -695,7 +696,7 @@ public abstract class ComponentBusinessLogic extends BaseBusinessLogic { List<Component> components = latestVersionEither.left().value(); - Component component = components.stream().filter(c -> c.isHighestVersion()).findFirst().orElse(null); + Component component = components.stream().filter(Component::isHighestVersion).findFirst().orElse(null); if(component == null){ component = components.stream().filter(c -> c.getLifecycleState() == LifecycleStateEnum.CERTIFIED).findFirst().orElse(null); } @@ -785,7 +786,6 @@ public abstract class ComponentBusinessLogic extends BaseBusinessLogic { protected Either<List<String>, ResponseFormat> deleteMarkedComponents(ComponentTypeEnum componentType) { -// List<String> deletedComponents = new ArrayList<String>(); log.trace("start deleteMarkedComponents"); Either<List<String>, StorageOperationStatus> deleteMarkedElements = toscaOperationFacade.deleteMarkedElements(componentType); @@ -794,30 +794,12 @@ public abstract class ComponentBusinessLogic extends BaseBusinessLogic { ResponseFormat responseFormat = componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(deleteMarkedElements.right().value(), componentType)); return Either.right(responseFormat); } -// ComponentOperation componentOperation = getComponentOperation(componentType); -// Either<List<String>, StorageOperationStatus> resourcesToDelete = componentOperation.getAllComponentsMarkedForDeletion(); -// if (resourcesToDelete.isRight()) { -// ResponseFormat responseFormat = componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(resourcesToDelete.right().value(), componentType)); -// return Either.right(responseFormat); -// } -// -// for (String resourceToDelete : resourcesToDelete.left().value()) { -// -// Either<String, ResponseFormat> deleteMarkedResource = deleteMarkedComponent(resourceToDelete, componentType); -// if (deleteMarkedResource.isLeft()) { -// deletedComponents.add(deleteMarkedResource.left().value()); -// } -// } -// if(deletedComponents.size() == 0) { -// log.debug("Component list to delete is empty. do commit"); -// titanGenericDao.commit(); -// } log.trace("end deleteMarkedComponents"); return Either.left(deleteMarkedElements.left().value()); } - public Either<List<ArtifactDefinition>, StorageOperationStatus> getComponentArtifactsForDelete(String parentId, NodeTypeEnum parentType, boolean inTransacton) { - List<ArtifactDefinition> artifacts = new ArrayList<ArtifactDefinition>(); + public Either<List<ArtifactDefinition>, StorageOperationStatus> getComponentArtifactsForDelete(String parentId, NodeTypeEnum parentType) { + List<ArtifactDefinition> artifacts = new ArrayList<>(); Either<Map<String, ArtifactDefinition>, StorageOperationStatus> artifactsResponse = artifactToscaOperation.getArtifacts(parentId); if (artifactsResponse.isRight()) { if (!artifactsResponse.right().value().equals(StorageOperationStatus.NOT_FOUND)) { @@ -827,16 +809,6 @@ public abstract class ComponentBusinessLogic extends BaseBusinessLogic { } else { artifacts.addAll(artifactsResponse.left().value().values()); } - -// if (NodeTypeEnum.Resource.equals(parentType)) { -// Either<List<ArtifactDefinition>, StorageOperationStatus> interfacesArtifactsForResource = getAdditionalArtifacts(parentId, false, true); -// if (artifactsResponse.isRight() && !interfacesArtifactsForResource.right().value().equals(StorageOperationStatus.NOT_FOUND)) { -// log.debug("failed to retrieve interface artifacts for {} {}", parentType, parentId); -// return Either.right(interfacesArtifactsForResource.right().value()); -// } else if (artifactsResponse.isLeft()) { -// artifacts.addAll(interfacesArtifactsForResource.left().value()); -// } -// } return Either.left(artifacts); } @@ -873,50 +845,39 @@ public abstract class ComponentBusinessLogic extends BaseBusinessLogic { return Either.left(result); } - protected <T extends Component> void generateInputsFromGenericTypeProperties(T component, Resource genericType) { - - List<PropertyDefinition> genericTypeProps = genericType.getProperties(); - if(null != genericTypeProps) { - String genericUniqueId = genericType.getUniqueId(); - List<InputDefinition> inputs = convertGenericTypePropertiesToInputsDefintion(genericTypeProps, genericUniqueId); - if(null != component.getInputs()) - inputs.addAll(component.getInputs()); - component.setInputs(inputs); - } - } - - private List<InputDefinition> convertGenericTypePropertiesToInputsDefintion(List<PropertyDefinition> genericTypeProps, String genericUniqueId) { - return genericTypeProps.stream() - .map(p -> setInputDefinitionFromProp(p, genericUniqueId)) - .collect(Collectors.toList()); + protected <T extends Component> void generateAndAddInputsFromGenericTypeProperties(T component, Resource genericType) { + List<InputDefinition> genericAndComponentInputs = new ArrayList<>(); + List<InputDefinition> genericInputs = genericTypeBusinessLogic.generateInputsFromGenericTypeProperties(genericType); + genericAndComponentInputs.addAll(genericInputs); + if (null != component.getInputs()){ + List<InputDefinition> nonGenericInputsFromComponent = getAllNonGenericInputsFromComponent(genericInputs, component.getInputs()); + genericAndComponentInputs.addAll(nonGenericInputsFromComponent); + } + component.setInputs(genericAndComponentInputs); } - - private InputDefinition setInputDefinitionFromProp(PropertyDefinition prop, String genericUniqueId){ - InputDefinition input = new InputDefinition(prop); - input.setOwnerId(genericUniqueId); - return input; + + private List<InputDefinition> getAllNonGenericInputsFromComponent(List<InputDefinition> genericInputs, List<InputDefinition> componentInputs) { + if (genericInputs == null) { + return componentInputs; + } + + Map<String, InputDefinition> inputByNameMap = MapUtil.toMap(genericInputs, InputDefinition::getName); + List<InputDefinition> componentNonGenericInputs = new ArrayList<>(); + componentInputs.stream().forEach(input -> { + if (!inputByNameMap.containsKey(input.getName())) { + componentNonGenericInputs.add(input); + } + }); + return componentNonGenericInputs; } protected <T extends Component> Either<Resource, ResponseFormat> fetchAndSetDerivedFromGenericType(T component){ - String genericTypeToscaName = null; - if(component.getComponentType() == ComponentTypeEnum.RESOURCE && ((Resource)component).getResourceType() == ResourceTypeEnum.CVFC && CollectionUtils.isNotEmpty(((Resource)component).getDerivedFrom())){ - genericTypeToscaName = ((Resource)component).getDerivedFrom().get(0); - } else { - genericTypeToscaName = component.fetchGenericTypeToscaNameFromConfig(); - } - log.debug("Fetching generic tosca name {}", genericTypeToscaName); - if(null == genericTypeToscaName) { - log.debug("Failed to fetch certified node type by tosca resource name {}", genericTypeToscaName); - return Either.right(componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR)); + Either<Resource, ResponseFormat> genericTypeEither = this.genericTypeBusinessLogic.fetchDerivedFromGenericType(component); + if(genericTypeEither.isRight()){ + log.debug("Failed to fetch latest generic type for component {} of type", component.getName(), component.assetType()); + return Either.right(componentsUtils.getResponseFormat(ActionStatus.GENERIC_TYPE_NOT_FOUND, component.assetType())); } - - Either<Resource, StorageOperationStatus> findLatestGeneric = toscaOperationFacade.getLatestCertifiedNodeTypeByToscaResourceName(genericTypeToscaName); - if(findLatestGeneric.isRight()){ - log.debug("Failed to fetch certified node type by tosca resource name {}", genericTypeToscaName); - return Either.right(componentsUtils.getResponseFormat(ActionStatus.GENERIC_TYPE_NOT_FOUND, component.assetType(), genericTypeToscaName)); - } - - Resource genericTypeResource = findLatestGeneric.left().value(); + Resource genericTypeResource = genericTypeEither.left().value(); component.setDerivedFromGenericInfo(genericTypeResource); return Either.left(genericTypeResource); } @@ -1119,7 +1080,7 @@ public abstract class ComponentBusinessLogic extends BaseBusinessLogic { return shouldUpgradeNodeType(componentToCheckOut, latestGeneric); } List<PropertyDefinition> genericTypeProps = latestGeneric.getProperties(); - List<InputDefinition> genericTypeInputs = null == genericTypeProps? null : convertGenericTypePropertiesToInputsDefintion(genericTypeProps, latestGeneric.getUniqueId()); + List<InputDefinition> genericTypeInputs = null == genericTypeProps? null : genericTypeBusinessLogic.convertGenericTypePropertiesToInputsDefintion(genericTypeProps, latestGeneric.getUniqueId()); List<InputDefinition> currentList = new ArrayList<>(); // nullify existing ownerId from existing list and merge into updated list if (null != componentToCheckOut.getInputs()) { @@ -21,6 +21,8 @@ package org.openecomp.sdc.be.components.impl; import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.List; @@ -32,23 +34,28 @@ import java.util.UUID; import java.util.stream.Collectors; import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.collections.MapUtils; import org.apache.commons.lang.StringUtils; import org.apache.commons.lang3.tuple.ImmutablePair; +import org.openecomp.sdc.be.components.merge.instance.ComponentInstanceMergeDataBusinessLogic; +import org.openecomp.sdc.be.components.merge.instance.DataForMergeHolder; import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.config.BeEcompErrorManager.ErrorSeverity; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum; import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; -import org.openecomp.sdc.be.datatypes.components.ResourceMetadataDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.CapabilityDataDefinition; import org.openecomp.sdc.be.datatypes.elements.GroupDataDefinition; import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.RequirementDataDefinition; import org.openecomp.sdc.be.datatypes.elements.SchemaDefinition; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; import org.openecomp.sdc.be.datatypes.enums.OriginTypeEnum; import org.openecomp.sdc.be.info.CreateAndAssotiateInfo; import org.openecomp.sdc.be.model.ArtifactDefinition; +import org.openecomp.sdc.be.model.CapabilityDefinition; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.ComponentInstanceInput; @@ -59,7 +66,10 @@ import org.openecomp.sdc.be.model.GroupDefinition; import org.openecomp.sdc.be.model.InputDefinition; import org.openecomp.sdc.be.model.LifecycleStateEnum; import org.openecomp.sdc.be.model.PropertyDefinition.PropertyNames; +import org.openecomp.sdc.be.model.RelationshipInfo; import org.openecomp.sdc.be.model.RequirementCapabilityRelDef; +import org.openecomp.sdc.be.model.RequirementDefinition; +import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.model.cache.ApplicationDataTypeCache; import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; @@ -95,7 +105,10 @@ public abstract class ComponentInstanceBusinessLogic extends BaseBusinessLogic { private ArtifactsBusinessLogic artifactBusinessLogic; @Autowired private ApplicationDataTypeCache dataTypeCache; - + + @Autowired + private ComponentInstanceMergeDataBusinessLogic compInstMergeDataBL; + public static final String VF_MODULE = "org.openecomp.groups.VfModule"; public ComponentInstanceBusinessLogic() { @@ -112,8 +125,8 @@ public abstract class ComponentInstanceBusinessLogic extends BaseBusinessLogic { User user = null; org.openecomp.sdc.be.model.Component containerComponent = null; ComponentTypeEnum containerComponentType; - - try{ + + try { Either<User, ResponseFormat> resp = validateUserExists(userId, "create Component Instance", inTransaction); if (resp.isRight()) { return Either.right(resp.right().value()); @@ -125,37 +138,56 @@ public abstract class ComponentInstanceBusinessLogic extends BaseBusinessLogic { if (validateValidJson.isRight()) { return Either.right(validateValidJson.right().value()); } - + Either<ComponentTypeEnum, ResponseFormat> validateComponentType = validateComponentType(containerComponentParam); if (validateComponentType.isRight()) { return Either.right(validateComponentType.right().value()); } else { containerComponentType = validateComponentType.left().value(); } - + Either<org.openecomp.sdc.be.model.Component, ResponseFormat> validateComponentExists = validateComponentExists(containerComponentId, containerComponentType, null); if (validateComponentExists.isRight()) { return Either.right(validateComponentExists.right().value()); } else { containerComponent = validateComponentExists.left().value(); } - + if (ModelConverter.isAtomicComponent(containerComponent)) { log.debug("Cannot attach resource instances to container resource of type {}", containerComponent.assetType()); return Either.right(componentsUtils.getResponseFormat(ActionStatus.RESOURCE_CANNOT_CONTAIN_RESOURCE_INSTANCES, containerComponent.assetType())); } - + Either<Boolean, ResponseFormat> validateCanWorkOnComponent = validateCanWorkOnComponent(containerComponent, userId); if (validateCanWorkOnComponent.isRight()) { return Either.right(validateCanWorkOnComponent.right().value()); } - + if (resourceInstance != null && containerComponentType != null) { - Either<Component, ResponseFormat> getOriginComponentRes = getAndValidateOriginComponentOfComponentInstance(containerComponentType, resourceInstance); - if (getOriginComponentRes.isRight()) { - return Either.right(getOriginComponentRes.right().value()); + OriginTypeEnum originType = resourceInstance.getOriginType(); + if (originType == OriginTypeEnum.ServiceProxy) { + Either<Component, StorageOperationStatus> serviceProxyOrigin = toscaOperationFacade.getLatestByName("serviceProxy"); + if (serviceProxyOrigin.isRight()) { + log.debug("Failed to fetch normative service proxy resource by tosca name, error {}", serviceProxyOrigin.right().value()); + return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(serviceProxyOrigin.right().value()))); + } + origComponent = serviceProxyOrigin.left().value(); + + StorageOperationStatus fillProxyRes = fillProxyInstanceData(resourceInstance, origComponent); + if (fillProxyRes != StorageOperationStatus.OK) { + log.debug("Failed to fill service proxy resource data with data from service, error {}", fillProxyRes); + return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(fillProxyRes))); + + } + } else { - origComponent = getOriginComponentRes.left().value(); + Either<Component, ResponseFormat> getOriginComponentRes = getAndValidateOriginComponentOfComponentInstance(containerComponentType, resourceInstance); + + if (getOriginComponentRes.isRight()) { + return Either.right(getOriginComponentRes.right().value()); + } else { + origComponent = getOriginComponentRes.left().value(); + } } } if (needLock) { @@ -174,6 +206,43 @@ public abstract class ComponentInstanceBusinessLogic extends BaseBusinessLogic { } } + private StorageOperationStatus fillProxyInstanceData(ComponentInstance resourceInstance, Component proxyTemplate) { + resourceInstance.setIsProxy(true); + ComponentParametersView filter = new ComponentParametersView(true); + filter.setIgnoreCapabilities(false); + filter.setIgnoreCapabiltyProperties(false); + filter.setIgnoreComponentInstances(false); + filter.setIgnoreRequirements(false); + Either<Component, StorageOperationStatus> serviceRes = toscaOperationFacade.getToscaElement(resourceInstance.getComponentUid(), filter); + if (serviceRes.isRight()) { + return serviceRes.right().value(); + } + Component service = serviceRes.left().value(); + Map<String, List<CapabilityDefinition>> capabilities = service.getCapabilities(); + resourceInstance.setCapabilities(capabilities); + Map<String, List<RequirementDefinition>> req = service.getRequirements(); + resourceInstance.setRequirements(req); + + String name = service.getNormalizedName() + ToscaOperationFacade.PROXY_SUFFIX; + String toscaResourceName = ((Resource) proxyTemplate).getToscaResourceName(); + int lastIndexOf = toscaResourceName.lastIndexOf('.'); + if (lastIndexOf != -1) { + String proxyToscaName = toscaResourceName.substring(0, lastIndexOf + 1) + name; + resourceInstance.setToscaComponentName(proxyToscaName); + } + resourceInstance.setName(name); + resourceInstance.setIsProxy(true); + resourceInstance.setSourceModelInvariant(service.getInvariantUUID()); + resourceInstance.setSourceModelName(service.getName()); + resourceInstance.setSourceModelUuid(service.getUUID()); + resourceInstance.setSourceModelUid(service.getUniqueId()); + resourceInstance.setComponentUid(proxyTemplate.getUniqueId()); + resourceInstance.setDescription("A Proxy for Service " + service.getName()); + resourceInstance.setComponentVersion(service.getVersion()); + + return StorageOperationStatus.OK; + } + public Either<CreateAndAssotiateInfo, ResponseFormat> createAndAssociateRIToRI(String containerComponentParam, String containerComponentId, String userId, CreateAndAssotiateInfo createAndAssotiateInfo) { Either<CreateAndAssotiateInfo, ResponseFormat> resultOp = null; @@ -216,7 +285,7 @@ public abstract class ComponentInstanceBusinessLogic extends BaseBusinessLogic { try { log.debug("Try to create entry on graph"); - Either<Component, ResponseFormat> eitherResourceName = getOriginComponentNameFromComponentInstance(resourceInstance, true); + Either<Component, ResponseFormat> eitherResourceName = getOriginComponentFromComponentInstance(resourceInstance, true); if (eitherResourceName.isRight()) { resultOp = Either.right(eitherResourceName.right().value()); @@ -260,7 +329,7 @@ public abstract class ComponentInstanceBusinessLogic extends BaseBusinessLogic { } } - private Either<Component, ResponseFormat> getOriginComponentNameFromComponentInstance(ComponentInstance componentInstance, boolean inTransaction) { + private Either<Component, ResponseFormat> getOriginComponentFromComponentInstance(ComponentInstance componentInstance, boolean inTransaction) { Either<Component, ResponseFormat> eitherResponse; Either<Component, StorageOperationStatus> eitherComponent = toscaOperationFacade.getToscaFullElement(componentInstance.getComponentUid()); if (eitherComponent.isRight()) { @@ -286,7 +355,7 @@ public abstract class ComponentInstanceBusinessLogic extends BaseBusinessLogic { log.debug("Entity on graph is created."); Component updatedComponent = result.left().value().getLeft(); Map<String, String> existingEnvVersions = new HashMap<>(); - //TODO existingEnvVersions ?? + // TODO existingEnvVersions ?? Either<ActionStatus, ResponseFormat> addComponentInstanceArtifacts = addComponentInstanceArtifacts(updatedComponent, componentInstance, originComponent, user, existingEnvVersions); if (addComponentInstanceArtifacts.isRight()) { log.debug("Failed to create component instance {}", componentInstance.getName()); @@ -304,19 +373,17 @@ public abstract class ComponentInstanceBusinessLogic extends BaseBusinessLogic { return resultOp; } - /** - * addResourceInstanceArtifacts - add artifacts (HEAT_ENV) to resource instance The instance artifacts are generated from the resource's artifacts - * - * @param componentInstance - * @param userId - * @param existingEnvVersions - * TODO - * @param containerComponentId - * - * @return - */ - protected Either<ActionStatus, ResponseFormat> addComponentInstanceArtifacts(org.openecomp.sdc.be.model.Component containerComponent, ComponentInstance componentInstance, org.openecomp.sdc.be.model.Component originComponent, User user, - Map<String, String> existingEnvVersions) { +/** + * addResourceInstanceArtifacts - add artifacts (HEAT_ENV) to resource instance The instance artifacts are generated from the resource's artifacts + * @param containerComponent + * @param componentInstance + * @param originComponent + * @param user + * @param existingEnvVersions + * @return + */ + protected Either<ActionStatus, ResponseFormat> addComponentInstanceArtifacts(org.openecomp.sdc.be.model.Component containerComponent, ComponentInstance componentInstance, org.openecomp.sdc.be.model.Component originComponent, User user, Map<String, String> existingEnvVersions) { + log.debug("add artifacts to resource instance"); List<GroupDefinition> filteredGroups = null; ActionStatus status = setResourceArtifactsOnResourceInstance(componentInstance); @@ -324,80 +391,72 @@ public abstract class ComponentInstanceBusinessLogic extends BaseBusinessLogic { ResponseFormat resultOp = componentsUtils.getResponseFormatForResourceInstance(status, "", null); return Either.right(resultOp); } - + StorageOperationStatus artStatus; // generate heat_env if necessary Map<String, ArtifactDefinition> componentDeploymentArtifacts = componentInstance.getDeploymentArtifacts(); - if (componentDeploymentArtifacts == null) { - return Either.left(ActionStatus.OK); - } - Map<String, ArtifactDefinition> finalDeploymentArtifacts = new HashMap<String, ArtifactDefinition>(); - - Map<String, List<ArtifactDefinition>> groupInstancesArtifacts = new HashMap<>(); - - for (ArtifactDefinition artifact : componentDeploymentArtifacts.values()) { - String type = artifact.getArtifactType(); + if (MapUtils.isNotEmpty(componentDeploymentArtifacts)) { - if ( !type.equalsIgnoreCase(ArtifactTypeEnum.HEAT_ENV.getType()) ){ - finalDeploymentArtifacts.put(artifact.getArtifactLabel(), artifact); - } - - if (!(type.equalsIgnoreCase(ArtifactTypeEnum.HEAT.getType()) || type.equalsIgnoreCase(ArtifactTypeEnum.HEAT_NET.getType()) || type.equalsIgnoreCase(ArtifactTypeEnum.HEAT_VOL.getType()))) { - continue; - } + Map<String, ArtifactDefinition> finalDeploymentArtifacts = new HashMap<String, ArtifactDefinition>(); + Map<String, List<ArtifactDefinition>> groupInstancesArtifacts = new HashMap<>(); - if (artifact.checkEsIdExist()) { - Either<ArtifactDefinition, ResponseFormat> createHeatEnvPlaceHolder = artifactBusinessLogic.createHeatEnvPlaceHolder(artifact, ArtifactsBusinessLogic.HEAT_ENV_NAME, componentInstance.getUniqueId(), NodeTypeEnum.ResourceInstance, - componentInstance.getName(), user, containerComponent, existingEnvVersions); - if (createHeatEnvPlaceHolder.isRight()) { - return Either.right(createHeatEnvPlaceHolder.right().value()); + for (ArtifactDefinition artifact : componentDeploymentArtifacts.values()) { + String type = artifact.getArtifactType(); + if (!type.equalsIgnoreCase(ArtifactTypeEnum.HEAT_ENV.getType())) { + finalDeploymentArtifacts.put(artifact.getArtifactLabel(), artifact); } - ArtifactDefinition artifactDefinition = createHeatEnvPlaceHolder.left().value(); - - //put env - finalDeploymentArtifacts.put(artifactDefinition.getArtifactLabel(), artifactDefinition); - - if(CollectionUtils.isNotEmpty(originComponent.getGroups())){ - filteredGroups = originComponent.getGroups().stream().filter(g -> g.getType().equals(VF_MODULE)).collect(Collectors.toList()); + if (!(type.equalsIgnoreCase(ArtifactTypeEnum.HEAT.getType()) || type.equalsIgnoreCase(ArtifactTypeEnum.HEAT_NET.getType()) || type.equalsIgnoreCase(ArtifactTypeEnum.HEAT_VOL.getType()))) { + continue; } - if (CollectionUtils.isNotEmpty(filteredGroups)) { - for (GroupDefinition groupInstance : filteredGroups) { - Optional<String> op = groupInstance.getArtifacts().stream().filter(p -> p.equals(artifactDefinition.getGeneratedFromId())).findAny(); - if (op.isPresent()) { - List<ArtifactDefinition> artifactsUid; - if (groupInstancesArtifacts.containsKey(groupInstance.getUniqueId())) { - artifactsUid = groupInstancesArtifacts.get(groupInstance.getUniqueId()); - } else { - artifactsUid = new ArrayList<>(); + if (artifact.checkEsIdExist()) { + Either<ArtifactDefinition, ResponseFormat> createHeatEnvPlaceHolder = artifactBusinessLogic.createHeatEnvPlaceHolder(artifact, ArtifactsBusinessLogic.HEAT_ENV_NAME, componentInstance.getUniqueId(), NodeTypeEnum.ResourceInstance, + componentInstance.getName(), user, containerComponent, existingEnvVersions); + if (createHeatEnvPlaceHolder.isRight()) { + return Either.right(createHeatEnvPlaceHolder.right().value()); + } + ArtifactDefinition artifactDefinition = createHeatEnvPlaceHolder.left().value(); + // put env + finalDeploymentArtifacts.put(artifactDefinition.getArtifactLabel(), artifactDefinition); + + if (CollectionUtils.isNotEmpty(originComponent.getGroups())) { + filteredGroups = originComponent.getGroups().stream().filter(g -> g.getType().equals(VF_MODULE)).collect(Collectors.toList()); + } + if (CollectionUtils.isNotEmpty(filteredGroups)) { + for (GroupDefinition groupInstance : filteredGroups) { + Optional<String> op = groupInstance.getArtifacts().stream().filter(p -> p.equals(artifactDefinition.getGeneratedFromId())).findAny(); + if (op.isPresent()) { + List<ArtifactDefinition> artifactsUid; + if (groupInstancesArtifacts.containsKey(groupInstance.getUniqueId())) { + artifactsUid = groupInstancesArtifacts.get(groupInstance.getUniqueId()); + } else { + artifactsUid = new ArrayList<>(); + } + artifactsUid.add(artifactDefinition); + groupInstancesArtifacts.put(groupInstance.getUniqueId(), artifactsUid); + break; } - artifactsUid.add(artifactDefinition); - groupInstancesArtifacts.put(groupInstance.getUniqueId(), artifactsUid); - break; } } - } } + artStatus = toscaOperationFacade.addDeploymentArtifactsToInstance(containerComponent.getUniqueId(), componentInstance, finalDeploymentArtifacts); + if (artStatus != StorageOperationStatus.OK) { + log.debug("Failed to add instance deployment artifacts for instance {} in conatiner {} error {}", componentInstance.getUniqueId(), containerComponent.getUniqueId(), artStatus); + return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponseForResourceInstance(artStatus, false))); + + } + StorageOperationStatus result = toscaOperationFacade.addGroupInstancesToComponentInstance(containerComponent, componentInstance, filteredGroups, groupInstancesArtifacts); + if (result != StorageOperationStatus.OK) { + log.debug("failed to update group instance for component instance {}", componentInstance.getUniqueId()); + return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(result))); + } + componentInstance.setDeploymentArtifacts(finalDeploymentArtifacts); } - StorageOperationStatus artStatus = toscaOperationFacade.addDeploymentArtifactsToInstance(containerComponent.getUniqueId(), componentInstance, finalDeploymentArtifacts); - if ( artStatus != StorageOperationStatus.OK){ - log.debug("Failed to add instance deployment artifacts for instance {} in conatiner {} error {}", componentInstance.getUniqueId(), containerComponent.getUniqueId(), artStatus); - return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponseForResourceInstance(artStatus, false))); - - } - StorageOperationStatus result = toscaOperationFacade - .addGroupInstancesToComponentInstance(containerComponent, componentInstance, filteredGroups, groupInstancesArtifacts); - if (result != StorageOperationStatus.OK) { - log.debug("failed to update group instance for component instance {}", componentInstance.getUniqueId()); - return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(result))); - } - componentInstance.setDeploymentArtifacts(finalDeploymentArtifacts); - - + artStatus = toscaOperationFacade.addInformationalArtifactsToInstance(containerComponent.getUniqueId(), componentInstance, originComponent.getArtifacts()); - if ( artStatus != StorageOperationStatus.OK){ + if (artStatus != StorageOperationStatus.OK) { log.debug("Failed to add informational artifacts to the instance {} belonging to the conatiner {}. Status is {}", componentInstance.getUniqueId(), containerComponent.getUniqueId(), artStatus); return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponseForResourceInstance(artStatus, false))); - + } componentInstance.setArtifacts(originComponent.getArtifacts()); return Either.left(ActionStatus.OK); @@ -483,7 +542,7 @@ public abstract class ComponentInstanceBusinessLogic extends BaseBusinessLogic { } try { - Either<Component, ResponseFormat> eitherResourceName = getOriginComponentNameFromComponentInstance(componentInstance, inTransaction); + Either<Component, ResponseFormat> eitherResourceName = getOriginComponentFromComponentInstance(componentInstance, inTransaction); if (eitherResourceName.isRight()) { resultOp = Either.right(eitherResourceName.right().value()); @@ -557,42 +616,40 @@ public abstract class ComponentInstanceBusinessLogic extends BaseBusinessLogic { List<ComponentInstance> updatedList = new ArrayList<>(); List<ComponentInstance> instancesFromContainerComponent = containerComponent.getComponentInstances(); List<ComponentInstance> listForUpdate = new ArrayList<>(); - if(instancesFromContainerComponent == null || instancesFromContainerComponent.isEmpty()) + if (instancesFromContainerComponent == null || instancesFromContainerComponent.isEmpty()) containerComponent.setComponentInstances(componentInstanceList); - else{ + else { Iterator<ComponentInstance> iterator = instancesFromContainerComponent.iterator(); - while(iterator.hasNext()){ + while (iterator.hasNext()) { ComponentInstance origInst = iterator.next(); Optional<ComponentInstance> op = componentInstanceList.stream().filter(ci -> ci.getUniqueId().equals(origInst.getUniqueId())).findAny(); - if(op.isPresent()){ - ComponentInstance updatedCi = op.get(); + if (op.isPresent()) { + ComponentInstance updatedCi = op.get(); updatedCi = buildComponentInstance(updatedCi, origInst); - + Boolean isUniqueName = validateInstanceNameUniquenessUponUpdate(containerComponent, origInst, updatedCi.getName()); - if(!isUniqueName){ - CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to update the name of the component instance {} to {}. A component instance with the same name already exists. ", - origInst.getName(), updatedCi.getName()); + if (!isUniqueName) { + CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to update the name of the component instance {} to {}. A component instance with the same name already exists. ", origInst.getName(), updatedCi.getName()); resultOp = Either.right(componentsUtils.getResponseFormat(ActionStatus.COMPONENT_NAME_ALREADY_EXIST, containerComponentType.getValue(), origInst.getName())); return resultOp; } - + listForUpdate.add(updatedCi); - } - else + } else listForUpdate.add(origInst); } containerComponent.setComponentInstances(listForUpdate); - - if(resultOp == null){ - Either<Component, StorageOperationStatus> updateStatus = toscaOperationFacade.updateComponentInstanceMetadataOfTopologyTemplate(containerComponent); - if(updateStatus.isRight()){ + + if (resultOp == null) { + Either<Component, StorageOperationStatus> updateStatus = toscaOperationFacade.updateComponentInstanceMetadataOfTopologyTemplate(containerComponent, componentFilter); + if (updateStatus.isRight()) { CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to update metadata belonging to container component {}. Status is {}. ", containerComponent.getName(), updateStatus.right().value()); resultOp = Either.right(componentsUtils.getResponseFormatForResourceInstance(componentsUtils.convertFromStorageResponseForResourceInstance(updateStatus.right().value(), true), "", null)); return resultOp; } - for(ComponentInstance updatedInstance : updateStatus.left().value().getComponentInstances()){ + for (ComponentInstance updatedInstance : updateStatus.left().value().getComponentInstances()) { Optional<ComponentInstance> op = componentInstanceList.stream().filter(ci -> ci.getName().equals(updatedInstance.getName())).findAny(); - if(op.isPresent()){ + if (op.isPresent()) { updatedList.add(updatedInstance); } } @@ -640,8 +697,7 @@ public abstract class ComponentInstanceBusinessLogic extends BaseBusinessLogic { if (resultOp == null) { oldComponentInstance = componentInstanceOptional.get(); String newInstanceName = componentInstance.getName(); - if ( oldComponentInstance!=null && oldComponentInstance.getName() != null - && !oldComponentInstance.getName().equals( newInstanceName ) ) + if (oldComponentInstance != null && oldComponentInstance.getName() != null && !oldComponentInstance.getName().equals(newInstanceName)) isNameChanged = true; Boolean isUniqueName = validateInstanceNameUniquenessUponUpdate(containerComponent, oldComponentInstance, newInstanceName); if (!isUniqueName) { @@ -655,14 +711,14 @@ public abstract class ComponentInstanceBusinessLogic extends BaseBusinessLogic { CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to update metadata of component instance {} belonging to container component {}. Status is {}. ", componentInstance.getName(), containerComponent.getName(), updateRes.right().value()); resultOp = Either.right(componentsUtils.getResponseFormatForResourceInstance(componentsUtils.convertFromStorageResponseForResourceInstance(updateRes.right().value(), true), "", null)); - }else{ - //region - Update instance Groups - if ( isNameChanged ){ - Either result = toscaOperationFacade.cleanAndAddGroupInstancesToComponentInstance( containerComponent ,oldComponentInstance ,componentInstanceId ); - if ( result.isRight() ) - CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to rename group instances for container {}. error {} ", componentInstanceId ,result.right().value() ); + } else { + // region - Update instance Groups + if (isNameChanged) { + Either result = toscaOperationFacade.cleanAndAddGroupInstancesToComponentInstance(containerComponent, oldComponentInstance, componentInstanceId); + if (result.isRight()) + CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to rename group instances for container {}. error {} ", componentInstanceId, result.right().value()); } - //endregion + // endregion } } if (resultOp == null) { @@ -672,24 +728,28 @@ public abstract class ComponentInstanceBusinessLogic extends BaseBusinessLogic { if (!updatedInstanceOptional.isPresent()) { log.debug("Failed to update metadata of component instance {} of container component {}", componentInstance.getName(), containerComponent.getName()); resultOp = Either.right(componentsUtils.getResponseFormat(ActionStatus.COMPONENT_INSTANCE_NOT_FOUND_ON_CONTAINER, componentInstance.getName())); - }else{ + } else { resultOp = Either.left(updatedInstanceOptional.get()); } - + } if (resultOp == null) { resultOp = Either.left(componentInstanceOptional.get()); } return resultOp; } + /** - * @param oldPrefix- The normalized old vf name - * @param newNormailzedPrefix- The normalized new vf name - * @param qualifiedGroupInstanceName- old Group Instance Name + * @param oldPrefix- + * The normalized old vf name + * @param newNormailzedPrefix- + * The normalized new vf name + * @param qualifiedGroupInstanceName- + * old Group Instance Name **/ - //modify group names - private String getNewGroupName( String oldPrefix ,String newNormailzedPrefix , String qualifiedGroupInstanceName){ - if (qualifiedGroupInstanceName == null){ + // modify group names + private String getNewGroupName(String oldPrefix, String newNormailzedPrefix, String qualifiedGroupInstanceName) { + if (qualifiedGroupInstanceName == null) { log.info("CANNOT change group name "); return null; } @@ -702,9 +762,8 @@ public abstract class ComponentInstanceBusinessLogic extends BaseBusinessLogic { oldComponentInstance.setName(newComponentInstance.getName()); oldComponentInstance.setModificationTime(System.currentTimeMillis()); oldComponentInstance.setCustomizationUUID(UUID.randomUUID().toString()); - if ( oldComponentInstance.getGroupInstances() != null ) - oldComponentInstance.getGroupInstances().forEach( group -> - group.setName( getNewGroupName( oldComponentInstance.getNormalizedName() , ValidationUtils.normalizeComponentInstanceName( newComponentInstance.getName() ) , group.getName() ) ) ); + if (oldComponentInstance.getGroupInstances() != null) + oldComponentInstance.getGroupInstances().forEach(group -> group.setName(getNewGroupName(oldComponentInstance.getNormalizedName(), ValidationUtils.normalizeComponentInstanceName(newComponentInstance.getName()), group.getName()))); return oldComponentInstance; } @@ -772,26 +831,25 @@ public abstract class ComponentInstanceBusinessLogic extends BaseBusinessLogic { } if (resultOp.isLeft() && CollectionUtils.isNotEmpty(containerComponent.getGroups())) { List<GroupDataDefinition> groupsToUpdate = new ArrayList<>(); - for(GroupDataDefinition currGroup : containerComponent.getGroups()){ - if(currGroup.getMembers().containsKey(deletedInstance.getName())){ - currGroup.getMembers().remove(deletedInstance.getName()); + for (GroupDataDefinition currGroup : containerComponent.getGroups()) { + Map<String, String> members = currGroup.getMembers(); + if (members != null && members.containsKey(deletedInstance.getName())) { + members.remove(deletedInstance.getName()); groupsToUpdate.add(currGroup); } } - Either<List<GroupDefinition>, StorageOperationStatus> updateGroupsRes = - toscaOperationFacade.updateGroupsOnComponent(containerComponent, containerComponent.getComponentType(), groupsToUpdate); + Either<List<GroupDefinition>, StorageOperationStatus> updateGroupsRes = toscaOperationFacade.updateGroupsOnComponent(containerComponent, containerComponent.getComponentType(), groupsToUpdate); if (updateGroupsRes.isRight()) { log.debug("Failed to delete component instance {} from group members. ", componentInstanceId); ActionStatus status = componentsUtils.convertFromStorageResponse(updateGroupsRes.right().value(), containerComponentType); resultOp = Either.right(componentsUtils.getResponseFormat(status, componentInstanceId)); } } - if(resultOp.isLeft() && CollectionUtils.isNotEmpty(containerComponent.getInputs())){ + if (resultOp.isLeft() && CollectionUtils.isNotEmpty(containerComponent.getInputs())) { List<InputDefinition> inputsToDelete = containerComponent.getInputs().stream().filter(i -> i.getInstanceUniqueId() != null && i.getInstanceUniqueId().equals(componentInstanceId)).collect(Collectors.toList()); - if(CollectionUtils.isNotEmpty(inputsToDelete)){ - StorageOperationStatus deleteInputsRes = - toscaOperationFacade.deleteComponentInstanceInputsFromTopologyTemplate(containerComponent, containerComponent.getComponentType(), inputsToDelete); - if(deleteInputsRes != StorageOperationStatus.OK){ + if (CollectionUtils.isNotEmpty(inputsToDelete)) { + StorageOperationStatus deleteInputsRes = toscaOperationFacade.deleteComponentInstanceInputsFromTopologyTemplate(containerComponent, containerComponent.getComponentType(), inputsToDelete); + if (deleteInputsRes != StorageOperationStatus.OK) { log.debug("Failed to delete inputs of the component instance {} from container component. ", componentInstanceId); resultOp = Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(deleteInputsRes, containerComponentType), componentInstanceId)); } @@ -802,8 +860,8 @@ public abstract class ComponentInstanceBusinessLogic extends BaseBusinessLogic { private ComponentInstance findAndRemoveComponentInstanceFromContainerComponent(String componentInstanceId, Component containerComponent) { ComponentInstance foundInstance = null; - for(ComponentInstance instance : containerComponent.getComponentInstances()){ - if(instance.getUniqueId().equals(componentInstanceId)){ + for (ComponentInstance instance : containerComponent.getComponentInstances()) { + if (instance.getUniqueId().equals(componentInstanceId)) { foundInstance = instance; containerComponent.getComponentInstances().remove(instance); break; @@ -885,7 +943,7 @@ public abstract class ComponentInstanceBusinessLogic extends BaseBusinessLogic { toNameOrId = toResult.left().value().getName(); } - resultOp = Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponseForResourceInstance(result.right().value(), true), fromNameOrId, toNameOrId, requirementDef.getRelationships().get(0).getRequirement())); + resultOp = Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponseForResourceInstance(result.right().value(), true), fromNameOrId, toNameOrId, requirementDef.getRelationships().get(0).getRelation().getRequirement())); return resultOp; } @@ -941,13 +999,156 @@ public abstract class ComponentInstanceBusinessLogic extends BaseBusinessLogic { } resultOp = Either - .right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponseForResourceInstance(result.right().value(), true), fromNameOrId, toNameOrId, requirementDef.getRelationships().get(0).getRequirement())); + .right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponseForResourceInstance(result.right().value(), true), fromNameOrId, toNameOrId, requirementDef.getRelationships().get(0).getRelation().getRequirement())); return resultOp; } } finally { unlockComponent(resultOp, containerComponent); } } + /** + * Allows to get relation contained in specified component according to received Id + * @param componentId + * @param relationId + * @param userId + * @param componentTypeEnum + * @return + */ + public Either<RequirementCapabilityRelDef, ResponseFormat> getRelationById(String componentId, String relationId, String userId, ComponentTypeEnum componentTypeEnum) { + + Either<RequirementCapabilityRelDef, ResponseFormat> resultOp = null; + try { + org.openecomp.sdc.be.model.Component containerComponent = null; + Either<org.openecomp.sdc.be.model.Component, ResponseFormat> validateComponentExists = null; + RequirementCapabilityRelDef foundRelation = null; + + Either<User, ResponseFormat> validateUserRes = validateUserExists(userId, "get relation by Id", false); + if (validateUserRes.isRight()) { + resultOp = Either.right(validateUserRes.right().value()); + } + if(resultOp == null){ + validateComponentExists = validateComponentExists(componentId, componentTypeEnum, null); + if (validateComponentExists.isRight()) { + resultOp = Either.right(validateComponentExists.right().value()); + } + } + if(resultOp == null){ + containerComponent = validateComponentExists.left().value(); + List<RequirementCapabilityRelDef> requirementCapabilityRelations = containerComponent.getComponentInstancesRelations(); + foundRelation = findRelation(relationId, requirementCapabilityRelations); + if(foundRelation == null){ + ResponseFormat responseFormat = componentsUtils.getResponseFormat(ActionStatus.RELATION_NOT_FOUND, relationId, componentId); + log.debug("Relation with id {} was not found on the component", relationId, componentId); + resultOp = Either.right(responseFormat); + } + } + if(resultOp == null){ + resultOp = setRelatedCapability(foundRelation, containerComponent); + } + if(resultOp.isLeft()){ + resultOp = setRelatedRequirement(foundRelation, containerComponent); + } + } catch (Exception e) { + log.error("The exception {} occured upon get relation {} of the component {} ", e, relationId, componentId); + resultOp = Either.right(componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR)); + } + return resultOp; + } + + private RequirementCapabilityRelDef findRelation(String relationId, List<RequirementCapabilityRelDef> requirementCapabilityRelations) { + for(RequirementCapabilityRelDef relationship : requirementCapabilityRelations){ + if(relationship.getRelationships().stream().filter(r -> r.getRelation().getId().equals(relationId)).findFirst().isPresent()){ + return relationship; + } + } + return null; + } + + private Either<RequirementCapabilityRelDef, ResponseFormat> setRelatedRequirement(RequirementCapabilityRelDef foundRelation, Component containerComponent) { + Either<RequirementCapabilityRelDef, ResponseFormat> result = null; + RelationshipInfo relationshipInfo = foundRelation.getSingleRelationship().getRelation(); + String instanceId = foundRelation.getFromNode(); + Optional<RequirementDefinition> foundRequirement; + Optional<ComponentInstance> instance = containerComponent.getComponentInstances().stream().filter(i -> i.getUniqueId().equals(instanceId)).findFirst(); + if(!instance.isPresent()){ + ResponseFormat responseFormat = componentsUtils.getResponseFormat(ActionStatus.COMPONENT_INSTANCE_NOT_FOUND_ON_CONTAINER, instanceId, "instance", containerComponent.getComponentType().getValue(), containerComponent.getName()); + log.debug("Component instance with id {} was not found on the component", instanceId, containerComponent.getUniqueId()); + result = Either.right(responseFormat); + } + if(result == null){ + for(List<RequirementDefinition> requirements : instance.get().getRequirements().values()){ + foundRequirement = requirements.stream().filter(r -> isBelongingRequirement(relationshipInfo, r)).findFirst(); + if(foundRequirement.isPresent()){ + foundRelation.getSingleRelationship().setRequirement(foundRequirement.get()); + result = Either.left(foundRelation); + } + } + } + if(result == null){ + Either<RequirementDataDefinition, StorageOperationStatus> getfulfilledRequirementRes = toscaOperationFacade.getFulfilledRequirementByRelation(containerComponent.getUniqueId(), instanceId, foundRelation, (rel, req)->isBelongingRequirement(rel, req)); + if(getfulfilledRequirementRes.isRight()){ + ResponseFormat responseFormat = componentsUtils.getResponseFormat(ActionStatus.REQUIREMENT_OF_INSTANCE_NOT_FOUND_ON_CONTAINER, relationshipInfo.getRequirement(), instanceId, containerComponent.getUniqueId()); + log.debug("Requirement {} of instance {} was not found on the container {}. ", relationshipInfo.getCapability(), instanceId, containerComponent.getUniqueId()); + result = Either.right(responseFormat); + } else { + foundRelation.getSingleRelationship().setRequirement(getfulfilledRequirementRes.left().value()); + } + } + if(result == null){ + result = Either.left(foundRelation); + } + return result; + } + + private boolean isBelongingRequirement(RelationshipInfo relationshipInfo, RequirementDataDefinition req) { + return req.getRelationship().equals(relationshipInfo.getRelationship().getType()) && + req.getName().equals(relationshipInfo.getRequirement()) && + req.getUniqueId().equals(relationshipInfo.getRequirementUid()) && + req.getOwnerId().equals(relationshipInfo.getRequirementOwnerId()); + } + + private Either<RequirementCapabilityRelDef, ResponseFormat> setRelatedCapability(RequirementCapabilityRelDef foundRelation, Component containerComponent) { + Either<RequirementCapabilityRelDef, ResponseFormat> result = null; + RelationshipInfo relationshipInfo = foundRelation.getSingleRelationship().getRelation(); + String instanceId = foundRelation.getToNode(); + Optional<CapabilityDefinition> foundCapability; + Optional<ComponentInstance> instance = containerComponent.getComponentInstances().stream().filter(i -> i.getUniqueId().equals(instanceId)).findFirst(); + if(!instance.isPresent()){ + ResponseFormat responseFormat = componentsUtils.getResponseFormat(ActionStatus.COMPONENT_INSTANCE_NOT_FOUND_ON_CONTAINER, instanceId, "instance", containerComponent.getComponentType().getValue(), containerComponent.getName()); + log.debug("Component instance with id {} was not found on the component", instanceId, containerComponent.getUniqueId()); + result = Either.right(responseFormat); + } + if(result == null){ + for(List<CapabilityDefinition> capabilities : instance.get().getCapabilities().values()){ + foundCapability = capabilities.stream().filter(c -> isBelongingCapability(relationshipInfo, c)).findFirst(); + if(foundCapability.isPresent()){ + foundRelation.getSingleRelationship().setCapability(foundCapability.get()); + result = Either.left(foundRelation); + } + } + } + if(result == null){ + Either<CapabilityDataDefinition, StorageOperationStatus> getfulfilledRequirementRes = + toscaOperationFacade.getFulfilledCapabilityByRelation(containerComponent.getUniqueId(), instanceId, foundRelation, (rel, cap)->isBelongingCapability(rel, cap)); + if(getfulfilledRequirementRes.isRight()){ + ResponseFormat responseFormat = componentsUtils.getResponseFormat(ActionStatus.CAPABILITY_OF_INSTANCE_NOT_FOUND_ON_CONTAINER, relationshipInfo.getCapability(), instanceId, containerComponent.getUniqueId()); + log.debug("Capability {} of instance {} was not found on the container {}. ", relationshipInfo.getCapability(), instanceId, containerComponent.getUniqueId()); + result = Either.right(responseFormat); + } else { + foundRelation.getSingleRelationship().setCapability(getfulfilledRequirementRes.left().value()); + } + } + if(result == null){ + result = Either.left(foundRelation); + } + return result; + } + + private boolean isBelongingCapability(RelationshipInfo relationshipInfo, CapabilityDataDefinition cap) { + return cap.getName().equals(relationshipInfo.getCapability()) && + cap.getUniqueId().equals(relationshipInfo.getCapabilityUid()) && + cap.getOwnerId().equals(relationshipInfo.getCapabilityOwnerId()); + } private Either<ComponentInstanceProperty, ResponseFormat> updateAttributeValue(ComponentInstanceProperty attribute, String resourceInstanceId) { Either<ComponentInstanceProperty, StorageOperationStatus> eitherAttribute = componentInstanceOperation.updateAttributeValueInResourceInstance(attribute, resourceInstanceId, true); @@ -999,7 +1200,7 @@ public abstract class ComponentInstanceBusinessLogic extends BaseBusinessLogic { /** * Create Or Updates Attribute Instance - * + * * @param componentTypeEnum * @param componentId * @param resourceInstanceId @@ -1047,28 +1248,82 @@ public abstract class ComponentInstanceBusinessLogic extends BaseBusinessLogic { } } - // US833308 VLI in service - specific network_role property value logic + private boolean isNetworkRoleServiceProperty(ComponentInstanceProperty property, ComponentTypeEnum componentTypeEnum) { + return StringUtils.isNotEmpty(property.getValue()) + && PropertyNames.NETWORK_ROLE.getPropertyName().equalsIgnoreCase(property.getName()) + && ComponentTypeEnum.SERVICE == componentTypeEnum; + } + private StorageOperationStatus concatServiceNameToVLINetworkRolePropertyValue(ToscaOperationFacade toscaOperationFacade, ComponentTypeEnum componentTypeEnum, String componentId, String resourceInstanceId, ComponentInstanceProperty property) { - if (StringUtils.isNotEmpty(property.getValue()) && PropertyNames.NETWORK_ROLE.getPropertyName().equalsIgnoreCase(property.getName()) && ComponentTypeEnum.SERVICE == componentTypeEnum) { - ComponentParametersView componentParametersView = new ComponentParametersView(); - componentParametersView.disableAll(); - componentParametersView.setIgnoreComponentInstances(false); - Either<Component, StorageOperationStatus> getServiceResult = toscaOperationFacade.getToscaElement(componentId, componentParametersView); - if (getServiceResult.isRight()) { - return getServiceResult.right().value(); + return concatServiceNameToVLINetworkRolePropertiesValues(toscaOperationFacade, componentTypeEnum, componentId, resourceInstanceId, Arrays.asList(property)); + } + + // US833308 VLI in service - specific network_role property value logic + private StorageOperationStatus concatServiceNameToVLINetworkRolePropertiesValues(ToscaOperationFacade toscaOperationFacade, ComponentTypeEnum componentTypeEnum, String componentId, String resourceInstanceId, List<ComponentInstanceProperty> properties) { + for (ComponentInstanceProperty property: properties) { + if (isNetworkRoleServiceProperty(property, componentTypeEnum)) { + ComponentParametersView componentParametersView = new ComponentParametersView(); + componentParametersView.disableAll(); + componentParametersView.setIgnoreComponentInstances(false); + Either<Component, StorageOperationStatus> getServiceResult = toscaOperationFacade.getToscaElement(componentId, componentParametersView); + if (getServiceResult.isRight()) { + return getServiceResult.right().value(); + } + Component service = getServiceResult.left().value(); + Optional<ComponentInstance> getInstance = service.getComponentInstances().stream().filter(p -> p.getUniqueId().equals(resourceInstanceId)).findAny(); + if (!getInstance.isPresent()) { + return StorageOperationStatus.NOT_FOUND; + } + String prefix = service.getSystemName() + "."; + String value = property.getValue(); + if (OriginTypeEnum.VL == getInstance.get().getOriginType() && (!value.startsWith(prefix) || value.equalsIgnoreCase(prefix))) { + property.setValue(prefix + value); + } + } + } + return StorageOperationStatus.OK; + } + + private Either<String,ResponseFormat> updatePropertyObjectValue(ComponentInstanceProperty property, Map<String, DataTypeDefinition> allDataTypes) { + String innerType = null; + String propertyType = property.getType(); + ToscaPropertyType type = ToscaPropertyType.isValidType(propertyType); + log.debug("The type of the property {} is {}", property.getUniqueId(), propertyType); + + if (type == ToscaPropertyType.LIST || type == ToscaPropertyType.MAP) { + SchemaDefinition def = property.getSchema(); + if (def == null) { + log.debug("Schema doesn't exists for property of type {}", type); + return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(StorageOperationStatus.INVALID_VALUE))); } - Component service = getServiceResult.left().value(); - Optional<ComponentInstance> getInstance = service.getComponentInstances().stream().filter(p -> p.getUniqueId().equals(resourceInstanceId)).findAny(); - if (!getInstance.isPresent()) { - return StorageOperationStatus.NOT_FOUND; + PropertyDataDefinition propDef = def.getProperty(); + if (propDef == null) { + log.debug("Property in Schema Definition inside property of type {} doesn't exist", type); + return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(StorageOperationStatus.INVALID_VALUE))); } - String prefix = service.getSystemName() + "."; - String value = property.getValue(); - if (OriginTypeEnum.VL == getInstance.get().getOriginType() && (!value.startsWith(prefix) || value.equalsIgnoreCase(prefix))) { - property.setValue(prefix + value); + innerType = propDef.getType(); + } + // Specific Update Logic + Either<Object, Boolean> isValid = propertyOperation.validateAndUpdatePropertyValue(propertyType, property.getValue(), true, innerType, allDataTypes); + String newValue = property.getValue(); + if (isValid.isRight()) { + Boolean res = isValid.right().value(); + if (res == false) { + return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertTitanStatusToStorageStatus(TitanOperationStatus.ILLEGAL_ARGUMENT)))); + } + } else { + Object object = isValid.left().value(); + if (object != null) { + newValue = object.toString(); } } - return StorageOperationStatus.OK; + + ImmutablePair<String, Boolean> pair = propertyOperation.validateAndUpdateRules(propertyType, property.getRules(), innerType, allDataTypes, true); + if (pair.getRight() != null && pair.getRight() == false) { + BeEcompErrorManager.getInstance().logBeInvalidValueError("Add property value", pair.getLeft(), property.getName(), propertyType); + return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertTitanStatusToStorageStatus(TitanOperationStatus.ILLEGAL_ARGUMENT)))); + } + return Either.left(newValue); } public Either<ComponentInstanceProperty, ResponseFormat> createOrUpdatePropertyValue(ComponentTypeEnum componentTypeEnum, String componentId, String resourceInstanceId, ComponentInstanceProperty property, String userId) { @@ -1156,7 +1411,7 @@ public abstract class ComponentInstanceBusinessLogic extends BaseBusinessLogic { if (object != null) { newValue = object.toString(); } - } + } ImmutablePair<String, Boolean> pair = propertyOperation.validateAndUpdateRules(propertyType, property.getRules(), innerType, allDataTypes.left().value(), true); if (pair.getRight() != null && pair.getRight() == false) { @@ -1169,12 +1424,12 @@ public abstract class ComponentInstanceBusinessLogic extends BaseBusinessLogic { Optional<ComponentInstanceProperty> instanceProperty = instanceProperties.stream().filter(p -> p.getUniqueId().equals(property.getUniqueId())).findAny(); StorageOperationStatus status; instanceProperty.get().setValue(newValue); - if(instanceProperty.isPresent()){ + if (instanceProperty.isPresent()) { status = toscaOperationFacade.updateComponentInstanceProperty(containerComponent, foundResourceInstance.getUniqueId(), property); } else { status = toscaOperationFacade.addComponentInstanceProperty(containerComponent, foundResourceInstance.getUniqueId(), property); } - if(status != StorageOperationStatus.OK){ + if (status != StorageOperationStatus.OK) { ActionStatus actionStatus = componentsUtils.convertFromStorageResponseForResourceInstanceProperty(status); resultOp = Either.right(componentsUtils.getResponseFormatForResourceInstanceProperty(actionStatus, "")); return resultOp; @@ -1182,17 +1437,17 @@ public abstract class ComponentInstanceBusinessLogic extends BaseBusinessLogic { List<String> path = new ArrayList<>(); path.add(foundResourceInstance.getUniqueId()); property.setPath(path); - + foundResourceInstance.setCustomizationUUID(UUID.randomUUID().toString()); Either<Component, StorageOperationStatus> updateContainerRes = toscaOperationFacade.updateComponentInstanceMetadataOfTopologyTemplate(containerComponent); - + if (updateContainerRes.isRight()) { ActionStatus actionStatus = componentsUtils.convertFromStorageResponseForResourceInstanceProperty(updateContainerRes.right().value()); resultOp = Either.right(componentsUtils.getResponseFormatForResourceInstanceProperty(actionStatus, "")); return resultOp; } - resultOp = Either.left(property); - return resultOp; + resultOp = Either.left(property); + return resultOp; } finally { if (resultOp == null || resultOp.isRight()) { @@ -1205,7 +1460,7 @@ public abstract class ComponentInstanceBusinessLogic extends BaseBusinessLogic { } } - + public Either<ComponentInstanceInput, ResponseFormat> createOrUpdateInstanceInputValue(ComponentTypeEnum componentTypeEnum, String componentId, String resourceInstanceId, ComponentInstanceInput property, String userId) { Either<ComponentInstanceInput, ResponseFormat> resultOp = null; @@ -1239,9 +1494,9 @@ public abstract class ComponentInstanceBusinessLogic extends BaseBusinessLogic { resultOp = Either.right(componentsUtils.getResponseFormat(ActionStatus.RESOURCE_INSTANCE_NOT_FOUND_ON_SERVICE, resourceInstanceId, componentId)); return resultOp; } - + ComponentInstance foundResourceInstance = resourceInstanceStatus.left().value(); - + // lock resource StorageOperationStatus lockStatus = graphLockOperation.lockComponent(componentId, componentTypeEnum.getNodeType()); if (lockStatus != StorageOperationStatus.OK) { @@ -1276,44 +1531,38 @@ public abstract class ComponentInstanceBusinessLogic extends BaseBusinessLogic { } Either<Object, Boolean> isValid = propertyOperation.validateAndUpdatePropertyValue(propertyType, property.getValue(), true, innerType, allDataTypes.left().value()); - String newValue = property.getValue(); if (isValid.isRight()) { Boolean res = isValid.right().value(); - if (res == false) { + if (!res) { return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertTitanStatusToStorageStatus(TitanOperationStatus.ILLEGAL_ARGUMENT)))); } - } else { - Object object = isValid.left().value(); - if (object != null) { - newValue = object.toString(); - } - } + } try { List<ComponentInstanceInput> instanceProperties = containerComponent.getComponentInstancesInputs().get(resourceInstanceId); Optional<ComponentInstanceInput> instanceProperty = instanceProperties.stream().filter(p -> p.getUniqueId().equals(property.getUniqueId())).findAny(); StorageOperationStatus status; - if(instanceProperty.isPresent()){ + if (instanceProperty.isPresent()) { instanceProperty.get().setValue(property.getValue()); status = toscaOperationFacade.updateComponentInstanceInput(containerComponent, foundResourceInstance.getUniqueId(), property); } else { status = toscaOperationFacade.addComponentInstanceInput(containerComponent, foundResourceInstance.getUniqueId(), property); } - if(status != StorageOperationStatus.OK){ + if (status != StorageOperationStatus.OK) { ActionStatus actionStatus = componentsUtils.convertFromStorageResponseForResourceInstanceProperty(status); resultOp = Either.right(componentsUtils.getResponseFormatForResourceInstanceProperty(actionStatus, "")); return resultOp; } foundResourceInstance.setCustomizationUUID(UUID.randomUUID().toString()); Either<Component, StorageOperationStatus> updateContainerRes = toscaOperationFacade.updateComponentInstanceMetadataOfTopologyTemplate(containerComponent); - + if (updateContainerRes.isRight()) { ActionStatus actionStatus = componentsUtils.convertFromStorageResponseForResourceInstanceProperty(updateContainerRes.right().value()); resultOp = Either.right(componentsUtils.getResponseFormatForResourceInstanceProperty(actionStatus, "")); return resultOp; } - resultOp = Either.left(property); - return resultOp; + resultOp = Either.left(property); + return resultOp; } finally { if (resultOp == null || resultOp.isRight()) { @@ -1577,7 +1826,7 @@ public abstract class ComponentInstanceBusinessLogic extends BaseBusinessLogic { } private Either<Component, ResponseFormat> getAndValidateOriginComponentOfComponentInstance(ComponentTypeEnum containerComponentType, ComponentInstance componentInstance) { - + Either<Component, ResponseFormat> eitherResponse = null; ComponentTypeEnum componentType = getComponentTypeByParentComponentType(containerComponentType); Component component; @@ -1589,16 +1838,16 @@ public abstract class ComponentInstanceBusinessLogic extends BaseBusinessLogic { errorResponse = componentsUtils.getResponseFormat(actionStatus, Constants.EMPTY_STRING); eitherResponse = Either.right(errorResponse); } - if(eitherResponse == null) { + if (eitherResponse == null) { component = getComponentRes.left().value(); LifecycleStateEnum resourceCurrState = component.getLifecycleState(); if (resourceCurrState == LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT) { ActionStatus actionStatus = ActionStatus.ILLEGAL_COMPONENT_STATE; errorResponse = componentsUtils.getResponseFormat(actionStatus, component.getComponentType().toString(), component.getName(), resourceCurrState.toString()); - eitherResponse = Either.right(errorResponse); + eitherResponse = Either.right(errorResponse); } } - if(eitherResponse == null) { + if (eitherResponse == null) { eitherResponse = Either.left(getComponentRes.left().value()); } return eitherResponse; @@ -1632,7 +1881,7 @@ public abstract class ComponentInstanceBusinessLogic extends BaseBusinessLogic { return Either.right(validateCanWorkOnComponent.right().value()); } - Either<ComponentInstance, StorageOperationStatus> resourceInstanceStatus = getResourceInstanceById(containerComponent,componentInstanceId); + Either<ComponentInstance, StorageOperationStatus> resourceInstanceStatus = getResourceInstanceById(containerComponent, componentInstanceId); if (resourceInstanceStatus.isRight()) { resultOp = Either.right(componentsUtils.getResponseFormat(ActionStatus.RESOURCE_INSTANCE_NOT_FOUND_ON_SERVICE, componentInstanceId, containerComponentId)); return resultOp; @@ -1646,48 +1895,79 @@ public abstract class ComponentInstanceBusinessLogic extends BaseBusinessLogic { } try { + + if (currentResourceInstance.getComponentUid().equals(newComponentInstance.getComponentUid())) { resultOp = Either.left(currentResourceInstance); return resultOp; } String resourceId = newComponentInstance.getComponentUid(); + + + Either<Boolean, StorageOperationStatus> componentExistsRes = toscaOperationFacade.validateComponentExists(resourceId); - if(componentExistsRes.isRight()){ + if (componentExistsRes.isRight()) { log.debug("Failed to validate existing of the component {}. Status is {} ", resourceId); resultOp = Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(componentExistsRes.right().value()), resourceId)); return resultOp; - } - else if (!componentExistsRes.left().value()) { + } else if (!componentExistsRes.left().value()) { log.debug("The resource {} not found ", resourceId); resultOp = Either.right(componentsUtils.getResponseFormat(ActionStatus.RESOURCE_NOT_FOUND, resourceId)); return resultOp; } - // List<GroupInstance> groupInstances = currentResourceInstance.getGroupInstances(); - Map<String, ArtifactDefinition> deploymentArtifacts = currentResourceInstance.getDeploymentArtifacts(); + Either<Component, ResponseFormat> eitherOriginComponent = getOriginComponentFromComponentInstance(currentResourceInstance, true); + + if (eitherOriginComponent.isRight()) { + resultOp = Either.right(eitherOriginComponent.right().value()); + return resultOp; + } + DataForMergeHolder dataHolder = compInstMergeDataBL.saveAllDataBeforeDeleting(containerComponent, currentResourceInstance, eitherOriginComponent.left().value()); resultOp = deleteComponentInstance(containerComponent, componentInstanceId, containerComponentType); if (resultOp.isRight()) { log.debug("failed to delete resource instance {}", resourceId); return resultOp; } + ComponentInstance resResourceInfo = resultOp.left().value(); + Component origComponent = null; + OriginTypeEnum originType = currentResourceInstance.getOriginType(); + if (originType == OriginTypeEnum.ServiceProxy) { + Either<Component, StorageOperationStatus> serviceProxyOrigin = toscaOperationFacade.getLatestByName("serviceProxy"); + if (serviceProxyOrigin.isRight()) { + log.debug("Failed to fetch normative service proxy resource by tosca name, error {}", serviceProxyOrigin.right().value()); + return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(serviceProxyOrigin.right().value()))); + } + origComponent = serviceProxyOrigin.left().value(); - Either<Component, ResponseFormat> eitherResourceName = getOriginComponentNameFromComponentInstance(newComponentInstance, true); + StorageOperationStatus fillProxyRes = fillProxyInstanceData(newComponentInstance, origComponent); - if (eitherResourceName.isRight()) { - resultOp = Either.right(eitherResourceName.right().value()); - return resultOp; - } + if (fillProxyRes != StorageOperationStatus.OK) { + log.debug("Failed to fill service proxy resource data with data from service, error {}", fillProxyRes); + return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(fillProxyRes))); - Component origComponent = eitherResourceName.left().value(); + } + newComponentInstance.setOriginType(originType); + }else{ + + + Either<Component, ResponseFormat> eitherResourceName = getOriginComponentFromComponentInstance(newComponentInstance, true); + + if (eitherResourceName.isRight()) { + resultOp = Either.right(eitherResourceName.right().value()); + return resultOp; + } + + origComponent = eitherResourceName.left().value(); + + newComponentInstance.setName(resResourceInfo.getName()); + //newComponentInstance.setToscaComponentName(((ResourceMetadataDataDefinition) origComponent.getComponentMetadataDefinition().getMetadataDataDefinition()).getToscaResourceName()); + } - ComponentInstance resResourceInfo = resultOp.left().value(); - newComponentInstance.setName(resResourceInfo.getName()); newComponentInstance.setInvariantName(resResourceInfo.getInvariantName()); newComponentInstance.setPosX(resResourceInfo.getPosX()); newComponentInstance.setPosY(resResourceInfo.getPosY()); newComponentInstance.setDescription(resResourceInfo.getDescription()); - newComponentInstance.setToscaComponentName(((ResourceMetadataDataDefinition)origComponent.getComponentMetadataDefinition().getMetadataDataDefinition()).getToscaResourceName()); resultOp = createComponentInstanceOnGraph(containerComponent, origComponent, newComponentInstance, user); @@ -1702,29 +1982,25 @@ public abstract class ComponentInstanceBusinessLogic extends BaseBusinessLogic { return resultOp; } - /* if (CollectionUtils.isNotEmpty(groupInstances)) { - StorageOperationStatus addGroupsToComponentInstance = toscaOperationFacade.addGroupInstancesToComponentInstance(containerComponent, updatedComponentInstance, groupInstances); - if (addGroupsToComponentInstance != StorageOperationStatus.OK) { - BeEcompErrorManager.getInstance().logInternalFlowError("ChangeComponentInstanceVersion", "Failed to associate groups to new component instance", ErrorSeverity.ERROR); - resultOp = Either.right(componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR)); - return resultOp; - } - - + Either<Component, ResponseFormat> mergeStatusEither = compInstMergeDataBL.mergeComponentUserOrigData(user, dataHolder, containerComponent, containerComponentId, newComponentInstance.getUniqueId()); + if (mergeStatusEither.isRight()) { + return Either.right(mergeStatusEither.right().value()); } - if (MapUtils.isNotEmpty(deploymentArtifacts)) { - StorageOperationStatus addDeploymentArtifactsToComponentInstance = toscaOperationFacade.addDeploymentArtifactsToComponentInstance(containerComponent, updatedComponentInstance, deploymentArtifacts); - if (addDeploymentArtifactsToComponentInstance != StorageOperationStatus.OK) { - BeEcompErrorManager.getInstance().logInternalFlowError("ChangeComponentInstanceVersion", "Failed to associate groups to new component instance", ErrorSeverity.ERROR); - resultOp = Either.right(componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR)); - return resultOp; - } - }*/ - + /* + * if (CollectionUtils.isNotEmpty(groupInstances)) { StorageOperationStatus addGroupsToComponentInstance = toscaOperationFacade.addGroupInstancesToComponentInstance( containerComponent, updatedComponentInstance, groupInstances); if + * (addGroupsToComponentInstance != StorageOperationStatus.OK) { BeEcompErrorManager.getInstance().logInternalFlowError( "ChangeComponentInstanceVersion", "Failed to associate groups to new component instance", ErrorSeverity.ERROR); + * resultOp = Either.right(componentsUtils.getResponseFormat(ActionStatus. GENERAL_ERROR)); return resultOp; } + * + * + * } if (MapUtils.isNotEmpty(deploymentArtifacts)) { StorageOperationStatus addDeploymentArtifactsToComponentInstance = toscaOperationFacade.addDeploymentArtifactsToComponentInstance( containerComponent, updatedComponentInstance, + * deploymentArtifacts); if (addDeploymentArtifactsToComponentInstance != StorageOperationStatus.OK) { BeEcompErrorManager.getInstance().logInternalFlowError( "ChangeComponentInstanceVersion", + * "Failed to associate groups to new component instance", ErrorSeverity.ERROR); resultOp = Either.right(componentsUtils.getResponseFormat(ActionStatus. GENERAL_ERROR)); return resultOp; } } + */ + ComponentParametersView filter = new ComponentParametersView(true); filter.setIgnoreComponentInstances(false); - Either<Component, StorageOperationStatus> updatedComponentRes = toscaOperationFacade.getToscaElement(containerComponentId, filter); + Either<Component, StorageOperationStatus> updatedComponentRes = toscaOperationFacade.getToscaElement(containerComponentId, filter); if (updatedComponentRes.isRight()) { StorageOperationStatus storageOperationStatus = updatedComponentRes.right().value(); ActionStatus actionStatus = componentsUtils.convertFromStorageResponse(storageOperationStatus, containerComponent.getComponentType()); @@ -1732,7 +2008,7 @@ public abstract class ComponentInstanceBusinessLogic extends BaseBusinessLogic { log.debug("Component with id {} was not found", containerComponentId); return Either.right(responseFormat); } - resourceInstanceStatus = getResourceInstanceById(updatedComponentRes.left().value(),updatedComponentInstance.getUniqueId()); + resourceInstanceStatus = getResourceInstanceById(updatedComponentRes.left().value(), updatedComponentInstance.getUniqueId()); if (resourceInstanceStatus.isRight()) { resultOp = Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(resourceInstanceStatus.right().value()), updatedComponentInstance.getUniqueId())); return resultOp; @@ -1780,9 +2056,9 @@ public abstract class ComponentInstanceBusinessLogic extends BaseBusinessLogic { resultOp = Either.right(componentsUtils.getResponseFormat(ActionStatus.RESOURCE_INSTANCE_NOT_FOUND_ON_SERVICE, componentInstanceUniqueId, containerComponentId)); return resultOp; } - + List<ComponentInstanceProperty> instanceProperties = containerComponent.getComponentInstancesProperties().get(componentInstanceUniqueId); - if(CollectionUtils.isEmpty(instanceProperties)){ + if (CollectionUtils.isEmpty(instanceProperties)) { instanceProperties = new ArrayList<>(); } resultOp = Either.left(instanceProperties); @@ -1808,7 +2084,7 @@ public abstract class ComponentInstanceBusinessLogic extends BaseBusinessLogic { /** * updates componentInstance modificationTime - * + * * @param componentInstance * @param componentInstanceType * @param modificationTime @@ -1827,7 +2103,7 @@ public abstract class ComponentInstanceBusinessLogic extends BaseBusinessLogic { } return result; } - + public Either<ComponentInstance, ResponseFormat> deleteServiceProxy(String containerComponentType, String containerComponentId, String serviceProxyId, String userId) { // TODO Add implementation Either<ComponentInstance, ResponseFormat> result = Either.left(new ComponentInstance()); @@ -1845,7 +2121,7 @@ public abstract class ComponentInstanceBusinessLogic extends BaseBusinessLogic { Either<ComponentInstance, ResponseFormat> result = Either.left(new ComponentInstance()); return result; } - + private Boolean validateInstanceNameUniquenessUponUpdate(Component containerComponent, ComponentInstance oldComponentInstance, String newInstanceName) { Boolean isUnique = true; String newInstanceNormalizedName = ValidationUtils.normalizeComponentInstanceName(newInstanceName); @@ -1859,57 +2135,259 @@ public abstract class ComponentInstanceBusinessLogic extends BaseBusinessLogic { } private Either<ComponentInstance, StorageOperationStatus> getResourceInstanceById(Component containerComponent, String instanceId) { - + Either<ComponentInstance, StorageOperationStatus> result = null; List<ComponentInstance> instances = containerComponent.getComponentInstances(); Optional<ComponentInstance> foundInstance = null; - if(CollectionUtils.isEmpty(instances)){ + if (CollectionUtils.isEmpty(instances)) { result = Either.right(StorageOperationStatus.NOT_FOUND); } - if(result == null){ + if (result == null) { foundInstance = instances.stream().filter(i -> i.getUniqueId().equals(instanceId)).findFirst(); - if(!foundInstance.isPresent()){ + if (!foundInstance.isPresent()) { result = Either.right(StorageOperationStatus.NOT_FOUND); } } - if(result == null){ + if (result == null) { result = Either.left(foundInstance.get()); } return result; } - - private ComponentInstance buildComponentInstance(ComponentInstance resourceInstanceForUpdate, ComponentInstance origInstanceForUpdate) { - Long creationDate = origInstanceForUpdate.getCreationTime(); - + private ComponentInstance buildComponentInstance(ComponentInstance resourceInstanceForUpdate, ComponentInstance origInstanceForUpdate) { + + Long creationDate = origInstanceForUpdate.getCreationTime(); + Long modificationTime = System.currentTimeMillis(); resourceInstanceForUpdate.setCreationTime(creationDate); resourceInstanceForUpdate.setModificationTime(modificationTime); - + resourceInstanceForUpdate.setCustomizationUUID(origInstanceForUpdate.getCustomizationUUID()); - + if (StringUtils.isEmpty(resourceInstanceForUpdate.getName()) && StringUtils.isNotEmpty(origInstanceForUpdate.getName())) { resourceInstanceForUpdate.setName(origInstanceForUpdate.getName()); } - + resourceInstanceForUpdate.setNormalizedName(ValidationUtils.normalizeComponentInstanceName(resourceInstanceForUpdate.getName())); - + if (StringUtils.isEmpty(resourceInstanceForUpdate.getIcon())) - resourceInstanceForUpdate.setIcon(origInstanceForUpdate.getIcon()); - - + resourceInstanceForUpdate.setIcon(origInstanceForUpdate.getIcon()); + if (StringUtils.isEmpty(resourceInstanceForUpdate.getComponentVersion())) resourceInstanceForUpdate.setComponentVersion(origInstanceForUpdate.getComponentVersion()); - + if (StringUtils.isEmpty(resourceInstanceForUpdate.getComponentName())) resourceInstanceForUpdate.setComponentName(origInstanceForUpdate.getComponentName()); - + if (StringUtils.isEmpty(resourceInstanceForUpdate.getToscaComponentName())) - resourceInstanceForUpdate.setToscaComponentName(origInstanceForUpdate.getToscaComponentName()); - - if (resourceInstanceForUpdate.getOriginType() == null) { + resourceInstanceForUpdate.setToscaComponentName(origInstanceForUpdate.getToscaComponentName()); + + if (resourceInstanceForUpdate.getOriginType() == null) { resourceInstanceForUpdate.setOriginType(origInstanceForUpdate.getOriginType()); } + if(resourceInstanceForUpdate.getOriginType() == OriginTypeEnum.ServiceProxy) + resourceInstanceForUpdate.setIsProxy(true); + if (resourceInstanceForUpdate.getSourceModelInvariant() == null) { + resourceInstanceForUpdate.setSourceModelInvariant(origInstanceForUpdate.getSourceModelInvariant()); + } + if (resourceInstanceForUpdate.getSourceModelName() == null) { + resourceInstanceForUpdate.setSourceModelName(origInstanceForUpdate.getSourceModelName()); + } + if (resourceInstanceForUpdate.getSourceModelUuid() == null) { + resourceInstanceForUpdate.setSourceModelUuid(origInstanceForUpdate.getSourceModelUuid()); + } + if (resourceInstanceForUpdate.getSourceModelUid() == null) { + resourceInstanceForUpdate.setSourceModelUid(origInstanceForUpdate.getSourceModelUid()); + } return resourceInstanceForUpdate; } + /** + * Returns list of ComponentInstanceProperty belonging to component instance capability specified by name and type + * @param containerComponentType + * @param containerComponentId + * @param componentInstanceUniqueId + * @param capabilityType + * @param capabilityName + * @param userId + * @return + */ + public Either<List<ComponentInstanceProperty>, ResponseFormat> getComponentInstanceCapabilityPropertiesById(String containerComponentType, String containerComponentId, String componentInstanceUniqueId, String capabilityType, String capabilityName, String userId) { + + Component containerComponent = null; + + Either<List<ComponentInstanceProperty>, ResponseFormat> resultOp = null; + try { + Either<User, ResponseFormat> validateUserExists = validateUserExists(userId, "Get Component Instance Properties By Id", false); + if (validateUserExists.isRight()) { + resultOp = Either.right(validateUserExists.right().value()); + } + if(resultOp == null){ + Either<ComponentTypeEnum, ResponseFormat> validateComponentType = validateComponentType(containerComponentType); + if (validateComponentType.isRight()) { + resultOp = Either.right(validateComponentType.right().value()); + } + } + if(resultOp == null){ + Either<Component, StorageOperationStatus> validateContainerComponentExists = toscaOperationFacade.getToscaFullElement(containerComponentId); + if (validateContainerComponentExists.isRight()) { + resultOp = Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(validateContainerComponentExists.right().value()))); + } else { + containerComponent = validateContainerComponentExists.left().value(); + } + } + if(resultOp == null){ + Either<ComponentInstance, StorageOperationStatus> resourceInstanceStatus = getResourceInstanceById(containerComponent, componentInstanceUniqueId); + if (resourceInstanceStatus.isRight()) { + resultOp = Either.right(componentsUtils.getResponseFormat(ActionStatus.RESOURCE_INSTANCE_NOT_FOUND_ON_SERVICE, componentInstanceUniqueId, containerComponentId)); + } else { + resultOp = findCapabilityOfInstance(containerComponentId, componentInstanceUniqueId, capabilityType, capabilityName, resourceInstanceStatus.left().value().getCapabilities()); + } + } + return resultOp; + } finally { + unlockComponent(resultOp, containerComponent); + } + } + + private Either<List<ComponentInstanceProperty>, ResponseFormat> findCapabilityOfInstance( String componentId, String instanceId, String capabilityType, String capabilityName, Map<String, List<CapabilityDefinition>> instanceCapabilities) { + Either<List<ComponentInstanceProperty>, ResponseFormat> result = null; + CapabilityDefinition foundCapability; + if (MapUtils.isNotEmpty(instanceCapabilities)) { + List<CapabilityDefinition> capabilitiesPerType = instanceCapabilities.get(capabilityType); + if (capabilitiesPerType != null) { + Optional<CapabilityDefinition> capabilityOpt = capabilitiesPerType.stream().filter(c -> c.getName().equals(capabilityName)).findFirst(); + if (capabilityOpt.isPresent()) { + foundCapability = capabilityOpt.get(); + result = Either.left(foundCapability.getProperties() == null ? new ArrayList<>() : foundCapability.getProperties()); + } + } + } + if (result == null) { + result = fetchComponentInstanceCapabilityProperties(componentId, instanceId, capabilityType, capabilityName); + } + return result; + } + + private Either<List<ComponentInstanceProperty>, ResponseFormat> fetchComponentInstanceCapabilityProperties(String componentId, String instanceId, String capabilityType, String capabilityName) { + Either<List<ComponentInstanceProperty>, ResponseFormat> resultOp = null; + try { + Either<List<ComponentInstanceProperty>, StorageOperationStatus> getComponentInstanceCapabilityProperties = toscaOperationFacade.getComponentInstanceCapabilityProperties(componentId, instanceId, capabilityName, capabilityType); + if(getComponentInstanceCapabilityProperties.isRight()){ + resultOp = Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(getComponentInstanceCapabilityProperties.right().value()), capabilityType, instanceId, componentId)); + } else { + resultOp = Either.left(getComponentInstanceCapabilityProperties.left().value()); + } + } catch(Exception e){ + log.error("The exception {} occurred upon the component {} instance {} capability {} properties retrieving. ", componentId, instanceId, capabilityName, e); + resultOp = Either.right(componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR)); + } + return resultOp; + } + + private ResponseFormat updateCapabilityPropertyOnContainerComponent(ComponentInstanceProperty property, String newValue, Component containerComponent, ComponentInstance foundResourceInstance, + String capabilityType, String capabilityName) { + String componentInstanceUniqueId = foundResourceInstance.getUniqueId(); + StringBuilder sb = new StringBuilder(componentInstanceUniqueId); + sb.append(ModelConverter.CAP_PROP_DELIM).append(property.getOwnerId()).append(ModelConverter.CAP_PROP_DELIM).append(capabilityType).append(ModelConverter.CAP_PROP_DELIM).append(capabilityName); + String capKey = sb.toString(); + + Map<String, List<CapabilityDefinition>> capabilities = Optional.ofNullable(foundResourceInstance.getCapabilities()) + .orElse(Collections.emptyMap()); + List<CapabilityDefinition> capPerType = Optional.ofNullable(capabilities.get(capabilityType)).orElse(Collections.emptyList()); + Optional<CapabilityDefinition> cap = capPerType.stream().filter(c -> c.getName().equals(capabilityName)).findAny(); + if (cap.isPresent()) { + List<ComponentInstanceProperty> capProperties = cap.get().getProperties(); + if (capProperties != null) { + Optional<ComponentInstanceProperty> instanceProperty = capProperties.stream().filter(p -> p.getUniqueId().equals(property.getUniqueId())).findAny(); + StorageOperationStatus status; + if (instanceProperty.isPresent()) { + instanceProperty.get().setValue(newValue); + List<String> path = new ArrayList<>(); + path.add(componentInstanceUniqueId); + path.add(capKey); + instanceProperty.get().setPath(path); + status = toscaOperationFacade.updateComponentInstanceCapabiltyProperty(containerComponent, componentInstanceUniqueId, capKey, instanceProperty.get()); + if (status != StorageOperationStatus.OK) { + ActionStatus actionStatus = componentsUtils.convertFromStorageResponseForResourceInstanceProperty(status); + return componentsUtils.getResponseFormatForResourceInstanceProperty(actionStatus, ""); + + } + foundResourceInstance.setCustomizationUUID(UUID.randomUUID().toString()); + } + } + } + return componentsUtils.getResponseFormat(ActionStatus.OK); + } + + public Either<List<ComponentInstanceProperty>, ResponseFormat> updateInstanceCapabilityProperties(ComponentTypeEnum componentTypeEnum, String containerComponentId, String componentInstanceUniqueId, String capabilityType, String capabilityName, + List<ComponentInstanceProperty> properties, String userId) { + Either<List<ComponentInstanceProperty>, ResponseFormat> resultOp = null; + + Either<User, ResponseFormat> resp = validateUserExists(userId, "update instance capability property", false); + if (resp.isRight()) { + return Either.right(resp.right().value()); + } + + if (componentTypeEnum == null) { + BeEcompErrorManager.getInstance().logInvalidInputError("updateInstanceCapabilityProperty", "invalid component type", ErrorSeverity.INFO); + return Either.right(componentsUtils.getResponseFormat(ActionStatus.NOT_ALLOWED)); + } + Either<Component, StorageOperationStatus> getResourceResult = toscaOperationFacade.getToscaFullElement(containerComponentId); + + if (getResourceResult.isRight()) { + log.debug("Failed to retrieve component, component id {}", containerComponentId); + return Either.right(componentsUtils.getResponseFormat(ActionStatus.RESTRICTED_OPERATION)); + } + Component containerComponent = getResourceResult.left().value(); + + if (!ComponentValidationUtils.canWorkOnComponent(containerComponent, userId)) { + log.info("Restricted operation for user: {} on component {}", userId, containerComponentId); + return Either.right(componentsUtils.getResponseFormat(ActionStatus.RESTRICTED_OPERATION)); + } + Either<ComponentInstance, StorageOperationStatus> resourceInstanceStatus = getResourceInstanceById(containerComponent, componentInstanceUniqueId); + if (resourceInstanceStatus.isRight()) { + return Either.right(componentsUtils.getResponseFormat(ActionStatus.RESOURCE_INSTANCE_NOT_FOUND_ON_SERVICE, componentInstanceUniqueId, containerComponentId)); + } + ComponentInstance foundResourceInstance = resourceInstanceStatus.left().value(); + // lock resource + StorageOperationStatus lockStatus = graphLockOperation.lockComponent(containerComponentId, componentTypeEnum.getNodeType()); + if (lockStatus != StorageOperationStatus.OK) { + log.debug("Failed to lock component {}", containerComponentId); + return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(lockStatus))); + } + + Either<Map<String, DataTypeDefinition>, TitanOperationStatus> allDataTypes = dataTypeCache.getAll(); + if (allDataTypes.isRight()) { + TitanOperationStatus status = allDataTypes.right().value(); + BeEcompErrorManager.getInstance().logInternalFlowError("UpdatePropertyValueOnComponentInstance", "Failed to update property value on instance. Status is " + status, ErrorSeverity.ERROR); + return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertTitanStatusToStorageStatus(status)))); + } + + try { + for (ComponentInstanceProperty property : properties) { + Either<String, ResponseFormat> newPropertyValueEither = updatePropertyObjectValue(property, allDataTypes.left().value()); + newPropertyValueEither.bimap(updatedValue -> + updateCapabilityPropertyOnContainerComponent(property,updatedValue, containerComponent, foundResourceInstance, capabilityType, capabilityName), + responseFormat -> Either.right(responseFormat)); + } + Either<Component, StorageOperationStatus> updateContainerRes = toscaOperationFacade.updateComponentInstanceMetadataOfTopologyTemplate(containerComponent); + + if (updateContainerRes.isRight()) { + ActionStatus actionStatus = componentsUtils.convertFromStorageResponseForResourceInstanceProperty(updateContainerRes.right().value()); + resultOp = Either.right(componentsUtils.getResponseFormatForResourceInstanceProperty(actionStatus, "")); + return resultOp; + } + resultOp = Either.left(properties); + return resultOp; + + } finally { + if (resultOp == null || resultOp.isRight()) { + titanDao.rollback(); + } else { + titanDao.commit(); + } + // unlock resource + graphLockOperation.unlockComponent(containerComponentId, componentTypeEnum.getNodeType()); + } + } } @@ -69,7 +69,7 @@ public class CompositionBusinessLogic { boolean isNotAllPositionsCalculated = resource.getComponentInstances() == null || resource.getComponentInstances().stream().filter(p -> (p.getPosX() == null || p.getPosX().isEmpty()) || (p.getPosY() == null || p.getPosY().isEmpty())).findAny().isPresent(); - if (isNotAllPositionsCalculated) { + if (isNotAllPositionsCalculated && resource.getComponentInstances() != null) { // Arrange Icons In Spiral Pattern Map<ImmutablePair<Double, Double>, ComponentInstance> componentInstanceLocations = buildSpiralPatternPositioningForComponentInstances(resource); @@ -20,8 +20,6 @@ package org.openecomp.sdc.be.components.impl; -import static org.openecomp.sdc.be.tosca.CsarUtils.VF_NODE_TYPE_ARTIFACTS_PATH_PATTERN; - import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.StringReader; @@ -20,9 +20,12 @@ package org.openecomp.sdc.be.components.impl; -import org.springframework.beans.factory.annotation.Autowired; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; -import fj.data.Either; import org.apache.http.HttpStatus; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.dao.cassandra.AuditCassandraDao; @@ -43,7 +46,7 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import java.util.*; +import fj.data.Either; @Component("distributionMonitoringBusinessLogic") public class DistributionMonitoringBusinessLogic extends BaseBusinessLogic { @@ -20,10 +20,20 @@ package org.openecomp.sdc.be.components.impl; -import com.thinkaurelius.titan.core.TitanGraph; -import fj.data.Either; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Arrays; import java.util.EnumMap; +import java.util.HashMap; +import java.util.HashSet; import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import java.util.function.Predicate; +import java.util.stream.Collectors; + import org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.http.NameValuePair; import org.apache.http.client.utils.URLEncodedUtils; @@ -38,10 +48,27 @@ import org.openecomp.sdc.be.datamodel.api.CategoryTypeEnum; import org.openecomp.sdc.be.datamodel.utils.NodeTypeConvertUtils; import org.openecomp.sdc.be.datatypes.components.ComponentMetadataDataDefinition; import org.openecomp.sdc.be.datatypes.components.ResourceMetadataDataDefinition; -import org.openecomp.sdc.be.datatypes.enums.*; +import org.openecomp.sdc.be.datatypes.enums.AssetTypeEnum; +import org.openecomp.sdc.be.datatypes.enums.ComponentFieldsEnum; +import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; +import org.openecomp.sdc.be.datatypes.enums.FilterKeyEnum; import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum; +import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; +import org.openecomp.sdc.be.datatypes.enums.OriginTypeEnum; +import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.impl.ComponentsUtils; -import org.openecomp.sdc.be.model.*; +import org.openecomp.sdc.be.model.ArtifactType; +import org.openecomp.sdc.be.model.Component; +import org.openecomp.sdc.be.model.ComponentParametersView; +import org.openecomp.sdc.be.model.DistributionStatusEnum; +import org.openecomp.sdc.be.model.LifecycleStateEnum; +import org.openecomp.sdc.be.model.Product; +import org.openecomp.sdc.be.model.PropertyScope; +import org.openecomp.sdc.be.model.Resource; +import org.openecomp.sdc.be.model.ResourceMetadataDefinition; +import org.openecomp.sdc.be.model.Service; +import org.openecomp.sdc.be.model.Tag; +import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.model.category.CategoryDefinition; import org.openecomp.sdc.be.model.category.GroupingDefinition; import org.openecomp.sdc.be.model.category.SubCategoryDefinition; @@ -64,10 +91,9 @@ import org.openecomp.sdc.exception.ResponseFormat; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.nio.charset.StandardCharsets; -import java.util.*; -import java.util.function.Predicate; -import java.util.stream.Collectors; +import com.thinkaurelius.titan.core.TitanGraph; + +import fj.data.Either; @org.springframework.stereotype.Component("elementsBusinessLogic") public class ElementBusinessLogic extends BaseBusinessLogic { @@ -20,7 +20,6 @@ package org.openecomp.sdc.be.components.impl; -import java.io.IOException; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -42,17 +41,13 @@ import org.apache.commons.io.FilenameUtils; import org.apache.commons.lang.StringUtils; import org.apache.commons.lang3.math.NumberUtils; import org.apache.commons.lang3.tuple.ImmutablePair; -import org.codehaus.jackson.JsonGenerationException; -import org.codehaus.jackson.map.JsonMappingException; import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.config.BeEcompErrorManager.ErrorSeverity; import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.dao.jsongraph.utils.JsonParserUtils; import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; import org.openecomp.sdc.be.datatypes.elements.GroupDataDefinition; import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; -import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; import org.openecomp.sdc.be.info.ArtifactDefinitionInfo; import org.openecomp.sdc.be.info.ArtifactTemplateInfo; import org.openecomp.sdc.be.info.GroupDefinitionInfo; @@ -69,17 +64,15 @@ import org.openecomp.sdc.be.model.GroupTypeDefinition; import org.openecomp.sdc.be.model.PropertyDefinition; import org.openecomp.sdc.be.model.PropertyDefinition.GroupInstancePropertyValueUpdateBehavior; import org.openecomp.sdc.be.model.PropertyDefinition.PropertyNames; +import org.openecomp.sdc.be.model.Resource; +import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.model.cache.ApplicationDataTypeCache; import org.openecomp.sdc.be.model.jsontitan.operations.ArtifactsOperations; import org.openecomp.sdc.be.model.jsontitan.operations.GroupsOperation; -import org.openecomp.sdc.be.model.Resource; -import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.DaoStatusConverter; -import org.openecomp.sdc.be.model.operations.impl.GroupOperation; import org.openecomp.sdc.be.model.operations.impl.GroupTypeOperation; import org.openecomp.sdc.be.model.operations.impl.UniqueIdBuilder; -import org.openecomp.sdc.common.api.ArtifactTypeEnum; import org.openecomp.sdc.common.api.Constants; import org.openecomp.sdc.exception.ResponseFormat; import org.slf4j.Logger; @@ -88,7 +81,6 @@ import org.springframework.beans.factory.annotation.Autowired; import com.google.gson.Gson; import com.google.gson.GsonBuilder; -import com.google.gson.JsonSyntaxException; import fj.data.Either; @@ -20,7 +20,15 @@ package org.openecomp.sdc.be.components.impl; -import fj.data.Either; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.function.Consumer; +import java.util.stream.Collectors; + +import javax.annotation.Resource; + import org.apache.commons.lang3.tuple.ImmutablePair; import org.openecomp.sdc.be.components.impl.CommonImportManager.ElementTypeEnum; import org.openecomp.sdc.be.components.impl.ImportUtils.ToscaTagNamesEnum; @@ -37,13 +45,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; -import javax.annotation.Resource; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.function.Consumer; -import java.util.stream.Collectors; +import fj.data.Either; @Component("groupTypeImportManager") public class GroupTypeImportManager { @@ -21,7 +21,6 @@ package org.openecomp.sdc.be.components.impl; import java.io.IOException; -import java.lang.reflect.Type; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -38,6 +37,8 @@ import javax.annotation.PostConstruct; import javax.annotation.PreDestroy; import javax.annotation.Resource; +import org.apache.commons.lang3.tuple.ImmutablePair; +import org.apache.commons.lang3.tuple.Pair; import org.apache.http.HttpEntity; import org.apache.http.HttpStatus; import org.apache.http.client.config.RequestConfig; @@ -54,18 +55,18 @@ import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.dao.api.IEsHealthCheckDao; import org.openecomp.sdc.be.dao.titan.TitanGenericDao; import org.openecomp.sdc.be.switchover.detector.SwitchoverDetector; +import org.openecomp.sdc.common.api.Constants; import org.openecomp.sdc.common.api.HealthCheckInfo; -import org.openecomp.sdc.common.api.HealthCheckInfo.HealthCheckComponent; import org.openecomp.sdc.common.api.HealthCheckInfo.HealthCheckStatus; -import org.openecomp.sdc.common.api.HealthCheckWrapper; import org.openecomp.sdc.common.impl.ExternalConfiguration; +import org.openecomp.sdc.common.util.HealthCheckUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import com.google.gson.Gson; -import com.google.gson.reflect.TypeToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; @Component("healthCheckBusinessLogic") public class HealthCheckBusinessLogic { @@ -135,12 +136,26 @@ public class HealthCheckBusinessLogic { return true; } - public List<HealthCheckInfo> getBeHealthCheckInfosStatus() { + public Pair<Boolean, List<HealthCheckInfo>> getBeHealthCheckInfosStatus() { - return prevBeHealthCheckInfos; + return new ImmutablePair<Boolean, List<HealthCheckInfo>>(getAggregateBeStatus(prevBeHealthCheckInfos), prevBeHealthCheckInfos); } + private Boolean getAggregateBeStatus(List<HealthCheckInfo> beHealthCheckInfos) { + + Boolean status = true; + + for (HealthCheckInfo healthCheckInfo : beHealthCheckInfos) { + if (healthCheckInfo.getHealthCheckStatus().equals(HealthCheckStatus.DOWN) && !healthCheckInfo.getHealthCheckComponent().equals(Constants.HC_COMPONENT_DISTRIBUTION_ENGINE)) { + status = false; + break; + } + } + return status; + } + + private List<HealthCheckInfo> getBeHealthCheckInfos() { log.trace("In getBeHealthCheckInfos"); @@ -150,9 +165,6 @@ public class HealthCheckBusinessLogic { // BE getBeHealthCheck(healthCheckInfos); - /*// ES - getEsHealthCheck(healthCheckInfos);*/ - // Titan getTitanHealthCheck(healthCheckInfos); @@ -165,18 +177,21 @@ public class HealthCheckBusinessLogic { // Amdocs getAmdocsHealthCheck(healthCheckInfos); + //DCAE + getDcaeHealthCheck(healthCheckInfos); + return healthCheckInfos; } private List<HealthCheckInfo> getBeHealthCheck(List<HealthCheckInfo> healthCheckInfos) { String appVersion = ExternalConfiguration.getAppVersion(); String description = "OK"; - healthCheckInfos.add(new HealthCheckInfo(HealthCheckComponent.BE, HealthCheckStatus.UP, appVersion, description)); + healthCheckInfos.add(new HealthCheckInfo(Constants.HC_COMPONENT_BE, HealthCheckStatus.UP, appVersion, description)); return healthCheckInfos; } //Removed from aggregate HC - TDP 293490 -/* private List<HealthCheckInfo> getEsHealthCheck(List<HealthCheckInfo> healthCheckInfos) { + /* private List<HealthCheckInfo> getEsHealthCheck(List<HealthCheckInfo> healthCheckInfos) { // ES health check and version HealthCheckStatus healthCheckStatus; @@ -198,7 +213,7 @@ public class HealthCheckBusinessLogic { healthCheckInfos.add(new HealthCheckInfo(HealthCheckComponent.ES, healthCheckStatus, null, description)); return healthCheckInfos; } -*/ + */ public List<HealthCheckInfo> getTitanHealthCheck(List<HealthCheckInfo> healthCheckInfos) { // Titan health check and version String description; @@ -208,15 +223,15 @@ public class HealthCheckBusinessLogic { isTitanUp = titanGenericDao.isGraphOpen(); } catch (Exception e) { description = "Titan error: " + e.getMessage(); - healthCheckInfos.add(new HealthCheckInfo(HealthCheckComponent.TITAN, HealthCheckStatus.DOWN, null, description)); + healthCheckInfos.add(new HealthCheckInfo(Constants.HC_COMPONENT_TITAN, HealthCheckStatus.DOWN, null, description)); return healthCheckInfos; } if (isTitanUp) { description = "OK"; - healthCheckInfos.add(new HealthCheckInfo(HealthCheckComponent.TITAN, HealthCheckStatus.UP, null, description)); + healthCheckInfos.add(new HealthCheckInfo(Constants.HC_COMPONENT_TITAN, HealthCheckStatus.UP, null, description)); } else { description = "Titan graph is down"; - healthCheckInfos.add(new HealthCheckInfo(HealthCheckComponent.TITAN, HealthCheckStatus.DOWN, null, description)); + healthCheckInfos.add(new HealthCheckInfo(Constants.HC_COMPONENT_TITAN, HealthCheckStatus.DOWN, null, description)); } return healthCheckInfos; } @@ -234,10 +249,10 @@ public class HealthCheckBusinessLogic { } if (isCassandraUp) { description = "OK"; - healthCheckInfos.add(new HealthCheckInfo(HealthCheckComponent.CASSANDRA, HealthCheckStatus.UP, null, description)); + healthCheckInfos.add(new HealthCheckInfo(Constants.HC_COMPONENT_CASSANDRA, HealthCheckStatus.UP, null, description)); } else { description = "Cassandra is down"; - healthCheckInfos.add(new HealthCheckInfo(HealthCheckComponent.CASSANDRA, HealthCheckStatus.DOWN, null, description)); + healthCheckInfos.add(new HealthCheckInfo(Constants.HC_COMPONENT_CASSANDRA, HealthCheckStatus.DOWN, null, description)); } return healthCheckInfos; @@ -252,71 +267,92 @@ public class HealthCheckBusinessLogic { } private List<HealthCheckInfo> getAmdocsHealthCheck(List<HealthCheckInfo> healthCheckInfos) { + HealthCheckInfo beHealthCheckInfo = getHostedComponentsBeHealthCheck(Constants.HC_COMPONENT_ON_BOARDING, buildOnBoardingHealthCheckUrl()); + healthCheckInfos.add(beHealthCheckInfo); + return healthCheckInfos; + } + + private List<HealthCheckInfo> getDcaeHealthCheck(List<HealthCheckInfo> healthCheckInfos) { + HealthCheckInfo beHealthCheckInfo = getHostedComponentsBeHealthCheck(Constants.HC_COMPONENT_DCAE, buildDcaeHealthCheckUrl()); + healthCheckInfos.add(beHealthCheckInfo); + return healthCheckInfos; + } + + private HealthCheckInfo getHostedComponentsBeHealthCheck(String componentName, String healthCheckUrl) { HealthCheckStatus healthCheckStatus; String description; String version = null; List<HealthCheckInfo> componentsInfo = new ArrayList<>(); CloseableHttpClient httpClient = getHttpClient(); - String amdocsHealtchCheckUrl = buildHealthCheckUrl(); - HttpGet httpGet = new HttpGet(amdocsHealtchCheckUrl); - CloseableHttpResponse beResponse; - int beStatus; - try { - beResponse = httpClient.execute(httpGet); - beStatus = beResponse.getStatusLine().getStatusCode(); - - StringBuilder sb = new StringBuilder(); - - if (beStatus == HttpStatus.SC_OK || beStatus == HttpStatus.SC_INTERNAL_SERVER_ERROR) { - HttpEntity entity = beResponse.getEntity(); - String beJsonResponse = EntityUtils.toString(entity); - Gson gson = new Gson(); - HealthCheckWrapper healthCheckWrapper = gson.fromJson(beJsonResponse, HealthCheckWrapper.class); - version = healthCheckWrapper.getSdcVersion(); - componentsInfo = healthCheckWrapper.getComponentsInfo(); - - if (componentsInfo != null) { - componentsInfo.forEach(x -> { - if (x.getHealthCheckStatus() == HealthCheckStatus.DOWN) { - sb.append("Component " + x.getHealthCheckComponent().name() + " is Down, "); - } - }); + + if (healthCheckUrl != null) { + HttpGet httpGet = new HttpGet(healthCheckUrl); + CloseableHttpResponse beResponse; + int beStatus; + try { + beResponse = httpClient.execute(httpGet); + beStatus = beResponse.getStatusLine().getStatusCode(); + + String aggDescription = ""; + + if (beStatus == HttpStatus.SC_OK || beStatus == HttpStatus.SC_INTERNAL_SERVER_ERROR) { + HttpEntity entity = beResponse.getEntity(); + String beJsonResponse = EntityUtils.toString(entity); + log.trace("{} Health Check response: {}", componentName, beJsonResponse); + + ObjectMapper mapper = new ObjectMapper(); + Map<String, Object> healthCheckMap = mapper.readValue(beJsonResponse, new TypeReference<Map<String, Object>>(){}); + version = healthCheckMap.get("sdcVersion") != null ? healthCheckMap.get("sdcVersion").toString() : null; + if (healthCheckMap.containsKey("componentsInfo")) { + componentsInfo = mapper.convertValue(healthCheckMap.get("componentsInfo"), new TypeReference<List<HealthCheckInfo>>() {}); + } + + if (componentsInfo.size() > 0) { + aggDescription = HealthCheckUtil.getAggregateDescription(componentsInfo, null); + } else { + componentsInfo.add(new HealthCheckInfo(Constants.HC_COMPONENT_BE, HealthCheckStatus.DOWN, null, null)); + } } else { - componentsInfo.add(new HealthCheckInfo(HealthCheckComponent.BE, HealthCheckStatus.DOWN, null, null)); + log.trace("{} Health Check Response code: {}", componentName, beStatus); } - } - if (beStatus != HttpStatus.SC_OK) { - healthCheckStatus = HealthCheckStatus.DOWN; - //Removing the last comma - description = sb.length()>0 - ? sb.substring(0, sb.length()-1) - : "Onboarding is Down, specific reason unknown";//No Amdocs inner component returned DOWN, but the status of Amdocs HC is still DOWN. - if (componentsInfo.size() == 0) { - componentsInfo.add(new HealthCheckInfo(HealthCheckComponent.BE, HealthCheckStatus.DOWN, null, description)); + if (beStatus != HttpStatus.SC_OK) { + healthCheckStatus = HealthCheckStatus.DOWN; + description = aggDescription.length() > 0 + ? aggDescription + : componentName + " is Down, specific reason unknown";//No inner component returned DOWN, but the status of HC is still DOWN. + if (componentsInfo.size() == 0) { + componentsInfo.add(new HealthCheckInfo(Constants.HC_COMPONENT_BE, HealthCheckStatus.DOWN, null, description)); + } + } else { + healthCheckStatus = HealthCheckStatus.UP; + description = "OK"; } - } else { - healthCheckStatus = HealthCheckStatus.UP; - description = "OK"; - } - } catch (Exception e) { - healthCheckStatus = HealthCheckStatus.DOWN; - description = "Onboarding unexpected response: " + e.getMessage(); - componentsInfo.add(new HealthCheckInfo(HealthCheckComponent.BE, HealthCheckStatus.DOWN, null, description)); - } finally { - if (httpClient != null) { - try { - httpClient.close(); - } catch (IOException e) { - e.printStackTrace(); + } catch (Exception e) { + log.error("{} unexpected response: ", componentName, e); + healthCheckStatus = HealthCheckStatus.DOWN; + description = componentName + " unexpected response: " + e.getMessage(); + if (componentsInfo != null && componentsInfo.size() == 0) { + componentsInfo.add(new HealthCheckInfo(Constants.HC_COMPONENT_BE, HealthCheckStatus.DOWN, null, description)); + } + } finally { + if (httpClient != null) { + try { + httpClient.close(); + } catch (IOException e) { + log.error("closing http client has failed" , e); + } } } + } else { + healthCheckStatus = HealthCheckStatus.DOWN; + description = componentName + " health check Configuration is missing"; + componentsInfo.add(new HealthCheckInfo(Constants.HC_COMPONENT_BE, HealthCheckStatus.DOWN, null, description)); } - healthCheckInfos.add(new HealthCheckInfo(HealthCheckComponent.ON_BOARDING, healthCheckStatus, version, description, componentsInfo)); - return healthCheckInfos; + return new HealthCheckInfo(componentName, healthCheckStatus, version, description, componentsInfo); } private CloseableHttpClient getHttpClient() { @@ -371,20 +407,6 @@ public class HealthCheckBusinessLogic { } } - - private boolean getAggregateBeStatus(List<HealthCheckInfo> beHealthCheckInfos) { - - boolean status = true; - - for (HealthCheckInfo healthCheckInfo : beHealthCheckInfos) { - if (healthCheckInfo.getHealthCheckStatus().equals(HealthCheckStatus.DOWN) && healthCheckInfo.getHealthCheckComponent() != HealthCheckComponent.DE) { - status = false; - break; - } - } - return status; - } - } private void logAlarm(boolean prevHealthState) { @@ -410,8 +432,8 @@ public class HealthCheckBusinessLogic { if (beHealthCheckInfos != null && prevBeHealthCheckInfos != null) { - Map<HealthCheckComponent, HealthCheckStatus> currentValues = beHealthCheckInfos.stream().collect(Collectors.toMap(p -> p.getHealthCheckComponent(), p -> p.getHealthCheckStatus())); - Map<HealthCheckComponent, HealthCheckStatus> prevValues = prevBeHealthCheckInfos.stream().collect(Collectors.toMap(p -> p.getHealthCheckComponent(), p -> p.getHealthCheckStatus())); + Map<String, HealthCheckStatus> currentValues = beHealthCheckInfos.stream().collect(Collectors.toMap(p -> p.getHealthCheckComponent(), p -> p.getHealthCheckStatus())); + Map<String, HealthCheckStatus> prevValues = prevBeHealthCheckInfos.stream().collect(Collectors.toMap(p -> p.getHealthCheckComponent(), p -> p.getHealthCheckStatus())); if (currentValues != null && prevValues != null) { int currentSize = currentValues.size(); @@ -421,7 +443,7 @@ public class HealthCheckBusinessLogic { result = true; //extra/missing component - Map<HealthCheckComponent, HealthCheckStatus> notPresent = null; + Map<String, HealthCheckStatus> notPresent = null; if (currentValues.keySet().containsAll(prevValues.keySet())) { notPresent = new HashMap<>(currentValues); notPresent.keySet().removeAll(prevValues.keySet()); @@ -430,15 +452,15 @@ public class HealthCheckBusinessLogic { notPresent.keySet().removeAll(currentValues.keySet()); } - for (HealthCheckComponent component : notPresent.keySet()) { + for (String component : notPresent.keySet()) { logAlarm(String.format(COMPONENT_CHANGED_MESSAGE, component, prevValues.get(component), currentValues.get(component))); } // HealthCheckComponent changedComponent = notPresent.keySet().iterator().next(); } else { - for (Entry<HealthCheckComponent, HealthCheckStatus> entry : currentValues.entrySet()) { - HealthCheckComponent key = entry.getKey(); + for (Entry<String, HealthCheckStatus> entry : currentValues.entrySet()) { + String key = entry.getKey(); HealthCheckStatus value = entry.getValue(); if (!prevValues.containsKey(key)) { @@ -468,15 +490,37 @@ public class HealthCheckBusinessLogic { return result; } - private String buildHealthCheckUrl() { + private String buildOnBoardingHealthCheckUrl() { Configuration.OnboardingConfig onboardingConfig = ConfigurationManager.getConfigurationManager().getConfiguration().getOnboarding(); - String protocol = onboardingConfig.getProtocol(); - String host = onboardingConfig.getHost(); - Integer port = onboardingConfig.getPort(); - String uri = onboardingConfig.getHealthCheckUri(); + if (onboardingConfig != null) { + String protocol = onboardingConfig.getProtocol(); + String host = onboardingConfig.getHost(); + Integer port = onboardingConfig.getPort(); + String uri = onboardingConfig.getHealthCheckUri(); + + return protocol + "://" + host + ":" + port + uri; + } + + log.error("onboarding health check configuration is missing."); + return null; + } + + private String buildDcaeHealthCheckUrl() { + + Configuration.DcaeConfig dcaeConfig = ConfigurationManager.getConfigurationManager().getConfiguration().getDcae(); + + if (dcaeConfig != null) { + String protocol = dcaeConfig.getProtocol(); + String host = dcaeConfig.getHost(); + Integer port = dcaeConfig.getPort(); + String uri = dcaeConfig.getHealthCheckUri(); + + return protocol + "://" + host + ":" + port + uri; + } - return protocol + "://" + host + ":" + port + uri; + log.error("dcae health check configuration is missing."); + return null; } } @@ -21,7 +21,15 @@ package org.openecomp.sdc.be.components.impl; import java.lang.reflect.Type; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; import java.util.Map.Entry; import java.util.function.Consumer; import java.util.function.Function; @@ -20,31 +20,6 @@ package org.openecomp.sdc.be.components.impl; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.function.Predicate; -import java.util.stream.Collectors; - -import org.apache.commons.codec.binary.Base64; -import org.openecomp.sdc.be.config.ConfigurationManager; -import org.openecomp.sdc.be.config.Configuration.ArtifactTypeConfig; -import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; -import org.openecomp.sdc.be.model.ArtifactDefinition; -import org.openecomp.sdc.be.model.Component; -import org.openecomp.sdc.be.model.ComponentInstance; -import org.openecomp.sdc.be.model.Resource; -import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; -import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum; -import org.openecomp.sdc.common.api.ArtifactTypeEnum; -import org.openecomp.sdc.common.datastructure.Wrapper; -import org.openecomp.sdc.exception.ResponseFormat; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import fj.data.Either; - //Pavel //currently NOT IN USE - there are no informational deployed artifacts after US601880 @@ -20,12 +20,19 @@ package org.openecomp.sdc.be.components.impl; -import java.util.*; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; import java.util.Map.Entry; +import java.util.Optional; +import java.util.Set; import java.util.function.BiConsumer; import java.util.stream.Collectors; -import jline.internal.Log; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.MapUtils; import org.json.simple.JSONObject; @@ -50,7 +57,6 @@ import org.openecomp.sdc.be.model.IComponentInstanceConnectedElement; import org.openecomp.sdc.be.model.InputDefinition; import org.openecomp.sdc.be.model.PropertyDefinition; import org.openecomp.sdc.be.model.User; - import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.DaoStatusConverter; import org.openecomp.sdc.be.model.operations.impl.UniqueIdBuilder; @@ -65,6 +71,7 @@ import org.yaml.snakeyaml.Yaml; import com.google.gson.Gson; import fj.data.Either; +import jline.internal.Log; @Component("inputsBusinessLogic") public class InputsBusinessLogic extends BaseBusinessLogic { @@ -311,6 +318,7 @@ public class InputsBusinessLogic extends BaseBusinessLogic { } currentInput.setDefaultValue(newValue); + currentInput.setOwnerId(userId); Either<InputDefinition, StorageOperationStatus> status = toscaOperationFacade.updateInputOfComponent(component, currentInput); @@ -473,6 +481,7 @@ public class InputsBusinessLogic extends BaseBusinessLogic { } + assignOwnerIdToInputs(userId, inputsToCreate); Either<List<InputDefinition>, StorageOperationStatus> assotiateInputsEither = toscaOperationFacade.addInputsToComponent(inputsToCreate, component.getUniqueId()); if(assotiateInputsEither.isRight()){ @@ -524,6 +533,10 @@ public class InputsBusinessLogic extends BaseBusinessLogic { } + private void assignOwnerIdToInputs(String userId, Map<String, InputDefinition> inputsToCreate) { + inputsToCreate.values().forEach(inputDefinition -> inputDefinition.setOwnerId(userId)); + } + private StorageOperationStatus addInputsToComponent(String componentId, Map<String, InputDefinition> inputsToCreate, Map<String, List<ComponentInstanceInput>> inputsValueToCreateMap, Map<String, DataTypeDefinition> allDataTypes, List<InputDefinition> resList, int index, String compInstId, String compInstname, org.openecomp.sdc.be.model.Component origComponent, InputDefinition input) { @@ -642,7 +655,7 @@ public class InputsBusinessLogic extends BaseBusinessLogic { } Map<String, InputDefinition> inputs = inputsDefinitions.stream().collect(Collectors.toMap( o -> o.getName(), o -> o)); - result = createInputsInGraph(inputs, component, user, inTransaction); + result = createInputsInGraph(inputs, component); } return result; @@ -669,7 +682,7 @@ public class InputsBusinessLogic extends BaseBusinessLogic { } - public Either<List<InputDefinition>, ResponseFormat> createInputsInGraph(Map<String, InputDefinition> inputs, org.openecomp.sdc.be.model.Component component, User user, boolean inTransaction) { + public Either<List<InputDefinition>, ResponseFormat> createInputsInGraph(Map<String, InputDefinition> inputs, org.openecomp.sdc.be.model.Component component) { List<InputDefinition> resList = inputs.values().stream().collect(Collectors.toList()); Either<List<InputDefinition>, ResponseFormat> result = Either.left(resList); @@ -1212,7 +1225,7 @@ public class InputsBusinessLogic extends BaseBusinessLogic { propInput.setOwnerId(null); propInput.setParentUniqueId(null); - Either<InputDefinition, StorageOperationStatus> createInputRes = createInputForComponentInstance(component, origComponent,ci, inputsToCreate, propertiesToCreate, inputsValueToCreate, dataTypes, inputName, propInput, isInputValue); + Either<InputDefinition, StorageOperationStatus> createInputRes = createInputForComponentInstance(component, ci, inputsToCreate, propertiesToCreate, inputsValueToCreate, inputName, propInput, isInputValue); if (createInputRes.isRight()) { log.debug("Failed to create input of resource instance for id {} error {}", compInstId, createInputRes.right().value()); @@ -1235,7 +1248,7 @@ public class InputsBusinessLogic extends BaseBusinessLogic { return Either.left(resList); } - private Either<InputDefinition, StorageOperationStatus> createInputForComponentInstance(org.openecomp.sdc.be.model.Component component,org.openecomp.sdc.be.model.Component orignComponent, ComponentInstance ci, Map<String, InputDefinition> inputsToCreate, List<ComponentInstanceProperty> propertiesToCreate, List<ComponentInstanceInput> inputsValueToCreate, Map<String, DataTypeDefinition> dataTypes, String inputName, ComponentInstancePropInput propInput, boolean isInputValue) { + private Either<InputDefinition, StorageOperationStatus> createInputForComponentInstance(org.openecomp.sdc.be.model.Component component, ComponentInstance ci, Map<String, InputDefinition> inputsToCreate, List<ComponentInstanceProperty> propertiesToCreate, List<ComponentInstanceInput> inputsValueToCreate, String inputName, ComponentInstancePropInput propInput, boolean isInputValue) { String propertiesName = propInput.getPropertiesName() ; PropertyDefinition selectedProp = propInput.getInput(); String[] parsedPropNames = propInput.getParsedPropNames(); @@ -20,7 +20,12 @@ package org.openecomp.sdc.be.components.impl; -import fj.data.Either; +import java.util.List; +import java.util.Map; +import java.util.function.Consumer; + +import javax.annotation.Resource; + import org.apache.commons.lang3.tuple.ImmutablePair; import org.openecomp.sdc.be.components.impl.CommonImportManager.ElementTypeEnum; import org.openecomp.sdc.be.components.impl.ImportUtils.ToscaTagNamesEnum; @@ -34,10 +39,7 @@ import org.openecomp.sdc.exception.ResponseFormat; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import javax.annotation.Resource; -import java.util.List; -import java.util.Map; -import java.util.function.Consumer; +import fj.data.Either; @Component("policyTypeImportManager") public class PolicyTypeImportManager { @@ -22,11 +22,8 @@ package org.openecomp.sdc.be.components.impl; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; -import org.openecomp.sdc.exception.ResponseFormat; import org.springframework.stereotype.Component; -import fj.data.Either; - @Component("productComponentInstanceBusinessLogic") public class ProductComponentInstanceBusinessLogic extends ComponentInstanceBusinessLogic { @@ -20,11 +20,16 @@ package org.openecomp.sdc.be.components.impl; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonElement; -import com.google.gson.reflect.TypeToken; -import fj.data.Either; +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.function.Supplier; + +import javax.servlet.ServletContext; + import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.tuple.ImmutablePair; import org.openecomp.sdc.be.config.BeEcompErrorManager; @@ -57,14 +62,12 @@ import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; import org.springframework.web.context.WebApplicationContext; -import javax.servlet.ServletContext; -import java.lang.reflect.Type; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.function.Supplier; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonElement; +import com.google.gson.reflect.TypeToken; + +import fj.data.Either; @Component("propertyBusinessLogic") public class PropertyBusinessLogic extends BaseBusinessLogic { @@ -229,7 +232,7 @@ public class PropertyBusinessLogic extends BaseBusinessLogic { return Either.right(componentsUtils.getResponseFormat(ActionStatus.PROPERTY_NOT_FOUND, "")); } for (PropertyDefinition property : properties) { - if (property.getUniqueId().equals(propertyId) && isPropertyBelongsToResource(property, resourceId)) { + if (property.getUniqueId().equals(propertyId) ) { Map<String, PropertyDefinition> propMap = new HashMap<>(); propMap.put(property.getName(), property); return Either.left(propMap.entrySet().iterator().next()); @@ -55,6 +55,8 @@ import org.openecomp.sdc.be.components.impl.ImportUtils.ToscaTagNamesEnum; import org.openecomp.sdc.be.components.lifecycle.LifecycleBusinessLogic; import org.openecomp.sdc.be.components.lifecycle.LifecycleChangeInfoWithAction; import org.openecomp.sdc.be.components.lifecycle.LifecycleChangeInfoWithAction.LifecycleChanceActionEnum; +import org.openecomp.sdc.be.components.merge.resource.MergeResourceBLFactory; +import org.openecomp.sdc.be.components.merge.resource.MergeResourceBusinessLogic; import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.config.BeEcompErrorManager.ErrorSeverity; import org.openecomp.sdc.be.config.Configuration.VfModuleProperty; @@ -76,6 +78,7 @@ import org.openecomp.sdc.be.info.ArtifactTemplateInfo; import org.openecomp.sdc.be.info.MergedArtifactInfo; import org.openecomp.sdc.be.model.ArtifactDefinition; import org.openecomp.sdc.be.model.CapabilityDefinition; +import org.openecomp.sdc.be.model.CapabilityRequirementRelationship; import org.openecomp.sdc.be.model.CapabilityTypeDefinition; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentInstance; @@ -97,7 +100,7 @@ import org.openecomp.sdc.be.model.Operation; import org.openecomp.sdc.be.model.ParsedToscaYamlInfo; import org.openecomp.sdc.be.model.PropertyDefinition; import org.openecomp.sdc.be.model.RelationshipImpl; -import org.openecomp.sdc.be.model.RequirementAndRelationshipPair; +import org.openecomp.sdc.be.model.RelationshipInfo; import org.openecomp.sdc.be.model.RequirementCapabilityRelDef; import org.openecomp.sdc.be.model.RequirementDefinition; import org.openecomp.sdc.be.model.Resource; @@ -127,7 +130,6 @@ import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; import org.openecomp.sdc.be.servlets.RepresentationUtils; import org.openecomp.sdc.be.tosca.CsarUtils; import org.openecomp.sdc.be.tosca.CsarUtils.NonMetaArtifactInfo; -import org.openecomp.sdc.be.tosca.ToscaUtils; import org.openecomp.sdc.be.ui.model.UiComponentDataTransfer; import org.openecomp.sdc.be.user.IUserBusinessLogic; import org.openecomp.sdc.be.user.Role; @@ -215,6 +217,9 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { @Autowired private ApplicationDataTypeCache dataTypeCache; + @Autowired + private MergeResourceBLFactory mergeResourceBLFactory; + private Gson gson = new Gson(); public CsarOperation getCsarOperation() { @@ -539,20 +544,12 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { } Map<String, EnumMap<ArtifactOperationEnum, List<ArtifactDefinition>>> nodeTypesArtifactsToHandle = findNodeTypesArtifactsToHandleRes.left().value(); try{ - result = updateResourceFromYaml(oldRresource, newRresource, updateResource, createdArtifacts, isUpdateYaml, yamlFileName, yamlFileContents, csarInfo, nodeTypesInfo, nodeTypesArtifactsToHandle, null); + result = updateResourceFromYaml(oldRresource, newRresource, updateResource, createdArtifacts, isUpdateYaml, yamlFileName, yamlFileContents, csarInfo, nodeTypesInfo, nodeTypesArtifactsToHandle, null, false); } finally { if (result == null || result.isRight()) { log.warn("operation failed. do rollback"); titanDao.rollback(); - if (!createdArtifacts.isEmpty()) { - StorageOperationStatus deleteFromEsRes = artifactsBusinessLogic.deleteAllComponentArtifactsIfNotOnGraph(createdArtifacts); - if (!deleteFromEsRes.equals(StorageOperationStatus.OK)) { - ActionStatus actionStatus = componentsUtils.convertFromStorageResponse(deleteFromEsRes); - result = Either.right(componentsUtils.getResponseFormat(actionStatus, oldRresource.getName())); - } - log.debug("component and all its artifacts were deleted, id = {}", oldRresource.getName()); - } } else { log.debug("operation success. do commit"); titanDao.commit(); @@ -566,7 +563,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { private Either<Resource, ResponseFormat> updateResourceFromYaml(Resource oldRresource, Resource newRresource, AuditingActionEnum updateResource, List<ArtifactDefinition> createdArtifacts, boolean isUpdateYaml, String yamlFileName, String yamlFileContent, CsarInfo csarInfo, Map<String, NodeTypeInfo> nodeTypesInfo, - Map<String, EnumMap<ArtifactOperationEnum, List<ArtifactDefinition>>> nodeTypesArtifactsToHandle, String nodeName) { + Map<String, EnumMap<ArtifactOperationEnum, List<ArtifactDefinition>>> nodeTypesArtifactsToHandle, String nodeName, boolean isNested) { Either<Resource, ResponseFormat> result; Either<Map<String, Resource>, ResponseFormat> parseNodeTypeInfoYamlEither; boolean inTransaction = true; @@ -586,7 +583,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { if (isUpdateYaml || !nodeTypesArtifactsToHandle.isEmpty()) { - prepareForUpdate = updateExistingResourceByImport(newRresource, oldRresource, csarInfo.getModifier(), inTransaction, shouldLock); + prepareForUpdate = updateExistingResourceByImport(newRresource, oldRresource, csarInfo.getModifier(), inTransaction, shouldLock, isNested); if (prepareForUpdate.isRight()) { log.debug("Failed to prepare resource for update : {}", prepareForUpdate.right().value()); result = Either.right(prepareForUpdate.right().value()); @@ -690,19 +687,35 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { preparedResource = createdCsarArtifactsEither.left().value(); } + ActionStatus mergingPropsAndInputsStatus = mergeResourceEntities(oldRresource, preparedResource); + if (mergingPropsAndInputsStatus != ActionStatus.OK) { + ResponseFormat responseFormat = componentsUtils.getResponseFormatByResource(mergingPropsAndInputsStatus, preparedResource); + return Either.right(responseFormat); + } + Either<List<ComponentInstance>, ResponseFormat> eitherSetPosition = compositionBusinessLogic.setPositionsForComponentInstances(preparedResource, csarInfo.getModifier().getUserId()); result = eitherSetPosition.isRight() ? Either.right(eitherSetPosition.right().value()) : Either.left(preparedResource); return result; } + + private ActionStatus mergeResourceEntities(Resource oldResource, Resource newResource) { + Either<MergeResourceBusinessLogic, ActionStatus> mergeResourceBLEither = mergeResourceBLFactory.getInstance(oldResource, newResource); + if (mergeResourceBLEither.isRight()) { + return mergeResourceBLEither.right().value(); + } + MergeResourceBusinessLogic mergeResourceBusinessLogic = mergeResourceBLEither.left().value(); + return mergeResourceBusinessLogic.mergeResourceEntities(oldResource, newResource); + } + private Either<Resource, ResponseFormat> handleResourceGenericType(Resource resource) { Either<Resource, ResponseFormat> genericResourceEither = fetchAndSetDerivedFromGenericType(resource); if (genericResourceEither.isRight()) { return genericResourceEither; } if (resource.shouldGenerateInputs()) { - generateInputsFromGenericTypeProperties(resource, genericResourceEither.left().value()); + generateAndAddInputsFromGenericTypeProperties(resource, genericResourceEither.left().value()); } return genericResourceEither; } @@ -715,18 +728,22 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { try { nodeTypesArtifactsToHandleRes = Either.left(nodeTypesArtifactsToHandle); - Map<String, String> extractedVfcToscaNames = extractVfcToscaNames(nodeTypesInfo, oldResource.getName(), csarInfo); + Map<String, ImmutablePair<String,String>> extractedVfcToscaNames = extractVfcToscaNames(nodeTypesInfo, oldResource.getName(), csarInfo); Either<EnumMap<ArtifactOperationEnum, List<ArtifactDefinition>>, ResponseFormat> curNodeTypeArtifactsToHandleRes; EnumMap<ArtifactOperationEnum, List<ArtifactDefinition>> curNodeTypeArtifactsToHandle = null; log.debug("Going to fetch node types for resource with name {} during import csar with UUID {}. ", oldResource.getName(), csarInfo.getCsarUUID()); - for (Entry<String, String> currVfcToscaNameEntry : extractedVfcToscaNames.entrySet()) { - String currVfcToscaName = currVfcToscaNameEntry.getValue(); + for (Entry<String, ImmutablePair<String,String>> currVfcToscaNameEntry : extractedVfcToscaNames.entrySet()) { + String currVfcToscaName = currVfcToscaNameEntry.getValue().getLeft(); + String previousVfcToscaName = currVfcToscaNameEntry.getValue().getRight(); String currNamespace = currVfcToscaNameEntry.getKey(); log.debug("Going to fetch node type with tosca name {}. ", currVfcToscaName); Either<Resource, StorageOperationStatus> curVfcRes = toscaOperationFacade.getLatestByToscaResourceName(currVfcToscaName); Resource curNodeType = null; + if (curVfcRes.isRight() && curVfcRes.right().value() == StorageOperationStatus.NOT_FOUND) { + curVfcRes = toscaOperationFacade.getLatestByToscaResourceName(previousVfcToscaName); + } if (curVfcRes.isRight() && curVfcRes.right().value() != StorageOperationStatus.NOT_FOUND) { log.debug("Error occured during fetching node type with tosca name {}, error: {}", currVfcToscaName, curVfcRes.right().value()); ResponseFormat responseFormat = componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(curVfcRes.right().value()), csarInfo.getCsarUUID()); @@ -925,15 +942,15 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { return handleNodeTypeArtifactsRes; } - private Map<String, String> extractVfcToscaNames(Map<String, NodeTypeInfo> nodeTypesInfo, String vfResourceName, CsarInfo csarInfo) { - Map<String, String> vfcToscaNames = new HashMap<>(); + private Map<String, ImmutablePair<String,String>> extractVfcToscaNames(Map<String, NodeTypeInfo> nodeTypesInfo, String vfResourceName, CsarInfo csarInfo) { + Map<String, ImmutablePair<String,String>> vfcToscaNames = new HashMap<>(); Map<String, Object> nodes = extractAllNodes(nodeTypesInfo, csarInfo); if (!nodes.isEmpty()) { Iterator<Entry<String, Object>> nodesNameEntry = nodes.entrySet().iterator(); while (nodesNameEntry.hasNext()) { Entry<String, Object> nodeType = nodesNameEntry.next(); - String toscaResourceName = buildNestedToscaResourceName(ResourceTypeEnum.VFC.name(), vfResourceName, nodeType.getKey()); + ImmutablePair<String,String> toscaResourceName = buildNestedToscaResourceName(ResourceTypeEnum.VFC.name(), vfResourceName, nodeType.getKey()); vfcToscaNames.put(nodeType.getKey(), toscaResourceName); } } @@ -1201,7 +1218,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { vfcCreated = handleNeatedVfcYaml.left().value(); } else if(csarInfo.getCreatedNodesToscaResourceNames()!= null && !csarInfo.getCreatedNodesToscaResourceNames().containsKey(nodeType.getKey())){ log.trace("************* Going to create node {}", nodeType.getKey()); - Either<ImmutablePair<Resource, ActionStatus>, ResponseFormat> resourceCreated = this.createNodeTypeResourceFromYaml(yamlName, nodeType, csarInfo.getModifier(), mapToConvert, resource, needLock, nodeTypeArtifactsToHandle, nodeTypesNewCreatedArtifacts, true, csarInfo); + Either<ImmutablePair<Resource, ActionStatus>, ResponseFormat> resourceCreated = this.createNodeTypeResourceFromYaml(yamlName, nodeType, csarInfo.getModifier(), mapToConvert, resource, needLock, nodeTypeArtifactsToHandle, nodeTypesNewCreatedArtifacts, true, csarInfo, true); log.debug("************* Finished to create node {}", nodeType.getKey()); if (resourceCreated.isRight()) { @@ -1257,11 +1274,18 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { if(result == null){ newComplexVfc = buildCvfcRes.left().value(); Either<Resource, StorageOperationStatus> oldComplexVfcRes = toscaOperationFacade.getFullLatestComponentByToscaResourceName(newComplexVfc.getToscaResourceName()); + if(oldComplexVfcRes.isRight() && oldComplexVfcRes.right().value() == StorageOperationStatus.NOT_FOUND){ + oldComplexVfcRes = toscaOperationFacade.getFullLatestComponentByToscaResourceName(buildNestedToscaResourceName(ResourceTypeEnum.CVFC.name(), csarInfo.getVfResourceName(), nodeName).getRight()); + } if(oldComplexVfcRes.isRight() && oldComplexVfcRes.right().value() != StorageOperationStatus.NOT_FOUND){ log.debug("Failed to fetch previous complex VFC by tosca resource name {}. Status is {}. ", newComplexVfc.getToscaResourceName(), oldComplexVfcRes.right().value()); result = Either.right(componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR)); } else if(oldComplexVfcRes.isLeft()){ - oldComplexVfc = oldComplexVfcRes.left().value(); + log.debug("validate derived before update"); + Either<Boolean, ResponseFormat> eitherValidation = validateNestedDerivedFromDuringUpdate(oldComplexVfcRes.left().value(), newComplexVfc, ValidationUtils.hasBeenCertified(oldComplexVfcRes.left().value().getVersion())); + if (eitherValidation.isLeft()) { + oldComplexVfc = oldComplexVfcRes.left().value(); + } } } if(result == null){ @@ -1298,7 +1322,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { log.debug("Failed to create resource {} from YAML {}. ", newComplexVfc.getName(), yamlName); } } else { - handleComplexVfcRes = updateResourceFromYaml(oldComplexVfc, newComplexVfc, AuditingActionEnum.UPDATE_RESOURCE_METADATA, createdArtifacts, true, yamlContent, yamlName, csarInfo, newNodeTypesInfo, nodesArtifactsToHandle, nodeName); + handleComplexVfcRes = updateResourceFromYaml(oldComplexVfc, newComplexVfc, AuditingActionEnum.UPDATE_RESOURCE_METADATA, createdArtifacts, true, yamlContent, yamlName, csarInfo, newNodeTypesInfo, nodesArtifactsToHandle, nodeName, true); if (handleComplexVfcRes.isRight()) { log.debug("Failed to update resource {} from YAML {}. ", oldComplexVfc.getName(), yamlName); } @@ -1335,13 +1359,13 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { } private Either<ImmutablePair<Resource, ActionStatus>, ResponseFormat> createNodeTypeResourceFromYaml(String yamlName, Entry<String, Object> nodeNameValue, User user, Map<String, Object> mapToConvert, Resource resourceVf, boolean needLock, - Map<ArtifactOperationEnum, List<ArtifactDefinition>> nodeTypeArtifactsToHandle, List<ArtifactDefinition> nodeTypesNewCreatedArtifacts, boolean forceCertificationAllowed, CsarInfo csarInfo) { + Map<ArtifactOperationEnum, List<ArtifactDefinition>> nodeTypeArtifactsToHandle, List<ArtifactDefinition> nodeTypesNewCreatedArtifacts, boolean forceCertificationAllowed, CsarInfo csarInfo, boolean isNested) { Either<UploadResourceInfo, ResponseFormat> resourceMetaData = fillResourceMetadata(yamlName, resourceVf, nodeNameValue.getKey(), user); if (resourceMetaData.isRight()) { return Either.right(resourceMetaData.right().value()); } - String singleVfcYaml = buildNodeTypeYaml(nodeNameValue, mapToConvert, resourceMetaData.left().value().getResourceType(), csarInfo.getVfResourceName()); + String singleVfcYaml = buildNodeTypeYaml(nodeNameValue, mapToConvert, resourceMetaData.left().value().getResourceType(), csarInfo); Either<User, ResponseFormat> eitherCreator = validateUser(user, "CheckIn Resource", resourceVf, AuditingActionEnum.CHECKIN_RESOURCE, true); if (eitherCreator.isRight()) { @@ -1349,10 +1373,10 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { } user = eitherCreator.left().value(); - return this.createResourceFromNodeType(singleVfcYaml, resourceMetaData.left().value(), user, true, needLock, nodeTypeArtifactsToHandle, nodeTypesNewCreatedArtifacts, forceCertificationAllowed, csarInfo); + return this.createResourceFromNodeType(singleVfcYaml, resourceMetaData.left().value(), user, true, needLock, nodeTypeArtifactsToHandle, nodeTypesNewCreatedArtifacts, forceCertificationAllowed, csarInfo, nodeNameValue.getKey(), isNested); } - private String buildNodeTypeYaml(Entry<String, Object> nodeNameValue, Map<String, Object> mapToConvert, String nodeResourceType, String csarVfName) { + private String buildNodeTypeYaml(Entry<String, Object> nodeNameValue, Map<String, Object> mapToConvert, String nodeResourceType, CsarInfo csarInfo) { // We need to create a Yaml from each node_types in order to create // resource from each node type using import normative flow. DumperOptions options = new DumperOptions(); @@ -1360,7 +1384,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { Yaml yaml = new Yaml(options); Map<String, Object> node = new HashMap<>(); - node.put(buildNestedToscaResourceName(nodeResourceType, csarVfName, nodeNameValue.getKey()), nodeNameValue.getValue()); + node.put(buildNestedToscaResourceName(nodeResourceType, csarInfo.getVfResourceName(), nodeNameValue.getKey()).getLeft(), nodeNameValue.getValue()); mapToConvert.put(ToscaTagNamesEnum.NODE_TYPES.getElementName(), node); return yaml.dumpAsMap(mapToConvert); @@ -1376,11 +1400,11 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { } public Either<ImmutablePair<Resource, ActionStatus>, ResponseFormat> createResourceFromNodeType(String nodeTypeYaml, UploadResourceInfo resourceMetaData, User creator, boolean isInTransaction, boolean needLock, - Map<ArtifactOperationEnum, List<ArtifactDefinition>> nodeTypeArtifactsToHandle, List<ArtifactDefinition> nodeTypesNewCreatedArtifacts, boolean forceCertificationAllowed, CsarInfo csarInfo) { + Map<ArtifactOperationEnum, List<ArtifactDefinition>> nodeTypeArtifactsToHandle, List<ArtifactDefinition> nodeTypesNewCreatedArtifacts, boolean forceCertificationAllowed, CsarInfo csarInfo, String nodeName, boolean isNested) { LifecycleChangeInfoWithAction lifecycleChangeInfo = new LifecycleChangeInfoWithAction("certification on import", LifecycleChanceActionEnum.CREATE_FROM_CSAR); Function<Resource, Either<Boolean, ResponseFormat>> validator = (resource) -> this.validateResourceCreationFromNodeType(resource, creator); - return this.resourceImportManager.importCertifiedResource(nodeTypeYaml, resourceMetaData, creator, validator, lifecycleChangeInfo, isInTransaction, true, needLock, nodeTypeArtifactsToHandle, nodeTypesNewCreatedArtifacts, forceCertificationAllowed, csarInfo); + return this.resourceImportManager.importCertifiedResource(nodeTypeYaml, resourceMetaData, creator, validator, lifecycleChangeInfo, isInTransaction, true, needLock, nodeTypeArtifactsToHandle, nodeTypesNewCreatedArtifacts, forceCertificationAllowed, csarInfo, nodeName, isNested); } private Either<UploadResourceInfo, ResponseFormat> fillResourceMetadata(String yamlName, Resource resourceVf, String nodeName, User user) { @@ -1457,7 +1481,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { cvfc.setVendorName(resourceVf.getVendorName()); cvfc.setVendorRelease(resourceVf.getVendorRelease()); cvfc.setResourceVendorModelNumber(resourceVf.getResourceVendorModelNumber()); - cvfc.setToscaResourceName(buildNestedToscaResourceName(ResourceTypeEnum.CVFC.name(), csarInfo.getVfResourceName(), nodeName)); + cvfc.setToscaResourceName(buildNestedToscaResourceName(ResourceTypeEnum.CVFC.name(), csarInfo.getVfResourceName(), nodeName).getLeft()); cvfc.setInvariantUUID(UniqueIdBuilder.buildInvariantUUID()); List<String> tags = new ArrayList<>(); @@ -1521,7 +1545,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { // add groups to resource log.trace("************* Going to add inputs from yaml {}", yamlName); if (resource.shouldGenerateInputs()) - generateInputsFromGenericTypeProperties(resource, genericResourceEither.left().value()); + generateAndAddInputsFromGenericTypeProperties(resource, genericResourceEither.left().value()); Map<String, InputDefinition> inputs = parsedToscaYamlInfo.getInputs(); Either<Resource, ResponseFormat> createInputsOnResource = createInputsOnResource(resource, csarInfo.getModifier(), inputs, inTransaction); @@ -1599,11 +1623,6 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { titanDao.rollback(); if (!createdArtifacts.isEmpty() || !nodeTypesNewCreatedArtifacts.isEmpty()) { createdArtifacts.addAll(nodeTypesNewCreatedArtifacts); - StorageOperationStatus deleteFromEsRes = artifactsBusinessLogic.deleteAllComponentArtifactsIfNotOnGraph(createdArtifacts); - if (!deleteFromEsRes.equals(StorageOperationStatus.OK)) { - ActionStatus actionStatus = componentsUtils.convertFromStorageResponse(deleteFromEsRes); - return Either.right(componentsUtils.getResponseFormat(actionStatus, resource.getName())); - } log.debug("component and all its artifacts were deleted, id = {}", resource.getName()); } @@ -1720,7 +1739,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { List<InputDefinition> resourceProperties = resource.getInputs(); if ( (inputs != null && false == inputs.isEmpty()) || (resourceProperties != null && false == resourceProperties.isEmpty()) ) { - Either<List<InputDefinition>, ResponseFormat> createInputs = inputsBusinessLogic.createInputsInGraph(inputs, resource, user, inTransaction); + Either<List<InputDefinition>, ResponseFormat> createInputs = inputsBusinessLogic.createInputsInGraph(inputs, resource); if (createInputs.isRight()) { return Either.right(createInputs.right().value()); } @@ -2042,12 +2061,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { if (groupsToDelete != null && !groupsToDelete.isEmpty()) { Set<String> artifactsToDelete = new HashSet<String>(); - /* - * for (GroupDefinition group : groupsToDelete) { List<String> artifacts = group.getArtifacts(); if (artifacts != null) { artifactsToDelete.addAll(artifacts); Either<GroupDefinition, StorageOperationStatus> deleteGroupEither = - * groupOperation.deleteGroup(group.getUniqueId(), inTransaction); if (deleteGroupEither.isRight()) { StorageOperationStatus storageOperationStatus = deleteGroupEither.right().value(); ActionStatus actionStatus = - * componentsUtils.convertFromStorageResponse(storageOperationStatus); log.debug("Failed to delete group {} under component {}, error: {}", group.getUniqueId(), resource.getNormalizedName(), actionStatus.name()); return - * Either.right(componentsUtils.getResponseFormat(actionStatus)); } } } - */ + for (String artifactId : artifactsToDelete) { Either<Either<ArtifactDefinition, Operation>, ResponseFormat> handleDelete = artifactsBusinessLogic.handleDelete(resource.getUniqueId(), artifactId, csarInfo.getModifier(), AuditingActionEnum.ARTIFACT_DELETE, ComponentTypeEnum.RESOURCE, resource, null, null, shouldLock, inTransaction); @@ -2169,9 +2183,14 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { ////////////////////////////////////// create set parsed ////////////////////////////////////// artifacts/////////////////////////////////////////// Map<String, List<ArtifactTemplateInfo>> parsedArtifactsMap = parseResourceInfoFromYamlEither.left().value(); - Collection<List<ArtifactTemplateInfo>> parsedArifactsCollection = parsedArtifactsMap.values(); + Map<ArtifactTemplateInfo, Set<ArtifactTemplateInfo>> parsedGroup = new HashMap<ArtifactTemplateInfo, Set<ArtifactTemplateInfo>>(); - + List<ArtifactTemplateInfo> artifactsWithoutGroups = null; + if(parsedArtifactsMap.containsKey(ArtifactTemplateInfo.CSAR_ARTIFACT)){ + artifactsWithoutGroups = parsedArtifactsMap.get(ArtifactTemplateInfo.CSAR_ARTIFACT); + parsedArtifactsMap.remove(ArtifactTemplateInfo.CSAR_ARTIFACT); + } + Collection<List<ArtifactTemplateInfo>> parsedArifactsCollection = parsedArtifactsMap.values(); for (List<ArtifactTemplateInfo> parsedGroupTemplateList : parsedArifactsCollection) { for (ArtifactTemplateInfo parsedGroupTemplate : parsedGroupTemplateList) { @@ -2235,7 +2254,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { ////////////// artifacts//////////////////////////// Either<Resource, ResponseFormat> assDissotiateEither = associateAndDissociateArtifactsToGroup(csarInfo, resource, createdNewArtifacts, labelCounter, shouldLock, inTransaction, createdDeplymentArtifactsAfterDelete, mergedgroup, deletedArtifacts); - + groups = resource.getGroups(); if (assDissotiateEither.isRight()) { log.debug("Failed to delete artifacts. Status is {} ", assDissotiateEither.right().value()); @@ -2251,7 +2270,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { } } - groups = resource.getGroups(); + // update vfModule names Set<GroupDefinition> groupForAssociateWithMembers = mergedgroup.keySet(); @@ -2331,7 +2350,16 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { } } - + if(artifactsWithoutGroups != null && !artifactsWithoutGroups.isEmpty()){ + for(ArtifactTemplateInfo t: artifactsWithoutGroups){ + List<ArtifactTemplateInfo> arrtifacts = new ArrayList<ArtifactTemplateInfo>(); + arrtifacts.add(t); + Either<Resource, ResponseFormat> resStatus = createGroupDeploymentArtifactsFromCsar(csarInfo, resource, arrtifacts, createdNewArtifacts, createdDeplymentArtifactsAfterDelete, labelCounter, shouldLock, inTransaction); + if (resStatus.isRight()) + return resStatus; + }; + } + Either<Resource, StorageOperationStatus> eitherGerResource = toscaOperationFacade.getToscaElement(resource.getUniqueId()); if (eitherGerResource.isRight()) { ResponseFormat responseFormat = componentsUtils.getResponseFormatByResource(componentsUtils.convertFromStorageResponse(eitherGerResource.right().value()), resource); @@ -2351,17 +2379,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { for (ArtifactDefinition artifact : artifactsToDelete) { String artifactType = artifact.getArtifactType(); ArtifactTypeEnum artifactTypeEnum = ArtifactTypeEnum.findType(artifactType); - if (artifactTypeEnum == ArtifactTypeEnum.HEAT_ENV) { - - /* - * Either<ArtifactDefinition, StorageOperationStatus> removeArifactFromGraph = artifactOperation.removeArifactFromResource(resourceId, artifact.getUniqueId(), NodeTypeEnum.Resource, true, true); if - * (removeArifactFromGraph.isRight()) { StorageOperationStatus status = removeArifactFromGraph.right().value(); log.debug("Failed to delete heat env artifact {} . status is {}", artifact.getUniqueId(), status); ActionStatus - * actionStatus = componentsUtils.convertFromStorageResponse(status); return Either.right(componentsUtils.getResponseFormat(actionStatus)); } - * - * deletedArtifacts.add(removeArifactFromGraph.left().value()); - */ - - } else { + if (artifactTypeEnum != ArtifactTypeEnum.HEAT_ENV) { Either<Either<ArtifactDefinition, Operation>, ResponseFormat> handleDelete = artifactsBusinessLogic.handleDelete(resourceId, artifact.getUniqueId(), user, AuditingActionEnum.ARTIFACT_DELETE, ComponentTypeEnum.RESOURCE, resource, null, null, shouldLock, inTransaction); if (handleDelete.isRight()) { @@ -2425,8 +2443,9 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { GroupDefinition groupToUpdate = artifactsToUpdateEntry.getKey(); for (ImmutablePair<ArtifactDefinition, ArtifactTemplateInfo> artifact : artifactsToUpdateList) { - String prevUUID = artifact.getKey().getArtifactUUID(); + String prevUUID = artifact.getKey().getArtifactUUID(); String prevId = artifact.getKey().getUniqueId(); + String prevHeatEnvId = checkAndGetHeatEnvId(artifact.getKey()); Either<ArtifactDefinition, ResponseFormat> updateArtifactEither = updateDeploymentArtifactsFromCsar(csarInfo, resource, artifact.getKey(), artifact.getValue(), updatedArtifacts, artifact.getRight().getRelatedArtifactsInfo(), shouldLock, inTransaction); if (updateArtifactEither.isRight()) { @@ -2441,6 +2460,13 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { groupToUpdate.getArtifacts().add(artAfterUpdate.getUniqueId()); groupToUpdate.getArtifactsUuid().add(artAfterUpdate.getArtifactUUID()); } + Optional<ArtifactDefinition> op = updatedArtifacts.stream().filter(p -> p.getGeneratedFromId() != null && p.getGeneratedFromId().equals(artAfterUpdate.getUniqueId())).findAny(); + if (op.isPresent()) { + ArtifactDefinition artifactInfoHeatEnv = op.get(); + groupToUpdate.getArtifacts().remove(prevHeatEnvId); + groupToUpdate.getArtifacts().add(artifactInfoHeatEnv.getUniqueId()); + } + } } } @@ -2521,16 +2547,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { } } - /* - * if (!associateArtifactGroup.isEmpty()) { - * - * log.debug("Try to associate artifacts to groups."); - * - * Either<List<GroupDefinition>, ResponseFormat> assotiateGroupEither = groupBusinessLogic.associateArtifactsToGroup(resource.getUniqueId(), user.getUserId(), ComponentTypeEnum.RESOURCE, associateArtifactGroup, shouldLock, inTransaction); if - * (assotiateGroupEither.isRight()) { log.debug("Failed to associate artifacts to groups. Status is {} ", assotiateGroupEither.right().value()); resEither = Either.right(assotiateGroupEither.right().value()); return resEither; - * - * } } - */ + ComponentParametersView parametersView = new ComponentParametersView(); parametersView.disableAll(); @@ -3332,6 +3349,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { return resStatus; } ArtifactDefinition currentInfo = uploadArtifactToService.left().value().left().value(); + updatedArtifacts.add(currentInfo); Either<ArtifactDefinition, ResponseFormat> updateEnvEither = updateHeatParamsFromCsar(resource, csarInfo, artifactTemplateInfo, currentInfo, true); if (updateEnvEither.isRight()) { @@ -3342,7 +3360,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { // TODO evg update env time ( must be separate US for this!!!!) updatedArtifacts.add(updateEnvEither.left().value()); - resStatus = Either.left(updateEnvEither.left().value()); + resStatus = Either.left(currentInfo); return resStatus; @@ -3359,11 +3377,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { return resStatus; } Either<List<HeatParameterDefinition>, ResponseFormat> propsStatus = extractHeatParameters(ArtifactTypeEnum.HEAT_ENV.getType(), artifactTemplateInfo.getEnv(), artifactparamsStatus.left().value().getValue(), false); - /* - * if (propsStatus.isRight()) { - * - * resStatus = Either.right(propsStatus.right().value()); return resStatus; } - */ + if (propsStatus.isLeft()) { List<HeatParameterDefinition> updatedHeatEnvParams = propsStatus.left().value(); List<HeatParameterDefinition> currentHeatEnvParams = currentInfo.getListHeatParameters(); @@ -3405,6 +3419,23 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { } } if (isUpdateEnv) { + ComponentParametersView parametersView = new ComponentParametersView(); + parametersView.disableAll(); + parametersView.setIgnoreComponentInstances(false); + parametersView.setIgnoreUsers(false); + parametersView.setIgnoreArtifacts(false); + parametersView.setIgnoreGroups(false); + + Either<Resource, StorageOperationStatus> eitherGerResource = toscaOperationFacade.getToscaElement(resource.getUniqueId(), parametersView); + + if (eitherGerResource.isRight()) { + ResponseFormat responseFormat = componentsUtils.getResponseFormatByResource(componentsUtils.convertFromStorageResponse(eitherGerResource.right().value()), resource); + + resStatus = Either.right(responseFormat); + return resStatus; + + } + resource = eitherGerResource.left().value(); Map<String, ArtifactDefinition> artifacts = resource.getDeploymentArtifacts(); Optional<ArtifactDefinition> op = artifacts.values().stream().filter(p -> p.getGeneratedFromId() != null && p.getGeneratedFromId().equals(currentInfo.getUniqueId())).findAny(); if (op.isPresent()) { @@ -3414,6 +3445,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { log.debug("Failed to update heat env on CSAR flow for component {} artifact {} label {}", resource.getUniqueId(), artifactInfoHeatEnv.getUniqueId(), artifactInfoHeatEnv.getArtifactLabel()); return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(updateArifactOnResource.right().value()))); } + resStatus = Either.left(updateArifactOnResource.left().value()); } } return resStatus; @@ -3821,7 +3853,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { String value = null; List<GetInputValueDataDefinition> getInputs = null; boolean isValidate = true; - if (null != propertyInfo && null != propertyInfo.getValue()) { + if (propertyInfo.getValue() != null) { getInputs = propertyInfo.getGet_input(); isValidate = getInputs == null || getInputs.isEmpty(); if (isValidate) { @@ -3944,10 +3976,10 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { } RequirementDefinition validReq = eitherReqStatus.left().value(); - List<RequirementAndRelationshipPair> reqAndRelationshipPairList = regCapRelDef.getRelationships(); + List<CapabilityRequirementRelationship> reqAndRelationshipPairList = regCapRelDef.getRelationships(); if (reqAndRelationshipPairList == null) - reqAndRelationshipPairList = new ArrayList<RequirementAndRelationshipPair>(); - RequirementAndRelationshipPair reqAndRelationshipPair = new RequirementAndRelationshipPair(); + reqAndRelationshipPairList = new ArrayList<>(); + RelationshipInfo reqAndRelationshipPair = new RelationshipInfo(); reqAndRelationshipPair.setRequirement(regName); reqAndRelationshipPair.setRequirementOwnerId(validReq.getOwnerId()); reqAndRelationshipPair.setRequirementUid(validReq.getUniqueId()); @@ -3982,7 +4014,9 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { reqAndRelationshipPair.setCapability(aviableCapForRel.getName()); reqAndRelationshipPair.setCapabilityUid(aviableCapForRel.getUniqueId()); reqAndRelationshipPair.setCapabilityOwnerId(aviableCapForRel.getOwnerId()); - reqAndRelationshipPairList.add(reqAndRelationshipPair); + CapabilityRequirementRelationship capReqRel = new CapabilityRequirementRelationship(); + capReqRel.setRelation(reqAndRelationshipPair); + reqAndRelationshipPairList.add(capReqRel); regCapRelDef.setRelationships(reqAndRelationshipPairList); relations.add(regCapRelDef); } @@ -4151,8 +4185,6 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { return componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(validatevalueEiter.right().value())); } - // String uniqueId = UniqueIdBuilder.buildResourceInstancePropertyValueUid(currentCompInstance.getComponentUid(), index++); - // property.setUniqueId(uniqueId); property.setValue(validatevalueEiter.left().value()); if (getInputs != null && !getInputs.isEmpty()) { @@ -4239,18 +4271,6 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { } } - - // TODO temporary fix - remove specific capability node validation - - // String reqNode = validReq.getNode(); - // if (reqNode != null && !reqNode.isEmpty() && - // !cap.getCapabilitySources().contains(reqNode)) { - // return null; - // } - // RequirementAndRelationshipPair relationPair = getReqRelPair(cap); - // Either<Boolean, StorageOperationStatus> eitherStatus = componentInstanceOperation.isAvailableCapabilty(currentCapCompInstance, relationPair); - // if (eitherStatus.isRight() || eitherStatus.left().value() == false) { - // return null; - // } return cap; } @@ -4261,13 +4281,6 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { List<CapabilityDefinition> capList = capMap.get(validReq.getCapability()); for (CapabilityDefinition cap : capList) { - // TODO temporary fix - remove specific capability node - // String reqNode = validReq.getNode(); - // if (reqNode != null && !reqNode.isEmpty()) { - // if (!cap.getCapabilitySources().contains(reqNode)) { - // continue; - // } - // } if (cap.getMaxOccurrences() != null && !cap.getMaxOccurrences().equals(CapabilityDataDefinition.MAX_OCCURRENCES)) { String leftOccurrences = cap.getLeftOccurrences(); if (leftOccurrences == null) { @@ -5097,7 +5110,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { * createOrUpdateResourceByImport(resource, user, isNormative, false, needLock); } */ - public Either<ImmutablePair<Resource, ActionStatus>, ResponseFormat> createOrUpdateResourceByImport(Resource resource, User user, boolean isNormative, boolean isInTransaction, boolean needLock, CsarInfo csarInfo) { + public Either<ImmutablePair<Resource, ActionStatus>, ResponseFormat> createOrUpdateResourceByImport(Resource resource, User user, boolean isNormative, boolean isInTransaction, boolean needLock, CsarInfo csarInfo, String nodeName, boolean isNested) { // check if resource already exist Either<Resource, StorageOperationStatus> latestByName = toscaOperationFacade.getLatestByName(resource.getName()); @@ -5107,10 +5120,22 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { if (latestByName.isRight() && latestByName.right().value().equals(StorageOperationStatus.NOT_FOUND)) { Either<Resource, StorageOperationStatus> latestByToscaName = toscaOperationFacade.getLatestByToscaResourceName(resource.getToscaResourceName()); - if (latestByToscaName.isRight() && latestByToscaName.right().value().equals(StorageOperationStatus.NOT_FOUND)) + if (csarInfo!= null && csarInfo.isUpdate() && nodeName != null && latestByToscaName.isRight() && latestByToscaName.right().value().equals(StorageOperationStatus.NOT_FOUND)){ + latestByToscaName = toscaOperationFacade.getLatestByToscaResourceName(buildNestedToscaResourceName(resource.getResourceType().name(), csarInfo.getVfResourceName(), nodeName).getRight()); + // update + if (latestByToscaName.isLeft()) { + log.debug("validate derived before update"); + Either<Boolean, ResponseFormat> eitherValidation = validateNestedDerivedFromDuringUpdate(latestByToscaName.left().value(), resource, ValidationUtils.hasBeenCertified(latestByToscaName.left().value().getVersion())); + if (eitherValidation.isRight()) { + result = createResourceByImport(resource, user, isNormative, isInTransaction, csarInfo); + } else { + result = updateExistingResourceByImport(resource, latestByToscaName.left().value(), user, isNormative, needLock, isNested); + } + } + } + if (result == null && latestByToscaName.isRight() && latestByToscaName.right().value().equals(StorageOperationStatus.NOT_FOUND)){ result = createResourceByImport(resource, user, isNormative, isInTransaction, csarInfo); - - else { + } else if (result == null){ StorageOperationStatus status = latestByName.right().value(); BeEcompErrorManager.getInstance().logBeComponentMissingError("Create / Update resource by import", ComponentTypeEnum.RESOURCE.getValue(), resource.getName()); log.debug("resource already exist {}. status={}", resource.getName(), status); @@ -5123,7 +5148,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { // update else if (latestByName.isLeft()) { - result = updateExistingResourceByImport(resource, latestByName.left().value(), user, isNormative, needLock); + result = updateExistingResourceByImport(resource, latestByName.left().value(), user, isNormative, needLock, isNested); } // error @@ -5160,7 +5185,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { return latestByName.isLeft(); } - private Either<ImmutablePair<Resource, ActionStatus>, ResponseFormat> updateExistingResourceByImport(Resource newResource, Resource oldResource, User user, boolean inTransaction, boolean needLock) { + private Either<ImmutablePair<Resource, ActionStatus>, ResponseFormat> updateExistingResourceByImport(Resource newResource, Resource oldResource, User user, boolean inTransaction, boolean needLock, boolean isNested) { String lockedResourceId = oldResource.getUniqueId(); log.debug("found resource: name={}, id={}, version={}, state={}", oldResource.getName(), lockedResourceId, oldResource.getVersion(), oldResource.getLifecycleState()); Either<ImmutablePair<Resource, ActionStatus>, ResponseFormat> result = null; @@ -5184,7 +5209,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { mergeOldResourceMetadataWithNew(oldResource, newResource); - Either<Boolean, ResponseFormat> validateFieldsResponse = validateResourceFieldsBeforeUpdate(oldResource, newResource, inTransaction); + Either<Boolean, ResponseFormat> validateFieldsResponse = validateResourceFieldsBeforeUpdate(oldResource, newResource, inTransaction, isNested); if (validateFieldsResponse.isRight()) { result = Either.right(validateFieldsResponse.right().value()); return result; @@ -5211,7 +5236,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { newResource.setSystemName(oldResource.getSystemName()); if (oldResource.getCsarUUID() != null) { newResource.setCsarUUID(oldResource.getCsarUUID()); - } + } if (oldResource.getImportedToscaChecksum() != null) { newResource.setImportedToscaChecksum(oldResource.getImportedToscaChecksum()); } @@ -5957,7 +5982,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { } //endregion - Either<Boolean, ResponseFormat> validateResourceFields = validateResourceFieldsBeforeUpdate(currentResource, newResource, inTransaction); + Either<Boolean, ResponseFormat> validateResourceFields = validateResourceFieldsBeforeUpdate(currentResource, newResource, inTransaction, false); if (validateResourceFields.isRight()) { return Either.right(validateResourceFields.right().value()); } @@ -6117,15 +6142,16 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { * validateResourceFieldsBeforeUpdate * * @param currentResource - Resource object to validate + * @param isNested * @return Either<Boolean, ErrorResponse> */ - private Either<Boolean, ResponseFormat> validateResourceFieldsBeforeUpdate(Resource currentResource, Resource updateInfoResource, boolean inTransaction) { + private Either<Boolean, ResponseFormat> validateResourceFieldsBeforeUpdate(Resource currentResource, Resource updateInfoResource, boolean inTransaction, boolean isNested) { boolean hasBeenCertified = ValidationUtils.hasBeenCertified(currentResource.getVersion()); // validate resource name log.debug("validate resource name before update"); - Either<Boolean, ResponseFormat> eitherValidation = validateResourceName(currentResource, updateInfoResource, hasBeenCertified); + Either<Boolean, ResponseFormat> eitherValidation = validateResourceName(currentResource, updateInfoResource, hasBeenCertified, isNested); if (eitherValidation.isRight()) { return eitherValidation; } @@ -6314,10 +6340,10 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { return resourceName+"Cvfc"; } - private Either<Boolean, ResponseFormat> validateResourceName(Resource currentResource, Resource updateInfoResource, boolean hasBeenCertified) { + private Either<Boolean, ResponseFormat> validateResourceName(Resource currentResource, Resource updateInfoResource, boolean hasBeenCertified, boolean isNested) { String resourceNameUpdated = updateInfoResource.getName(); if (!isResourceNameEquals(currentResource, updateInfoResource)) { - if (!hasBeenCertified) { + if (isNested || !hasBeenCertified) { Either<Boolean, ResponseFormat> validateResourceNameResponse = validateComponentName(null, updateInfoResource, null); if (validateResourceNameResponse.isRight()) { ResponseFormat errorResponse = validateResourceNameResponse.right().value(); @@ -6449,6 +6475,36 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { } return Either.left(true); } + + private Either<Boolean, ResponseFormat> validateNestedDerivedFromDuringUpdate(Resource currentResource, Resource updateInfoResource, boolean hasBeenCertified) { + + List<String> currentDerivedFrom = currentResource.getDerivedFrom(); + List<String> updatedDerivedFrom = updateInfoResource.getDerivedFrom(); + if (currentDerivedFrom == null || currentDerivedFrom.isEmpty() || updatedDerivedFrom == null || updatedDerivedFrom.isEmpty()) { + log.trace("Update normative types"); + return Either.left(true); + } + + String derivedFromCurrent = currentDerivedFrom.get(0); + String derivedFromUpdated = updatedDerivedFrom.get(0); + + if (!derivedFromCurrent.equals(derivedFromUpdated)) { + if (!hasBeenCertified) { + Either<Boolean, ResponseFormat> validateDerivedFromExistsEither = validateDerivedFromExist(null, updateInfoResource, null); + if (validateDerivedFromExistsEither.isRight()) { + return validateDerivedFromExistsEither; + } + } else { + Either<Boolean, ResponseFormat> validateDerivedFromExtending = validateDerivedFromExtending(null, currentResource, updateInfoResource, null); + + if (validateDerivedFromExtending.isRight() || !validateDerivedFromExtending.left().value()) { + log.debug("Derived from cannot be updated if it doesnt inherits directly or extends inheritance"); + return validateDerivedFromExtending; + } + } + } + return Either.left(true); + } private Either<Boolean, ResponseFormat> validateDerivedFromExist(User user, Resource resource, AuditingActionEnum actionEnum) { @@ -7309,9 +7365,10 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { } - private String buildNestedToscaResourceName(String nodeResourceType, String vfResourceName, String nodeTypeFullName) { + private ImmutablePair<String, String> buildNestedToscaResourceName(String nodeResourceType, String vfResourceName, String nodeTypeFullName) { String actualType; String actualVfName; + String actualPreviousVfName; if(ResourceTypeEnum.CVFC.name().equals(nodeResourceType)){ actualVfName = vfResourceName + ResourceTypeEnum.CVFC.name(); actualType = ResourceTypeEnum.VFC.name(); @@ -7319,6 +7376,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { actualVfName = vfResourceName; actualType = nodeResourceType; } + StringBuilder toscaResourceName = new StringBuilder(Constants.USER_DEFINED_RESOURCE_NAMESPACE_PREFIX); String nameWithouNamespacePrefix = nodeTypeFullName.substring(Constants.USER_DEFINED_RESOURCE_NAMESPACE_PREFIX.length()); String[] findTypes = nameWithouNamespacePrefix.split("\\."); @@ -7330,7 +7388,8 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { } else { toscaResourceName.append(actualType.toLowerCase()).append('.').append(ValidationUtils.convertToSystemName(actualVfName)).append('.').append(Constants.ABSTRACT); } - return toscaResourceName.append(actualName.toLowerCase()).toString(); + StringBuilder previousToscaResourceName = new StringBuilder(toscaResourceName); + return new ImmutablePair<>(toscaResourceName.append(actualName.toLowerCase()).toString(), previousToscaResourceName.append(actualName.substring(actualName.split("\\.")[1].length() + 1).toLowerCase()).toString()); } public ICacheMangerOperation getCacheManagerOperation() { @@ -20,7 +20,22 @@ package org.openecomp.sdc.be.components.impl; -import fj.data.Either; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.EnumMap; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; +import java.util.function.Function; +import java.util.regex.Pattern; +import java.util.stream.Collectors; + +import javax.servlet.ServletContext; + import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.tuple.ImmutablePair; import org.openecomp.sdc.be.auditing.api.IAuditingManager; @@ -38,7 +53,17 @@ import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.impl.WebAppContextWrapper; -import org.openecomp.sdc.be.model.*; +import org.openecomp.sdc.be.model.ArtifactDefinition; +import org.openecomp.sdc.be.model.CapabilityDefinition; +import org.openecomp.sdc.be.model.ComponentInstanceProperty; +import org.openecomp.sdc.be.model.CsarInfo; +import org.openecomp.sdc.be.model.InterfaceDefinition; +import org.openecomp.sdc.be.model.LifecycleStateEnum; +import org.openecomp.sdc.be.model.PropertyDefinition; +import org.openecomp.sdc.be.model.RequirementDefinition; +import org.openecomp.sdc.be.model.Resource; +import org.openecomp.sdc.be.model.UploadResourceInfo; +import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.model.category.CategoryDefinition; import org.openecomp.sdc.be.model.category.SubCategoryDefinition; import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; @@ -57,20 +82,7 @@ import org.springframework.stereotype.Component; import org.springframework.web.context.WebApplicationContext; import org.yaml.snakeyaml.Yaml; -import javax.servlet.ServletContext; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.EnumMap; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; -import java.util.function.Function; -import java.util.regex.Pattern; -import java.util.stream.Collectors; +import fj.data.Either; @Component("resourceImportManager") public class ResourceImportManager { @@ -110,7 +122,7 @@ public class ResourceImportManager { lifecycleChangeInfo.setUserRemarks("certification on import"); Function<Resource, Either<Boolean, ResponseFormat>> validator = (resource) -> resourceBusinessLogic.validatePropertiesDefaultValues(resource); - return importCertifiedResource(resourceYml, resourceMetaData, creator, validator, lifecycleChangeInfo, false, createNewVersion, needLock, null, null, false, null); + return importCertifiedResource(resourceYml, resourceMetaData, creator, validator, lifecycleChangeInfo, false, createNewVersion, needLock, null, null, false, null, null, false); } public Either<ImmutablePair<Resource, ActionStatus>, ResponseFormat> importNormativeResourceFromCsar(String resourceYml, UploadResourceInfo resourceMetaData, User creator, boolean createNewVersion, boolean needLock) { @@ -119,11 +131,11 @@ public class ResourceImportManager { lifecycleChangeInfo.setUserRemarks("certification on import"); Function<Resource, Either<Boolean, ResponseFormat>> validator = (resource) -> resourceBusinessLogic.validatePropertiesDefaultValues(resource); - return importCertifiedResource(resourceYml, resourceMetaData, creator, validator, lifecycleChangeInfo, false, createNewVersion, needLock, null, null, false, null); + return importCertifiedResource(resourceYml, resourceMetaData, creator, validator, lifecycleChangeInfo, false, createNewVersion, needLock, null, null, false, null, null, false); } public Either<ImmutablePair<Resource, ActionStatus>, ResponseFormat> importCertifiedResource(String resourceYml, UploadResourceInfo resourceMetaData, User creator, Function<Resource, Either<Boolean, ResponseFormat>> validationFunction, - LifecycleChangeInfoWithAction lifecycleChangeInfo, boolean isInTransaction, boolean createNewVersion, boolean needLock, Map<ArtifactOperationEnum, List<ArtifactDefinition>> nodeTypeArtifactsToHandle, List<ArtifactDefinition> nodeTypesNewCreatedArtifacts, boolean forceCertificationAllowed, CsarInfo csarInfo) { + LifecycleChangeInfoWithAction lifecycleChangeInfo, boolean isInTransaction, boolean createNewVersion, boolean needLock, Map<ArtifactOperationEnum, List<ArtifactDefinition>> nodeTypeArtifactsToHandle, List<ArtifactDefinition> nodeTypesNewCreatedArtifacts, boolean forceCertificationAllowed, CsarInfo csarInfo, String nodeName, boolean isNested) { Resource resource = new Resource(); ImmutablePair<Resource, ActionStatus> responsePair = new ImmutablePair<>(resource, ActionStatus.CREATED); Either<ImmutablePair<Resource, ActionStatus>, ResponseFormat> response = Either.left(responsePair); @@ -152,7 +164,7 @@ public class ResourceImportManager { } } - response = resourceBusinessLogic.createOrUpdateResourceByImport(resource, creator, true, isInTransaction, needLock, csarInfo); + response = resourceBusinessLogic.createOrUpdateResourceByImport(resource, creator, true, isInTransaction, needLock, csarInfo, nodeName, isNested); Either<Resource, ResponseFormat> changeStateResponse; if (response.isLeft()) { resource = response.left().value().left; @@ -240,7 +252,7 @@ public class ResourceImportManager { Either<Boolean, ResponseFormat> validatePropertiesTypes = resourceBusinessLogic.validatePropertiesDefaultValues(resource); if (validatePropertiesTypes.isLeft()) { - response = resourceBusinessLogic.createOrUpdateResourceByImport(resource, creator, false, isInTransaction, true, null); + response = resourceBusinessLogic.createOrUpdateResourceByImport(resource, creator, false, isInTransaction, true, null, null, false); } else { ResponseFormat validationErrorResponse = validatePropertiesTypes.right().value(); auditErrorImport(resourceMetaData, creator, validationErrorResponse, false); @@ -20,13 +20,11 @@ package org.openecomp.sdc.be.components.impl; -import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.config.ErrorConfiguration; import org.openecomp.sdc.be.config.ErrorInfo; import org.openecomp.sdc.be.config.ErrorInfo.ErrorInfoType; import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.common.config.EcompErrorName; import org.openecomp.sdc.exception.OkResponseInfo; import org.openecomp.sdc.exception.PolicyException; import org.openecomp.sdc.exception.ResponseFormat; @@ -60,7 +58,6 @@ public class ResponseFormatManager { ErrorConfiguration errorConfiguration = configurationManager.getErrorConfiguration(); ErrorInfo errorInfo = errorConfiguration.getErrorInfo(responseEnum.name()); if (errorInfo == null) { - BeEcompErrorManager.getInstance().processEcompError(EcompErrorName.EcompErrorNotFound, "ResponseFormatManager", responseEnum.name()); log.debug("failed to locate {} in error configuration", responseEnum.name()); errorInfo = errorConfiguration.getErrorInfo(ActionStatus.GENERAL_ERROR.name()); } @@ -23,7 +23,6 @@ package org.openecomp.sdc.be.components.impl; import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.Arrays; -import java.util.Collection; import java.util.Collections; import java.util.EnumMap; import java.util.HashMap; @@ -359,7 +358,7 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic { if (genericServiceEither.isRight()) return Either.right(genericServiceEither.right().value()); - generateInputsFromGenericTypeProperties(service, genericServiceEither.left().value()); + generateAndAddInputsFromGenericTypeProperties(service, genericServiceEither.left().value()); Either<Service, StorageOperationStatus> dataModelResponse = toscaOperationFacade.createToscaComponent(service); @@ -711,7 +710,7 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic { String uuidUpdated = serviceUpdate.getUUID(); String uuidCurrent = currentService.getUUID(); if (!uuidCurrent.equals(uuidUpdated)) { - log.info("update srvice: recived request to update uuid to {} the field is not updatable ignoring.", uuidUpdated); + log.info("update service: recived request to update uuid to {} the field is not updatable ignoring.", uuidUpdated); } response = validateAndUpdateServiceType(user, currentService, serviceUpdate, null); @@ -734,7 +733,9 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic { serviceUpdate.setInvariantUUID(currentInvariantUuid); } validateAndUpdateEcompNaming(currentService, serviceUpdate); - + + currentService.setEnvironmentContext(serviceUpdate.getEnvironmentContext()); + return Either.left(currentService); } @@ -1508,7 +1509,7 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic { return vfModuleAertifact; } - private void fillVfModuleInstHeatEnvPayload(List<GroupInstance> groupsForCurrVF, ComponentInstance currVFInstance, Wrapper<String> payloadWrapper) { + private void fillVfModuleInstHeatEnvPayload(List<GroupInstance> groupsForCurrVF, Wrapper<String> payloadWrapper) { // Converts GroupDefinition to VfModuleArtifactPayload which is the // format used in the payload @@ -1531,37 +1532,13 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic { } - private void addHeatEnvArtifactsToVFModulePayload(VfModuleArtifactPayload vfModulePayload, ComponentInstance currVFInstance) { - List<String> originalModuleArtifacts = vfModulePayload.getArtifacts(); - if (!MapUtils.isEmpty(currVFInstance.getDeploymentArtifacts()) && !CollectionUtils.isEmpty(originalModuleArtifacts)) { - - // EVG : fix now for patch. remove null from list. Need to be fixed later : remove VF HEAT ENV uuid from the list?? - List<String> filteredUUIDFromModule = originalModuleArtifacts.stream().filter(uuid -> uuid != null).collect(Collectors.toList()); - - final Collection<ArtifactDefinition> depInsArtifacts = currVFInstance.getDeploymentArtifacts().values(); - // All Heat_ENV - List<ArtifactDefinition> heatEnvArtifacts = depInsArtifacts.stream().filter(art -> art.getArtifactType().equals(ArtifactTypeEnum.HEAT_ENV.getType())).collect(Collectors.toList()); - // Unique Id Of Artifacts In the vf module - List<String> moduleArtUniqueId = depInsArtifacts.stream().filter(art -> originalModuleArtifacts.contains(art.getArtifactUUID())).map(art -> art.getUniqueId()).collect(Collectors.toList()); - // Collect Only Heat Artifatcs that are Generated from artifacts in - // the module - List<String> relevantHeatEnvUUID = heatEnvArtifacts.stream().filter(heatEnv -> moduleArtUniqueId.contains(heatEnv.getGeneratedFromId())).map(heatEnv -> heatEnv.getArtifactUUID()).collect(Collectors.toList()); - - List<String> fullArtifactList = new ArrayList<>(); - fullArtifactList.addAll(filteredUUIDFromModule); - fullArtifactList.addAll(relevantHeatEnvUUID); - - vfModulePayload.setArtifacts(fullArtifactList); - } - } - private Either<ArtifactDefinition, ResponseFormat> generateVfModuleInstanceArtifact(User modifier, ComponentInstance currVFInstance, Service service, boolean shouldLock) { ArtifactDefinition vfModuleAertifact = null; Wrapper<ResponseFormat> responseWrapper = new Wrapper<>(); Wrapper<String> payloadWrapper = new Wrapper<>(); List<GroupInstance> groupsForCurrVF = collectGroupsInstanceForCompInstance(currVFInstance, responseWrapper); if (responseWrapper.isEmpty()) { - fillVfModuleInstHeatEnvPayload(groupsForCurrVF, currVFInstance, payloadWrapper); + fillVfModuleInstHeatEnvPayload(groupsForCurrVF, payloadWrapper); } if (responseWrapper.isEmpty() && payloadWrapper.getInnerElement() != null) { vfModuleAertifact = getVfModuleInstArtifactForCompInstance(currVFInstance, service, modifier, groupsForCurrVF, payloadWrapper, responseWrapper); @@ -1694,7 +1671,7 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic { @Override public Either<ArtifactDefinition, ResponseFormat> call() throws Exception { - return artifactsBusinessLogic.generateHeatEnvArtifact(artifactDefinition, ComponentTypeEnum.RESOURCE_INSTANCE, service, resourceInstanceName, modifier, shouldLock, instanceId); + return artifactsBusinessLogic.forceGenerateHeatEnvArtifact(artifactDefinition, ComponentTypeEnum.RESOURCE_INSTANCE, service, resourceInstanceName, modifier, shouldLock, instanceId); } public ArtifactDefinition getArtifactDefinition() { @@ -20,19 +20,12 @@ package org.openecomp.sdc.be.components.impl; -import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; -import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; -import org.openecomp.sdc.be.model.Resource; -import org.openecomp.sdc.be.tosca.ToscaUtils; -import org.openecomp.sdc.exception.ResponseFormat; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; -import fj.data.Either; - @Component("vfComponentInstanceBusinessLogic") public class VFComponentInstanceBusinessLogic extends ComponentInstanceBusinessLogic { @@ -0,0 +1,91 @@ +package org.openecomp.sdc.be.components.impl.generic; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +import org.apache.commons.collections.CollectionUtils; +import org.openecomp.sdc.be.dao.api.ActionStatus; +import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; +import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; +import org.openecomp.sdc.be.impl.ComponentsUtils; +import org.openecomp.sdc.be.model.Component; +import org.openecomp.sdc.be.model.InputDefinition; +import org.openecomp.sdc.be.model.PropertyDefinition; +import org.openecomp.sdc.be.model.Resource; +import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; +import org.openecomp.sdc.exception.ResponseFormat; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; + +import fj.data.Either; + +@org.springframework.stereotype.Component +public class GenericTypeBusinessLogic { + + private final static Logger log = LoggerFactory.getLogger(GenericTypeBusinessLogic.class); + + @Autowired + private ComponentsUtils componentsUtils; + + @Autowired + private ToscaOperationFacade toscaOperationFacade; + + /** + * @param component the component of which to fetch its generic type + * @return the generic node type which corresponds to the given component + */ + public Either<Resource, ResponseFormat> fetchDerivedFromGenericType(Component component){ + String genericTypeToscaName = getGenericTypeToscaName(component); + log.debug("Fetching generic tosca name {}", genericTypeToscaName); + if(null == genericTypeToscaName) { + log.debug("Failed to fetch certified generic node type for component {}", component.getName()); + return Either.right(componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR)); + } + + Either<Resource, StorageOperationStatus> findLatestGeneric = toscaOperationFacade.getLatestCertifiedNodeTypeByToscaResourceName(genericTypeToscaName); + if(findLatestGeneric.isRight()){ + log.debug("Failed to fetch certified node type by tosca resource name {}", genericTypeToscaName); + return Either.right(componentsUtils.getResponseFormat(ActionStatus.GENERIC_TYPE_NOT_FOUND, component.assetType(), genericTypeToscaName)); + } + + Resource genericTypeResource = findLatestGeneric.left().value(); + return Either.left(genericTypeResource); + } + + /** + * + * @param genericType the generic node type + * @return the generic type properties as inputs + */ + public List<InputDefinition> generateInputsFromGenericTypeProperties(Resource genericType) { + List<PropertyDefinition> genericTypeProps = genericType.getProperties(); + if(null != genericTypeProps) { + return convertGenericTypePropertiesToInputsDefintion(genericTypeProps, genericType.getUniqueId()); + } + return new ArrayList<>(); + } + + public List<InputDefinition> convertGenericTypePropertiesToInputsDefintion(List<PropertyDefinition> genericTypeProps, String genericUniqueId) { + return genericTypeProps.stream() + .map(p -> setInputDefinitionFromProp(p, genericUniqueId)) + .collect(Collectors.toList()); + } + + private InputDefinition setInputDefinitionFromProp(PropertyDefinition prop, String genericUniqueId){ + InputDefinition input = new InputDefinition(prop); + input.setOwnerId(genericUniqueId); + return input; + } + + private <T extends Component> String getGenericTypeToscaName(T component) { + return isCvfcHasDerivedFrom(component) ? ((Resource)component).getDerivedFrom().get(0) : component.fetchGenericTypeToscaNameFromConfig(); + } + + private <T extends Component> boolean isCvfcHasDerivedFrom(T component) { + return component.getComponentType() == ComponentTypeEnum.RESOURCE && ((Resource)component).getResourceType() == ResourceTypeEnum.CVFC && CollectionUtils.isNotEmpty(((Resource)component).getDerivedFrom()); + } + +} @@ -21,6 +21,7 @@ package org.openecomp.sdc.be.components.lifecycle; import java.util.Arrays; + import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic; import org.openecomp.sdc.be.components.impl.ComponentBusinessLogic; import org.openecomp.sdc.be.config.BeEcompErrorManager; @@ -20,7 +20,14 @@ package org.openecomp.sdc.be.components.lifecycle; -import fj.data.Either; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Optional; +import java.util.Set; + import org.openecomp.sdc.be.components.distribution.engine.ServiceDistributionArtifactsBuilder; import org.openecomp.sdc.be.components.impl.ComponentBusinessLogic; import org.openecomp.sdc.be.components.impl.ServiceBusinessLogic; @@ -32,7 +39,15 @@ import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; import org.openecomp.sdc.be.datatypes.enums.OriginTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.impl.ComponentsUtils; -import org.openecomp.sdc.be.model.*; +import org.openecomp.sdc.be.model.ArtifactDefinition; +import org.openecomp.sdc.be.model.Component; +import org.openecomp.sdc.be.model.ComponentInstance; +import org.openecomp.sdc.be.model.LifeCycleTransitionEnum; +import org.openecomp.sdc.be.model.LifecycleStateEnum; +import org.openecomp.sdc.be.model.Operation; +import org.openecomp.sdc.be.model.Resource; +import org.openecomp.sdc.be.model.Service; +import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElement; import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElementTypeEnum; import org.openecomp.sdc.be.model.jsontitan.operations.ToscaElementLifecycleOperation; @@ -48,14 +63,7 @@ import org.openecomp.sdc.exception.ResponseFormat; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Optional; -import java.util.Set; +import fj.data.Either; public class CertificationRequestTransition extends LifeCycleTransition { @@ -229,12 +237,12 @@ public class CertificationRequestTransition extends LifeCycleTransition { } finally { if (result == null || result.isRight()) { BeEcompErrorManager.getInstance().logBeDaoSystemError("Change LifecycleState"); - if (inTransaction == false) { + if (!inTransaction) { log.debug("operation failed. do rollback"); titanDao.rollback(); } } else { - if (inTransaction == false) { + if (!inTransaction) { log.debug("operation success. do commit"); titanDao.commit(); } @@ -21,10 +21,7 @@ package org.openecomp.sdc.be.components.lifecycle; import java.util.Arrays; -import java.util.Collection; import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; import org.openecomp.sdc.be.components.impl.ComponentBusinessLogic; import org.openecomp.sdc.be.config.BeEcompErrorManager; @@ -32,22 +29,17 @@ import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.dao.jsongraph.TitanDao; import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum; import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum; -import org.openecomp.sdc.be.datatypes.elements.ComponentInstanceDataDefinition; -import org.openecomp.sdc.be.datatypes.elements.MapPropertiesDataDefinition; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; -import org.openecomp.sdc.be.datatypes.enums.OriginTypeEnum; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.InputDefinition; import org.openecomp.sdc.be.model.LifeCycleTransitionEnum; import org.openecomp.sdc.be.model.LifecycleStateEnum; import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.be.model.jsontitan.datamodel.TopologyTemplate; import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElement; import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElementTypeEnum; import org.openecomp.sdc.be.model.jsontitan.operations.ToscaElementLifecycleOperation; -import org.openecomp.sdc.be.model.jsontitan.operations.ToscaElementOperation; import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.jsontitan.utils.ModelConverter; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; @@ -108,11 +100,22 @@ public class CheckoutTransition extends LifeCycleTransition { } else { Component clonedComponent = ModelConverter.convertFromToscaElement(checkoutResourceResult.left().value()); + if ( checkoutResourceResult.left().value().getToscaType() == ToscaElementTypeEnum.NodeType ){ + Either<Component, ActionStatus> upgradeToLatestDerived = componentBl.shouldUpgradeToLatestDerived(clonedComponent); + if (upgradeToLatestDerived.isRight() && ActionStatus.OK != upgradeToLatestDerived.right().value()){ + result = Either.right(componentUtils.getResponseFormat(upgradeToLatestDerived.right().value())); + return result; + } + if ( upgradeToLatestDerived.isLeft() ){ + //get resource after update derived + clonedComponent = upgradeToLatestDerived.left().value(); + } + } result = Either.left(clonedComponent); Either<Boolean, ResponseFormat> upgradeToLatestGeneric = componentBl.shouldUpgradeToLatestGeneric(clonedComponent); if (upgradeToLatestGeneric.isRight()) result = Either.right(upgradeToLatestGeneric.right().value()); - else if (upgradeToLatestGeneric.left().value()) { + else if (upgradeToLatestGeneric.left().value() ) { StorageOperationStatus response = upgradeToLatestGenericData(clonedComponent); if (StorageOperationStatus.OK != response) { ActionStatus actionStatus = componentUtils.convertFromStorageResponse(response); @@ -145,10 +145,12 @@ public abstract class LifeCycleTransition { if (getAuthorizedRoles(componentType).contains(Role.valueOf(modifier.getRole())) || userResourceRoleValidation(component,componentType,modifier)) { return Either.left(true); } - // this is only when creating vfc/cp when import vf from csar - when we + // this is only used in 2 cases + //1. when creating vfc/cp when import vf from csar - when we // create resources from node type, we create need to change the state // to certified - if (lifecycleChangeInfo != null && lifecycleChangeInfo.getAction() != null && lifecycleChangeInfo.getAction() == LifecycleChanceActionEnum.CREATE_FROM_CSAR) { + //2. certification flow upno upgrade migration + if (lifecycleChangeInfo != null && lifecycleChangeInfo.getAction() != null && (lifecycleChangeInfo.getAction() == LifecycleChanceActionEnum.CREATE_FROM_CSAR|| lifecycleChangeInfo.getAction() == LifecycleChanceActionEnum.UPGRADE_MIGRATION)) { return Either.left(true); } @@ -207,7 +207,7 @@ public class LifecycleBusinessLogic { LifecycleStateEnum resourceCurrState = component.getLifecycleState(); // lock resource - if (inTransaction == false && needLock) { + if (!inTransaction && needLock) { log.info("lock component {}", componentId); Either<Boolean, ResponseFormat> eitherLockResource = lockComponent(componentType, component); if (eitherLockResource.isRight()) { @@ -216,7 +216,7 @@ public class LifecycleBusinessLogic { log.error("lock component {} failed", componentId); return Either.right(errorResponse); } - log.info("after lock component {}", componentId); + log.debug("after lock component {}", componentId); } try { Either<String, ResponseFormat> commentValidationResult = validateComment(changeInfo, transitionEnum); @@ -228,12 +228,12 @@ public class LifecycleBusinessLogic { return Either.right(errorResponse); } changeInfo.setUserRemarks(commentValidationResult.left().value()); - log.info("after validate component"); + log.debug("after validate component"); Either<Boolean, ResponseFormat> validateHighestVersion = validateHighestVersion(modifier, lifeCycleTransition, component, resourceCurrVersion, componentType); if (validateHighestVersion.isRight()) { return Either.right(validateHighestVersion.right().value()); } - log.info("after validate Highest Version"); + log.debug("after validate Highest Version"); if (isComponentVFCMT(component,componentType)){ Either<? extends Component, ResponseFormat> changeVFCMTStateResponse = changeVFCMTState(componentType, modifier, transitionEnum, changeInfo, inTransaction, component); if (changeVFCMTStateResponse.isRight()){ @@ -243,11 +243,11 @@ public class LifecycleBusinessLogic { return changeState(component, lifeCycleTransition, componentType, modifier, changeInfo, inTransaction); } finally { - log.info("unlock component {}", componentId); - if (inTransaction == false && needLock && component != null) { - component.setUniqueId(componentId); + component.setUniqueId(componentId); + if (!inTransaction && needLock) { + log.info("unlock component {}", componentId); NodeTypeEnum nodeType = componentType.getNodeType(); - log.info("During change state, another component {} has been created/updated", componentId); + log.info("During change state, another component {} has been created/updated", componentId); graphLockOperation.unlockComponent(componentId, nodeType); } @@ -23,7 +23,7 @@ package org.openecomp.sdc.be.components.lifecycle; public class LifecycleChangeInfoWithAction extends LifecycleChangeInfoBase { public enum LifecycleChanceActionEnum { - CREATE_FROM_CSAR, UPDATE_FROM_EXTERNAL_API + CREATE_FROM_CSAR, UPDATE_FROM_EXTERNAL_API, UPGRADE_MIGRATION }; private LifecycleChanceActionEnum action; @@ -20,7 +20,8 @@ package org.openecomp.sdc.be.components.lifecycle; -import fj.data.Either; +import java.util.Arrays; + import org.openecomp.sdc.be.components.impl.ComponentBusinessLogic; import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.dao.api.ActionStatus; @@ -43,7 +44,7 @@ import org.openecomp.sdc.exception.ResponseFormat; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.Arrays; +import fj.data.Either; public class StartCertificationTransition extends LifeCycleTransition { @@ -21,6 +21,7 @@ package org.openecomp.sdc.be.components.lifecycle; import java.util.Arrays; + import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic; import org.openecomp.sdc.be.components.impl.ComponentBusinessLogic; import org.openecomp.sdc.be.config.BeEcompErrorManager; @@ -0,0 +1,36 @@ +package org.openecomp.sdc.be.components.merge; + +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; + +import org.openecomp.sdc.be.components.impl.BaseBusinessLogic; +import org.openecomp.sdc.be.components.impl.generic.GenericTypeBusinessLogic; +import org.openecomp.sdc.be.dao.api.ActionStatus; +import org.openecomp.sdc.be.model.InputDefinition; +import org.openecomp.sdc.be.model.Resource; +import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; +import org.springframework.stereotype.Component; + +import fj.data.Either; + +@Component +public class GlobalInputsFilteringBusinessLogic extends BaseBusinessLogic { + + @javax.annotation.Resource + private GenericTypeBusinessLogic genericTypeBusinessLogic; + + Either<List<InputDefinition>, ActionStatus> filterGlobalInputs(Resource newResource) { + Either<Resource, StorageOperationStatus> genericComp = toscaOperationFacade.getLatestCertifiedNodeTypeByToscaResourceName(newResource.fetchGenericTypeToscaNameFromConfig()); + return genericComp.bimap(genericResource -> findCommonInputs(genericResource, newResource), + storageOperationStatus -> componentsUtils.convertFromStorageResponse(storageOperationStatus)); + } + + private List<InputDefinition> findCommonInputs(Resource genericResource, Resource resource) { + List<InputDefinition> resourceInputs = resource.getInputs(); + List<InputDefinition> genericInputs = genericTypeBusinessLogic.generateInputsFromGenericTypeProperties(genericResource); + Set<String> genericInputsNames = genericInputs.stream().map(InputDefinition::getName).collect(Collectors.toSet()); + return resourceInputs.stream().filter(input -> genericInputsNames.contains(input.getName())).collect(Collectors.toList()); + } + +} @@ -0,0 +1,41 @@ +package org.openecomp.sdc.be.components.merge; + +import java.util.List; + +import org.openecomp.sdc.be.components.merge.input.ComponentInputsMergeBL; +import org.openecomp.sdc.be.components.merge.resource.MergeResourceBusinessLogic; +import org.openecomp.sdc.be.dao.api.ActionStatus; +import org.openecomp.sdc.be.model.InputDefinition; +import org.openecomp.sdc.be.model.Resource; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; + +import fj.data.Either; + +@Component +public class GlobalTypesMergeBusinessLogic implements MergeResourceBusinessLogic { + + private static final Logger LOGGER = LoggerFactory.getLogger(GlobalTypesMergeBusinessLogic.class); + + @javax.annotation.Resource + private GlobalInputsFilteringBusinessLogic globalInputsFilteringBusinessLogic; + + @javax.annotation.Resource + private ComponentInputsMergeBL inputsValuesMergeBL; + + @Override + public ActionStatus mergeResourceEntities(Resource oldResource, Resource newResource) { + if (oldResource == null) { + return ActionStatus.OK; + } + Either<List<InputDefinition>, ActionStatus> globalInputsEither = globalInputsFilteringBusinessLogic.filterGlobalInputs(newResource); + if (globalInputsEither.isRight()) { + LOGGER.error("failed to get global inputs of resource {} status is {}", newResource.getUniqueId(), globalInputsEither.right().value()); + return globalInputsEither.right().value(); + } + List<InputDefinition> globalInputs = globalInputsEither.left().value(); + return inputsValuesMergeBL.mergeComponentInputs(oldResource, newResource, globalInputs); + } + +} @@ -0,0 +1,95 @@ +package org.openecomp.sdc.be.components.merge; + +import java.util.List; +import java.util.Map; +import java.util.Optional; + +import org.openecomp.sdc.be.model.ComponentInstance; +import org.openecomp.sdc.be.model.RelationshipInfo; +import org.openecomp.sdc.be.model.RequirementCapabilityRelDef; +import org.openecomp.sdc.be.model.Resource; +import org.springframework.stereotype.Component; + +@Component +public class RelationsComparator { + + /** + * + * @param oldResource the old resource + * @param newResource the new resource + * @return true if there was a change in one of the relations between the old and new resource + * a change in relation is determine by comparing the relations type, node, capability and requirement name + */ + public boolean isRelationsChanged(Resource oldResource, Resource newResource) { + Map<String, List<RequirementCapabilityRelDef>> oldRelationsByInstance = oldResource.groupRelationsByInstanceName(oldResource); + Map<String, List<RequirementCapabilityRelDef>> newRelationsByInstance = newResource.groupRelationsByInstanceName(newResource); + for (Map.Entry<String, List<RequirementCapabilityRelDef>> relationByInst : newRelationsByInstance.entrySet()) { + List<RequirementCapabilityRelDef> oldRelations = oldRelationsByInstance.get(relationByInst.getKey()); + List<RequirementCapabilityRelDef> newRelations = relationByInst.getValue(); + if (isInstanceRelationsChanged(oldResource, oldRelations, newResource, newRelations)) { + return true; + } + } + return false; + + } + + private boolean isInstanceRelationsChanged(Resource oldResource, List<RequirementCapabilityRelDef> oldRelations, Resource newResource, List<RequirementCapabilityRelDef> newRelations) { + if (oldRelations == null || oldRelations.size() != newRelations.size()){ + return true; + } + return newRelations.stream().anyMatch(newRelation -> !findRelation(oldResource, oldRelations, newResource, newRelation)); + } + + + + private boolean findRelation(Resource oldResource, List<RequirementCapabilityRelDef> oldRelations, Resource newResource, RequirementCapabilityRelDef newRelation) { + for (RequirementCapabilityRelDef oldRelation : oldRelations) { + RelationshipInfo oldRelationship = oldRelation.getSingleRelationship().getRelation(); + RelationshipInfo newRelationship = newRelation.getSingleRelationship().getRelation(); + if (oldRelationship != null && newRelationship != null && isRelationEqual(oldRelationship, newRelationship) && isRelationToNodeEquals(oldResource, oldRelation, newResource, newRelation)) { + return true; + } + } + return false; + } + + private boolean isRelationToNodeEquals(Resource oldResource, RequirementCapabilityRelDef oldRelation, Resource newResource, RequirementCapabilityRelDef newRelation) { + String oldToNodeId = oldRelation.getToNode(); + String newToNodeId = newRelation.getToNode(); + Optional<ComponentInstance> oldRelationToNode = oldResource.getComponentInstanceById(oldToNodeId); + Optional<ComponentInstance> newRelationToNode = newResource.getComponentInstanceById(newToNodeId); + return oldRelationToNode.isPresent() && newRelationToNode.isPresent() && oldRelationToNode.get().getName().equals(newRelationToNode.get().getName()); + } + + private boolean isRelationEqual(RelationshipInfo oldRelationship, RelationshipInfo newRelationship) { + return isRelationshipTypeEquals(oldRelationship, newRelationship) && + isRelationshipCapabilityEquals(oldRelationship, newRelationship) && + isRelationshipReqNameEquals(oldRelationship, newRelationship); + } + + private boolean isRelationshipCapabilityEquals(RelationshipInfo oldRelationship, RelationshipInfo newRelationship) { + if(oldRelationship.getCapabilityUid() !=null && newRelationship.getCapabilityUid() != null){ + return oldRelationship.getCapabilityUid().equals(newRelationship.getCapabilityUid()); + } + else if(oldRelationship.getCapabilityUid() == null && newRelationship.getCapabilityUid() == null){ + return true; + } + return false; + } + + private boolean isRelationshipTypeEquals(RelationshipInfo oldRelationship, RelationshipInfo newRelationship) { + return oldRelationship.getRelationship().getType().equals(newRelationship.getRelationship().getType()); + } + + private boolean isRelationshipReqNameEquals(RelationshipInfo oldRelationship, RelationshipInfo newRelationship) { + if(oldRelationship.getRequirement() != null && newRelationship.getRequirement() != null){ + return oldRelationship.getRequirement().equals(newRelationship.getRequirement()); + } + else if(oldRelationship.getRequirement() == null && newRelationship.getRequirement() == null){ + return true; + } + return false; + } + +} @@ -0,0 +1,105 @@ +package org.openecomp.sdc.be.components.merge; + +import java.util.List; +import java.util.Map; + +import org.openecomp.sdc.be.dao.api.ActionStatus; +import org.openecomp.sdc.be.dao.utils.MapUtil; +import org.openecomp.sdc.be.exception.SdcActionException; +import org.openecomp.sdc.be.impl.ComponentsUtils; +import org.openecomp.sdc.be.model.Component; +import org.openecomp.sdc.be.model.ComponentInstance; +import org.openecomp.sdc.be.model.Resource; +import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import fj.data.Either; + +@org.springframework.stereotype.Component +public class TopologyComparator { + + public static final Logger LOGGER = LoggerFactory.getLogger(TopologyComparator.class); + + @javax.annotation.Resource + private RelationsComparator relationsComparator; + + @javax.annotation.Resource + private ToscaOperationFacade toscaOperationFacade; + + @javax.annotation.Resource + private ComponentsUtils componentsUtils; + + /** + * + * @param oldResource the old version of the resource of which to check for topology change + * @param newResource the new version of the resource of which to check for topology change + * @return true if there was a topology change between the old resource and new resource or false otherwise + * in case the action to find topology change failed, an appropriate {@link ActionStatus} will be returned + */ + public Either<Boolean, ActionStatus> isTopologyChanged(Resource oldResource, Resource newResource) { + List<ComponentInstance> oldInstances = oldResource.getComponentInstances(); + List<ComponentInstance> newInstances = newResource.getComponentInstances(); + if (oldInstances != null && newInstances == null || oldInstances == null && newInstances != null) { + return Either.left(true); + } + if (oldInstances == null && newInstances == null) { + return Either.left(false); + } + Map<String, ComponentInstance> oldInstancesByName = MapUtil.toMap(oldInstances, ComponentInstance::getName); + Map<String, ComponentInstance> newInstancesByName = MapUtil.toMap(newInstances, ComponentInstance::getName); + return isTopologyInstancesChanged(oldResource, newResource, oldInstancesByName, newInstancesByName); + } + + private Either<Boolean, ActionStatus> isTopologyInstancesChanged(Resource oldResource, Resource newResource, Map<String, ComponentInstance> oldInstancesByName, Map<String, ComponentInstance> newInstancesByName) { + try { + boolean isTopologyChanged = isInstanceNamesChanged(oldInstancesByName, newInstancesByName) || + isInstanceTypesChanged(oldInstancesByName, newInstancesByName) || + relationsComparator.isRelationsChanged(oldResource, newResource); + return Either.left(isTopologyChanged); + } catch (SdcActionException e) { + LOGGER.error("failed to merge entities of previous resource %s to current resource %s. reason: %s", oldResource.getUniqueId(), newResource.getUniqueId(), e.getActionStatus(), e); + return Either.right(e.getActionStatus()); + } + } + + private boolean isInstanceTypesChanged(Map<String, ComponentInstance> oldInstancesByName, Map<String, ComponentInstance> newInstancesByName) { + for (Map.Entry<String, ComponentInstance> instanceByName : newInstancesByName.entrySet()) { + ComponentInstance oldInstance = oldInstancesByName.get(instanceByName.getKey()); + if (!isSameToscaTypeOrOriginComponent(oldInstance, instanceByName.getValue())) { + return true; + } + } + return false; + } + + private boolean isInstanceNamesChanged(Map<String, ComponentInstance> oldInstanceByName, Map<String, ComponentInstance> newInstancesByName) { + return !oldInstanceByName.keySet().equals(newInstancesByName.keySet()); + } + + private boolean isSameToscaTypeOrOriginComponent(ComponentInstance oldInstance, ComponentInstance newInstance) { + return isSameToscaType(oldInstance, newInstance) || + isSameOriginComponent(oldInstance, newInstance); + } + + private boolean isSameToscaType(ComponentInstance oldInstance, ComponentInstance newInstance) { + return oldInstance.getToscaComponentName().equals(newInstance.getToscaComponentName()); + } + + private boolean isSameOriginComponent(ComponentInstance oldInstance, ComponentInstance newInstance) { + if (oldInstance.getComponentUid().equals(newInstance.getComponentUid())) { + return true; + } + Component oldOriginCmpt = toscaOperationFacade.getToscaElement(oldInstance.getComponentUid()).left().on(storageStatus -> throwSdcActionException(storageStatus, oldInstance)); + Component newOriginCmpt = toscaOperationFacade.getToscaElement(newInstance.getComponentUid()).left().on(storageStatus -> throwSdcActionException(storageStatus, newInstance)); + return oldOriginCmpt.getInvariantUUID().equals(newOriginCmpt.getInvariantUUID()); + } + + private Component throwSdcActionException(StorageOperationStatus storageOperationStatus, ComponentInstance cmptInstance) { + LOGGER.error("failed to fetch origin node type %s for instance %s", cmptInstance.getUniqueId(), cmptInstance.getComponentUid()); + throw new SdcActionException(componentsUtils.convertFromStorageResponse(storageOperationStatus)); + } + + +} @@ -0,0 +1,64 @@ +package org.openecomp.sdc.be.components.merge.heat; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.openecomp.sdc.be.dao.utils.MapUtil; +import org.openecomp.sdc.be.model.ArtifactDefinition; +import org.openecomp.sdc.be.model.HeatParameterDefinition; +import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; + +/** + * Created by chaya on 9/14/2017. + */ +@Component +public class HeatEnvArtifactsMergeBusinessLogic { + + public List<ArtifactDefinition> mergeInstanceHeatEnvArtifacts(List<ArtifactDefinition> origHeatEnvArtifacts, List<ArtifactDefinition> newHeatEnvArtifacts) { + Map<String, ArtifactDefinition> origArtifactDefinitionByLabel = MapUtil.toMap(origHeatEnvArtifacts, ArtifactDefinition::getArtifactLabel); + List<ArtifactDefinition> artifactsToUpdate = new ArrayList<>(); + newHeatEnvArtifacts.stream() + .filter(heatEnvArtifact -> origArtifactDefinitionByLabel.containsKey(heatEnvArtifact.getArtifactLabel())) + .forEach(heatEnvArtifact -> { + ArtifactDefinition origHeatEnvArtifact = origArtifactDefinitionByLabel.get(heatEnvArtifact.getArtifactLabel()); + Boolean wasMergedHeatEnvArtifact = mergeHeatEnvArtifactsParameters(heatEnvArtifact, origHeatEnvArtifact); + if (wasMergedHeatEnvArtifact) { + artifactsToUpdate.add(heatEnvArtifact); + } + }); + return artifactsToUpdate; + } + + private Boolean mergeHeatEnvArtifactsParameters(ArtifactDefinition currArtifact, ArtifactDefinition origArtifact) { + List<HeatParameterDefinition> currentHeatEnvParams = currArtifact.getListHeatParameters(); + List<HeatParameterDefinition> origHeatEnvParams = origArtifact.getListHeatParameters(); + boolean wasChanged = false; + + if (CollectionUtils.isEmpty(origHeatEnvParams) || CollectionUtils.isEmpty(currentHeatEnvParams)) { + return false; + } + + Map<String, HeatParameterDefinition> origHeatParametersByName = MapUtil.toMap(origHeatEnvParams, HeatParameterDefinition::getName); + + for (HeatParameterDefinition currHeatParam : currentHeatEnvParams) { + String paramName = currHeatParam.getName(); + HeatParameterDefinition origHeatParam = origHeatParametersByName.get(paramName); + if (isSameHeatWithDiffValue(origHeatParam, currHeatParam)) { + currHeatParam.setCurrentValue(origHeatParam.getCurrentValue()); + wasChanged = true; + } + } + currArtifact.setListHeatParameters(currentHeatEnvParams); + return wasChanged; + } + + private boolean isSameHeatWithDiffValue(HeatParameterDefinition origHeatParam, HeatParameterDefinition newHeatParam) { + return origHeatParam != null && + origHeatParam.getCurrentValue() != null && + origHeatParam.getType().equals(newHeatParam.getType()) && + !origHeatParam.getCurrentValue().equals(newHeatParam.getCurrentValue()); + } + +} @@ -0,0 +1,60 @@ +package org.openecomp.sdc.be.components.merge.input; + +import java.util.Collections; +import java.util.List; +import java.util.Map; + +import org.openecomp.sdc.be.dao.api.ActionStatus; +import org.openecomp.sdc.be.dao.utils.MapUtil; +import org.openecomp.sdc.be.impl.ComponentsUtils; +import org.openecomp.sdc.be.model.Component; +import org.openecomp.sdc.be.model.InputDefinition; +import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; + +import fj.data.Either; + +@org.springframework.stereotype.Component +public class ComponentInputsMergeBL { + + @javax.annotation.Resource + private InputsValuesMergingBusinessLogic inputsValuesMergingBusinessLogic; + + @javax.annotation.Resource + private ToscaOperationFacade toscaOperationFacade; + + @javax.annotation.Resource + private ComponentsUtils componentsUtils; + + public ActionStatus mergeAndRedeclareComponentInputs(Component prevComponent, Component newComponent, List<InputDefinition> inputsToMerge) { + mergeInputs(prevComponent, inputsToMerge); + List<InputDefinition> previouslyDeclaredInputs = inputsValuesMergingBusinessLogic.getPreviouslyDeclaredInputsToMerge(prevComponent, newComponent); + inputsToMerge.addAll(previouslyDeclaredInputs); + return updateInputs(newComponent.getUniqueId(), inputsToMerge); + } + + public ActionStatus mergeComponentInputs(Component prevComponent, Component newComponent, List<InputDefinition> inputsToMerge) { + mergeInputs(prevComponent, inputsToMerge); + return updateInputs(newComponent.getUniqueId(), inputsToMerge); + } + + public ActionStatus redeclareComponentInputsForInstance(List<InputDefinition> oldInputs, Component newComponent, String instanceId) { + List<InputDefinition> previouslyDeclaredInputs = inputsValuesMergingBusinessLogic.getPreviouslyDeclaredInputsToMerge(oldInputs, newComponent, instanceId); + return updateInputs(newComponent.getUniqueId(), previouslyDeclaredInputs); + } + + private void mergeInputs(Component prevComponent, List<InputDefinition> inputsToMerge) { + Map<String, InputDefinition> oldInputsByName = prevComponent.getInputs() == null ? Collections.emptyMap() : MapUtil.toMap(prevComponent.getInputs(), InputDefinition::getName); + Map<String, InputDefinition> inputsToMergeByName = MapUtil.toMap(inputsToMerge, InputDefinition::getName); + inputsValuesMergingBusinessLogic.mergeComponentInputs(oldInputsByName, inputsToMergeByName); + } + + private ActionStatus updateInputs(String containerId, List<InputDefinition> inputsToUpdate) { + Either<List<InputDefinition>, StorageOperationStatus> updateInputsEither = toscaOperationFacade.updateInputsToComponent(inputsToUpdate, containerId); + if (updateInputsEither.isRight()) { + return componentsUtils.convertFromStorageResponse(updateInputsEither.right().value()); + } + return ActionStatus.OK; + } + +} @@ -0,0 +1,180 @@ +package org.openecomp.sdc.be.components.merge.input; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +import org.apache.commons.lang.StringUtils; +import org.openecomp.sdc.be.dao.utils.MapUtil; +import org.openecomp.sdc.be.datatypes.elements.GetInputValueDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; +import org.openecomp.sdc.be.model.Component; +import org.openecomp.sdc.be.model.InputDefinition; + +@org.springframework.stereotype.Component +public class InputsValuesMergingBusinessLogic { + + /** + * Merge old inputs values into the updated inputs + * An input value is merged if the input previous version had a user defined value and its value is empty in current version + * @param oldInputs the currently persisted inputs mapped by their names + * @param updatedInputs the currently being update inputs mapped by their names + */ + public void mergeComponentInputs(Map<String, InputDefinition> oldInputs, Map<String, InputDefinition> updatedInputs) { + updatedInputs.forEach((inputName, input) -> mergeInputsValues(oldInputs.get(inputName), input)); + } + + /** + * @param oldComponent the old state of {@link Component} that is being updated + * @param newComponent the new state of {@link Component} that is being updated + * @return a list of all inputs that were previously declared and need to be merged to the updating component + * An input needs to merged if a property was declared as an input (by the user) in previous component version and the declared input not exist in new version + */ + public List<InputDefinition> getPreviouslyDeclaredInputsToMerge(Component oldComponent, Component newComponent) { + if (oldComponent == null || oldComponent.getInputs() == null || newComponent == null ) { + return Collections.emptyList(); + } + Map<String, List<PropertyDataDefinition>> getInputProperties = getAllGetInputPropertyData(newComponent); + List<RedeclareInputData> inputsToRedeclareData = buildRedeclareInputData(newComponent, getInputProperties); + return findPrevDeclaredInputs(oldComponent.getInputs(), inputsToRedeclareData); + } + + /** + * @param oldInputs list of previous inputs to find inputs to redeclare from + * @param newComponent the new state of {@link Component} that is being updated + * @param instanceId instance id + * @return a list of all inputs that were previously declared and need to be merged to the updating component + * An input needs to merged if an instance property was declared as an input (by the user) in previous component version and the declared input not exist in new version + */ + public List<InputDefinition> getPreviouslyDeclaredInputsToMerge(List<InputDefinition> oldInputs, Component newComponent, String instanceId) { + if (oldInputs == null || newComponent == null ) { + return Collections.emptyList(); + } + Map<String, List<PropertyDataDefinition>> getInputProperties = getAllGetInputPropertyData(newComponent, instanceId); + List<RedeclareInputData> inputsToRedeclareData = buildRedeclareInputData(newComponent, getInputProperties); + return findPrevDeclaredInputs(oldInputs, inputsToRedeclareData); + } + + private List<InputDefinition> findPrevDeclaredInputs(List<InputDefinition> oldInputs, List<RedeclareInputData> inputsToRedeclareData) { + Map<String, InputDefinition> oldInputsById = MapUtil.toMap(oldInputs, InputDefinition::getUniqueId); + List<InputDefinition> inputsToRedeclare = new ArrayList<>(); + inputsToRedeclareData.forEach(redeclareInputData -> { + List<InputDefinition> inputDefinitions = prepareInputsForRedeclaration(oldInputsById, redeclareInputData); + inputsToRedeclare.addAll(inputDefinitions); + }); + return inputsToRedeclare; + } + + private List<InputDefinition> prepareInputsForRedeclaration(Map<String, InputDefinition> oldInputsById, RedeclareInputData redeclareInputData) { + List<InputDefinition> inputsForRedeclaration = redeclareInputData.declaredInputIds.stream().map(oldInputsById::get).collect(Collectors.toList()); + inputsForRedeclaration.forEach(input -> { + input.setPropertyId(redeclareInputData.propertyId); + input.setInstanceUniqueId(redeclareInputData.instanceId); + }); + return inputsForRedeclaration; + } + + private <T extends PropertyDataDefinition> Map<String, List<PropertyDataDefinition>> findGetInputPropsDefinitions(Map<String, List<T>> instancesPropDefinitions) { + Map<String, List<PropertyDataDefinition>> getInputProps = new HashMap<>(); + if (instancesPropDefinitions == null) { + return getInputProps; + } + return instancesPropDefinitions.entrySet() + .stream() + .collect(Collectors.toMap(Map.Entry::getKey, + entry -> this.filterGetInputProps(entry.getValue()))); + } + + private <T extends PropertyDataDefinition> List<PropertyDataDefinition> filterGetInputProps(List<T> propDefinitions) { + return propDefinitions + .stream() + .filter(PropertyDataDefinition::isGetInputProperty) + .collect(Collectors.toList()); + } + + private void mergeInputsValues(InputDefinition oldInput, InputDefinition updatedInput) { + if (shouldMergeOldValue(oldInput, updatedInput)) { + updatedInput.setDefaultValue(oldInput.getDefaultValue()); + } + } + + private boolean shouldMergeOldValue(InputDefinition oldInput, InputDefinition newInput) { + return isNonEmptyDefaultValue(oldInput) && isEmptyDefaultValue(newInput) && isSameType(oldInput, newInput); + } + + private boolean isSameType(InputDefinition oldInput, InputDefinition updatedInput) { + return oldInput.typeEquals(updatedInput); + } + + private boolean isEmptyDefaultValue(InputDefinition input) { + return input != null && StringUtils.isEmpty(input.getDefaultValue()); + } + + private boolean isNonEmptyDefaultValue(InputDefinition input) { + return input != null && !isEmptyDefaultValue(input); + } + + private List<RedeclareInputData> buildRedeclareInputData(Component newComponent, Map<String, List<PropertyDataDefinition>> getInputProperties) { + Map<String, InputDefinition> inputsById = MapUtil.toMap(newComponent.getInputs(), InputDefinition::getUniqueId); + List<RedeclareInputData> redeclareInputData = new ArrayList<>(); + getInputProperties.forEach((instanceId, getInputProps) -> { + redeclareInputData.addAll(findInputsToRedeclare(inputsById, instanceId, getInputProps)); + }); + return redeclareInputData; + + } + + private Map<String, List<PropertyDataDefinition>> getAllGetInputPropertyData(Component newComponent) { + Map<String, List<PropertyDataDefinition>> getInputInstanceProps = findGetInputPropsDefinitions(newComponent.getComponentInstancesProperties()); + Map<String, List<PropertyDataDefinition>> getInputInstanceInputs = findGetInputPropsDefinitions(newComponent.getComponentInstancesInputs()); + getInputInstanceInputs.putAll(getInputInstanceProps); + return getInputInstanceInputs; + } + + private Map<String, List<PropertyDataDefinition>> getAllGetInputPropertyData(Component newComponent, String instanceId) { + List<PropertyDataDefinition> getInputInstanceProps = this.filterGetInputProps(newComponent.safeGetComponentInstanceProperties(instanceId)); + List<PropertyDataDefinition> getInputInstanceInputs = this.filterGetInputProps(newComponent.safeGetComponentInstanceInput(instanceId)); + getInputInstanceInputs.addAll(getInputInstanceProps); + return Collections.singletonMap(instanceId, getInputInstanceInputs); + } + + private List<RedeclareInputData> findInputsToRedeclare(Map<String, InputDefinition> inputsById, String instanceId, List<PropertyDataDefinition> getInputProps) { + List<RedeclareInputData> redeclareInputDataList = new ArrayList<>(); + getInputProps.forEach(property -> { + List<String> inputsToRedeclareIds = findInputsToRedeclareIds(inputsById, property); + RedeclareInputData redeclareInputData = new RedeclareInputData(property.getUniqueId(), inputsToRedeclareIds, instanceId); + redeclareInputDataList.add(redeclareInputData); + }); + return redeclareInputDataList; + } + + private List<String> findInputsToRedeclareIds(Map<String, InputDefinition> inputsById, PropertyDataDefinition property) { + List<GetInputValueDataDefinition> getInputValues = property.getGetInputValues(); + return getInputValues.stream() + .filter(getInputVal -> getInputValueWithNoCorrespondingInput(getInputVal, inputsById)) + .map(GetInputValueDataDefinition::getInputId) + .collect(Collectors.toList()); + } + + private boolean getInputValueWithNoCorrespondingInput(GetInputValueDataDefinition getInputVal, Map<String, InputDefinition> inputsById) { + return !inputsById.containsKey(getInputVal.getInputId()); + } + + private class RedeclareInputData { + private String propertyId; + private List<String> declaredInputIds; + private String instanceId; + + public RedeclareInputData(String propertyId, List<String> declaredInputIds, String instanceId) { + this.propertyId = propertyId; + this.declaredInputIds = declaredInputIds; + this.instanceId = instanceId; + } + + } + + +}
\ No newline at end of file @@ -0,0 +1,101 @@ +package org.openecomp.sdc.be.components.merge.instance; + +import java.util.HashMap; +import java.util.Map; +import java.util.Optional; +import java.util.stream.Collectors; + +import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic; +import org.openecomp.sdc.be.model.ArtifactDefinition; +import org.openecomp.sdc.be.model.Component; +import org.openecomp.sdc.be.model.ComponentInstance; +import org.openecomp.sdc.be.model.Operation; +import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.common.api.Constants; +import org.openecomp.sdc.exception.ResponseFormat; +import org.springframework.beans.factory.annotation.Autowired; + +import fj.data.Either; + +/** + * Created by chaya on 9/20/2017. + */ +@org.springframework.stereotype.Component("ComponentInstanceArtifactsMerge") +public class ComponentInstanceArtifactsMerge implements ComponentInstanceMergeInterface { + + @Autowired + ToscaOperationFacade toscaOperationFacade; + + @Autowired + ArtifactsBusinessLogic artifactsBusinessLogic; + + @Override + public void saveDataBeforeMerge(DataForMergeHolder dataHolder, Component containerComponent, ComponentInstance currentResourceInstance, Component originComponent) { + Map<String, ArtifactDefinition> componentInstancesDeploymentArtifacts = currentResourceInstance.safeGetDeploymentArtifacts(); + Map<String, ArtifactDefinition> originalComponentDeploymentArtifacts = originComponent.getDeploymentArtifacts(); + Map<String, ArtifactDefinition> deploymentArtifactsCreatedOnTheInstance = componentInstancesDeploymentArtifacts.entrySet() + .stream() + .filter(i -> !originalComponentDeploymentArtifacts.containsKey(i.getKey())) + .collect(Collectors.toMap(p -> p.getKey(), p -> p.getValue())); + + dataHolder.setOrigComponentDeploymentArtifactsCreatedOnTheInstance(deploymentArtifactsCreatedOnTheInstance); + + Map<String, ArtifactDefinition> componentInstancesInformationalArtifacts = currentResourceInstance.safeGetArtifacts(); + Map<String, ArtifactDefinition> originalComponentInformationalArtifacts = originComponent.getArtifacts(); + Map<String, ArtifactDefinition> informationalArtifactsCreatedOnTheInstance = componentInstancesInformationalArtifacts.entrySet() + .stream() + .filter(i -> !originalComponentInformationalArtifacts.containsKey(i.getKey())) + .collect(Collectors.toMap(p -> p.getKey(), p -> p.getValue())); + dataHolder.setOrigComponentInformationalArtifactsCreatedOnTheInstance(informationalArtifactsCreatedOnTheInstance); + } + + private void addEsIdToArtifactJson(Map<String, Object> artifactJson, String origEsId) { + artifactJson.put(Constants.ARTIFACT_ES_ID, origEsId); + } + + @Override + public Either<Component, ResponseFormat> mergeDataAfterCreate(User user, DataForMergeHolder dataHolder, Component updatedContainerComponent, String newInstanceId) { + Map<String, ArtifactDefinition> origInstanceDeploymentArtifactsCreatedOnTheInstance = dataHolder.getOrigComponentDeploymentArtifactsCreatedOnTheInstance(); + Map<String, ArtifactDefinition> currentInstanceDeploymentArtifacts = updatedContainerComponent.safeGetComponentInstanceDeploymentArtifacts(newInstanceId); + Map<String, ArtifactDefinition> filteredDeploymentArtifactsToAdd = Optional.ofNullable(origInstanceDeploymentArtifactsCreatedOnTheInstance).orElse(new HashMap<>()).entrySet().stream() + .filter(artifact -> noArtifactWithTheSameLabel(artifact.getValue().getArtifactLabel(), currentInstanceDeploymentArtifacts)) + .collect(Collectors.toMap(p -> p.getKey(), q -> q.getValue())); + Map<String, ArtifactDefinition> origInstanceInformationalArtifactsCreatedOnTheInstance = dataHolder.getOrigComponentInformationalArtifactsCreatedOnTheInstance(); + Map<String, ArtifactDefinition> currentInstanceInformationalArtifacts = updatedContainerComponent.safeGetComponentInstanceInformationalArtifacts(newInstanceId); + Map<String, ArtifactDefinition> filteredInformationalArtifactsToAdd = Optional.ofNullable(origInstanceInformationalArtifactsCreatedOnTheInstance).orElse(new HashMap<>()).entrySet().stream() + .filter(artifact -> noArtifactWithTheSameLabel(artifact.getValue().getArtifactLabel(), currentInstanceInformationalArtifacts)) + .collect(Collectors.toMap(p -> p.getKey(), q -> q.getValue())); + Map<String, ArtifactDefinition> allFilteredArtifactsToAdd = new HashMap<>(); + allFilteredArtifactsToAdd.putAll(filteredDeploymentArtifactsToAdd); + allFilteredArtifactsToAdd.putAll(filteredInformationalArtifactsToAdd); + + for (Map.Entry<String, ArtifactDefinition> currentArtifactDefinition : allFilteredArtifactsToAdd.entrySet()) { + Map<String, Object> jsonForUpdateArtifact = artifactsBusinessLogic.buildJsonForUpdateArtifact( + currentArtifactDefinition.getValue().getUniqueId(), currentArtifactDefinition.getValue().getArtifactName(), + currentArtifactDefinition.getValue().getArtifactType(), currentArtifactDefinition.getValue().getArtifactGroupType(), + currentArtifactDefinition.getValue().getArtifactLabel(), currentArtifactDefinition.getValue().getArtifactDisplayName(), + currentArtifactDefinition.getValue().getDescription(), currentArtifactDefinition.getValue().getPayloadData(), + null, currentArtifactDefinition.getValue().getListHeatParameters()); + addEsIdToArtifactJson(jsonForUpdateArtifact, currentArtifactDefinition.getValue().getEsId()); + Either<Either<ArtifactDefinition, Operation>, ResponseFormat> uploadArtifactToService = + artifactsBusinessLogic.updateResourceInstanceArtifactNoContent(newInstanceId, updatedContainerComponent, + user, jsonForUpdateArtifact, artifactsBusinessLogic.new ArtifactOperationInfo( + false, false, ArtifactsBusinessLogic.ArtifactOperationEnum.Link), currentArtifactDefinition.getValue()); + if (uploadArtifactToService.isRight()) { + return Either.right(uploadArtifactToService.right().value()); + } + toscaOperationFacade.commit(); + } + return Either.left(updatedContainerComponent); + } + + private boolean noArtifactWithTheSameLabel(String artifactLabel, Map<String, ArtifactDefinition> currDeploymentArtifacts) { + for (Map.Entry<String, ArtifactDefinition> artifact : currDeploymentArtifacts.entrySet()) { + if (artifact.getValue().getArtifactLabel().equals(artifactLabel)) { + return false; + } + } + return true; + } +} @@ -0,0 +1,63 @@ +package org.openecomp.sdc.be.components.merge.instance; + +import java.util.List; +import java.util.Map; + +import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic; +import org.openecomp.sdc.be.components.merge.heat.HeatEnvArtifactsMergeBusinessLogic; +import org.openecomp.sdc.be.impl.ComponentsUtils; +import org.openecomp.sdc.be.model.ArtifactDefinition; +import org.openecomp.sdc.be.model.Component; +import org.openecomp.sdc.be.model.ComponentInstance; +import org.openecomp.sdc.be.model.Operation; +import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum; +import org.openecomp.sdc.exception.ResponseFormat; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; + +import fj.data.Either; + +/** + * Created by chaya on 9/20/2017. + */ +@org.springframework.stereotype.Component("ComponentInstanceHeatEnvMerge") +public class ComponentInstanceHeatEnvMerge implements ComponentInstanceMergeInterface { + + private static Logger log = LoggerFactory.getLogger(ComponentInstanceHeatEnvMerge.class.getName()); + + @Autowired + private ArtifactsBusinessLogic artifactsBusinessLogic; + + @Autowired + private HeatEnvArtifactsMergeBusinessLogic heatEnvArtifactsMergeBusinessLogic; + + @Autowired + protected ComponentsUtils componentsUtils; + + + @Override + public void saveDataBeforeMerge(DataForMergeHolder dataHolder, Component containerComponent, ComponentInstance currentResourceInstance, Component originComponent) { + dataHolder.setOrigComponentInstanceHeatEnvArtifacts(containerComponent.safeGetComponentInstanceHeatArtifacts(currentResourceInstance.getUniqueId())); + } + + @Override + public Either<Component, ResponseFormat> mergeDataAfterCreate(User user, DataForMergeHolder dataHolder, Component updatedContainerComponent, String newInstanceId) { + List<ArtifactDefinition> origCompInstHeatEnvArtifacts = dataHolder.getOrigComponentInstanceHeatEnvArtifacts(); + List<ArtifactDefinition> newCompInstHeatEnvArtifacts = updatedContainerComponent.safeGetComponentInstanceHeatArtifacts(newInstanceId); + List<ArtifactDefinition> artifactsToUpdate = heatEnvArtifactsMergeBusinessLogic.mergeInstanceHeatEnvArtifacts(origCompInstHeatEnvArtifacts, newCompInstHeatEnvArtifacts); + + for (ArtifactDefinition artifactInfo : artifactsToUpdate) { + Map<String, Object> json = artifactsBusinessLogic.buildJsonForUpdateArtifact(artifactInfo, ArtifactGroupTypeEnum.DEPLOYMENT, null); + + Either<Either<ArtifactDefinition, Operation>, ResponseFormat> uploadArtifactToService = artifactsBusinessLogic.updateResourceInstanceArtifactNoContent(newInstanceId, updatedContainerComponent, user, json, + artifactsBusinessLogic.new ArtifactOperationInfo(false, false, ArtifactsBusinessLogic.ArtifactOperationEnum.Update), null); + if (uploadArtifactToService.isRight()) { + log.error("Failed to update artifact {} on resourceInstance {}", artifactInfo.getArtifactLabel(), newInstanceId); + return Either.right(uploadArtifactToService.right().value()); + } + } + return Either.left(updatedContainerComponent); + } +} @@ -0,0 +1,90 @@ +package org.openecomp.sdc.be.components.merge.instance; + +import java.util.List; + +import org.openecomp.sdc.be.dao.api.ActionStatus; +import org.openecomp.sdc.be.impl.ComponentsUtils; +import org.openecomp.sdc.be.model.Component; +import org.openecomp.sdc.be.model.ComponentInstance; +import org.openecomp.sdc.be.model.ComponentParametersView; +import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; +import org.openecomp.sdc.exception.ResponseFormat; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; + +import fj.data.Either; +/** + * Created by chaya on 9/12/2017. + */ +@org.springframework.stereotype.Component("componentInstanceMergeDataBusinessLogic") +public class ComponentInstanceMergeDataBusinessLogic { + + private static Logger log = LoggerFactory.getLogger(ComponentInstanceMergeDataBusinessLogic.class.getName()); + + @Autowired + private List<ComponentInstanceMergeInterface> componentInstancesMergeBLs; + + @Autowired + private ToscaOperationFacade toscaOperationFacade; + + @Autowired + private ComponentsUtils componentsUtils; + + //for testing only + protected void setComponentInstancesMergeBLs(List<ComponentInstanceMergeInterface> componentInstancesMergeBLs) { + this.componentInstancesMergeBLs = componentInstancesMergeBLs; + } + + /** + * Saves all containerComponents data before deleting, in order to merge once creating a new instance + * @param containerComponent + * @param currentResourceInstance + */ + public DataForMergeHolder saveAllDataBeforeDeleting(org.openecomp.sdc.be.model.Component containerComponent, ComponentInstance currentResourceInstance, Component originComponent) { + DataForMergeHolder dataHolder = new DataForMergeHolder(); + for (ComponentInstanceMergeInterface compInstMergeBL : componentInstancesMergeBLs) { + compInstMergeBL.saveDataBeforeMerge(dataHolder, containerComponent, currentResourceInstance, originComponent); + } + return dataHolder; + } + + /** + * Merges inputs and instance inputs/props of the new Container component with the old container component data (before deleting) + * @param containerComponent + * @param newContainerComponentId + * @param newInstanceId + * @return + */ + public Either<Component, ResponseFormat> mergeComponentUserOrigData(User user, DataForMergeHolder dataHolder, org.openecomp.sdc.be.model.Component containerComponent, String newContainerComponentId, String newInstanceId) { + + Either<Component, StorageOperationStatus> componentWithInstancesInputsAndProperties = getComponentWithInstancesInputsAndProperties(newContainerComponentId); + if (componentWithInstancesInputsAndProperties.isRight()) { + log.error("Component with id {} was not found", newContainerComponentId); + StorageOperationStatus storageOperationStatus = componentWithInstancesInputsAndProperties.right().value(); + ActionStatus actionStatus = componentsUtils.convertFromStorageResponse(storageOperationStatus, containerComponent.getComponentType()); + return Either.right(componentsUtils.getResponseFormat(actionStatus)); + } + Component updatedContainerComponent = componentWithInstancesInputsAndProperties.left().value(); + + for (ComponentInstanceMergeInterface compInstMergeBL: componentInstancesMergeBLs) { + Either<Component, ResponseFormat> compInstanceMergeEither = compInstMergeBL.mergeDataAfterCreate(user, dataHolder, updatedContainerComponent, newInstanceId); + if (compInstanceMergeEither.isRight()) { + return Either.right(compInstanceMergeEither.right().value()); + } + } + + return Either.left(updatedContainerComponent); + } + + private Either<Component, StorageOperationStatus> getComponentWithInstancesInputsAndProperties(String containerComponentId) { + ComponentParametersView filter = new ComponentParametersView(true); + filter.setIgnoreComponentInstances(false); + filter.setIgnoreComponentInstancesInputs(false); + filter.setIgnoreComponentInstancesProperties(false); + filter.setIgnoreArtifacts(false); + return toscaOperationFacade.getToscaElement(containerComponentId, filter); + } +} @@ -0,0 +1,18 @@ +package org.openecomp.sdc.be.components.merge.instance; + +import org.openecomp.sdc.be.model.Component; +import org.openecomp.sdc.be.model.ComponentInstance; +import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.exception.ResponseFormat; + +import fj.data.Either; + +/** + * Created by chaya on 9/20/2017. + */ +public interface ComponentInstanceMergeInterface { + + void saveDataBeforeMerge(DataForMergeHolder dataHolder, Component containerComponent, ComponentInstance currentResourceInstance, Component originComponent); + + Either<Component, ResponseFormat> mergeDataAfterCreate(User user, DataForMergeHolder dataHolder, Component updatedContainerComponent, String newInstanceId); +} @@ -0,0 +1,131 @@ +package org.openecomp.sdc.be.components.merge.instance; + +import java.util.ArrayList; +import java.util.List; + +import org.openecomp.sdc.be.components.merge.input.ComponentInputsMergeBL; +import org.openecomp.sdc.be.components.merge.property.ComponentInstanceInputsMergeBL; +import org.openecomp.sdc.be.components.merge.property.ComponentInstancePropertiesMergeBL; +import org.openecomp.sdc.be.dao.api.ActionStatus; +import org.openecomp.sdc.be.impl.ComponentsUtils; +import org.openecomp.sdc.be.model.Component; +import org.openecomp.sdc.be.model.ComponentInstance; +import org.openecomp.sdc.be.model.ComponentInstanceInput; +import org.openecomp.sdc.be.model.ComponentInstanceProperty; +import org.openecomp.sdc.be.model.ComponentParametersView; +import org.openecomp.sdc.be.model.InputDefinition; +import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; +import org.openecomp.sdc.exception.ResponseFormat; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; + +import fj.data.Either; + +/** + * Created by chaya on 9/20/2017. + */ +@org.springframework.stereotype.Component("ComponentInstancePropsAndInputsMerge") +public class ComponentInstancePropsAndInputsMerge implements ComponentInstanceMergeInterface { + + private static Logger log = LoggerFactory.getLogger(ComponentInstancePropsAndInputsMerge.class.getName()); + + @Autowired + private ToscaOperationFacade toscaOperationFacade; + + @Autowired + private ComponentsUtils componentsUtils; + + @Autowired + private ComponentInstancePropertiesMergeBL componentInstancePropertiesMergeBL; + + @Autowired + private ComponentInstanceInputsMergeBL resourceInstanceInputsMergeBL; + + @Autowired + private ComponentInputsMergeBL resourceInputsMergeBL; + + @Override + public void saveDataBeforeMerge(DataForMergeHolder dataHolder, Component containerComponent, ComponentInstance currentResourceInstance, Component originComponent) { + dataHolder.setOrigComponentInstanceInputs(containerComponent.safeGetComponentInstanceInputsByName(currentResourceInstance.getName())); + dataHolder.setOrigComponentInstanceProperties(containerComponent.safeGetComponentInstanceProperties(currentResourceInstance.getUniqueId())); + dataHolder.setOrigComponentInputs(containerComponent.getInputs()); + } + + @Override + public Either<Component, ResponseFormat> mergeDataAfterCreate(User user, DataForMergeHolder dataHolder, Component updatedContainerComponent, String newInstanceId) { + Either<List<ComponentInstanceInput>, ActionStatus> instanceInputsEither = mergeComponentInstanceInputsIntoContainer(dataHolder, updatedContainerComponent, newInstanceId); + if (instanceInputsEither.isRight()) { + ActionStatus actionStatus = instanceInputsEither.right().value(); + return Either.right(componentsUtils.getResponseFormat(actionStatus)); + } + Either<List<ComponentInstanceProperty>, ActionStatus> instancePropsEither = mergeComponentInstancePropsIntoContainer(dataHolder, updatedContainerComponent, newInstanceId); + if (instancePropsEither.isRight()) { + ActionStatus actionStatus = instancePropsEither.right().value(); + return Either.right(componentsUtils.getResponseFormat(actionStatus)); + } + Either<List<InputDefinition>, ActionStatus> inputsEither = mergeComponentInputsIntoContainer(dataHolder, updatedContainerComponent.getUniqueId(), newInstanceId); + if (inputsEither.isRight()) { + ActionStatus actionStatus = inputsEither.right().value(); + return Either.right(componentsUtils.getResponseFormat(actionStatus)); + } + return Either.left(updatedContainerComponent); + } + + private Either<List<ComponentInstanceProperty>, ActionStatus> mergeComponentInstancePropsIntoContainer(DataForMergeHolder dataHolder, Component updatedComponent, String instanceId) { + List<ComponentInstanceProperty> originComponentInstanceProps = dataHolder.getOrigComponentInstanceProperties(); + List<InputDefinition> originComponentsInputs = dataHolder.getOrigComponentInputs(); + List<ComponentInstanceProperty> newComponentInstancesProps = updatedComponent.safeGetComponentInstanceProperties(instanceId); + ActionStatus actionStatus = componentInstancePropertiesMergeBL.mergeComponentInstanceProperties(originComponentInstanceProps, originComponentsInputs, updatedComponent, instanceId); + + if (actionStatus != ActionStatus.OK) { + log.error("Failed to update component {} with merged instance properties", updatedComponent.getUniqueId(), newComponentInstancesProps); + return Either.right(actionStatus); + } + return Either.left(newComponentInstancesProps); + } + + private Either<List<ComponentInstanceInput>, ActionStatus> mergeComponentInstanceInputsIntoContainer(DataForMergeHolder dataHolder, Component updatedComponent, String instanceId) { + List<ComponentInstanceInput> originComponentInstanceInputs = dataHolder.getOrigComponentInstanceInputs(); + List<InputDefinition> originComponentsInputs = dataHolder.getOrigComponentInputs(); + List<ComponentInstanceInput> newComponentInstancesInputs = updatedComponent.safeGetComponentInstanceInput(instanceId); + ActionStatus actionStatus = resourceInstanceInputsMergeBL.mergeComponentInstanceInputs(originComponentInstanceInputs, originComponentsInputs, updatedComponent, instanceId); + if (actionStatus != ActionStatus.OK) { + log.error("Failed to update component {} with merged instance properties", updatedComponent.getUniqueId(), newComponentInstancesInputs); + return Either.right(actionStatus); + } + return Either.left(newComponentInstancesInputs); + } + + private Either<List<InputDefinition>, ActionStatus> mergeComponentInputsIntoContainer(DataForMergeHolder dataHolder, String newContainerComponentId, String newInstanceId) { + List<InputDefinition> origComponentInputs = dataHolder.getOrigComponentInputs(); + List<InputDefinition> inputsToAddToContainer = new ArrayList<>(); + if (origComponentInputs != null && !origComponentInputs.isEmpty()) { + // get instance inputs and properties after merge + Either<Component, StorageOperationStatus> componentWithInstancesInputsAndProperties = getComponentWithInstancesInputsAndProperties(newContainerComponentId); + if (componentWithInstancesInputsAndProperties.isRight()) { + log.error("Component %s was not found", newContainerComponentId); + return Either.right(componentsUtils.convertFromStorageResponse(componentWithInstancesInputsAndProperties.right().value())); + } + Component updatedContainerComponent = componentWithInstancesInputsAndProperties.left().value(); + + ActionStatus redeclareStatus = resourceInputsMergeBL.redeclareComponentInputsForInstance(origComponentInputs, updatedContainerComponent, newInstanceId); + if (redeclareStatus != ActionStatus.OK) { + log.error("Failed to update component {} with merged inputs {}", newContainerComponentId, inputsToAddToContainer); + Either.right(redeclareStatus); + } + } + return Either.left(inputsToAddToContainer); + } + + private Either<Component, StorageOperationStatus> getComponentWithInstancesInputsAndProperties(String containerComponentId) { + ComponentParametersView filter = new ComponentParametersView(true); + filter.setIgnoreComponentInstances(false); + filter.setIgnoreComponentInstancesInputs(false); + filter.setIgnoreComponentInstancesProperties(false); + filter.setIgnoreArtifacts(false); + return toscaOperationFacade.getToscaElement(containerComponentId, filter); + } +} @@ -0,0 +1,114 @@ +package org.openecomp.sdc.be.components.merge.instance; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; + +import org.openecomp.sdc.be.model.ArtifactDefinition; +import org.openecomp.sdc.be.model.ComponentInstanceInput; +import org.openecomp.sdc.be.model.ComponentInstanceProperty; +import org.openecomp.sdc.be.model.InputDefinition; + +/** + * Created by chaya on 9/7/2017. + */ +public class DataForMergeHolder { + + private List<ComponentInstanceInput> origComponentInstanceInputs; + private List<ComponentInstanceProperty> origComponentInstanceProperties; + private List<InputDefinition> origComponentInputs; + private Map<String, ArtifactDefinition> origCompInstDeploymentArtifactsCreatedOnTheInstance; + private Map<String, ArtifactDefinition> origCompInstInformationalArtifactsCreatedOnTheInstance; + private List<ArtifactDefinition> origComponentInstanceHeatEnvArtifacts; + + public DataForMergeHolder() { + origComponentInstanceInputs = new ArrayList<>(); + origComponentInstanceProperties = new ArrayList<>(); + origComponentInputs = new ArrayList<>(); + origCompInstDeploymentArtifactsCreatedOnTheInstance = new HashMap<>(); + origCompInstDeploymentArtifactsCreatedOnTheInstance = new HashMap<>(); + + } + + public List<ArtifactDefinition> getOrigComponentInstanceHeatEnvArtifacts() { + return origComponentInstanceHeatEnvArtifacts; + } + + public void setOrigComponentInstanceHeatEnvArtifacts(List<ArtifactDefinition> origComponentInstanceHeatEnvArtifacts) { + this.origComponentInstanceHeatEnvArtifacts = origComponentInstanceHeatEnvArtifacts; + } + + public List<ComponentInstanceInput> getOrigComponentInstanceInputs() { + return origComponentInstanceInputs; + } + + public void setOrigComponentInstanceInputs(List<ComponentInstanceInput> origComponentInstanceInputs) { + Optional.ofNullable(origComponentInstanceInputs).orElse(Collections.emptyList()).stream().forEach(input -> { + ComponentInstanceInput copyInput = new ComponentInstanceInput(); + copyInput.setType(input.getType()); + copyInput.setPath(input.getPath()); + copyInput.setRules(input.getRules()); + copyInput.setValueUniqueUid(input.getValueUniqueUid()); + copyInput.setDefaultValue(input.getDefaultValue()); + copyInput.setDescription(input.getDescription()); + copyInput.setGetInputValues(input.getGetInputValues()); + copyInput.setInputId(input.getInputId()); + copyInput.setInputPath(input.getInputPath()); + copyInput.setInputs(input.getInputs()); + copyInput.setLabel(input.getLabel()); + copyInput.setName(input.getName()); + copyInput.setParentUniqueId(input.getParentUniqueId()); + copyInput.setProperties(input.getProperties()); + copyInput.setPropertyId(input.getPropertyId()); + copyInput.setSchema(input.getSchema()); + copyInput.setStatus(input.getStatus()); + copyInput.setDefaultValue(input.getDefaultValue()); + copyInput.setValue(input.getValue()); + this.origComponentInstanceInputs.add(copyInput); + }); + } + + public List<ComponentInstanceProperty> getOrigComponentInstanceProperties() { + return origComponentInstanceProperties; + } + + public void setOrigComponentInstanceProperties(List<ComponentInstanceProperty> origComponentInstanceProperties) { + Optional.ofNullable(origComponentInstanceProperties).orElse(Collections.emptyList()).stream().forEach(property -> { + ComponentInstanceProperty propertyCopy = new ComponentInstanceProperty(); + propertyCopy.setType(property.getType()); + propertyCopy.setName(property.getName()); + propertyCopy.setValue(property.getValue()); + propertyCopy.setUniqueId(property.getUniqueId()); + propertyCopy.setDefaultValue(property.getDefaultValue()); + propertyCopy.setInputId(property.getInputId()); + propertyCopy.setGetInputValues(property.getGetInputValues()); + this.origComponentInstanceProperties.add(propertyCopy); + }); + } + + public List<InputDefinition> getOrigComponentInputs() { + return origComponentInputs; + } + + public void setOrigComponentInputs(List<InputDefinition> origComponentInputs) { + this.origComponentInputs = origComponentInputs; + } + + public Map<String, ArtifactDefinition> getOrigComponentDeploymentArtifactsCreatedOnTheInstance(){ return this.origCompInstDeploymentArtifactsCreatedOnTheInstance;} + + public Map<String, ArtifactDefinition> getOrigComponentInformationalArtifactsCreatedOnTheInstance(){ return origCompInstInformationalArtifactsCreatedOnTheInstance;} + + public void setOrigComponentDeploymentArtifactsCreatedOnTheInstance(Map<String, ArtifactDefinition> origDeploymentArtifacts){ + origCompInstDeploymentArtifactsCreatedOnTheInstance = origDeploymentArtifacts; + } + + public void setOrigComponentInformationalArtifactsCreatedOnTheInstance(Map<String, ArtifactDefinition> origInformationalArtifacts){ + origCompInstInformationalArtifactsCreatedOnTheInstance = origInformationalArtifacts; + } + + + +} @@ -0,0 +1,17 @@ +package org.openecomp.sdc.be.components.merge.property; + +import java.util.List; + +public class ComplexPropertyValueMerger extends PropertyValueMerger { + + private static final ComplexPropertyValueMerger INSTANCE = new ComplexPropertyValueMerger(); + + public static PropertyValueMerger getInstance() { + return INSTANCE; + } + + @Override + Object merge(Object oldVal, Object newVal, List<String> someStrings) { + return mergeValues(oldVal, newVal, someStrings); + } +} @@ -0,0 +1,72 @@ +package org.openecomp.sdc.be.components.merge.property; + +import java.util.Collections; +import java.util.List; +import java.util.Map; + +import org.openecomp.sdc.be.dao.api.ActionStatus; +import org.openecomp.sdc.be.impl.ComponentsUtils; +import org.openecomp.sdc.be.model.Component; +import org.openecomp.sdc.be.model.ComponentInstance; +import org.openecomp.sdc.be.model.ComponentInstanceInput; +import org.openecomp.sdc.be.model.InputDefinition; +import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; + +import fj.data.Either; + +@org.springframework.stereotype.Component +public class ComponentInstanceInputsMergeBL { + + @javax.annotation.Resource + private ToscaOperationFacade toscaOperationFacade; + + @javax.annotation.Resource + private ComponentsUtils componentsUtils; + + @javax.annotation.Resource + private DataDefinitionsValuesMergingBusinessLogic propertyValuesMergingBusinessLogic; + + public ActionStatus mergeComponentInstancesInputs(Component oldComponent, Component newComponent) { + Map<String, List<ComponentInstanceInput>> componentInstancesInputs = newComponent.getComponentInstancesInputs(); + if (componentInstancesInputs == null) { + return ActionStatus.OK; + } + componentInstancesInputs.forEach((instanceId, instInputs) -> mergeOldInstanceInputsValues(oldComponent, newComponent, instanceId, instInputs)); + return updateComponentInstancesInputs(newComponent, componentInstancesInputs); + } + + public ActionStatus mergeComponentInstanceInputs(List<ComponentInstanceInput> oldInstProps, List<InputDefinition> oldInputs, Component newComponent, String instanceId) { + List<ComponentInstanceInput> newInstInput = newComponent.safeGetComponentInstanceInput(instanceId); + if (newInstInput == null) { + return ActionStatus.OK; + } + propertyValuesMergingBusinessLogic.mergeInstanceDataDefinitions(oldInstProps, oldInputs, newInstInput, newComponent.getInputs()); + return updateComponentInstanceInputs(newComponent, instanceId, newInstInput); + } + + private ActionStatus updateComponentInstanceInputs(Component newComponent, String instanceId, List<ComponentInstanceInput> newInstInput) { + StorageOperationStatus storageOperationStatus = toscaOperationFacade.updateComponentInstanceInputs(newComponent, instanceId, newInstInput); + if (storageOperationStatus != StorageOperationStatus.OK) { + return componentsUtils.convertFromStorageResponse(storageOperationStatus); + } + return ActionStatus.OK; + } + + private ActionStatus updateComponentInstancesInputs(Component component, Map<String, List<ComponentInstanceInput>> componentInstancesInputs) { + Either<Map<String, List<ComponentInstanceInput>>, StorageOperationStatus> mapStorageOperationStatusEither = toscaOperationFacade.updateComponentInstanceInputsToComponent(componentInstancesInputs, component.getUniqueId()); + if (mapStorageOperationStatusEither.isRight()) { + return componentsUtils.convertFromStorageResponse(mapStorageOperationStatusEither.right().value()); + } + return ActionStatus.OK; + } + + private void mergeOldInstanceInputsValues(Component oldComponent, Component newComponent, String instanceId, List<ComponentInstanceInput> instInputs) { + ComponentInstance currentCompInstance = newComponent.getComponentInstanceById(instanceId).get(); + List<ComponentInstanceInput> oldInstInputs = oldComponent == null ? Collections.emptyList() : oldComponent.safeGetComponentInstanceInputsByName(currentCompInstance.getName()); + List<InputDefinition> oldInputs = oldComponent == null ? Collections.emptyList() : oldComponent.getInputs(); + propertyValuesMergingBusinessLogic.mergeInstanceDataDefinitions(oldInstInputs, oldInputs, instInputs, newComponent.getInputs()); + } + + +} @@ -0,0 +1,73 @@ +package org.openecomp.sdc.be.components.merge.property; + +import java.util.Collections; +import java.util.List; +import java.util.Map; + +import org.openecomp.sdc.be.dao.api.ActionStatus; +import org.openecomp.sdc.be.impl.ComponentsUtils; +import org.openecomp.sdc.be.model.Component; +import org.openecomp.sdc.be.model.ComponentInstanceProperty; +import org.openecomp.sdc.be.model.InputDefinition; +import org.openecomp.sdc.be.model.Resource; +import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; + +import fj.data.Either; + +@org.springframework.stereotype.Component +public class ComponentInstancePropertiesMergeBL { + + @javax.annotation.Resource + private ToscaOperationFacade toscaOperationFacade; + + @javax.annotation.Resource(name = "componentUtils") + private ComponentsUtils componentsUtils; + + @javax.annotation.Resource + private DataDefinitionsValuesMergingBusinessLogic propertyValuesMergingBusinessLogic; + + public ActionStatus mergeComponentInstancesProperties(Component oldComponent, Resource newResource) { + Map<String, List<ComponentInstanceProperty>> newInstProps = newResource.getComponentInstancesProperties(); + if (newInstProps == null) { + return ActionStatus.OK; + } + newInstProps.forEach((instanceId, newProps) -> mergeOldInstancePropertiesValues(oldComponent, newResource, instanceId, newProps) ); + return updateComponentInstancesProperties(newResource, newInstProps); + } + + + public ActionStatus mergeComponentInstanceProperties(List<ComponentInstanceProperty> oldInstProps, List<InputDefinition> oldInputs, Component newComponent, String instanceId) { + List<ComponentInstanceProperty> newInstProps = newComponent.safeGetComponentInstanceProperties(instanceId); + if (newInstProps == null) { + return ActionStatus.OK; + } + propertyValuesMergingBusinessLogic.mergeInstanceDataDefinitions(oldInstProps, oldInputs, newInstProps, newComponent.getInputs()); + return updateComponentInstanceProperties(newComponent, instanceId, newInstProps); + } + + private void mergeOldInstancePropertiesValues(Component oldComponent, Component newComponent, String instanceId, List<ComponentInstanceProperty> newProps) { + List<ComponentInstanceProperty> oldInstProperties = oldComponent == null ? Collections.emptyList() : oldComponent.safeGetComponentInstanceProperties(instanceId); + List<InputDefinition> oldInputs = oldComponent == null ? Collections.emptyList() : oldComponent.getInputs(); + propertyValuesMergingBusinessLogic.mergeInstanceDataDefinitions(oldInstProperties, oldInputs, newProps, newComponent.getInputs()); + } + + private ActionStatus updateComponentInstancesProperties(Component newComponent, Map<String, List<ComponentInstanceProperty>> newInstProps) { + Either<Map<String, List<ComponentInstanceProperty>>, StorageOperationStatus> mapStorageOperationStatusEither = toscaOperationFacade.updateComponentInstancePropsToComponent(newInstProps, newComponent.getUniqueId()); + if (mapStorageOperationStatusEither.isRight()) { + return componentsUtils.convertFromStorageResponse(mapStorageOperationStatusEither.right().value()); + } + return ActionStatus.OK; + } + + private ActionStatus updateComponentInstanceProperties(Component component, String instanceId, List<ComponentInstanceProperty> newInstProps) { + StorageOperationStatus storageOperationStatus = toscaOperationFacade.updateComponentInstanceProperties(component, instanceId, newInstProps); + if (storageOperationStatus != StorageOperationStatus.OK) { + return componentsUtils.convertFromStorageResponse(storageOperationStatus); + } + return ActionStatus.OK; + } + + + +} @@ -0,0 +1,43 @@ +package org.openecomp.sdc.be.components.merge.property; + +import java.util.List; + +import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; +import org.openecomp.sdc.be.model.InputDefinition; +import org.springframework.stereotype.Component; + +@Component +public class DataDefinitionsValuesMergingBusinessLogic { + + @javax.annotation.Resource + private PropertyDataValueMergeBusinessLogic propertyValueMergeBL; + + /** + * Merge previous version data definition values into the new version data definition. + * A data definition value is merged if it had a value in previous version and has no value in the current version. + * in case a property get input value has no corresponding input in the current version its value will not be merged + * @param oldInstanceDataDefinition the currently persisted instance data definitions + * @param oldInputs the previous version inputs + * @param updatedInstanceDataDefinition the currently being update instance data definitions + * @param newInputs the new version inputs + */ + public <T extends PropertyDataDefinition> void mergeInstanceDataDefinitions(List<T> oldInstanceDataDefinition, List<InputDefinition> oldInputs, List<T> updatedInstanceDataDefinition, List<InputDefinition> newInputs) { + if (updatedInstanceDataDefinition == null || updatedInstanceDataDefinition.isEmpty() || oldInstanceDataDefinition == null || oldInstanceDataDefinition.isEmpty()) { + return; + } + List<MergePropertyData> mergePropertyData = PropertyInstanceMergeDataBuilder.getInstance().buildDataForMerging(oldInstanceDataDefinition, oldInputs, updatedInstanceDataDefinition, newInputs); + mergePropertyData.forEach(this::mergeInstanceDefinition); + + } + + private void mergeInstanceDefinition(MergePropertyData mergeData) { + if (isSameType(mergeData.getOldProp(), mergeData.getNewProp())) { + propertyValueMergeBL.mergePropertyValue(mergeData.getOldProp(), mergeData.getNewProp(), mergeData.getGetInputNamesToMerge()); + } + } + + private boolean isSameType(PropertyDataDefinition oldDataDefinition, PropertyDataDefinition updatedDataDefinition) { + return oldDataDefinition.typeEquals(updatedDataDefinition); + } + +} @@ -0,0 +1,52 @@ +package org.openecomp.sdc.be.components.merge.property; + +import java.util.ArrayList; +import java.util.List; + +import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; + +/** + * A POJO which represents an instance property data definition (a {@link org.openecomp.sdc.be.model.ComponentInstanceProperty} or {@link org.openecomp.sdc.be.model.ComponentInstanceInput}) + * that its value needs to be merged during an upgrade of a VSP. + * + */ +public class MergePropertyData { + + /*The previous state of the instance property to merge */ + private PropertyDataDefinition oldProp; + /*The new state of the instance property to merge */ + private PropertyDataDefinition newProp; + + private List<String> getInputNamesToMerge = new ArrayList<>(); + + public PropertyDataDefinition getOldProp() { + return oldProp; + } + + public MergePropertyData setOldProp(PropertyDataDefinition oldProp) { + this.oldProp = oldProp; + return this; + } + + public MergePropertyData setNewProp(PropertyDataDefinition newProp) { + this.newProp = newProp; + return this; + } + + public PropertyDataDefinition getNewProp() { + return newProp; + } + + public void addAddGetInputNamesToMerge(List<String> getInputsNameToMerge) { + getInputNamesToMerge.addAll(getInputsNameToMerge); + } + + public List<String> getGetInputNamesToMerge() { + return getInputNamesToMerge; + } + + public boolean isGetInputProp() { + return oldProp.isGetInputProperty(); + } + +} @@ -0,0 +1,164 @@ +package org.openecomp.sdc.be.components.merge.property; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.stream.Collectors; + +import javax.annotation.Resource; + +import org.openecomp.sdc.be.components.impl.ImportUtils; +import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; +import org.openecomp.sdc.be.datatypes.elements.GetInputValueDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; +import org.openecomp.sdc.be.model.DataTypeDefinition; +import org.openecomp.sdc.be.model.cache.ApplicationDataTypeCache; +import org.openecomp.sdc.be.model.tosca.ToscaFunctions; +import org.openecomp.sdc.be.model.tosca.ToscaPropertyType; +import org.openecomp.sdc.be.tosca.PropertyConvertor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; + +import com.google.gson.Gson; + +import fj.data.Either; + +@Component +public class PropertyDataValueMergeBusinessLogic { + + private static final Logger LOGGER = LoggerFactory.getLogger(PropertyDataValueMergeBusinessLogic.class); + + private final PropertyConvertor propertyConvertor = PropertyConvertor.getInstance(); + + private PropertyValueMerger complexPropertyValueMerger = ComplexPropertyValueMerger.getInstance(); + + private PropertyValueMerger scalarPropertyValueMerger = ScalarPropertyValueMerger.getInstance(); + + @Resource + private ApplicationDataTypeCache dataTypeCache; + + private final Gson gson = new Gson(); + + /** + * + * @param oldProp the old property to merge value from + * @param newProp the new property to merge value into + * @param getInputNamesToMerge inputs names which their corresponding get_input values are allowed to be merged + */ + public void mergePropertyValue(PropertyDataDefinition oldProp, PropertyDataDefinition newProp, List<String> getInputNamesToMerge) { + Either<Map<String, DataTypeDefinition>, TitanOperationStatus> dataTypesEither = dataTypeCache.getAll(); + if (dataTypesEither.isRight()) { + LOGGER.debug("failed to fetch data types, skip merging of previous property values. status: {}", dataTypesEither.right().value()); + } + mergePropertyValue(oldProp, newProp, dataTypesEither.left().value(), getInputNamesToMerge); + mergeComplexPropertyGetInputsValues(oldProp, newProp); + } + + private void mergePropertyValue(PropertyDataDefinition oldProp, PropertyDataDefinition newProp, Map<String, DataTypeDefinition> dataTypes, List<String> getInputNamesToMerge) { + Object oldValAsObject = convertPropertyStrValueToObject(oldProp, dataTypes); + Object newValAsObject = convertPropertyStrValueToObject(newProp, dataTypes); + PropertyValueMerger propertyValueMerger = getPropertyValueMerger(newProp); + if(oldValAsObject != null){ + Object mergedValue = propertyValueMerger.mergeValues(oldValAsObject, newValAsObject, getInputNamesToMerge); + newProp.setValue(convertPropertyValueObjectToString(mergedValue)); + } + } + + private PropertyValueMerger getPropertyValueMerger(PropertyDataDefinition newProp) { + if (ToscaPropertyType.isPrimitiveType(newProp.getType()) || ToscaPropertyType.isPrimitiveType(newProp.getSchemaType())) { + return scalarPropertyValueMerger; + } + return complexPropertyValueMerger; + } + + private String convertPropertyValueObjectToString(Object mergedValue) { + if (isEmptyValue(mergedValue)) { + return null; + } + return mergedValue instanceof String? mergedValue.toString() : gson.toJson(mergedValue); + } + + private Object convertPropertyStrValueToObject(PropertyDataDefinition propertyDataDefinition, Map<String, DataTypeDefinition> dataTypes) { + String propValue = propertyDataDefinition.getValue() == null ? "": propertyDataDefinition.getValue(); + String propertyType = propertyDataDefinition.getType(); + String innerType = propertyDataDefinition.getSchemaType(); + return propertyConvertor.convertToToscaObject(propertyType, propValue, innerType, dataTypes); + } + + + @SuppressWarnings("unchecked") + private Object removeUnwantedGetInputValues(Object val, List<String> getInputNamesToMerge) { + if (val instanceof Map) { + return removeUnwantedGetInputValues((Map<String, Object>) val, getInputNamesToMerge); + } + if (val instanceof List) { + return removeUnwantedGetInputValues((List<Object>)val, getInputNamesToMerge); + } + return val; + } + + private List<Object> removeUnwantedGetInputValues(List<Object> listVal, List<String> getInputNamesToMerge) { + return listVal.stream().map(val -> removeUnwantedGetInputValues(val, getInputNamesToMerge)).collect(Collectors.toList()); + } + + private Map<String, Object> removeUnwantedGetInputValues(Map<String, Object> val, List<String> getInputNamesToMerge) { + return val.entrySet().stream().filter(entry -> !isGetInputEntry(entry) || isGetInputToMerge(getInputNamesToMerge, entry)) + .collect(Collectors.toMap(Map.Entry::getKey, entry -> removeUnwantedGetInputValues(entry.getValue(), getInputNamesToMerge))); + } + + private boolean isGetInputToMerge(List<String> getInputNamesToMerge, Map.Entry<String, Object> entry) { + return getInputNamesToMerge.contains(retrieveGetInputInputName(entry.getValue())); + } + + private String retrieveGetInputInputName(Object getInputValue) { + return getInputValue instanceof List ? (String)((List) getInputValue).get(0) : (String)getInputValue; + } + + private boolean isGetInputEntry(Map.Entry<String, Object> oldValEntry) { + return oldValEntry.getKey().equals(ImportUtils.ToscaTagNamesEnum.GET_INPUT.getElementName()); + } + + private boolean isEmptyValue(Object val) { + return val == null || + val instanceof Map && ((Map) val).isEmpty() || + val instanceof List && ((List) val).isEmpty(); + } + + private void mergeComplexPropertyGetInputsValues(PropertyDataDefinition oldProp, PropertyDataDefinition newProp) { + if (!oldProp.isGetInputProperty()) { + return; + } + List<GetInputValueDataDefinition> getInputsToMerge = findOldGetInputValuesToMerge(oldProp, newProp); + List<GetInputValueDataDefinition> newPropGetInputValues = Optional.ofNullable(newProp.getGetInputValues()).orElse(new ArrayList<>()); + newPropGetInputValues.addAll(getInputsToMerge); + newProp.setGetInputValues(newPropGetInputValues); + } + + private List<GetInputValueDataDefinition> findOldGetInputValuesToMerge(PropertyDataDefinition oldProp, PropertyDataDefinition newProp) { + List<GetInputValueDataDefinition> oldGetInputValues = oldProp.getGetInputValues(); + List<GetInputValueDataDefinition> newGetInputValues = Optional.ofNullable(newProp.getGetInputValues()).orElse(Collections.emptyList()); + List<String> newGetInputNames = newGetInputValues.stream().map(GetInputValueDataDefinition::getInputName).collect(Collectors.toList()); + return oldGetInputValues.stream() + .filter(getInput -> !newGetInputNames.contains(getInput.getInputName())) + .filter(getInput -> isValueContainsGetInput(getInput.getInputName(), newProp.getValue())) + .collect(Collectors.toList()); + } + + private boolean isValueContainsGetInput(String inputName, String value) { + String getInputEntry = "\"%s\":\"%s\""; + return value != null && value.contains(String.format(getInputEntry, ToscaFunctions.GET_INPUT.getFunctionName(), inputName)); + } + + + + + + + + + + +} @@ -0,0 +1,79 @@ +package org.openecomp.sdc.be.components.merge.property; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +import org.openecomp.sdc.be.dao.utils.MapUtil; +import org.openecomp.sdc.be.datatypes.elements.GetInputValueDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; +import org.openecomp.sdc.be.model.InputDefinition; + +public class PropertyInstanceMergeDataBuilder { + + private final static PropertyInstanceMergeDataBuilder INSTANCE = new PropertyInstanceMergeDataBuilder(); + + private PropertyInstanceMergeDataBuilder() { + } + + public static PropertyInstanceMergeDataBuilder getInstance() { + return INSTANCE; + } + + public <T extends PropertyDataDefinition> List<MergePropertyData> buildDataForMerging(List<T> oldProps, + List<InputDefinition> oldInputs, + List<T> newProps, + List<InputDefinition> newInputs) { + + Map<String, T> oldPropsByName = MapUtil.toMap(oldProps, T::getName); + Map<String, InputDefinition> oldInputsByName = MapUtil.toMap(oldInputs, InputDefinition::getName); + Map<String, T> newPropsByName = MapUtil.toMap(newProps, T::getName); + Map<String, InputDefinition> newInputsByName = MapUtil.toMap(newInputs, InputDefinition::getName); + return buildMergeData(oldPropsByName, oldInputsByName, newPropsByName, newInputsByName); + + } + + private <T extends PropertyDataDefinition> List<MergePropertyData> buildMergeData(Map<String, T> oldPropsByName, Map<String, InputDefinition> oldInputsByName, Map<String, T> newPropsByName, Map<String, InputDefinition> newInputsByName) { + List<MergePropertyData> mergeData = new ArrayList<>(); + newPropsByName.forEach((name, prop) -> { + if (oldPropsByName.containsKey(name)) { + mergeData.add(buildMergePropertyData(oldPropsByName.get(name), oldInputsByName, prop, newInputsByName)); + } + }); + return mergeData; + } + + private MergePropertyData buildMergePropertyData(PropertyDataDefinition oldProp, + Map<String, InputDefinition> oldInputsByName, + PropertyDataDefinition newProp, + Map<String, InputDefinition> newInputsByName) { + MergePropertyData mergePropertyData = new MergePropertyData(); + mergePropertyData.setOldProp(oldProp) + .setNewProp(newProp); + if (oldProp.isGetInputProperty()) { + setGetInputData(oldProp, oldInputsByName, newInputsByName, mergePropertyData); + + } + return mergePropertyData; + } + + private void setGetInputData(PropertyDataDefinition oldProp, Map<String, InputDefinition> oldInputsByName, Map<String, InputDefinition> newInputsByName, MergePropertyData mergePropertyData) { + List<String> oldDeclaredByUserInputNames = getOldDeclaredInputsByUser(oldProp.getGetInputValues(), oldInputsByName); + List<String> oldGetInputNamesWhichExistInNewVersion = getOldGetInputNamesWhichExistInNewVersion(oldProp.getGetInputValues(), newInputsByName); + mergePropertyData.addAddGetInputNamesToMerge(oldDeclaredByUserInputNames); + mergePropertyData.addAddGetInputNamesToMerge(oldGetInputNamesWhichExistInNewVersion); + } + + private List<String> getOldGetInputNamesWhichExistInNewVersion(List<GetInputValueDataDefinition> getInputValues, Map<String, InputDefinition> newInputsByName) { + return getInputValues.stream().map(GetInputValueDataDefinition::getInputName).filter(newInputsByName::containsKey).collect(Collectors.toList()); + } + + private List<String> getOldDeclaredInputsByUser(List<GetInputValueDataDefinition> getInputValues, Map<String, InputDefinition> oldInputsByName) { + return getInputValues.stream().map(GetInputValueDataDefinition::getInputName) + .map(oldInputsByName::get) + .filter(oldInput -> oldInput.getInstanceUniqueId() != null) + .map(PropertyDataDefinition::getName) + .collect(Collectors.toList()); + } +} @@ -0,0 +1,148 @@ +package org.openecomp.sdc.be.components.merge.property; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +import org.apache.commons.lang.StringUtils; +import org.openecomp.sdc.be.components.impl.ImportUtils; + +public abstract class PropertyValueMerger { + + abstract Object merge(Object oldVal, Object newVal, List<String> someStrings); + + @SuppressWarnings("unchecked") + /** + * merges property value oldVal into property value newVal recursively + * @param oldVal - cannot be {@code Null} + */ + protected Object mergeValues(Object oldVal, Object newVal, List<String> getInputNamesToMerge) { + if (isEmptyValue(newVal)) { + return removeUnwantedGetInputValues(oldVal, getInputNamesToMerge); + } + if (isMapTypeValues(oldVal, newVal)) { + return mergeMapValue((Map<String, Object>) oldVal, (Map<String, Object>) newVal, getInputNamesToMerge); + } + if (isListTypeValues(oldVal, newVal)) { + return mergeListValue((List<Object>) oldVal, (List<Object>) newVal, getInputNamesToMerge); + } + if (isSameTypeValues(oldVal, newVal)) { + return mergeScalarValue(oldVal, newVal); + } + return newVal; + + } + + private Map<String, Object> mergeMapValue(Map<String, Object> oldValMap, Map<String, Object> newValMap, List<String> getInputNamesToMerge) { + mergeEntriesExistInNewValue(oldValMap, newValMap, getInputNamesToMerge);//continue the recursion + setOldEntriesNotExistInNewValue(oldValMap, newValMap, getInputNamesToMerge); + return newValMap; + } + + private void mergeEntriesExistInNewValue(Map<String, Object> oldValMap, Map<String, Object> newValMap, List<String> getInputNamesToMerge) { + for (Map.Entry<String, Object> newValEntry : newValMap.entrySet()) { + Object oldVal = oldValMap.get(newValEntry.getKey()); + if (oldVal != null) { + newValMap.put(newValEntry.getKey(), merge(oldVal, newValEntry.getValue(), getInputNamesToMerge)); + } + } + } + + private void setOldEntriesNotExistInNewValue(Map<String, Object> oldVal, Map<String, Object> newVal, List<String> getInputNamesToMerge) { + for (Map.Entry<String, Object> oldValEntry : oldVal.entrySet()) { + if (!isGetInputEntry(oldValEntry) || isGetInputToMerge(getInputNamesToMerge, oldValEntry)) { + Object oldValObj = oldValEntry.getValue(); + newVal.computeIfAbsent(oldValEntry.getKey(), key -> removeUnwantedGetInputValues(oldValObj, getInputNamesToMerge)); + } + } + } + + private List<Object> mergeListValue(List<Object> oldVal, List<Object> newVal, List<String> getInputNamesToMerge) { + List<Object> mergedList = mergeLists(oldVal, newVal, getInputNamesToMerge); + copyRestOfBiggerList(oldVal, newVal, getInputNamesToMerge, mergedList); + return mergedList; + } + + private void copyRestOfBiggerList(List<Object> oldVal, List<Object> newVal, List<String> getInputNamesToMerge, List<Object> mergedList) { + if (oldVal.size() == newVal.size()) { + return; + } + int maxListSize = Math.max(oldVal.size(), newVal.size()); + List<Object> greaterList = newVal.size() == maxListSize ? newVal : oldVal; + for (int i = mergedList.size(); i < maxListSize; i ++) { + Object listVal = greaterList.get(i); + Object listValToMerge = greaterList == oldVal ? removeUnwantedGetInputValues(listVal, getInputNamesToMerge) : listVal; + mergedList.add(listValToMerge); + } + } + + private List<Object> mergeLists(List<Object> oldVal, List<Object> newVal, List<String> getInputNamesToMerge) { + int minListSize = Math.min(oldVal.size(), newVal.size()); + List<Object> mergedList = new ArrayList<>(); + for (int i = 0; i < minListSize; i++) { + Object mergedVal = merge(oldVal.get(i), newVal.get(i), getInputNamesToMerge); + mergedList.add(mergedVal); + } + return mergedList; + } + + Object mergeScalarValue(Object oldVal, Object newVal) { + return isEmptyValue(newVal) ? oldVal : newVal; + } + + @SuppressWarnings("unchecked") + Object removeUnwantedGetInputValues(Object val, List<String> getInputNamesToMerge) { + if (val instanceof Map) { + return removeUnwantedGetInputValues((Map<String, Object>) val, getInputNamesToMerge); + } + if (val instanceof List) { + return removeUnwantedGetInputValues((List<Object>)val, getInputNamesToMerge); + } + return val; + } + + private List<Object> removeUnwantedGetInputValues(List<Object> listVal, List<String> getInputNamesToMerge) { + return listVal.stream().map(val -> removeUnwantedGetInputValues(val, getInputNamesToMerge)).collect(Collectors.toList()); + } + + private Map<String, Object> removeUnwantedGetInputValues(Map<String, Object> val, List<String> getInputNamesToMerge) { + return val.entrySet().stream().filter(entry -> !isGetInputEntry(entry) || isGetInputToMerge(getInputNamesToMerge, entry)) + .collect(Collectors.toMap(Map.Entry::getKey, entry -> removeUnwantedGetInputValues(entry.getValue(), getInputNamesToMerge))); + } + + private boolean isGetInputToMerge(List<String> getInputNamesToMerge, Map.Entry<String, Object> entry) { + return getInputNamesToMerge.contains(retrieveGetInputInputName(entry.getValue())); + } + + private boolean isMapTypeValues(Object oldVal, Object newVal) { + return newVal instanceof Map && oldVal instanceof Map; + } + + private boolean isListTypeValues(Object oldVal, Object newVal) { + return newVal instanceof List && oldVal instanceof List; + } + + private boolean isSameTypeValues(Object oldVal, Object newVal) { + return oldVal.getClass().equals(newVal.getClass()); + } + + private String retrieveGetInputInputName(Object getInputValue) { + return getInputValue instanceof List ? (String)((List) getInputValue).get(0) : (String)getInputValue; + } + + private boolean isGetInputEntry(Map.Entry<String, Object> oldValEntry) { + return oldValEntry.getKey().equals(ImportUtils.ToscaTagNamesEnum.GET_INPUT.getElementName()); + } + + private boolean isEmptyValue(Object val) { + return val == null || + val instanceof String && StringUtils.isEmpty((String)val) || + val instanceof Map && ((Map) val).isEmpty() || + val instanceof List && ((List) val).isEmpty(); + + + } + + +} @@ -0,0 +1,20 @@ +package org.openecomp.sdc.be.components.merge.property; + +import java.util.List; + +import org.springframework.stereotype.Component; + +@Component("scalar-prop-value-merger") +public class ScalarPropertyValueMerger extends PropertyValueMerger { + + private final static ScalarPropertyValueMerger INSTANCE = new ScalarPropertyValueMerger(); + + public static PropertyValueMerger getInstance() { + return INSTANCE; + } + + @Override + Object merge(Object oldVal, Object newVal, List<String> getInputNamesToMerge) { + return mergeScalarValue(removeUnwantedGetInputValues(oldVal, getInputNamesToMerge), newVal); + } +} @@ -0,0 +1,33 @@ +package org.openecomp.sdc.be.components.merge.resource; + + +import org.openecomp.sdc.be.components.merge.GlobalTypesMergeBusinessLogic; +import org.openecomp.sdc.be.components.merge.TopologyComparator; +import org.openecomp.sdc.be.dao.api.ActionStatus; +import org.openecomp.sdc.be.model.Resource; +import org.springframework.stereotype.Component; + +import fj.data.Either; + +@Component +public class MergeResourceBLFactory { + + @javax.annotation.Resource + private ResourceDataMergeBusinessLogic resourceDataMergeBusinessLogic; + + @javax.annotation.Resource + private GlobalTypesMergeBusinessLogic globalTypesMergeBusinessLogic; + + @javax.annotation.Resource + private TopologyComparator topologyComparator; + + public Either<MergeResourceBusinessLogic, ActionStatus> getInstance(Resource oldResource, Resource newResource) { + Either<Boolean, ActionStatus> isTopologyChangeEither = topologyComparator.isTopologyChanged(oldResource, newResource); + return isTopologyChangeEither.bimap(this::getInstance, actionStatus -> actionStatus); + } + + private MergeResourceBusinessLogic getInstance(boolean topologyChanged) { + return topologyChanged ? globalTypesMergeBusinessLogic : resourceDataMergeBusinessLogic; + } + +} @@ -0,0 +1,10 @@ +package org.openecomp.sdc.be.components.merge.resource; + +import org.openecomp.sdc.be.dao.api.ActionStatus; +import org.openecomp.sdc.be.model.Resource; + +public interface MergeResourceBusinessLogic { + + ActionStatus mergeResourceEntities(Resource oldResource, Resource newResource); + +} @@ -0,0 +1,62 @@ +package org.openecomp.sdc.be.components.merge.resource; + +import java.util.ArrayList; +import java.util.List; + +import org.openecomp.sdc.be.components.merge.input.ComponentInputsMergeBL; +import org.openecomp.sdc.be.components.merge.property.ComponentInstanceInputsMergeBL; +import org.openecomp.sdc.be.components.merge.property.ComponentInstancePropertiesMergeBL; +import org.openecomp.sdc.be.dao.api.ActionStatus; +import org.openecomp.sdc.be.model.InputDefinition; +import org.openecomp.sdc.be.model.Resource; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; + +@Component +public class ResourceDataMergeBusinessLogic implements MergeResourceBusinessLogic { + + private final static Logger log = LoggerFactory.getLogger(ResourceDataMergeBusinessLogic.class.getName()); + + @javax.annotation.Resource + private ComponentInputsMergeBL inputsValuesMergeBL; + + @javax.annotation.Resource + private ComponentInstancePropertiesMergeBL instancePropertiesValueMergeBL; + + @javax.annotation.Resource + private ComponentInstanceInputsMergeBL instanceInputsValueMergeBL; + + @Override + public ActionStatus mergeResourceEntities(Resource oldResource, Resource newResource) { + if (oldResource == null) { + return ActionStatus.OK; + } + + ActionStatus mergeInstInputsStatus = instancePropertiesValueMergeBL.mergeComponentInstancesProperties(oldResource, newResource); + if (mergeInstInputsStatus != ActionStatus.OK) { + log.error("failed to merge instance properties of resource {} status is {}", newResource.getUniqueId(), mergeInstInputsStatus); + return mergeInstInputsStatus; + } + + ActionStatus mergeInstPropsStatus = instanceInputsValueMergeBL.mergeComponentInstancesInputs(oldResource, newResource); + if (mergeInstPropsStatus != ActionStatus.OK) { + log.error("failed to merge instance inputs of resource {} status is {}", newResource.getUniqueId(), mergeInstPropsStatus); + return mergeInstPropsStatus; + } + + ActionStatus mergeInputsStatus = mergeInputs(oldResource, newResource); + if (mergeInputsStatus != ActionStatus.OK) { + log.error("failed to merge inputs of resource {} status is {}", newResource.getUniqueId(), mergeInputsStatus); + return mergeInputsStatus; + } + return ActionStatus.OK; + } + + private ActionStatus mergeInputs(Resource oldResource, Resource newResource) { + List<InputDefinition> inputsToMerge = newResource.getInputs() != null ? newResource.getInputs() : new ArrayList<>(); + return inputsValuesMergeBL.mergeAndRedeclareComponentInputs(oldResource, newResource, inputsToMerge); + } + + +} @@ -20,12 +20,12 @@ package org.openecomp.sdc.be.components.validation; -import org.openecomp.sdc.be.model.Component; -import org.openecomp.sdc.be.model.ComponentInstance; - import java.util.Optional; import java.util.stream.Collectors; +import org.openecomp.sdc.be.model.Component; +import org.openecomp.sdc.be.model.ComponentInstance; + public class ComponentValidations { public static boolean validateComponentInstanceExist(Component component, String instanceId) { @@ -0,0 +1,16 @@ +package org.openecomp.sdc.be.exception; + +import org.openecomp.sdc.be.dao.api.ActionStatus; + +public class SdcActionException extends RuntimeException { + + private ActionStatus actionStatus; + + public SdcActionException(ActionStatus actionStatus) { + this.actionStatus = actionStatus; + } + + public ActionStatus getActionStatus() { + return actionStatus; + } +} @@ -57,6 +57,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.jcabi.aspects.Loggable; + +import fj.data.Either; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; @@ -65,8 +67,6 @@ import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; -import fj.data.Either; - /** * This Servlet serves external users operations on artifacts. * @@ -21,8 +21,11 @@ package org.openecomp.sdc.be.impl; import java.lang.reflect.Type; -import java.security.cert.CollectionCertStoreParameters; -import java.util.*; +import java.util.ArrayList; +import java.util.Collection; +import java.util.EnumMap; +import java.util.List; +import java.util.Map; import java.util.regex.Pattern; import javax.annotation.PostConstruct; @@ -39,20 +42,28 @@ import org.openecomp.sdc.be.components.impl.ResponseFormatManager; import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.dao.graph.datatype.AdditionalInformationEnum; -import org.openecomp.sdc.be.dao.utils.CollectionUtils; import org.openecomp.sdc.be.datatypes.elements.AdditionalInfoParameterInfo; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; -import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; -import org.openecomp.sdc.be.model.*; +import org.openecomp.sdc.be.model.ArtifactDefinition; +import org.openecomp.sdc.be.model.CapabilityTypeDefinition; +import org.openecomp.sdc.be.model.Component; +import org.openecomp.sdc.be.model.ConsumerDefinition; +import org.openecomp.sdc.be.model.DataTypeDefinition; +import org.openecomp.sdc.be.model.GroupTypeDefinition; +import org.openecomp.sdc.be.model.PolicyTypeDefinition; +import org.openecomp.sdc.be.model.PropertyConstraint; +import org.openecomp.sdc.be.model.RequirementDefinition; +import org.openecomp.sdc.be.model.Resource; +import org.openecomp.sdc.be.model.Service; +import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.PropertyOperation.PropertyConstraintDeserialiser; import org.openecomp.sdc.be.model.operations.impl.PropertyOperation.PropertyConstraintJacksonDeserialiser; import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; import org.openecomp.sdc.be.tosca.ToscaError; import org.openecomp.sdc.common.api.Constants; -import org.openecomp.sdc.common.config.EcompErrorName; import org.openecomp.sdc.common.datastructure.AuditingFieldsKeysEnum; import org.openecomp.sdc.common.util.ThreadLocalsHolder; import org.openecomp.sdc.common.util.ValidationUtils; @@ -91,7 +102,6 @@ public class ComponentsUtils { public <T> Either<T, ResponseFormat> convertJsonToObject(String data, User user, Class<T> clazz, AuditingActionEnum actionEnum) { if (data == null) { - BeEcompErrorManager.getInstance().processEcompError(EcompErrorName.BeInvalidJsonInput, "convertJsonToObject"); BeEcompErrorManager.getInstance().logBeInvalidJsonInput("convertJsonToObject"); log.debug("object is null after converting from json"); ResponseFormat responseFormat = getInvalidContentErrorAndAudit(user, actionEnum); @@ -102,7 +112,6 @@ public class ComponentsUtils { return Either.left(obj); } catch (Exception e) { // INVALID JSON - BeEcompErrorManager.getInstance().processEcompError(EcompErrorName.BeInvalidJsonInput, "convertJsonToObject"); BeEcompErrorManager.getInstance().logBeInvalidJsonInput("convertJsonToObject"); log.debug("failed to convert from json {}", data, e); ResponseFormat responseFormat = getInvalidContentErrorAndAudit(user, actionEnum); @@ -134,14 +143,12 @@ public class ComponentsUtils { component = mapper.readValue(data, clazz); if (component == null) { - BeEcompErrorManager.getInstance().processEcompError(EcompErrorName.BeInvalidJsonInput, "convertJsonToObject"); BeEcompErrorManager.getInstance().logBeInvalidJsonInput("convertJsonToObject"); log.debug("object is null after converting from json"); ResponseFormat responseFormat = getInvalidContentErrorAndAuditComponent(user, actionEnum, typeEnum); return Either.right(responseFormat); } } catch (Exception e) { - BeEcompErrorManager.getInstance().processEcompError(EcompErrorName.BeInvalidJsonInput, "convertJsonToObject"); BeEcompErrorManager.getInstance().logBeInvalidJsonInput("convertJsonToObject"); log.debug("failed to convert from json {}", data, e); ResponseFormat responseFormat = getInvalidContentErrorAndAuditComponent(user, actionEnum, typeEnum); @@ -160,6 +167,10 @@ public class ComponentsUtils { return responseFormatManager.getResponseFormat(actionStatus, params); } + public ResponseFormat getResponseFormat(StorageOperationStatus storageStatus, String... params) { + return responseFormatManager.getResponseFormat(this.convertFromStorageResponse(storageStatus), params); + } + /** * Returns the response format of resource error with respective variables according to actionStatus. This is needed for cases where actionStatus is anonymously converted from storage operation, and the caller doesn't know what actionStatus he * received. It's caller's Responsibility to fill the resource object passed to this function with needed fields. @@ -238,8 +249,8 @@ public class ComponentsUtils { switch (actionStatus) { case MISSING_CAPABILITY_TYPE: - if (obj instanceof List && org.apache.commons.collections.CollectionUtils.isNotEmpty((List) obj)){ - List list = (List)obj; + if (obj instanceof List && org.apache.commons.collections.CollectionUtils.isNotEmpty((List<?>) obj)){ + List<?> list = (List<?>)obj; if ( list.get(0) instanceof RequirementDefinition ) { responseFormat = getResponseFormat(ActionStatus.MISSING_CAPABILITY_TYPE, ((RequirementDefinition) list.get(0)).getName()); //Arbitray index, all we need is single object return responseFormat; @@ -43,7 +43,6 @@ import org.openecomp.sdc.be.info.ServletJsonResponse; import org.openecomp.sdc.be.resources.data.ESArtifactData; import org.openecomp.sdc.common.api.Constants; import org.openecomp.sdc.common.config.EcompErrorName; -import org.openecomp.sdc.common.util.GeneralUtility; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -21,7 +21,6 @@ package org.openecomp.sdc.be.info; import org.openecomp.sdc.be.model.ArtifactDefinition; -import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum; public class ArtifactDefinitionInfo { @@ -27,8 +27,8 @@ import java.util.Map; import java.util.Set; import org.openecomp.sdc.be.config.BeEcompErrorManager; -import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.config.Configuration.ArtifactTypeConfig; +import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; import org.openecomp.sdc.be.impl.ComponentsUtils; @@ -177,13 +177,17 @@ public class ArtifactTemplateInfo { String correctType = type; if (type.equalsIgnoreCase(CSAR_NESTED)) correctType = ArtifactTypeEnum.HEAT_NESTED.getType(); - else if ((type.equalsIgnoreCase(CSAR_VOLUME))) + else if (type.equalsIgnoreCase(CSAR_VOLUME)) correctType = ArtifactTypeEnum.HEAT_VOL.getType(); - else if ((type.equalsIgnoreCase(CSAR_NETWORK))) + else if (type.equalsIgnoreCase(CSAR_NETWORK)) correctType = ArtifactTypeEnum.HEAT_NET.getType(); - else if ((type.equalsIgnoreCase(CSAR_ARTIFACT))) - correctType = ArtifactTypeEnum.HEAT_ARTIFACT.getType(); - else if ((type.equalsIgnoreCase(CSAR_HEAT))) + else if (type.equalsIgnoreCase(CSAR_ARTIFACT)){ + if( parentArtifact != null) + correctType = ArtifactTypeEnum.HEAT_ARTIFACT.getType(); + else + correctType = resourceInfo.type; + } + else if (type.equalsIgnoreCase(CSAR_HEAT)) correctType = ArtifactTypeEnum.HEAT.getType(); else correctType = ArtifactTypeEnum.OTHER.getType(); @@ -21,6 +21,7 @@ package org.openecomp.sdc.be.info; import java.util.List; + import org.openecomp.sdc.be.model.GroupDefinition; import org.openecomp.sdc.be.model.GroupInstance; import org.openecomp.sdc.be.model.GroupProperty; @@ -23,14 +23,12 @@ package org.openecomp.sdc.be.info; import java.util.ArrayList; import java.util.HashSet; import java.util.List; -import java.util.Map; +import java.util.Optional; import java.util.Set; import org.apache.commons.lang3.tuple.ImmutablePair; import org.openecomp.sdc.be.model.ArtifactDefinition; -import java.util.Optional; - public class MergedArtifactInfo { private List<ArtifactDefinition> createdArtifact; @@ -20,6 +20,15 @@ package org.openecomp.sdc.be.listen; +import java.io.IOException; +import java.io.InputStream; +import java.util.jar.Attributes; +import java.util.jar.Manifest; + +import javax.servlet.ServletContext; +import javax.servlet.ServletContextEvent; +import javax.servlet.ServletContextListener; + import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.impl.DownloadArtifactLogic; import org.openecomp.sdc.be.impl.WebAppContextWrapper; @@ -29,15 +38,6 @@ import org.openecomp.sdc.common.impl.ExternalConfiguration; import org.openecomp.sdc.common.listener.AppContextListener; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.web.context.WebApplicationContext; - -import javax.servlet.ServletContext; -import javax.servlet.ServletContextEvent; -import javax.servlet.ServletContextListener; -import java.io.IOException; -import java.io.InputStream; -import java.util.jar.Attributes; -import java.util.jar.Manifest; public class BEAppContextListener extends AppContextListener implements ServletContextListener { @@ -51,14 +51,14 @@ import org.slf4j.LoggerFactory; import org.springframework.web.context.WebApplicationContext; import com.jcabi.aspects.Loggable; + +import fj.data.Either; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; -import fj.data.Either; - @Loggable(prepend = true, value = Loggable.DEBUG, trim = false) @Path("/v1/catalog") @Api(value = "Additional Information Servlet", description = "Additional Information Servlet") @@ -53,14 +53,14 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.jcabi.aspects.Loggable; + +import fj.data.Either; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; -import fj.data.Either; - /** * Root resource (exposed at "/" path) */ @@ -49,14 +49,14 @@ import org.slf4j.LoggerFactory; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.jcabi.aspects.Loggable; + +import fj.data.Either; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; -import fj.data.Either; - /** * Web Servlet for actions on Attributes * @@ -20,7 +20,6 @@ package org.openecomp.sdc.be.servlets; -import java.util.EnumMap; import java.util.Map; import java.util.Map.Entry; import java.util.function.Supplier; @@ -57,7 +56,6 @@ import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; import org.openecomp.sdc.be.user.UserBusinessLogic; import org.openecomp.sdc.common.api.Constants; import org.openecomp.sdc.common.config.EcompErrorName; -import org.openecomp.sdc.common.datastructure.AuditingFieldsKeysEnum; import org.openecomp.sdc.common.servlets.BasicServlet; import org.openecomp.sdc.exception.ResponseFormat; import org.slf4j.Logger; @@ -34,6 +34,7 @@ import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; +import org.apache.commons.lang3.tuple.Pair; import org.openecomp.sdc.be.components.impl.HealthCheckBusinessLogic; import org.openecomp.sdc.be.components.impl.MonitoringBusinessLogic; import org.openecomp.sdc.be.config.BeEcompErrorManager; @@ -41,8 +42,6 @@ import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.impl.WebAppContextWrapper; import org.openecomp.sdc.common.api.Constants; import org.openecomp.sdc.common.api.HealthCheckInfo; -import org.openecomp.sdc.common.api.HealthCheckInfo.HealthCheckComponent; -import org.openecomp.sdc.common.api.HealthCheckInfo.HealthCheckStatus; import org.openecomp.sdc.common.api.HealthCheckWrapper; import org.openecomp.sdc.common.config.EcompErrorName; import org.openecomp.sdc.common.monitoring.MonitoringEvent; @@ -54,13 +53,13 @@ import org.springframework.web.context.WebApplicationContext; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.jcabi.aspects.Loggable; + +import fj.data.Either; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; -import fj.data.Either; - @Loggable(prepend = true, value = Loggable.TRACE, trim = false) @Path("/") @Api(value = "BE Monitoring", description = "BE Monitoring") @@ -75,22 +74,20 @@ public class BeMonitoringServlet extends BeGenericServlet { @Path("/healthCheck") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "return aggregate BE health check of Titan, ES and BE", notes = "return BE health check", response = String.class) - @ApiResponses(value = { @ApiResponse(code = 200, message = "Titan, ES and BE are all up"), @ApiResponse(code = 500, message = "One or more BE components (Titan, ES, BE) are down") }) + @ApiOperation(value = "Return aggregate BE health check of SDC BE components", notes = "return BE health check", response = String.class) + @ApiResponses(value = { @ApiResponse(code = 200, message = "SDC BE components are all up"), @ApiResponse(code = 500, message = "One or more SDC BE components are down") }) public Response getHealthCheck(@Context final HttpServletRequest request) { try { HealthCheckBusinessLogic healthCheckBusinessLogic = getHealthCheckBL(request.getSession().getServletContext()); - List<HealthCheckInfo> beHealthCheckInfos = healthCheckBusinessLogic.getBeHealthCheckInfosStatus(); - - // List<HealthCheckInfo> beHealthCheckInfos = - // HealthCheckBusinessLogic.getInstance().getBeHealthCheckInfos(request.getSession().getServletContext()); - ActionStatus status = getAggregateBeStatus(beHealthCheckInfos); + Pair<Boolean, List<HealthCheckInfo>> beHealthCheckInfosStatus = healthCheckBusinessLogic.getBeHealthCheckInfosStatus(); + Boolean aggregateStatus = beHealthCheckInfosStatus.getLeft(); + ActionStatus status = aggregateStatus ? ActionStatus.OK : ActionStatus.GENERAL_ERROR; String sdcVersion = getVersionFromContext(request); if (sdcVersion == null || sdcVersion.isEmpty()) { sdcVersion = "UNKNOWN"; } String siteMode = healthCheckBusinessLogic.getSiteMode(); - HealthCheckWrapper healthCheck = new HealthCheckWrapper(beHealthCheckInfos, sdcVersion, siteMode); + HealthCheckWrapper healthCheck = new HealthCheckWrapper(beHealthCheckInfosStatus.getRight(), sdcVersion, siteMode); // The response can be either with 200 or 500 aggregate status - the // body of individual statuses is returned either way @@ -168,17 +165,6 @@ public class BeMonitoringServlet extends BeGenericServlet { return version; } - private ActionStatus getAggregateBeStatus(List<HealthCheckInfo> beHealthCheckInfos) { - ActionStatus status = ActionStatus.OK; - for (HealthCheckInfo healthCheckInfo : beHealthCheckInfos) { - if (healthCheckInfo.getHealthCheckStatus().equals(HealthCheckStatus.DOWN) && healthCheckInfo.getHealthCheckComponent() != HealthCheckComponent.DE) { - status = ActionStatus.GENERAL_ERROR; - break; - } - } - return status; - } - protected MonitoringEvent convertContentToJson(String content, Class<MonitoringEvent> clazz) { MonitoringEvent object = null; @@ -22,6 +22,7 @@ package org.openecomp.sdc.be.servlets; import java.io.InputStream; import java.lang.reflect.Type; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -42,6 +43,7 @@ import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import org.apache.commons.io.IOUtils; +import org.apache.commons.lang.StringUtils; import org.codehaus.jackson.map.ObjectMapper; import org.openecomp.sdc.be.components.impl.ComponentInstanceBusinessLogic; import org.openecomp.sdc.be.components.impl.GroupBusinessLogic; @@ -78,12 +80,11 @@ import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; /** - * Root resource (exposed at "/" path) - * .json + * Root resource (exposed at "/" path) .json */ @Loggable(prepend = true, value = Loggable.DEBUG, trim = false) @Path("/v1/catalog") -@Api(value = "Resource Instance Servlet", description = "Resource Instance Servlet") +@Api(value = "Resource Instance Servlet") @Singleton public class ComponentInstanceServlet extends AbstractValidationsServlet { @@ -227,9 +228,6 @@ public class ComponentInstanceServlet extends AbstractValidationsServlet { if (convertResponse.isRight()) { // Using both ECOMP error methods, show to Sofer BeEcompErrorManager.getInstance().logBeSystemError("Resource Instance - updateResourceInstance"); - /* - * BeEcompErrorManager.getInstance().processEcompError( EcompErrorName.BeSystemError, "Resource Instance - updateResourceInstance"); - */ log.debug("Failed to convert received data to BE format."); return buildErrorResponse(convertResponse.right().value()); } @@ -358,8 +356,8 @@ public class ComponentInstanceServlet extends AbstractValidationsServlet { public Response dissociateRIFromRI( @ApiParam(value = "allowed values are resources /services / products", allowableValues = ComponentTypeEnum.RESOURCE_PARAM_NAME + "," + ComponentTypeEnum.SERVICE_PARAM_NAME + "," + ComponentTypeEnum.PRODUCT_PARAM_NAME, required = true) @PathParam("containerComponentType") final String containerComponentType, - @ApiParam(value = "unique id of the container component") @PathParam("componentId") final String componentId, @HeaderParam(value = Constants.USER_ID_HEADER) String userId, @ApiParam(value = "RelationshipInfo", required = true) String data, - @Context final HttpServletRequest request) { + @ApiParam(value = "unique id of the container component") @PathParam("componentId") final String componentId, @HeaderParam(value = Constants.USER_ID_HEADER) String userId, + @ApiParam(value = "RelationshipInfo", required = true) String data, @Context final HttpServletRequest request) { ServletContext context = request.getSession().getServletContext(); String url = request.getMethod() + " " + request.getRequestURI(); @@ -517,7 +515,7 @@ public class ComponentInstanceServlet extends AbstractValidationsServlet { } } - + @POST @Path("/{containerComponentType}/{componentId}/resourceInstance/{componentInstanceId}/input") @Consumes(MediaType.APPLICATION_JSON) @@ -535,8 +533,7 @@ public class ComponentInstanceServlet extends AbstractValidationsServlet { try { Wrapper<String> dataWrapper = new Wrapper<>(); Wrapper<ResponseFormat> errorWrapper = new Wrapper<>(); - Wrapper<ComponentInstanceInput> propertyWrapper = new Wrapper<>(); - + validateInputStream(request, dataWrapper, errorWrapper); ComponentInstanceInput property = null; @@ -544,21 +541,22 @@ public class ComponentInstanceServlet extends AbstractValidationsServlet { User modifier = new User(); modifier.setUserId(userId); log.debug("modifier id is {}", userId); - - Either<ComponentInstanceInput, ResponseFormat> inputEither = getComponentsUtils().convertJsonToObjectUsingObjectMapper(dataWrapper.getInnerElement(), modifier, ComponentInstanceInput.class, AuditingActionEnum.UPDATE_RESOURCE_METADATA, ComponentTypeEnum.SERVICE);; - if(inputEither.isRight()){ + + Either<ComponentInstanceInput, ResponseFormat> inputEither = getComponentsUtils().convertJsonToObjectUsingObjectMapper(dataWrapper.getInnerElement(), modifier, ComponentInstanceInput.class, AuditingActionEnum.UPDATE_RESOURCE_METADATA, + ComponentTypeEnum.SERVICE); + ; + if (inputEither.isRight()) { log.debug("Failed to convert data to input definition. Status is {}", inputEither.right().value()); return buildErrorResponse(getComponentsUtils().getResponseFormat(ActionStatus.INVALID_CONTENT)); } property = inputEither.left().value(); - + } if (property == null) { return buildErrorResponse(getComponentsUtils().getResponseFormat(ActionStatus.INVALID_CONTENT)); } - log.debug("Start handle request of updateResourceInstanceProperty. Received property is {}", property); ServletContext context = request.getSession().getServletContext(); @@ -743,7 +741,7 @@ public class ComponentInstanceServlet extends AbstractValidationsServlet { } } - + @POST @Path("/{containerComponentType}/{componentId}/resourceInstance/{componentInstanceId}/groupInstance/{groupInstanceId}/property") @Consumes(MediaType.APPLICATION_JSON) @@ -752,8 +750,8 @@ public class ComponentInstanceServlet extends AbstractValidationsServlet { @ApiResponses(value = { @ApiResponse(code = 201, message = "Resource instance created"), @ApiResponse(code = 403, message = "Restricted operation"), @ApiResponse(code = 400, message = "Invalid content / Missing content") }) public Response updateGroupInstanceProperty(@ApiParam(value = "service id") @PathParam("componentId") final String componentId, @ApiParam(value = "valid values: resources / services", allowableValues = ComponentTypeEnum.RESOURCE_PARAM_NAME + "," + ComponentTypeEnum.SERVICE_PARAM_NAME) @PathParam("containerComponentType") final String containerComponentType, - @ApiParam(value = "resource instance id") @PathParam("componentInstanceId") final String componentInstanceId, @ApiParam(value = "group instance id") @PathParam("groupInstanceId") final String groupInstanceId, @ApiParam(value = "id of user initiating the operation") @HeaderParam(value = Constants.USER_ID_HEADER) String userId, - @Context final HttpServletRequest request) { + @ApiParam(value = "resource instance id") @PathParam("componentInstanceId") final String componentInstanceId, @ApiParam(value = "group instance id") @PathParam("groupInstanceId") final String groupInstanceId, + @ApiParam(value = "id of user initiating the operation") @HeaderParam(value = Constants.USER_ID_HEADER) String userId, @Context final HttpServletRequest request) { String url = request.getMethod() + " " + request.getRequestURI(); log.debug("Start handle request of {}", url); @@ -803,15 +801,15 @@ public class ComponentInstanceServlet extends AbstractValidationsServlet { } } - + @GET @Path("/{containerComponentType}/{componentId}/resourceInstance/{componentInstanceId}/groupInstance/{groupInstId}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @ApiOperation(value = "Get group artifacts ", httpMethod = "GET", notes = "Returns artifacts metadata according to groupInstId", response = Resource.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "group found"), @ApiResponse(code = 403, message = "Restricted operation"), @ApiResponse(code = 404, message = "Group not found") }) - public Response getGroupArtifactById(@PathParam("containerComponentType") final String containerComponentType, @PathParam("componentId") final String componentId, @PathParam("componentInstanceId") final String componentInstanceId, @PathParam("groupInstId") final String groupInstId, - @Context final HttpServletRequest request, @HeaderParam(value = Constants.USER_ID_HEADER) String userId) { + public Response getGroupArtifactById(@PathParam("containerComponentType") final String containerComponentType, @PathParam("componentId") final String componentId, @PathParam("componentInstanceId") final String componentInstanceId, + @PathParam("groupInstId") final String groupInstId, @Context final HttpServletRequest request, @HeaderParam(value = Constants.USER_ID_HEADER) String userId) { ServletContext context = request.getSession().getServletContext(); String url = request.getMethod() + " " + request.getRequestURI(); log.debug("(GET) Start handle request of {}", url); @@ -836,22 +834,17 @@ public class ComponentInstanceServlet extends AbstractValidationsServlet { } } - - //US831698 + + // US831698 @GET @Path("/{containerComponentType}/{containerComponentId}/componentInstances/{componentInstanceUniqueId}/properties") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Get component instance properties", httpMethod = "GET", - notes = "Returns component instance properties", response = Response.class) - @ApiResponses(value = { @ApiResponse(code = 200, message = "Properties found"), - @ApiResponse(code = 403, message = "Restricted operation"), - @ApiResponse(code = 404, message = "Component/Component Instance - not found") }) - public Response getInstancePropertiesById(@PathParam("containerComponentType") final String containerComponentType, - @PathParam("containerComponentId") final String containerComponentId, - @PathParam("componentInstanceUniqueId") final String componentInstanceUniqueId, - @Context final HttpServletRequest request, @HeaderParam(value = Constants.USER_ID_HEADER) String userId) { - + @ApiOperation(value = "Get component instance properties", httpMethod = "GET", notes = "Returns component instance properties", response = Response.class) + @ApiResponses(value = { @ApiResponse(code = 200, message = "Properties found"), @ApiResponse(code = 403, message = "Restricted operation"), @ApiResponse(code = 404, message = "Component/Component Instance - not found") }) + public Response getInstancePropertiesById(@PathParam("containerComponentType") final String containerComponentType, @PathParam("containerComponentId") final String containerComponentId, + @PathParam("componentInstanceUniqueId") final String componentInstanceUniqueId, @Context final HttpServletRequest request, @HeaderParam(value = Constants.USER_ID_HEADER) String userId) { + ServletContext context = request.getSession().getServletContext(); String url = request.getMethod() + " " + request.getRequestURI(); log.debug("(GET) Start handle request of {}", url); @@ -859,19 +852,15 @@ public class ComponentInstanceServlet extends AbstractValidationsServlet { try { ComponentTypeEnum componentTypeEnum = ComponentTypeEnum.findByParamName(containerComponentType); ComponentInstanceBusinessLogic componentInstanceBL = getComponentInstanceBL(context, componentTypeEnum); - - Either<List<ComponentInstanceProperty>, ResponseFormat> componentInstancePropertiesById = componentInstanceBL - .getComponentInstancePropertiesById(containerComponentType, containerComponentId, - componentInstanceUniqueId, userId); + + Either<List<ComponentInstanceProperty>, ResponseFormat> componentInstancePropertiesById = componentInstanceBL.getComponentInstancePropertiesById(containerComponentType, containerComponentId, componentInstanceUniqueId, userId); if (componentInstancePropertiesById.isRight()) { - log.debug("Failed to get properties of component instance ID: {} in {} with ID: {}", - componentInstanceUniqueId, containerComponentType, containerComponentId); + log.debug("Failed to get properties of component instance ID: {} in {} with ID: {}", componentInstanceUniqueId, containerComponentType, containerComponentId); return buildErrorResponse(componentInstancePropertiesById.right().value()); } - return buildOkResponse(getComponentsUtils(). - getResponseFormat(ActionStatus.OK), componentInstancePropertiesById.left().value()); + return buildOkResponse(getComponentsUtils().getResponseFormat(ActionStatus.OK), componentInstancePropertiesById.left().value()); } catch (Exception e) { BeEcompErrorManager.getInstance().logBeRestApiGeneralError("getGroupArtifactById"); log.debug("getGroupArtifactById unexpected exception", e); @@ -879,7 +868,102 @@ public class ComponentInstanceServlet extends AbstractValidationsServlet { } } - + + // US330353 + @GET + @Path("/{containerComponentType}/{containerComponentId}/componentInstances/{componentInstanceUniqueId}/capability/{capabilityType}/capabilityName/{capabilityName}/properties") + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + @ApiOperation(value = "Get component instance capability properties", httpMethod = "GET", notes = "Returns component instance capability properties", response = Response.class) + @ApiResponses(value = { @ApiResponse(code = 200, message = "Properties found"), @ApiResponse(code = 403, message = "Restricted operation"), @ApiResponse(code = 404, message = "Component/Component Instance/Capability - not found") }) + public Response getInstanceCapabilityPropertiesById(@PathParam("containerComponentType") final String containerComponentType, @PathParam("containerComponentId") final String containerComponentId, + @PathParam("componentInstanceUniqueId") final String componentInstanceUniqueId, @PathParam("capabilityType") final String capabilityType, @PathParam("capabilityName") final String capabilityName, @Context final HttpServletRequest request, + @HeaderParam(value = Constants.USER_ID_HEADER) String userId) { + + ServletContext context = request.getSession().getServletContext(); + String url = request.getMethod() + " " + request.getRequestURI(); + log.debug("(GET) Start handle request of {}", url); + + try { + ComponentTypeEnum componentTypeEnum = ComponentTypeEnum.findByParamName(containerComponentType); + ComponentInstanceBusinessLogic componentInstanceBL = getComponentInstanceBL(context, componentTypeEnum); + + Either<List<ComponentInstanceProperty>, ResponseFormat> componentInstancePropertiesById = componentInstanceBL.getComponentInstanceCapabilityPropertiesById(containerComponentType, containerComponentId, componentInstanceUniqueId, + capabilityType, capabilityName, userId); + + if (componentInstancePropertiesById.isRight()) { + log.debug("Failed to get properties of component instance ID: {} in {} with ID: {}", componentInstanceUniqueId, containerComponentType, containerComponentId); + return buildErrorResponse(componentInstancePropertiesById.right().value()); + } + + return buildOkResponse(getComponentsUtils().getResponseFormat(ActionStatus.OK), componentInstancePropertiesById.left().value()); + } catch (Exception e) { + BeEcompErrorManager.getInstance().logBeRestApiGeneralError("getGroupArtifactById"); + log.debug("getGroupArtifactById unexpected exception", e); + return buildErrorResponse(getComponentsUtils().getResponseFormat(ActionStatus.GENERAL_ERROR)); + } + + } + + private Either<List<ComponentInstanceProperty>, ResponseFormat> convertMultipleProperties(String dataList) { + if (StringUtils.isEmpty(dataList)) { + return Either.right(getComponentsUtils().getResponseFormat(ActionStatus.INVALID_CONTENT)); + } + Either<ComponentInstanceProperty[], ResponseFormat> convertStatus = getComponentsUtils().convertJsonToObjectUsingObjectMapper(dataList, new User(), ComponentInstanceProperty[].class, null, ComponentTypeEnum.RESOURCE_INSTANCE); + if (convertStatus.isRight()) { + return Either.right(convertStatus.right().value()); + } + return Either.left(Arrays.asList(convertStatus.left().value())); + } + + //US 331281 + @PUT + @Path("/{containerComponentType}/{containerComponentId}/componentInstances/{componentInstanceUniqueId}/capability/{capabilityType}/capabilityName/{capabilityName}/properties") + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + @ApiOperation(value = "Update Instance Capabilty Property", httpMethod = "PUT", notes = "Returns updated property", response = Response.class) + @ApiResponses(value = { @ApiResponse(code = 200, message = "Resource instance capabilty property updated"), @ApiResponse(code = 403, message = "Restricted operation"), @ApiResponse(code = 400, message = "Invalid content / Missing content"), + @ApiResponse(code = 404, message = "Component/Component Instance/Capability - not found") }) + public Response updateInstanceCapabilityProperty(@PathParam("containerComponentType") final String containerComponentType, @PathParam("containerComponentId") final String containerComponentId, + @PathParam("componentInstanceUniqueId") final String componentInstanceUniqueId, @PathParam("capabilityType") final String capabilityType, @PathParam("capabilityName") final String capabilityName, + @ApiParam(value = "Instance capabilty property to update", required = true) String data, @Context final HttpServletRequest request, @HeaderParam(value = Constants.USER_ID_HEADER) String userId) { + ServletContext context = request.getSession().getServletContext(); + String url = request.getMethod() + " " + request.getRequestURI(); + log.debug("(PUT) Start handle request of {}", url); + try { + Wrapper<ResponseFormat> errorWrapper = new Wrapper<>(); + List<ComponentInstanceProperty> propertiesToUpdate = new ArrayList<>(); + if (errorWrapper.isEmpty()) { + Either<List<ComponentInstanceProperty>, ResponseFormat> propertiesToUpdateEither = convertMultipleProperties(data); + if (propertiesToUpdateEither.isRight()) { + errorWrapper.setInnerElement(propertiesToUpdateEither.right().value()); + } else { + propertiesToUpdate = propertiesToUpdateEither.left().value(); + } + } + + if (!errorWrapper.isEmpty()) { + return buildErrorResponse(errorWrapper.getInnerElement()); + } + + ComponentTypeEnum componentTypeEnum = ComponentTypeEnum.findByParamName(containerComponentType); + ComponentInstanceBusinessLogic componentInstanceBL = getComponentInstanceBL(context, componentTypeEnum); + + Either<List<ComponentInstanceProperty>, ResponseFormat> updateCICapProperty = componentInstanceBL.updateInstanceCapabilityProperties(componentTypeEnum, containerComponentId, componentInstanceUniqueId, capabilityType, capabilityName, propertiesToUpdate, userId); + + if (updateCICapProperty.isRight()) { + log.debug("Failed to get properties of component instance ID: {} in {} with ID: {}", componentInstanceUniqueId, containerComponentType, containerComponentId); + return buildErrorResponse(updateCICapProperty.right().value()); + } + + return buildOkResponse(getComponentsUtils().getResponseFormat(ActionStatus.OK), updateCICapProperty.left().value()); + } catch (Exception e) { + BeEcompErrorManager.getInstance().logBeRestApiGeneralError("getGroupArtifactById"); + log.debug("getGroupArtifactById unexpected exception", e); + return buildErrorResponse(getComponentsUtils().getResponseFormat(ActionStatus.GENERAL_ERROR)); + } + } + @POST @Path("/{containerComponentType}/{containerComponentId}/serviceProxy") @Consumes(MediaType.APPLICATION_JSON) @@ -897,7 +981,7 @@ public class ComponentInstanceServlet extends AbstractValidationsServlet { ComponentInstance componentInstance = RepresentationUtils.fromRepresentation(data, ComponentInstance.class); componentInstance.setInvariantName(null); ComponentTypeEnum componentTypeEnum = ComponentTypeEnum.findByParamName(containerComponentType); - if(componentTypeEnum != ComponentTypeEnum.SERVICE){ + if (componentTypeEnum != ComponentTypeEnum.SERVICE) { log.debug("Unsupported container component type {}", containerComponentType); return buildErrorResponse(getComponentsUtils().getResponseFormat(ActionStatus.UNSUPPORTED_ERROR, containerComponentType)); } @@ -919,7 +1003,7 @@ public class ComponentInstanceServlet extends AbstractValidationsServlet { return buildErrorResponse(getComponentsUtils().getResponseFormat(ActionStatus.GENERAL_ERROR)); } } - + @DELETE @Path("/{containerComponentType}/{containerComponentId}/serviceProxy/{serviceProxyId}") @Consumes(MediaType.APPLICATION_JSON) @@ -956,7 +1040,7 @@ public class ComponentInstanceServlet extends AbstractValidationsServlet { return buildErrorResponse(getComponentsUtils().getResponseFormat(ActionStatus.GENERAL_ERROR)); } } - + @POST @Path("/{containerComponentType}/{containerComponentId}/serviceProxy/{serviceProxyId}/changeVersion/{newServiceId}") @Consumes(MediaType.APPLICATION_JSON) @@ -981,7 +1065,7 @@ public class ComponentInstanceServlet extends AbstractValidationsServlet { return buildErrorResponse(getComponentsUtils().getResponseFormat(ActionStatus.UNSUPPORTED_ERROR, containerComponentType)); } Either<ComponentInstance, ResponseFormat> actionResponse = componentInstanceLogic.changeServiceProxyVersion(containerComponentType, containerComponentId, serviceProxyId, userId); - + if (actionResponse.isRight()) { return buildErrorResponse(actionResponse.right().value()); } @@ -993,11 +1077,50 @@ public class ComponentInstanceServlet extends AbstractValidationsServlet { return buildErrorResponse(getComponentsUtils().getResponseFormat(ActionStatus.GENERAL_ERROR)); } } + /** + * REST API GET relation by Id + * Allows to get relation contained in specified component according to received Id + * @param containerComponentType + * @param componentId + * @param relationId + * @param request + * @param userId + * @return Response + */ + @GET + @Path("/{containerComponentType}/{componentId}/relationId/{relationId}") + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + @ApiOperation(value = "Get relation", httpMethod = "GET", notes = "Returns relation metadata according to relationId", response = Resource.class) + @ApiResponses(value = { @ApiResponse(code = 200, message = "relation found"), @ApiResponse(code = 403, message = "Restricted operation"), @ApiResponse(code = 404, message = "Relation not found") }) + public Response getRelationById(@PathParam("containerComponentType") final String containerComponentType, @PathParam("componentId") final String componentId, + @PathParam("relationId") final String relationId, @Context final HttpServletRequest request, @HeaderParam(value = Constants.USER_ID_HEADER) String userId) { + + ServletContext context = request.getSession().getServletContext(); + String url = request.getMethod() + " " + request.getRequestURI(); + log.debug("(GET) Start handle request of {}", url); + try { + ComponentTypeEnum componentTypeEnum = ComponentTypeEnum.findByParamName(containerComponentType); + ComponentInstanceBusinessLogic componentInstanceLogic = getComponentInstanceBL(context, componentTypeEnum); + if (componentInstanceLogic == null) { + log.debug("Unsupported component type {}", containerComponentType); + return buildErrorResponse(getComponentsUtils().getResponseFormat(ActionStatus.UNSUPPORTED_ERROR, containerComponentType)); + } + + Either<RequirementCapabilityRelDef, ResponseFormat> actionResponse = componentInstanceLogic.getRelationById(componentId, relationId, userId, componentTypeEnum); + if (actionResponse.isRight()) { + return buildErrorResponse(actionResponse.right().value()); + } + return buildOkResponse(getComponentsUtils().getResponseFormat(ActionStatus.OK), actionResponse.left().value()); + } catch (Exception e) { + BeEcompErrorManager.getInstance().logBeRestApiGeneralError("getRelationById"); + log.debug("getRelationById unexpected exception", e); + return buildErrorResponse(getComponentsUtils().getResponseFormat(ActionStatus.GENERAL_ERROR)); + } + } private Either<ComponentInstance, ResponseFormat> convertToResourceInstance(String data) { - // Either<ComponentInstance, ActionStatus> convertStatus = - // convertJsonToObject(data, ComponentInstance.class); Either<ComponentInstance, ResponseFormat> convertStatus = getComponentsUtils().convertJsonToObjectUsingObjectMapper(data, new User(), ComponentInstance.class, null, ComponentTypeEnum.RESOURCE_INSTANCE); if (convertStatus.isRight()) { return Either.right(convertStatus.right().value()); @@ -20,11 +20,8 @@ package org.openecomp.sdc.be.servlets; -import java.io.IOException; import java.util.ArrayList; -import java.util.Collection; import java.util.EnumMap; -import java.util.HashMap; import java.util.List; import java.util.Map; @@ -44,41 +41,33 @@ import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import org.apache.commons.collections.CollectionUtils; -import org.codehaus.jackson.JsonGenerationException; -import org.codehaus.jackson.map.JsonMappingException; import org.openecomp.sdc.be.components.impl.ComponentBusinessLogic; -import org.openecomp.sdc.be.components.impl.ResourceBusinessLogic; import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.datamodel.api.HighestFilterEnum; -import org.openecomp.sdc.be.datatypes.components.ComponentMetadataDataDefinition; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.FilterKeyEnum; import org.openecomp.sdc.be.model.CapReqDef; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentInstance; -import org.openecomp.sdc.be.model.ComponentInstanceProperty; import org.openecomp.sdc.be.model.IComponentInstanceConnectedElement; -import org.openecomp.sdc.be.model.PropertyDefinition; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.be.resources.data.ComponentMetadataData; import org.openecomp.sdc.be.ui.model.UiComponentDataTransfer; import org.openecomp.sdc.common.api.Constants; -import org.openecomp.sdc.common.config.EcompErrorName; import org.openecomp.sdc.exception.ResponseFormat; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.jcabi.aspects.Loggable; + +import fj.data.Either; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; -import fj.data.Either; - @Loggable(prepend = true, value = Loggable.DEBUG, trim = false) @Path("/v1/catalog") @Api(value = "Component Servlet", description = "Component Servlet") @@ -51,14 +51,14 @@ import org.springframework.web.context.WebApplicationContext; import com.google.gson.Gson; import com.jcabi.aspects.Loggable; + +import fj.data.Either; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; -import fj.data.Either; - @Loggable(prepend = true, value = Loggable.DEBUG, trim = false) @Path("/v1/consumers") @Api(value = "Consumer Servlet", description = "Consumer Servlet") @@ -48,13 +48,13 @@ import org.slf4j.LoggerFactory; import org.springframework.web.context.WebApplicationContext; import com.jcabi.aspects.Loggable; + +import fj.data.Either; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; -import fj.data.Either; - /** * Root resource (exposed at "/" path) */ @@ -20,8 +20,27 @@ package org.openecomp.sdc.be.servlets; -import com.jcabi.aspects.Loggable; -import fj.data.Either; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.inject.Singleton; +import javax.servlet.ServletContext; +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.HeaderParam; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + import org.openecomp.sdc.be.components.clean.ComponentsCleanBusinessLogic; import org.openecomp.sdc.be.components.impl.ElementBusinessLogic; import org.openecomp.sdc.be.config.BeEcompErrorManager; @@ -31,7 +50,12 @@ import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; import org.openecomp.sdc.be.datatypes.enums.OriginTypeEnum; import org.openecomp.sdc.be.info.ArtifactTypesInfo; -import org.openecomp.sdc.be.model.*; +import org.openecomp.sdc.be.model.ArtifactType; +import org.openecomp.sdc.be.model.Category; +import org.openecomp.sdc.be.model.Component; +import org.openecomp.sdc.be.model.PropertyScope; +import org.openecomp.sdc.be.model.Tag; +import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.model.category.CategoryDefinition; import org.openecomp.sdc.be.model.category.GroupingDefinition; import org.openecomp.sdc.be.model.category.SubCategoryDefinition; @@ -43,21 +67,15 @@ import org.openecomp.sdc.exception.ResponseFormat; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.inject.Singleton; +import com.jcabi.aspects.Loggable; + +import fj.data.Either; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.*; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import java.util.*; - @Path("/v1/") /**** @@ -467,6 +485,7 @@ public class ElementServlet extends BeGenericServlet { configuration.put("componentTypes", elementBL.getAllComponentTypesParamNames()); configuration.put("roles", elementBL.getAllSupportedRoles()); configuration.put("resourceTypes", resourceTypesMap.left().value()); + configuration.put("environmentContext", ConfigurationManager.getConfigurationManager().getConfiguration().getEnvironmentContext()); return buildOkResponse(getComponentsUtils().getResponseFormat(ActionStatus.OK), configuration); } @@ -46,7 +46,6 @@ import org.openecomp.sdc.be.model.GroupProperty; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.common.api.Constants; -import org.openecomp.sdc.common.config.EcompErrorName; import org.openecomp.sdc.exception.ResponseFormat; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -54,14 +53,14 @@ import org.slf4j.LoggerFactory; import com.google.common.reflect.TypeToken; import com.google.gson.Gson; import com.jcabi.aspects.Loggable; + +import fj.data.Either; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; -import fj.data.Either; - /** * Root resource (exposed at "/" path) */ @@ -106,7 +105,7 @@ public class GroupServlet extends AbstractValidationsServlet { return buildOkResponse(getComponentsUtils().getResponseFormat(ActionStatus.OK), actionResponse.left().value()); - } catch (Throwable e) { + } catch (Exception e) { BeEcompErrorManager.getInstance().logBeRestApiGeneralError("getGroupArtifactById"); log.debug("getGroupArtifactById unexpected exception", e); return buildErrorResponse(getComponentsUtils().getResponseFormat(ActionStatus.GENERAL_ERROR)); @@ -30,7 +30,6 @@ import javax.ws.rs.DELETE; import javax.ws.rs.GET; import javax.ws.rs.HeaderParam; import javax.ws.rs.POST; -import javax.ws.rs.PUT; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; @@ -40,7 +39,6 @@ import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import org.codehaus.jackson.map.ObjectMapper; -import org.openecomp.sdc.be.components.impl.ComponentInstanceBusinessLogic; import org.openecomp.sdc.be.components.impl.InputsBusinessLogic; import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.dao.api.ActionStatus; @@ -55,21 +53,20 @@ import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; import org.openecomp.sdc.common.api.Constants; import org.openecomp.sdc.common.config.EcompErrorName; -import org.openecomp.sdc.common.datastructure.Wrapper; import org.openecomp.sdc.exception.ResponseFormat; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.web.context.WebApplicationContext; import com.jcabi.aspects.Loggable; + +import fj.data.Either; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; -import fj.data.Either; - @Loggable(prepend = true, value = Loggable.DEBUG, trim = false) @Path("/v1/catalog") @Api(value = "Input Catalog", description = "Input Servlet") @@ -53,14 +53,14 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.jcabi.aspects.Loggable; + +import fj.data.Either; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; -import fj.data.Either; - @Loggable(prepend = true, value = Loggable.DEBUG, trim = false) @Path("/v1/catalog") @Api(value = "Lifecycle Actions Servlet", description = "Lifecycle Actions Servlet") @@ -99,7 +99,7 @@ public class ProductServlet extends BeGenericServlet { response = buildOkResponse(getComponentsUtils().getResponseFormat(ActionStatus.CREATED), result); return response; - } catch (Throwable e) { + } catch (Exception e) { BeEcompErrorManager.getInstance().processEcompError(EcompErrorName.BeRestApiGeneralError, "Create Product"); BeEcompErrorManager.getInstance().logBeRestApiGeneralError("Create Product"); log.debug("create product failed with error ", e); @@ -141,7 +141,7 @@ public class ProductServlet extends BeGenericServlet { Object product = RepresentationUtils.toRepresentation(actionResponse.left().value()); return buildOkResponse(getComponentsUtils().getResponseFormat(ActionStatus.OK), product); - } catch (Throwable e) { + } catch (Exception e) { BeEcompErrorManager.getInstance().processEcompError(EcompErrorName.BeRestApiGeneralError, "Get Product"); BeEcompErrorManager.getInstance().logBeRestApiGeneralError("Get Product"); log.debug("get product failed with error ", e); @@ -221,7 +221,7 @@ public class ProductServlet extends BeGenericServlet { response = buildOkResponse(getComponentsUtils().getResponseFormat(ActionStatus.OK), product); return response; - } catch (Throwable e) { + } catch (Exception e) { BeEcompErrorManager.getInstance().processEcompError(EcompErrorName.BeRestApiGeneralError, "Delete Resource"); BeEcompErrorManager.getInstance().logBeRestApiGeneralError("Delete Resource"); log.debug("delete resource failed with error ", e); @@ -68,14 +68,14 @@ import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.reflect.TypeToken; import com.jcabi.aspects.Loggable; + +import fj.data.Either; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; -import fj.data.Either; - @Loggable(prepend = true, value = Loggable.DEBUG, trim = false) @Path("/v1/catalog") @Api(value = "Resource Property Servlet", description = "Resource Property Servlet") @@ -39,6 +39,7 @@ import org.slf4j.LoggerFactory; import com.google.gson.JsonSyntaxException; import com.jcabi.aspects.Loggable; + import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; @@ -54,6 +54,7 @@ import org.slf4j.LoggerFactory; import org.springframework.web.context.WebApplicationContext; import com.jcabi.aspects.Loggable; + import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; @@ -67,14 +67,14 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.jcabi.aspects.Loggable; + +import fj.data.Either; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; -import fj.data.Either; - @Loggable(prepend = true, value = Loggable.DEBUG, trim = false) @Path("/v1/catalog") @Api(value = "Resources Catalog", description = "Resources Servlet") @@ -70,14 +70,14 @@ import org.slf4j.LoggerFactory; import com.google.gson.reflect.TypeToken; import com.jcabi.aspects.Loggable; + +import fj.data.Either; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; -import fj.data.Either; - @Loggable(prepend = true, value = Loggable.DEBUG, trim = false) @Path("/v1/catalog") @Api(value = "Service Catalog", description = "Service Servlet") @@ -763,7 +763,6 @@ public class ServiceServlet extends AbstractValidationsServlet { } catch (Exception e) { log.error("Failed runnign the command {}", command, e); - e.printStackTrace(); return Either.right(getComponentsUtils().getResponseFormat(ActionStatus.GENERAL_ERROR)); } @@ -20,7 +20,6 @@ package org.openecomp.sdc.be.servlets; -import java.lang.reflect.Type; import java.util.Map; import javax.inject.Singleton; @@ -40,9 +39,7 @@ import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.impl.WebAppContextWrapper; import org.openecomp.sdc.be.model.DataTypeDefinition; -import org.openecomp.sdc.be.model.PropertyConstraint; import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.be.model.operations.impl.PropertyOperation.PropertyConstraintSerialiser; import org.openecomp.sdc.common.api.Constants; import org.openecomp.sdc.common.config.EcompErrorName; import org.openecomp.sdc.common.datastructure.Wrapper; @@ -51,17 +48,14 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.web.context.WebApplicationContext; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.reflect.TypeToken; import com.jcabi.aspects.Loggable; + +import fj.data.Either; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; -import fj.data.Either; - @Loggable(prepend = true, value = Loggable.DEBUG, trim = false) @Path("/v1/catalog") @Api(value = "Types Fetch Servlet", description = "Types Fetch Servlet") @@ -42,8 +42,6 @@ import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import org.apache.commons.lang3.tuple.ImmutablePair; -import org.codehaus.jackson.JsonGenerationException; -import org.codehaus.jackson.map.JsonMappingException; import org.glassfish.jersey.media.multipart.FormDataParam; import org.openecomp.sdc.be.components.impl.CapabilityTypeImportManager; import org.openecomp.sdc.be.components.impl.CategoriesImportManager; @@ -60,22 +58,22 @@ import org.openecomp.sdc.be.model.GroupTypeDefinition; import org.openecomp.sdc.be.model.PolicyTypeDefinition; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.common.api.Constants; -import org.openecomp.sdc.common.datastructure.Wrapper; import org.openecomp.sdc.common.datastructure.FunctionalInterfaces.ConsumerTwoParam; +import org.openecomp.sdc.common.datastructure.Wrapper; import org.openecomp.sdc.exception.ResponseFormat; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.web.context.WebApplicationContext; import com.jcabi.aspects.Loggable; + +import fj.data.Either; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; -import fj.data.Either; - @Loggable(prepend = true, value = Loggable.DEBUG, trim = false) @Path("/v1/catalog/uploadType") @Api(value = "Catalog Types Upload", description = "Upload Type from yaml") @@ -53,14 +53,14 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.jcabi.aspects.Loggable; + +import fj.data.Either; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; -import fj.data.Either; - @Loggable(prepend = true, value = Loggable.DEBUG, trim = false) @Path("/v1/user") @Api(value = "User Administration", description = "User admininstarator operations") @@ -34,8 +34,8 @@ import javax.annotation.PreDestroy; import org.apache.commons.codec.binary.Base64; import org.openecomp.sdc.be.config.BeEcompErrorManager; -import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.config.Configuration.SwitchoverDetectorConfig; +import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.dao.rest.HttpRestClient; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -1,5 +1,4 @@ /*- - * ============LICENSE_START======================================================= * SDC * ================================================================================ @@ -81,9 +80,7 @@ public class CapabiltyRequirementConvertor { @Autowired private ToscaOperationFacade toscaOperationFacade; - protected CapabiltyRequirementConvertor() { - - } + protected CapabiltyRequirementConvertor() {} public static synchronized CapabiltyRequirementConvertor getInstance() { if (instance == null) { @@ -117,9 +114,8 @@ public class CapabiltyRequirementConvertor { } private void convertOverridenProperties(ComponentInstance componentInstance, Map<String, DataTypeDefinition> dataTypes, Map<String, ToscaTemplateCapability> capabilties, CapabilityDefinition c) { - List<ComponentInstanceProperty> properties = c.getProperties(); - if (properties != null && !properties.isEmpty()) { - properties + if (CollectionUtils.isNotEmpty(c.getProperties())) { + c.getProperties() .stream() .filter(p -> p.getValue() != null || p.getDefaultValue() != null) .forEach(p -> convertOverridenProperty(componentInstance, dataTypes, capabilties, c, p)); @@ -331,7 +327,9 @@ public class CapabiltyRequirementConvertor { result = Either.right(false); } if(result == null){ - result = buildSubstitutedName(componentsCache, getOriginRes.left().value(), Lists.newArrayList(path.subList(0, path.size()-1)), name); + List<String> reducedPath = getReducedPath(path); + reducedPath.remove(reducedPath.size()-1); + result = buildSubstitutedName(componentsCache, getOriginRes.left().value(), reducedPath, name); } return result; } @@ -432,12 +430,12 @@ public class CapabiltyRequirementConvertor { */ public Either<Map<String, String[]>, ToscaError> convertSubstitutionMappingCapabilities(Map<String, Component> componentsCache, Component component) { Map<String, List<CapabilityDefinition>> capabilities = component.getCapabilities(); - Either<Map<String, String[]>, ToscaError> res = null; + Either<Map<String, String[]>, ToscaError> res; if (capabilities != null) { res = buildAddSubstitutionMappingsCapabilities(componentsCache, component, capabilities); } else { + res = Either.left(Maps.newHashMap()); logger.debug(NO_CAPABILITIES); - res = Either.left(new HashMap<>()); } return res; } @@ -483,7 +481,7 @@ public class CapabiltyRequirementConvertor { toscaCapability.setValid_source_types(c.getValidSourceTypes()); List<ComponentInstanceProperty> properties = c.getProperties(); - if (properties != null && !properties.isEmpty()) { + if (CollectionUtils.isNotEmpty(properties)) { Map<String, ToscaProperty> toscaProperties = new HashMap<>(); for (PropertyDefinition property : properties) { ToscaProperty toscaProperty = PropertyConvertor.getInstance().convertProperty(dataTypes, property, true); @@ -493,15 +491,22 @@ public class CapabiltyRequirementConvertor { } toscaCapabilities.put(name, toscaCapability); } - - Either<String, Boolean> buildSubstitutedName(Map<String, Component> originComponents, Component originComponent, List<String> path, String name) { + /** + * Allows to build substituted name of capability\requirement of the origin component instance according to the path + * @param componentsCache + * @param originComponent + * @param path + * @param name + * @return + */ + public Either<String, Boolean> buildSubstitutedName(Map<String, Component> componentsCache, Component originComponent, List<String> path, String name) { StringBuilder substitutedName = new StringBuilder(); boolean nameBuiltSuccessfully = true; Either<String, Boolean> result; if(CollectionUtils.isNotEmpty(path) && !ToscaUtils.isComplexVfc(originComponent)){ - Collections.reverse(path); - Iterator<String> instanceIdIter = path.iterator(); - nameBuiltSuccessfully = appendNameRecursively(originComponents, originComponent, instanceIdIter, substitutedName); + List<String> reducedPath = getReducedPath(path); + Collections.reverse(reducedPath); + nameBuiltSuccessfully = appendNameRecursively(componentsCache, originComponent, reducedPath.iterator(), substitutedName); } if(nameBuiltSuccessfully){ result = Either.left(substitutedName.append(name).toString()); @@ -511,43 +516,57 @@ public class CapabiltyRequirementConvertor { return result; } - private boolean appendNameRecursively(Map<String, Component> originComponents, Component originComponent, Iterator<String> instanceIdIter, StringBuilder substitutedName) { - if(CollectionUtils.isNotEmpty(originComponent.getComponentInstances()) && instanceIdIter.hasNext()){ + private List<String> getReducedPath(List<String> path) { + List<String> pathCopy = Lists.newArrayList(); + path.stream().forEach(id -> {if(!pathCopy.contains(id))pathCopy.add(id);}); + return pathCopy; + } + + private boolean appendNameRecursively(Map<String, Component> componentsCache, Component originComponent, Iterator<String> instanceIdIter, StringBuilder substitutedName) { + if(CollectionUtils.isNotEmpty(originComponent.getComponentInstances()) && instanceIdIter.hasNext() && !ToscaUtils.isComplexVfc(originComponent)){ String instanceId = instanceIdIter.next(); Optional<ComponentInstance> instanceOpt = originComponent.getComponentInstances().stream().filter(i -> i.getUniqueId().equals(instanceId)).findFirst(); if(!instanceOpt.isPresent()){ logger.debug("Failed to find an instance with uniqueId {} on a component with uniqueId {}", instanceId, originComponent.getUniqueId()); return false; } - Either<Component, Boolean> getOriginRes = getOriginComponent(originComponents, instanceOpt.get()); + substitutedName.append(instanceOpt.get().getNormalizedName()).append('.'); + Either<Component, Boolean> getOriginRes = getOriginComponent(componentsCache, instanceOpt.get()); if(getOriginRes.isRight()){ return false; } - appendNameRecursively(originComponents, getOriginRes.left().value(), instanceIdIter, substitutedName); - substitutedName.append(instanceOpt.get().getNormalizedName()).append('.'); - return true; + appendNameRecursively(componentsCache, getOriginRes.left().value(), instanceIdIter, substitutedName); } return true; } - private Either<Component, Boolean> getOriginComponent(Map<String, Component> originComponents, ComponentInstance instance) { + Either<Component, Boolean> getOriginComponent(Map<String, Component> componentsCache, ComponentInstance instance) { Either<Component, Boolean> result; Either<Component, StorageOperationStatus> getOriginRes; - if(originComponents.containsKey(instance.getComponentUid())){ - result = Either.left(originComponents.get(instance.getComponentUid())); + if(componentsCache.containsKey(instance.getActualComponentUid())){ + result = Either.left(componentsCache.get(instance.getActualComponentUid())); } else { - ComponentParametersView filter = new ComponentParametersView(true); - filter.setIgnoreComponentInstances(false); - getOriginRes = toscaOperationFacade.getToscaElement(instance.getComponentUid(), filter); + ComponentParametersView filter = getFilter(instance); + getOriginRes = toscaOperationFacade.getToscaElement(instance.getActualComponentUid(), filter); if(getOriginRes.isRight()){ - logger.debug("Failed to get an origin component with uniqueId {}", instance.getComponentUid()); + logger.debug("Failed to get an origin component with uniqueId {}", instance.getActualComponentUid()); result = Either.right(false); } else { result = Either.left(getOriginRes.left().value()); - originComponents.put(getOriginRes.left().value().getUniqueId(), getOriginRes.left().value()); + componentsCache.put(getOriginRes.left().value().getUniqueId(), getOriginRes.left().value()); } } return result; } + private ComponentParametersView getFilter(ComponentInstance instance) { + ComponentParametersView filter = new ComponentParametersView(true); + filter.setIgnoreComponentInstances(false); + if(instance.getIsProxy()){ + filter.setIgnoreCapabilities(false); + filter.setIgnoreRequirements(false); + } + return filter; + } + } @@ -20,8 +20,26 @@ package org.openecomp.sdc.be.tosca; -import com.google.gson.Gson; -import fj.data.Either; +import java.io.BufferedOutputStream; +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.EnumMap; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.stream.Collectors; +import java.util.zip.ZipEntry; +import java.util.zip.ZipInputStream; +import java.util.zip.ZipOutputStream; + import org.apache.commons.codec.binary.Base64; import org.apache.commons.codec.digest.DigestUtils; import org.apache.commons.io.output.ByteArrayOutputStream; @@ -61,7 +79,6 @@ import org.openecomp.sdc.be.tosca.model.ToscaTemplate; import org.openecomp.sdc.be.utils.CommonBeUtils; import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum; import org.openecomp.sdc.common.api.ArtifactTypeEnum; -import org.openecomp.sdc.common.api.Constants; import org.openecomp.sdc.common.impl.ExternalConfiguration; import org.openecomp.sdc.common.util.GeneralUtility; import org.openecomp.sdc.common.util.ValidationUtils; @@ -75,25 +92,9 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import java.io.BufferedOutputStream; -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.EnumMap; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import java.util.stream.Collectors; -import java.util.zip.ZipEntry; -import java.util.zip.ZipInputStream; -import java.util.zip.ZipOutputStream; +import com.google.gson.Gson; + +import fj.data.Either; /** @@ -254,7 +255,8 @@ public class CsarUtils { String cassandraId = artifactDefinition.getEsId(); Either<byte[], ActionStatus> fromCassandra = getFromCassandra(cassandraId); if (fromCassandra.isRight()) { - ResponseFormat responseFormat = componentsUtils.getResponseFormat(fromCassandra.right().value()); + log.debug("ArtifactName {}, unique ID {}", artifactDefinition.getArtifactName(), artifactDefinition.getUniqueId()); + ResponseFormat responseFormat = componentsUtils.getResponseFormat(fromCassandra.right().value()); return Either.right(responseFormat); } mainYaml = fromCassandra.left().value(); @@ -328,6 +330,12 @@ public class CsarUtils { // add component to zip Either<byte[], ActionStatus> entryData = getEntryData(innerComponentTriple.getLeft(), innerComponent); + if (entryData.isRight()) { + ResponseFormat responseFormat = componentsUtils.getResponseFormat(entryData.right().value()); + log.debug("Failed adding to zip component {}, error {}", innerComponentTriple.getLeft(), + entryData.right().value()); + return Either.right(responseFormat); + } byte[] content = entryData.left().value(); zip.putNextEntry(new ZipEntry(DEFINITIONS_PATH + icFileName)); zip.write(content); @@ -394,7 +402,7 @@ public class CsarUtils { final int initSize = 2048; - log.debug("Starting coppy from Schema file zip to CSAR zip"); + log.debug("Starting copy from Schema file zip to CSAR zip"); try (ZipInputStream zipStream = new ZipInputStream(new ByteArrayInputStream(schemaFileZip)); ByteArrayOutputStream out = new ByteArrayOutputStream(); @@ -657,7 +665,7 @@ public class CsarUtils { null, null, user, component, shouldLock, inTransaction, false); if (validateAndHandleArtifact.isRight()) { - if (ArtifactOperationEnum.Create == operationType.getArtifactOperationEnum() || ArtifactOperationEnum.Update == operationType.getArtifactOperationEnum()) { + if (ArtifactOperationEnum.isCreateOrLink(operationType.getArtifactOperationEnum()) || ArtifactOperationEnum.Update == operationType.getArtifactOperationEnum()) { ResponseFormat responseFormat = componentsUtils.getResponseFormat(ActionStatus.AAI_ARTIFACT_GENERATION_FAILED, componentType.getValue(), component.getName(), validateAndHandleArtifact.right().value().toString()); Either.right(responseFormat); @@ -739,7 +747,7 @@ public class CsarUtils { } else { Either<byte[], ActionStatus> fromCassandra = getFromCassandra(cassandraId); if (fromCassandra.isRight()) { - return Either.right(fromCassandra.right().value()); + return Either.right(fromCassandra.right().value()); } else { content = fromCassandra.left().value(); } @@ -773,19 +781,16 @@ public class CsarUtils { Either<ESArtifactData, CassandraOperationStatus> artifactResponse = artifactCassandraDao.getArtifact(cassandraId); if (artifactResponse.isRight()) { - log.debug("In createCsar fetching of artifact from CS failed"); - log.debug("Failed to fetch from Cassandra by id {} error {} ", cassandraId, artifactResponse.right().value()); + log.debug("Failed to fetch artifact from Cassandra by id {} error {} ", cassandraId, artifactResponse.right().value()); StorageOperationStatus storageStatus = DaoStatusConverter.convertCassandraStatusToStorageStatus(artifactResponse.right().value()); ActionStatus convertedFromStorageResponse = componentsUtils.convertFromStorageResponse(storageStatus); return Either.right(convertedFromStorageResponse); - } else { - ESArtifactData artifactData = artifactResponse.left().value(); - return Either.left(artifactData.getDataAsArray()); - } + ESArtifactData artifactData = artifactResponse.left().value(); + return Either.left(artifactData.getDataAsArray()); } - + private String createCsarBlock0(String metaFileVersion, String toscaConformanceLevel) { final String BLOCK_0_TEMPLATE = "SDC-TOSCA-Meta-File-Version: %s\nSDC-TOSCA-Definitions-Version: %s\n"; @@ -1201,18 +1206,20 @@ public class CsarUtils { for (ArtifactDefinition artifactDefinition : artifactDefinitionList) { if (!isInCertificationRequest && componentType == ComponentTypeEnum.SERVICE - && artifactDefinition.getArtifactType().equals(heatEnvType)){ + && artifactDefinition.getArtifactType().equals(heatEnvType) || + //this is placeholder + (artifactDefinition.getEsId() == null && artifactDefinition.getMandatory())){ continue; } - String esId = artifactDefinition.getEsId(); byte[] payloadData = artifactDefinition.getPayloadData(); String artifactFileName = artifactDefinition.getArtifactName(); if (payloadData == null) { - Either<byte[], ActionStatus> fromCassandra = getFromCassandra(esId); + Either<byte[], ActionStatus> fromCassandra = getFromCassandra(artifactDefinition.getEsId()); if (fromCassandra.isRight()) { + log.debug("ArtifactName {}, unique ID {}", artifactDefinition.getArtifactName(), artifactDefinition.getUniqueId()); log.debug("Failed to get {} payload from DB reason: {}", artifactFileName, fromCassandra.right().value()); continue; } @@ -145,7 +145,7 @@ public class PropertyConvertor { } innerConverter = type.getValueConverter(); - if (ToscaPropertyType.STRING.equals(type) && value.startsWith("/")) { + if (ToscaPropertyType.STRING.equals(type) && valueStartsWithNonJsonChar(value)) { return innerConverter.convertToToscaValue(value, innerType, dataTypes); } } @@ -192,4 +192,8 @@ public class PropertyConvertor { } + private boolean valueStartsWithNonJsonChar(String value) { + return value.startsWith("/") || value.startsWith(":"); + } + } @@ -57,7 +57,7 @@ import org.openecomp.sdc.be.model.GroupInstance; import org.openecomp.sdc.be.model.GroupProperty; import org.openecomp.sdc.be.model.InputDefinition; import org.openecomp.sdc.be.model.PropertyDefinition; -import org.openecomp.sdc.be.model.RequirementAndRelationshipPair; +import org.openecomp.sdc.be.model.RelationshipInfo; import org.openecomp.sdc.be.model.RequirementCapabilityRelDef; import org.openecomp.sdc.be.model.RequirementDefinition; import org.openecomp.sdc.be.model.Resource; @@ -110,7 +110,7 @@ public class ToscaExportHandler { @Autowired private CapabiltyRequirementConvertor capabiltyRequirementConvertor; private PropertyConvertor propertyConvertor = PropertyConvertor.getInstance(); - Map<String,Component> originComponents = new HashMap<>(); + Map<String, Component> originComponents = new HashMap<>(); private static Logger log = LoggerFactory.getLogger(ToscaExportHandler.class.getName()); @@ -127,7 +127,8 @@ public class ToscaExportHandler { public static final String VF_MODULE_TYPE_EXPANSION = "Expansion"; private static final String FAILED_TO_GET_DEFAULT_IMPORTS_CONFIGURATION = "convertToToscaTemplate - failed to get Default Imports section from configuration"; private static final String NOT_SUPPORTED_COMPONENT_TYPE = "Not supported component type {}"; - protected static final List<Map<String, Map<String, String>>> DEFAULT_IMPORTS = ConfigurationManager.getConfigurationManager().getConfiguration().getDefaultImports(); + protected static final List<Map<String, Map<String, String>>> DEFAULT_IMPORTS = ConfigurationManager + .getConfigurationManager().getConfiguration().getDefaultImports(); public Either<ToscaRepresentation, ToscaError> exportComponent(Component component) { @@ -229,7 +230,7 @@ public class ToscaExportHandler { return Either.right(importsRes.right().value()); } toscaNode = importsRes.left().value().left; - /*Either<Map<String, ToscaNodeType>, ToscaError> nodeTypesMapEither = createProxyNodeTypes(component); + Either<Map<String, ToscaNodeType>, ToscaError> nodeTypesMapEither = createProxyNodeTypes(component); if (nodeTypesMapEither.isRight()) { log.debug("Failed to fetch normative service proxy resource by tosca name, error {}", nodeTypesMapEither.right().value()); @@ -237,7 +238,7 @@ public class ToscaExportHandler { } Map<String, ToscaNodeType> nodeTypesMap = nodeTypesMapEither.left().value(); if (nodeTypesMap != null && !nodeTypesMap.isEmpty()) - toscaNode.setNode_types(nodeTypesMap);*/ + toscaNode.setNode_types(nodeTypesMap); Map<String, Component> componentCache = importsRes.left().value().right; Either<Map<String, DataTypeDefinition>, TitanOperationStatus> dataTypesEither = dataTypeCache.getAll(); @@ -274,8 +275,17 @@ public class ToscaExportHandler { if (groups != null && !groups.isEmpty()) { groupsMap = new HashMap<>(); for (GroupDefinition group : groups) { - ToscaGroupTemplate toscaGroup = convertGroup(group); - groupsMap.put(group.getName(), toscaGroup); + boolean addToTosca = true; + if (group.getType().equals(Constants.DEFAULT_GROUP_VF_MODULE)) { + List<String> artifacts = group.getArtifacts(); + if (artifacts == null || artifacts.isEmpty()) { + addToTosca = false; + } + } + if (addToTosca) { + ToscaGroupTemplate toscaGroup = convertGroup(group); + groupsMap.put(group.getName(), toscaGroup); + } } log.debug("groups converted"); @@ -343,10 +353,10 @@ public class ToscaExportHandler { private ToscaMetadata convertMetadata(Component component, boolean isInstance, ComponentInstance componentInstance) { ToscaMetadata toscaMetadata = new ToscaMetadata(); - toscaMetadata.setName(component.getComponentMetadataDefinition().getMetadataDataDefinition().getName()); toscaMetadata.setInvariantUUID(component.getInvariantUUID()); toscaMetadata.setUUID(component.getUUID()); toscaMetadata.setDescription(component.getDescription()); + toscaMetadata.setName(component.getComponentMetadataDefinition().getMetadataDataDefinition().getName()); List<CategoryDefinition> categories = component.getCategories(); CategoryDefinition categoryDefinition = categories.get(0); @@ -355,11 +365,26 @@ public class ToscaExportHandler { if (isInstance) { toscaMetadata.setVersion(component.getVersion()); toscaMetadata.setCustomizationUUID(componentInstance.getCustomizationUUID()); + if (componentInstance.getSourceModelInvariant() != null + && !componentInstance.getSourceModelInvariant().isEmpty()) { + toscaMetadata.setVersion(componentInstance.getComponentVersion()); + toscaMetadata.setSourceModelInvariant(componentInstance.getSourceModelInvariant()); + toscaMetadata.setSourceModelUuid(componentInstance.getSourceModelUuid()); + toscaMetadata.setSourceModelName(componentInstance.getSourceModelName()); + toscaMetadata.setName( + componentInstance.getSourceModelName() + " " + OriginTypeEnum.ServiceProxy.getDisplayValue()); + toscaMetadata.setDescription(componentInstance.getDescription()); + } + } switch (component.getComponentType()) { case RESOURCE: Resource resource = (Resource) component; - toscaMetadata.setType(resource.getResourceType().name()); + + if (isInstance && componentInstance.getOriginType() == OriginTypeEnum.ServiceProxy) { + toscaMetadata.setType(componentInstance.getOriginType().getDisplayValue()); + } else + toscaMetadata.setType(resource.getResourceType().name()); toscaMetadata.setSubcategory(categoryDefinition.getSubcategories().get(0).getName()); toscaMetadata.setResourceVendor(resource.getVendorName()); toscaMetadata.setResourceVendorRelease(resource.getVendorRelease()); @@ -370,15 +395,16 @@ public class ToscaExportHandler { toscaMetadata.setType(component.getComponentType().getValue()); toscaMetadata.setServiceType(service.getServiceType()); toscaMetadata.setServiceRole(service.getServiceRole()); + toscaMetadata.setEnvironmentContext(service.getEnvironmentContext()); if (!isInstance) { // DE268546 - toscaMetadata.setServiceEcompNaming(((Service)component).isEcompGeneratedNaming()); - toscaMetadata.setEcompGeneratedNaming(((Service)component).isEcompGeneratedNaming()); - toscaMetadata.setNamingPolicy(((Service)component).getNamingPolicy()); + toscaMetadata.setServiceEcompNaming(((Service) component).isEcompGeneratedNaming()); + toscaMetadata.setEcompGeneratedNaming(((Service) component).isEcompGeneratedNaming()); + toscaMetadata.setNamingPolicy(((Service) component).getNamingPolicy()); } break; default: - log.debug("Not supported component type {}", component.getComponentType()); + log.debug(NOT_SUPPORTED_COMPONENT_TYPE, component.getComponentType()); } return toscaMetadata; } @@ -472,7 +498,7 @@ public class ToscaExportHandler { } public static String getInterfaceFilename(String artifactName) { - return artifactName.substring(0, artifactName.lastIndexOf('.')) + ToscaExportHandler.TOSCA_INTERFACE_NAME; + return artifactName.substring(0, artifactName.lastIndexOf('.')) + ToscaExportHandler.TOSCA_INTERFACE_NAME; } private Either<ToscaTemplate, ToscaError> convertNodeType(Component component, ToscaTemplate toscaNode, @@ -539,7 +565,8 @@ public class ToscaExportHandler { toscaNodeType = capabilities.left().value(); log.debug("Capabilities converted for {}", component.getUniqueId()); - Either<ToscaNodeType, ToscaError> requirements = capabiltyRequirementConvertor.convertRequirements(component, toscaNodeType); + Either<ToscaNodeType, ToscaError> requirements = capabiltyRequirementConvertor.convertRequirements(component, + toscaNodeType); if (requirements.isRight()) { return Either.right(requirements.right().value()); } @@ -584,9 +611,15 @@ public class ToscaExportHandler { ToscaNodeTemplate nodeTemplate = new ToscaNodeTemplate(); nodeTemplate.setType(componentInstance.getToscaComponentName()); + Either<Component, Boolean> originComponentRes = capabiltyRequirementConvertor + .getOriginComponent(componentCache, componentInstance); + if (originComponentRes.isRight()) { + convertNodeTemplatesRes = Either.right(ToscaError.NODE_TYPE_REQUIREMENT_ERROR); + break; + } Either<ToscaNodeTemplate, ToscaError> requirements = convertComponentInstanceRequirements(component, componentInstance, component.getComponentInstancesRelations(), nodeTemplate, - componentCache.get(componentInstance.getComponentUid())); + originComponentRes.left().value()); if (requirements.isRight()) { convertNodeTemplatesRes = Either.right(requirements.right().value()); break; @@ -596,7 +629,7 @@ public class ToscaExportHandler { nodeTemplate = requirements.left().value(); - Component componentOfInstance = componentCache.get(componentInstance.getComponentUid()); + Component componentOfInstance = componentCache.get(componentInstance.getActualComponentUid()); nodeTemplate.setMetadata(convertMetadata(componentOfInstance, true, componentInstance)); Either<ToscaNodeTemplate, ToscaError> capabilities = capabiltyRequirementConvertor @@ -634,9 +667,17 @@ public class ToscaExportHandler { groupsMap = new HashMap<>(); } for (GroupInstance groupInst : groupInstances) { - ToscaGroupTemplate toscaGroup = convertGroupInstance(groupInst); + boolean addToTosca = true; + + List<String> artifacts = groupInst.getArtifacts(); + if (artifacts == null || artifacts.isEmpty()) { + addToTosca = false; + } - groupsMap.put(groupInst.getName(), toscaGroup); + if (addToTosca) { + ToscaGroupTemplate toscaGroup = convertGroupInstance(groupInst); + groupsMap.put(groupInst.getName(), toscaGroup); + } } } @@ -729,6 +770,7 @@ public class ToscaExportHandler { } private ToscaGroupTemplate convertGroup(GroupDefinition group) { + ToscaGroupTemplate toscaGroup = new ToscaGroupTemplate(); Map<String, String> members = group.getMembers(); if (members != null) @@ -845,7 +887,7 @@ public class ToscaExportHandler { return toscaNodeType; } - /*private Either<Map<String, ToscaNodeType>, ToscaError> createProxyNodeTypes(Component container) { + private Either<Map<String, ToscaNodeType>, ToscaError> createProxyNodeTypes(Component container) { Map<String, ToscaNodeType> nodeTypesMap = null; Either<Map<String, ToscaNodeType>, ToscaError> res = Either.left(nodeTypesMap); @@ -855,13 +897,15 @@ public class ToscaExportHandler { if (componetInstances == null || componetInstances.isEmpty()) return res; Map<String, ComponentInstance> serviceProxyInstanceList = new HashMap<>(); - List<ComponentInstance> proxyInst = componetInstances.stream().filter(p -> p.getOriginType().name().equals(OriginTypeEnum.ServiceProxy.name())).collect(Collectors.toList()); - if(proxyInst != null && !proxyInst.isEmpty()){ - for(ComponentInstance inst: proxyInst){ + List<ComponentInstance> proxyInst = componetInstances.stream() + .filter(p -> p.getOriginType().name().equals(OriginTypeEnum.ServiceProxy.name())) + .collect(Collectors.toList()); + if (proxyInst != null && !proxyInst.isEmpty()) { + for (ComponentInstance inst : proxyInst) { serviceProxyInstanceList.put(inst.getToscaComponentName(), inst); } } - + if (serviceProxyInstanceList.isEmpty()) return res; ComponentParametersView filter = new ComponentParametersView(true); @@ -894,7 +938,7 @@ public class ToscaExportHandler { } return Either.left(nodeTypesMap); - }*/ + } private ToscaNodeType createProxyNodeType(Component origComponent, Component proxyComponent, ComponentInstance instance) { @@ -920,8 +964,9 @@ public class ToscaExportHandler { ToscaNodeTemplate nodeTypeTemplate, Component originComponent) { List<Map<String, ToscaTemplateRequirement>> toscaRequirements = new ArrayList<>(); - if(!addRequirements(component, componentInstance, relations, originComponent, toscaRequirements)){ - log.debug("Failed to convert component instance requirements for the component instance {}. ", componentInstance.getName()); + if (!addRequirements(component, componentInstance, relations, originComponent, toscaRequirements)) { + log.debug("Failed to convert component instance requirements for the component instance {}. ", + componentInstance.getName()); return Either.right(ToscaError.NODE_TYPE_REQUIREMENT_ERROR); } if (!toscaRequirements.isEmpty()) { @@ -931,82 +976,114 @@ public class ToscaExportHandler { return Either.left(nodeTypeTemplate); } - private boolean addRequirements(Component component, ComponentInstance componentInstance, List<RequirementCapabilityRelDef> relations, Component originComponent, + private boolean addRequirements(Component component, ComponentInstance componentInstance, + List<RequirementCapabilityRelDef> relations, Component originComponent, List<Map<String, ToscaTemplateRequirement>> toscaRequirements) { boolean result; - List<RequirementCapabilityRelDef> filteredRelations = relations.stream().filter(p -> componentInstance.getUniqueId().equals(p.getFromNode())).collect(Collectors.toList()); - if(CollectionUtils.isEmpty(filteredRelations)){ + List<RequirementCapabilityRelDef> filteredRelations = relations.stream() + .filter(p -> componentInstance.getUniqueId().equals(p.getFromNode())).collect(Collectors.toList()); + if (CollectionUtils.isEmpty(filteredRelations)) { result = true; } else { - result = !filteredRelations.stream().filter(rel -> !addRequirement(component,componentInstance, originComponent, component.getComponentInstances(), rel, toscaRequirements)).findFirst().isPresent(); + result = !filteredRelations.stream().filter(rel -> !addRequirement(componentInstance, originComponent, + component.getComponentInstances(), rel, toscaRequirements)).findFirst().isPresent(); } return result; } - - private boolean addRequirement(Component component,ComponentInstance fromInstance, Component originComponent, List<ComponentInstance> instancesList, RequirementCapabilityRelDef rel, List<Map<String, ToscaTemplateRequirement>> toscaRequirements){ - + + private boolean addRequirement(ComponentInstance fromInstance, Component fromOriginComponent, + List<ComponentInstance> instancesList, RequirementCapabilityRelDef rel, + List<Map<String, ToscaTemplateRequirement>> toscaRequirements) { + boolean result = true; - Map<String,Component> originComponents = new HashMap<>(); - Map<String, List<RequirementDefinition>> reqMap = originComponent.getRequirements(); - RequirementAndRelationshipPair reqAndRelationshipPair = rel.getRelationships().get(0); + Map<String, List<RequirementDefinition>> reqMap = fromOriginComponent.getRequirements(); + RelationshipInfo reqAndRelationshipPair = rel.getRelationships().get(0).getRelation(); Either<Component, StorageOperationStatus> getOriginRes = null; Optional<RequirementDefinition> reqOpt = null; Component toOriginComponent = null; Optional<CapabilityDefinition> cap = null; - Either<String, Boolean> buildCapNameRes = null; - Either<String, Boolean> buildReqNameRes = null; - - ComponentInstance toInstance = instancesList.stream().filter(i -> rel.getToNode().equals(i.getUniqueId())).findFirst().orElse(null); + + ComponentInstance toInstance = instancesList.stream().filter(i -> rel.getToNode().equals(i.getUniqueId())) + .findFirst().orElse(null); if (toInstance == null) { - log.debug("Failed to find a relation from the node {} to the node {}", fromInstance.getName(), rel.getToNode()); + log.debug("Failed to find a relation from the node {} to the node {}", fromInstance.getName(), + rel.getToNode()); result = false; } - if(result){ - - if(component.getComponentType().equals(ComponentTypeEnum.SERVICE)) { - reqOpt = findRequirement(reqMap, reqAndRelationshipPair); - } - else { - reqOpt = findRequirement(reqMap, reqAndRelationshipPair.getRequirementUid()); - } - if(!reqOpt.isPresent()){ - log.debug("Failed to find a requirement with uniqueId {} on a component with uniqueId {}", reqAndRelationshipPair.getRequirementUid(), originComponent.getUniqueId()); + if (result) { + reqOpt = findRequirement(fromOriginComponent, reqMap, reqAndRelationshipPair, toInstance.getUniqueId()); + if (!reqOpt.isPresent()) { + log.debug("Failed to find a requirement with uniqueId {} on a component with uniqueId {}", + reqAndRelationshipPair.getRequirementUid(), fromOriginComponent.getUniqueId()); result = false; } } - if(result){ + if (result) { ComponentParametersView filter = new ComponentParametersView(true); filter.setIgnoreComponentInstances(false); filter.setIgnoreCapabilities(false); - getOriginRes = toscaOperationFacade.getToscaElement(toInstance.getComponentUid(), filter); - if(getOriginRes.isRight()){ - log.debug("Failed to build substituted name for the requirement {}. Failed to get an origin component with uniqueId {}", reqOpt.get().getName(), toInstance.getComponentUid()); + getOriginRes = toscaOperationFacade.getToscaElement(toInstance.getActualComponentUid(), filter); + if (getOriginRes.isRight()) { + log.debug("Failed to build substituted name for the requirement {}. Failed to get an origin component with uniqueId {}", + reqOpt.get().getName(), toInstance.getActualComponentUid()); result = false; } } - if(result){ + if (result) { toOriginComponent = getOriginRes.left().value(); - cap = toOriginComponent.getCapabilities().get(reqOpt.get().getCapability()).stream().filter(c -> c.getName().equals(reqAndRelationshipPair.getCapability())).findFirst(); - if(!cap.isPresent()){ - log.debug("Failed to find a capability with name {} on a component with uniqueId {}", reqAndRelationshipPair.getCapability(), originComponent.getUniqueId()); + cap = toOriginComponent.getCapabilities().get(reqOpt.get().getCapability()).stream() + .filter(c -> c.getName().equals(reqAndRelationshipPair.getCapability())).findFirst(); + if (!cap.isPresent()) { + cap = findCapability(reqMap, reqAndRelationshipPair, toOriginComponent, fromOriginComponent, reqOpt.get(), fromInstance); + if(!cap.isPresent()){ result = false; + log.debug("Failed to find a capability with name {} on a component with uniqueId {}", + reqAndRelationshipPair.getCapability(), fromOriginComponent.getUniqueId()); + } } } - if(result){ - buildCapNameRes = capabiltyRequirementConvertor.buildSubstitutedName(originComponents, toOriginComponent, cap.get().getPath(), reqAndRelationshipPair.getCapability()); - if(buildCapNameRes.isRight()){ - log.debug("Failed to build a substituted capability name for the capability with name {} on a component with uniqueId {}", reqAndRelationshipPair.getCapability(), originComponent.getUniqueId()); - result = false; - } + if (result) { + result = buildAndAddRequirement(toscaRequirements, fromOriginComponent, toOriginComponent, cap.get(), + reqOpt.get(), reqAndRelationshipPair, toInstance); } - if(result){ - buildReqNameRes = capabiltyRequirementConvertor.buildSubstitutedName(originComponents, originComponent, reqOpt.get().getPath(), reqAndRelationshipPair.getRequirement()); - if(buildReqNameRes.isRight()){ - log.debug("Failed to build a substituted requirement name for the requirement with name {} on a component with uniqueId {}", reqAndRelationshipPair.getRequirement(), originComponent.getUniqueId()); + return result; + } + + private Optional<CapabilityDefinition> findCapability(Map<String, List<RequirementDefinition>> reqMap, RelationshipInfo reqAndRelationshipPair, Component toOriginComponent, Component fromOriginComponent, RequirementDefinition requirement, ComponentInstance fromInstance) { + Optional<CapabilityDefinition> cap = Optional.empty(); + Optional<RequirementDefinition> findAny = reqMap.values().stream().flatMap(e -> e.stream()).filter(e -> e.getName().equals(reqAndRelationshipPair.getRequirement())).findAny(); + if (findAny.isPresent()) { + RequirementDefinition reqDefinition = findAny.get(); + cap = toOriginComponent.getCapabilities().get(requirement.getCapability()).stream().filter(c -> c.getType().equals(reqDefinition.getCapability())).findFirst(); + if (!cap.isPresent()) { + log.debug("Failed to find a capability with name {} on a component with uniqueId {}", reqAndRelationshipPair.getCapability(), fromOriginComponent.getUniqueId()); + } + } + return cap; + } + + private boolean buildAndAddRequirement(List<Map<String, ToscaTemplateRequirement>> toscaRequirements, Component fromOriginComponent, Component toOriginComponent, CapabilityDefinition capability, RequirementDefinition requirement, RelationshipInfo reqAndRelationshipPair, ComponentInstance toInstance) { + boolean result = true; + Either<String, Boolean> buildReqNameRes = null; + Either<String, Boolean> buildCapNameRes = capabiltyRequirementConvertor.buildSubstitutedName(originComponents, + toOriginComponent, capability.getPath(), reqAndRelationshipPair.getCapability()); + if (buildCapNameRes.isRight()) { + log.debug( + "Failed to build a substituted capability name for the capability with name {} on a component with uniqueId {}", + reqAndRelationshipPair.getCapability(), fromOriginComponent.getUniqueId()); + result = false; + } + if (result) { + buildReqNameRes = capabiltyRequirementConvertor.buildSubstitutedName(originComponents, fromOriginComponent, + requirement.getPath(), reqAndRelationshipPair.getRequirement()); + if (buildReqNameRes.isRight()) { + log.debug( + "Failed to build a substituted requirement name for the requirement with name {} on a component with uniqueId {}", + reqAndRelationshipPair.getRequirement(), fromOriginComponent.getUniqueId()); result = false; } } - if(result){ + if (result) { ToscaTemplateRequirement toscaRequirement = new ToscaTemplateRequirement(); Map<String, ToscaTemplateRequirement> toscaReqMap = new HashMap<>(); toscaRequirement.setNode(toInstance.getName()); @@ -1017,39 +1094,49 @@ public class ToscaExportHandler { return result; } - private Optional<RequirementDefinition> findRequirement(Map<String, List<RequirementDefinition>> reqMap, String reqId) { + private Optional<RequirementDefinition> findRequirement(Component fromOriginComponent, Map<String, List<RequirementDefinition>> reqMap, RelationshipInfo reqAndRelationshipPair, String toInstanceId) { for(List<RequirementDefinition> reqList: reqMap.values()){ - Optional<RequirementDefinition> reqOpt = reqList.stream().filter(r -> r.getUniqueId().equals(reqId)).findFirst(); + Optional<RequirementDefinition> reqOpt = reqList.stream().filter(r -> isRequirementBelongToRelation(fromOriginComponent, reqAndRelationshipPair, r, toInstanceId)).findFirst(); if(reqOpt.isPresent()){ return reqOpt; } } return Optional.empty(); } - - private Optional<RequirementDefinition> findRequirement(Map<String, List<RequirementDefinition>> reqMap, RequirementAndRelationshipPair reqAndRelationshipPair) { - for(List<RequirementDefinition> reqList: reqMap.values()){ - Optional<RequirementDefinition> reqOpt = reqList.stream().filter(r -> - isRequirmentBelongTo(reqAndRelationshipPair, r)) - .findFirst(); - if(reqOpt.isPresent()){ - return reqOpt; - } - } - return Optional.empty(); + + /** + * Allows detecting the requirement belonging to the received relationship + * The detection logic is: A requirement belongs to a relationship IF 1.The + * name of the requirement equals to the "requirement" field of the + * relation; AND 2. In case of a non-atomic resource, OwnerId of the + * requirement equals to requirementOwnerId of the relation OR uniqueId of + * toInstance equals to capabilityOwnerId of the relation + * + * @param fromOriginComponent + * @param reqAndRelationshipPair + * @param requirement + * @param toInstanceId + * @return + */ + private boolean isRequirementBelongToRelation(Component originComponent, RelationshipInfo reqAndRelationshipPair, RequirementDefinition requirement, String toInstanceId) { + if (!StringUtils.equals(requirement.getName(), reqAndRelationshipPair.getRequirement())) + return false; + if (!ModelConverter.isAtomicComponent(originComponent)) + return isRequirementBelongToOwner(reqAndRelationshipPair, requirement, toInstanceId); + return true; } - private boolean isRequirmentBelongTo(RequirementAndRelationshipPair reqAndRelationshipPair, RequirementDefinition r) { - return StringUtils.isNotEmpty(r.getOwnerId()) && r.getOwnerId().equals(reqAndRelationshipPair.getRequirementOwnerId()) - && StringUtils.isNotEmpty(r.getName()) && r.getName().equals(reqAndRelationshipPair.getRequirement()); + private boolean isRequirementBelongToOwner(RelationshipInfo reqAndRelationshipPair, RequirementDefinition requirement, String toInstanceId) { + return StringUtils.equals(requirement.getOwnerId(), reqAndRelationshipPair.getRequirementOwnerId()) || StringUtils.equals(toInstanceId, reqAndRelationshipPair.getCapabilityOwnerId()); } - private Either<SubstitutionMapping, ToscaError> convertCapabilities(Component component, SubstitutionMapping substitutionMappings) { - - Either<SubstitutionMapping, ToscaError> result = Either.left(substitutionMappings);; + private Either<SubstitutionMapping, ToscaError> convertCapabilities(Component component, + SubstitutionMapping substitutionMappings) { + + Either<SubstitutionMapping, ToscaError> result = Either.left(substitutionMappings); Either<Map<String, String[]>, ToscaError> toscaCapabilitiesRes = capabiltyRequirementConvertor .convertSubstitutionMappingCapabilities(originComponents, component); - if(toscaCapabilitiesRes.isRight()){ + if (toscaCapabilitiesRes.isRight()) { result = Either.right(toscaCapabilitiesRes.right().value()); log.error("Failed convert capabilities for the component {}. ", component.getName()); } else if (MapUtils.isNotEmpty(toscaCapabilitiesRes.left().value())) { @@ -1108,6 +1195,7 @@ public class ToscaExportHandler { } private class RepresentNull implements Represent { + @Override public Node representData(Object data) { // possible values are here http://yaml.org/type/null.html return representScalar(Tag.NULL, ""); @@ -38,7 +38,12 @@ public class ToscaMetadata implements IToscaMetadata { private Boolean serviceEcompNaming; private Boolean ecompGeneratedNaming; private String namingPolicy; - + private String sourceModelInvariant; + private String environmentContext; + private String sourceModelName; + private String sourceModelUuid; + + public String getName() { return name; } @@ -179,4 +184,37 @@ public class ToscaMetadata implements IToscaMetadata { this.customizationUUID = customizationUUID; } + public String getSourceModelInvariant() { + return sourceModelInvariant; + } + + public void setSourceModelInvariant(String sourceModelInvariant) { + this.sourceModelInvariant = sourceModelInvariant; + } + + public String getSourceModelName() { + return sourceModelName; + } + + public void setSourceModelName(String sourceModelName) { + this.sourceModelName = sourceModelName; + } + + public String getSourceModelUuid() { + return sourceModelUuid; + } + + public void setSourceModelUuid(String sourceModelUuid) { + this.sourceModelUuid = sourceModelUuid; + } + + + + public String getEnvironmentContext() { + return environmentContext; + } + + public void setEnvironmentContext(String environmentContext) { + this.environmentContext = environmentContext; + } } @@ -34,7 +34,6 @@ import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; import org.openecomp.sdc.be.dao.titan.TitanGenericDao; import org.openecomp.sdc.be.dao.utils.UserStatusEnum; -import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.LifecycleStateEnum; import org.openecomp.sdc.be.model.User; @@ -20,16 +20,16 @@ package org.openecomp.sdc.common.transaction.mngr; -import fj.P; -import fj.data.Either; -import fj.data.HashMap; -import fj.data.List; - import org.openecomp.sdc.common.transaction.api.RollbackHandler; import org.openecomp.sdc.common.transaction.api.TransactionUtils.DBActionCodeEnum; import org.openecomp.sdc.common.transaction.api.TransactionUtils.DBTypeEnum; import org.openecomp.sdc.common.util.MethodActivationStatusEnum; +import fj.P; +import fj.data.Either; +import fj.data.HashMap; +import fj.data.List; + public class RollbackManager { private final HashMap<DBTypeEnum, RollbackHandler> rollbackHandlersMap; private final Integer transactionId; @@ -22,6 +22,7 @@ org.openecomp.sdc.be.impl, org.openecomp.sdc.be.auditing.impl, org.openecomp.sdc.be.components.impl, + org.openecomp.sdc.be.components.merge, org.openecomp.sdc.be.components.distribution.engine, org.openecomp.sdc.be.distribution, org.openecomp.sdc.be.components.clean, @@ -21,9 +21,9 @@ beProtocol: http # catalog backend ssl port beSslPort: 8443 -version: 1.0 +version: 1.1.0 released: 2012-11-30 -toscaConformanceLevel: 4.0 +toscaConformanceLevel: 5.0 minToscaConformanceLevel: 3.0 titanCfgFile: /home/vagrant/catalog-be/config/catalog-be/titan.properties @@ -575,6 +575,12 @@ onboarding: downloadCsarUri: "/onboarding-api/v1.0/vendor-software-products/packages" healthCheckUri: "/onboarding-api/v1.0/healthcheck" +dcae: + protocol: http + host: 127.0.0.1 + port: 8080 + healthCheckUri: "/dcae/healthCheck" + switchoverDetector: gBeFqdn: AIO-BE.ecomp.idns.cip.com gFeFqdn: AIO-FE.ecomp.idns.cip.com @@ -637,3 +643,22 @@ genericAssetNodeTypes: VF : org.openecomp.resource.abstract.nodes.VF PNF: org.openecomp.resource.abstract.nodes.PNF Service: org.openecomp.resource.abstract.nodes.service + +workloadContext: Production +environmentContext: + defaultValue: General_Revenue-Bearing + validValues: + - Critical_Revenue-Bearing + - Vital_Revenue-Bearing + - Essential_Revenue-Bearing + - Important_Revenue-Bearing + - Needed_Revenue-Bearing + - Useful_Revenue-Bearing + - General_Revenue-Bearing + - Critical_Non-Revenue + - Vital_Non-Revenue + - Essential_Non-Revenue + - Important_Non-Revenue + - Needed_Non-Revenue + - Useful_Non-Revenue + - General_Non-Revenue @@ -1851,4 +1851,30 @@ errors: code: 400, message: 'Error: VSP %1 cannot be imported. The VSP contains internal loop in VFC %2', messageId: "SVC4671" + } +#---------SVC4672------------------------------ +# %1 - capability uniqueId +# %2 - instance uniqueId +# %3 - container uniqueId + CAPABILITY_OF_INSTANCE_NOT_FOUND_ON_CONTAINER: { + code: 404, + message: "Error: Requested capability %1 of instance %2 was not found on the container %3.", + messageId: "SVC4672" + } +#---------SVC4673------------------------------ +# %1 - requirement uniqueId +# %2 - instance uniqueId +# %3 - container uniqueId + REQUIREMENT_OF_INSTANCE_NOT_FOUND_ON_CONTAINER: { + code: 404, + message: "Error: Requested requirement %1 of instance %2 was not found on the container %3.", + messageId: "SVC4673" + } +#---------SVC4674----------------------------- +# %1 - relation Id +# %2 - container uniqueId + RELATION_NOT_FOUND: { + code: 404, + message: "Error: Requested relation %1 was not found on the container %2.", + messageId: "SVC4674" }
\ No newline at end of file @@ -27,6 +27,11 @@ tosca.capabilities.Container: required: false constraints: - greater_or_equal: 0 MB +org.openecomp.capabilities.PortMirroring: + derived_from: tosca.capabilities.Root + properties: + connection_point: + type: org.openecomp.datatypes.PortMirroringConnectionPointDescription tosca.capabilities.Endpoint: derived_from: tosca.capabilities.Root properties: Binary files differ@@ -99,6 +99,12 @@ resources: VirtualLinks: name: "Virtual Links" icons: ['vl'] + Configuration: + name: "Configuration" + subcategories: + Configuraion: + name: "Configuration" + icons: ['pmc'] DcaeComponent: name: "DCAE Component" subcategories: @@ -123,6 +129,9 @@ resources: Policy: name: "Policy" icons: ['dcae_policy'] + MachineLearning: + name: "Machine Learning" + icons: ['dcae_machineLearning'] Template: name: "Template" subcategories: Binary files differ@@ -55,6 +55,18 @@ tosca.datatypes.Credential: type: string required: false +org.openecomp.datatypes.PortMirroringConnectionPointDescription: + derived_from: tosca.datatypes.Root + properties: + nf_type: + type: string + nfc_type: + type: string + network_role: + type: string + pps_capacity: + type: string + tosca.datatypes.TimeInterval: derived_from: tosca.datatypes.Root properties: @@ -348,6 +360,11 @@ org.openecomp.datatypes.heat.neutron.port.FixedIps: description: IP address desired in the subnet for this port required: false status: SUPPORTED + subnet_id: + type: string + description: Subnet in which to allocate the IP address for this port + required: false + status: SUPPORTED org.openecomp.datatypes.heat.FileInfo: derived_from: tosca.datatypes.Root Binary files differ@@ -23,5 +23,6 @@ node_types: type: integer max_instances: type: integer - -
\ No newline at end of file + multi_stage_design: + type: boolean + default: false
\ No newline at end of file Binary files differ@@ -0,0 +1,21 @@ +{ + "payloadName": "extContrailCP.yml", + "contactId": "DS200P", + "name": "extContrailCP", + "description": "The AT&T Connection Point base type all other CP derive from", + "resourceIconPath": "network", + "resourceType": "CP", + "categories": [ + { + "name": "Generic", + "subcategories": [ + { + "name": "Network Elements" + } + ] + } +], + "tags": [ + "extContrailCP" + ] +} @@ -0,0 +1,59 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +node_types: + org.openecomp.resource.cp.v2.extContrailCP: + derived_from: org.openecomp.resource.cp.v2.extCP + properties: + # copied from the org.openecomp.resource.cp.nodes.heat.network.contrail.Port type + static_routes: + type: list + description: An ordered list of static routes to be added to this interface + required: false + status: SUPPORTED + entry_schema: + type: org.openecomp.datatypes.heat.network.contrail.port.StaticRoute + virtual_network: + type: string + description: Virtual Network for this interface + required: true + status: SUPPORTED + static_route: + type: boolean + description: Static route enabled + required: false + default: false + status: SUPPORTED + allowed_address_pairs: + type: list + description: List of allowed address pair for this interface + required: false + status: SUPPORTED + entry_schema: + type: org.openecomp.datatypes.heat.network.contrail.AddressPair + shared_ip: + type: boolean + description: Shared ip enabled + required: false + default: false + status: SUPPORTED + ip_address: + type: string + description: IP for this interface + required: false + status: SUPPORTED + interface_type: + type: string + description: Interface type + required: true + status: SUPPORTED + constraints: + - valid_values: + - management + - left + - right + - other + attributes: + # copied from the org.openecomp.resource.cp.nodes.heat.network.contrail.Port type + fq_name: + type: string + description: fq_name + status: SUPPORTED Binary files differ@@ -0,0 +1,21 @@ +{ + "payloadName": "extCP.yml", + "contactId": "DS200P", + "name": "ExtCP2", + "description": "The AT&T Connection Point base type all other CP derive from", + "resourceIconPath": "network", + "resourceType": "CP", + "categories": [ + { + "name": "Generic", + "subcategories": [ + { + "name": "Network Elements" + } + ] + } +], + "tags": [ + "ExtCP2" + ] +} @@ -0,0 +1,8 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +node_types: + org.openecomp.resource.cp.v2.extCP: + derived_from: org.openecomp.resource.cp.nodes.network.Port + description: The SDC External Connection Point base type + capabilities: + port_mirroring: + type: org.openecomp.capabilities.PortMirroring
\ No newline at end of file Binary files differ@@ -0,0 +1,21 @@ +{ + "payloadName": "extNeutronCP.yml", + "contactId": "DS200P", + "name": "extNeutronCP", + "description": "The AT&T Connection Point base type all other CP derive from", + "resourceIconPath": "network", + "resourceType": "CP", + "categories": [ + { + "name": "Generic", + "subcategories": [ + { + "name": "Network Elements" + } + ] + } +], + "tags": [ + "extNeutronCP" + ] +} @@ -0,0 +1,140 @@ + +tosca_definitions_version: tosca_simple_yaml_1_0_0 +node_types: + org.openecomp.resource.cp.v2.extNeutronCP: + derived_from: org.openecomp.resource.cp.v2.extCP + properties: + # copied from the org.openecomp.resource.cp.nodes.heat.network.neutron.Port type + 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: + # copied from the org.openecomp.resource.cp.nodes.heat.network.neutron.Port type + 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: + # copied from the org.openecomp.resource.cp.nodes.heat.network.neutron.Port type + attachment: + type: tosca.capabilities.Attachment + occurrences: + - 1 + - UNBOUNDED + binding: + type: tosca.capabilities.network.Bindable + valid_source_types: + - org.openecomp.resource.cp.nodes.heat.network.contrailV2.VLANSubInterface + occurrences: + - 0 + - UNBOUNDED
\ No newline at end of file Binary files differ@@ -10,7 +10,7 @@ node_types: description: ECOMP supported network types. network_role: type: string - required: ture + required: true description: > Unique label that defines the role that this network performs. example: vce oam network, vnat sr-iov1 network Binary files differ@@ -0,0 +1,21 @@ +{ + "payloadName": "portMirroring.yml", + "contactId": "jh0003", + "name": "Port Mirroring Configuration", + "description": "A port mirroring configuration object", + "resourceIconPath": "pmc", + "resourceType": "Configuration", + "categories": [ + { + "name": "Configuration", + "subcategories": [ + { + "name": "Configuration" + } + ] + } +], + "tags": [ + "Port Mirroring Configuration" + ] +}
\ No newline at end of file @@ -0,0 +1,11 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +node_types: + org.openecomp.nodes.PortMirroringConfiguration: + derived_from: tosca.nodes.Root + requirements: + - source: + capability: org.openecomp.capabilities.PortMirroring + occurrences: [1,UNBOUNDED] + - collector: + capability: org.openecomp.capabilities.PortMirroring + occurrences: [1,1]
\ No newline at end of file Binary files differ@@ -0,0 +1,21 @@ +{ + "payloadName": "portMirroringByPolicy.yml", + "contactId": "jh0003", + "name": "Port Mirroring Configuration By Policy", + "description": "A port mirroring configuration by policy object", + "resourceIconPath": "pmc", + "resourceType": "Configuration", + "categories": [ + { + "name": "Configuration", + "subcategories": [ + { + "name": "Configuration" + } + ] + } +], + "tags": [ + "Port Mirroring Configuration By Policy" + ] +}
\ No newline at end of file @@ -0,0 +1,26 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +node_types: + org.openecomp.nodes.PortMirroringConfigurationByPolicy: + derived_from: tosca.nodes.Root + properties: + collector_node: + type: string + description: The name of the Collector Proxy + required: true + policy_name: + type: string + description: The name of the policy for selection of the collector interfaces + required: true + equip_model: + type: string + description: The name of the equipment type of the collector, i.e. Cisco 4500x + required: true + equip_vendor: + type: string + description: The name of the equipment vendor of the collector, i.e. Cisco + required: true + requirements: + - source: + capability: org.openecomp.capabilities.PortMirroring + occurrences: [1,UNBOUNDED] + Binary files differ@@ -0,0 +1,21 @@ +{ + "payloadName": "serviceProxy.yml", + "contactId": "jh0003", + "name": "serviceProxy", + "description": "Represents a proxy to a service VFC.", + "resourceIconPath": "defaulticon", + "resourceType": "ServiceProxy", + "categories": [ + { + "name": "Generic", + "subcategories": [ + { + "name": "Abstract" + } + ] + } +], + "tags": [ + "serviceProxy" + ] +}
\ No newline at end of file @@ -0,0 +1,4 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +node_types: + org.openecomp.nodes.ServiceProxy: + derived_from: tosca.nodes.Root
\ No newline at end of file Binary files differ@@ -42,6 +42,8 @@ def importHeatTypes(beHost, bePort, adminUser, fileDir, updateversion): "Generic_Service", "contrailNetworkRules", "contrailPort", + "portMirroring", + "serviceProxy", "contrailV2NetworkRules", "contrailV2VirtualNetwork", "securityRules", @@ -52,9 +54,10 @@ def importHeatTypes(beHost, bePort, adminUser, fileDir, updateversion): "contrailV2VLANSubInterface", "multiFlavorVFC", "vnfConfiguration", - "underlayVpn", - "overlayTunnel", - "genericNeutronNet" + "extCp2", + "extNeutronCP", + "extContrailCP", + "portMirroringByPolicy" ] responseCodes = [200, 201] @@ -122,11 +122,7 @@ def main(argv): fileLocation = baseFileLocation + "heat-types/" resultsHeat = importHeatTypes(beHost, bePort, adminUser, fileLocation, updateversion) handleResults(resultsHeat, updateversion) - - fileLocation = baseFileLocation + "onap-types/" - resultsHeat = importOnapTypes(beHost, bePort, adminUser, fileLocation, updateversion) - handleResults(resultsHeat, updateversion) - + fileLocation = baseFileLocation + "group-types/" importGroupTypes(beHost, bePort, adminUser, False, fileLocation) @@ -0,0 +1,140 @@ +import pycurl +import sys, getopt, os +from StringIO import StringIO +import json +import copy +import time +#from importNormativeElements import createNormativeElement +from importNormativeElements import * +from importNormativeTypes import importNormativeTypes +from importHeatTypes import importHeatTypes +from importOnapTypes import importOnapTypes +from importNormativeCapabilities import importNormativeCapabilities +from importCategoryTypes import importCategories +from importNormativeInterfaceLifecycleTypes import importNormativeInterfaceLifecycleType +from importDataTypes import importDataTypes +from importGroupTypes import importGroupTypes +from importPolicyTypes import importPolicyTypes +from importCommon import * +import importCommon + +################################################################################################################################################################################################# +# # +# Import all users from a given file # +# # +# activation : # +# python importNormativeAll.py [-i <be host> | --ip=<be host>] [-p <be port> | --port=<be port> ] [-u <user userId> | --user=<user userId> ] [-d <true|false> | --debug=<true|false>] # +# [-v <true|false> | --updateversion=<true|false>] # +# # +# shortest activation (be host = localhost, be port = 8080, user = jh0003): # # # +# python importNormativeAll.py # +# # +################################################################################################################################################################################################# + +def usage(): + print sys.argv[0], '[-i <be host> | --ip=<be host>] [-p <be port> | --port=<be port> ] [-u <user userId> | --user=<user userId> ] [-d <true|false> | --debug=<true|false>] [-v <true|false> | --updateversion=<true|false>]' + +def handleResults(results, updateversion): + printFrameLine() + for result in results: + printNameAndReturnCode(result[0], result[1]) + printFrameLine() + + responseCodes = [200, 201] + + if(updateversion == 'false'): + responseCodes = [200, 201, 409] + + failedResults = filter(lambda x: x[1] == None or x[1] not in responseCodes, results) + if (len(failedResults) > 0): + errorAndExit(1, None) + +def main(argv): + print 'Number of arguments:', len(sys.argv), 'arguments.' + + beHost = 'localhost' + bePort = '8080' + adminUser = 'jh0003' + debugf = None + updateversion = 'true' + importCommon.debugFlag = False + + try: + opts, args = getopt.getopt(argv,"i:p:u:d:v:h",["ip=","port=","user=","debug=","updateversion="]) + except getopt.GetoptError: + usage() + errorAndExit(2, 'Invalid input') + + for opt, arg in opts: + #print opt, arg + if opt == '-h': + usage() + sys.exit(3) + elif opt in ("-i", "--ip"): + beHost = arg + elif opt in ("-p", "--port"): + bePort = arg + elif opt in ("-u", "--user"): + adminUser = arg + elif opt in ("-d", "--debug"): + print arg + debugf = bool(arg.lower() == "true" or arg.lower() == "yes") + elif opt in ("-v", "--updateversion"): + print arg + if (arg.lower() == "false" or arg.lower() == "no"): + updateversion = 'false' + + print 'be host =',beHost,', be port =', bePort,', user =', adminUser, ', debug =', debugf, ', updateversion =', updateversion + + if (debugf != None): + print 'set debug mode to ' + str(debugf) + importCommon.debugFlag = debugf + + if ( beHost == None ): + usage() + sys.exit(3) + + print sys.argv[0] + pathdir = os.path.dirname(os.path.realpath(sys.argv[0])) + debug("path dir =" + pathdir) + + baseFileLocation = pathdir + "/../../../import/tosca/" + + fileLocation = baseFileLocation + "data-types/" + importDataTypes(beHost, bePort, adminUser, False, fileLocation) + + print 'sleep until data type cache is updated' + time.sleep( 70 ) + + fileLocation = baseFileLocation + "capability-types/" + importNormativeCapabilities(beHost, bePort, adminUser, False, fileLocation) + + fileLocation = baseFileLocation + "interface-lifecycle-types/" + importNormativeInterfaceLifecycleType(beHost, bePort, adminUser, False, fileLocation) + + fileLocation = baseFileLocation + "categories/" + importCategories(beHost, bePort, adminUser, False, fileLocation) + + fileLocation = baseFileLocation + "normative-types/" + results = importNormativeTypes(beHost, bePort, adminUser, fileLocation, updateversion) + handleResults(results, updateversion) + + fileLocation = baseFileLocation + "heat-types/" + resultsHeat = importHeatTypes(beHost, bePort, adminUser, fileLocation, updateversion) + handleResults(resultsHeat, updateversion) + + fileLocation = baseFileLocation + "onap-types/" + resultsHeat = importOnapTypes(beHost, bePort, adminUser, fileLocation, updateversion) + handleResults(resultsHeat, updateversion) + + fileLocation = baseFileLocation + "group-types/" + importGroupTypes(beHost, bePort, adminUser, False, fileLocation) + + fileLocation = baseFileLocation + "policy-types/" + importPolicyTypes(beHost, bePort, adminUser, False, fileLocation) + + errorAndExit(0, None) + +if __name__ == "__main__": + main(sys.argv[1:]) + @@ -1,54 +1,20 @@ { "heat": [ - "globalNetwork", - "globalPort", - "globalCompute", - "volume", - "cinderVolume", - "contrailVirtualNetwork", - "neutronNet", - "neutronPort", - "novaServer", - "extVl", - "internalVl", - "extCp", - "vl", - "eline", - "abstractSubstitute", - "Generic_VFC", - "Generic_VF", - "Generic_PNF", - "Generic_Service", - "contrailNetworkRules", "contrailPort", - "contrailV2NetworkRules", - "contrailV2VirtualNetwork", - "securityRules", - "contrailAbstractSubstitute", - "contrailCompute", + "extCp", "contrailV2VirtualMachineInterface", - "subInterface", - "contrailV2VLANSubInterface", - "multiFlavorVFC", - "vnfConfiguration", - "underlayVpn", - "overlayTunnel", - "genericNeutronNet" + "neutronPort", + "Generic_PNF", + "portMirroring", + "Generic_VF", + "serviceProxy", + "extCp2", + "extContrailCP", + "vnfConfiguration", + "extVl", + "multiFlavorVFC", + "portMirroringByPolicy" ], "normative": [ - "root", - "compute", - "softwareComponent", - "webServer", - "webApplication", - "DBMS", - "database", - "objectStorage", - "blockStorage", - "containerRuntime", - "containerApplication", - "loadBalancer", - "port", - "network" ] }
\ No newline at end of file @@ -114,10 +114,6 @@ def main(argv): resultsHeat = upgradeTypesPerConfigFile(beHost, bePort, adminUser, baseFileLocation, updateversion) handleResults(resultsHeat, 'false') - fileLocation = baseFileLocation + "onap-types/" - resultsHeat = importOnapTypes(beHost, bePort, adminUser, fileLocation, updateversion) - handleResults(resultsHeat, updateversion) - errorAndExit(0, None) if __name__ == "__main__": @@ -0,0 +1,124 @@ +import pycurl +import sys, getopt, os +from StringIO import StringIO +import json +import copy +import time +from importCategoryTypes import importCategories +from upgradeHeatAndNormativeTypes import upgradeTypesPerConfigFile +from importDataTypes import importDataTypes +from importPolicyTypes import importPolicyTypes +from importGroupTypes import importGroupTypes +from importNormativeCapabilities import importNormativeCapabilities +from importNormativeInterfaceLifecycleTypes import importNormativeInterfaceLifecycleType +from importOnapTypes import importOnapTypes + + +from importCommon import * +import importCommon + +################################################################################################################################################################################################# +# # +# Upgrades the normative types # +# # +# activation : # +# python upgradeNormative.py [-i <be host> | --ip=<be host>] [-p <be port> | --port=<be port> ] [-u <user userId> | --user=<user userId> ] [-d <true|false> | --debug=<true|false>] # +# # +# # +# shortest activation (be host = localhost, be port = 8080, user = jh0003): # # # +# python upgradeNormative.py # +# # +################################################################################################################################################################################################# + +def usage(): + print sys.argv[0], '[-i <be host> | --ip=<be host>] [-p <be port> | --port=<be port> ] [-u <user userId> | --user=<user userId> ] [-d <true|false> | --debug=<true|false>]' + +def handleResults(results, updateversion): + printFrameLine() + for result in results: + printNameAndReturnCode(result[0], result[1]) + printFrameLine() + + failedResults = filter(lambda x: x[1] == None or x[1] not in [200, 201, 409], results) + if (len(failedResults) > 0): + errorAndExit(1, None) + +def main(argv): + print 'Number of arguments:', len(sys.argv), 'arguments.' + + beHost = 'localhost' + bePort = '8080' + adminUser = 'jh0003' + debugf = None + updateversion = 'true' + importCommon.debugFlag = False + + try: + opts, args = getopt.getopt(argv,"i:p:u:d:h",["ip=","port=","user=","debug="]) + except getopt.GetoptError: + usage() + errorAndExit(2, 'Invalid input') + + for opt, arg in opts: + #print opt, arg + if opt == '-h': + usage() + sys.exit(3) + elif opt in ("-i", "--ip"): + beHost = arg + elif opt in ("-p", "--port"): + bePort = arg + elif opt in ("-u", "--user"): + adminUser = arg + elif opt in ("-d", "--debug"): + print arg + debugf = bool(arg.lower() == "true" or arg.lower() == "yes") + + print 'be host =',beHost,', be port =', bePort,', user =', adminUser, ', debug =', debugf + + if (debugf != None): + print 'set debug mode to ' + str(debugf) + importCommon.debugFlag = debugf + + if ( beHost == None ): + usage() + sys.exit(3) + + print sys.argv[0] + pathdir = os.path.dirname(os.path.realpath(sys.argv[0])) + debug("path dir =" + pathdir) + + baseFileLocation = pathdir + "/../../../import/tosca/" + + fileLocation = baseFileLocation + "categories/" + importCategories(beHost, bePort, adminUser, False, fileLocation) + + fileLocation = baseFileLocation + "data-types/" + importDataTypes(beHost, bePort, adminUser, False, fileLocation) + + fileLocation = baseFileLocation + "policy-types/" + importPolicyTypes(beHost, bePort, adminUser, False, fileLocation) + + fileLocation = baseFileLocation + "group-types/" + importGroupTypes(beHost, bePort, adminUser, False, fileLocation) + + fileLocation = baseFileLocation + "capability-types/" + importNormativeCapabilities(beHost, bePort, adminUser, False, fileLocation) + + fileLocation = baseFileLocation + "interface-lifecycle-types/" + importNormativeInterfaceLifecycleType(beHost, bePort, adminUser, False, fileLocation) + + print 'sleep until data type cache is updated' + time.sleep( 70 ) + + resultsHeat = upgradeTypesPerConfigFile(beHost, bePort, adminUser, baseFileLocation, updateversion) + handleResults(resultsHeat, 'false') + + fileLocation = baseFileLocation + "onap-types/" + resultsHeat = importOnapTypes(beHost, bePort, adminUser, fileLocation, updateversion) + handleResults(resultsHeat, updateversion) + + errorAndExit(0, None) + +if __name__ == "__main__": + main(sys.argv[1:]) @@ -21,8 +21,6 @@ package org.openecomp.sdc; import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.FileInputStream; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; @@ -0,0 +1,40 @@ +package org.openecomp.sdc.be; + +import static org.mockito.Mockito.mock; + +import org.openecomp.sdc.be.config.Configuration; +import org.openecomp.sdc.be.config.ConfigurationManager; +import org.openecomp.sdc.be.config.DistributionEngineConfiguration; +import org.openecomp.sdc.common.api.ConfigurationListener; +import org.openecomp.sdc.common.api.ConfigurationSource; + +public class DummyConfigurationManager { + + private DistributionEngineConfiguration distributionConfigurationMock = mock(DistributionEngineConfiguration.class); + private Configuration configurationMock = mock(Configuration.class); + + public DummyConfigurationManager() { + new ConfigurationManager(new DummyConfigurationSource()); + } + + public class DummyConfigurationSource implements ConfigurationSource { + + @SuppressWarnings("unchecked") + @Override + public <T> T getAndWatchConfiguration(Class<T> className, ConfigurationListener configurationListener) { + if (className.equals(DistributionEngineConfiguration.class)) { + return (T) distributionConfigurationMock; + } + if (className.equals(Configuration.class)) { + return (T) configurationMock; + } + return null; + } + + @Override + public <T> void addWatchConfiguration(Class<T> className, ConfigurationListener configurationListener) { + + } + } + +} @@ -25,8 +25,6 @@ import static org.mockito.Mockito.when; import java.util.EnumMap; import java.util.UUID; -import junit.framework.Assert; - import org.junit.Before; import org.junit.Test; import org.mockito.InjectMocks; @@ -38,10 +36,8 @@ import org.openecomp.sdc.be.dao.impl.AuditingDao; import org.openecomp.sdc.common.api.Constants; import org.openecomp.sdc.common.datastructure.AuditingFieldsKeysEnum; import org.openecomp.sdc.common.util.ThreadLocalsHolder; -import org.slf4j.LoggerFactory; -import ch.qos.logback.classic.Level; -import ch.qos.logback.classic.Logger; +import junit.framework.Assert; public class AuditingManagerTest extends BaseConfDependentTest{ @@ -20,49 +20,108 @@ package org.openecomp.sdc.be.components; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.Mockito.when; + +import java.util.HashMap; import java.util.List; +import java.util.Map; +import org.junit.BeforeClass; import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.runners.MockitoJUnitRunner; +import org.openecomp.sdc.be.DummyConfigurationManager; +import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic; import org.openecomp.sdc.be.components.impl.ComponentBusinessLogic; import org.openecomp.sdc.be.components.impl.ComponentInstanceBusinessLogic; +import org.openecomp.sdc.be.components.utils.ResourceBuilder; +import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; +import org.openecomp.sdc.be.model.ArtifactDefinition; import org.openecomp.sdc.be.model.ComponentInstance; +import org.openecomp.sdc.be.model.Resource; +import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.ui.model.UiComponentDataTransfer; +import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum; import org.openecomp.sdc.exception.ResponseFormat; import fj.data.Either; +@RunWith(MockitoJUnitRunner.class) public class ComponentBusinessLogicTest { - ComponentBusinessLogic businessLogic = new ComponentBusinessLogic() { + private static final User USER = new User(); + private static final String ARTIFACT_LABEL = "toscaArtifact1"; + private static final String ARTIFACT_LABEL2 = "toscaArtifact2"; + + @InjectMocks + private ComponentBusinessLogic testInstance = new ComponentBusinessLogic() { @Override public Either<List<String>, ResponseFormat> deleteMarkedComponents() { - // TODO Auto-generated method stub return null; } @Override public ComponentInstanceBusinessLogic getComponentInstanceBL() { - // TODO Auto-generated method stub return null; } @Override public Either<List<ComponentInstance>, ResponseFormat> getComponentInstancesFilteredByPropertiesAndInputs(String componentId, ComponentTypeEnum componentTypeEnum, String userId, String searchText) { - // TODO Auto-generated method stub return null; } @Override public Either<UiComponentDataTransfer, ResponseFormat> getUiComponentDataTransferByComponentId(String componentId, List<String> dataParamsToReturn) { - // TODO Auto-generated method stub return null; } }; + @Mock + private ArtifactsBusinessLogic artifactsBusinessLogic; + + @BeforeClass + public static void setUp() throws Exception { + new DummyConfigurationManager(); + } + + @SuppressWarnings("unchecked") @Test - public void testGetRequirementsAndCapabilities() { - // businessLogic.getRequirementsAndCapabilities(componentId, - // componentTypeEnum); + public void setToscaArtifactsPlaceHolders_normalizeArtifactName() throws Exception { + Resource resource = new ResourceBuilder().setUniqueId("uid") + .setComponentType(ComponentTypeEnum.RESOURCE) + .setSystemName("myResource") + .build(); + Map<String, Object> artifactsFromConfig = new HashMap<>(); + artifactsFromConfig.put(ARTIFACT_LABEL, buildArtifactMap("artifact:not normalized.yml")); + artifactsFromConfig.put(ARTIFACT_LABEL2, buildArtifactMap("alreadyNormalized.csar")); + when(ConfigurationManager.getConfigurationManager().getConfiguration().getToscaArtifacts()).thenReturn(artifactsFromConfig); + when(artifactsBusinessLogic.createArtifactPlaceHolderInfo(resource.getUniqueId(), ARTIFACT_LABEL, (Map<String, Object>) artifactsFromConfig.get(ARTIFACT_LABEL), USER, ArtifactGroupTypeEnum.TOSCA)) + .thenReturn(buildArtifactDef(ARTIFACT_LABEL)); + when(artifactsBusinessLogic.createArtifactPlaceHolderInfo(resource.getUniqueId(), ARTIFACT_LABEL2, (Map<String, Object>) artifactsFromConfig.get(ARTIFACT_LABEL2), USER, ArtifactGroupTypeEnum.TOSCA)) + .thenReturn(buildArtifactDef(ARTIFACT_LABEL2)); + testInstance.setToscaArtifactsPlaceHolders(resource, USER); + + Map<String, ArtifactDefinition> toscaArtifacts = resource.getToscaArtifacts(); + assertThat(toscaArtifacts).hasSize(2); + ArtifactDefinition artifactDefinition = toscaArtifacts.get(ARTIFACT_LABEL); + assertThat(artifactDefinition.getArtifactName()).isEqualTo("resource-myResourceartifactnot-normalized.yml"); + ArtifactDefinition artifactDefinition2 = toscaArtifacts.get(ARTIFACT_LABEL2); + assertThat(artifactDefinition2.getArtifactName()).isEqualTo("resource-myResourcealreadyNormalized.csar"); + } + + private Map<String, Object> buildArtifactMap(String artifactName) { + Map<String, Object> artifact = new HashMap<>(); + artifact.put("artifactName", artifactName); + return artifact; + } + + private ArtifactDefinition buildArtifactDef(String artifactLabel) { + ArtifactDefinition artifactDefinition = new ArtifactDefinition(); + artifactDefinition.setArtifactLabel(artifactLabel); + return artifactDefinition; } } @@ -20,15 +20,8 @@ package org.openecomp.sdc.be.components; -import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.when; -import java.lang.reflect.Method; -import java.util.Arrays; -import java.util.EnumMap; -import java.util.List; -import java.util.Map; - import javax.servlet.ServletContext; import org.junit.Before; @@ -43,8 +36,6 @@ import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.GroupDefinition; -import org.openecomp.sdc.be.model.GroupProperty; -import org.openecomp.sdc.be.model.PropertyDefinition.PropertyNames; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.model.operations.api.IGraphLockOperation; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; @@ -53,11 +44,8 @@ import org.openecomp.sdc.common.api.ConfigurationSource; import org.openecomp.sdc.common.api.Constants; import org.openecomp.sdc.common.impl.ExternalConfiguration; import org.openecomp.sdc.common.impl.FSConfigurationSource; -import org.openecomp.sdc.exception.ResponseFormat; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - -import fj.data.Either; /** * tests GroupBusinessLogic class * @author ns019t @@ -20,28 +20,17 @@ package org.openecomp.sdc.be.components; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + import java.util.ArrayList; import java.util.List; -import javax.annotation.Resource; - import org.junit.Test; import org.openecomp.sdc.be.components.impl.HealthCheckBusinessLogic; -import org.openecomp.sdc.be.dao.cassandra.schema.SdcSchemaUtils; -import org.openecomp.sdc.be.dao.titan.TitanGenericDao; -import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; -import org.openecomp.sdc.be.dao.utils.UserStatusEnum; -import org.openecomp.sdc.be.resources.data.UserData; +import org.openecomp.sdc.common.api.Constants; import org.openecomp.sdc.common.api.HealthCheckInfo; -import org.openecomp.sdc.common.api.HealthCheckInfo.HealthCheckComponent; import org.openecomp.sdc.common.api.HealthCheckInfo.HealthCheckStatus; - -import com.datastax.driver.core.Cluster; - -import fj.data.Either; - -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.assertFalse; public class HealthCheckBusinessLogicTest { HealthCheckBusinessLogic healthCheckBusinessLogic = new HealthCheckBusinessLogic(); @@ -58,8 +47,8 @@ public class HealthCheckBusinessLogicTest { statusChanged = healthCheckBusinessLogic.anyStatusChanged(checkInfosLeft, checkInfosRight); assertFalse("check false", statusChanged); - HealthCheckInfo checkInfoTitanUp = new HealthCheckInfo(HealthCheckComponent.TITAN, HealthCheckStatus.UP, null, null); - HealthCheckInfo checkInfoTitanDown = new HealthCheckInfo(HealthCheckComponent.TITAN, HealthCheckStatus.DOWN, null, null); + HealthCheckInfo checkInfoTitanUp = new HealthCheckInfo(Constants.HC_COMPONENT_TITAN, HealthCheckStatus.UP, null, null); + HealthCheckInfo checkInfoTitanDown = new HealthCheckInfo(Constants.HC_COMPONENT_TITAN, HealthCheckStatus.DOWN, null, null); /* * HealthCheckInfo checkInfoUebUp = new HealthCheckInfo(HealthCheckComponent.DE, HealthCheckStatus.UP, null, null); HealthCheckInfo checkInfoUebDown = new HealthCheckInfo(HealthCheckComponent.DE, HealthCheckStatus.DOWN, null, null); @@ -20,10 +20,17 @@ package org.openecomp.sdc.be.components; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import fj.data.Either; -import junit.framework.Assert; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.when; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +import javax.servlet.ServletContext; + import org.junit.Before; import org.junit.Test; import org.mockito.InjectMocks; @@ -41,7 +48,6 @@ import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.IPropertyOperation; -import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.resources.data.EntryData; import org.openecomp.sdc.be.user.Role; import org.openecomp.sdc.be.user.UserBusinessLogic; @@ -54,16 +60,11 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.web.context.WebApplicationContext; -import javax.servlet.ServletContext; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; +import fj.data.Either; +import junit.framework.Assert; public class PropertyBusinessLogicTest { @@ -195,7 +196,7 @@ public class PropertyBusinessLogicTest { resource.setUniqueId(resourceId); Mockito.when(toscaOperationFacade.getToscaElement(resourceId)).thenReturn(Either.left(resource)); - Either<Map.Entry<String, PropertyDefinition>, ResponseFormat> notFoundProperty = bl.getProperty(resourceId, property1.getUniqueId(), user.getUserId()); + Either<Map.Entry<String, PropertyDefinition>, ResponseFormat> notFoundProperty = bl.getProperty(resourceId, "invalidId", user.getUserId()); assertTrue(notFoundProperty.isRight()); Mockito.verify(componentsUtils).getResponseFormat(ActionStatus.PROPERTY_NOT_FOUND, ""); } @@ -156,7 +156,7 @@ public class ResourceImportManagerTest { // Mockito.verify(log).error(Mockito.anyString(), Mockito.anyString(), // Mockito.anyString()); - Mockito.verify(resourceBusinessLogic, Mockito.times(0)).createOrUpdateResourceByImport(Mockito.any(Resource.class), Mockito.eq(user), Mockito.eq(true), Mockito.eq(false), Mockito.eq(true), Mockito.eq(null)); + Mockito.verify(resourceBusinessLogic, Mockito.times(0)).createOrUpdateResourceByImport(Mockito.any(Resource.class), Mockito.eq(user), Mockito.eq(true), Mockito.eq(false), Mockito.eq(true), Mockito.eq(null), Mockito.eq(null), Mockito.eq(false)); Mockito.verify(resourceBusinessLogic, Mockito.times(0)).propagateStateToCertified(Mockito.eq(user), Mockito.any(Resource.class), Mockito.any(LifecycleChangeInfoWithAction.class), Mockito.eq(false), Mockito.eq(true), Mockito.eq(false)); @@ -181,7 +181,7 @@ public class ResourceImportManagerTest { testSetCapabilities(resource); Mockito.verify(resourceBusinessLogic, Mockito.times(1)).propagateStateToCertified(Mockito.eq(user), Mockito.eq(resource), Mockito.any(LifecycleChangeInfoWithAction.class), Mockito.eq(false), Mockito.eq(true), Mockito.eq(false)); - Mockito.verify(resourceBusinessLogic, Mockito.times(1)).createOrUpdateResourceByImport(resource, user, true, false, true, null); + Mockito.verify(resourceBusinessLogic, Mockito.times(1)).createOrUpdateResourceByImport(resource, user, true, false, true, null, null, false); } @@ -206,7 +206,7 @@ public class ResourceImportManagerTest { private void setResourceBusinessLogicMock() { when(resourceBusinessLogic.getUserAdmin()).thenReturn(userAdmin); - when(resourceBusinessLogic.createOrUpdateResourceByImport(Mockito.any(Resource.class), Mockito.any(User.class), Mockito.anyBoolean(), Mockito.anyBoolean(), Mockito.anyBoolean(), Mockito.eq(null))) + when(resourceBusinessLogic.createOrUpdateResourceByImport(Mockito.any(Resource.class), Mockito.any(User.class), Mockito.anyBoolean(), Mockito.anyBoolean(), Mockito.anyBoolean(), Mockito.eq(null), Mockito.eq(null), Mockito.eq(false))) .thenAnswer(new Answer<Either<ImmutablePair<Resource, ActionStatus>, ResponseFormat>>() { public Either<ImmutablePair<Resource, ActionStatus>, ResponseFormat> answer(InvocationOnMock invocation) throws Throwable { Object[] args = invocation.getArguments(); @@ -250,6 +250,7 @@ public class ResourceImportManagerTest { private UploadResourceInfo createDummyResourceMD() { UploadResourceInfo resourceMD = new UploadResourceInfo(); resourceMD.setName("tosca.nodes.BlockStorage"); + resourceMD.setPayloadName("payLoad"); resourceMD.addSubCategory("Generic", "Infrastructure"); resourceMD.setContactId("ya107f"); resourceMD.setResourceIconPath("defaulticon"); @@ -44,6 +44,7 @@ import org.openecomp.sdc.be.auditing.impl.AuditingManager; import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic; import org.openecomp.sdc.be.components.impl.ResponseFormatManager; import org.openecomp.sdc.be.components.impl.ServiceBusinessLogic; +import org.openecomp.sdc.be.components.impl.generic.GenericTypeBusinessLogic; import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.dao.cassandra.AuditCassandraDao; @@ -104,6 +105,7 @@ public class ServiceBusinessLogicTest { TitanDao mockTitanDao = Mockito.mock(TitanDao.class); ToscaOperationFacade toscaOperationFacade = Mockito.mock(ToscaOperationFacade.class); CacheMangerOperation cacheManager = Mockito.mock(CacheMangerOperation.class); + GenericTypeBusinessLogic genericTypeBusinessLogic = Mockito.mock(GenericTypeBusinessLogic.class); User user = null; Service serviceResponse = null; @@ -154,7 +156,7 @@ public class ServiceBusinessLogicTest { // artifact bussinesslogic ArtifactDefinition artifactDef = new ArtifactDefinition(); - when(artifactBl.createArtifactPlaceHolderInfo(Mockito.anyString(), Mockito.anyString(), Mockito.anyMap(), Mockito.any(User.class), Mockito.any(ArtifactGroupTypeEnum.class))).thenReturn(artifactDef); + when(artifactBl.createArtifactPlaceHolderInfo(Mockito.any(), Mockito.anyString(), Mockito.anyMap(), Mockito.any(User.class), Mockito.any(ArtifactGroupTypeEnum.class))).thenReturn(artifactDef); // createService serviceResponse = createServiceObject(true); @@ -177,7 +179,7 @@ public class ServiceBusinessLogicTest { bl.setGraphLockOperation(graphLockOperation); bl.setTitanGenericDao(mockTitanDao); bl.setToscaOperationFacade(toscaOperationFacade); - + bl.setGenericTypeBusinessLogic(genericTypeBusinessLogic); componentsUtils.Init(); componentsUtils.setAuditingManager(auditingManager); bl.setComponentsUtils(componentsUtils); @@ -209,6 +211,7 @@ public class ServiceBusinessLogicTest { @Test public void testHappyScenario() { Service service = createServiceObject(false); + when(genericTypeBusinessLogic.fetchDerivedFromGenericType(service)).thenReturn(Either.left(genericService)); Either<Service, ResponseFormat> createResponse = bl.createService(service, user); if (createResponse.isRight()) { @@ -744,8 +747,6 @@ public class ServiceBusinessLogicTest { Either<Component, StorageOperationStatus> eitherDelete = Either.left(new Resource()); when(toscaOperationFacade.deleteToscaComponent(resourceFree)).thenReturn(eitherDelete); - when(artifactBl.deleteAllComponentArtifactsIfNotOnGraph(artifacts)).thenReturn(StorageOperationStatus.OK); - Either<List<String>, ResponseFormat> deleteMarkedResources = bl.deleteMarkedComponents(); assertTrue(deleteMarkedResources.isLeft()); List<String> resourceIdList = deleteMarkedResources.left().value(); @@ -753,7 +754,6 @@ public class ServiceBusinessLogicTest { assertTrue(resourceIdList.contains(resourceFree)); assertFalse(resourceIdList.contains(resourceInUse)); - Mockito.verify(artifactBl, Mockito.times(1)).deleteAllComponentArtifactsIfNotOnGraph(artifacts); } private Service createServiceObject(boolean afterCreate) { @@ -1004,6 +1004,7 @@ public class ServiceBusinessLogicTest { public void testDerivedFromGeneric() { Service service = createServiceObject(true); when(toscaOperationFacade.createToscaComponent(service)).thenReturn(Either.left(service)); + when(genericTypeBusinessLogic.fetchDerivedFromGenericType(service)).thenReturn(Either.left(genericService)); Either<Service, ResponseFormat> createResponse = bl.createService(service, user); assertTrue(createResponse.isLeft()); service = createResponse.left().value(); @@ -1,7 +1,5 @@ package org.openecomp.sdc.be.components.clean; -import javax.annotation.Generated; - import org.junit.Test; @@ -20,7 +20,8 @@ package org.openecomp.sdc.be.components.distribution.engine; -import static org.junit.Assert.*; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; import java.io.File; import java.util.ArrayList; @@ -28,7 +29,6 @@ import java.util.List; import org.junit.Before; import org.junit.Test; -import org.openecomp.sdc.be.components.distribution.engine.DistributionEngine; import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.config.DistributionEngineConfiguration; import org.openecomp.sdc.be.config.DistributionEngineConfiguration.ComponentArtifactTypesConfig; @@ -30,10 +30,6 @@ import org.junit.Test; import org.mockito.Mock; import org.mockito.Mockito; import org.openecomp.sdc.be.components.BaseConfDependentTest; -import org.openecomp.sdc.be.components.distribution.engine.CambriaErrorResponse; -import org.openecomp.sdc.be.components.distribution.engine.CambriaHandler; -import org.openecomp.sdc.be.components.distribution.engine.DistributionEngineClusterHealth; -import org.openecomp.sdc.be.components.distribution.engine.UebHealthCheckCall; import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.distribution.api.client.CambriaOperationStatus; @@ -27,20 +27,15 @@ import static org.mockito.Mockito.when; import java.io.File; import java.util.ArrayList; -import java.util.Collection; import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.concurrent.atomic.AtomicBoolean; -import org.junit.Before; +import org.junit.BeforeClass; import org.junit.Test; import org.mockito.Mock; import org.mockito.Mockito; -import org.openecomp.sdc.be.components.distribution.engine.CambriaErrorResponse; -import org.openecomp.sdc.be.components.distribution.engine.CambriaHandler; -import org.openecomp.sdc.be.components.distribution.engine.DistributionEngineInitTask; -import org.openecomp.sdc.be.components.distribution.engine.SubscriberTypeEnum; import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.config.DistributionEngineConfiguration; import org.openecomp.sdc.be.config.DistributionEngineConfiguration.CreateTopicConfig; @@ -63,8 +58,8 @@ public class DistributionEngineInitTaskTest { // public static final IAuditingDao iAuditingDao = // Mockito.mock(AuditingDao.class); - @Before - public void setup() { + @BeforeClass + public static void setup() { // ExternalConfiguration.setAppName("distribEngine1"); ExternalConfiguration.setAppName("catalog-be"); ExternalConfiguration.setConfigDir("src/test/resources/config"); @@ -128,11 +123,11 @@ public class DistributionEngineInitTaskTest { String realNotifTopic = notifTopic + "-" + envName.toUpperCase(); String realStatusTopic = statusTopic + "-" + envName.toUpperCase(); - when(cambriaHandler.createTopic(Mockito.any(Collection.class), Mockito.any(String.class), Mockito.any(String.class), Mockito.eq(realNotifTopic), Mockito.eq(1), Mockito.eq(1))).thenReturn(cambriaErrorResponse); - when(cambriaHandler.createTopic(Mockito.any(Collection.class), Mockito.any(String.class), Mockito.any(String.class), Mockito.eq(realStatusTopic), Mockito.eq(1), Mockito.eq(1))).thenReturn(cambriaErrorResponse); + when(cambriaHandler.createTopic(Mockito.any(), Mockito.any(), Mockito.any(), Mockito.eq(realNotifTopic), Mockito.eq(1), Mockito.eq(1))).thenReturn(cambriaErrorResponse); + when(cambriaHandler.createTopic(Mockito.any(), Mockito.any(), Mockito.any(), Mockito.eq(realStatusTopic), Mockito.eq(1), Mockito.eq(1))).thenReturn(cambriaErrorResponse); cambriaErrorResponse = new CambriaErrorResponse(CambriaOperationStatus.OK); - when(cambriaHandler.registerToTopic(Mockito.any(Collection.class), Mockito.any(String.class), Mockito.any(String.class), Mockito.any(String.class), Mockito.any(String.class), Mockito.any(SubscriberTypeEnum.class))) + when(cambriaHandler.registerToTopic(Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any())) .thenReturn(cambriaErrorResponse); DistributionEngineInitTask initTask = new DistributionEngineInitTask(0l, deConfiguration, envName, new AtomicBoolean(false), componentsUtils, null); @@ -159,7 +154,6 @@ public class DistributionEngineInitTaskTest { List<String> uebServers = new ArrayList<>(); uebServers.add("server1"); - CambriaErrorResponse cambriaErrorResponse = new CambriaErrorResponse(CambriaOperationStatus.NOT_FOUND); Either<Set<String>, CambriaErrorResponse> left = Either.left(topics); when(cambriaHandler.getTopics(Mockito.any(List.class))).thenReturn(left); @@ -177,8 +171,8 @@ public class DistributionEngineInitTaskTest { createTopic.setReplicationCount(1); deConfiguration.setCreateTopic(createTopic); - cambriaErrorResponse = new CambriaErrorResponse(CambriaOperationStatus.OK); - when(cambriaHandler.registerToTopic(Mockito.any(Collection.class), Mockito.any(String.class), Mockito.any(String.class), Mockito.any(String.class), Mockito.any(String.class), Mockito.any(SubscriberTypeEnum.class))) + CambriaErrorResponse cambriaErrorResponse = new CambriaErrorResponse(CambriaOperationStatus.OK); + when(cambriaHandler.registerToTopic(Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any())) .thenReturn(cambriaErrorResponse); DistributionEngineInitTask initTask = new DistributionEngineInitTask(0l, deConfiguration, envName, new AtomicBoolean(false), componentsUtils, null); @@ -224,15 +218,16 @@ public class DistributionEngineInitTaskTest { String realNotifTopic = notifTopic + "-" + envName.toUpperCase(); String realStatusTopic = statusTopic + "-" + envName.toUpperCase(); - when(cambriaHandler.createTopic(Mockito.any(Collection.class), Mockito.any(String.class), Mockito.any(String.class), Mockito.eq(realNotifTopic), Mockito.eq(1), Mockito.eq(1))).thenReturn(cambriaErrorResponse); - when(cambriaHandler.createTopic(Mockito.any(Collection.class), Mockito.any(String.class), Mockito.any(String.class), Mockito.eq(realStatusTopic), Mockito.eq(1), Mockito.eq(1))).thenReturn(cambriaErrorResponse); + when(cambriaHandler.createTopic(Mockito.any(), Mockito.any(), Mockito.any(), Mockito.eq(realNotifTopic), Mockito.eq(1), Mockito.eq(1))).thenReturn(cambriaErrorResponse); + when(cambriaHandler.createTopic(Mockito.any(), Mockito.any(), Mockito.any(), Mockito.eq(realStatusTopic), Mockito.eq(1), Mockito.eq(1))).thenReturn(cambriaErrorResponse); - when(cambriaHandler.registerToTopic(Mockito.any(Collection.class), Mockito.eq(realNotifTopic), Mockito.any(String.class), Mockito.any(String.class), Mockito.any(String.class), Mockito.any(SubscriberTypeEnum.class))) + when(cambriaHandler.registerToTopic(Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(SubscriberTypeEnum.class))) .thenReturn(new CambriaErrorResponse(CambriaOperationStatus.OK)); - when(cambriaHandler.registerToTopic(Mockito.any(Collection.class), Mockito.eq(realStatusTopic), Mockito.any(String.class), Mockito.any(String.class), Mockito.any(String.class), Mockito.any(SubscriberTypeEnum.class))) + when(cambriaHandler.registerToTopic(Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(SubscriberTypeEnum.class))) .thenReturn(new CambriaErrorResponse(CambriaOperationStatus.CONNNECTION_ERROR)); + DistributionEngineInitTask initTask = new DistributionEngineInitTask(0l, deConfiguration, envName, new AtomicBoolean(false), componentsUtils, null); initTask.setCambriaHandler(cambriaHandler); @@ -4,11 +4,8 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; -import javax.annotation.Generated; - import org.junit.Test; import org.openecomp.sdc.be.model.GroupDefinition; -import org.openecomp.sdc.be.model.GroupInstance; import org.openecomp.sdc.be.model.GroupInstanceProperty; @@ -2,7 +2,6 @@ package org.openecomp.sdc.be.components.impl; import java.util.List; -import javax.annotation.Generated; import javax.servlet.ServletContext; import org.junit.Test; @@ -20,20 +20,36 @@ package org.openecomp.sdc.be.components.impl; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonElement; -import fj.data.Either; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyBoolean; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.when; +import static org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic.HEAT_ENV_NAME; +import static org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic.HEAT_VF_ENV_NAME; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + import org.codehaus.jackson.map.DeserializationConfig; import org.codehaus.jackson.map.ObjectMapper; import org.codehaus.jackson.map.SerializationConfig.Feature; import org.codehaus.jackson.map.annotate.JsonSerialize; import org.junit.Before; -import org.junit.BeforeClass; import org.junit.Test; import org.mockito.InjectMocks; +import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; +import org.openecomp.sdc.be.components.utils.ArtifactBuilder; +import org.openecomp.sdc.be.components.utils.ObjectGenerator; import org.openecomp.sdc.be.config.Configuration.ArtifactTypeConfig; import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.dao.api.ActionStatus; @@ -45,10 +61,13 @@ import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.ArtifactDefinition; import org.openecomp.sdc.be.model.ArtifactType; +import org.openecomp.sdc.be.model.HeatParameterDefinition; import org.openecomp.sdc.be.model.InterfaceDefinition; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.be.model.jsontitan.operations.ArtifactsOperations; +import org.openecomp.sdc.be.model.jsontitan.operations.NodeTemplateOperation; import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.IElementOperation; import org.openecomp.sdc.be.model.operations.api.IInterfaceLifecycleOperation; @@ -57,6 +76,7 @@ import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.ArtifactOperation; import org.openecomp.sdc.be.resources.data.ESArtifactData; import org.openecomp.sdc.be.servlets.RepresentationUtils; +import org.openecomp.sdc.be.user.UserBusinessLogic; import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum; import org.openecomp.sdc.common.api.ArtifactTypeEnum; import org.openecomp.sdc.common.api.ConfigurationSource; @@ -64,30 +84,40 @@ import org.openecomp.sdc.common.impl.ExternalConfiguration; import org.openecomp.sdc.common.impl.FSConfigurationSource; import org.openecomp.sdc.exception.ResponseFormat; -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonElement; -import static org.junit.Assert.*; -import static org.mockito.Mockito.when; +import fj.data.Either; public class ArtifactBusinessLogicTest { + public static final User USER = new User("John", "Doh", "jh0003", "jh0003@gmail.com", "ADMIN", System.currentTimeMillis()); static ConfigurationSource configurationSource = new FSConfigurationSource(ExternalConfiguration.getChangeListener(), "src/test/resources/config/catalog-be"); static ConfigurationManager configurationManager = new ConfigurationManager(configurationSource); @InjectMocks - static ArtifactsBusinessLogic artifactBL = new ArtifactsBusinessLogic(); - - public static final ArtifactOperation artifactOperation = Mockito.mock(ArtifactOperation.class); - public static final ComponentsUtils componentsUtils = Mockito.mock(ComponentsUtils.class); - public static final IInterfaceLifecycleOperation lifecycleOperation = Mockito.mock(IInterfaceLifecycleOperation.class); - public static final IUserAdminOperation userOperation = Mockito.mock(IUserAdminOperation.class); - public static final IElementOperation elementOperation = Mockito.mock(IElementOperation.class); - public static final ArtifactCassandraDao artifactCassandraDao = Mockito.mock(ArtifactCassandraDao.class); - public static final ToscaOperationFacade toscaOperationFacade = Mockito.mock(ToscaOperationFacade.class); + private static ArtifactsBusinessLogic artifactBL; + @Mock + private ArtifactOperation artifactOperation; + @Mock + public ComponentsUtils componentsUtils; + @Mock + private IInterfaceLifecycleOperation lifecycleOperation; + @Mock + private IUserAdminOperation userOperation; + @Mock + private IElementOperation elementOperation; + @Mock + private ArtifactCassandraDao artifactCassandraDao; + @Mock + public ToscaOperationFacade toscaOperationFacade; + @Mock + private UserBusinessLogic userBusinessLogic; + @Mock + private NodeTemplateOperation nodeTemplateOperation; + @Mock + private ArtifactsOperations artifactsOperations; // public static final InformationDeployedArtifactsBusinessLogic // informationDeployedArtifactsBusinessLogic = @@ -96,31 +126,6 @@ public class ArtifactBusinessLogicTest { public static final Resource resource = Mockito.mock(Resource.class); private Gson gson = new GsonBuilder().setPrettyPrinting().create(); - @BeforeClass - public static void setup() { - - Either<ArtifactDefinition, StorageOperationStatus> NotFoundResult = Either.right(StorageOperationStatus.NOT_FOUND); -// when(artifactOperation.getArtifactById(Mockito.anyString(), Mockito.anyBoolean())).thenReturn(NotFoundResult); - - Either<Map<String, ArtifactDefinition>, StorageOperationStatus> NotFoundResult2 = Either.right(StorageOperationStatus.NOT_FOUND); - when(artifactOperation.getArtifacts(Mockito.anyString(), Mockito.eq(NodeTypeEnum.Service), Mockito.anyBoolean())).thenReturn(NotFoundResult2); - when(artifactOperation.getArtifacts(Mockito.anyString(), Mockito.eq(NodeTypeEnum.Resource), Mockito.anyBoolean())).thenReturn(NotFoundResult2); - - Either<Map<String, InterfaceDefinition>, StorageOperationStatus> notFoundInterfaces = Either.right(StorageOperationStatus.NOT_FOUND); - when(lifecycleOperation.getAllInterfacesOfResource(Mockito.anyString(), Mockito.anyBoolean())).thenReturn(notFoundInterfaces); - - User userJH = new User("John", "Doh", "jh0003", "jh0003@gmail.com", "ADMIN", System.currentTimeMillis()); - Either<User, ActionStatus> getUserResult = Either.left(userJH); - - when(userOperation.getUserData("jh0003", false)).thenReturn(getUserResult); - - Either<List<ArtifactType>, ActionStatus> getType = Either.left(getAllTypes()); - when(elementOperation.getAllArtifactTypes()).thenReturn(getType); - - when(resource.getResourceType()).thenReturn(ResourceTypeEnum.VFC); - // when(informationDeployedArtifactsBusinessLogic.getAllDeployableArtifacts(Mockito.any(Resource.class))).thenReturn(new - // ArrayList<ArtifactDefinition>()); - } private static List<ArtifactType> getAllTypes() { List<ArtifactType> artifactTypes = new ArrayList<ArtifactType>(); @@ -136,6 +141,23 @@ public class ArtifactBusinessLogicTest { @Before public void initMocks() { MockitoAnnotations.initMocks(this); + Either<ArtifactDefinition, StorageOperationStatus> NotFoundResult = Either.right(StorageOperationStatus.NOT_FOUND); + + Either<Map<String, ArtifactDefinition>, StorageOperationStatus> NotFoundResult2 = Either.right(StorageOperationStatus.NOT_FOUND); + when(artifactOperation.getArtifacts(Mockito.anyString(), eq(NodeTypeEnum.Service), Mockito.anyBoolean())).thenReturn(NotFoundResult2); + when(artifactOperation.getArtifacts(Mockito.anyString(), eq(NodeTypeEnum.Resource), Mockito.anyBoolean())).thenReturn(NotFoundResult2); + + Either<Map<String, InterfaceDefinition>, StorageOperationStatus> notFoundInterfaces = Either.right(StorageOperationStatus.NOT_FOUND); + when(lifecycleOperation.getAllInterfacesOfResource(Mockito.anyString(), Mockito.anyBoolean())).thenReturn(notFoundInterfaces); + + Either<User, ActionStatus> getUserResult = Either.left(USER); + + when(userOperation.getUserData("jh0003", false)).thenReturn(getUserResult); + + Either<List<ArtifactType>, ActionStatus> getType = Either.left(getAllTypes()); + when(elementOperation.getAllArtifactTypes()).thenReturn(getType); + + when(resource.getResourceType()).thenReturn(ResourceTypeEnum.VFC); } @Test @@ -283,9 +305,59 @@ public class ArtifactBusinessLogicTest { assertTrue(downloadServiceArtifactByNamesRes.isLeft()); assertTrue(downloadServiceArtifactByNamesRes.left().value() !=null && downloadServiceArtifactByNamesRes.left().value().length == payload.length); } - - // @Test + @Test + public void createHeatEnvPlaceHolder_vf_emptyHeatParameters() throws Exception { + ArtifactDefinition heatArtifact = new ArtifactBuilder() + .addHeatParam(ObjectGenerator.buildHeatParam("defVal1", "val1")) + .addHeatParam(ObjectGenerator.buildHeatParam("defVal2", "val2")) + .build(); + + Resource component = new Resource(); + when(userBusinessLogic.getUser(anyString(), anyBoolean())).thenReturn(Either.left(USER)); + when(artifactsOperations.addHeatEnvArtifact(any(ArtifactDefinition.class), any(ArtifactDefinition.class), eq(component.getUniqueId()), eq(NodeTypeEnum.Resource), eq(true), eq("parentId"))) + .thenReturn(Either.left(new ArtifactDefinition())); + Either<ArtifactDefinition, ResponseFormat> heatEnvPlaceHolder = artifactBL.createHeatEnvPlaceHolder(heatArtifact, HEAT_VF_ENV_NAME, "parentId", NodeTypeEnum.Resource, "parentName", USER, component, Collections.emptyMap()); + assertTrue(heatEnvPlaceHolder.isLeft()); + assertNull(heatEnvPlaceHolder.left().value().getListHeatParameters()); + } + + @Test + public void createHeatEnvPlaceHolder_resourceInstance_copyHeatParamasCurrValuesToHeatEnvDefaultVal() throws Exception { + HeatParameterDefinition heatParam1 = ObjectGenerator.buildHeatParam("defVal1", "val1"); + HeatParameterDefinition heatParam2 = ObjectGenerator.buildHeatParam("defVal2", "val2"); + HeatParameterDefinition heatParam3 = ObjectGenerator.buildHeatParam("defVal3", "val3"); + ArtifactDefinition heatArtifact = new ArtifactBuilder() + .addHeatParam(heatParam1) + .addHeatParam(heatParam2) + .addHeatParam(heatParam3) + .build(); + + Resource component = new Resource(); + + when(userBusinessLogic.getUser(anyString(), anyBoolean())).thenReturn(Either.left(USER)); + when(artifactsOperations.addHeatEnvArtifact(any(ArtifactDefinition.class), any(ArtifactDefinition.class), eq(component.getUniqueId()), eq(NodeTypeEnum.Resource), eq(true), eq("parentId"))) + .thenReturn(Either.left(new ArtifactDefinition())); + + Either<ArtifactDefinition, ResponseFormat> heatEnvPlaceHolder = artifactBL.createHeatEnvPlaceHolder(heatArtifact, HEAT_ENV_NAME, "parentId", NodeTypeEnum.ResourceInstance, "parentName", USER, component, Collections.emptyMap()); + + assertTrue(heatEnvPlaceHolder.isLeft()); + ArtifactDefinition heatEnvArtifact = heatEnvPlaceHolder.left().value(); + List<HeatParameterDefinition> listHeatParameters = heatEnvArtifact.getListHeatParameters(); + assertEquals(listHeatParameters.size(), 3); + verifyHeatParam(listHeatParameters.get(0), heatParam1); + verifyHeatParam(listHeatParameters.get(1), heatParam2); + verifyHeatParam(listHeatParameters.get(2), heatParam3); + } + + private void verifyHeatParam(HeatParameterDefinition heatEnvParam, HeatParameterDefinition heatYamlParam) { + assertEquals(heatEnvParam.getDefaultValue(), heatYamlParam.getCurrentValue()); + assertNull(heatEnvParam.getCurrentValue()); + } + + + +// @Test // public void convertAndValidateDeploymentArtifactNonHeatSuccess(){ // ArtifactDefinition createArtifactDef = createArtifactDef(); // createArtifactDef.setArtifactType(ArtifactTypeEnum.YANG_XML.getType()); @@ -20,6 +20,12 @@ package org.openecomp.sdc.be.components.impl; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; + +import java.util.Collections; +import java.util.Map; + import org.junit.Before; import org.junit.Test; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; @@ -28,12 +34,6 @@ import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.Service; -import java.util.Collections; -import java.util.Map; - -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; - public class ArtifactResolverTest { private ArtifactResolverImpl testInstance = new ArtifactResolverImpl(); @@ -2,9 +2,6 @@ package org.openecomp.sdc.be.components.impl; import java.util.List; -import javax.annotation.Generated; - -import org.junit.Assert; import org.junit.Test; import org.openecomp.sdc.be.model.PropertyDefinition; import org.openecomp.sdc.exception.ResponseFormat; @@ -39,8 +39,6 @@ import org.mockito.Mockito; import org.mockito.MockitoAnnotations; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; -import org.openecomp.sdc.be.components.impl.CapabilityTypeImportManager; -import org.openecomp.sdc.be.components.impl.CommonImportManager; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.CapabilityTypeDefinition; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; @@ -38,8 +38,6 @@ import org.mockito.Mockito; import org.mockito.MockitoAnnotations; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; -import org.openecomp.sdc.be.components.impl.CategoriesImportManager; -import org.openecomp.sdc.be.components.impl.InterfaceLifecycleTypeImportManager; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; import org.openecomp.sdc.be.impl.ComponentsUtils; @@ -68,13 +66,12 @@ public class CategoriesImportManagerTest { subcategory = new SubCategoryDefinition(); subcategory.setUniqueId("123"); - when(elementOperation.createCategory(Mockito.any(CategoryDefinition.class), Mockito.any(NodeTypeEnum.class))).thenAnswer(new Answer<Either<CategoryDefinition, ActionStatus>>() { - public Either<CategoryDefinition, ActionStatus> answer(InvocationOnMock invocation) { - Object[] args = invocation.getArguments(); - Either<CategoryDefinition, ActionStatus> ans = Either.left((CategoryDefinition) args[0]); - return ans; - } - + when(elementOperation.createCategory(Mockito.any(CategoryDefinition.class), Mockito.any(NodeTypeEnum.class))).thenAnswer((Answer<Either<CategoryDefinition, ActionStatus>>) invocation -> { + Object[] args = invocation.getArguments(); + CategoryDefinition category = (CategoryDefinition) args[0]; + category.setUniqueId("123"); + Either<CategoryDefinition, ActionStatus> ans = Either.left(category); + return ans; }); when(elementOperation.createSubCategory(Mockito.any(String.class), Mockito.any(SubCategoryDefinition.class), Mockito.any(NodeTypeEnum.class))).thenAnswer(new Answer<Either<SubCategoryDefinition, ActionStatus>>() { public Either<SubCategoryDefinition, ActionStatus> answer(InvocationOnMock invocation) { @@ -0,0 +1,245 @@ +package org.openecomp.sdc.be.components.impl; + +import static org.junit.Assert.assertTrue; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.when; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.function.BiPredicate; + +import org.assertj.core.util.Lists; +import org.junit.BeforeClass; +import org.junit.Test; +import org.mockito.Mockito; +import org.openecomp.sdc.be.dao.api.ActionStatus; +import org.openecomp.sdc.be.datatypes.elements.CapabilityDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.RequirementDataDefinition; +import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; +import org.openecomp.sdc.be.impl.ComponentsUtils; +import org.openecomp.sdc.be.impl.ServletUtils; +import org.openecomp.sdc.be.model.CapabilityDefinition; +import org.openecomp.sdc.be.model.CapabilityRequirementRelationship; +import org.openecomp.sdc.be.model.Component; +import org.openecomp.sdc.be.model.ComponentInstance; +import org.openecomp.sdc.be.model.ComponentParametersView; +import org.openecomp.sdc.be.model.RelationshipImpl; +import org.openecomp.sdc.be.model.RelationshipInfo; +import org.openecomp.sdc.be.model.RequirementCapabilityRelDef; +import org.openecomp.sdc.be.model.RequirementDefinition; +import org.openecomp.sdc.be.model.Resource; +import org.openecomp.sdc.be.model.Service; +import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; +import org.openecomp.sdc.be.user.UserBusinessLogic; +import org.openecomp.sdc.exception.ResponseFormat; + +import fj.data.Either; + +/** + * The test suite designed for test functionality of ComponentInstanceBusinessLogic class + */ +public class ComponentInstanceBusinessLogicTest { + + private final static String USER_ID = "jh0003"; + private final static String COMPONENT_ID = "componentId"; + private final static String TO_INSTANCE_ID = "toInstanceId"; + private final static String FROM_INSTANCE_ID = "fromInstanceId"; + private final static String RELATION_ID = "relationId"; + private final static String CAPABILITY_OWNER_ID = "capabilityOwnerId"; + private final static String CAPABILITY_UID = "capabilityUid"; + private final static String CAPABILITY_NAME = "capabilityName"; + private final static String REQUIREMENT_OWNER_ID = "requirementOwnerId"; + private final static String REQUIREMENT_UID = "requirementUid"; + private final static String REQUIREMENT_NAME = "requirementName"; + private final static String RELATIONSHIP_TYPE = "relationshipType"; + + private static ComponentsUtils componentsUtils; + private static ServletUtils servletUtils; + private static ResponseFormat responseFormat; + private static ToscaOperationFacade toscaOperationFacade; + private static UserBusinessLogic userAdmin; + + private static ComponentInstanceBusinessLogic serviceBusinessLogic; + private static ComponentInstanceBusinessLogic resourceBusinessLogic; + private static User user; + private static Component service; + private static Component resource; + private static ComponentInstance toInstance; + private static ComponentInstance fromInstance; + private static CapabilityDataDefinition capability; + private static RequirementDataDefinition requirement; + private static RequirementCapabilityRelDef relation; + + @BeforeClass + public static void setup() { + createMocks(); + setMocks(); + stubMethods(); + createComponents(); + } + + @Test + public void testGetRelationByIdSuccess(){ + getServiceRelationByIdSuccess(service); + getServiceRelationByIdSuccess(resource); + } + + @Test + public void testGetRelationByIdUserValidationFailure(){ + getServiceRelationByIdUserValidationFailure(service); + getServiceRelationByIdUserValidationFailure(resource); + } + + @Test + public void testGetRelationByIdComponentNotFoundFailure(){ + getRelationByIdComponentNotFoundFailure(service); + getRelationByIdComponentNotFoundFailure(resource); + } + + @SuppressWarnings("unchecked") + private void getServiceRelationByIdSuccess(Component component){ + Either<User, ActionStatus> eitherCreator = Either.left(user); + when(userAdmin.getUser(eq(USER_ID), eq(false))).thenReturn(eitherCreator); + Either<Component, StorageOperationStatus> getComponentRes = Either.left(component); + when(toscaOperationFacade.getToscaElement(eq(COMPONENT_ID), any(ComponentParametersView.class))).thenReturn(getComponentRes); + + Either<RequirementDataDefinition, StorageOperationStatus> getfulfilledRequirementRes = Either.left(requirement); + when(toscaOperationFacade.getFulfilledRequirementByRelation(eq(COMPONENT_ID), eq(FROM_INSTANCE_ID), eq(relation), any(BiPredicate.class))).thenReturn(getfulfilledRequirementRes); + + Either<CapabilityDataDefinition, StorageOperationStatus> getfulfilledCapabilityRes = Either.left(capability); + when(toscaOperationFacade.getFulfilledCapabilityByRelation(eq(COMPONENT_ID), eq(FROM_INSTANCE_ID), eq(relation), any(BiPredicate.class))).thenReturn(getfulfilledCapabilityRes); + + Either<RequirementCapabilityRelDef, ResponseFormat> response = serviceBusinessLogic.getRelationById(COMPONENT_ID, RELATION_ID, USER_ID, component.getComponentType()); + assertTrue(response.isLeft()); + } + + private void getServiceRelationByIdUserValidationFailure(Component component){ + Either<User, ActionStatus> eitherCreator = Either.right(ActionStatus.USER_NOT_FOUND); + when(userAdmin.getUser(eq(USER_ID), eq(false))).thenReturn(eitherCreator); + + Either<RequirementCapabilityRelDef, ResponseFormat> response = serviceBusinessLogic.getRelationById(COMPONENT_ID, RELATION_ID, USER_ID, component.getComponentType()); + assertTrue(response.isRight()); + } + + private void getRelationByIdComponentNotFoundFailure(Component component){ + Either<User, ActionStatus> eitherCreator = Either.left(user); + when(userAdmin.getUser(eq(USER_ID), eq(false))).thenReturn(eitherCreator); + Either<Component, StorageOperationStatus> getComponentRes = Either.right(StorageOperationStatus.NOT_FOUND); + when(toscaOperationFacade.getToscaElement(eq(COMPONENT_ID), any(ComponentParametersView.class))).thenReturn(getComponentRes); + + Either<RequirementCapabilityRelDef, ResponseFormat> response = serviceBusinessLogic.getRelationById(COMPONENT_ID, RELATION_ID, USER_ID, component.getComponentType()); + assertTrue(response.isRight()); + } + + private static void createMocks() { + componentsUtils = Mockito.mock(ComponentsUtils.class); + servletUtils = Mockito.mock(ServletUtils.class); + responseFormat = Mockito.mock(ResponseFormat.class); + toscaOperationFacade = Mockito.mock(ToscaOperationFacade.class); + userAdmin = Mockito.mock(UserBusinessLogic.class); + user = Mockito.mock(User.class); + } + + private static void setMocks() { + serviceBusinessLogic = new ServiceComponentInstanceBusinessLogic(); + serviceBusinessLogic.setToscaOperationFacade(toscaOperationFacade); + serviceBusinessLogic.setUserAdmin(userAdmin); + serviceBusinessLogic.setComponentsUtils(componentsUtils); + + resourceBusinessLogic = new VFComponentInstanceBusinessLogic(); + resourceBusinessLogic.setToscaOperationFacade(toscaOperationFacade); + resourceBusinessLogic.setUserAdmin(userAdmin); + resourceBusinessLogic.setComponentsUtils(componentsUtils); + } + + private static void stubMethods() { + when(servletUtils.getComponentsUtils()).thenReturn(componentsUtils); + when(componentsUtils.getResponseFormat(eq(ActionStatus.RELATION_NOT_FOUND), eq(RELATION_ID), eq(COMPONENT_ID))).thenReturn(responseFormat); + } + + private static void createComponents() { + createRelation(); + createInstances(); + createService(); + createResource(); + } + + private static void createResource() { + resource = new Resource(); + resource.setUniqueId(COMPONENT_ID); + resource.setComponentInstancesRelations(Lists.newArrayList(relation)); + resource.setComponentInstances(Lists.newArrayList(toInstance,fromInstance)); + resource.setCapabilities(toInstance.getCapabilities()); + resource.setRequirements(fromInstance.getRequirements()); + resource.setComponentType(ComponentTypeEnum.RESOURCE); + } + + + private static void createService() { + service = new Service(); + service.setUniqueId(COMPONENT_ID); + service.setComponentInstancesRelations(Lists.newArrayList(relation)); + service.setComponentInstances(Lists.newArrayList(toInstance,fromInstance)); + service.setCapabilities(toInstance.getCapabilities()); + service.setRequirements(fromInstance.getRequirements()); + service.setComponentType(ComponentTypeEnum.SERVICE); + } + + + private static void createInstances() { + toInstance = new ComponentInstance(); + toInstance.setUniqueId(TO_INSTANCE_ID); + + fromInstance = new ComponentInstance(); + fromInstance.setUniqueId(FROM_INSTANCE_ID); + + capability = new CapabilityDataDefinition(); + capability.setOwnerId(CAPABILITY_OWNER_ID); + capability.setUniqueId(CAPABILITY_UID); + capability.setName(CAPABILITY_NAME); + + Map<String, List<CapabilityDefinition>> capabilities = new HashMap<>(); + capabilities.put(capability.getName(), Lists.newArrayList(new CapabilityDefinition(capability))); + + requirement = new RequirementDataDefinition(); + requirement.setOwnerId(REQUIREMENT_OWNER_ID); + requirement.setUniqueId(REQUIREMENT_UID); + requirement.setName(REQUIREMENT_NAME); + requirement.setRelationship(RELATIONSHIP_TYPE); + + + Map<String, List<RequirementDefinition>> requirements = new HashMap<>(); + requirements.put(requirement.getCapability(), Lists.newArrayList(new RequirementDefinition(requirement))); + + toInstance.setCapabilities(capabilities); + fromInstance.setRequirements(requirements); + } + + + private static void createRelation() { + + relation = new RequirementCapabilityRelDef(); + CapabilityRequirementRelationship relationship = new CapabilityRequirementRelationship(); + RelationshipInfo relationInfo = new RelationshipInfo(); + relationInfo.setId(RELATION_ID); + relationship.setRelation(relationInfo); + + relation.setRelationships(Lists.newArrayList(relationship)); + relation.setToNode(TO_INSTANCE_ID); + relation.setFromNode(FROM_INSTANCE_ID); + + relationInfo.setCapabilityOwnerId(CAPABILITY_OWNER_ID); + relationInfo.setCapabilityUid(CAPABILITY_UID); + relationInfo.setCapability(CAPABILITY_NAME); + relationInfo.setRequirementOwnerId(REQUIREMENT_OWNER_ID); + relationInfo.setRequirementUid(REQUIREMENT_UID); + relationInfo.setRequirement(REQUIREMENT_NAME); + RelationshipImpl relationshipImpl = new RelationshipImpl(); + relationshipImpl.setType(RELATIONSHIP_TYPE); + relationInfo.setRelationships(relationshipImpl); + } +} @@ -31,7 +31,6 @@ import java.util.stream.Collectors; import org.apache.commons.lang3.tuple.ImmutablePair; import org.junit.Test; -import org.openecomp.sdc.be.components.impl.CompositionBusinessLogic; import org.openecomp.sdc.be.datatypes.enums.OriginTypeEnum; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.RequirementCapabilityRelDef; @@ -1,12 +1,8 @@ package org.openecomp.sdc.be.components.impl; -import javax.annotation.Generated; - -import org.junit.Assert; import org.junit.Test; import org.openecomp.sdc.be.model.ConsumerDefinition; import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; import org.openecomp.sdc.exception.ResponseFormat; import fj.data.Either; @@ -21,9 +21,9 @@ package org.openecomp.sdc.be.components.impl; import java.util.Arrays; + import org.junit.Assert; import org.junit.Test; -import org.openecomp.sdc.be.components.impl.CsarValidationUtils; public class CsarValidationUtilsTest { private String[] invalidExtensions = { null, ".bla", ".yaml", ".yml", ".txt", ".zip" }; @@ -2,48 +2,23 @@ package org.openecomp.sdc.be.components.impl; import java.util.List; import java.util.Map; -import java.util.Optional; -import java.util.Set; -import javax.annotation.Generated; - -import org.apache.commons.httpclient.NameValuePair; -import org.apache.commons.lang3.tuple.ImmutablePair; -import org.apache.tinkerpop.gremlin.structure.T; -import org.junit.Assert; import org.junit.Test; import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.dao.graph.datatype.GraphEdge; -import org.openecomp.sdc.be.datamodel.api.CategoryTypeEnum; -import org.openecomp.sdc.be.datatypes.components.ComponentMetadataDataDefinition; -import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.FilterKeyEnum; -import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; import org.openecomp.sdc.be.datatypes.enums.OriginTypeEnum; -import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.model.ArtifactType; import org.openecomp.sdc.be.model.Component; -import org.openecomp.sdc.be.model.DistributionStatusEnum; -import org.openecomp.sdc.be.model.LifecycleStateEnum; import org.openecomp.sdc.be.model.PropertyScope; -import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.model.category.CategoryDefinition; import org.openecomp.sdc.be.model.category.GroupingDefinition; import org.openecomp.sdc.be.model.category.SubCategoryDefinition; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; -import org.openecomp.sdc.be.resources.data.ComponentMetadataData; -import org.openecomp.sdc.be.resources.data.ResourceMetadataData; -import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; -import org.openecomp.sdc.be.resources.data.category.SubCategoryData; import org.openecomp.sdc.be.ui.model.UiCategories; import org.openecomp.sdc.exception.ResponseFormat; -import com.google.common.util.concurrent.Service; -import com.thinkaurelius.titan.core.TitanGraph; - import fj.data.Either; -import io.swagger.annotations.Tag; public class ElementBusinessLogicTest { @@ -4,8 +4,6 @@ import java.util.Collection; import java.util.List; import java.util.Map; -import javax.annotation.Generated; - import org.apache.commons.lang3.tuple.ImmutablePair; import org.junit.Test; import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; @@ -22,8 +22,9 @@ package org.openecomp.sdc.be.components.impl; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + import java.io.IOException; import java.nio.file.FileSystems; import java.nio.file.Files; @@ -33,10 +34,8 @@ import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Map.Entry; -import java.util.function.Function; import org.junit.Test; -import org.openecomp.sdc.be.components.impl.ImportUtils; import org.openecomp.sdc.be.components.impl.ImportUtils.ResultStatusEnum; import org.openecomp.sdc.be.components.impl.ImportUtils.ToscaElementTypeEnum; import org.openecomp.sdc.be.components.impl.ImportUtils.ToscaTagNamesEnum; @@ -20,7 +20,15 @@ package org.openecomp.sdc.be.components.impl; -import fj.data.Either; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + import org.junit.Before; import org.junit.Test; import org.mockito.InjectMocks; @@ -35,18 +43,10 @@ import org.openecomp.sdc.be.model.ComponentParametersView; import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; -import org.openecomp.sdc.be.model.operations.impl.PropertyOperation; import org.openecomp.sdc.be.user.IUserBusinessLogic; import org.openecomp.sdc.exception.ResponseFormat; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import fj.data.Either; public class InputsBusinessLogicTest { @@ -37,8 +37,6 @@ import org.mockito.Mockito; import org.mockito.MockitoAnnotations; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; -import org.openecomp.sdc.be.components.impl.CommonImportManager; -import org.openecomp.sdc.be.components.impl.InterfaceLifecycleTypeImportManager; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.InterfaceDefinition; import org.openecomp.sdc.be.model.operations.api.IInterfaceLifecycleOperation; @@ -3,10 +3,7 @@ package org.openecomp.sdc.be.components.impl; import java.util.List; import java.util.Map; -import javax.annotation.Generated; - import org.apache.commons.math3.stat.descriptive.summary.Product; -import org.junit.Assert; import org.junit.Test; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.model.Component; @@ -32,14 +32,11 @@ import java.util.EnumMap; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Set; -import java.util.regex.Pattern; import java.util.stream.Collectors; import javax.servlet.ServletContext; import org.apache.commons.lang3.tuple.ImmutablePair; -import org.junit.Assert; import org.junit.Before; import org.junit.Ignore; import org.junit.Test; @@ -51,55 +48,31 @@ import org.openecomp.sdc.be.auditing.api.IAuditingManager; import org.openecomp.sdc.be.auditing.impl.AuditingLogFormatUtil; import org.openecomp.sdc.be.auditing.impl.AuditingManager; import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic.ArtifactOperationEnum; -import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic.ArtifactOperationInfo; +import org.openecomp.sdc.be.components.impl.generic.GenericTypeBusinessLogic; import org.openecomp.sdc.be.components.lifecycle.LifecycleBusinessLogic; import org.openecomp.sdc.be.components.lifecycle.LifecycleChangeInfoWithAction; import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.dao.jsongraph.TitanDao; -import org.openecomp.sdc.be.datamodel.api.HighestFilterEnum; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.impl.WebAppContextWrapper; -import org.openecomp.sdc.be.info.ArtifactTemplateInfo; -import org.openecomp.sdc.be.info.MergedArtifactInfo; import org.openecomp.sdc.be.model.ArtifactDefinition; -import org.openecomp.sdc.be.model.CapabilityDefinition; import org.openecomp.sdc.be.model.Component; -import org.openecomp.sdc.be.model.ComponentInstance; -import org.openecomp.sdc.be.model.ComponentInstanceInput; -import org.openecomp.sdc.be.model.ComponentInstanceProperty; -import org.openecomp.sdc.be.model.CsarInfo; import org.openecomp.sdc.be.model.DataTypeDefinition; -import org.openecomp.sdc.be.model.GroupDefinition; -import org.openecomp.sdc.be.model.GroupProperty; -import org.openecomp.sdc.be.model.GroupTypeDefinition; -import org.openecomp.sdc.be.model.HeatParameterDefinition; import org.openecomp.sdc.be.model.InputDefinition; import org.openecomp.sdc.be.model.LifeCycleTransitionEnum; import org.openecomp.sdc.be.model.LifecycleStateEnum; -import org.openecomp.sdc.be.model.NodeTypeInfo; -import org.openecomp.sdc.be.model.ParsedToscaYamlInfo; import org.openecomp.sdc.be.model.PropertyDefinition; -import org.openecomp.sdc.be.model.RequirementCapabilityRelDef; -import org.openecomp.sdc.be.model.RequirementDefinition; import org.openecomp.sdc.be.model.Resource; -import org.openecomp.sdc.be.model.UploadCapInfo; -import org.openecomp.sdc.be.model.UploadComponentInstanceInfo; -import org.openecomp.sdc.be.model.UploadPropInfo; -import org.openecomp.sdc.be.model.UploadReqInfo; -import org.openecomp.sdc.be.model.UploadResourceInfo; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.model.cache.ApplicationDataTypeCache; -import org.openecomp.sdc.be.model.category.CategoryDefinition; -import org.openecomp.sdc.be.model.category.SubCategoryDefinition; import org.openecomp.sdc.be.model.jsontitan.operations.NodeTemplateOperation; import org.openecomp.sdc.be.model.jsontitan.operations.NodeTypeOperation; import org.openecomp.sdc.be.model.jsontitan.operations.TopologyTemplateOperation; import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; -import org.openecomp.sdc.be.model.operations.api.ICacheMangerOperation; import org.openecomp.sdc.be.model.operations.api.ICapabilityTypeOperation; import org.openecomp.sdc.be.model.operations.api.IElementOperation; import org.openecomp.sdc.be.model.operations.api.IPropertyOperation; @@ -110,15 +83,12 @@ import org.openecomp.sdc.be.model.operations.impl.GraphLockOperation; import org.openecomp.sdc.be.model.tosca.ToscaPropertyType; import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; import org.openecomp.sdc.be.tosca.CsarUtils.NonMetaArtifactInfo; -import org.openecomp.sdc.be.ui.model.UiComponentDataTransfer; -import org.openecomp.sdc.be.user.IUserBusinessLogic; import org.openecomp.sdc.be.user.Role; import org.openecomp.sdc.be.user.UserBusinessLogic; import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum; import org.openecomp.sdc.common.api.ArtifactTypeEnum; import org.openecomp.sdc.common.api.ConfigurationSource; import org.openecomp.sdc.common.api.Constants; -import org.openecomp.sdc.common.datastructure.AuditingFieldsKeysEnum; import org.openecomp.sdc.common.impl.ExternalConfiguration; import org.openecomp.sdc.common.impl.FSConfigurationSource; import org.openecomp.sdc.common.util.GeneralUtility; @@ -128,10 +98,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.web.context.WebApplicationContext; -import com.att.nsa.cambria.test.support.CambriaBatchingPublisherMock.Entry; -import com.google.common.base.Equivalence.Wrapper; -import com.netflix.astyanax.connectionpool.Operation; - import fj.data.Either; public class ResourceBusinessLogicTest { @@ -145,10 +111,10 @@ public class ResourceBusinessLogicTest { public static final String UPDATED_SUBCATEGORY = "Gateway"; public static final String RESOURCE_NAME = "My-Resource_Name with space"; - private static final String GENERIC_VF_NAME = "org.openecomp.resource.abstract.nodes.VF"; - private static final String GENERIC_VFC_NAME = "org.openecomp.resource.abstract.nodes.VFC"; - private static final String GENERIC_PNF_NAME = "org.openecomp.resource.abstract.nodes.PNF"; - + private static final String GENERIC_VF_NAME = "org.openecomp.resource.abstract.nodes.VF"; + private static final String GENERIC_VFC_NAME = "org.openecomp.resource.abstract.nodes.VFC"; + private static final String GENERIC_PNF_NAME = "org.openecomp.resource.abstract.nodes.PNF"; + final ServletContext servletContext = Mockito.mock(ServletContext.class); IAuditingManager iAuditingManager = null; IElementOperation mockElementDao; @@ -179,9 +145,10 @@ public class ResourceBusinessLogicTest { ArtifactsBusinessLogic artifactManager = new ArtifactsBusinessLogic(); CsarOperation csarOperation = Mockito.mock(CsarOperation.class); Map<String, DataTypeDefinition> emptyDataTypes = new HashMap<String, DataTypeDefinition>(); - + private GenericTypeBusinessLogic genericTypeBusinessLogic = Mockito.mock(GenericTypeBusinessLogic.class); CacheMangerOperation cacheManager = Mockito.mock(CacheMangerOperation.class); + public ResourceBusinessLogicTest() { } @@ -195,8 +162,7 @@ public class ResourceBusinessLogicTest { // Init Configuration String appConfigDir = "src/test/resources/config/catalog-be"; - ConfigurationSource configurationSource = new FSConfigurationSource(ExternalConfiguration.getChangeListener(), - appConfigDir); + ConfigurationSource configurationSource = new FSConfigurationSource(ExternalConfiguration.getChangeListener(), appConfigDir); ConfigurationManager configurationManager = new ConfigurationManager(configurationSource); // Elements @@ -214,38 +180,30 @@ public class ResourceBusinessLogicTest { // Servlet Context attributes when(servletContext.getAttribute(Constants.CONFIGURATION_MANAGER_ATTR)).thenReturn(configurationManager); - when(servletContext.getAttribute(Constants.WEB_APPLICATION_CONTEXT_WRAPPER_ATTR)) - .thenReturn(webAppContextWrapper); + when(servletContext.getAttribute(Constants.WEB_APPLICATION_CONTEXT_WRAPPER_ATTR)).thenReturn(webAppContextWrapper); when(webAppContextWrapper.getWebAppContext(servletContext)).thenReturn(webAppContext); when(webAppContext.getBean(IElementOperation.class)).thenReturn(mockElementDao); Either<Integer, StorageOperationStatus> eitherCountRoot = Either.left(1); Either<Boolean, StorageOperationStatus> eitherFalse = Either.left(true); - when(toscaOperationFacade.validateComponentNameExists("Root", ResourceTypeEnum.VFC, ComponentTypeEnum.RESOURCE)) - .thenReturn(eitherFalse); + when(toscaOperationFacade.validateComponentNameExists("Root", ResourceTypeEnum.VFC, ComponentTypeEnum.RESOURCE)).thenReturn(eitherFalse); Either<Boolean, StorageOperationStatus> eitherCountExist = Either.left(true); - when(toscaOperationFacade.validateComponentNameExists("alreadyExists", ResourceTypeEnum.VFC, - ComponentTypeEnum.RESOURCE)).thenReturn(eitherCountExist); - + when(toscaOperationFacade.validateComponentNameExists("alreadyExists", ResourceTypeEnum.VFC, ComponentTypeEnum.RESOURCE)).thenReturn(eitherCountExist); + Either<Boolean, StorageOperationStatus> eitherCount = Either.left(false); - when(toscaOperationFacade.validateComponentNameExists(RESOURCE_NAME, ResourceTypeEnum.VFC, - ComponentTypeEnum.RESOURCE)).thenReturn(eitherCount); - when(toscaOperationFacade.validateComponentNameExists(RESOURCE_NAME, ResourceTypeEnum.VF, - ComponentTypeEnum.RESOURCE)).thenReturn(eitherCount); - when(toscaOperationFacade.validateComponentNameExists(RESOURCE_NAME, ResourceTypeEnum.PNF, - ComponentTypeEnum.RESOURCE)).thenReturn(eitherCount); - + when(toscaOperationFacade.validateComponentNameExists(RESOURCE_NAME, ResourceTypeEnum.VFC, ComponentTypeEnum.RESOURCE)).thenReturn(eitherCount); + when(toscaOperationFacade.validateComponentNameExists(RESOURCE_NAME, ResourceTypeEnum.VF, ComponentTypeEnum.RESOURCE)).thenReturn(eitherCount); + when(toscaOperationFacade.validateComponentNameExists(RESOURCE_NAME, ResourceTypeEnum.PNF, ComponentTypeEnum.RESOURCE)).thenReturn(eitherCount); + Either<Boolean, StorageOperationStatus> validateDerivedExists = Either.left(true); when(toscaOperationFacade.validateToscaResourceNameExists("Root")).thenReturn(validateDerivedExists); - + Either<Boolean, StorageOperationStatus> validateDerivedNotExists = Either.left(false); when(toscaOperationFacade.validateToscaResourceNameExists("kuku")).thenReturn(validateDerivedNotExists); - when(graphLockOperation.lockComponent(Mockito.anyString(), Mockito.eq(NodeTypeEnum.Resource))) - .thenReturn(StorageOperationStatus.OK); - when(graphLockOperation.lockComponentByName(Mockito.anyString(), Mockito.eq(NodeTypeEnum.Resource))) - .thenReturn(StorageOperationStatus.OK); - + when(graphLockOperation.lockComponent(Mockito.anyString(), Mockito.eq(NodeTypeEnum.Resource))).thenReturn(StorageOperationStatus.OK); + when(graphLockOperation.lockComponentByName(Mockito.anyString(), Mockito.eq(NodeTypeEnum.Resource))).thenReturn(StorageOperationStatus.OK); + // createResource resourceResponse = createResourceObject(true); Either<Resource, StorageOperationStatus> eitherCreate = Either.left(resourceResponse); @@ -272,6 +230,7 @@ public class ResourceBusinessLogicTest { bl.setApplicationDataTypeCache(applicationDataTypeCache); bl.setCsarOperation(csarOperation); bl.setCacheManagerOperation(cacheManager); + bl.setGenericTypeBusinessLogic(genericTypeBusinessLogic); toscaOperationFacade.setNodeTypeOperation(nodeTypeOperation); toscaOperationFacade.setTopologyTemplateOperation(topologyTemplateOperation); bl.setToscaOperationFacade(toscaOperationFacade); @@ -334,7 +293,7 @@ public class ResourceBusinessLogicTest { if (afterCreate) { resource.setName(resource.getName()); resource.setVersion("0.1"); - + resource.setUniqueId(resource.getName().toLowerCase() + ":" + resource.getVersion()); resource.setCreatorUserId(user.getUserId()); resource.setCreatorFullName(user.getFirstName() + " " + user.getLastName()); @@ -352,8 +311,7 @@ public class ResourceBusinessLogicTest { @Test public void testHappyScenario() { Resource resource = createResourceObject(false); - Either<Resource, ResponseFormat> createResponse = bl.createResource(resource, - AuditingActionEnum.CREATE_RESOURCE, user, null, null); + Either<Resource, ResponseFormat> createResponse = bl.createResource(resource, AuditingActionEnum.CREATE_RESOURCE, user, null, null); if (createResponse.isRight()) { assertEquals(new Integer(200), createResponse.right().value().getStatus()); @@ -365,17 +323,15 @@ public class ResourceBusinessLogicTest { public void testUpdateHappyScenario() { Resource resource = createResourceObjectCsar(true); setCanWorkOnResource(resource); - + Either<Resource, StorageOperationStatus> resourceLinkedToCsarRes = Either.left(resource); - when(toscaOperationFacade.getLatestComponentByCsarOrName(ComponentTypeEnum.RESOURCE, resource.getCsarUUID(), - resource.getSystemName())).thenReturn(resourceLinkedToCsarRes); + when(toscaOperationFacade.getLatestComponentByCsarOrName(ComponentTypeEnum.RESOURCE, resource.getCsarUUID(), resource.getSystemName())).thenReturn(resourceLinkedToCsarRes); Either<Boolean, StorageOperationStatus> validateDerivedExists = Either.left(true); when(toscaOperationFacade.validateToscaResourceNameExists("Root")).thenReturn(validateDerivedExists); - + Either<Resource, StorageOperationStatus> dataModelResponse = Either.left(resource); when(toscaOperationFacade.updateToscaElement(resource)).thenReturn(dataModelResponse); - Either<Resource, ResponseFormat> updateResponse = bl.validateAndUpdateResourceFromCsar(resource, user, null, - null, resource.getUniqueId()); + Either<Resource, ResponseFormat> updateResponse = bl.validateAndUpdateResourceFromCsar(resource, user, null, null, resource.getUniqueId()); if (updateResponse.isRight()) { assertEquals(new Integer(200), updateResponse.right().value().getStatus()); } @@ -403,7 +359,7 @@ public class ResourceBusinessLogicTest { testTagsExceedsLimitCreate(); testTagsNoServiceName(); testInvalidTag(); - + testContactIdTooLong(); testContactIdWrongFormatCreate(); testResourceContactIdEmpty(); @@ -431,18 +387,15 @@ public class ResourceBusinessLogicTest { resourceExist.setName(resourceName); resourceExist.getTags().add(resourceName); - Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExist, - AuditingActionEnum.CREATE_RESOURCE, user, null, null); - assertResponse(createResponse, ActionStatus.COMPONENT_NAME_ALREADY_EXIST, ComponentTypeEnum.RESOURCE.getValue(), - resourceName); + Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExist, AuditingActionEnum.CREATE_RESOURCE, user, null, null); + assertResponse(createResponse, ActionStatus.COMPONENT_NAME_ALREADY_EXIST, ComponentTypeEnum.RESOURCE.getValue(), resourceName); } private void testResourceNameEmpty() { Resource resourceExist = createResourceObject(false); resourceExist.setName(null); - Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExist, - AuditingActionEnum.CREATE_RESOURCE, user, null, null); + Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExist, AuditingActionEnum.CREATE_RESOURCE, user, null, null); assertResponse(createResponse, ActionStatus.MISSING_COMPONENT_NAME, ComponentTypeEnum.RESOURCE.getValue()); } @@ -452,11 +405,9 @@ public class ResourceBusinessLogicTest { String tooLongResourceName = "zCRCAWjqte0DtgcAAMmcJcXeNubeX1p1vOZNTShAHOYNAHvV3iK"; resourceExccedsNameLimit.setName(tooLongResourceName); - Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExccedsNameLimit, - AuditingActionEnum.CREATE_RESOURCE, user, null, null); + Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExccedsNameLimit, AuditingActionEnum.CREATE_RESOURCE, user, null, null); assertTrue(createResponse.isRight()); - assertResponse(createResponse, ActionStatus.COMPONENT_NAME_EXCEEDS_LIMIT, ComponentTypeEnum.RESOURCE.getValue(), - "" + ValidationUtils.COMPONENT_NAME_MAX_LENGTH); + assertResponse(createResponse, ActionStatus.COMPONENT_NAME_EXCEEDS_LIMIT, ComponentTypeEnum.RESOURCE.getValue(), "" + ValidationUtils.COMPONENT_NAME_MAX_LENGTH); } private void testResourceNameWrongFormat() { @@ -465,8 +416,7 @@ public class ResourceBusinessLogicTest { String nameWrongFormat = "ljg?fd"; resource.setName(nameWrongFormat); - Either<Resource, ResponseFormat> createResponse = bl.createResource(resource, - AuditingActionEnum.CREATE_RESOURCE, user, null, null); + Either<Resource, ResponseFormat> createResponse = bl.createResource(resource, AuditingActionEnum.CREATE_RESOURCE, user, null, null); assertTrue(createResponse.isRight()); assertResponse(createResponse, ActionStatus.INVALID_COMPONENT_NAME, ComponentTypeEnum.RESOURCE.getValue()); } @@ -487,11 +437,9 @@ public class ResourceBusinessLogicTest { resourceExccedsDescLimit.setDescription(tooLongResourceDesc); - Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExccedsDescLimit, - AuditingActionEnum.CREATE_RESOURCE, user, null, null); + Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExccedsDescLimit, AuditingActionEnum.CREATE_RESOURCE, user, null, null); assertTrue(createResponse.isRight()); - assertResponse(createResponse, ActionStatus.COMPONENT_DESCRIPTION_EXCEEDS_LIMIT, - ComponentTypeEnum.RESOURCE.getValue(), "" + ValidationUtils.COMPONENT_DESCRIPTION_MAX_LENGTH); + assertResponse(createResponse, ActionStatus.COMPONENT_DESCRIPTION_EXCEEDS_LIMIT, ComponentTypeEnum.RESOURCE.getValue(), "" + ValidationUtils.COMPONENT_DESCRIPTION_MAX_LENGTH); } private void testResourceDescNotEnglish() { @@ -500,35 +448,29 @@ public class ResourceBusinessLogicTest { String notEnglishDesc = "\uC2B5"; notEnglish.setDescription(notEnglishDesc); - Either<Resource, ResponseFormat> createResponse = bl.createResource(notEnglish, - AuditingActionEnum.CREATE_RESOURCE, user, null, null); + Either<Resource, ResponseFormat> createResponse = bl.createResource(notEnglish, AuditingActionEnum.CREATE_RESOURCE, user, null, null); assertTrue(createResponse.isRight()); - assertResponse(createResponse, ActionStatus.COMPONENT_INVALID_DESCRIPTION, - ComponentTypeEnum.RESOURCE.getValue()); + assertResponse(createResponse, ActionStatus.COMPONENT_INVALID_DESCRIPTION, ComponentTypeEnum.RESOURCE.getValue()); } private void testResourceDescriptionEmpty() { Resource resourceExist = createResourceObject(false); resourceExist.setDescription(""); - Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExist, - AuditingActionEnum.CREATE_RESOURCE, user, null, null); + Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExist, AuditingActionEnum.CREATE_RESOURCE, user, null, null); assertTrue(createResponse.isRight()); - assertResponse(createResponse, ActionStatus.COMPONENT_MISSING_DESCRIPTION, - ComponentTypeEnum.RESOURCE.getValue()); + assertResponse(createResponse, ActionStatus.COMPONENT_MISSING_DESCRIPTION, ComponentTypeEnum.RESOURCE.getValue()); } private void testResourceDescriptionMissing() { Resource resourceExist = createResourceObject(false); resourceExist.setDescription(null); - Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExist, - AuditingActionEnum.CREATE_RESOURCE, user, null, null); + Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExist, AuditingActionEnum.CREATE_RESOURCE, user, null, null); assertTrue(createResponse.isRight()); - assertResponse(createResponse, ActionStatus.COMPONENT_MISSING_DESCRIPTION, - ComponentTypeEnum.RESOURCE.getValue()); + assertResponse(createResponse, ActionStatus.COMPONENT_MISSING_DESCRIPTION, ComponentTypeEnum.RESOURCE.getValue()); } // Resource description - end // Resource icon start @@ -537,8 +479,7 @@ public class ResourceBusinessLogicTest { Resource resourceExist = createResourceObject(false); resourceExist.setIcon(null); - Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExist, - AuditingActionEnum.CREATE_RESOURCE, user, null, null); + Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExist, AuditingActionEnum.CREATE_RESOURCE, user, null, null); assertTrue(createResponse.isRight()); assertResponse(createResponse, ActionStatus.COMPONENT_MISSING_ICON, ComponentTypeEnum.RESOURCE.getValue()); @@ -548,8 +489,7 @@ public class ResourceBusinessLogicTest { Resource resourceExist = createResourceObject(false); resourceExist.setIcon("kjk3453^&"); - Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExist, - AuditingActionEnum.CREATE_RESOURCE, user, null, null); + Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExist, AuditingActionEnum.CREATE_RESOURCE, user, null, null); assertTrue(createResponse.isRight()); assertResponse(createResponse, ActionStatus.COMPONENT_INVALID_ICON, ComponentTypeEnum.RESOURCE.getValue()); @@ -559,12 +499,10 @@ public class ResourceBusinessLogicTest { Resource resourceExist = createResourceObject(false); resourceExist.setIcon("dsjfhskdfhskjdhfskjdhkjdhfkshdfksjsdkfhsdfsdfsdfsfsdfsf"); - Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExist, - AuditingActionEnum.CREATE_RESOURCE, user, null, null); + Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExist, AuditingActionEnum.CREATE_RESOURCE, user, null, null); assertTrue(createResponse.isRight()); - assertResponse(createResponse, ActionStatus.COMPONENT_ICON_EXCEEDS_LIMIT, ComponentTypeEnum.RESOURCE.getValue(), - "" + ValidationUtils.ICON_MAX_LENGTH); + assertResponse(createResponse, ActionStatus.COMPONENT_ICON_EXCEEDS_LIMIT, ComponentTypeEnum.RESOURCE.getValue(), "" + ValidationUtils.ICON_MAX_LENGTH); } // Resource icon end @@ -573,8 +511,7 @@ public class ResourceBusinessLogicTest { Resource resourceExist = createResourceObject(false); resourceExist.setTags(null); - Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExist, - AuditingActionEnum.CREATE_RESOURCE, user, null, null); + Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExist, AuditingActionEnum.CREATE_RESOURCE, user, null, null); assertTrue(createResponse.isRight()); assertResponse(createResponse, ActionStatus.COMPONENT_MISSING_TAGS); @@ -584,8 +521,7 @@ public class ResourceBusinessLogicTest { Resource resourceExist = createResourceObject(false); resourceExist.setTags(new ArrayList<String>()); - Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExist, - AuditingActionEnum.CREATE_RESOURCE, user, null, null); + Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExist, AuditingActionEnum.CREATE_RESOURCE, user, null, null); assertTrue(createResponse.isRight()); assertResponse(createResponse, ActionStatus.COMPONENT_MISSING_TAGS); @@ -641,11 +577,9 @@ public class ResourceBusinessLogicTest { resourceExccedsNameLimit.setTags(tagsList); - Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExccedsNameLimit, - AuditingActionEnum.CREATE_RESOURCE, user, null, null); + Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExccedsNameLimit, AuditingActionEnum.CREATE_RESOURCE, user, null, null); assertTrue(createResponse.isRight()); - assertResponse(createResponse, ActionStatus.COMPONENT_TAGS_EXCEED_LIMIT, - "" + ValidationUtils.TAG_LIST_MAX_LENGTH); + assertResponse(createResponse, ActionStatus.COMPONENT_TAGS_EXCEED_LIMIT, "" + ValidationUtils.TAG_LIST_MAX_LENGTH); } @@ -659,11 +593,9 @@ public class ResourceBusinessLogicTest { resourceExccedsNameLimit.setTags(tagsList); - Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExccedsNameLimit, - AuditingActionEnum.CREATE_RESOURCE, user, null, null); + Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExccedsNameLimit, AuditingActionEnum.CREATE_RESOURCE, user, null, null); assertTrue(createResponse.isRight()); - assertResponse(createResponse, ActionStatus.COMPONENT_SINGLE_TAG_EXCEED_LIMIT, - "" + ValidationUtils.TAG_MAX_LENGTH); + assertResponse(createResponse, ActionStatus.COMPONENT_SINGLE_TAG_EXCEED_LIMIT, "" + ValidationUtils.TAG_MAX_LENGTH); } @@ -674,8 +606,7 @@ public class ResourceBusinessLogicTest { tagsList.add(tag1); serviceExccedsNameLimit.setTags(tagsList); - Either<Resource, ResponseFormat> createResponse = bl.createResource(serviceExccedsNameLimit, - AuditingActionEnum.CREATE_RESOURCE, user, null, null); + Either<Resource, ResponseFormat> createResponse = bl.createResource(serviceExccedsNameLimit, AuditingActionEnum.CREATE_RESOURCE, user, null, null); assertTrue(createResponse.isRight()); assertResponse(createResponse, ActionStatus.COMPONENT_INVALID_TAGS_NO_COMP_NAME); @@ -688,8 +619,7 @@ public class ResourceBusinessLogicTest { tagsList.add(tag1); serviceExccedsNameLimit.setTags(tagsList); - Either<Resource, ResponseFormat> createResponse = bl.createResource(serviceExccedsNameLimit, - AuditingActionEnum.CREATE_RESOURCE, user, null, null); + Either<Resource, ResponseFormat> createResponse = bl.createResource(serviceExccedsNameLimit, AuditingActionEnum.CREATE_RESOURCE, user, null, null); assertTrue(createResponse.isRight()); assertResponse(createResponse, ActionStatus.INVALID_FIELD_FORMAT, new String[] { "Resource", "tag" }); @@ -697,15 +627,14 @@ public class ResourceBusinessLogicTest { // Resource tags - stop // Resource contact start - + private void testContactIdTooLong() { Resource resourceContactId = createResourceObject(false); // 59 chars instead of 50 String contactIdTooLong = "thisNameIsVeryLongAndExeccedsTheNormalLengthForContactId"; resourceContactId.setContactId(contactIdTooLong); - Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceContactId, - AuditingActionEnum.CREATE_RESOURCE, user, null, null); + Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceContactId, AuditingActionEnum.CREATE_RESOURCE, user, null, null); assertTrue(createResponse.isRight()); assertResponse(createResponse, ActionStatus.COMPONENT_INVALID_CONTACT, ComponentTypeEnum.RESOURCE.getValue()); } @@ -716,8 +645,7 @@ public class ResourceBusinessLogicTest { String contactIdFormatWrong = "yrt134!!!"; resourceContactId.setContactId(contactIdFormatWrong); - Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceContactId, - AuditingActionEnum.CREATE_RESOURCE, user, null, null); + Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceContactId, AuditingActionEnum.CREATE_RESOURCE, user, null, null); assertTrue(createResponse.isRight()); assertResponse(createResponse, ActionStatus.COMPONENT_INVALID_CONTACT, ComponentTypeEnum.RESOURCE.getValue()); } @@ -726,8 +654,7 @@ public class ResourceBusinessLogicTest { Resource resourceExist = createResourceObject(false); resourceExist.setContactId(""); - Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExist, - AuditingActionEnum.CREATE_RESOURCE, user, null, null); + Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExist, AuditingActionEnum.CREATE_RESOURCE, user, null, null); assertTrue(createResponse.isRight()); assertResponse(createResponse, ActionStatus.COMPONENT_MISSING_CONTACT, ComponentTypeEnum.RESOURCE.getValue()); @@ -737,8 +664,7 @@ public class ResourceBusinessLogicTest { Resource resourceExist = createResourceObject(false); resourceExist.setContactId(null); - Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExist, - AuditingActionEnum.CREATE_RESOURCE, user, null, null); + Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExist, AuditingActionEnum.CREATE_RESOURCE, user, null, null); assertTrue(createResponse.isRight()); assertResponse(createResponse, ActionStatus.COMPONENT_MISSING_CONTACT, ComponentTypeEnum.RESOURCE.getValue()); @@ -749,23 +675,19 @@ public class ResourceBusinessLogicTest { String tooLongVendorName = "h1KSyJh9Eh1KSyJh9Eh1KSyJh9Eh1KSyJh9Eh1KSyJh9Eh1KSyJh9Eh1KSyJh9Eh1KSyJh9E"; resourceExccedsVendorNameLimit.setVendorName(tooLongVendorName); - Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExccedsVendorNameLimit, - AuditingActionEnum.CREATE_RESOURCE, user, null, null); + Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExccedsVendorNameLimit, AuditingActionEnum.CREATE_RESOURCE, user, null, null); assertTrue(createResponse.isRight()); - assertResponse(createResponse, ActionStatus.VENDOR_NAME_EXCEEDS_LIMIT, - "" + ValidationUtils.VENDOR_NAME_MAX_LENGTH); + assertResponse(createResponse, ActionStatus.VENDOR_NAME_EXCEEDS_LIMIT, "" + ValidationUtils.VENDOR_NAME_MAX_LENGTH); } - + private void testResourceVendorModelNumberExceedsLimit() { Resource resourceExccedsVendorModelNumberLimit = createResourceObject(false); String tooLongVendorModelNumber = "h1KSyJh9Eh1KSyJh9Eh1KSyJh9Eh1KSyJh9Eh1KSyJh9Eh1KSyJh9Eh1KSyJh9Eh1KSyJh9E"; resourceExccedsVendorModelNumberLimit.setResourceVendorModelNumber(tooLongVendorModelNumber); - Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExccedsVendorModelNumberLimit, - AuditingActionEnum.CREATE_RESOURCE, user, null, null); + Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExccedsVendorModelNumberLimit, AuditingActionEnum.CREATE_RESOURCE, user, null, null); assertTrue(createResponse.isRight()); - assertResponse(createResponse, ActionStatus.RESOURCE_VENDOR_MODEL_NUMBER_EXCEEDS_LIMIT, - "" + ValidationUtils.RESOURCE_VENDOR_MODEL_NUMBER_MAX_LENGTH); + assertResponse(createResponse, ActionStatus.RESOURCE_VENDOR_MODEL_NUMBER_EXCEEDS_LIMIT, "" + ValidationUtils.RESOURCE_VENDOR_MODEL_NUMBER_MAX_LENGTH); } private void testVendorNameWrongFormatCreate() { @@ -774,8 +696,7 @@ public class ResourceBusinessLogicTest { String nameWrongFormat = "ljg*fd"; resource.setVendorName(nameWrongFormat); - Either<Resource, ResponseFormat> createResponse = bl.createResource(resource, - AuditingActionEnum.CREATE_RESOURCE, user, null, null); + Either<Resource, ResponseFormat> createResponse = bl.createResource(resource, AuditingActionEnum.CREATE_RESOURCE, user, null, null); assertTrue(createResponse.isRight()); assertResponse(createResponse, ActionStatus.INVALID_VENDOR_NAME); } @@ -786,8 +707,7 @@ public class ResourceBusinessLogicTest { String nameWrongFormat = "1>2"; resource.setVendorRelease(nameWrongFormat); - Either<Resource, ResponseFormat> createResponse = bl.createResource(resource, - AuditingActionEnum.CREATE_RESOURCE, user, null, null); + Either<Resource, ResponseFormat> createResponse = bl.createResource(resource, AuditingActionEnum.CREATE_RESOURCE, user, null, null); assertTrue(createResponse.isRight()); assertResponse(createResponse, ActionStatus.INVALID_VENDOR_RELEASE); @@ -798,19 +718,16 @@ public class ResourceBusinessLogicTest { String tooLongVendorRelease = "h1KSyJh9Eh1KSyJh9Eh1KSyJh9Eh1KSyJh9E"; resourceExccedsNameLimit.setVendorRelease(tooLongVendorRelease); - Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExccedsNameLimit, - AuditingActionEnum.CREATE_RESOURCE, user, null, null); + Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExccedsNameLimit, AuditingActionEnum.CREATE_RESOURCE, user, null, null); assertTrue(createResponse.isRight()); - assertResponse(createResponse, ActionStatus.VENDOR_RELEASE_EXCEEDS_LIMIT, - "" + ValidationUtils.VENDOR_RELEASE_MAX_LENGTH); + assertResponse(createResponse, ActionStatus.VENDOR_RELEASE_EXCEEDS_LIMIT, "" + ValidationUtils.VENDOR_RELEASE_MAX_LENGTH); } private void testResourceVendorNameMissing() { Resource resourceExist = createResourceObject(false); resourceExist.setVendorName(null); - Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExist, - AuditingActionEnum.CREATE_RESOURCE, user, null, null); + Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExist, AuditingActionEnum.CREATE_RESOURCE, user, null, null); assertTrue(createResponse.isRight()); assertResponse(createResponse, ActionStatus.MISSING_VENDOR_NAME); @@ -820,8 +737,7 @@ public class ResourceBusinessLogicTest { Resource resourceExist = createResourceObject(false); resourceExist.setVendorRelease(null); - Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExist, - AuditingActionEnum.CREATE_RESOURCE, user, null, null); + Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExist, AuditingActionEnum.CREATE_RESOURCE, user, null, null); assertTrue(createResponse.isRight()); assertResponse(createResponse, ActionStatus.MISSING_VENDOR_RELEASE); @@ -833,8 +749,7 @@ public class ResourceBusinessLogicTest { Resource resourceExist = createResourceObject(false); resourceExist.setCategories(null); - Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExist, - AuditingActionEnum.CREATE_RESOURCE, user, null, null); + Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExist, AuditingActionEnum.CREATE_RESOURCE, user, null, null); assertTrue(createResponse.isRight()); assertResponse(createResponse, ActionStatus.COMPONENT_MISSING_CATEGORY, ComponentTypeEnum.RESOURCE.getValue()); @@ -846,8 +761,7 @@ public class ResourceBusinessLogicTest { resourceExist.setCategories(null); resourceExist.addCategory("koko", "koko"); - Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExist, - AuditingActionEnum.CREATE_RESOURCE, user, null, null); + Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExist, AuditingActionEnum.CREATE_RESOURCE, user, null, null); assertTrue(createResponse.isRight()); assertResponse(createResponse, ActionStatus.COMPONENT_INVALID_CATEGORY, ComponentTypeEnum.RESOURCE.getValue()); @@ -866,8 +780,7 @@ public class ResourceBusinessLogicTest { String licenseType = "User"; createResourceObject.setCost(cost); createResourceObject.setLicenseType(licenseType); - Either<Resource, ResponseFormat> createResponse = bl.createResource(createResourceObject, - AuditingActionEnum.CREATE_RESOURCE, user, null, null); + Either<Resource, ResponseFormat> createResponse = bl.createResource(createResourceObject, AuditingActionEnum.CREATE_RESOURCE, user, null, null); if (createResponse.isRight()) { assertEquals(new Integer(200), createResponse.right().value().getStatus()); @@ -883,8 +796,7 @@ public class ResourceBusinessLogicTest { String cost = "12356,464"; resourceCost.setCost(cost); - Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceCost, - AuditingActionEnum.CREATE_RESOURCE, user, null, null); + Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceCost, AuditingActionEnum.CREATE_RESOURCE, user, null, null); assertTrue(createResponse.isRight()); assertResponse(createResponse, ActionStatus.INVALID_CONTENT); } @@ -897,8 +809,7 @@ public class ResourceBusinessLogicTest { String licenseType = "cpu"; resourceLicenseType.setLicenseType(licenseType); - Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceLicenseType, - AuditingActionEnum.CREATE_RESOURCE, user, null, null); + Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceLicenseType, AuditingActionEnum.CREATE_RESOURCE, user, null, null); assertTrue(createResponse.isRight()); assertResponse(createResponse, ActionStatus.INVALID_CONTENT); } @@ -910,8 +821,7 @@ public class ResourceBusinessLogicTest { List<String> list = null; resourceExist.setDerivedFrom(list); - Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExist, - AuditingActionEnum.CREATE_RESOURCE, user, null, null); + Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExist, AuditingActionEnum.CREATE_RESOURCE, user, null, null); assertTrue(createResponse.isRight()); assertResponse(createResponse, ActionStatus.MISSING_DERIVED_FROM_TEMPLATE); @@ -921,8 +831,7 @@ public class ResourceBusinessLogicTest { Resource resourceExist = createResourceObject(false); resourceExist.setDerivedFrom(new ArrayList<String>()); - Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExist, - AuditingActionEnum.CREATE_RESOURCE, user, null, null); + Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExist, AuditingActionEnum.CREATE_RESOURCE, user, null, null); assertTrue(createResponse.isRight()); assertResponse(createResponse, ActionStatus.MISSING_DERIVED_FROM_TEMPLATE); @@ -934,21 +843,18 @@ public class ResourceBusinessLogicTest { derivedFrom.add("kuku"); resourceExist.setDerivedFrom(derivedFrom); - Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExist, - AuditingActionEnum.CREATE_RESOURCE, user, null, null); + Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExist, AuditingActionEnum.CREATE_RESOURCE, user, null, null); assertTrue(createResponse.isRight()); assertResponse(createResponse, ActionStatus.PARENT_RESOURCE_NOT_FOUND); } // Derived from stop - private void assertResponse(Either<Resource, ResponseFormat> createResponse, ActionStatus expectedStatus, - String... variables) { + private void assertResponse(Either<Resource, ResponseFormat> createResponse, ActionStatus expectedStatus, String... variables) { ResponseFormat expectedResponse = responseManager.getResponseFormat(expectedStatus, variables); ResponseFormat actualResponse = createResponse.right().value(); assertEquals(expectedResponse.getStatus(), actualResponse.getStatus()); - assertEquals("assert error description", expectedResponse.getFormattedMessage(), - actualResponse.getFormattedMessage()); + assertEquals("assert error description", expectedResponse.getFormattedMessage(), actualResponse.getFormattedMessage()); } // UPDATE tests - start @@ -967,9 +873,8 @@ public class ResourceBusinessLogicTest { Either<Resource, StorageOperationStatus> dataModelResponse = Either.left(resource); when(toscaOperationFacade.updateToscaElement(resource)).thenReturn(dataModelResponse); - - Either<Resource, ResponseFormat> createResponse = bl.updateResourceMetadata(resource.getUniqueId(), - updatedResource, null, user, false); + + Either<Resource, ResponseFormat> createResponse = bl.updateResourceMetadata(resource.getUniqueId(), updatedResource, null, user, false); assertTrue(createResponse.isRight()); assertResponse(createResponse, ActionStatus.INVALID_COMPONENT_NAME, ComponentTypeEnum.RESOURCE.getValue()); @@ -988,12 +893,11 @@ public class ResourceBusinessLogicTest { String name = "ljg"; updatedResource.setName(name); resource.setVersion("1.0"); - + Either<Resource, StorageOperationStatus> dataModelResponse = Either.left(resource); when(toscaOperationFacade.updateToscaElement(resource)).thenReturn(dataModelResponse); - Either<Resource, ResponseFormat> createResponse = bl.updateResourceMetadata(resource.getUniqueId(), - updatedResource, null, user, false); + Either<Resource, ResponseFormat> createResponse = bl.updateResourceMetadata(resource.getUniqueId(), updatedResource, null, user, false); assertTrue(createResponse.isRight()); assertResponse(createResponse, ActionStatus.RESOURCE_NAME_CANNOT_BE_CHANGED); @@ -1014,11 +918,9 @@ public class ResourceBusinessLogicTest { Either<Resource, StorageOperationStatus> dataModelResponse = Either.left(resource); when(toscaOperationFacade.updateToscaElement(resource)).thenReturn(dataModelResponse); - Either<Resource, ResponseFormat> createResponse = bl.updateResourceMetadata(resource.getUniqueId(), - updatedResource, null, user, false); + Either<Resource, ResponseFormat> createResponse = bl.updateResourceMetadata(resource.getUniqueId(), updatedResource, null, user, false); assertTrue(createResponse.isRight()); - assertResponse(createResponse, ActionStatus.COMPONENT_NAME_EXCEEDS_LIMIT, ComponentTypeEnum.RESOURCE.getValue(), - "" + ValidationUtils.COMPONENT_NAME_MAX_LENGTH); + assertResponse(createResponse, ActionStatus.COMPONENT_NAME_EXCEEDS_LIMIT, ComponentTypeEnum.RESOURCE.getValue(), "" + ValidationUtils.COMPONENT_NAME_MAX_LENGTH); } @Test @@ -1034,11 +936,9 @@ public class ResourceBusinessLogicTest { updatedResource.setName(resourceName); Either<Resource, StorageOperationStatus> dataModelResponse = Either.left(updatedResource); when(toscaOperationFacade.updateToscaElement(updatedResource)).thenReturn(dataModelResponse); - Either<Resource, ResponseFormat> createResponse = bl.updateResourceMetadata(resource.getUniqueId(), - updatedResource, null, user, false); + Either<Resource, ResponseFormat> createResponse = bl.updateResourceMetadata(resource.getUniqueId(), updatedResource, null, user, false); assertTrue(createResponse.isRight()); - assertResponse(createResponse, ActionStatus.COMPONENT_NAME_ALREADY_EXIST, ComponentTypeEnum.RESOURCE.getValue(), - resourceName); + assertResponse(createResponse, ActionStatus.COMPONENT_NAME_ALREADY_EXIST, ComponentTypeEnum.RESOURCE.getValue(), resourceName); } // @@ -1064,11 +964,9 @@ public class ResourceBusinessLogicTest { updatedResource.setDescription(tooLongResourceDesc); Either<Resource, StorageOperationStatus> dataModelResponse = Either.left(resource); when(toscaOperationFacade.updateToscaElement(resource)).thenReturn(dataModelResponse); - Either<Resource, ResponseFormat> createResponse = bl.updateResourceMetadata(resource.getUniqueId(), - updatedResource, null, user, false); + Either<Resource, ResponseFormat> createResponse = bl.updateResourceMetadata(resource.getUniqueId(), updatedResource, null, user, false); assertTrue(createResponse.isRight()); - assertResponse(createResponse, ActionStatus.COMPONENT_DESCRIPTION_EXCEEDS_LIMIT, - ComponentTypeEnum.RESOURCE.getValue(), "" + ValidationUtils.COMPONENT_DESCRIPTION_MAX_LENGTH); + assertResponse(createResponse, ActionStatus.COMPONENT_DESCRIPTION_EXCEEDS_LIMIT, ComponentTypeEnum.RESOURCE.getValue(), "" + ValidationUtils.COMPONENT_DESCRIPTION_MAX_LENGTH); } @@ -1087,8 +985,7 @@ public class ResourceBusinessLogicTest { Either<Resource, StorageOperationStatus> dataModelResponse = Either.left(resource); when(toscaOperationFacade.updateToscaElement(resource)).thenReturn(dataModelResponse); - Either<Resource, ResponseFormat> createResponse = bl.updateResourceMetadata(resource.getUniqueId(), - updatedResource, null, user, false); + Either<Resource, ResponseFormat> createResponse = bl.updateResourceMetadata(resource.getUniqueId(), updatedResource, null, user, false); assertTrue(createResponse.isRight()); assertResponse(createResponse, ActionStatus.COMPONENT_INVALID_ICON, ComponentTypeEnum.RESOURCE.getValue()); @@ -1111,8 +1008,7 @@ public class ResourceBusinessLogicTest { ; Either<Resource, StorageOperationStatus> dataModelResponse = Either.left(resource); when(toscaOperationFacade.updateToscaElement(resource)).thenReturn(dataModelResponse); - Either<Resource, ResponseFormat> createResponse = bl.updateResourceMetadata(resource.getUniqueId(), - updatedResource, null, user, false); + Either<Resource, ResponseFormat> createResponse = bl.updateResourceMetadata(resource.getUniqueId(), updatedResource, null, user, false); assertTrue(createResponse.isRight()); assertResponse(createResponse, ActionStatus.RESOURCE_ICON_CANNOT_BE_CHANGED); @@ -1176,12 +1072,10 @@ public class ResourceBusinessLogicTest { updatedResource.setTags(tagsList); Either<Resource, StorageOperationStatus> dataModelResponse = Either.left(resource); when(toscaOperationFacade.updateToscaElement(resource)).thenReturn(dataModelResponse); - Either<Resource, ResponseFormat> createResponse = bl.updateResourceMetadata(resource.getUniqueId(), - updatedResource, null, user, false); + Either<Resource, ResponseFormat> createResponse = bl.updateResourceMetadata(resource.getUniqueId(), updatedResource, null, user, false); assertTrue(createResponse.isRight()); - assertResponse(createResponse, ActionStatus.COMPONENT_TAGS_EXCEED_LIMIT, - "" + ValidationUtils.TAG_LIST_MAX_LENGTH); + assertResponse(createResponse, ActionStatus.COMPONENT_TAGS_EXCEED_LIMIT, "" + ValidationUtils.TAG_LIST_MAX_LENGTH); } @Test @@ -1198,8 +1092,7 @@ public class ResourceBusinessLogicTest { updatedResource.setVendorName(nameWrongFormat); Either<Resource, StorageOperationStatus> dataModelResponse = Either.left(resource); when(toscaOperationFacade.updateToscaElement(resource)).thenReturn(dataModelResponse); - Either<Resource, ResponseFormat> createResponse = bl.updateResourceMetadata(resource.getUniqueId(), - updatedResource, null, user, false); + Either<Resource, ResponseFormat> createResponse = bl.updateResourceMetadata(resource.getUniqueId(), updatedResource, null, user, false); assertTrue(createResponse.isRight()); assertResponse(createResponse, ActionStatus.INVALID_VENDOR_NAME); @@ -1221,8 +1114,7 @@ public class ResourceBusinessLogicTest { ; Either<Resource, StorageOperationStatus> dataModelResponse = Either.left(resource); when(toscaOperationFacade.updateToscaElement(resource)).thenReturn(dataModelResponse); - Either<Resource, ResponseFormat> createResponse = bl.updateResourceMetadata(resource.getUniqueId(), - updatedResource, null, user, false); + Either<Resource, ResponseFormat> createResponse = bl.updateResourceMetadata(resource.getUniqueId(), updatedResource, null, user, false); assertTrue(createResponse.isRight()); assertResponse(createResponse, ActionStatus.RESOURCE_VENDOR_NAME_CANNOT_BE_CHANGED); @@ -1241,11 +1133,9 @@ public class ResourceBusinessLogicTest { updatedResource.setVendorRelease(tooLongVendorRelease); Either<Resource, StorageOperationStatus> dataModelResponse = Either.left(resource); when(toscaOperationFacade.updateToscaElement(resource)).thenReturn(dataModelResponse); - Either<Resource, ResponseFormat> createResponse = bl.updateResourceMetadata(resource.getUniqueId(), - updatedResource, null, user, false); + Either<Resource, ResponseFormat> createResponse = bl.updateResourceMetadata(resource.getUniqueId(), updatedResource, null, user, false); assertTrue(createResponse.isRight()); - assertResponse(createResponse, ActionStatus.VENDOR_RELEASE_EXCEEDS_LIMIT, - "" + ValidationUtils.VENDOR_RELEASE_MAX_LENGTH); + assertResponse(createResponse, ActionStatus.VENDOR_RELEASE_EXCEEDS_LIMIT, "" + ValidationUtils.VENDOR_RELEASE_MAX_LENGTH); } @Ignore @@ -1263,8 +1153,7 @@ public class ResourceBusinessLogicTest { updatedResource.setContactId(contactIdTooLong); Either<Resource, StorageOperationStatus> dataModelResponse = Either.left(resource); when(toscaOperationFacade.updateToscaElement(resource)).thenReturn(dataModelResponse); - Either<Resource, ResponseFormat> createResponse = bl.updateResourceMetadata(resourceId, updatedResource, null, - user, false); + Either<Resource, ResponseFormat> createResponse = bl.updateResourceMetadata(resourceId, updatedResource, null, user, false); assertTrue(createResponse.isRight()); assertResponse(createResponse, ActionStatus.COMPONENT_INVALID_CONTACT, ComponentTypeEnum.RESOURCE.getValue()); @@ -1285,8 +1174,7 @@ public class ResourceBusinessLogicTest { updatedResource.addCategory(badCategory, "fikt"); Either<Resource, StorageOperationStatus> dataModelResponse = Either.left(resource); when(toscaOperationFacade.updateToscaElement(resource)).thenReturn(dataModelResponse); - Either<Resource, ResponseFormat> createResponse = bl.updateResourceMetadata(resourceId, updatedResource, null, - user, false); + Either<Resource, ResponseFormat> createResponse = bl.updateResourceMetadata(resourceId, updatedResource, null, user, false); assertTrue(createResponse.isRight()); assertResponse(createResponse, ActionStatus.COMPONENT_INVALID_CATEGORY, ComponentTypeEnum.RESOURCE.getValue()); @@ -1308,8 +1196,7 @@ public class ResourceBusinessLogicTest { ; Either<Resource, StorageOperationStatus> dataModelResponse = Either.left(resource); when(toscaOperationFacade.updateToscaElement(resource)).thenReturn(dataModelResponse); - Either<Resource, ResponseFormat> createResponse = bl.updateResourceMetadata(resourceId, updatedResource, null, - user, false); + Either<Resource, ResponseFormat> createResponse = bl.updateResourceMetadata(resourceId, updatedResource, null, user, false); assertTrue(createResponse.isRight()); assertResponse(createResponse, ActionStatus.RESOURCE_CATEGORY_CANNOT_BE_CHANGED); @@ -1330,8 +1217,7 @@ public class ResourceBusinessLogicTest { updatedResource.setDerivedFrom(list); Either<Resource, StorageOperationStatus> dataModelResponse = Either.left(resource); when(toscaOperationFacade.updateToscaElement(resource)).thenReturn(dataModelResponse); - Either<Resource, ResponseFormat> createResponse = bl.updateResourceMetadata(resourceId, updatedResource, null, - user, false); + Either<Resource, ResponseFormat> createResponse = bl.updateResourceMetadata(resourceId, updatedResource, null, user, false); assertTrue(createResponse.isRight()); assertResponse(createResponse, ActionStatus.MISSING_DERIVED_FROM_TEMPLATE); @@ -1350,8 +1236,7 @@ public class ResourceBusinessLogicTest { updatedResource.setDerivedFrom(new ArrayList<String>()); Either<Resource, StorageOperationStatus> dataModelResponse = Either.left(resource); when(toscaOperationFacade.updateToscaElement(resource)).thenReturn(dataModelResponse); - Either<Resource, ResponseFormat> createResponse = bl.updateResourceMetadata(resourceId, updatedResource, null, - user, false); + Either<Resource, ResponseFormat> createResponse = bl.updateResourceMetadata(resourceId, updatedResource, null, user, false); assertTrue(createResponse.isRight()); assertResponse(createResponse, ActionStatus.MISSING_DERIVED_FROM_TEMPLATE); @@ -1372,8 +1257,7 @@ public class ResourceBusinessLogicTest { updatedResource.setDerivedFrom(derivedFrom); Either<Resource, StorageOperationStatus> dataModelResponse = Either.left(resource); when(toscaOperationFacade.updateToscaElement(resource)).thenReturn(dataModelResponse); - Either<Resource, ResponseFormat> createResponse = bl.updateResourceMetadata(resourceId, updatedResource, null, - user, false); + Either<Resource, ResponseFormat> createResponse = bl.updateResourceMetadata(resourceId, updatedResource, null, user, false); assertTrue(createResponse.isRight()); assertResponse(createResponse, ActionStatus.PARENT_RESOURCE_NOT_FOUND); @@ -1388,16 +1272,13 @@ public class ResourceBusinessLogicTest { // this is in order to prevent failing with 403 earlier Either<Component, StorageOperationStatus> eitherUpdate = Either.left(setCanWorkOnResource(resource)); when(toscaOperationFacade.getToscaElement(resource.getUniqueId())).thenReturn(eitherUpdate); - + Either<Boolean, StorageOperationStatus> isToscaNameExtending = Either.left(true); - when(toscaOperationFacade.validateToscaResourceNameExtends(Mockito.anyString(), Mockito.anyString())) - .thenReturn(isToscaNameExtending); - - Either<Map<String, PropertyDefinition>, StorageOperationStatus> findPropertiesOfNode = Either - .left(new HashMap<>()); - when(propertyOperation.deleteAllPropertiesAssociatedToNode(Mockito.any(NodeTypeEnum.class), - Mockito.anyString())).thenReturn(findPropertiesOfNode); - + when(toscaOperationFacade.validateToscaResourceNameExtends(Mockito.anyString(), Mockito.anyString())).thenReturn(isToscaNameExtending); + + Either<Map<String, PropertyDefinition>, StorageOperationStatus> findPropertiesOfNode = Either.left(new HashMap<>()); + when(propertyOperation.deleteAllPropertiesAssociatedToNode(Mockito.any(NodeTypeEnum.class), Mockito.anyString())).thenReturn(findPropertiesOfNode); + resource.setVersion("1.0"); ArrayList<String> derivedFrom = new ArrayList<String>(); @@ -1405,11 +1286,10 @@ public class ResourceBusinessLogicTest { updatedResource.setDerivedFrom(derivedFrom); Either<Resource, StorageOperationStatus> dataModelResponse = Either.left(updatedResource); when(toscaOperationFacade.updateToscaElement(updatedResource)).thenReturn(dataModelResponse); - Either<Resource, ResponseFormat> createResponse = bl.updateResourceMetadata(resourceId, updatedResource, null, - user, false); + Either<Resource, ResponseFormat> createResponse = bl.updateResourceMetadata(resourceId, updatedResource, null, user, false); assertTrue(createResponse.isLeft()); } - + @Test public void testResourceTemplateCertify_UPDATE_SAD() { Resource resource = createResourceObject(true); @@ -1419,7 +1299,7 @@ public class ResourceBusinessLogicTest { // this is in order to prevent failing with 403 earlier Either<Component, StorageOperationStatus> eitherUpdate = Either.left(setCanWorkOnResource(resource)); when(toscaOperationFacade.getToscaElement(resource.getUniqueId())).thenReturn(eitherUpdate); - + Either<Boolean, StorageOperationStatus> isToscaNameExtending = Either.left(false); when(toscaOperationFacade.validateToscaResourceNameExtends(Mockito.anyString(), Mockito.anyString())) .thenReturn(isToscaNameExtending); @@ -1431,8 +1311,8 @@ public class ResourceBusinessLogicTest { updatedResource.setDerivedFrom(derivedFrom); Either<Resource, StorageOperationStatus> dataModelResponse = Either.left(resource); when(toscaOperationFacade.updateToscaElement(resource)).thenReturn(dataModelResponse); - Either<Resource, ResponseFormat> createResponse = bl.updateResourceMetadata(resourceId, updatedResource, null, - user, false); + Either<Resource, ResponseFormat> createResponse = bl.updateResourceMetadata(resourceId, updatedResource, null, user, + false); assertTrue(createResponse.isRight()); assertResponse(createResponse, ActionStatus.PARENT_RESOURCE_DOES_NOT_EXTEND); @@ -1443,28 +1323,23 @@ public class ResourceBusinessLogicTest { public void createOrUpdateResourceAlreadyCheckout() { Resource resourceExist = createResourceObject(false); - Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExist, - AuditingActionEnum.CREATE_RESOURCE, user, null, null); + Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExist, AuditingActionEnum.CREATE_RESOURCE, user, null, null); createResponse.left().value().setLastUpdaterUserId(user.getUserId()); assertTrue(createResponse.isLeft()); - Either<Component, StorageOperationStatus> getLatestResult = Either.left(createResponse.left().value()); - when(toscaOperationFacade.getLatestByName(resourceExist.getName())).thenReturn(getLatestResult); - when(toscaOperationFacade.overrideComponent(Mockito.any(Component.class), Mockito.any(Component.class))) - .thenReturn(getLatestResult); + Either<Resource, StorageOperationStatus> getLatestResult = Either.left(createResponse.left().value()); + Either<Component, StorageOperationStatus> getCompLatestResult = Either.left(createResponse.left().value()); + when(toscaOperationFacade.getLatestByName(resourceExist.getName())).thenReturn(getCompLatestResult); + when(toscaOperationFacade.overrideComponent(Mockito.any(Resource.class), Mockito.any(Resource.class))).thenReturn(getLatestResult); Resource resourceToUpdtae = createResourceObject(false); - Either<ImmutablePair<Resource, ActionStatus>, ResponseFormat> createOrUpdateResource = bl - .createOrUpdateResourceByImport(resourceToUpdtae, user, false, false, false, null); + Either<ImmutablePair<Resource, ActionStatus>, ResponseFormat> createOrUpdateResource = bl.createOrUpdateResourceByImport(resourceToUpdtae, user, false, false, false, null, null, false); assertTrue(createOrUpdateResource.isLeft()); - Mockito.verify(toscaOperationFacade, Mockito.times(1)).overrideComponent(Mockito.any(Resource.class), - Mockito.any(Resource.class)); - Mockito.verify(lifecycleBl, Mockito.times(0)).changeState(Mockito.anyString(), Mockito.eq(user), - Mockito.eq(LifeCycleTransitionEnum.CHECKOUT), Mockito.any(LifecycleChangeInfoWithAction.class), - Mockito.anyBoolean(), Mockito.anyBoolean()); + Mockito.verify(toscaOperationFacade, Mockito.times(1)).overrideComponent(Mockito.any(Resource.class), Mockito.any(Resource.class)); + Mockito.verify(lifecycleBl, Mockito.times(0)).changeState(Mockito.anyString(), Mockito.eq(user), Mockito.eq(LifeCycleTransitionEnum.CHECKOUT), Mockito.any(LifecycleChangeInfoWithAction.class), Mockito.anyBoolean(), Mockito.anyBoolean()); } @@ -1472,34 +1347,28 @@ public class ResourceBusinessLogicTest { public void createOrUpdateResourceCertified() { Resource resourceExist = createResourceObject(false); - Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExist, - AuditingActionEnum.CREATE_RESOURCE, user, null, null); + Either<Resource, ResponseFormat> createResponse = bl.createResource(resourceExist, AuditingActionEnum.CREATE_RESOURCE, user, null, null); assertTrue(createResponse.isLeft()); Resource certifiedResource = createResponse.left().value(); certifiedResource.setLifecycleState(LifecycleStateEnum.CERTIFIED); certifiedResource.setVersion("1.0"); + - Either<Component, StorageOperationStatus> getLatestResult = Either.left(certifiedResource); - when(toscaOperationFacade.getLatestByName(resourceExist.getName())).thenReturn(getLatestResult); - when(toscaOperationFacade.overrideComponent(Mockito.any(Component.class), Mockito.any(Component.class))) - .thenReturn(getLatestResult); + Either<Resource, StorageOperationStatus> getLatestResult = Either.left(certifiedResource); + Either<Component, StorageOperationStatus> getCompLatestResult = Either.left(createResponse.left().value()); + when(toscaOperationFacade.getLatestByName(resourceExist.getName())).thenReturn(getCompLatestResult); + when(toscaOperationFacade.overrideComponent(Mockito.any(Resource.class), Mockito.any(Resource.class))).thenReturn(getLatestResult); - when(lifecycleBl.changeState(Mockito.anyString(), Mockito.eq(user), - Mockito.eq(LifeCycleTransitionEnum.CHECKOUT), Mockito.any(LifecycleChangeInfoWithAction.class), - Mockito.anyBoolean(), Mockito.anyBoolean())).thenReturn(createResponse); + when(lifecycleBl.changeState(Mockito.anyString(), Mockito.eq(user), Mockito.eq(LifeCycleTransitionEnum.CHECKOUT), Mockito.any(LifecycleChangeInfoWithAction.class), Mockito.anyBoolean(), Mockito.anyBoolean())).thenReturn(createResponse); Resource resourceToUpdtae = createResourceObject(false); - Either<ImmutablePair<Resource, ActionStatus>, ResponseFormat> createOrUpdateResource = bl - .createOrUpdateResourceByImport(resourceToUpdtae, user, false, false, false, null); + Either<ImmutablePair<Resource, ActionStatus>, ResponseFormat> createOrUpdateResource = bl.createOrUpdateResourceByImport(resourceToUpdtae, user, false, false, false, null, null, false); assertTrue(createOrUpdateResource.isLeft()); - Mockito.verify(toscaOperationFacade, Mockito.times(1)).overrideComponent(Mockito.any(Component.class), - Mockito.any(Component.class)); - Mockito.verify(lifecycleBl, Mockito.times(1)).changeState(Mockito.anyString(), Mockito.eq(user), - Mockito.eq(LifeCycleTransitionEnum.CHECKOUT), Mockito.any(LifecycleChangeInfoWithAction.class), - Mockito.anyBoolean(), Mockito.anyBoolean()); + Mockito.verify(toscaOperationFacade, Mockito.times(1)).overrideComponent(Mockito.any(Resource.class), Mockito.any(Resource.class)); + Mockito.verify(lifecycleBl, Mockito.times(1)).changeState(Mockito.anyString(), Mockito.eq(user), Mockito.eq(LifeCycleTransitionEnum.CHECKOUT), Mockito.any(LifecycleChangeInfoWithAction.class), Mockito.anyBoolean(), Mockito.anyBoolean()); } @@ -1510,20 +1379,14 @@ public class ResourceBusinessLogicTest { Either<Component, StorageOperationStatus> getLatestResult = Either.right(StorageOperationStatus.NOT_FOUND); when(toscaOperationFacade.getLatestByName(resourceToUpdtae.getName())).thenReturn(getLatestResult); - Either<Component, StorageOperationStatus> getLatestToscaNameResult = Either - .right(StorageOperationStatus.NOT_FOUND); - when(toscaOperationFacade.getLatestByToscaResourceName(resourceToUpdtae.getToscaResourceName())) - .thenReturn(getLatestToscaNameResult); + Either<Component, StorageOperationStatus> getLatestToscaNameResult = Either.right(StorageOperationStatus.NOT_FOUND); + when(toscaOperationFacade.getLatestByToscaResourceName(resourceToUpdtae.getToscaResourceName())).thenReturn(getLatestToscaNameResult); - Either<ImmutablePair<Resource, ActionStatus>, ResponseFormat> createOrUpdateResource = bl - .createOrUpdateResourceByImport(resourceToUpdtae, user, false, false, false, null); + Either<ImmutablePair<Resource, ActionStatus>, ResponseFormat> createOrUpdateResource = bl.createOrUpdateResourceByImport(resourceToUpdtae, user, false, false, false, null, null, false); assertTrue(createOrUpdateResource.isLeft()); - Mockito.verify(toscaOperationFacade, Mockito.times(0)).overrideComponent(Mockito.any(Component.class), - Mockito.any(Component.class)); - Mockito.verify(lifecycleBl, Mockito.times(0)).changeState(Mockito.anyString(), Mockito.eq(user), - Mockito.eq(LifeCycleTransitionEnum.CHECKOUT), Mockito.any(LifecycleChangeInfoWithAction.class), - Mockito.anyBoolean(), Mockito.anyBoolean()); + Mockito.verify(toscaOperationFacade, Mockito.times(0)).overrideComponent(Mockito.any(Resource.class), Mockito.any(Resource.class)); + Mockito.verify(lifecycleBl, Mockito.times(0)).changeState(Mockito.anyString(), Mockito.eq(user), Mockito.eq(LifeCycleTransitionEnum.CHECKOUT), Mockito.any(LifecycleChangeInfoWithAction.class), Mockito.anyBoolean(), Mockito.anyBoolean()); } @@ -1567,381 +1430,294 @@ public class ResourceBusinessLogicTest { assertTrue(validatePropertiesDefaultValues.isRight()); } - // @Test - // public void testDeleteMarkedResourcesNoResources() { - // List<GraphVertex> ids = new ArrayList<>(); - // Either<List<GraphVertex>, StorageOperationStatus> eitherNoResources = - // Either.left(ids); - // when(topologyTemplateOperation.getAllComponentsMarkedForDeletion(ComponentTypeEnum.RESOURCE)).thenReturn(eitherNoResources); - // - // Either<List<String>, ResponseFormat> deleteMarkedResources = - // bl.deleteMarkedComponents(); - // assertTrue(deleteMarkedResources.isLeft()); - // assertTrue(deleteMarkedResources.left().value().isEmpty()); - // - // Mockito.verify(artifactManager, - // Mockito.times(0)).deleteAllComponentArtifactsIfNotOnGraph(Mockito.anyList()); - // - // } - // - // @Test - // public void testDeleteMarkedResources() { - // List<String> ids = new ArrayList<String>(); - // String resourceInUse = "123"; - // ids.add(resourceInUse); - // String resourceFree = "456"; - // ids.add(resourceFree); - // Either<List<String>, StorageOperationStatus> eitherNoResources = - // Either.left(ids); - // when(toscaOperationFacade.getAllComponentsMarkedForDeletion()).thenReturn(eitherNoResources); - // - // Either<Boolean, StorageOperationStatus> resourceInUseResponse = - // Either.left(true); - // Either<Boolean, StorageOperationStatus> resourceFreeResponse = - // Either.left(false); - // - // List<ArtifactDefinition> artifacts = new ArrayList<ArtifactDefinition>(); - // Either<List<ArtifactDefinition>, StorageOperationStatus> - // getArtifactsResponse = Either.left(artifacts); - // when(toscaOperationFacade.getComponentArtifactsForDelete(resourceFree, - // NodeTypeEnum.Resource, true)).thenReturn(getArtifactsResponse); - // - // when(toscaOperationFacade.isComponentInUse(resourceFree)).thenReturn(resourceFreeResponse); - // when(toscaOperationFacade.isComponentInUse(resourceInUse)).thenReturn(resourceInUseResponse); - // - // Either<Component, StorageOperationStatus> eitherDelete = Either.left(new - // Resource()); - // when(toscaOperationFacade.deleteToscaComponent(resourceFree)).thenReturn(eitherDelete); - // - // when(artifactManager.deleteAllComponentArtifactsIfNotOnGraph(artifacts)).thenReturn(StorageOperationStatus.OK); - // List<String> deletedComponents = new ArrayList<>(); - // deletedComponents.add(resourceFree); - // when(toscaOperationFacade.deleteMarkedElements(ComponentTypeEnum.RESOURCE)).thenReturn(Either.left(deletedComponents)); - // - // Either<List<String>, ResponseFormat> deleteMarkedResources = - // bl.deleteMarkedComponents(); - // assertTrue(deleteMarkedResources.isLeft()); - // List<String> resourceIdList = deleteMarkedResources.left().value(); - // assertFalse(resourceIdList.isEmpty()); - // assertTrue(resourceIdList.contains(resourceFree)); - // assertFalse(resourceIdList.contains(resourceInUse)); - // - // Mockito.verify(artifactManager, - // Mockito.times(1)).deleteAllComponentArtifactsIfNotOnGraph(artifacts); - // } - +// @Test +// public void testDeleteMarkedResourcesNoResources() { +// List<GraphVertex> ids = new ArrayList<>(); +// Either<List<GraphVertex>, StorageOperationStatus> eitherNoResources = Either.left(ids); +// when(topologyTemplateOperation.getAllComponentsMarkedForDeletion(ComponentTypeEnum.RESOURCE)).thenReturn(eitherNoResources); +// +// Either<List<String>, ResponseFormat> deleteMarkedResources = bl.deleteMarkedComponents(); +// assertTrue(deleteMarkedResources.isLeft()); +// assertTrue(deleteMarkedResources.left().value().isEmpty()); +// +// Mockito.verify(artifactManager, Mockito.times(0)).deleteAllComponentArtifactsIfNotOnGraph(Mockito.anyList()); +// +// } +// +// @Test +// public void testDeleteMarkedResources() { +// List<String> ids = new ArrayList<String>(); +// String resourceInUse = "123"; +// ids.add(resourceInUse); +// String resourceFree = "456"; +// ids.add(resourceFree); +// Either<List<String>, StorageOperationStatus> eitherNoResources = Either.left(ids); +// when(toscaOperationFacade.getAllComponentsMarkedForDeletion()).thenReturn(eitherNoResources); +// +// Either<Boolean, StorageOperationStatus> resourceInUseResponse = Either.left(true); +// Either<Boolean, StorageOperationStatus> resourceFreeResponse = Either.left(false); +// +// List<ArtifactDefinition> artifacts = new ArrayList<ArtifactDefinition>(); +// Either<List<ArtifactDefinition>, StorageOperationStatus> getArtifactsResponse = Either.left(artifacts); +// when(toscaOperationFacade.getComponentArtifactsForDelete(resourceFree, NodeTypeEnum.Resource, true)).thenReturn(getArtifactsResponse); +// +// when(toscaOperationFacade.isComponentInUse(resourceFree)).thenReturn(resourceFreeResponse); +// when(toscaOperationFacade.isComponentInUse(resourceInUse)).thenReturn(resourceInUseResponse); +// +// Either<Component, StorageOperationStatus> eitherDelete = Either.left(new Resource()); +// when(toscaOperationFacade.deleteToscaComponent(resourceFree)).thenReturn(eitherDelete); +// +// when(artifactManager.deleteAllComponentArtifactsIfNotOnGraph(artifacts)).thenReturn(StorageOperationStatus.OK); +// List<String> deletedComponents = new ArrayList<>(); +// deletedComponents.add(resourceFree); +// when(toscaOperationFacade.deleteMarkedElements(ComponentTypeEnum.RESOURCE)).thenReturn(Either.left(deletedComponents)); +// +// Either<List<String>, ResponseFormat> deleteMarkedResources = bl.deleteMarkedComponents(); +// assertTrue(deleteMarkedResources.isLeft()); +// List<String> resourceIdList = deleteMarkedResources.left().value(); +// assertFalse(resourceIdList.isEmpty()); +// assertTrue(resourceIdList.contains(resourceFree)); +// assertFalse(resourceIdList.contains(resourceInUse)); +// +// Mockito.verify(artifactManager, Mockito.times(1)).deleteAllComponentArtifactsIfNotOnGraph(artifacts); +// } @SuppressWarnings("unchecked") @Test public void testFindVfCsarArtifactsToHandle() { - + Class<ResourceBusinessLogic> targetClass = ResourceBusinessLogic.class; String methodName = "findVfCsarArtifactsToHandle"; Resource resource = new Resource(); String deploymentArtifactToUpdateFileName = "deploymentArtifactToUpdate.yaml"; String deploymentArtifactToDeleteFileName = "deploymentArtifactToDelete.yaml"; String deploymentArtifactToCreateFileName = "deploymentArtifactToCreate.yaml"; - + String artifactInfoToUpdateFileName = "infoArtifactToUpdate.yaml"; String artifactInfoToDeleteFileName = "infoArtifactToDelete.yaml"; String artifactInfoToCreateFileName = "infoArtifactToCreate.yaml"; - + byte[] oldPayloadData = "oldPayloadData".getBytes(); byte[] newPayloadData = "newPayloadData".getBytes(); - Map<String, ArtifactDefinition> deploymentArtifacts = new HashMap<>(); - + Map<String, ArtifactDefinition> deploymentArtifacts =new HashMap<>(); + ArtifactDefinition deploymentArtifactToUpdate = new ArtifactDefinition(); deploymentArtifactToUpdate.setMandatory(false); deploymentArtifactToUpdate.setArtifactName(deploymentArtifactToUpdateFileName); deploymentArtifactToUpdate.setArtifactType("SNMP_POLL"); deploymentArtifactToUpdate.setPayload(oldPayloadData); - deploymentArtifactToUpdate - .setArtifactChecksum(GeneralUtility.calculateMD5Base64EncodedByByteArray(oldPayloadData)); - + deploymentArtifactToUpdate.setArtifactChecksum(GeneralUtility.calculateMD5Base64EncodedByByteArray(oldPayloadData)); + ArtifactDefinition deploymentArtifactToDelete = new ArtifactDefinition(); deploymentArtifactToDelete.setMandatory(false); deploymentArtifactToDelete.setArtifactName(deploymentArtifactToDeleteFileName); deploymentArtifactToDelete.setArtifactType("SNMP_TRAP"); deploymentArtifactToDelete.setPayload(oldPayloadData); - deploymentArtifactToDelete - .setArtifactChecksum(GeneralUtility.calculateMD5Base64EncodedByByteArray(oldPayloadData)); - + deploymentArtifactToDelete.setArtifactChecksum(GeneralUtility.calculateMD5Base64EncodedByByteArray(oldPayloadData)); + ArtifactDefinition deploymentArtifactToIgnore = new ArtifactDefinition(); - - deploymentArtifacts.put(ValidationUtils.normalizeArtifactLabel(deploymentArtifactToUpdate.getArtifactName()), - deploymentArtifactToUpdate); - deploymentArtifacts.put(ValidationUtils.normalizeArtifactLabel(deploymentArtifactToDelete.getArtifactName()), - deploymentArtifactToDelete); + + deploymentArtifacts.put(ValidationUtils.normalizeArtifactLabel(deploymentArtifactToUpdate.getArtifactName()), deploymentArtifactToUpdate); + deploymentArtifacts.put(ValidationUtils.normalizeArtifactLabel(deploymentArtifactToDelete.getArtifactName()), deploymentArtifactToDelete); deploymentArtifacts.put("ignore", deploymentArtifactToIgnore); - + Map<String, ArtifactDefinition> artifacts = new HashMap<>(); - + ArtifactDefinition artifactToUpdate = new ArtifactDefinition(); artifactToUpdate.setMandatory(false); artifactToUpdate.setArtifactName(artifactInfoToUpdateFileName); artifactToUpdate.setArtifactType("SNMP_POLL"); artifactToUpdate.setPayload(oldPayloadData); artifactToUpdate.setArtifactChecksum(GeneralUtility.calculateMD5Base64EncodedByByteArray(oldPayloadData)); - + ArtifactDefinition artifactToDelete = new ArtifactDefinition(); artifactToDelete.setMandatory(false); artifactToDelete.setArtifactName(artifactInfoToDeleteFileName); artifactToDelete.setArtifactType("SNMP_TRAP"); artifactToDelete.setPayload(oldPayloadData); artifactToDelete.setArtifactChecksum(GeneralUtility.calculateMD5Base64EncodedByByteArray(oldPayloadData)); - + ArtifactDefinition artifactToIgnore = new ArtifactDefinition(); - - artifacts.put(ValidationUtils.normalizeArtifactLabel(artifactToUpdate.getArtifactName()), artifactToUpdate); - artifacts.put(ValidationUtils.normalizeArtifactLabel(artifactToDelete.getArtifactName()), artifactToDelete); - artifacts.put("ignore", artifactToIgnore); - + + artifacts.put(ValidationUtils.normalizeArtifactLabel(artifactToUpdate.getArtifactName()),artifactToUpdate); + artifacts.put(ValidationUtils.normalizeArtifactLabel(artifactToDelete.getArtifactName()),artifactToDelete); + artifacts.put("ignore",artifactToIgnore); + resource.setDeploymentArtifacts(deploymentArtifacts); resource.setArtifacts(artifacts); - + List<NonMetaArtifactInfo> artifactPathAndNameList = new ArrayList<>(); - NonMetaArtifactInfo deploymentArtifactInfoToUpdate = new NonMetaArtifactInfo( - deploymentArtifactToUpdate.getArtifactName(), null, - ArtifactTypeEnum.findType(deploymentArtifactToUpdate.getArtifactType()), - ArtifactGroupTypeEnum.DEPLOYMENT, newPayloadData, deploymentArtifactToUpdate.getArtifactName()); - - NonMetaArtifactInfo informationalArtifactInfoToUpdate = new NonMetaArtifactInfo( - artifactToUpdate.getArtifactName(), null, ArtifactTypeEnum.findType(artifactToUpdate.getArtifactType()), - ArtifactGroupTypeEnum.DEPLOYMENT, newPayloadData, artifactToUpdate.getArtifactName()); - - NonMetaArtifactInfo deploymentArtifactInfoToCreate = new NonMetaArtifactInfo(deploymentArtifactToCreateFileName, - null, ArtifactTypeEnum.OTHER, ArtifactGroupTypeEnum.DEPLOYMENT, newPayloadData, - deploymentArtifactToCreateFileName); - - NonMetaArtifactInfo informationalArtifactInfoToCreate = new NonMetaArtifactInfo(artifactInfoToCreateFileName, - null, ArtifactTypeEnum.OTHER, ArtifactGroupTypeEnum.DEPLOYMENT, newPayloadData, - artifactInfoToCreateFileName); - + NonMetaArtifactInfo deploymentArtifactInfoToUpdate = new NonMetaArtifactInfo(deploymentArtifactToUpdate.getArtifactName(), null, + ArtifactTypeEnum.findType(deploymentArtifactToUpdate.getArtifactType()), ArtifactGroupTypeEnum.DEPLOYMENT, + newPayloadData, deploymentArtifactToUpdate.getArtifactName()); + + NonMetaArtifactInfo informationalArtifactInfoToUpdate = new NonMetaArtifactInfo(artifactToUpdate.getArtifactName(), null, + ArtifactTypeEnum.findType(artifactToUpdate.getArtifactType()), ArtifactGroupTypeEnum.DEPLOYMENT, + newPayloadData, artifactToUpdate.getArtifactName()); + + NonMetaArtifactInfo deploymentArtifactInfoToCreate = new NonMetaArtifactInfo(deploymentArtifactToCreateFileName, null, + ArtifactTypeEnum.OTHER, ArtifactGroupTypeEnum.DEPLOYMENT, newPayloadData, deploymentArtifactToCreateFileName); + + NonMetaArtifactInfo informationalArtifactInfoToCreate = new NonMetaArtifactInfo(artifactInfoToCreateFileName, null, + ArtifactTypeEnum.OTHER, ArtifactGroupTypeEnum.DEPLOYMENT, + newPayloadData, artifactInfoToCreateFileName); + artifactPathAndNameList.add(deploymentArtifactInfoToUpdate); artifactPathAndNameList.add(informationalArtifactInfoToUpdate); artifactPathAndNameList.add(deploymentArtifactInfoToCreate); artifactPathAndNameList.add(informationalArtifactInfoToCreate); - - Object[] argObjects = { resource, artifactPathAndNameList, user }; - Class[] argClasses = { Resource.class, List.class, User.class }; - try { - Method method = targetClass.getDeclaredMethod(methodName, argClasses); - method.setAccessible(true); - Either<EnumMap<ArtifactOperationEnum, List<NonMetaArtifactInfo>>, ResponseFormat> findVfCsarArtifactsToHandleRes = (Either<EnumMap<ArtifactOperationEnum, List<NonMetaArtifactInfo>>, ResponseFormat>) method - .invoke(bl, argObjects); - assertTrue(findVfCsarArtifactsToHandleRes.isLeft()); - EnumMap<ArtifactOperationEnum, List<NonMetaArtifactInfo>> foundVfArtifacts = findVfCsarArtifactsToHandleRes - .left().value(); - assertTrue(foundVfArtifacts.get(ArtifactOperationEnum.Create).size() == 2); - assertTrue(foundVfArtifacts.get(ArtifactOperationEnum.Update).size() == 2); - assertTrue(foundVfArtifacts.get(ArtifactOperationEnum.Create).size() == 2); - - } catch (Exception e) { - e.printStackTrace(); - } - } - - @SuppressWarnings("rawtypes") - @Test - public void testBuildNestedVfcToscaNamespace() { - - Class<ResourceBusinessLogic> targetClass = ResourceBusinessLogic.class; - String methodName = "buildNestedVfcToscaNamespace"; - String nodeTypeFullName = "org.openecomp.resource.abstract.nodes.heat.FEAdd_On_Module_vLBAgentTemplate"; - String expectedNestedVfcToscaNamespace = "org.openecomp.resource.vfc.nodes.heat.FEAdd_On_Module_vLBAgentTemplate"; - Object[] argObjects = { nodeTypeFullName }; - Class[] argClasses = { String.class }; - try { - Method method = targetClass.getDeclaredMethod(methodName, argClasses); - method.setAccessible(true); - String actualNestedVfcToscaNamespace = (String) method.invoke(bl, argObjects); - assertTrue(!actualNestedVfcToscaNamespace.isEmpty()); - assertTrue(actualNestedVfcToscaNamespace.equals(expectedNestedVfcToscaNamespace)); - - } catch (Exception e) { - e.printStackTrace(); - } - } - - @SuppressWarnings("rawtypes") - @Test - public void testBuildNestedVfcToscaResourceName() { - - Class<ResourceBusinessLogic> targetClass = ResourceBusinessLogic.class; - String methodName = "buildNestedVfcToscaResourceName"; - String vfResourceName = "vfname"; - String nodeTypeFullName = "org.openecomp.resource.abstract.nodes.heat.FEAdd_On_Module_vLBAgentTemplate"; - String expectedNestedVfcToscaResourceName = "org.openecomp.resource.vfc.vfname.abstract.nodes.heat.FEAdd_On_Module_vLBAgentTemplate"; - Object[] argObjects = { vfResourceName, nodeTypeFullName }; - Class[] argClasses = { String.class, String.class }; - try { - Method method = targetClass.getDeclaredMethod(methodName, argClasses); - method.setAccessible(true); - String actualNestedVfcToscaResourceName = (String) method.invoke(bl, argObjects); - assertTrue(!actualNestedVfcToscaResourceName.isEmpty()); - assertTrue(actualNestedVfcToscaResourceName.equals(expectedNestedVfcToscaResourceName)); - - } catch (Exception e) { - e.printStackTrace(); - } - } - - @SuppressWarnings("rawtypes") - @Test - public void testBuildNestedSubstituteYamlName() { - - Class<ResourceBusinessLogic> targetClass = ResourceBusinessLogic.class; - String methodName = "buildNestedSubstituteYamlName"; - String nodeTypeFullName = "org.openecomp.resource.abstract.nodes.heat.FEAdd_On_Module_vLBAgentTemplate"; - String expectedNestedSubstituteYamlName = "Definitions/FEAdd_On_Module_vLBAgentTemplateServiceTemplate.yaml"; - Object[] argObjects = { nodeTypeFullName }; - Class[] argClasses = { String.class }; - try { - Method method = targetClass.getDeclaredMethod(methodName, argClasses); - method.setAccessible(true); - String actualNestedSubstituteYamlName = (String) method.invoke(bl, argObjects); - assertTrue(!actualNestedSubstituteYamlName.isEmpty()); - assertTrue(actualNestedSubstituteYamlName.equals(expectedNestedSubstituteYamlName)); - - } catch (Exception e) { - e.printStackTrace(); - } + + Object[] argObjects = {resource, artifactPathAndNameList, user}; + Class[] argClasses = {Resource.class, List.class, User.class}; + try { + Method method = targetClass.getDeclaredMethod(methodName, argClasses); + method.setAccessible(true); + Either<EnumMap<ArtifactOperationEnum, List<NonMetaArtifactInfo>>, ResponseFormat> findVfCsarArtifactsToHandleRes = + (Either<EnumMap<ArtifactOperationEnum, List<NonMetaArtifactInfo>>, ResponseFormat>) method.invoke(bl, argObjects); + assertTrue(findVfCsarArtifactsToHandleRes.isLeft()); + EnumMap<ArtifactOperationEnum, List<NonMetaArtifactInfo>> foundVfArtifacts = findVfCsarArtifactsToHandleRes.left().value(); + assertTrue(foundVfArtifacts.get(ArtifactOperationEnum.Create).size()==2); + assertTrue(foundVfArtifacts.get(ArtifactOperationEnum.Update).size()==2); + assertTrue(foundVfArtifacts.get(ArtifactOperationEnum.Create).size()==2); + + } + catch (Exception e) { + e.printStackTrace(); + } } - + @Test public void testVFGeneratedInputs() { - + Resource resource = createVF(); List<InputDefinition> inputs = resource.getInputs(); assertTrue(8 == inputs.size()); - for (InputDefinition input : inputs) { + for(InputDefinition input : inputs){ assertNotNull(input.getOwnerId()); } assertTrue(resource.getDerivedFromGenericType().equals(genericVF.getToscaResourceName())); assertTrue(resource.getDerivedFromGenericVersion().equals(genericVF.getVersion())); } - + @Test public void testVFUpdateGenericInputsToLatestOnCheckout() { - - // create a VF that is derived from generic version 1.0 - Resource resource = createVF(); + + //create a VF that is derived from generic version 1.0 + Resource resource = createVF(); // create a new generic version without properties genericVF.setVersion("2.0"); genericVF.setProperties(null); String currentDerivedFromVersion = resource.getDerivedFromGenericVersion(); List<InputDefinition> currentInputs = resource.getInputs(); - // verify previous inputs ownerId fields exist - user may not delete - // generated inputs + //verify previous inputs ownerId fields exist - user may not delete generated inputs assertTrue(8 == currentInputs.stream().filter(p -> null != p.getOwnerId()).collect(Collectors.toList()).size()); Either<Boolean, ResponseFormat> upgradeToLatestGeneric = bl.shouldUpgradeToLatestGeneric(resource); - // verify success + //verify success assertTrue(upgradeToLatestGeneric.isLeft()); - // verify update required and valid + //verify update required and valid assertTrue(upgradeToLatestGeneric.left().value()); - // verify version was upgraded + //verify version was upgraded assertFalse(resource.getDerivedFromGenericVersion().equals(currentDerivedFromVersion)); - // verify inputs were not deleted + //verify inputs were not deleted assertTrue(8 == resource.getInputs().size()); - // verify inputs ownerId fields were removed - user may delete/edit - // inputs - assertTrue(8 == resource.getInputs().stream().filter(p -> null == p.getOwnerId()).collect(Collectors.toList()) - .size()); + //verify inputs ownerId fields were removed - user may delete/edit inputs + assertTrue(8 == resource.getInputs().stream().filter(p -> null == p.getOwnerId()).collect(Collectors.toList()).size()); } - + + @Test public void testVFUpdateGenericInputsToLatestOnCheckoutNotPerformed() { - - // create a VF that is derived from generic version 1.0 + + //create a VF that is derived from generic version 1.0 Resource resource = createVF(); - - // add an input to the VF + + //add an input to the VF PropertyDefinition newProp = new PropertyDefinition(); newProp.setType("integer"); newProp.setName("newProp"); resource.getInputs().add(new InputDefinition(newProp)); - - // create a new generic version with a new property which has the same - // name as a user defined input on the VF with a different type + + //create a new generic version with a new property which has the same name as a user defined input on the VF with a different type genericVF.setVersion("2.0"); newProp.setType("string"); genericVF.setProperties(new ArrayList<PropertyDefinition>()); genericVF.getProperties().add(newProp); - + when(genericTypeBusinessLogic.fetchDerivedFromGenericType(resource)).thenReturn(Either.left(genericVF)); + when(genericTypeBusinessLogic.convertGenericTypePropertiesToInputsDefintion(genericVF.getProperties(), genericVF.getUniqueId())).thenCallRealMethod(); String currentDerivedFromVersion = resource.getDerivedFromGenericVersion(); - assertTrue(8 == resource.getInputs().stream().filter(p -> null != p.getOwnerId()).collect(Collectors.toList()) - .size()); + assertTrue(8 == resource.getInputs().stream().filter(p -> null != p.getOwnerId()).collect(Collectors.toList()).size()); Either<Boolean, ResponseFormat> upgradeToLatestGeneric = bl.shouldUpgradeToLatestGeneric(resource); - // verify success + //verify success assertTrue(upgradeToLatestGeneric.isLeft()); - // verify update is invalid an void + //verify update is invalid an void assertFalse(upgradeToLatestGeneric.left().value()); - // verify version was not upgraded + //verify version was not upgraded assertTrue(resource.getDerivedFromGenericVersion().equals(currentDerivedFromVersion)); - // verify inputs were not removed + //verify inputs were not removed assertTrue(9 == resource.getInputs().size()); - // verify user defined input exists - assertTrue(1 == resource.getInputs().stream().filter(p -> null == p.getOwnerId()).collect(Collectors.toList()) - .size()); - assertTrue(resource.getInputs().stream().filter(p -> null == p.getOwnerId()).findAny().get().getType() - .equals("integer")); + //verify user defined input exists + assertTrue(1 == resource.getInputs().stream().filter(p -> null == p.getOwnerId()).collect(Collectors.toList()).size()); + assertTrue(resource.getInputs().stream().filter(p -> null == p.getOwnerId()).findAny().get().getType().equals("integer")); } - + @Test public void testPNFGeneratedInputsNoGeneratedInformationalArtifacts() { - + Resource resource = createPNF(); List<InputDefinition> inputs = resource.getInputs(); assertTrue(8 == inputs.size()); - for (InputDefinition input : inputs) { + for(InputDefinition input : inputs){ assertNotNull(input.getOwnerId()); } assertTrue(resource.getDerivedFromGenericType().equals(genericPNF.getToscaResourceName())); assertTrue(resource.getDerivedFromGenericVersion().equals(genericPNF.getVersion())); assertTrue(0 == resource.getArtifacts().size()); } - + + private Resource createVF() { - + genericVF = setupGenericTypeMock(GENERIC_VF_NAME); - when(toscaOperationFacade.getLatestCertifiedNodeTypeByToscaResourceName(GENERIC_VF_NAME)) - .thenReturn(Either.left(genericVF)); + when(toscaOperationFacade.getLatestCertifiedNodeTypeByToscaResourceName(GENERIC_VF_NAME)).thenReturn(Either.left(genericVF)); Resource resource = createResourceObject(true); resource.setDerivedFrom(null); resource.setResourceType(ResourceTypeEnum.VF); when(toscaOperationFacade.createToscaComponent(resource)).thenReturn(Either.left(resource)); - Either<Resource, ResponseFormat> createResponse = bl.createResource(resource, - AuditingActionEnum.CREATE_RESOURCE, user, null, null); + when(genericTypeBusinessLogic.fetchDerivedFromGenericType(resource)).thenReturn(Either.left(genericVF)); + when(genericTypeBusinessLogic.generateInputsFromGenericTypeProperties(genericVF)).thenCallRealMethod(); + when(genericTypeBusinessLogic.convertGenericTypePropertiesToInputsDefintion(genericVF.getProperties(), resource.getUniqueId())).thenCallRealMethod(); + Either<Resource, ResponseFormat> createResponse = bl.createResource(resource, AuditingActionEnum.CREATE_RESOURCE, user, null, null); assertTrue(createResponse.isLeft()); return createResponse.left().value(); } - - private Resource createPNF() { - + + private Resource createPNF() { + genericPNF = setupGenericTypeMock(GENERIC_PNF_NAME); - when(toscaOperationFacade.getLatestCertifiedNodeTypeByToscaResourceName(GENERIC_PNF_NAME)) - .thenReturn(Either.left(genericPNF)); + when(toscaOperationFacade.getLatestCertifiedNodeTypeByToscaResourceName(GENERIC_PNF_NAME)).thenReturn(Either.left(genericPNF)); Resource resource = createResourceObject(true); resource.setDerivedFrom(null); resource.setResourceType(ResourceTypeEnum.PNF); when(toscaOperationFacade.createToscaComponent(resource)).thenReturn(Either.left(resource)); - Either<Resource, ResponseFormat> createResponse = bl.createResource(resource, - AuditingActionEnum.CREATE_RESOURCE, user, null, null); + when(genericTypeBusinessLogic.fetchDerivedFromGenericType(resource)).thenReturn(Either.left(genericPNF)); + when(genericTypeBusinessLogic.generateInputsFromGenericTypeProperties(genericPNF)).thenCallRealMethod(); + when(genericTypeBusinessLogic.convertGenericTypePropertiesToInputsDefintion(genericPNF.getProperties(), resource.getUniqueId())).thenCallRealMethod(); + Either<Resource, ResponseFormat> createResponse = bl.createResource(resource, AuditingActionEnum.CREATE_RESOURCE, user, null, null); assertTrue(createResponse.isLeft()); return createResponse.left().value(); } + - private Resource setupGenericTypeMock(String toscaName) { - + + private Resource setupGenericTypeMock(String toscaName) { + Resource genericType = createResourceObject(true); genericType.setVersion("1.0"); genericType.setToscaResourceName(toscaName); - String[] propNames = { "nf_function", "nf_role", "nf_naming_code", "nf_type", "nf_naming", - "availability_zone_max_count", "min_instances", "max_instances" }; - String[] propTypes = { "string", "string", "string", "string", "org.openecomp.datatypes.Naming", "integer", - "integer", "integer" }; + String[] propNames = {"nf_function", "nf_role", "nf_naming_code", "nf_type", "nf_naming", "availability_zone_max_count", "min_instances", "max_instances"}; + String[] propTypes = {"string", "string", "string", "string", "org.openecomp.datatypes.Naming", "integer", "integer", "integer"}; List<PropertyDefinition> genericProps = new ArrayList<>(); - for (int i = 0; i < 8; ++i) { + for(int i = 0; i < 8; ++i){ PropertyDefinition prop = new PropertyDefinition(); prop.setName(propNames[i]); prop.setType(propTypes[i]); @@ -1951,427 +1727,6 @@ public class ResourceBusinessLogicTest { return genericType; } - private ResourceBusinessLogic createTestSubject() { - return new ResourceBusinessLogic(); - } - - @Test - public void testGetCsarOperation() throws Exception { - ResourceBusinessLogic testSubject; - CsarOperation result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getCsarOperation(); - } - - @Test - public void testSetCsarOperation() throws Exception { - ResourceBusinessLogic testSubject; - CsarOperation csarOperation = null; - - // default test - testSubject = createTestSubject(); - testSubject.setCsarOperation(csarOperation); - } - - - @Test - public void testGetLifecycleBusinessLogic() throws Exception { - ResourceBusinessLogic testSubject; - LifecycleBusinessLogic result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getLifecycleBusinessLogic(); - } - - - @Test - public void testSetLifecycleManager() throws Exception { - ResourceBusinessLogic testSubject; - LifecycleBusinessLogic lifecycleBusinessLogic = null; - - // default test - testSubject = createTestSubject(); - testSubject.setLifecycleManager(lifecycleBusinessLogic); - } - - - @Test - public void testGetElementDao() throws Exception { - ResourceBusinessLogic testSubject; - IElementOperation result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getElementDao(); - } - - - @Test - public void testSetElementDao() throws Exception { - ResourceBusinessLogic testSubject; - IElementOperation elementDao = null; - - // default test - testSubject = createTestSubject(); - testSubject.setElementDao(elementDao); - } - - - @Test - public void testGetUserAdmin() throws Exception { - ResourceBusinessLogic testSubject; - IUserBusinessLogic result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getUserAdmin(); - } - - - @Test - public void testSetUserAdmin() throws Exception { - ResourceBusinessLogic testSubject; - UserBusinessLogic userAdmin = null; - - // default test - testSubject = createTestSubject(); - testSubject.setUserAdmin(userAdmin); - } - - - @Test - public void testGetComponentsUtils() throws Exception { - ResourceBusinessLogic testSubject; - ComponentsUtils result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getComponentsUtils(); - } - - - @Test - public void testSetComponentsUtils() throws Exception { - ResourceBusinessLogic testSubject; - ComponentsUtils componentsUtils = null; - - // default test - testSubject = createTestSubject(); - testSubject.setComponentsUtils(componentsUtils); - } - - - @Test - public void testGetArtifactsManager() throws Exception { - ResourceBusinessLogic testSubject; - ArtifactsBusinessLogic result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getArtifactsManager(); - } - - - @Test - public void testSetArtifactsManager() throws Exception { - ResourceBusinessLogic testSubject; - ArtifactsBusinessLogic artifactsManager = null; - - // default test - testSubject = createTestSubject(); - testSubject.setArtifactsManager(artifactsManager); - } - - - @Test - public void testSetPropertyOperation() throws Exception { - ResourceBusinessLogic testSubject; - IPropertyOperation propertyOperation = null; - - // default test - testSubject = createTestSubject(); - testSubject.setPropertyOperation(propertyOperation); - } - - - @Test - public void testGetApplicationDataTypeCache() throws Exception { - ResourceBusinessLogic testSubject; - ApplicationDataTypeCache result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getApplicationDataTypeCache(); - } - - - @Test - public void testSetApplicationDataTypeCache() throws Exception { - ResourceBusinessLogic testSubject; - ApplicationDataTypeCache applicationDataTypeCache = null; - - // default test - testSubject = createTestSubject(); - testSubject.setApplicationDataTypeCache(applicationDataTypeCache); - } - - @Test - public void testSetDeploymentArtifactsPlaceHolder() throws Exception { - ResourceBusinessLogic testSubject; - Component component = new Resource() { - }; - User user = null; - - // default test - testSubject = createTestSubject(); - testSubject.setDeploymentArtifactsPlaceHolder(component, user); - } - - - - @Test - public void testValidateVendorReleaseName_1() throws Exception { - ResourceBusinessLogic testSubject; - String vendorRelease = ""; - Either<Boolean, ResponseFormat> result; - - // test 1 - testSubject = createTestSubject(); - vendorRelease = null; - result = testSubject.validateVendorReleaseName(vendorRelease); - Assert.assertEquals(false, result.left().value()); - - } - - - - - - - @Test - public void testGetCapabilityTypeOperation() throws Exception { - ResourceBusinessLogic testSubject; - ICapabilityTypeOperation result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getCapabilityTypeOperation(); - } - - - @Test - public void testSetCapabilityTypeOperation() throws Exception { - ResourceBusinessLogic testSubject; - ICapabilityTypeOperation capabilityTypeOperation = null; - - // default test - testSubject = createTestSubject(); - testSubject.setCapabilityTypeOperation(capabilityTypeOperation); - } - - - @Test - public void testValidatePropertiesDefaultValues() throws Exception { - ResourceBusinessLogic testSubject; - Resource resource = new Resource(); - Either<Boolean, ResponseFormat> result; - - // default test - testSubject = createTestSubject(); - result = testSubject.validatePropertiesDefaultValues(resource); - } - - - @Test - public void testGetComponentInstanceBL() throws Exception { - ResourceBusinessLogic testSubject; - ComponentInstanceBusinessLogic result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getComponentInstanceBL(); - } - - - - @Test - public void testGetComponentInstancesFilteredByPropertiesAndInputs() throws Exception { - ResourceBusinessLogic testSubject; - String componentId = ""; - ComponentTypeEnum componentTypeEnum = null; - String userId = ""; - String searchText = ""; - Either<List<ComponentInstance>, ResponseFormat> result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getComponentInstancesFilteredByPropertiesAndInputs(componentId, componentTypeEnum, userId, - searchText); - } - - - - @Test - public void testGetCacheManagerOperation() throws Exception { - ResourceBusinessLogic testSubject; - ICacheMangerOperation result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getCacheManagerOperation(); - } - - - @Test - public void testSetCacheManagerOperation() throws Exception { - ResourceBusinessLogic testSubject; - ICacheMangerOperation cacheManagerOperation = null; - - // default test - testSubject = createTestSubject(); - testSubject.setCacheManagerOperation(cacheManagerOperation); - } - - - @Test - public void testGetElementDao_1() throws Exception { - ResourceBusinessLogic testSubject;IElementOperation result; - - // default test - testSubject=createTestSubject();result=testSubject.getElementDao(); - } - - - @Test - public void testGetAllCertifiedResources() throws Exception { - ResourceBusinessLogic testSubject;boolean getAbstract = false; - HighestFilterEnum highestFilter = null; - String userId = ""; - Either<List<Resource>,ResponseFormat> result; - - // default test - } - - - @Test - public void testValidateResourceNameExists() throws Exception { - ResourceBusinessLogic testSubject;String resourceName = ""; - ResourceTypeEnum resourceTypeEnum = null; - String userId = ""; - Either<Map<String,Boolean>,ResponseFormat> result; - - // default test - } - - - @Test - public void testCreateResource() throws Exception { - ResourceBusinessLogic testSubject;Resource resource = null; - AuditingActionEnum auditingAction = null; - User user = null; - Map<String,byte[]> csarUIPayload = null; - String payloadName = ""; - Either<Resource,ResponseFormat> result; - - // test 1 - testSubject=createTestSubject();payloadName = null; - - // test 2 - testSubject=createTestSubject();payloadName = ""; - } - - - @Test - public void testValidateAndUpdateResourceFromCsar() throws Exception { - ResourceBusinessLogic testSubject;Resource resource = null; - User user = null; - Map<String,byte[]> csarUIPayload = null; - String payloadName = ""; - String resourceUniqueId = ""; - Either<Resource,ResponseFormat> result; - - // test 1 - testSubject=createTestSubject();payloadName = null; - - // test 2 - testSubject=createTestSubject();payloadName = ""; - } - - - - - - - - - - - - @Test - public void testCreateResourceFromCsar() throws Exception { - ResourceBusinessLogic testSubject;Resource resource = null; - User user = null; - Either<Map<String,byte[]>,StorageOperationStatus> csarUIPayload = null; - String csarUUID = ""; - Either<Resource,ResponseFormat> result; - - // test 1 - testSubject=createTestSubject();csarUIPayload = null; - } - - - - - - - - @Test - public void testCreateResourcesFromYamlNodeTypesList() throws Exception { - ResourceBusinessLogic testSubject;String yamlName = ""; - Resource resource = null; - Map<String,Object> mappedToscaTemplate = null; - boolean needLock = false; - Map<String,EnumMap<ArtifactOperationEnum,List<ArtifactDefinition>>> nodeTypesArtifactsToHandle = null; - List<ArtifactDefinition> nodeTypesNewCreatedArtifacts = null; - Map<String,NodeTypeInfo> nodeTypesInfo = null; - CsarInfo csarInfo = null; - Either<Map<String,Resource>,ResponseFormat> result; - - // default test - } - - - - - - - @Test - public void testValidateResourceCreationFromNodeType() throws Exception { - ResourceBusinessLogic testSubject;Resource resource = null; - User creator = null; - Either<Boolean,ResponseFormat> result; - - // default test - } - - - @Test - public void testCreateResourceFromNodeType() throws Exception { - ResourceBusinessLogic testSubject;String nodeTypeYaml = ""; - UploadResourceInfo resourceMetaData = null; - User creator = null; - boolean isInTransaction = false; - boolean needLock = false; - Map<ArtifactOperationEnum,List<ArtifactDefinition>> nodeTypeArtifactsToHandle = null; - List<ArtifactDefinition> nodeTypesNewCreatedArtifacts = null; - boolean forceCertificationAllowed = false; - CsarInfo csarInfo = null; - Either<ImmutablePair<Resource,ActionStatus>,ResponseFormat> result; - - // default test - } - + + } @@ -20,7 +20,16 @@ package org.openecomp.sdc.be.components.impl; -import fj.data.Either; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; + +import java.util.ArrayList; +import java.util.EnumMap; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + import org.junit.Before; import org.junit.Test; import org.mockito.InjectMocks; @@ -52,13 +61,7 @@ import org.openecomp.sdc.common.impl.ExternalConfiguration; import org.openecomp.sdc.common.impl.FSConfigurationSource; import org.openecomp.sdc.exception.ResponseFormat; -import java.util.ArrayList; -import java.util.EnumMap; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static org.junit.Assert.*; +import fj.data.Either; public class ResourceInstanceBusinessLogicTest { @@ -141,8 +144,8 @@ public class ResourceInstanceBusinessLogicTest { StorageOperationStatus status = StorageOperationStatus.OK; Mockito.when(toscaOperationFacade.addDeploymentArtifactsToInstance(Mockito.any(String.class), Mockito.any(ComponentInstance.class), Mockito.any(Map.class))).thenReturn(status); - Mockito.when(toscaOperationFacade.addInformationalArtifactsToInstance(Mockito.any(String.class), Mockito.any(ComponentInstance.class), Mockito.any(Map.class))).thenReturn(status); - Mockito.when(toscaOperationFacade.addGroupInstancesToComponentInstance(Mockito.any(Component.class), Mockito.any(ComponentInstance.class), Mockito.any(List.class), Mockito.any(Map.class))).thenReturn(status); + Mockito.when(toscaOperationFacade.addInformationalArtifactsToInstance(Mockito.any(String.class), Mockito.any(ComponentInstance.class), Mockito.any())).thenReturn(status); + Mockito.when(toscaOperationFacade.addGroupInstancesToComponentInstance(Mockito.any(Component.class), Mockito.any(ComponentInstance.class), Mockito.any(), Mockito.any(Map.class))).thenReturn(status); } @@ -0,0 +1,97 @@ +package org.openecomp.sdc.be.components.impl.generic; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.when; + +import java.util.Arrays; +import java.util.List; + +import org.junit.Before; +import org.junit.Test; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.MockitoAnnotations; +import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; +import org.openecomp.sdc.be.model.InputDefinition; +import org.openecomp.sdc.be.model.PropertyDefinition; +import org.openecomp.sdc.be.model.Resource; +import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.exception.ResponseFormat; + +import fj.data.Either; + +public class GenericTypeBusinessLogicTest { + + @InjectMocks + private GenericTypeBusinessLogic testInstance; + + @Mock + private ToscaOperationFacade toscaOperationFacadeMock; + + @Before + public void setUp() throws Exception { + testInstance = new GenericTypeBusinessLogic(); + MockitoAnnotations.initMocks(this); + + } + + @Test + public void fetchDerivedFromGenericType_cvfv_getGenericResourceTypeFromDerivedFrom() throws Exception { + Resource cvfc = new Resource(); + cvfc.setResourceType(ResourceTypeEnum.CVFC); + cvfc.setDerivedFrom(Arrays.asList("genericType", "someOtherType")); + Resource genericResource = new Resource(); + when(toscaOperationFacadeMock.getLatestCertifiedNodeTypeByToscaResourceName("genericType")).thenReturn(Either.left(genericResource)); + Either<Resource, ResponseFormat> fetchedGenericType = testInstance.fetchDerivedFromGenericType(cvfc); + assertEquals(genericResource, fetchedGenericType.left().value()); + } + + @Test + public void fetchDerivedFromGenericType_getGenericResourceTypeFromConfiguration() throws Exception { + Resource resource = Mockito.mock(Resource.class); + when(resource.getResourceType()).thenReturn(ResourceTypeEnum.VF); + when(resource.fetchGenericTypeToscaNameFromConfig()).thenReturn("genericType"); + Resource genericResource = new Resource(); + when(toscaOperationFacadeMock.getLatestCertifiedNodeTypeByToscaResourceName("genericType")).thenReturn(Either.left(genericResource)); + Either<Resource, ResponseFormat> fetchedGenericType = testInstance.fetchDerivedFromGenericType(resource); + assertEquals(genericResource, fetchedGenericType.left().value()); + } + + @Test + public void generateInputsFromGenericTypeProperties() throws Exception { + Resource genericNodeType = new Resource(); + genericNodeType.setUniqueId("genericUid"); + PropertyDefinition propertyDefinition = generatePropDefinition("prop1"); + PropertyDefinition propertyDefinition2 = generatePropDefinition("prop2"); + + genericNodeType.setProperties(Arrays.asList(propertyDefinition, propertyDefinition2)); + + List<InputDefinition> genericInputs = testInstance.generateInputsFromGenericTypeProperties(genericNodeType); + assertEquals(2, genericInputs.size()); + assertInput(genericInputs.get(0), propertyDefinition); + assertInput(genericInputs.get(1), propertyDefinition2); + } + + @Test + public void generateInputsFromGenericTypeProperties_genericHasNoProps() throws Exception { + Resource genericNodeType = new Resource(); + assertTrue(testInstance.generateInputsFromGenericTypeProperties(genericNodeType).isEmpty()); + } + + private void assertInput(InputDefinition inputDefinition, PropertyDefinition propertyDefinition) { + assertEquals(inputDefinition.getOwnerId(), "genericUid"); + assertEquals(inputDefinition.getValue(), propertyDefinition.getValue()); + assertEquals(inputDefinition.getName(), propertyDefinition.getName()); + } + + private PropertyDefinition generatePropDefinition(String name) { + PropertyDefinition propertyDefinition = new PropertyDefinition(); + propertyDefinition.setName(name); + propertyDefinition.setValue(name + "value"); + return propertyDefinition; + } + + +}
\ No newline at end of file @@ -22,23 +22,16 @@ package org.openecomp.sdc.be.components.lifecycle; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.when; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; -import org.mockito.Mockito; -import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic; -import org.openecomp.sdc.be.components.lifecycle.CertificationChangeTransition; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.impl.ComponentsUtils; -import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.LifeCycleTransitionEnum; import org.openecomp.sdc.be.model.LifecycleStateEnum; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.user.Role; import org.openecomp.sdc.exception.ResponseFormat; @@ -51,11 +44,8 @@ public class CertificationChangeTransitionTest extends LifecycleTestBase { private CertificationChangeTransition certificationFailObj = null; private ComponentsUtils componentsUtils = new ComponentsUtils(); - private String resourceName = "myResource"; private User owner = null; - protected ArtifactsBusinessLogic artifactsManager = Mockito.mock(ArtifactsBusinessLogic.class); - Resource resource; @SuppressWarnings("unchecked") @@ -79,8 +69,7 @@ public class CertificationChangeTransitionTest extends LifecycleTestBase { owner = new User("cs0008", "Carlos", "Santana", "cs@sdc.com", "DESIGNER", null); - when(artifactsManager.deleteAllComponentArtifactsIfNotOnGraph(Mockito.anyList())).thenReturn(StorageOperationStatus.OK); - resource = createResourceObject(false); + resource = createResourceObject(); } @Test @@ -20,13 +20,20 @@ package org.openecomp.sdc.be.components.lifecycle; -import fj.data.Either; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.when; + +import java.util.ArrayList; +import java.util.List; + import org.apache.http.HttpStatus; import org.junit.Before; import org.junit.Test; -import org.mockito.InjectMocks; +import org.junit.runner.RunWith; +import org.mockito.Mock; import org.mockito.Mockito; -import org.mockito.MockitoAnnotations; +import org.mockito.junit.MockitoJUnitRunner; import org.openecomp.sdc.be.components.distribution.engine.ServiceDistributionArtifactsBuilder; import org.openecomp.sdc.be.components.impl.ServiceBusinessLogic; import org.openecomp.sdc.be.dao.api.ActionStatus; @@ -44,46 +51,40 @@ import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElement; import org.openecomp.sdc.be.model.jsontitan.utils.ModelConverter; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.CapabilityOperation; -import org.openecomp.sdc.be.tosca.ToscaError; import org.openecomp.sdc.be.tosca.ToscaExportHandler; -import org.openecomp.sdc.be.tosca.ToscaRepresentation; import org.openecomp.sdc.be.user.Role; import org.openecomp.sdc.exception.ResponseFormat; -import java.util.ArrayList; -import java.util.List; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.when; +import fj.data.Either; +@RunWith(MockitoJUnitRunner.Silent.class) public class CertificationRequestTest extends LifecycleTestBase { private ComponentsUtils componentsUtils = new ComponentsUtils(); + @Mock + private ServiceDistributionArtifactsBuilder serviceDistributionArtifactsBuilder; + @Mock + private ServiceBusinessLogic serviceBusinessLogic; + @Mock + private CapabilityOperation capabilityOperation; + @Mock + private ToscaExportHandler toscaExportUtils; - protected ServiceDistributionArtifactsBuilder serviceDistributionArtifactsBuilder = Mockito.mock(ServiceDistributionArtifactsBuilder.class); - protected ServiceBusinessLogic serviceBusinessLogic = Mockito.mock(ServiceBusinessLogic.class); - protected CapabilityOperation capabilityOperation = Mockito.mock(CapabilityOperation.class); - protected ToscaExportHandler toscaExportUtils = Mockito.mock(ToscaExportHandler.class); - @InjectMocks - private CertificationRequestTransition rfcObj = new CertificationRequestTransition(componentsUtils, toscaElementLifecycleOperation, serviceDistributionArtifactsBuilder, serviceBusinessLogic, capabilityOperation, toscaExportUtils, toscaOperationFacade, titanDao); + private CertificationRequestTransition rfcObj; - protected ToscaRepresentation toscaRepresentation = Mockito.mock(ToscaRepresentation.class); @Before public void setup() { - MockitoAnnotations.initMocks(this); super.setup(); - + rfcObj = new CertificationRequestTransition(componentsUtils, toscaElementLifecycleOperation, serviceDistributionArtifactsBuilder, serviceBusinessLogic, capabilityOperation, toscaExportUtils, toscaOperationFacade, titanDao); // checkout transition object - rfcObj.setLifeCycleOperation(toscaElementLifecycleOperation); +// rfcObj.setLifeCycleOperation(toscaElementLifecycleOperation); // checkoutObj.setAuditingManager(iAuditingManager); rfcObj.setConfigurationManager(configurationManager); componentsUtils.Init(); - Either<ToscaRepresentation, ToscaError> either = Either.left(toscaRepresentation); - when(toscaExportUtils.exportComponent(Mockito.anyObject())).thenReturn(either); - +// Either<ToscaRepresentation, ToscaError> either = Either.left(toscaRepresentation); +// when(toscaExportUtils.exportComponent(Mockito.any())).thenReturn(either); } @Test @@ -109,7 +110,7 @@ public class CertificationRequestTest extends LifecycleTestBase { @Test public void testCheckoutStateValidation() { Either<? extends Component, ResponseFormat> changeStateResult; - Resource resource = createResourceObject(false); + Resource resource = createResourceObject(); resource.setLifecycleState(LifecycleStateEnum.NOT_CERTIFIED_CHECKIN); Either<User, ResponseFormat> ownerResponse = rfcObj.getComponentOwner(resource, ComponentTypeEnum.RESOURCE); @@ -130,7 +131,7 @@ public class CertificationRequestTest extends LifecycleTestBase { @Test public void testAlreadyRfc() { Either<Resource, ResponseFormat> changeStateResult; - Resource resource = createResourceObject(false); + Resource resource = createResourceObject(); resource.setLifecycleState(LifecycleStateEnum.READY_FOR_CERTIFICATION); Either<User, ResponseFormat> ownerResponse = rfcObj.getComponentOwner(resource, ComponentTypeEnum.RESOURCE); @@ -146,7 +147,7 @@ public class CertificationRequestTest extends LifecycleTestBase { @Test public void testCertificationInProgress() { Either<Resource, ResponseFormat> changeStateResult; - Resource resource = createResourceObject(false); + Resource resource = createResourceObject(); resource.setLifecycleState(LifecycleStateEnum.CERTIFICATION_IN_PROGRESS); Either<User, ResponseFormat> ownerResponse = rfcObj.getComponentOwner(resource, ComponentTypeEnum.RESOURCE); @@ -162,7 +163,7 @@ public class CertificationRequestTest extends LifecycleTestBase { @Test public void testAlreadyCertified() { Either<Resource, ResponseFormat> changeStateResult; - Resource resource = createResourceObject(false); + Resource resource = createResourceObject(); resource.setLifecycleState(LifecycleStateEnum.CERTIFIED); Either<User, ResponseFormat> ownerResponse = rfcObj.getComponentOwner(resource, ComponentTypeEnum.RESOURCE); @@ -25,9 +25,7 @@ import static org.junit.Assert.assertTrue; import org.junit.Before; import org.junit.Test; -import org.openecomp.sdc.be.components.lifecycle.CheckinTransition; import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.dao.jsongraph.TitanDao; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.LifecycleStateEnum; @@ -59,7 +57,7 @@ public class CheckinTest extends LifecycleTestBase { @Test public void testSimpleCheckin() { Either<Boolean, ResponseFormat> changeStateResult; - Resource resource = createResourceObject(false); + Resource resource = createResourceObject(); resource.setLifecycleState(LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT); Either<User, ResponseFormat> ownerResponse = checkinObj.getComponentOwner(resource, ComponentTypeEnum.RESOURCE); @@ -87,7 +85,7 @@ public class CheckinTest extends LifecycleTestBase { @Test public void testCheckinTwiceValidation() { Either<Resource, ResponseFormat> changeStateResult; - Resource resource = createResourceObject(false); + Resource resource = createResourceObject(); resource.setLifecycleState(LifecycleStateEnum.NOT_CERTIFIED_CHECKIN); Either<User, ResponseFormat> owner = checkinObj.getComponentOwner(resource, ComponentTypeEnum.RESOURCE); @@ -122,7 +120,7 @@ public class CheckinTest extends LifecycleTestBase { @Test public void testCheckoutByAnotherUserValidation() { Either<Resource, ResponseFormat> changeStateResult; - Resource resource = createResourceObject(false); + Resource resource = createResourceObject(); User modifier = new User(); modifier.setUserId("modifier"); @@ -27,7 +27,6 @@ import org.junit.Before; import org.junit.Test; import org.mockito.InjectMocks; import org.openecomp.sdc.be.components.impl.ResourceBusinessLogic; -import org.openecomp.sdc.be.components.lifecycle.CheckoutTransition; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.impl.ComponentsUtils; @@ -57,13 +56,15 @@ public class CheckoutTest extends LifecycleTestBase { checkoutObj.setLifeCycleOperation(toscaElementLifecycleOperation); checkoutObj.setConfigurationManager(configurationManager); componentsUtils.Init(); + bl.setToscaOperationFacade(toscaOperationFacade); + bl.setComponentsUtils(componentsUtils); } @Test public void testCheckoutStateValidation() { Either<? extends Component, ResponseFormat> changeStateResult; - Resource resource = createResourceObject(false); + Resource resource = createResourceObject(); resource.setLifecycleState(LifecycleStateEnum.NOT_CERTIFIED_CHECKIN); Either<User, ResponseFormat> ownerResponse = checkoutObj.getComponentOwner(resource, ComponentTypeEnum.RESOURCE); @@ -81,7 +82,7 @@ public class CheckoutTest extends LifecycleTestBase { @Test public void testAlreadyCheckout() { Either<Resource, ResponseFormat> changeStateResult; - Resource resource = createResourceObject(false); + Resource resource = createResourceObject(); resource.setLifecycleState(LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT); Either<User, ResponseFormat> ownerResponse = checkoutObj.getComponentOwner(resource, ComponentTypeEnum.RESOURCE); @@ -99,7 +100,7 @@ public class CheckoutTest extends LifecycleTestBase { @Test public void testCertificationInProgress() { Either<? extends Component, ResponseFormat> changeStateResult; - Resource resource = createResourceObject(false); + Resource resource = createResourceObject(); resource.setLifecycleState(LifecycleStateEnum.CERTIFICATION_IN_PROGRESS); Either<User, ResponseFormat> ownerResponse = checkoutObj.getComponentOwner(resource, ComponentTypeEnum.RESOURCE); @@ -119,7 +120,7 @@ public class CheckoutTest extends LifecycleTestBase { @Test public void testReadyForCertification() { Either<Resource, ResponseFormat> changeStateResult; - Resource resource = createResourceObject(false); + Resource resource = createResourceObject(); resource.setLifecycleState(LifecycleStateEnum.READY_FOR_CERTIFICATION); @@ -159,7 +160,7 @@ public class CheckoutTest extends LifecycleTestBase { @Test public void testRoles() { Either<Resource, ResponseFormat> changeStateResult; - Resource resource = createResourceObject(false); + Resource resource = createResourceObject(); resource.setLifecycleState(LifecycleStateEnum.NOT_CERTIFIED_CHECKIN); @@ -27,6 +27,7 @@ import java.util.List; import javax.servlet.ServletContext; +import org.junit.BeforeClass; import org.mockito.InjectMocks; import org.mockito.Mockito; import org.mockito.invocation.InvocationOnMock; @@ -39,7 +40,6 @@ import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.dao.jsongraph.TitanDao; import org.openecomp.sdc.be.datatypes.components.ResourceMetadataDataDefinition; -import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.impl.WebAppContextWrapper; import org.openecomp.sdc.be.model.ArtifactDefinition; @@ -67,11 +67,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.web.context.WebApplicationContext; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; - import fj.data.Either; -import junit.framework.Assert; public class LifecycleTestBase { private static Logger log = LoggerFactory.getLogger(LifecycleTestBase.class.getName()); @@ -86,19 +82,22 @@ public class LifecycleTestBase { protected User user = null; protected Resource resourceResponse; protected Service serviceResponse; - protected ConfigurationManager configurationManager = null; + protected static ConfigurationManager configurationManager = null; protected ResponseFormatManager responseManager = null; protected TitanDao titanDao = Mockito.mock(TitanDao.class); protected ToscaOperationFacade toscaOperationFacade = Mockito.mock(ToscaOperationFacade.class); - public void setup() { - + @BeforeClass + public static void setupClass() { ExternalConfiguration.setAppName("catalog-be"); // Init Configuration String appConfigDir = "src/test/resources/config/catalog-be"; ConfigurationSource configurationSource = new FSConfigurationSource(ExternalConfiguration.getChangeListener(), appConfigDir); configurationManager = new ConfigurationManager(configurationSource); + } + + public void setup() { // Auditing iAuditingManager = new AuditingMockManager("lll"); @@ -124,7 +123,7 @@ public class LifecycleTestBase { // getCount // createResource - resourceResponse = createResourceObject(true); + resourceResponse = createResourceObject(); Either<ToscaElement, StorageOperationStatus> eitherComponent = Either.left(ModelConverter.convertToToscaElement(resourceResponse)); when(toscaElementLifecycleOperation.checkoutToscaElement(Mockito.any(String.class), Mockito.any(String.class), Mockito.any(String.class))) .thenAnswer(createAnswer(eitherComponent)); @@ -137,7 +136,10 @@ public class LifecycleTestBase { Either<User, StorageOperationStatus> getOwnerResult = Either.left(user); when(toscaElementLifecycleOperation.getToscaElementOwner(Mockito.anyString())).thenReturn(getOwnerResult); - + + Either<Component, StorageOperationStatus> eitherlatestDerived = Either.right(StorageOperationStatus.OK); + when(toscaOperationFacade.shouldUpgradeToLatestDerived(Mockito.any(Resource.class))).thenReturn(eitherlatestDerived); + responseManager = ResponseFormatManager.getInstance(); } @@ -153,9 +155,10 @@ public class LifecycleTestBase { return dummy; } - protected Resource createResourceObject(boolean afterCreate) { + protected Resource createResourceObject() { Resource resource = new Resource(); resource.setName("MyResourceName"); + resource.setUniqueId("uid"); resource.addCategory("VoIP", "INfra"); resource.setDescription("My short description"); List<String> tgs = new ArrayList<String>(); @@ -179,6 +182,7 @@ public class LifecycleTestBase { ComponentMetadataDefinition cMetadataDataDefinition = new ComponentMetadataDefinition(rMetadataDataDefinition) ; Resource resource = new Resource(cMetadataDataDefinition); + resource.setUniqueId("rid"); resource.setName("MyResourceVFCMTName"); resource.addCategory("VoIP", "INfra"); resource.setDescription("My short description"); @@ -200,6 +204,7 @@ public class LifecycleTestBase { protected Service createServiceObject(boolean b) { Service service = new Service(); service.setName("MyServiceName"); + service.setUniqueId("sid"); service.addCategory("VoIP", null); service.setDescription("My short description"); List<String> tgs = new ArrayList<String>(); @@ -25,7 +25,6 @@ import static org.junit.Assert.assertTrue; import org.junit.Before; import org.junit.Test; -import org.openecomp.sdc.be.components.lifecycle.UndoCheckoutTransition; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.impl.ComponentsUtils; @@ -58,7 +57,7 @@ public class UndoCheckoutTest extends LifecycleTestBase { @Test public void testResourceNotCheckedOutValidation() { Either<Resource, ResponseFormat> changeStateResult; - Resource resource = createResourceObject(false); + Resource resource = createResourceObject(); resource.setLifecycleState(LifecycleStateEnum.NOT_CERTIFIED_CHECKIN); Either<User, ResponseFormat> ownerResponse = undoCheckoutObj.getComponentOwner(resource, ComponentTypeEnum.RESOURCE); @@ -102,7 +101,7 @@ public class UndoCheckoutTest extends LifecycleTestBase { @Test public void testDifferentResourceOwnerValidation() { Either<Resource, ResponseFormat> changeStateResult; - Resource resource = createResourceObject(false); + Resource resource = createResourceObject(); resource.setLifecycleState(LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT); User modifier = new User(); @@ -0,0 +1,86 @@ +package org.openecomp.sdc.be.components.merge; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.when; + +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; + +import org.junit.Before; +import org.junit.Test; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.MockitoAnnotations; +import org.openecomp.sdc.be.components.impl.generic.GenericTypeBusinessLogic; +import org.openecomp.sdc.be.components.utils.ObjectGenerator; +import org.openecomp.sdc.be.dao.api.ActionStatus; +import org.openecomp.sdc.be.impl.ComponentsUtils; +import org.openecomp.sdc.be.model.InputDefinition; +import org.openecomp.sdc.be.model.Resource; +import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; + +import com.google.common.collect.Sets; + +import fj.data.Either; + +public class GlobalInputsFilteringBusinessLogicTest { + + private static final String GENERIC_TOSCA_TYPE = "myGenericType"; + + @InjectMocks + private GlobalInputsFilteringBusinessLogic testInstance; + + @Mock + private GenericTypeBusinessLogic genericTypeBusinessLogicMock; + + @Mock + private ToscaOperationFacade toscaOperationFacadeMock; + + @Mock + private ComponentsUtils componentsUtils; + + @Before + public void setUp() throws Exception { + MockitoAnnotations.initMocks(this); + } + + @Test + public void testFilterGlobalInputs() throws Exception { + Resource mockResource = Mockito.mock(Resource.class); + String myGenericType = GENERIC_TOSCA_TYPE; + String[] genericProperties = {"property1", "property2"}; + String[] allInputs = {"property1", "property2", "property3", "property4"}; + when(mockResource.fetchGenericTypeToscaNameFromConfig()).thenReturn(myGenericType); + when(mockResource.getInputs()).thenReturn(ObjectGenerator.buildInputs(allInputs)); + Resource genericNodeType = ObjectGenerator.buildResourceWithProperties(genericProperties); + when(toscaOperationFacadeMock.getLatestCertifiedNodeTypeByToscaResourceName(myGenericType)).thenReturn(Either.left(genericNodeType)); + when(genericTypeBusinessLogicMock.generateInputsFromGenericTypeProperties(genericNodeType)).thenReturn(ObjectGenerator.buildInputs(genericProperties)); + Either<List<InputDefinition>, ActionStatus> globalInputsEither = testInstance.filterGlobalInputs(mockResource); + verifyFilteredOnlyGlobalInputs(globalInputsEither, genericProperties); + } + + @Test + public void testFilterGlobalInputs_errorGettingGenericType_convertToActionStatusAndReturn() throws Exception { + Resource mockResource = Mockito.mock(Resource.class); + when(mockResource.fetchGenericTypeToscaNameFromConfig()).thenReturn(GENERIC_TOSCA_TYPE); + when(toscaOperationFacadeMock.getLatestCertifiedNodeTypeByToscaResourceName(GENERIC_TOSCA_TYPE)).thenReturn(Either.right(StorageOperationStatus.GENERAL_ERROR)); + when(componentsUtils.convertFromStorageResponse(StorageOperationStatus.GENERAL_ERROR)).thenReturn(ActionStatus.GENERAL_ERROR); + Either<List<InputDefinition>, ActionStatus> globalInputsEither = testInstance.filterGlobalInputs(mockResource); + assertTrue(globalInputsEither.isRight()); + assertEquals(ActionStatus.GENERAL_ERROR, globalInputsEither.right().value()); + verifyZeroInteractions(genericTypeBusinessLogicMock); + } + + private void verifyFilteredOnlyGlobalInputs(Either<List<InputDefinition>, ActionStatus> globalInputsEither, String[] genericProperties) { + assertTrue(globalInputsEither.isLeft()); + List<InputDefinition> globalInputs = globalInputsEither.left().value(); + assertEquals(2, globalInputs.size()); + Set<String> actualGlobalInputNames = globalInputs.stream().map(InputDefinition::getName).collect(Collectors.toSet()); + assertEquals(Sets.newHashSet(genericProperties), actualGlobalInputNames); + } +}
\ No newline at end of file @@ -0,0 +1,62 @@ +package org.openecomp.sdc.be.components.merge; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.when; +import static org.openecomp.sdc.be.components.utils.ObjectGenerator.buildResourceWithInputs; + +import java.util.Arrays; +import java.util.List; + +import org.junit.Before; +import org.junit.Test; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; +import org.openecomp.sdc.be.components.merge.input.ComponentInputsMergeBL; +import org.openecomp.sdc.be.dao.api.ActionStatus; +import org.openecomp.sdc.be.model.InputDefinition; +import org.openecomp.sdc.be.model.Resource; + +import fj.data.Either; + +public class GlobalTypesMergeBusinessLogicTest { + + @InjectMocks + private GlobalTypesMergeBusinessLogic testInstance; + + @Mock + private ComponentInputsMergeBL resourceInputsMergeBLMock; + + @Mock + private GlobalInputsFilteringBusinessLogic globalInputsFilteringBusinessLogic; + + @Before + public void setUp() throws Exception { + MockitoAnnotations.initMocks(this); + } + + @Test + public void mergeInstancePropsAndInputs_mergeOnlyNewResourceGenericGlobalTypes() { + Resource oldResource = buildResourceWithInputs("input1", "input2"); + Resource newResource = buildResourceWithInputs("input1", "input2", "global1", "global2"); + List<InputDefinition> globalInputs = Arrays.asList(newResource.getInputs().get(2), newResource.getInputs().get(3)); + when(globalInputsFilteringBusinessLogic.filterGlobalInputs(newResource)).thenReturn(Either.left(globalInputs)); + when(resourceInputsMergeBLMock.mergeComponentInputs(oldResource, newResource, globalInputs)).thenReturn(ActionStatus.OK); + ActionStatus actionStatus = testInstance.mergeResourceEntities(oldResource, newResource); + assertEquals(ActionStatus.OK, actionStatus); + + } + + @Test + public void mergeInstancePropsAndInputs_failedToFilterGlobalInputs() throws Exception { + Resource oldResource = buildResourceWithInputs("input1", "input2"); + Resource newResource = buildResourceWithInputs("input1", "input2", "global1", "global2"); + when(globalInputsFilteringBusinessLogic.filterGlobalInputs(newResource)).thenReturn(Either.right(ActionStatus.GENERAL_ERROR)); + ActionStatus actionStatus = testInstance.mergeResourceEntities(oldResource, newResource); + assertEquals(actionStatus, ActionStatus.GENERAL_ERROR); + verifyZeroInteractions(resourceInputsMergeBLMock); + } + + +}
\ No newline at end of file @@ -0,0 +1,112 @@ +package org.openecomp.sdc.be.components.merge; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import java.util.Arrays; + +import org.junit.Before; +import org.junit.Test; +import org.openecomp.sdc.be.components.utils.ComponentInstanceBuilder; +import org.openecomp.sdc.be.components.utils.ObjectGenerator; +import org.openecomp.sdc.be.components.utils.RelationsBuilder; +import org.openecomp.sdc.be.model.ComponentInstance; +import org.openecomp.sdc.be.model.RequirementCapabilityRelDef; +import org.openecomp.sdc.be.model.Resource; + +public class RelationsComparatorTest { + + public static final String INSTANCE1 = "instance1"; + public static final String INSTANCE2 = "instance2"; + RelationsComparator testInstance; + + private RequirementCapabilityRelDef relation1, relation2, relation3, relation4; + private ComponentInstance componentInstance1, componentInstance2; + + @Before + public void setUp() { + testInstance = new RelationsComparator(); + componentInstance1 = new ComponentInstanceBuilder().setName(INSTANCE1).setId(INSTANCE1).build(); + componentInstance2 = new ComponentInstanceBuilder().setName(INSTANCE2).setId(INSTANCE2).build(); + buildRelations(); + } + + @Test + public void isRelationsChanged_sameRelationships() throws Exception { + Resource oldResource = ObjectGenerator.buildResourceWithRelationships(relation1, relation2, relation3, relation4); + oldResource.setComponentInstances(Arrays.asList(componentInstance1, componentInstance2)); + Resource newResource = ObjectGenerator.buildResourceWithRelationships(relation4, relation3, relation1, relation2); + newResource.setComponentInstances(Arrays.asList(componentInstance1, componentInstance2)); + assertFalse(testInstance.isRelationsChanged(oldResource, newResource)); + } + + @Test + public void isRelationsChanged_notSameAmountOfRelations() { + Resource oldResource = ObjectGenerator.buildResourceWithRelationships(relation1, relation2); + oldResource.setComponentInstances(Arrays.asList(componentInstance1, componentInstance2)); + Resource newResource = ObjectGenerator.buildResourceWithRelationships(relation1, relation2, relation3); + newResource.setComponentInstances(Arrays.asList(componentInstance1, componentInstance2)); + assertTrue(testInstance.isRelationsChanged(oldResource, newResource)); + } + + @Test + public void isRelationsChanged_notSameFromNode() throws Exception { + RequirementCapabilityRelDef relation2DifType = buildRelation("2", INSTANCE1); + relation2DifType.setFromNode(INSTANCE2); + isRelationsChangedTest(relation2DifType); + } + + @Test + public void isRelationsChanged_notSameType() throws Exception { + RequirementCapabilityRelDef relation2DifType = buildRelation("2", INSTANCE1); + relation2DifType.getSingleRelationship().getRelation().getRelationship().setType("someDiffType"); + isRelationsChangedTest(relation2DifType); + } + + @Test + public void isRelationsChanged_notSameCapability() throws Exception { + RequirementCapabilityRelDef relation2DifType = buildRelation("2", INSTANCE1); + relation2DifType.getSingleRelationship().getRelation().setCapabilityUid("someDiffUid"); + isRelationsChangedTest(relation2DifType); + } + + @Test + public void isRelationsChanged_notSameReqName() throws Exception { + RequirementCapabilityRelDef relation2DifType = buildRelation("2", INSTANCE1); + relation2DifType.getSingleRelationship().getRelation().setRequirement("someDiffReq"); + isRelationsChangedTest(relation2DifType); + } + + @Test + public void isRelationsChanged_notSameToNode() throws Exception { + RequirementCapabilityRelDef relation2DifType = buildRelation("2", INSTANCE1); + relation2DifType.setToNode("someDiffNode"); + isRelationsChangedTest(relation2DifType); + } + + private void isRelationsChangedTest(RequirementCapabilityRelDef relation2DifType) { + Resource oldResource = ObjectGenerator.buildResourceWithRelationships(relation1, relation2); + oldResource.setComponentInstances(Arrays.asList(componentInstance1, componentInstance2)); + Resource newResource = ObjectGenerator.buildResourceWithRelationships(relation1, relation2DifType); + newResource.setComponentInstances(Arrays.asList(componentInstance1, componentInstance2)); + assertTrue(testInstance.isRelationsChanged(oldResource, newResource)); + } + + + private void buildRelations() { + relation1 = buildRelation("1", INSTANCE1); + relation2 = buildRelation("2", INSTANCE1); + relation3 = buildRelation("3", INSTANCE2); + relation4 = buildRelation("4", INSTANCE2); + } + + private RequirementCapabilityRelDef buildRelation(String postFix, String instance) { + return new RelationsBuilder() + .setFromNode(instance) + .setCapabilityUID("cap" + postFix) + .setRelationType("type" + postFix) + .setRequirementName("req" + postFix) + .setToNode(instance) + .build(); + } +}
\ No newline at end of file @@ -0,0 +1,119 @@ +package org.openecomp.sdc.be.components.merge; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.when; + +import org.junit.Before; +import org.junit.Test; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; +import org.openecomp.sdc.be.components.utils.ComponentInstanceBuilder; +import org.openecomp.sdc.be.components.utils.ObjectGenerator; +import org.openecomp.sdc.be.components.utils.ResourceBuilder; +import org.openecomp.sdc.be.dao.api.ActionStatus; +import org.openecomp.sdc.be.impl.ComponentsUtils; +import org.openecomp.sdc.be.model.ComponentInstance; +import org.openecomp.sdc.be.model.Resource; +import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; + +import fj.data.Either; + +public class TopologyComparatorTest { + + @InjectMocks + private TopologyComparator testInstance; + + @Mock + private RelationsComparator relationsComparator; + + @Mock + private ToscaOperationFacade toscaOperationFacade; + + @Mock + private ComponentsUtils componentsUtils; + + @Before + public void setUp() throws Exception { + MockitoAnnotations.initMocks(this); + } + + @Test + public void compareTopologies_NotSameNumOfInstances() throws Exception { + Resource resourceWith2Instances = ObjectGenerator.buildResourceWithComponentInstance("inst1", "inst2"); + Resource resourceWith1Instances = ObjectGenerator.buildResourceWithComponentInstance("inst1"); + Resource resourceWithNoInstances = new Resource(); + assertTrue(testInstance.isTopologyChanged(resourceWithNoInstances, resourceWith2Instances).left().value()); + assertTrue(testInstance.isTopologyChanged(resourceWithNoInstances, resourceWith1Instances).left().value()); + assertTrue(testInstance.isTopologyChanged(resourceWith1Instances, resourceWith2Instances).left().value()); + } + + @Test + public void compareTopologies_notSameInstanceNames() throws Exception { + Resource resource1 = ObjectGenerator.buildResourceWithComponentInstance("inst1", "inst2"); + Resource resource2 = ObjectGenerator.buildResourceWithComponentInstance("inst1", "inst3"); + assertTrue(testInstance.isTopologyChanged(resource1, resource2).left().value()); + } + + @Test + public void compareTopologies_notSameInstanceTypes_notSameOriginInstanceTypes() throws Exception { + ComponentInstance inst1 = new ComponentInstanceBuilder().setName("inst1").setComponentUid("inst1").setToscaName("a.b.c").build(); + ComponentInstance inst2 = new ComponentInstanceBuilder().setName("inst2").setComponentUid("inst2").setToscaName("a.b.c.d").build(); + ComponentInstance inst2DiffType = new ComponentInstanceBuilder().setName("inst2").setComponentUid("inst2DiffType").setToscaName("a.b.c.d.e").build(); + Resource resource1 = ObjectGenerator.buildResourceWithComponentInstances(inst1, inst2); + Resource resource2 = ObjectGenerator.buildResourceWithComponentInstances(inst1, inst2DiffType); + Resource inst2OriginResource = new ResourceBuilder().setInvariantUUid("inst2Invariant").build(); + Resource inst2DiffTypeOriginResource = new ResourceBuilder().setInvariantUUid("inst2DiffTypeInvariant").build(); + when(toscaOperationFacade.getToscaElement(inst2.getComponentUid())).thenReturn(Either.left(inst2OriginResource)); + when(toscaOperationFacade.getToscaElement(inst2DiffType.getComponentUid())).thenReturn(Either.left(inst2DiffTypeOriginResource)); + assertTrue(testInstance.isTopologyChanged(resource1, resource2).left().value()); + } + + @Test + public void compareTopologies_notSameInstanceTypes_failToFetchOriginComponent() throws Exception { + ComponentInstance inst1 = new ComponentInstanceBuilder().setName("inst1").setComponentUid("inst1").setToscaName("a.b.c").build(); + ComponentInstance inst1DiffOriginCmpt = new ComponentInstanceBuilder().setName("inst1").setComponentUid("inst1Diff").setToscaName("a.b.c.d").build(); + Resource resource1 = ObjectGenerator.buildResourceWithComponentInstances(inst1); + Resource resource2 = ObjectGenerator.buildResourceWithComponentInstances(inst1DiffOriginCmpt); + when(toscaOperationFacade.getToscaElement(inst1.getComponentUid())).thenReturn(Either.right(StorageOperationStatus.GENERAL_ERROR)); + when(componentsUtils.convertFromStorageResponse(StorageOperationStatus.GENERAL_ERROR)).thenReturn(ActionStatus.GENERAL_ERROR); + assertEquals(ActionStatus.GENERAL_ERROR, testInstance.isTopologyChanged(resource1, resource2).right().value()); + } + + @Test + public void compareTopologies_notSameRelations() throws Exception { + ComponentInstance inst1 = new ComponentInstanceBuilder().setName("inst1").setToscaName("a.b.c").build(); + ComponentInstance inst2 = new ComponentInstanceBuilder().setName("inst2").setToscaName("a.b.c.d").build(); + Resource resource1 = ObjectGenerator.buildResourceWithComponentInstances(inst1, inst2); + Resource resource2 = ObjectGenerator.buildResourceWithComponentInstances(inst1, inst2); + when(relationsComparator.isRelationsChanged(resource1, resource2)).thenReturn(true); + assertTrue(testInstance.isTopologyChanged(resource1, resource2).left().value()); + } + + @Test + public void compareTopologies_sameInstances_sameRelations_noTopologyChange() throws Exception { + ComponentInstance inst1 = new ComponentInstanceBuilder().setName("inst1").setToscaName("a.b.c").build(); + ComponentInstance inst2 = new ComponentInstanceBuilder().setName("inst2").setToscaName("a.b.c.d").build(); + Resource resource1 = ObjectGenerator.buildResourceWithComponentInstances(inst1, inst2); + Resource resource2 = ObjectGenerator.buildResourceWithComponentInstances(inst1, inst2); + when(relationsComparator.isRelationsChanged(resource1, resource2)).thenReturn(false); + assertFalse(testInstance.isTopologyChanged(resource1, resource2).left().value()); + } + + @Test + public void compareTopologies_sameInstancesInvariant_sameRelations_noTopologyChange() throws Exception { + ComponentInstance inst1 = new ComponentInstanceBuilder().setName("inst1").setComponentUid("inst1").setToscaName("a.b.c").build(); + ComponentInstance inst2 = new ComponentInstanceBuilder().setName("inst2").setComponentUid("inst2").setToscaName("a.b.c.d").build(); + ComponentInstance inst2DiffType = new ComponentInstanceBuilder().setName("inst2").setComponentUid("inst2DiffType").setToscaName("a.b.c.d.e").build(); + Resource resource1 = ObjectGenerator.buildResourceWithComponentInstances(inst1, inst2); + Resource resource2 = ObjectGenerator.buildResourceWithComponentInstances(inst1, inst2DiffType); + Resource inst2OriginResource = new ResourceBuilder().setInvariantUUid("inst2Invariant").build(); + when(toscaOperationFacade.getToscaElement(inst2.getComponentUid())).thenReturn(Either.left(inst2OriginResource)); + when(toscaOperationFacade.getToscaElement(inst2DiffType.getComponentUid())).thenReturn(Either.left(inst2OriginResource)); + when(relationsComparator.isRelationsChanged(resource1, resource2)).thenReturn(false); + assertFalse(testInstance.isTopologyChanged(resource1, resource2).left().value()); + } +}
\ No newline at end of file @@ -0,0 +1,112 @@ +package org.openecomp.sdc.be.components.merge.heat; + +import static org.junit.Assert.assertEquals; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.stream.Stream; + +import org.junit.Before; +import org.junit.Test; +import org.openecomp.sdc.be.components.utils.ArtifactBuilder; +import org.openecomp.sdc.be.components.utils.HeatParameterBuilder; +import org.openecomp.sdc.be.datatypes.elements.HeatParameterDataDefinition; +import org.openecomp.sdc.be.model.ArtifactDefinition; +import org.openecomp.sdc.be.model.HeatParameterDefinition; + +public class HeatEnvArtifactsMergeBusinessLogicTest { + + private HeatEnvArtifactsMergeBusinessLogic testInstance; + + @Before + public void setUp() throws Exception { + testInstance = new HeatEnvArtifactsMergeBusinessLogic(); + } + + @Test + public void mergeHeatEnvParameter_diffArtifactLabel_noMerging() throws Exception { + HeatParameterDefinition newHeatParam1 = buildHeatParameterDefinition("param1", "type1", "param1NewValue"); + HeatParameterDefinition prevHeatParam1 = buildHeatParameterDefinition("param1", "type1", "param1PrevValue"); + + ArtifactDefinition oldArtifact = buildHeatArtifact("artifact1", prevHeatParam1); + ArtifactDefinition newArtifact = buildHeatArtifact("artifact2", newHeatParam1); + List<ArtifactDefinition> mergedArtifacts = testInstance.mergeInstanceHeatEnvArtifacts(Collections.singletonList(oldArtifact), Collections.singletonList(newArtifact)); + assertEquals(0, mergedArtifacts.size()); + assertEquals("param1NewValue", newArtifact.getHeatParameters().get(0).getCurrentValue()); + } + + @Test + public void mergeHeatEnvParameter_diffHeatParamName_noMerge() throws Exception { + HeatParameterDefinition newHeatParam1 = buildHeatParameterDefinition("param1", "type1", "param1NewValue"); + HeatParameterDefinition prevHeatParam1 = buildHeatParameterDefinition("param2", "type1", "param1PrevValue"); + ArtifactDefinition oldArtifact = buildHeatArtifact("artifact1", prevHeatParam1); + ArtifactDefinition newArtifact = buildHeatArtifact("artifact1", newHeatParam1); + List<ArtifactDefinition> mergedArtifacts = testInstance.mergeInstanceHeatEnvArtifacts(Collections.singletonList(oldArtifact), Collections.singletonList(newArtifact)); + assertEquals(0, mergedArtifacts.size()); + assertEquals("param1NewValue", newArtifact.getHeatParameters().get(0).getCurrentValue()); + } + + @Test + public void mergeHeatEnvParameter_diffHeatParamType_noMerge() throws Exception { + HeatParameterDefinition newHeatParam1 = buildHeatParameterDefinition("param1", "type1", "param1NewValue"); + HeatParameterDefinition prevHeatParam1 = buildHeatParameterDefinition("param1", "type2", "param1PrevValue"); + ArtifactDefinition oldArtifact = buildHeatArtifact("artifact1", prevHeatParam1); + ArtifactDefinition newArtifact = buildHeatArtifact("artifact1", newHeatParam1); + List<ArtifactDefinition> mergedArtifacts = testInstance.mergeInstanceHeatEnvArtifacts(Collections.singletonList(oldArtifact), Collections.singletonList(newArtifact)); + assertEquals(0, mergedArtifacts.size()); + assertEquals("param1NewValue", newArtifact.getHeatParameters().get(0).getCurrentValue()); + } + + @Test + public void mergeHeatEnvParameter__diffOldAndNewValues_overrideNewValueWithOldValue() throws Exception { + HeatParameterDefinition newHeatParam1 = buildHeatParameterDefinition("param1", "type1", null); + HeatParameterDefinition newHeatParam2 = buildHeatParameterDefinition("param2", "type1", "param2value"); + + HeatParameterDefinition prevHeatParam1 = buildHeatParameterDefinition("param1", "type1", "param1PrevValue"); + HeatParameterDefinition prevHeatParam2 = buildHeatParameterDefinition("param2", "type1", "param2PrevValue"); + + ArtifactDefinition oldArtifact = buildHeatArtifact("artifact1", prevHeatParam1, prevHeatParam2); + ArtifactDefinition newArtifact = buildHeatArtifact("artifact1", newHeatParam1, newHeatParam2); + + List<ArtifactDefinition> mergedArtifacts = testInstance.mergeInstanceHeatEnvArtifacts(Collections.singletonList(oldArtifact), Collections.singletonList(newArtifact)); + assertEquals(1, mergedArtifacts.size()); + List<HeatParameterDataDefinition> heatParameters = mergedArtifacts.get(0).getHeatParameters(); + assertEquals("param1PrevValue", heatParameters.get(0).getCurrentValue()); + assertEquals("param2PrevValue", heatParameters.get(1).getCurrentValue()); + } + + @Test + public void mergeHeatEnvParameter_multipleArtifacts() throws Exception { + HeatParameterDefinition newHeatParam1 = buildHeatParameterDefinition("param1", "type1", "param1Newvalue"); + HeatParameterDefinition newHeatParam2 = buildHeatParameterDefinition("param2", "type1", "param2Newvalue"); + HeatParameterDefinition newHeatParam3 = buildHeatParameterDefinition("param2", "type1", "param3Newvalue"); + + HeatParameterDefinition prevHeatParam1 = buildHeatParameterDefinition("param1", "type1", "param1PrevValue"); + HeatParameterDefinition prevHeatParam2 = buildHeatParameterDefinition("param2", "type1", "param2PrevValue"); + HeatParameterDefinition prevHeatParam3 = buildHeatParameterDefinition("param3", "type2", "param3PrevValue"); + + ArtifactDefinition oldArtifact1 = buildHeatArtifact("artifact1", prevHeatParam1); + ArtifactDefinition oldArtifact2 = buildHeatArtifact("artifact2", prevHeatParam2); + ArtifactDefinition oldArtifact3 = buildHeatArtifact("artifact3", prevHeatParam3); + + ArtifactDefinition newArtifact1 = buildHeatArtifact("artifact1", newHeatParam1); + ArtifactDefinition newArtifact2 = buildHeatArtifact("artifact2New", newHeatParam2); + ArtifactDefinition newArtifact3 = buildHeatArtifact("artifact3", newHeatParam3); + + List<ArtifactDefinition> mergedArtifacts = testInstance.mergeInstanceHeatEnvArtifacts(Arrays.asList(oldArtifact1, oldArtifact2, oldArtifact3), Arrays.asList(newArtifact1, newArtifact2, newArtifact3)); + assertEquals(1, mergedArtifacts.size());//artifact 2 not merged as it has different label, artifact 3 not merged as the heat parameter has diff types + assertEquals("artifact1", mergedArtifacts.get(0).getArtifactLabel()); + } + + private HeatParameterDefinition buildHeatParameterDefinition(String name, String type, String val) { + return new HeatParameterBuilder().setName(name).setType(type).setCurrentValue(val).build(); + } + + private ArtifactDefinition buildHeatArtifact(String label, HeatParameterDefinition ... heatParameterDefinitions) { + ArtifactBuilder artifactBuilder = new ArtifactBuilder().setLabel(label); + Stream.of(heatParameterDefinitions).forEach(artifactBuilder::addHeatParam); + return artifactBuilder.build(); + } + +}
\ No newline at end of file @@ -0,0 +1,94 @@ +package org.openecomp.sdc.be.components.merge.input; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import java.util.List; +import java.util.Map; +import java.util.function.Function; +import java.util.stream.Collectors; + +import org.apache.commons.collections.ListUtils; +import org.junit.Before; +import org.junit.Test; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; +import org.openecomp.sdc.be.components.utils.ObjectGenerator; +import org.openecomp.sdc.be.components.utils.ResourceBuilder; +import org.openecomp.sdc.be.dao.api.ActionStatus; +import org.openecomp.sdc.be.model.InputDefinition; +import org.openecomp.sdc.be.model.Resource; +import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; + +import fj.data.Either; + +public class ComponentInputsMergeBLTest { + + @InjectMocks + private ComponentInputsMergeBL testInstance; + + @Mock + private InputsValuesMergingBusinessLogic inputsValuesMergingBusinessLogicMock; + + @Mock + private ToscaOperationFacade toscaOperationFacade; + + @Before + public void setUp() throws Exception { + MockitoAnnotations.initMocks(this); + } + + @Test + public void mergeComponentInputs() { + Resource oldResource = new ResourceBuilder() + .addInput("input1") + .addInput("input2") + .build(); + + Resource newResource = new Resource(); + + List<InputDefinition> inputsToMerge = ObjectGenerator.buildInputs("input1", "input2", "input3"); + + when(toscaOperationFacade.updateInputsToComponent(inputsToMerge, newResource.getUniqueId())).thenReturn(Either.left(inputsToMerge)); + ActionStatus actionStatus = testInstance.mergeComponentInputs(oldResource, newResource, inputsToMerge); + assertEquals(ActionStatus.OK, actionStatus); + verifyCallToMergeComponentInputs(oldResource, inputsToMerge); + } + + @SuppressWarnings("unchecked") + @Test + public void mergeAndRedeclareComponentInputs() throws Exception { + Resource oldResource = new ResourceBuilder() + .addInput("input1") + .addInput("input2") + .build(); + + Resource newResource = ObjectGenerator.buildBasicResource(); + List<InputDefinition> inputsToMerge = ObjectGenerator.buildInputs("input1", "input2", "input3"); + List<InputDefinition> inputsToRedeclare = ObjectGenerator.buildInputs("input4"); + List<InputDefinition> expectedInputsToUpdate = ListUtils.union(inputsToMerge, inputsToRedeclare); + when(inputsValuesMergingBusinessLogicMock.getPreviouslyDeclaredInputsToMerge(oldResource, newResource)).thenReturn(inputsToRedeclare); + when(toscaOperationFacade.updateInputsToComponent(expectedInputsToUpdate, newResource.getUniqueId())).thenReturn(Either.left(inputsToMerge)); + ActionStatus actionStatus = testInstance.mergeAndRedeclareComponentInputs(oldResource, newResource, inputsToMerge); + assertEquals(ActionStatus.OK, actionStatus); + } + + @Test + public void redeclareResourceInputsForInstance() throws Exception { + List<InputDefinition> oldInputs = ObjectGenerator.buildInputs("input1", "input2"); + Resource newResource = ObjectGenerator.buildBasicResource(); + List<InputDefinition> inputsToRedeclare = ObjectGenerator.buildInputs("input1"); + when(inputsValuesMergingBusinessLogicMock.getPreviouslyDeclaredInputsToMerge(oldInputs, newResource, "inst1")).thenReturn(inputsToRedeclare); + when(toscaOperationFacade.updateInputsToComponent(inputsToRedeclare, newResource.getUniqueId())).thenReturn(Either.left(inputsToRedeclare)); + ActionStatus actionStatus = testInstance.redeclareComponentInputsForInstance(oldInputs, newResource, "inst1"); + } + + private void verifyCallToMergeComponentInputs(Resource oldResource, List<InputDefinition> inputsToMerge) { + Map<String, InputDefinition> oldInputsByName = oldResource.getInputs().stream().collect(Collectors.toMap(InputDefinition::getName, Function.identity())); + Map<String, InputDefinition> inputsToMergeByName = inputsToMerge.stream().collect(Collectors.toMap(InputDefinition::getName, Function.identity())); + verify(inputsValuesMergingBusinessLogicMock).mergeComponentInputs(oldInputsByName, inputsToMergeByName); + } + +}
\ No newline at end of file @@ -0,0 +1,186 @@ +package org.openecomp.sdc.be.components.merge.input; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +import org.junit.Before; +import org.junit.Test; +import org.openecomp.sdc.be.components.utils.PropertyDataDefinitionBuilder; +import org.openecomp.sdc.be.components.utils.ResourceBuilder; +import org.openecomp.sdc.be.dao.utils.MapUtil; +import org.openecomp.sdc.be.datatypes.elements.GetInputValueDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; +import org.openecomp.sdc.be.model.ComponentInstanceInput; +import org.openecomp.sdc.be.model.ComponentInstanceProperty; +import org.openecomp.sdc.be.model.InputDefinition; +import org.openecomp.sdc.be.model.Resource; + +public class InputsValuesMergingBusinessLogicTest { + + public static final String INPUT_DEFUALT_TYPE = "string"; + public static final String INPUT1_ID = "input1"; + public static final String INPUT2_ID = "input2"; + public static final String INPUT3_ID = "input3"; + public static final String INPUT4_ID = "input4"; + private InputsValuesMergingBusinessLogic testInstance; + + @Before + public void setUp() throws Exception { + testInstance = new InputsValuesMergingBusinessLogic(); + } + + @Test + public void testMergeInputs_inputsOfDifferentType_dontCopyOldValue() throws Exception { + InputDefinition oldInput = createUserDefinedInputDefinition(INPUT1_ID, "oldVal1"); + + InputDefinition newInput = createInputDefinition(INPUT1_ID, null); + newInput.setType("int"); + + + Map<String, InputDefinition> updatedInputs = Collections.singletonMap(newInput.getName(), newInput); + Map<String, InputDefinition> oldInputs = Collections.singletonMap(oldInput.getName(), oldInput); + testInstance.mergeComponentInputs(oldInputs, updatedInputs); + + assertNull(updatedInputs.get(INPUT1_ID).getDefaultValue()); + } + + @Test + public void testMergeInputs_newInputsHaveNoValue_copyOldValues() throws Exception { + InputDefinition oldInputWithCsarDefaultValue = createInputDefinition(INPUT1_ID, "oldVal1"); + InputDefinition oldInputWithUserDefinedValue = createUserDefinedInputDefinition(INPUT2_ID, "oldVal2"); + InputDefinition oldInputNotExistOnNew = createUserDefinedInputDefinition(INPUT3_ID, null); + + InputDefinition newInput1 = createInputDefinition(INPUT1_ID, ""); + InputDefinition newInput2 = createUserDefinedInputDefinition(INPUT2_ID, null); + + Map<String, InputDefinition> updatedInputs = mapInputsByName(Arrays.asList(newInput1, newInput2)); + Map<String, InputDefinition> oldInputs = mapInputsByName(Arrays.asList(oldInputWithCsarDefaultValue, oldInputWithUserDefinedValue, oldInputNotExistOnNew)); + testInstance.mergeComponentInputs(oldInputs, updatedInputs); + + assertEquals(oldInputWithCsarDefaultValue.getDefaultValue(), updatedInputs.get(INPUT1_ID).getDefaultValue()); + assertEquals(oldInputWithUserDefinedValue.getDefaultValue(), updatedInputs.get(INPUT2_ID).getDefaultValue()); + assertNull(updatedInputs.get(INPUT3_ID)); + } + + @Test + public void testMergeInputs_newInputsHaveValue_dontOverrideNewValue() throws Exception { + InputDefinition oldInputWithCsarDefaultValue = createInputDefinition(INPUT1_ID, "oldVal1"); + InputDefinition oldInputWithUserDefinedValue = createUserDefinedInputDefinition(INPUT2_ID, "oldVal2"); + InputDefinition oldInputWithNoValue = createUserDefinedInputDefinition(INPUT3_ID, null); + + InputDefinition newInput1 = createInputDefinition(INPUT1_ID, "newVal1"); + InputDefinition newInput2 = createUserDefinedInputDefinition(INPUT2_ID, "newVal2"); + InputDefinition newInput3 = createUserDefinedInputDefinition(INPUT3_ID, "newVal3"); + InputDefinition newInput4 = createUserDefinedInputDefinition(INPUT4_ID, "newVal4"); + + Map<String, InputDefinition> updatedInputs = mapInputsByName(Arrays.asList(newInput1, newInput2, newInput3, newInput4)); + Map<String, InputDefinition> oldInputs = mapInputsByName(Arrays.asList(oldInputWithCsarDefaultValue, oldInputWithUserDefinedValue, oldInputWithNoValue)); + testInstance.mergeComponentInputs(oldInputs, updatedInputs); + + assertEquals(updatedInputs.get(INPUT1_ID).getDefaultValue(), newInput1.getDefaultValue()); + assertEquals(updatedInputs.get(INPUT2_ID).getDefaultValue(), newInput2.getDefaultValue()); + assertEquals(updatedInputs.get(INPUT3_ID).getDefaultValue(), newInput3.getDefaultValue()); + assertEquals(updatedInputs.get(INPUT4_ID).getDefaultValue(), newInput4.getDefaultValue()); + } + + @Test + public void getPrevoislyDeclaredInputsToMerge() throws Exception { + PropertyDataDefinition declaredInputProp1 = new PropertyDataDefinitionBuilder().addGetInputValue(INPUT1_ID).addGetInputValue(INPUT3_ID).setUniqueId("prevDeclaredPropId").build(); + PropertyDataDefinition declaredInputProp2 = new PropertyDataDefinitionBuilder().addGetInputValue(INPUT4_ID).setUniqueId("prevDeclaredPropId2").build(); + + Resource prevResource = new ResourceBuilder().addInput(INPUT1_ID).addInput(INPUT2_ID).addInput(INPUT3_ID).addInput(INPUT4_ID).build(); + + Resource currentResource = new ResourceBuilder() + .addInput(INPUT2_ID) + .addInstanceProperty("inst1", new ComponentInstanceProperty(declaredInputProp1)) + .addInstanceInput("inst2", new ComponentInstanceInput(declaredInputProp2)) + .build(); + + List<InputDefinition> previouslyDeclaredInputs = testInstance.getPreviouslyDeclaredInputsToMerge(prevResource, currentResource); + assertEquals(3, previouslyDeclaredInputs.size()); + + assertInput(previouslyDeclaredInputs.get(0), INPUT1_ID, declaredInputProp1.getUniqueId(), "inst1"); + assertInput(previouslyDeclaredInputs.get(1), INPUT3_ID, declaredInputProp1.getUniqueId(), "inst1"); + assertInput(previouslyDeclaredInputs.get(2), INPUT4_ID, declaredInputProp2.getUniqueId(), "inst2"); + } + + private void assertInput(InputDefinition inputDefinition, String expectedInputId, String expectedPropertyId, String expectedInstanceUniqueId) { + assertEquals(expectedInputId, inputDefinition.getUniqueId()); + assertEquals(expectedPropertyId, inputDefinition.getPropertyId()); + assertEquals(inputDefinition.getInstanceUniqueId(), expectedInstanceUniqueId); + } + + private Map<String, InputDefinition> mapInputsByName(List<InputDefinition> inputs) { + return MapUtil.toMap(inputs, InputDefinition::getName); + } + + private InputDefinition createInputDefinition(String name, String value) { + InputDefinition inputDef = new InputDefinition(); + inputDef.setName(name); + inputDef.setDefaultValue(value); + inputDef.setType(INPUT_DEFUALT_TYPE); + return inputDef; + } + + private InputDefinition createUserDefinedInputDefinition(String name, String value) { + InputDefinition inputDef = createInputDefinition(name, value); + inputDef.setOwnerId("owner"); + return inputDef; + } + + private void addInstanceProperty(Resource resource, ComponentInstanceProperty prop, String instanceId) { + addInstancePropDefinition(resource.getComponentInstancesProperties(), prop, instanceId); + } + + private void addInstanceInput(Resource resource, ComponentInstanceInput prop, String instanceId) { + addInstancePropDefinition(resource.getComponentInstancesInputs(), prop, instanceId); + } + + private <T extends PropertyDataDefinition> void addInstancePropDefinition(Map<String, List<T>> propsDefinitions, T propDef, String instanceId) { + propsDefinitions.computeIfAbsent(instanceId, id -> new ArrayList<>()).add(propDef); + } + + private Resource createResourceWithInputs(String ... inputsIds) { + Resource resource = new Resource(); + List<InputDefinition> inputs = new ArrayList<>(); + for (String inputId : inputsIds) { + InputDefinition inputDefinition = new InputDefinition(); + inputDefinition.setOwnerId("cs0008"); + inputDefinition.setUniqueId(inputId); + inputs.add(inputDefinition); + } + resource.setInputs(inputs); + return resource; + } + + + private ComponentInstanceProperty createGetInputComponentProperty(String ... declaredToInputId) { + ComponentInstanceProperty prevDeclaredProperty = new ComponentInstanceProperty(); + for (String inputId : declaredToInputId) { + addGetInputValueOnProp(inputId, prevDeclaredProperty); + } + + return prevDeclaredProperty; + } + + private void addGetInputValueOnProp(String declaredToInputId, PropertyDataDefinition declaredProperty) { + GetInputValueDataDefinition getInputDef = new GetInputValueDataDefinition(); + getInputDef.setInputId(declaredToInputId); + if (declaredProperty.getGetInputValues() == null) { + declaredProperty.setGetInputValues(new ArrayList<>()); + } + declaredProperty.getGetInputValues().add(getInputDef); + } + + private ComponentInstanceInput createGetInputComponentInstanceInput(String declaredToInputId) { + ComponentInstanceInput prevDeclaredProp = new ComponentInstanceInput(); + addGetInputValueOnProp(declaredToInputId, prevDeclaredProp); + return prevDeclaredProp; + } +}
\ No newline at end of file @@ -0,0 +1,88 @@ +package org.openecomp.sdc.be.components.merge.instance; + +import static junit.framework.TestCase.assertEquals; + +import java.util.HashMap; +import java.util.Map; + +import org.junit.Before; +import org.junit.Test; +import org.mockito.InjectMocks; +import org.mockito.MockitoAnnotations; +import org.openecomp.sdc.be.model.ArtifactDefinition; +import org.openecomp.sdc.be.model.Component; +import org.openecomp.sdc.be.model.ComponentInstance; +import org.openecomp.sdc.be.model.Resource; + + +public class ComponentInstanceArtifactsMergeTest { + + @InjectMocks + private ComponentInstanceArtifactsMerge testInstance; + + @Before + public void setUp() throws Exception { + MockitoAnnotations.initMocks(this); + } + + @Test + public void testDeploymentArtifactSaveData() throws Exception { + + Component containerComponent = new Resource(); + Component originComponent = buildOriginalComponentWithOneArtifact(); + ComponentInstance componentInstance = buildComponentInstanceWithTwoArtifacts(); + + DataForMergeHolder dataForMergeHolder = new DataForMergeHolder(); + testInstance.saveDataBeforeMerge(dataForMergeHolder, containerComponent, componentInstance, originComponent); + Map<String, ArtifactDefinition> originalComponentDeploymentArtifactsCreatedOnTheInstance = dataForMergeHolder.getOrigComponentDeploymentArtifactsCreatedOnTheInstance(); + + assertEquals(originalComponentDeploymentArtifactsCreatedOnTheInstance.size() , 1); + assert(originalComponentDeploymentArtifactsCreatedOnTheInstance.containsKey("artifactTwo")); + } + + @Test + public void testInformationalArtifactSaveData() throws Exception { + + Component containerComponent = new Resource(); + Component originComponent = buildOriginalComponentWithOneArtifact(); + ComponentInstance componentInstance = buildComponentInstanceWithTwoArtifacts(); + + DataForMergeHolder dataForMergeHolder = new DataForMergeHolder(); + testInstance.saveDataBeforeMerge(dataForMergeHolder, containerComponent, componentInstance, originComponent); + Map<String, ArtifactDefinition> originalComponentInformationalArtifactsCreatedOnTheInstance = dataForMergeHolder.getOrigComponentInformationalArtifactsCreatedOnTheInstance(); + + assertEquals(originalComponentInformationalArtifactsCreatedOnTheInstance.size() , 1); + assert(originalComponentInformationalArtifactsCreatedOnTheInstance.containsKey("artifactTwo")); + } + + private ComponentInstance buildComponentInstanceWithTwoArtifacts(){ + ArtifactDefinition artifactFromTheOriginalResource = new ArtifactDefinition(); + artifactFromTheOriginalResource.setArtifactLabel("artifactOne"); + ArtifactDefinition artifactCreatedOnTheInstance = new ArtifactDefinition(); + artifactCreatedOnTheInstance.setArtifactLabel("artifactTwo"); + + Map<String, ArtifactDefinition> componentInstanceArtifacts = new HashMap<>(); + componentInstanceArtifacts.put(artifactFromTheOriginalResource.getArtifactLabel(), artifactFromTheOriginalResource); + componentInstanceArtifacts.put(artifactCreatedOnTheInstance.getArtifactLabel(), artifactCreatedOnTheInstance); + + ComponentInstance componentInstance = new ComponentInstance(); + componentInstance.setDeploymentArtifacts(componentInstanceArtifacts); + componentInstance.setArtifacts(componentInstanceArtifacts); + return componentInstance; + } + + private Component buildOriginalComponentWithOneArtifact() { + ArtifactDefinition artifactFromTheOriginalResource = new ArtifactDefinition(); + artifactFromTheOriginalResource.setArtifactLabel("artifactOne"); + + Map<String, ArtifactDefinition> originComponentArtifacts = new HashMap<>(); + originComponentArtifacts.put(artifactFromTheOriginalResource.getArtifactLabel(), artifactFromTheOriginalResource); + Component originComponent = new Resource(); + originComponent.setDeploymentArtifacts(originComponentArtifacts); + originComponent.setArtifacts(originComponentArtifacts); + return originComponent; + } + + + +}
\ No newline at end of file @@ -0,0 +1,16 @@ +package org.openecomp.sdc.be.components.merge.instance; + +import org.junit.Test; + +/** + * Created by chaya on 9/19/2017. + */ +public class ComponentInstanceDataMergingTest { + + ComponentInstanceMergeDataBusinessLogic compInstMergeDataBL; + + @Test + public void testMergeInstanceInputs() { + //compInstMergeDataBL.mergeComponentUserOrigData(); + } +} @@ -0,0 +1,101 @@ +package org.openecomp.sdc.be.components.merge.instance; + +import static org.mockito.Mockito.when; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import org.junit.Before; +import org.junit.Test; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.MockitoAnnotations; +import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic; +import org.openecomp.sdc.be.components.merge.heat.HeatEnvArtifactsMergeBusinessLogic; +import org.openecomp.sdc.be.components.utils.ArtifactBuilder; +import org.openecomp.sdc.be.components.utils.ComponentInstanceBuilder; +import org.openecomp.sdc.be.components.utils.ResourceBuilder; +import org.openecomp.sdc.be.impl.ComponentsUtils; +import org.openecomp.sdc.be.model.ArtifactDefinition; +import org.openecomp.sdc.be.model.Resource; +import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum; +import org.openecomp.sdc.common.api.ArtifactTypeEnum; + +import fj.data.Either; + +public class ComponentInstanceHeatEnvMergeTest { + + @InjectMocks + private ComponentInstanceHeatEnvMerge testInstance; + + @Mock + private ArtifactsBusinessLogic artifactsBusinessLogicMock; + + @Mock + private HeatEnvArtifactsMergeBusinessLogic heatEnvArtifactsMergeBusinessLogicMock; + + @Mock + private ComponentsUtils componentsUtils; + + private static final User USER = new User(); + + @Before + public void setUp() throws Exception { + MockitoAnnotations.initMocks(this); + } + + @Test + public void mergeDataAfterCreate_mergeAndPersistArtifacts() throws Exception { + Map<String, ArtifactDefinition> nodeTypeArtifactsByName = buildMapOfHeatArtifacts("artifact1", "artifact2"); + DataForMergeHolder dataHolder = new DataForMergeHolder(); + dataHolder.setOrigComponentDeploymentArtifactsCreatedOnTheInstance(nodeTypeArtifactsByName); + String instanceId = "instance1"; + Resource resource = buildResourceWithHeatArtifacts(instanceId, "heatArtifact1", "heatArtifact2"); + List<ArtifactDefinition> mergedArtifacts = buildListOfArtifacts("artifact1, heatArtifact1"); + when(heatEnvArtifactsMergeBusinessLogicMock.mergeInstanceHeatEnvArtifacts(dataHolder.getOrigComponentInstanceHeatEnvArtifacts(), resource.safeGetComponentInstanceHeatArtifacts(instanceId))) + .thenReturn(mergedArtifacts); + expectMergedArtifactsToBePersisted(mergedArtifacts, instanceId, resource); + testInstance.mergeDataAfterCreate(USER, dataHolder, resource, instanceId); + } + + private void expectMergedArtifactsToBePersisted(List<ArtifactDefinition> mergedArtifacts, String instanceId, Resource resource) { + for (ArtifactDefinition mergedArtifact : mergedArtifacts) { + Map<String, Object> json = new HashMap<>(); + when(artifactsBusinessLogicMock.buildJsonForUpdateArtifact(mergedArtifact, ArtifactGroupTypeEnum.DEPLOYMENT, null)).thenReturn(json); + ArtifactsBusinessLogic.ArtifactOperationInfo artifactUpdateOperation = artifactsBusinessLogicMock.new ArtifactOperationInfo(false, false, ArtifactsBusinessLogic.ArtifactOperationEnum.Update); + when(artifactsBusinessLogicMock.updateResourceInstanceArtifactNoContent(Mockito.eq(instanceId), Mockito.eq(resource), + Mockito.eq(USER), Mockito.eq(json), + Mockito.refEq(artifactUpdateOperation), + Mockito.isNull(ArtifactDefinition.class))) + .thenReturn(Either.left(Either.left(new ArtifactDefinition()))); + } + } + + private Resource buildResourceWithHeatArtifacts(String instanceId, String ... artifacts) { + ComponentInstanceBuilder componentInstanceBuilder = new ComponentInstanceBuilder().setId(instanceId); + for (String artifact : artifacts) { + ArtifactDefinition heatArtifact = new ArtifactBuilder().setType(ArtifactTypeEnum.HEAT_ARTIFACT.getType()).setName(artifact).build(); + componentInstanceBuilder.addDeploymentArtifact(heatArtifact); + } + return new ResourceBuilder().addComponentInstance(componentInstanceBuilder.build()).build(); + } + + private Map<String, ArtifactDefinition> buildMapOfHeatArtifacts(String ... artifacts) { + Map<String, ArtifactDefinition> artifactsByName = new HashMap<>(); + for (String artifact : artifacts) { + ArtifactDefinition heatArtifact = new ArtifactBuilder().setType(ArtifactTypeEnum.HEAT_ARTIFACT.getType()).setName(artifact).build(); + artifactsByName.put(artifact, heatArtifact); + } + return artifactsByName; + } + + private List<ArtifactDefinition> buildListOfArtifacts(String ... artifacts) { + return Stream.of(artifacts).map(artifact -> new ArtifactBuilder().setName(artifact).build()).collect(Collectors.toList()); + } + +}
\ No newline at end of file @@ -0,0 +1,115 @@ +package org.openecomp.sdc.be.components.merge.instance; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.when; + +import java.util.Arrays; + +import org.junit.Before; +import org.junit.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.MockitoAnnotations; +import org.openecomp.sdc.be.components.utils.ResourceBuilder; +import org.openecomp.sdc.be.dao.api.ActionStatus; +import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; +import org.openecomp.sdc.be.impl.ComponentsUtils; +import org.openecomp.sdc.be.model.Component; +import org.openecomp.sdc.be.model.ComponentInstance; +import org.openecomp.sdc.be.model.ComponentParametersView; +import org.openecomp.sdc.be.model.Resource; +import org.openecomp.sdc.be.model.Service; +import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; +import org.openecomp.sdc.exception.ResponseFormat; + +import fj.data.Either; + +public class ComponentInstanceMergeDataBusinessLogicTest { + + @InjectMocks + private ComponentInstanceMergeDataBusinessLogic testInstance; + + @Mock + private ToscaOperationFacade toscaOperationFacade; + + @Mock + private ComponentsUtils componentsUtils; + + @Mock + private ComponentInstanceMergeInterface componentInstanceMergeInterfaceMock1; + + @Mock + private ComponentInstanceMergeInterface componentInstanceMergeInterfaceMock2; + + @Before + public void setUp() throws Exception { + MockitoAnnotations.initMocks(this); + testInstance.setComponentInstancesMergeBLs(Arrays.asList(componentInstanceMergeInterfaceMock1, componentInstanceMergeInterfaceMock2)); + } + + @Test + public void saveAllDataBeforeDeleting_allInstanceMergeInterfacesAreCalled() throws Exception { + Component container = new Service(); + ComponentInstance instance = new ComponentInstance(); + Component instanceOriginResource = new Resource(); + DataForMergeHolder dataForMergeHolder = testInstance.saveAllDataBeforeDeleting(container, instance, instanceOriginResource); + verify(componentInstanceMergeInterfaceMock1).saveDataBeforeMerge(dataForMergeHolder, container, instance, instanceOriginResource); + verify(componentInstanceMergeInterfaceMock2).saveDataBeforeMerge(dataForMergeHolder, container, instance, instanceOriginResource); + } + + @Test + public void mergeComponentUserOrigData_allInstanceMergeInterfacesAreCalled() throws Exception { + ArgumentCaptor<ComponentParametersView> componentsFilterCapture = ArgumentCaptor.forClass(ComponentParametersView.class); + Service persistedService = new Service(); + User user = new User(); + DataForMergeHolder dataHolder = new DataForMergeHolder(); + when(toscaOperationFacade.getToscaElement(Mockito.eq("newContainerId"), componentsFilterCapture.capture())).thenReturn(Either.left(persistedService)); + when(componentInstanceMergeInterfaceMock1.mergeDataAfterCreate(user, dataHolder, persistedService, "instId")).thenReturn(Either.left(persistedService)); + when(componentInstanceMergeInterfaceMock2.mergeDataAfterCreate(user, dataHolder, persistedService, "instId")).thenReturn(Either.left(persistedService)); + Either<Component, ResponseFormat> mergeResult = testInstance.mergeComponentUserOrigData(user, dataHolder, new Service(), "newContainerId", "instId"); + assertEquals(persistedService, mergeResult.left().value()); + assertComponentFilter(componentsFilterCapture.getValue()); + } + + @Test + public void mergeComponentUserOrigData_failToGetPersistedComponent_doNotTryToMerge() throws Exception { + User user = new User(); + DataForMergeHolder dataHolder = new DataForMergeHolder(); + ResponseFormat rf = new ResponseFormat(); + Resource container = new ResourceBuilder().setComponentType(ComponentTypeEnum.SERVICE).build(); + when(toscaOperationFacade.getToscaElement(Mockito.eq("newContainerId"), Mockito.any(ComponentParametersView.class))).thenReturn(Either.right(StorageOperationStatus.GENERAL_ERROR)); + when(componentsUtils.convertFromStorageResponse(StorageOperationStatus.GENERAL_ERROR, ComponentTypeEnum.SERVICE)).thenReturn(ActionStatus.GENERAL_ERROR); + when(componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR)).thenReturn(rf); + Either<Component, ResponseFormat> mergeResult = testInstance.mergeComponentUserOrigData(user, dataHolder, container, "newContainerId", "instId"); + assertEquals(rf, mergeResult.right().value()); + verifyZeroInteractions(componentInstanceMergeInterfaceMock1, componentInstanceMergeInterfaceMock2); + } + + @Test + public void mergeComponentUserOrigData_failOnOneMerge_doNotCallOtherMerge() throws Exception { + Service persistedService = new Service(); + User user = new User(); + DataForMergeHolder dataHolder = new DataForMergeHolder(); + ResponseFormat rf = new ResponseFormat(); + when(toscaOperationFacade.getToscaElement(Mockito.eq("newContainerId"), Mockito.any(ComponentParametersView.class))).thenReturn(Either.left(persistedService)); + when(componentInstanceMergeInterfaceMock1.mergeDataAfterCreate(user, dataHolder, persistedService, "instId")).thenReturn(Either.right(rf)); + Either<Component, ResponseFormat> mergeResult = testInstance.mergeComponentUserOrigData(user, dataHolder, new Service(), "newContainerId", "instId"); + assertEquals(rf, mergeResult.right().value()); + verifyZeroInteractions(componentInstanceMergeInterfaceMock2); + } + + private void assertComponentFilter(ComponentParametersView value) { + assertFalse(value.isIgnoreComponentInstances()); + assertFalse(value.isIgnoreComponentInstancesProperties()); + assertFalse(value.isIgnoreComponentInstancesInputs()); + assertFalse(value.isIgnoreArtifacts()); + } + +}
\ No newline at end of file @@ -0,0 +1,154 @@ +package org.openecomp.sdc.be.components.merge.instance; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyList; +import static org.mockito.ArgumentMatchers.anyListOf; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.when; + +import java.util.List; + +import org.junit.Before; +import org.junit.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.MockitoAnnotations; +import org.openecomp.sdc.be.components.merge.input.ComponentInputsMergeBL; +import org.openecomp.sdc.be.components.merge.property.ComponentInstanceInputsMergeBL; +import org.openecomp.sdc.be.components.merge.property.ComponentInstancePropertiesMergeBL; +import org.openecomp.sdc.be.components.utils.ObjectGenerator; +import org.openecomp.sdc.be.components.utils.ResourceBuilder; +import org.openecomp.sdc.be.dao.api.ActionStatus; +import org.openecomp.sdc.be.impl.ComponentsUtils; +import org.openecomp.sdc.be.model.Component; +import org.openecomp.sdc.be.model.ComponentInstanceInput; +import org.openecomp.sdc.be.model.ComponentInstanceProperty; +import org.openecomp.sdc.be.model.ComponentParametersView; +import org.openecomp.sdc.be.model.InputDefinition; +import org.openecomp.sdc.be.model.Resource; +import org.openecomp.sdc.be.model.Service; +import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; +import org.openecomp.sdc.exception.ResponseFormat; + +import fj.data.Either; + +public class ComponentInstancePropsAndInputsMergeTest { + + private static final String INSTANCE_ID1 = "inst1"; + private static final User USER = new User(); + + @InjectMocks + private ComponentInstancePropsAndInputsMerge testInstance; + + @Mock + private ToscaOperationFacade toscaOperationFacade; + + @Mock + private ComponentsUtils componentsUtils; + + @Mock + private ComponentInstancePropertiesMergeBL componentInstancePropertiesMergeBL; + + @Mock + private ComponentInstanceInputsMergeBL componentInstanceInputsMergeBL; + + @Mock + private ComponentInputsMergeBL componentInputsMergeBL; + + private Resource resourceToUpdate; + + private DataForMergeHolder oldDataHolder; + + @Before + public void setUp() throws Exception { + MockitoAnnotations.initMocks(this); + resourceToUpdate = new ResourceBuilder().addInstanceInput(INSTANCE_ID1, "instInput1") + .addInstanceInput(INSTANCE_ID1, "instInput2") + .addInstanceProperty(INSTANCE_ID1, "instProp1") + .addInstanceProperty(INSTANCE_ID1, "instProp2") + .addInput("input1") + .addInput("input2") + .setUniqueId("resourceId").build(); + + List<InputDefinition> oldInputs = ObjectGenerator.buildInputs("input1"); + List<ComponentInstanceProperty> oldInstProps = ObjectGenerator.buildInstanceProperties("instProp1", "instProp3"); + List<ComponentInstanceInput> oldInstInputs = ObjectGenerator.buildInstanceInputs("instInput1", "instInput3"); + + oldDataHolder = new DataForMergeHolder(); + oldDataHolder.setOrigComponentInputs(oldInputs); + oldDataHolder.setOrigComponentInstanceProperties(oldInstProps); + oldDataHolder.setOrigComponentInstanceInputs(oldInstInputs); + } + + @Test + public void mergeDataAfterCreate() throws Exception { + List<InputDefinition> oldInputs = ObjectGenerator.buildInputs("input1"); + List<ComponentInstanceProperty> oldInstProps = ObjectGenerator.buildInstanceProperties("instProp1", "instProp3"); + List<ComponentInstanceInput> oldInstInputs = ObjectGenerator.buildInstanceInputs("instInput1", "instInput3"); + + DataForMergeHolder dataForMergeHolder = new DataForMergeHolder(); + dataForMergeHolder.setOrigComponentInputs(oldInputs); + dataForMergeHolder.setOrigComponentInstanceProperties(oldInstProps); + dataForMergeHolder.setOrigComponentInstanceInputs(oldInstInputs); + + ArgumentCaptor<ComponentParametersView> parametersViewCaptor = ArgumentCaptor.forClass(ComponentParametersView.class); + + when(toscaOperationFacade.getToscaElement(Mockito.eq("resourceId"), parametersViewCaptor.capture())).thenReturn(Either.left(resourceToUpdate)); + when(componentInstanceInputsMergeBL.mergeComponentInstanceInputs(oldInstInputs, oldInputs, resourceToUpdate, INSTANCE_ID1)).thenReturn(ActionStatus.OK); + when(componentInstancePropertiesMergeBL.mergeComponentInstanceProperties(oldInstProps, oldInputs, resourceToUpdate, INSTANCE_ID1)).thenReturn(ActionStatus.OK); + when(componentInputsMergeBL.redeclareComponentInputsForInstance(oldInputs, resourceToUpdate, INSTANCE_ID1)).thenReturn(ActionStatus.OK); + Either<Component, ResponseFormat> mergeResult = testInstance.mergeDataAfterCreate(USER, dataForMergeHolder, resourceToUpdate, INSTANCE_ID1); + assertEquals(mergeResult.left().value(), resourceToUpdate); + assertComponentFilter(parametersViewCaptor.getValue()); + } + + @Test + public void mergeDataAfterCreate_failedToMergeComponentInstanceInputs() throws Exception { + ResponseFormat errorResponse = new ResponseFormat(); + when(componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR)).thenReturn(errorResponse); + when(componentInstanceInputsMergeBL.mergeComponentInstanceInputs(anyListOf(ComponentInstanceInput.class), anyListOf(InputDefinition.class), any(Component.class), anyString())).thenReturn(ActionStatus.GENERAL_ERROR); + Either<Component, ResponseFormat> mergeResult = testInstance.mergeDataAfterCreate(USER, new DataForMergeHolder(), new Service(), "inst1"); + assertEquals(errorResponse, mergeResult.right().value()); + verifyZeroInteractions(componentInputsMergeBL, componentInstancePropertiesMergeBL, toscaOperationFacade); + } + + @Test + public void mergeDataAfterCreate_failedToMergeComponentInstProps() throws Exception { + ResponseFormat errorResponse = new ResponseFormat(); + when(componentInstanceInputsMergeBL.mergeComponentInstanceInputs(anyList(), anyList(), any(Component.class), anyString())).thenReturn(ActionStatus.OK); + when(componentInstancePropertiesMergeBL.mergeComponentInstanceProperties(anyList(), anyList(), any(Component.class), anyString())).thenReturn(ActionStatus.GENERAL_ERROR); + when(componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR)).thenReturn(errorResponse); + Either<Component, ResponseFormat> mergeResult = testInstance.mergeDataAfterCreate(USER, new DataForMergeHolder(), new Service(), "inst1"); + assertEquals(errorResponse, mergeResult.right().value()); + verifyZeroInteractions(componentInputsMergeBL, toscaOperationFacade); + } + + @Test + public void mergeDataAfterCreate_mergeInputs_FailedToFetchResource() throws Exception { + ResponseFormat errorResponse = new ResponseFormat(); + when(componentInstanceInputsMergeBL.mergeComponentInstanceInputs(anyList(), anyList(), any(Component.class), anyString())).thenReturn(ActionStatus.OK); + when(componentInstancePropertiesMergeBL.mergeComponentInstanceProperties(anyList(), anyList(), any(Component.class), anyString())).thenReturn(ActionStatus.OK); + when(toscaOperationFacade.getToscaElement(any(), any(ComponentParametersView.class))).thenReturn(Either.right(StorageOperationStatus.GENERAL_ERROR)); + when(componentsUtils.convertFromStorageResponse(StorageOperationStatus.GENERAL_ERROR)).thenReturn(ActionStatus.GENERAL_ERROR); + when(componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR)).thenReturn(errorResponse); + DataForMergeHolder dataHolder = new DataForMergeHolder(); + dataHolder.setOrigComponentInputs(ObjectGenerator.buildInputs("input1", "input2")); + Either<Component, ResponseFormat> mergeResult = testInstance.mergeDataAfterCreate(USER, dataHolder, new Service(), "inst1"); + assertEquals(errorResponse, mergeResult.right().value()); + verifyZeroInteractions(componentInputsMergeBL); + } + + private void assertComponentFilter(ComponentParametersView value) { + assertFalse(value.isIgnoreComponentInstances()); + assertFalse(value.isIgnoreComponentInstancesProperties()); + assertFalse(value.isIgnoreComponentInstancesInputs()); + assertFalse(value.isIgnoreArtifacts()); + } +}
\ No newline at end of file @@ -0,0 +1,120 @@ +package org.openecomp.sdc.be.components.merge.property; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoMoreInteractions; +import static org.mockito.Mockito.when; + +import java.util.Collections; +import java.util.List; + +import org.junit.Before; +import org.junit.Test; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; +import org.openecomp.sdc.be.components.utils.ComponentInstanceBuilder; +import org.openecomp.sdc.be.components.utils.ResourceBuilder; +import org.openecomp.sdc.be.dao.api.ActionStatus; +import org.openecomp.sdc.be.impl.ComponentsUtils; +import org.openecomp.sdc.be.model.ComponentInstance; +import org.openecomp.sdc.be.model.ComponentInstanceInput; +import org.openecomp.sdc.be.model.Resource; +import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; + +import fj.data.Either; + +public class ComponentInstanceInputsMergeBLTest { + + public static final String INSTANCE1 = "instance1"; + public static final String INSTANCE2 = "instance2"; + @InjectMocks + private ComponentInstanceInputsMergeBL testInstance; + + @Mock + private DataDefinitionsValuesMergingBusinessLogic propertyValuesMergingBusinessLogic; + + @Mock + private ToscaOperationFacade toscaOperationFacade; + + @Mock + private ComponentsUtils componentsUtils; + + private Resource oldResource, newResource; + + @Before + public void setUp() throws Exception { + MockitoAnnotations.initMocks(this); + ComponentInstance instance1 = new ComponentInstanceBuilder().setId(INSTANCE1).setName(INSTANCE1).build(); + ComponentInstance instance2 = new ComponentInstanceBuilder().setId(INSTANCE2).setName(INSTANCE2).build(); + + oldResource = new ResourceBuilder() + .addInstanceInput(INSTANCE1, "property1") + .addInstanceInput(INSTANCE1, "property2") + .addInstanceInput(INSTANCE2, "property3") + .addComponentInstance(instance1) + .addComponentInstance(instance2) + .addInput("input1") + .addInput("input2").build(); + + newResource = new ResourceBuilder() + .addInstanceInput(INSTANCE1, "property11") + .addInstanceInput(INSTANCE1, "property12") + .addInstanceInput(INSTANCE2, "property13") + .addComponentInstance(instance1) + .addComponentInstance(instance2) + .addInput("input11") + .addInput("input12").build(); + } + + @Test + public void mergeInstancesInputs() throws Exception { + when(toscaOperationFacade.updateComponentInstanceInputsToComponent(newResource.getComponentInstancesInputs(), newResource.getUniqueId())).thenReturn(Either.left(Collections.emptyMap())); + ActionStatus actionStatus = testInstance.mergeComponentInstancesInputs(oldResource, newResource); + assertEquals(actionStatus, ActionStatus.OK); + verifyMergeBLCalled(oldResource, newResource); + } + + @Test + public void mergeInstancesInputs_failure() throws Exception { + when(toscaOperationFacade.updateComponentInstanceInputsToComponent(newResource.getComponentInstancesInputs(), newResource.getUniqueId())).thenReturn(Either.right(StorageOperationStatus.GENERAL_ERROR)); + when(componentsUtils.convertFromStorageResponse(StorageOperationStatus.GENERAL_ERROR)).thenReturn(ActionStatus.GENERAL_ERROR); + verifyNoMoreInteractions(toscaOperationFacade, propertyValuesMergingBusinessLogic); + ActionStatus actionStatus = testInstance.mergeComponentInstancesInputs(oldResource, newResource); + assertEquals(ActionStatus.GENERAL_ERROR, actionStatus); + } + + @Test + public void mergeInstanceProps() throws Exception { + List<ComponentInstanceInput> newInstanceInputs = newResource.safeGetComponentInstanceInput(INSTANCE1); + List<ComponentInstanceInput> oldInstInputs = oldResource.safeGetComponentInstanceInput(INSTANCE1); + when(toscaOperationFacade.updateComponentInstanceInputs(newResource, INSTANCE1, newInstanceInputs)) + .thenReturn(StorageOperationStatus.OK); + ActionStatus actionStatus = testInstance.mergeComponentInstanceInputs(oldInstInputs, oldResource.getInputs(), newResource, INSTANCE1); + assertEquals(actionStatus, ActionStatus.OK); + verify(propertyValuesMergingBusinessLogic).mergeInstanceDataDefinitions(oldInstInputs, oldResource.getInputs(), newInstanceInputs, newResource.getInputs()); + } + + @Test + public void mergeInstanceProps_failure() throws Exception { + List<ComponentInstanceInput> newInstanceInputs = newResource.safeGetComponentInstanceInput(INSTANCE1); + List<ComponentInstanceInput> oldInstInputs = oldResource.safeGetComponentInstanceInput(INSTANCE1); + when(toscaOperationFacade.updateComponentInstanceInputs(newResource, INSTANCE1, newInstanceInputs)) + .thenReturn(StorageOperationStatus.GENERAL_ERROR); + when(componentsUtils.convertFromStorageResponse(StorageOperationStatus.GENERAL_ERROR)).thenReturn(ActionStatus.GENERAL_ERROR); + ActionStatus actionStatus = testInstance.mergeComponentInstanceInputs(oldInstInputs, oldResource.getInputs(), newResource, INSTANCE1); + assertEquals(actionStatus, ActionStatus.GENERAL_ERROR); + verify(propertyValuesMergingBusinessLogic).mergeInstanceDataDefinitions(oldInstInputs, oldResource.getInputs(), newInstanceInputs, newResource.getInputs()); + } + + private void verifyMergeBLCalled(Resource oldResource, Resource newResource) { + List<ComponentInstanceInput> instance1oldInputs = oldResource.getComponentInstancesInputs().get(INSTANCE1); + List<ComponentInstanceInput> instance1newInputs = newResource.getComponentInstancesInputs().get(INSTANCE1); + List<ComponentInstanceInput> instance2oldInputs = oldResource.getComponentInstancesInputs().get(INSTANCE2); + List<ComponentInstanceInput> instance2newInputs = newResource.getComponentInstancesInputs().get(INSTANCE2); + verify(propertyValuesMergingBusinessLogic).mergeInstanceDataDefinitions(instance1oldInputs, oldResource.getInputs(), instance1newInputs, newResource.getInputs()); + verify(propertyValuesMergingBusinessLogic).mergeInstanceDataDefinitions(instance2oldInputs, oldResource.getInputs(), instance2newInputs, newResource.getInputs()); + } + +}
\ No newline at end of file @@ -0,0 +1,114 @@ +package org.openecomp.sdc.be.components.merge.property; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoMoreInteractions; +import static org.mockito.Mockito.when; + +import java.util.Collections; +import java.util.List; + +import org.junit.Before; +import org.junit.Test; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; +import org.openecomp.sdc.be.components.utils.ResourceBuilder; +import org.openecomp.sdc.be.dao.api.ActionStatus; +import org.openecomp.sdc.be.impl.ComponentsUtils; +import org.openecomp.sdc.be.model.ComponentInstanceProperty; +import org.openecomp.sdc.be.model.Resource; +import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; + +import fj.data.Either; + +public class ComponentInstancePropertiesMergeBLTest { + + private static final String INSTANCE1 = "instance1"; + private static final String INSTANCE2 = "instance2"; + + @InjectMocks + private ComponentInstancePropertiesMergeBL testInstance; + + @Mock + private DataDefinitionsValuesMergingBusinessLogic propertyValuesMergingBusinessLogic; + + @Mock + private ToscaOperationFacade toscaOperationFacade; + + @Mock + private ComponentsUtils componentsUtils; + + private Resource oldResource, newResource; + + @Before + public void setUp() throws Exception { + MockitoAnnotations.initMocks(this); + oldResource = new ResourceBuilder() + .addInstanceProperty(INSTANCE1, "property1") + .addInstanceProperty(INSTANCE1, "property2") + .addInstanceProperty(INSTANCE2, "property3") + .addInput("input1") + .addInput("input2").build(); + + newResource = new ResourceBuilder() + .addInstanceProperty(INSTANCE1, "property11") + .addInstanceProperty(INSTANCE1, "property12") + .addInstanceProperty(INSTANCE2, "property13") + .addInput("input11") + .addInput("input12").build(); + } + + @Test + public void mergeInstancesPropsAndInputs_mergeInstanceProps() throws Exception { + when(toscaOperationFacade.updateComponentInstancePropsToComponent(newResource.getComponentInstancesProperties(), newResource.getUniqueId())) + .thenReturn(Either.left(Collections.emptyMap())); + ActionStatus actionStatus = testInstance.mergeComponentInstancesProperties(oldResource, newResource); + assertEquals(actionStatus, ActionStatus.OK); + verifyMergeBLCalled(oldResource, newResource); + } + + @Test + public void mergeInstancesProps_failure() throws Exception { + when(toscaOperationFacade.updateComponentInstancePropsToComponent(newResource.getComponentInstancesProperties(), newResource.getUniqueId())) + .thenReturn(Either.right(StorageOperationStatus.GENERAL_ERROR)); + when(componentsUtils.convertFromStorageResponse(StorageOperationStatus.GENERAL_ERROR)).thenReturn(ActionStatus.GENERAL_ERROR); + verifyNoMoreInteractions(toscaOperationFacade, propertyValuesMergingBusinessLogic); + ActionStatus actionStatus = testInstance.mergeComponentInstancesProperties(oldResource, newResource); + assertEquals(ActionStatus.GENERAL_ERROR, actionStatus); + } + + @Test + public void mergeInstanceProps() throws Exception { + List<ComponentInstanceProperty> newInstanceProps = newResource.safeGetComponentInstanceProperties(INSTANCE1); + List<ComponentInstanceProperty> oldInstProps = oldResource.safeGetComponentInstanceProperties(INSTANCE1); + when(toscaOperationFacade.updateComponentInstanceProperties(newResource, INSTANCE1, newInstanceProps)) + .thenReturn(StorageOperationStatus.OK); + ActionStatus actionStatus = testInstance.mergeComponentInstanceProperties(oldInstProps, oldResource.getInputs(), newResource, INSTANCE1); + assertEquals(actionStatus, ActionStatus.OK); + verify(propertyValuesMergingBusinessLogic).mergeInstanceDataDefinitions(oldInstProps, oldResource.getInputs(), newInstanceProps, newResource.getInputs()); + } + + @Test + public void mergeInstanceProps_failure() throws Exception { + List<ComponentInstanceProperty> newInstanceProps = newResource.safeGetComponentInstanceProperties(INSTANCE1); + List<ComponentInstanceProperty> oldInstProps = oldResource.safeGetComponentInstanceProperties(INSTANCE1); + when(toscaOperationFacade.updateComponentInstanceProperties(newResource, INSTANCE1, newInstanceProps)) + .thenReturn(StorageOperationStatus.GENERAL_ERROR); + when(componentsUtils.convertFromStorageResponse(StorageOperationStatus.GENERAL_ERROR)).thenReturn(ActionStatus.GENERAL_ERROR); + ActionStatus actionStatus = testInstance.mergeComponentInstanceProperties(oldInstProps, oldResource.getInputs(), newResource, INSTANCE1); + assertEquals(actionStatus, ActionStatus.GENERAL_ERROR); + verify(propertyValuesMergingBusinessLogic).mergeInstanceDataDefinitions(oldInstProps, oldResource.getInputs(), newInstanceProps, newResource.getInputs()); + } + + private void verifyMergeBLCalled(Resource oldResource, Resource newResource) { + List<ComponentInstanceProperty> instance1oldProps = oldResource.getComponentInstancesProperties().get(INSTANCE1); + List<ComponentInstanceProperty> instance1newProps = newResource.getComponentInstancesProperties().get(INSTANCE1); + List<ComponentInstanceProperty> instance2oldProps = oldResource.getComponentInstancesProperties().get(INSTANCE2); + List<ComponentInstanceProperty> instance2newProps = newResource.getComponentInstancesProperties().get(INSTANCE2); + verify(propertyValuesMergingBusinessLogic).mergeInstanceDataDefinitions(instance1oldProps, oldResource.getInputs(), instance1newProps, newResource.getInputs()); + verify(propertyValuesMergingBusinessLogic).mergeInstanceDataDefinitions(instance2oldProps, oldResource.getInputs(), instance2newProps, newResource.getInputs()); + } + +}
\ No newline at end of file @@ -0,0 +1,122 @@ +package org.openecomp.sdc.be.components.merge.property; + +import static org.mockito.Mockito.verify; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.junit.Before; +import org.junit.Test; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.MockitoAnnotations; +import org.openecomp.sdc.be.components.utils.PropertyDataDefinitionBuilder; +import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; +import org.openecomp.sdc.be.model.InputDefinition; + +public class DataDefinitionsValuesMergingBusinessLogicTest { + + private static final String DEFAULT_PROP_TYPE = "string"; + + @InjectMocks + private DataDefinitionsValuesMergingBusinessLogic testInstance; + + @Mock + private PropertyDataValueMergeBusinessLogic propertyDataValueMergeBusinessLogicMock; + + @Before + public void setUp() throws Exception { + MockitoAnnotations.initMocks(this); + } + + @Test + public void mergePropDataDefinition_propertiesNotOfSameType_dontMerge() throws Exception { + PropertyDataDefinition oldProp1 = createPropertyDataDefinition("prop1", "oldVal1"); + + PropertyDataDefinition newProp1 = createPropertyDataDefinition("prop1", null); + newProp1.setType("int"); + + testInstance.mergeInstanceDataDefinitions(Collections.singletonList(oldProp1), Collections.emptyList(), Collections.singletonList(newProp1), Collections.emptyList()); + Mockito.verifyZeroInteractions(propertyDataValueMergeBusinessLogicMock); + } + + @Test + public void mergePropDataDefinition_propertiesInnerTypesNotSame_dontMerge() throws Exception { + PropertyDataDefinition oldProp1 = new PropertyDataDefinitionBuilder() + .setName("prop1") + .setType("list") + .setSchemaType("string") + .setValue("val1").build(); + + PropertyDataDefinition newProp1 = new PropertyDataDefinitionBuilder() + .setName("prop1") + .setType("list") + .setSchemaType("int") + .setValue("val1").build(); + + testInstance.mergeInstanceDataDefinitions(Collections.singletonList(oldProp1), Collections.emptyList(), Collections.singletonList(newProp1), Collections.emptyList()); + Mockito.verifyZeroInteractions(propertyDataValueMergeBusinessLogicMock); + } + + @Test + public void mergePropDataDefinition_getInputsToMerge_mergeInputsThatExistInNewVersion_mergeInputsThatDeclaredByUserInPrevVersion() throws Exception { + PropertyDataDefinition userDeclaredGetInput = createGetInputPropertyDataDefinition("prop1", "input1"); + PropertyDataDefinition nonUserDeclaredGetInput = createGetInputPropertyDataDefinition("prop2", "input2", "input3"); + + PropertyDataDefinition newProp1 = createPropertyDataDefinition("prop1", ""); + PropertyDataDefinition newProp2 = createPropertyDataDefinition("prop2", null); + + InputDefinition oldDeclaredByUserInput1 = new InputDefinition(); + oldDeclaredByUserInput1.setName("input1"); + oldDeclaredByUserInput1.setInstanceUniqueId("instanceId"); + + InputDefinition oldNotDeclaredByUserInput2 = new InputDefinition(); + oldNotDeclaredByUserInput2.setName("input2"); + + InputDefinition oldNotDeclaredByUserInput3 = new InputDefinition(); + oldNotDeclaredByUserInput3.setName("input3"); + + InputDefinition newInput3 = new InputDefinition(); + newInput3.setName("input3"); + + List<PropertyDataDefinition> oldProps = Arrays.asList(userDeclaredGetInput, nonUserDeclaredGetInput); + List<PropertyDataDefinition> newProps = Arrays.asList(newProp1, newProp2); + + List<InputDefinition> oldInputs = Arrays.asList(oldDeclaredByUserInput1, oldNotDeclaredByUserInput2, oldNotDeclaredByUserInput3); + List<InputDefinition> newInputs = Collections.singletonList(newInput3); + + testInstance.mergeInstanceDataDefinitions(oldProps, oldInputs, newProps, newInputs); + //get input prop was declared by user - ok to merge it although its input not exist (it will be added later) + verify(propertyDataValueMergeBusinessLogicMock).mergePropertyValue(userDeclaredGetInput, newProp1, Collections.singletonList("input1")); + //input 2 not exist in new version - dont merge it, input 3 exist in new version - ok to merge it + verify(propertyDataValueMergeBusinessLogicMock).mergePropertyValue(nonUserDeclaredGetInput, newProp2, Collections.singletonList("input3")); + } + + @Test + public void mergePropDataDefinition_dontMergeOldPropsIfNotExistInNewVersion() throws Exception { + PropertyDataDefinition oldProp = createPropertyDataDefinition("prop1", "oldVal1"); + PropertyDataDefinition newProp = createPropertyDataDefinition("prop2", null); + testInstance.mergeInstanceDataDefinitions(Collections.singletonList(oldProp), Collections.emptyList(), Collections.singletonList(newProp), Collections.emptyList()); + Mockito.verifyZeroInteractions(propertyDataValueMergeBusinessLogicMock); + } + + private PropertyDataDefinition createPropertyDataDefinition(String name, String value) { + return new PropertyDataDefinitionBuilder() + .setName(name) + .setType(DEFAULT_PROP_TYPE) + .setValue(value).build(); + } + + private PropertyDataDefinition createGetInputPropertyDataDefinition(String name, String ... inputsNames) { + PropertyDataDefinitionBuilder propertyBuilder = new PropertyDataDefinitionBuilder() + .setName(name) + .setType(DEFAULT_PROP_TYPE); + for (String inputName : inputsNames) { + propertyBuilder.addGetInputValue(inputName); + } + return propertyBuilder.build(); + } + +}
\ No newline at end of file @@ -0,0 +1,253 @@ +package org.openecomp.sdc.be.components.merge.property; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.when; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import org.junit.Before; +import org.junit.Test; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; +import org.openecomp.sdc.be.components.utils.PropertyDataDefinitionBuilder; +import org.openecomp.sdc.be.datatypes.elements.GetInputValueDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; +import org.openecomp.sdc.be.model.DataTypeDefinition; +import org.openecomp.sdc.be.model.PropertyDefinition; +import org.openecomp.sdc.be.model.cache.ApplicationDataTypeCache; +import org.openecomp.sdc.be.model.tosca.ToscaPropertyType; + +import fj.data.Either; + +public class PropertyDataValueMergeBusinessLogicTest { + + @InjectMocks + private PropertyDataValueMergeBusinessLogic testInstance; + + @Mock + private ApplicationDataTypeCache applicationDataTypeCache; + + @Before + public void setUp() throws Exception { + MockitoAnnotations.initMocks(this); + } + + @Test + public void mergeProperties_emptyOldAndNewValues() throws Exception { + PropertyDataDefinition oldProp = createProp("prop1", ToscaPropertyType.STRING.getType(), null, null); + PropertyDataDefinition newProp = createProp("prop1", ToscaPropertyType.STRING.getType(), null, null); + testMergeProps(oldProp, newProp, null); + } + + @Test + public void mergeProperties_emptyOldValue() throws Exception { + PropertyDataDefinition oldProp = createProp("prop1", ToscaPropertyType.STRING.getType(), null, null); + PropertyDataDefinition newProp = createProp("prop1", ToscaPropertyType.STRING.getType(), null, "newVal"); + testMergeProps(oldProp, newProp, "newVal"); + } + + @Test + public void mergeSimpleStringType_copyOldValueIfNoNewValue() throws Exception { + PropertyDataDefinition oldProp = createProp("prop1", ToscaPropertyType.STRING.getType(), null, "val1"); + PropertyDataDefinition newProp = createProp("prop1", ToscaPropertyType.STRING.getType(), null, null); + testMergeProps(oldProp, newProp, "val1"); + } + + @Test + public void mergeSimpleStringType_dontCopyOldValIfHasNewVal() throws Exception { + PropertyDataDefinition oldProp = createProp("prop1", ToscaPropertyType.STRING.getType(), null, "val1"); + PropertyDataDefinition newProp = createProp("prop1", ToscaPropertyType.STRING.getType(), null, "newVal"); + testMergeProps(oldProp, newProp, "newVal"); + } + + @Test + public void mergeSimpleIntType_copyOldValueIfNoNewValue() throws Exception { + PropertyDataDefinition oldProp = createProp("prop1", ToscaPropertyType.INTEGER.getType(), null, "44"); + PropertyDataDefinition newProp = createProp("prop1", ToscaPropertyType.STRING.getType(), null, null); + testMergeProps(oldProp, newProp, "44"); + } + + @Test + public void mergeSimpleIntType_dontCopyOldValIfHasNewVal() throws Exception { + PropertyDataDefinition oldProp = createProp("prop1", ToscaPropertyType.INTEGER.getType(), null, "44"); + PropertyDataDefinition newProp = createProp("prop1", ToscaPropertyType.STRING.getType(), null, "45"); + testMergeProps(oldProp, newProp, "45"); + } + + @Test + public void mergeSimpleBooleanType_copyOldValueIfNoNewValue() throws Exception { + PropertyDataDefinition oldProp = createProp("prop1", ToscaPropertyType.BOOLEAN.getType(), null, "false"); + PropertyDataDefinition newProp = createProp("prop1", ToscaPropertyType.BOOLEAN.getType(), null, null); + testMergeProps(oldProp, newProp, "false"); + } + + @Test + public void mergeSimpleBooleanType_dontCopyOldValIfHasNewVal() throws Exception { + PropertyDataDefinition oldProp = createProp("prop1", ToscaPropertyType.BOOLEAN.getType(), null, "false"); + PropertyDataDefinition newProp = createProp("prop1", ToscaPropertyType.BOOLEAN.getType(), null, "true"); + testMergeProps(oldProp, newProp, "true"); + } + + @Test + public void mergeSimpleListType_copyOldValuesByIndex() throws Exception { + PropertyDataDefinition oldProp = createProp("prop1", ToscaPropertyType.LIST.getType(), "string", "[\"a\", \"b\", \"c\"]"); + PropertyDataDefinition newProp = createProp("prop1", ToscaPropertyType.LIST.getType(), "string", "[\"x\", \"\"]"); + testMergeProps(oldProp, newProp, "[\"x\",\"b\",\"c\"]"); + } + + @Test + public void mergeSimpleListType_jsonList() throws Exception { + PropertyDataDefinition oldProp = createProp("prop1", ToscaPropertyType.LIST.getType(), "json", "[[\"a\", \"b\"], \"c\"]"); + PropertyDataDefinition newProp = createProp("prop1", ToscaPropertyType.LIST.getType(), "json", "[[\"a\"], \"\"]"); + testMergeProps(oldProp, newProp, "[[\"a\"],\"c\"]"); + } + + @Test + public void mergeComplexType() throws Exception { + PropertyDataDefinition oldProp = createProp("prop1", "myType", null, "{\"mac_range_plan\":\"y\", \"mac_count_required\":{\"is_required\":true,\"count\":44}}"); + PropertyDataDefinition newProp = createProp("prop1", "myType", null, "{\"mac_count_required\":{\"is_required\":false, \"mac_address\":\"myAddress\"}}"); + testMergeProps(oldProp, newProp, "{\"mac_range_plan\":\"y\",\"mac_count_required\":{\"is_required\":false,\"mac_address\":\"myAddress\",\"count\":44}}"); + } + + @Test + public void mergeListOfComplexType() throws Exception { + PropertyDataDefinition oldProp = createProp("prop1", "list", "myType", "[{\"prop1\":\"val1\", \"prop2\":{\"prop3\":true,\"prop4\":44}}, " + + "{\"prop1\":\"val2\", \"prop2\":{\"prop3\":true}}]"); + PropertyDataDefinition newProp = createProp("prop1", "list", "myType", "[{\"prop2\":{\"prop3\":false}}]"); + + Map<String, DataTypeDefinition> dataTypes = buildDataTypes(); + when(applicationDataTypeCache.getAll()).thenReturn(Either.left(dataTypes)); + testInstance.mergePropertyValue(oldProp, newProp, Collections.emptyList()); + String expectedValue = "[{\"prop2\":{\"prop4\":44,\"prop3\":false},\"prop1\":\"\\\"val1\\\"\"}," + + "{\"prop2\":{\"prop3\":true},\"prop1\":\"\\\"val2\\\"\"}]"; + + assertEquals(expectedValue, newProp.getValue()); + } + + @Test + public void mergeMapType() throws Exception { + PropertyDataDefinition oldProp = createProp("prop1", "map", "string", "{\"prop1\":\"val1\", \"prop2\":\"val2\", \"prop3\":\"val3\"}"); + PropertyDataDefinition newProp = createProp("prop1", "map", "string", "{\"prop1\":\"newVal1\", \"prop2\":\"\"}"); + testMergeProps(oldProp, newProp, "{\"prop2\":\"val2\",\"prop1\":\"newVal1\",\"prop3\":\"val3\"}"); + } + + @Test + public void mergeGetInputValue() throws Exception { + PropertyDataDefinition oldProp = createGetInputProp("prop1", "string", null, "input1"); + PropertyDataDefinition newProp = createProp("prop1", "string", null, null); + testMergeProps(oldProp, newProp, oldProp.getValue(), Collections.singletonList("input1")); + assertGetInputValues(newProp, "input1"); + } + + @Test + public void mergeGetInputValue_inputNotForMerging() throws Exception { + PropertyDataDefinition oldProp = createGetInputProp("prop1", "string", null, "input1"); + PropertyDataDefinition newProp = createProp("prop1", "string", null, null); + testMergeProps(oldProp, newProp,null, Collections.singletonList("input2")); + assertTrue(newProp.getGetInputValues().isEmpty()); + } + + @Test + public void mergeComplexGetInputValue_moreThanOneGetInput_copyOnlyInputsForMerging() throws Exception { + PropertyDataDefinition oldProp = new PropertyDataDefinitionBuilder().addGetInputValue("input1").addGetInputValue("input2").setName("prop1").setType("myType").setValue("{\"mac_range_plan\":{\"get_input\": \"input1\"}, \"mac_count_required\":{\"is_required\":true,\"count\":{\"get_input\": \"input2\"}}}").build(); + PropertyDataDefinition newProp = createProp("prop1", "myType", null, "{\"mac_count_required\":{\"is_required\":true}}"); + testMergeProps(oldProp, newProp,"{\"mac_range_plan\":{},\"mac_count_required\":{\"is_required\":true,\"count\":{\"get_input\":\"input2\"}}}", Collections.singletonList("input2")); + assertGetInputValues(newProp, "input2"); + } + + @Test + public void mergeListValueWithMultipleGetInputs() throws Exception { + PropertyDataDefinition oldProp = new PropertyDataDefinitionBuilder() + .addGetInputValue("input1").addGetInputValue("input2").addGetInputValue("input3") + .setName("prop1") + .setType("list").setSchemaType("string") + .setValue("[{\"get_input\": \"input2\"},{\"get_input\": \"input3\"},{\"get_input\": \"input1\"}]") + .build(); + + PropertyDataDefinition newProp = new PropertyDataDefinitionBuilder() + .addGetInputValue("input3") + .setName("prop1") + .setType("list").setSchemaType("string") + .setValue("[\"\", {\"get_input\": \"input3\"}]") + .build(); + + testMergeProps(oldProp, newProp,"[{},{\"get_input\":\"input3\"},{\"get_input\":\"input1\"}]", Arrays.asList("input3", "input1")); + assertGetInputValues(newProp, "input3", "input1"); + } + + private void assertGetInputValues(PropertyDataDefinition newProp, String ... expectedInputNames) { + assertTrue(newProp.isGetInputProperty()); + assertEquals(newProp.getGetInputValues().size(), expectedInputNames.length); + for (int i = 0; i < expectedInputNames.length; i++) { + String expectedInputName = expectedInputNames[i]; + GetInputValueDataDefinition getInputValueDataDefinition = newProp.getGetInputValues().get(i); + assertEquals(getInputValueDataDefinition.getInputName(), expectedInputName); + } + } + + private void testMergeProps(PropertyDataDefinition oldProp, PropertyDataDefinition newProp, String expectedValue) { + testMergeProps(oldProp, newProp, expectedValue, Collections.emptyList()); + } + + private void testMergeProps(PropertyDataDefinition oldProp, PropertyDataDefinition newProp, String expectedValue, List<String> getInputsToMerge) { + when(applicationDataTypeCache.getAll()).thenReturn(Either.left(Collections.emptyMap())); + testInstance.mergePropertyValue(oldProp, newProp, getInputsToMerge); + assertEquals(expectedValue, newProp.getValue()); + } + + private PropertyDataDefinition createProp(String name, String type, String innerType, String val) { + return new PropertyDataDefinitionBuilder() + .setType(type) + .setSchemaType(innerType) + .setValue(val) + .setName(name) + .build(); + } + + private PropertyDataDefinition createGetInputProp(String name, String type, String innerType, String inputName) { + String val = String.format("{\"get_input\":\"%s\"}", inputName); + return new PropertyDataDefinitionBuilder() + .setType(type) + .setSchemaType(innerType) + .setValue(val) + .addGetInputValue(inputName) + .setName(name) + .build(); + + } + + private Map<String, DataTypeDefinition> buildDataTypes() { + DataTypeDefinition myType = new DataTypeDefinition(); + myType.setName("myType"); + DataTypeDefinition myInnerType = new DataTypeDefinition(); + myInnerType.setName("myInnerType"); + + PropertyDefinition prop1 = new PropertyDefinition(); + prop1.setName("prop1"); + + PropertyDefinition prop2 = new PropertyDefinition(); + prop2.setName("prop2"); + prop2.setType("myInnerType"); + + PropertyDefinition prop3 = new PropertyDefinition(); + prop3.setName("prop3"); + + PropertyDefinition prop4 = new PropertyDefinition(); + prop4.setName("prop4"); + + myType.setProperties(Arrays.asList(prop1, prop2)); + myInnerType.setProperties(Arrays.asList(prop3, prop4)); + + return Stream.of(myType, myInnerType).collect(Collectors.toMap(DataTypeDefinition::getName, Function.identity())); + } + + +}
\ No newline at end of file @@ -0,0 +1,82 @@ +package org.openecomp.sdc.be.components.merge.resource; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.when; + +import java.util.Collections; + +import org.junit.Before; +import org.junit.Test; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; +import org.openecomp.sdc.be.components.merge.input.ComponentInputsMergeBL; +import org.openecomp.sdc.be.components.merge.property.ComponentInstanceInputsMergeBL; +import org.openecomp.sdc.be.components.merge.property.ComponentInstancePropertiesMergeBL; +import org.openecomp.sdc.be.components.utils.ObjectGenerator; +import org.openecomp.sdc.be.dao.api.ActionStatus; +import org.openecomp.sdc.be.model.Resource; + +public class ResourceDataMergeBusinessLogicTest { + + @InjectMocks + private ResourceDataMergeBusinessLogic testInstance; + + @Mock + private ComponentInstanceInputsMergeBL instanceInputsValueMergeBLMock; + + @Mock + private ComponentInstancePropertiesMergeBL instancePropertiesValueMergeBLMock; + + @Mock + private ComponentInputsMergeBL inputsValueMergeBLMock; + + @Before + public void setUp() throws Exception { + MockitoAnnotations.initMocks(this); + } + + @Test + public void mergeResourceInputs_allMergeClassesAreCalled() throws Exception { + Resource oldResource = ObjectGenerator.buildBasicResource(); + Resource newResource = ObjectGenerator.buildBasicResource(); + when(instancePropertiesValueMergeBLMock.mergeComponentInstancesProperties(oldResource, newResource)).thenReturn(ActionStatus.OK); + when(instanceInputsValueMergeBLMock.mergeComponentInstancesInputs(oldResource, newResource)).thenReturn(ActionStatus.OK); + when(inputsValueMergeBLMock.mergeAndRedeclareComponentInputs(oldResource, newResource, Collections.emptyList())).thenReturn(ActionStatus.OK); + ActionStatus actionStatus = testInstance.mergeResourceEntities(oldResource, newResource); + assertEquals(ActionStatus.OK, actionStatus); + } + + @Test + public void mergeResourceInputs_failToMergeProperties_dontCallOtherMergeMethods() throws Exception { + Resource oldResource = ObjectGenerator.buildBasicResource(); + Resource newResource = ObjectGenerator.buildBasicResource(); + when(instancePropertiesValueMergeBLMock.mergeComponentInstancesProperties(oldResource, newResource)).thenReturn(ActionStatus.GENERAL_ERROR); + ActionStatus actionStatus = testInstance.mergeResourceEntities(oldResource, newResource); + assertEquals(ActionStatus.GENERAL_ERROR, actionStatus); + verifyZeroInteractions(instanceInputsValueMergeBLMock, inputsValueMergeBLMock); + } + + @Test + public void mergeResourceInputs_failToMergeInstanceInputs_dontCallOtherMergeMethods() throws Exception { + Resource oldResource = ObjectGenerator.buildBasicResource(); + Resource newResource = ObjectGenerator.buildBasicResource(); + when(instancePropertiesValueMergeBLMock.mergeComponentInstancesProperties(oldResource, newResource)).thenReturn(ActionStatus.OK); + when(instanceInputsValueMergeBLMock.mergeComponentInstancesInputs(oldResource, newResource)).thenReturn(ActionStatus.GENERAL_ERROR); + ActionStatus actionStatus = testInstance.mergeResourceEntities(oldResource, newResource); + assertEquals(ActionStatus.GENERAL_ERROR, actionStatus); + verifyZeroInteractions(inputsValueMergeBLMock); + } + + @Test + public void mergeResourceInputs_failedToMergeInputs() throws Exception { + Resource oldResource = ObjectGenerator.buildBasicResource(); + Resource newResource = ObjectGenerator.buildBasicResource(); + when(instancePropertiesValueMergeBLMock.mergeComponentInstancesProperties(oldResource, newResource)).thenReturn(ActionStatus.OK); + when(instanceInputsValueMergeBLMock.mergeComponentInstancesInputs(oldResource, newResource)).thenReturn(ActionStatus.OK); + when(inputsValueMergeBLMock.mergeAndRedeclareComponentInputs(oldResource, newResource, Collections.emptyList())).thenReturn(ActionStatus.GENERAL_ERROR); + ActionStatus actionStatus = testInstance.mergeResourceEntities(oldResource, newResource); + assertEquals(ActionStatus.GENERAL_ERROR, actionStatus); + } +}
\ No newline at end of file @@ -0,0 +1,42 @@ +package org.openecomp.sdc.be.components.utils; + +import java.util.ArrayList; + +import org.openecomp.sdc.be.model.ArtifactDefinition; +import org.openecomp.sdc.be.model.HeatParameterDefinition; + +public class ArtifactBuilder { + + private ArtifactDefinition artifactDefinition; + + public ArtifactBuilder() { + this.artifactDefinition = new ArtifactDefinition(); + } + + public ArtifactBuilder setType(String type) { + this.artifactDefinition.setArtifactType(type); + return this; + } + + public ArtifactBuilder setName(String name) { + this.artifactDefinition.setArtifactName(name); + return this; + } + + public ArtifactBuilder setLabel(String label) { + this.artifactDefinition.setArtifactLabel(label); + return this; + } + + public ArtifactBuilder addHeatParam(HeatParameterDefinition heatParam) { + if (this.artifactDefinition.getHeatParameters() == null) { + this.artifactDefinition.setHeatParameters(new ArrayList<>()); + } + this.artifactDefinition.getHeatParameters().add(heatParam); + return this; + } + + public ArtifactDefinition build() { + return artifactDefinition; + } +} @@ -0,0 +1,49 @@ +package org.openecomp.sdc.be.components.utils; + +import java.util.HashMap; +import java.util.Map; + +import org.openecomp.sdc.be.model.ArtifactDefinition; +import org.openecomp.sdc.be.model.ComponentInstance; + +public class ComponentInstanceBuilder { + + private ComponentInstance componentInstance; + + public ComponentInstanceBuilder() { + componentInstance = new ComponentInstance(); + } + + public ComponentInstanceBuilder setName(String name) { + componentInstance.setName(name); + return this; + } + + public ComponentInstanceBuilder setComponentUid(String componentUid) { + componentInstance.setComponentUid(componentUid); + return this; + } + + public ComponentInstanceBuilder setId(String id) { + componentInstance.setUniqueId(id); + return this; + } + + public ComponentInstanceBuilder setToscaName(String toscaName) { + componentInstance.setToscaComponentName(toscaName); + return this; + } + + public ComponentInstanceBuilder addDeploymentArtifact(ArtifactDefinition artifactDefinition) { + Map<String, ArtifactDefinition> deploymentArtifacts = componentInstance.getDeploymentArtifacts(); + if (deploymentArtifacts == null) { + componentInstance.setDeploymentArtifacts(new HashMap<>()); + } + componentInstance.getDeploymentArtifacts().put(artifactDefinition.getArtifactName(), artifactDefinition); + return this; + } + + public ComponentInstance build() { + return componentInstance; + } +} @@ -0,0 +1,36 @@ +package org.openecomp.sdc.be.components.utils; + +import org.openecomp.sdc.be.model.HeatParameterDefinition; + +public class HeatParameterBuilder { + + private HeatParameterDefinition heatParameterDefinition; + + public HeatParameterBuilder() { + heatParameterDefinition = new HeatParameterDefinition(); + } + + public HeatParameterBuilder setName(String name) { + heatParameterDefinition.setName(name); + return this; + } + + public HeatParameterBuilder setType(String type) { + heatParameterDefinition.setType(type); + return this; + } + + public HeatParameterBuilder setCurrentValue(String value) { + heatParameterDefinition.setCurrentValue(value); + return this; + } + + public HeatParameterBuilder setDefaultValue(String value) { + heatParameterDefinition.setDefaultValue(value); + return this; + } + + public HeatParameterDefinition build() { + return heatParameterDefinition; + } +} @@ -0,0 +1,101 @@ +package org.openecomp.sdc.be.components.utils; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import org.openecomp.sdc.be.model.ComponentInstance; +import org.openecomp.sdc.be.model.ComponentInstanceInput; +import org.openecomp.sdc.be.model.ComponentInstanceProperty; +import org.openecomp.sdc.be.model.HeatParameterDefinition; +import org.openecomp.sdc.be.model.InputDefinition; +import org.openecomp.sdc.be.model.PropertyDefinition; +import org.openecomp.sdc.be.model.RequirementCapabilityRelDef; +import org.openecomp.sdc.be.model.Resource; + +public class ObjectGenerator { + + public static Resource buildResourceWithInputs(String ... inputNames) { + Resource resource = buildBasicResource(); + resource.setInputs(ObjectGenerator.buildInputs(inputNames)); + return resource; + } + + public static Resource buildResourceWithProperties(String ... propertiesNames) { + ResourceBuilder resourceBuilder = new ResourceBuilder(); + resourceBuilder.setUniqueId("id"); + for (String propertyName : propertiesNames) { + PropertyDefinition propertyDefinition = new PropertyDefinition(); + propertyDefinition.setName(propertyName); + resourceBuilder.addProperty(propertyDefinition); + } + return resourceBuilder.build(); + } + + public static List<ComponentInstanceProperty> buildInstanceProperties(String ... propertiesNames) { + return Stream.of(propertiesNames).map(name -> { + ComponentInstanceProperty instProp = new ComponentInstanceProperty(); + instProp.setName(name); + return instProp; + }).collect(Collectors.toList()); + } + + public static List<ComponentInstanceInput> buildInstanceInputs(String ... inputsNames) { + return Stream.of(inputsNames).map(name -> { + ComponentInstanceInput instProp = new ComponentInstanceInput(); + instProp.setName(name); + return instProp; + }).collect(Collectors.toList()); + } + + public static List<InputDefinition> buildInputs(String ... inputNames) { + List<InputDefinition> inputs = new ArrayList<>(); + for (String inputName : inputNames) { + InputDefinition inputDefinition = new InputDefinition(); + inputDefinition.setName(inputName); + inputs.add(inputDefinition); + } + return inputs; + } + + public static Resource buildResourceWithComponentInstance(String ... instanceNames) { + List<ComponentInstance> instances = new ArrayList<>(); + for (String instanceName : instanceNames) { + ComponentInstance componentInstance = new ComponentInstanceBuilder().setName(instanceName).setComponentUid(instanceName).build(); + instances.add(componentInstance); + } + return buildResourceWithComponentInstances(instances); + } + + public static Resource buildResourceWithComponentInstances(List<ComponentInstance> instances) { + Resource resource = buildBasicResource(); + resource.setComponentInstances(instances); + return resource; + } + + public static Resource buildResourceWithComponentInstances(ComponentInstance ... instances) { + return buildResourceWithComponentInstances(Arrays.asList(instances)); + } + + public static Resource buildResourceWithRelationships(RequirementCapabilityRelDef ... relations) { + Resource resource = buildBasicResource(); + ResourceBuilder resourceBuilder = new ResourceBuilder(resource); + for (RequirementCapabilityRelDef relation : relations) { + resourceBuilder.addRelationship(relation); + } + return resourceBuilder.build(); + } + + public static Resource buildBasicResource() { + Resource resource = new Resource(); + resource.setUniqueId("id"); + return resource; + } + + public static HeatParameterDefinition buildHeatParam(String defaultVal, String currValue) { + return new HeatParameterBuilder().setDefaultValue(defaultVal).setCurrentValue(currValue).build(); + } + +} @@ -0,0 +1,68 @@ +package org.openecomp.sdc.be.components.utils; + +import java.util.ArrayList; + +import org.openecomp.sdc.be.datatypes.elements.GetInputValueDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.SchemaDefinition; +import org.openecomp.sdc.be.model.PropertyDefinition; + +public class PropertyDataDefinitionBuilder { + + private PropertyDefinition propertyDefinition; + + public PropertyDataDefinitionBuilder() { + propertyDefinition = new PropertyDefinition(); + } + + public PropertyDataDefinitionBuilder setUniqueId(String id) { + this.propertyDefinition.setUniqueId(id); + return this; + } + + public PropertyDataDefinitionBuilder setName(String name) { + this.propertyDefinition.setName(name); + return this; + } + + public PropertyDataDefinitionBuilder setValue(String value) { + this.propertyDefinition.setValue(value); + return this; + } + + public PropertyDataDefinitionBuilder setDefaultValue(String value) { + this.propertyDefinition.setDefaultValue(value); + return this; + } + + public PropertyDataDefinitionBuilder setType(String type) { + this.propertyDefinition.setType(type); + return this; + } + + public PropertyDataDefinitionBuilder setSchemaType(String type) { + if (propertyDefinition.getSchema() == null) { + propertyDefinition.setSchema(new SchemaDefinition()); + } + if (propertyDefinition.getSchema().getProperty() == null) { + propertyDefinition.getSchema().setProperty(new PropertyDataDefinition()); + } + propertyDefinition.getSchema().getProperty().setType(type); + return this; + } + + public PropertyDataDefinitionBuilder addGetInputValue(String inputName) { + GetInputValueDataDefinition getInputValueDataDefinition = new GetInputValueDataDefinition(); + getInputValueDataDefinition.setInputName(inputName); + getInputValueDataDefinition.setInputId(inputName); + if (propertyDefinition.getGetInputValues() == null) { + propertyDefinition.setGetInputValues(new ArrayList<>()); + } + propertyDefinition.getGetInputValues().add(getInputValueDataDefinition); + return this; + } + + public PropertyDefinition build() { + return propertyDefinition; + } +} @@ -0,0 +1,53 @@ +package org.openecomp.sdc.be.components.utils; + +import java.util.Collections; + +import org.openecomp.sdc.be.model.CapabilityRequirementRelationship; +import org.openecomp.sdc.be.model.RelationshipImpl; +import org.openecomp.sdc.be.model.RelationshipInfo; +import org.openecomp.sdc.be.model.RequirementCapabilityRelDef; + +public class RelationsBuilder { + + private RequirementCapabilityRelDef relation; + + public RelationsBuilder() { + relation = new RequirementCapabilityRelDef(); + RelationshipInfo requirementAndRelationshipPair = new RelationshipInfo(); + RelationshipImpl relationship = new RelationshipImpl(); + requirementAndRelationshipPair.setRelationships(relationship); + CapabilityRequirementRelationship capReqRel = new CapabilityRequirementRelationship(); + capReqRel.setRelation(requirementAndRelationshipPair); + relation.setRelationships(Collections.singletonList(capReqRel)); + } + + public RelationsBuilder setFromNode(String fromNode) { + relation.setFromNode(fromNode); + return this; + } + + public RelationsBuilder setRequirementName(String reqName) { + relation.getSingleRelationship().getRelation().setRequirement(reqName); + return this; + } + + public RelationsBuilder setRelationType(String type) { + relation.getSingleRelationship().getRelation().getRelationship().setType(type); + return this; + } + + public RelationsBuilder setCapabilityUID(String uid) { + relation.getSingleRelationship().getRelation().setCapabilityUid(uid); + return this; + } + + public RelationsBuilder setToNode(String toNode) { + relation.setToNode(toNode); + return this; + } + + public RequirementCapabilityRelDef build() { + return relation; + } + +} @@ -0,0 +1,126 @@ +package org.openecomp.sdc.be.components.utils; + +import java.util.ArrayList; +import java.util.HashMap; + +import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; +import org.openecomp.sdc.be.model.ComponentInstance; +import org.openecomp.sdc.be.model.ComponentInstanceInput; +import org.openecomp.sdc.be.model.ComponentInstanceProperty; +import org.openecomp.sdc.be.model.InputDefinition; +import org.openecomp.sdc.be.model.PropertyDefinition; +import org.openecomp.sdc.be.model.RequirementCapabilityRelDef; +import org.openecomp.sdc.be.model.Resource; + +public class ResourceBuilder { + + private Resource resource; + + public ResourceBuilder() { + this.resource = new Resource(); + } + + public ResourceBuilder(Resource resource) { + this.resource = resource; + } + + public ResourceBuilder setUniqueId(String id) { + resource.setUniqueId(id); + return this; + } + + public ResourceBuilder setInvariantUUid(String invariantUUid) { + resource.setInvariantUUID(invariantUUid); + return this; + } + + public ResourceBuilder setName(String name) { + resource.setName(name); + return this; + } + + public ResourceBuilder setComponentType(ComponentTypeEnum type) { + resource.setComponentType(type); + return this; + } + + public ResourceBuilder setSystemName(String systemName) { + resource.setSystemName(systemName); + return this; + } + + public ResourceBuilder addComponentInstance(ComponentInstance componentInstance) { + if (resource.getComponentInstances() == null) { + resource.setComponentInstances(new ArrayList<>()); + } + resource.getComponentInstances().add(componentInstance); + return this; + } + + public ResourceBuilder addInput(InputDefinition input) { + if (resource.getInputs() == null) { + resource.setInputs(new ArrayList<>()); + } + resource.getInputs().add(input); + return this; + } + + public ResourceBuilder addInput(String inputName) { + InputDefinition inputDefinition = new InputDefinition(); + inputDefinition.setName(inputName); + inputDefinition.setUniqueId(inputName); + this.addInput(inputDefinition); + return this; + } + + public ResourceBuilder addProperty(PropertyDefinition propertyDefinition) { + if (resource.getProperties() == null) { + resource.setProperties(new ArrayList<>()); + } + resource.getProperties().add(propertyDefinition); + return this; + } + + public ResourceBuilder addInstanceProperty(String instanceId, ComponentInstanceProperty prop) { + if (resource.getComponentInstancesProperties() == null) { + resource.setComponentInstancesProperties(new HashMap<>()); + } + resource.getComponentInstancesProperties().computeIfAbsent(instanceId, key -> new ArrayList<>()).add(prop); + return this; + } + + public ResourceBuilder addInstanceProperty(String instanceId, String propName) { + ComponentInstanceProperty componentInstanceProperty = new ComponentInstanceProperty(); + componentInstanceProperty.setName(propName); + this.addInstanceProperty(instanceId, componentInstanceProperty); + return this; + } + + public ResourceBuilder addInstanceInput(String instanceId, ComponentInstanceInput prop) { + if (resource.getComponentInstancesInputs() == null) { + resource.setComponentInstancesInputs(new HashMap<>()); + } + resource.getComponentInstancesInputs().computeIfAbsent(instanceId, key -> new ArrayList<>()).add(prop); + return this; + } + + public ResourceBuilder addInstanceInput(String instanceId, String propName) { + ComponentInstanceInput componentInstanceInput = new ComponentInstanceInput(); + componentInstanceInput.setName(propName); + this.addInstanceInput(instanceId, componentInstanceInput); + return this; + } + + public ResourceBuilder addRelationship(RequirementCapabilityRelDef requirementCapabilityRelDef) { + if (resource.getComponentInstancesRelations() == null) { + resource.setComponentInstancesRelations(new ArrayList<>()); + } + resource.getComponentInstancesRelations().add(requirementCapabilityRelDef); + return this; + } + + + public Resource build() { + return resource; + } +} @@ -37,8 +37,6 @@ import org.openecomp.sdc.be.components.distribution.engine.CambriaHandler; import org.openecomp.sdc.be.components.distribution.engine.DistributionEngineInitTask; import org.openecomp.sdc.be.components.distribution.engine.SubscriberTypeEnum; import org.openecomp.sdc.be.config.DistributionEngineConfiguration; -import org.openecomp.sdc.be.distribution.AuditHandler; -import org.openecomp.sdc.be.distribution.DistributionBusinessLogic; import org.openecomp.sdc.be.distribution.api.client.CambriaOperationStatus; import org.openecomp.sdc.be.distribution.api.client.RegistrationRequest; import org.openecomp.sdc.be.distribution.api.client.TopicRegistrationResponse; @@ -26,6 +26,8 @@ import java.lang.reflect.Method; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; + import org.junit.Test; import org.mockito.InjectMocks; import org.openecomp.sdc.be.components.BaseConfDependentTest; @@ -33,6 +35,7 @@ import org.openecomp.sdc.be.components.distribution.engine.ArtifactInfoImpl; import org.openecomp.sdc.be.components.distribution.engine.ServiceDistributionArtifactsBuilder; import org.openecomp.sdc.be.model.ArtifactDefinition; import org.openecomp.sdc.be.model.Service; +import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum; import org.openecomp.sdc.common.api.ArtifactTypeEnum; public class ServiceDistributionArtifactsBuilderTest extends BaseConfDependentTest { @@ -63,12 +66,25 @@ public class ServiceDistributionArtifactsBuilderTest extends BaseConfDependentTe toscaTemplateArtifact.setArtifactType(ArtifactTypeEnum.TOSCA_TEMPLATE.getType()); toscaTemplateArtifact.setArtifactLabel(artifactLabel); toscaTemplateArtifact.setEsId(esArtifactId); + toscaTemplateArtifact.setUniqueId(esArtifactId); toscaTemplateArtifact.setPayload(payload); Map<String, ArtifactDefinition> toscaArtifacts = new HashMap<>(); toscaArtifacts.put(artifactLabel, toscaTemplateArtifact); service.setToscaArtifacts(toscaArtifacts); + ArtifactDefinition deploymentArtifact = new ArtifactDefinition(); + deploymentArtifact.setArtifactName("deployment.yaml"); + deploymentArtifact.setArtifactGroupType(ArtifactGroupTypeEnum.DEPLOYMENT); + deploymentArtifact.setArtifactType(ArtifactTypeEnum.OTHER.getType()); + deploymentArtifact.setArtifactLabel("deployment"); + deploymentArtifact.setEsId("deployment007"); + deploymentArtifact.setUniqueId("deployment007"); + deploymentArtifact.setPayload(payload); + Map<String, ArtifactDefinition> deploymentArtifacts = new HashMap<>(); + deploymentArtifacts.put("deployment", deploymentArtifact); + service.setDeploymentArtifacts(deploymentArtifacts); + Class<ServiceDistributionArtifactsBuilder> targetClass = ServiceDistributionArtifactsBuilder.class; String methodName = "convertServiceArtifactsToArtifactInfo"; Object[] argObjects = {service}; @@ -79,8 +95,9 @@ public class ServiceDistributionArtifactsBuilderTest extends BaseConfDependentTe List<ArtifactInfoImpl> convertServiceArtifactsToArtifactInfoRes = (List<ArtifactInfoImpl>) method.invoke(serviceDistributionArtifactsBuilder, argObjects); assertTrue(convertServiceArtifactsToArtifactInfoRes != null); - assertTrue(convertServiceArtifactsToArtifactInfoRes.size() == 1); - assertTrue(convertServiceArtifactsToArtifactInfoRes.get(0).getArtifactName().equals(artifactName)); + assertTrue(convertServiceArtifactsToArtifactInfoRes.size() == 2); + List<String> artifactsNames = convertServiceArtifactsToArtifactInfoRes.stream().map(a->a.getArtifactName()).collect(Collectors.toList()); + assertTrue(artifactsNames.contains(artifactName) && artifactsNames.contains("deployment.yaml")); } catch (Exception e) { e.printStackTrace(); @@ -0,0 +1,188 @@ +/*- + * ============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.be.distribution; + +import java.util.ArrayList; +import java.util.List; +import java.util.Timer; +import java.util.TimerTask; +import java.util.concurrent.ArrayBlockingQueue; +import java.util.concurrent.BlockingQueue; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.RejectedExecutionException; +import java.util.concurrent.SynchronousQueue; +import java.util.concurrent.ThreadFactory; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicBoolean; + +import org.openecomp.sdc.be.components.distribution.engine.CambriaHandler; +import org.openecomp.sdc.be.components.distribution.engine.INotificationData; +import org.openecomp.sdc.be.components.distribution.engine.NotificationDataImpl; + +import com.google.common.util.concurrent.ThreadFactoryBuilder; + +public class TestQueue { + + public static void main(String[] args) { + ThreadFactoryBuilder threadFactoryBuilder = new ThreadFactoryBuilder(); + threadFactoryBuilder.setNameFormat("distribution-notification-thread"); + ThreadFactory threadFactory = threadFactoryBuilder.build(); + // TODO: add the package of google to the pom + + ExecutorService executorService = new ThreadPoolExecutor(0, 10, 60L, TimeUnit.SECONDS, new SynchronousQueue<Runnable>(), threadFactory); + // ExecutorService executorService = new ThreadPoolExecutor(0, 2, 60L, + // TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(20)); + + // 2 threads are always up and they handle the tasks. in case core size + // is 0, only one is handles the tasks. + // ExecutorService executorService = new ThreadPoolExecutor(0, 2, 60L, + // TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(20)); + + // TODO : check what happen when the number of threads are full. Throw + // RejectedExecutionException + // TODO : check what happen whether the pool is full and the size of + // pool + + ExecutorService newCachedThreadPool = Executors.newCachedThreadPool(threadFactory); + Runnable task = new Runnable() { + + @Override + public void run() { + try { + System.out.println("iN SLEEP" + Thread.currentThread()); + Thread.sleep(10 * 1000); + System.out.println("OUT SLEEP"); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + }; + + for (int i = 0; i < 4; i++) { + try { + executorService.submit(task); + } catch (RejectedExecutionException e) { + e.printStackTrace(); + } + } + + newCachedThreadPool.submit(task); + System.out.println("After submitting the task"); + + MyWorker[] watchThreads = new MyWorker[1]; + BlockingQueue<String> queue = new ArrayBlockingQueue<>(5); + for (int i = 0; i < watchThreads.length; i++) { + MyWorker myWorker = new MyWorker(queue); + myWorker.start(); + } + + for (int i = 0; i < 1; i++) { + try { + queue.put("message " + i); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + } + + public static class MyTimerTask extends TimerTask { + + AtomicBoolean state; + Thread thread; + + public MyTimerTask(AtomicBoolean state, Thread thread) { + super(); + this.state = state; + this.thread = thread; + + System.out.println("After create timer"); + } + + @Override + public void run() { + System.out.println("In running of Timer task"); + if (state.get() == false) { + System.out.println("In running of Timer task. Going to interrupt thread"); + // thread.interrupt(); + } else { + System.out.println("In running of Timer task. Finished."); + } + } + + } + + public static class MyWorker extends Thread { + + boolean active = true; + private final BlockingQueue<String> queue; + + public MyWorker(BlockingQueue<String> queue) { + this.queue = queue; + } + + Timer timer = new Timer(); + + public void run() { + try { + while (active) { + String s = queue.take(); + System.out.println("Thread " + Thread.currentThread() + " fecthed a message " + s); + + AtomicBoolean atomicBoolean = new AtomicBoolean(false); + MyTimerTask myTimerTask = new MyTimerTask(atomicBoolean, this); + timer.schedule(myTimerTask, 10 * 1000); + doWork(s); + atomicBoolean.set(true); + + } + } catch (InterruptedException ie) { + + System.out.println("Interrupted our thread"); + ie.printStackTrace(); + } + } + + private void doWork(String s) { + // TODO Auto-generated method stub + + CambriaHandler cambriaHandler = new CambriaHandler(); + INotificationData data = new NotificationDataImpl(); + List<String> servers = new ArrayList<>(); + servers.add("aaaaaaa"); + cambriaHandler.sendNotification("topicName", "uebPublicKey", "uebSecretKey", servers, data); + + System.out.println("IN WORK " + s); + try { + Thread.sleep(1 * 1000); + } catch (InterruptedException e) { + + for (int i = 0; i < 10; i++) { + System.out.println("*************************************************"); + } + e.printStackTrace(); + } + } + } + +} @@ -46,7 +46,6 @@ import org.openecomp.sdc.be.distribution.AuditHandler; import org.openecomp.sdc.be.distribution.DistributionBusinessLogic; import org.openecomp.sdc.be.distribution.api.client.RegistrationRequest; import org.openecomp.sdc.be.distribution.api.client.TopicRegistrationResponse; -import org.openecomp.sdc.be.distribution.servlet.DistributionServlet; import org.openecomp.sdc.be.impl.WebAppContextWrapper; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.common.api.Constants; @@ -20,21 +20,19 @@ package org.openecomp.sdc.be.ecomp; -import java.io.File; +import static org.junit.Assert.assertTrue; + import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import org.junit.Test; -import org.openecomp.sdc.be.config.BeEcompErrorManager.ErrorSeverity; import org.openecomp.sdc.common.config.EcompClassification; import org.openecomp.sdc.common.config.EcompErrorCode; import org.openecomp.sdc.common.config.EcompErrorEnum; import org.openecomp.sdc.common.config.generation.GenerateEcompErrorsCsv; -import static org.junit.Assert.assertTrue; - public class GenerateEcompErrorFileTest { @Test @@ -43,9 +43,7 @@ import org.json.simple.JSONObject; import org.json.simple.parser.JSONParser; import org.junit.BeforeClass; import org.junit.Test; -import org.mockito.Matchers; import org.mockito.Mockito; -import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; import org.openecomp.sdc.be.components.impl.ElementBusinessLogic; import org.openecomp.sdc.be.components.impl.ResourceBusinessLogic; @@ -58,10 +56,8 @@ import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.impl.ServletUtils; import org.openecomp.sdc.be.impl.WebAppContextWrapper; import org.openecomp.sdc.be.model.Resource; -import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.model.category.CategoryDefinition; import org.openecomp.sdc.be.model.category.SubCategoryDefinition; -import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; import org.openecomp.sdc.common.api.Constants; import org.openecomp.sdc.common.datastructure.FunctionalInterfaces; import org.openecomp.sdc.common.impl.ExternalConfiguration; @@ -115,7 +111,7 @@ public class AssetsDataServletTest extends JerseyTest { when(resource.getName()).thenReturn("MockVFCMT"); when(resource.getSystemName()).thenReturn("mockvfcmt"); Either<Resource, ResponseFormat> eitherRet = Either.left(resource); - when(componentsUtils.convertJsonToObjectUsingObjectMapper(Mockito.anyString(), Mockito.any(User.class), Mockito.eq(Resource.class), Mockito.any(AuditingActionEnum.class), Mockito.eq(ComponentTypeEnum.RESOURCE))).thenReturn(eitherRet); + when(componentsUtils.convertJsonToObjectUsingObjectMapper(Mockito.any(), Mockito.any(), Mockito.eq(Resource.class), Mockito.any(), Mockito.eq(ComponentTypeEnum.RESOURCE))).thenReturn(eitherRet); when(webApplicationContext.getBean(ResourceImportManager.class)).thenReturn(resourceImportManager); when(webApplicationContext.getBean(ElementBusinessLogic.class)).thenReturn(elementBusinessLogic); @@ -123,7 +119,7 @@ public class AssetsDataServletTest extends JerseyTest { when(subCategoryDefinition.getName()).thenReturn("Monitoring Template"); when(categoryDefinition.getSubcategories()).thenReturn(Arrays.asList(subCategoryDefinition)); when(elementBusinessLogic.getAllResourceCategories()).thenReturn(Either.left(Arrays.asList(categoryDefinition))); - when(resourceBusinessLogic.createResource(Mockito.eq(resource), Mockito.any(AuditingActionEnum.class), Mockito.any(User.class), Mockito.anyMap(), Mockito.anyString())).thenReturn(Either.left(resource)); + when(resourceBusinessLogic.createResource(Mockito.eq(resource), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any())).thenReturn(Either.left(resource)); when(webApplicationContext.getBean(AssetMetadataConverter.class)).thenReturn(assetMetadataConverter); Mockito.doReturn(Either.left(resourceAssetMetadata)).when(assetMetadataConverter).convertToSingleAssetMetadata(Mockito.eq(resource), Mockito.anyString(), @@ -136,22 +132,21 @@ public class AssetsDataServletTest extends JerseyTest { private static void mockResponseFormat() { - when(componentsUtils.getResponseFormat(Mockito.any(ActionStatus.class), Matchers.<String>anyVararg())).thenAnswer(new Answer<ResponseFormat>(){ - public ResponseFormat answer(InvocationOnMock invocation) throws Throwable { - ResponseFormat ret; - final ActionStatus actionStatus = invocation.getArgumentAt(0, ActionStatus.class); - switch( actionStatus ){ - case CREATED :{ - ret = new ResponseFormat(HttpStatus.SC_CREATED); - break; - } - default :{ - ret = new ResponseFormat(HttpStatus.SC_INTERNAL_SERVER_ERROR); - break; - } - } - return ret; - }}); + when(componentsUtils.getResponseFormat(Mockito.any(ActionStatus.class), Mockito.any(String[].class))).thenAnswer((Answer<ResponseFormat>) invocation -> { + ResponseFormat ret; + final ActionStatus actionStatus = invocation.getArgument(0); + switch( actionStatus ){ + case CREATED :{ + ret = new ResponseFormat(HttpStatus.SC_CREATED); + break; + } + default :{ + ret = new ResponseFormat(HttpStatus.SC_INTERNAL_SERVER_ERROR); + break; + } + } + return ret; + }); } @@ -1,7 +1,5 @@ package org.openecomp.sdc.be.externalapi.servlet.representation; -import javax.annotation.Generated; - import org.junit.Test; @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.externalapi.servlet.representation; import java.util.List; -import javax.annotation.Generated; - import org.junit.Test; @@ -1,7 +1,5 @@ package org.openecomp.sdc.be.externalapi.servlet.representation; -import javax.annotation.Generated; - import org.junit.Test; @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.externalapi.servlet.representation; import java.util.List; -import javax.annotation.Generated; - import org.junit.Test; public class ResourceAssetDetailedMetadataTest { @@ -1,7 +1,5 @@ package org.openecomp.sdc.be.externalapi.servlet.representation; -import javax.annotation.Generated; - import org.junit.Test; @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.externalapi.servlet.representation; import java.util.List; -import javax.annotation.Generated; - import org.junit.Test; @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.externalapi.servlet.representation; import java.util.List; -import javax.annotation.Generated; - import org.junit.Test; @@ -1,7 +1,5 @@ package org.openecomp.sdc.be.externalapi.servlet.representation; -import javax.annotation.Generated; - import org.junit.Test; @@ -1,31 +1,15 @@ package org.openecomp.sdc.be.impl; import java.util.EnumMap; -import java.util.List; -import java.util.Map; -import java.util.regex.Pattern; -import javax.servlet.http.HttpServletRequest; - -import org.apache.tinkerpop.gremlin.structure.T; -import org.codehaus.jackson.map.module.SimpleModule; import org.junit.Assert; import org.junit.Test; import org.openecomp.sdc.be.auditing.api.IAuditingManager; import org.openecomp.sdc.be.components.impl.ImportUtils.ResultStatusEnum; import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.dao.graph.datatype.AdditionalInformationEnum; -import org.openecomp.sdc.be.datatypes.elements.AdditionalInfoParameterInfo; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; -import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; -import org.openecomp.sdc.be.model.ArtifactDefinition; -import org.openecomp.sdc.be.model.CapabilityTypeDefinition; import org.openecomp.sdc.be.model.Component; -import org.openecomp.sdc.be.model.ConsumerDefinition; -import org.openecomp.sdc.be.model.DataTypeDefinition; -import org.openecomp.sdc.be.model.GroupTypeDefinition; -import org.openecomp.sdc.be.model.PolicyTypeDefinition; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; @@ -34,10 +18,6 @@ import org.openecomp.sdc.be.tosca.ToscaError; import org.openecomp.sdc.common.datastructure.AuditingFieldsKeysEnum; import org.openecomp.sdc.exception.ResponseFormat; -import com.fasterxml.jackson.databind.JsonDeserializer; - -import fj.data.Either; - public class ComponentsUtilsTest { private ComponentsUtils createTestSubject() { @@ -1,7 +1,5 @@ package org.openecomp.sdc.be.info; -import javax.annotation.Generated; - import org.junit.Test; @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.info; import java.util.List; -import javax.annotation.Generated; - import org.junit.Test; @@ -1,7 +1,5 @@ package org.openecomp.sdc.be.info; -import javax.annotation.Generated; - import org.junit.Test; import org.openecomp.sdc.be.model.ArtifactDefinition; @@ -1,8 +1,7 @@ package org.openecomp.sdc.be.info; -import static org.junit.Assert.*; -import java.util.*; -import org.junit.Assert; +import java.util.List; + import org.junit.Test; @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.info; import java.util.List; -import javax.annotation.Generated; - import org.junit.Test; import org.openecomp.sdc.be.model.ArtifactType; @@ -1,7 +1,5 @@ package org.openecomp.sdc.be.info; -import javax.annotation.Generated; - import org.junit.Test; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.RequirementCapabilityRelDef; @@ -1,7 +1,5 @@ package org.openecomp.sdc.be.info; -import javax.annotation.Generated; - import org.junit.Test; import org.openecomp.sdc.common.datastructure.ESTimeBasedEvent; @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.info; import java.util.List; -import javax.annotation.Generated; - import org.junit.Test; public class DistributionStatusListResponseTest { @@ -1,7 +1,5 @@ package org.openecomp.sdc.be.info; -import javax.annotation.Generated; - import org.junit.Test; @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.info; import java.util.List; -import javax.annotation.Generated; - import org.junit.Test; @@ -2,12 +2,8 @@ package org.openecomp.sdc.be.info; import java.util.List; -import javax.annotation.Generated; - import org.junit.Test; import org.openecomp.sdc.be.model.GroupProperty; -import java.util.*; -import org.junit.Assert; public class GroupDefinitionInfoTest { @@ -1,7 +1,5 @@ package org.openecomp.sdc.be.info; -import javax.annotation.Generated; - import org.junit.Test; @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.info; import java.util.List; -import javax.annotation.Generated; - import org.junit.Test; @@ -1,7 +1,5 @@ package org.openecomp.sdc.be.info; -import javax.annotation.Generated; - import org.junit.Test; public class ServiceVersionInfoTest { @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.info; import java.util.List; -import javax.annotation.Generated; - import org.junit.Test; @@ -1,7 +1,5 @@ package org.openecomp.sdc.be.info; -import javax.annotation.Generated; - import org.junit.Test; @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.info; import java.util.List; -import javax.annotation.Generated; - import org.junit.Test; @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.info; import java.util.List; -import javax.annotation.Generated; - import org.junit.Test; @@ -23,43 +23,26 @@ package org.openecomp.sdc.be.servlets; import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.mock; -import java.io.File; import java.io.IOException; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; -import java.util.List; import java.util.Map; import java.util.stream.Stream; -import javax.servlet.http.HttpServletRequest; import javax.ws.rs.core.Response; import org.apache.commons.codec.binary.Base64; -import org.apache.commons.lang3.tuple.ImmutablePair; -import org.apache.tinkerpop.gremlin.structure.T; -import org.glassfish.grizzly.servlet.ServletUtils; -import org.junit.Assert; import org.junit.Before; import org.junit.Test; -import org.openecomp.sdc.be.components.impl.ComponentInstanceBusinessLogic; -import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; -import org.openecomp.sdc.be.impl.ComponentsUtils; -import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.UploadResourceInfo; import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.be.servlets.ResourceUploadServlet.ResourceAuthorityTypeEnum; import org.openecomp.sdc.common.datastructure.Wrapper; import org.openecomp.sdc.exception.ResponseFormat; import org.slf4j.Logger; -import com.google.common.base.Supplier; -import com.google.gson.Gson; - -import aj.org.objectweb.asm.Type; import fj.data.Either; public class AbstractValidationsServletTest { @@ -1,13 +1,9 @@ package org.openecomp.sdc.be.servlets; -import javax.annotation.Generated; -import javax.servlet.ServletContext; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.core.Response; import org.junit.Test; -import org.openecomp.sdc.be.components.impl.AdditionalInformationBusinessLogic; -import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; public class AdditionalInformationServletTest { @@ -31,7 +31,6 @@ import org.glassfish.jersey.media.multipart.FormDataContentDisposition; import org.glassfish.jersey.media.multipart.MultiPart; import org.glassfish.jersey.server.ResourceConfig; import org.mockito.Mockito; -import org.openecomp.sdc.be.servlets.ResourceUploadServlet; public class ApplicationConfig extends Application { @@ -1,12 +1,9 @@ package org.openecomp.sdc.be.servlets; -import javax.annotation.Generated; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.core.Response; import org.junit.Test; -import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic.ArtifactOperationEnum; -import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; public class ArtifactServletTest { @@ -1,6 +1,5 @@ package org.openecomp.sdc.be.servlets; -import javax.annotation.Generated; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.core.Response; @@ -1,309 +1,136 @@ package org.openecomp.sdc.be.servlets; -import java.util.List; +import static org.junit.Assert.assertTrue; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.when; -import javax.annotation.Generated; +import javax.servlet.ServletContext; import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpSession; +import javax.ws.rs.core.Application; +import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; -import org.apache.tinkerpop.gremlin.structure.T; +import org.glassfish.grizzly.http.util.HttpStatus; +import org.glassfish.hk2.utilities.binding.AbstractBinder; +import org.glassfish.jersey.server.ResourceConfig; +import org.glassfish.jersey.test.JerseyTest; +import org.glassfish.jersey.test.TestProperties; +import org.junit.BeforeClass; import org.junit.Test; +import org.mockito.Mockito; +import org.openecomp.sdc.be.components.impl.ServiceComponentInstanceBusinessLogic; +import org.openecomp.sdc.be.components.impl.VFComponentInstanceBusinessLogic; import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.model.ComponentInstance; +import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; +import org.openecomp.sdc.be.impl.ComponentsUtils; +import org.openecomp.sdc.be.impl.ServletUtils; +import org.openecomp.sdc.be.impl.WebAppContextWrapper; import org.openecomp.sdc.be.model.RequirementCapabilityRelDef; +import org.openecomp.sdc.common.api.Constants; import org.openecomp.sdc.exception.ResponseFormat; +import org.springframework.web.context.WebApplicationContext; import fj.data.Either; -public class ComponentInstanceServletTest { - - private ComponentInstanceServlet createTestSubject() { - return new ComponentInstanceServlet(); - } - - - @Test - public void testCreateComponentInstance() throws Exception { - ComponentInstanceServlet testSubject; - String data = ""; - String containerComponentId = ""; - String containerComponentType = ""; - String userId = ""; - HttpServletRequest request = null; - Response result; - - // default test - testSubject = createTestSubject(); - - } - - - @Test - public void testUpdateComponentInstanceMetadata() throws Exception { - ComponentInstanceServlet testSubject; - String componentId = ""; - String componentInstanceId = ""; - String containerComponentType = ""; - HttpServletRequest request = null; - Response result; - - // default test - testSubject = createTestSubject(); - - } - - - @Test - public void testUpdateMultipleComponentInstance() throws Exception { - ComponentInstanceServlet testSubject; - String componentId = ""; - String containerComponentType = ""; - HttpServletRequest request = null; - String componentInstanceJsonArray = ""; - Response result; - - // default test - testSubject = createTestSubject(); - - } - - - @Test - public void testDeleteResourceInstance() throws Exception { - ComponentInstanceServlet testSubject; - String componentId = ""; - String resourceInstanceId = ""; - String containerComponentType = ""; - HttpServletRequest request = null; - Response result; - - // default test - testSubject = createTestSubject(); - - } - - - @Test - public void testAssociateRIToRI() throws Exception { - ComponentInstanceServlet testSubject; - String componentId = ""; - String containerComponentType = ""; - String userId = ""; - String data = ""; - HttpServletRequest request = null; - Response result; - - // default test - testSubject = createTestSubject(); - - } - - - @Test - public void testDissociateRIFromRI() throws Exception { - ComponentInstanceServlet testSubject; - String containerComponentType = ""; - String componentId = ""; - String userId = ""; - String data = ""; - HttpServletRequest request = null; - Response result; - - // default test - testSubject = createTestSubject(); - - } - - - @Test - public void testCreateAndAssociateRIToRI() throws Exception { - ComponentInstanceServlet testSubject; - String componentId = ""; - String containerComponentType = ""; - HttpServletRequest request = null; - Response result; - - // default test - testSubject = createTestSubject(); - - } - - - @Test - public void testUpdateResourceInstanceProperty() throws Exception { - ComponentInstanceServlet testSubject; - String componentId = ""; - String containerComponentType = ""; - String componentInstanceId = ""; - String userId = ""; - HttpServletRequest request = null; - Response result; - - // default test - testSubject = createTestSubject(); - - } - - - @Test - public void testUpdateResourceInstanceInput() throws Exception { - ComponentInstanceServlet testSubject; - String componentId = ""; - String containerComponentType = ""; - String componentInstanceId = ""; - String userId = ""; - HttpServletRequest request = null; - Response result; - - // default test - testSubject = createTestSubject(); - - } - - - @Test - public void testUpdateResourceInstanceAttribute() throws Exception { - ComponentInstanceServlet testSubject; - String componentId = ""; - String containerComponentType = ""; - String componentInstanceId = ""; - String userId = ""; - HttpServletRequest request = null; - Response result; - - // default test - testSubject = createTestSubject(); - - } - - - @Test - public void testDeleteResourceInstanceProperty() throws Exception { - ComponentInstanceServlet testSubject; - String componentId = ""; - String containerComponentType = ""; - String componentInstanceId = ""; - String propertyId = ""; - String userId = ""; - HttpServletRequest request = null; - Response result; - - // default test - testSubject = createTestSubject(); - - } - - - @Test - public void testChangeResourceInstanceVersion() throws Exception { - ComponentInstanceServlet testSubject; - String componentId = ""; - String componentInstanceId = ""; - String containerComponentType = ""; - HttpServletRequest request = null; - Response result; - - // default test - testSubject = createTestSubject(); - - } - - - @Test - public void testUpdateGroupInstanceProperty() throws Exception { - ComponentInstanceServlet testSubject; - String componentId = ""; - String containerComponentType = ""; - String componentInstanceId = ""; - String groupInstanceId = ""; - String userId = ""; - HttpServletRequest request = null; - Response result; - - // default test - testSubject = createTestSubject(); - - } - - - @Test - public void testGetGroupArtifactById() throws Exception { - ComponentInstanceServlet testSubject; - String containerComponentType = ""; - String componentId = ""; - String componentInstanceId = ""; - String groupInstId = ""; - HttpServletRequest request = null; - String userId = ""; - Response result; - - // default test - testSubject = createTestSubject(); - - } - - - @Test - public void testGetInstancePropertiesById() throws Exception { - ComponentInstanceServlet testSubject; - String containerComponentType = ""; - String containerComponentId = ""; - String componentInstanceUniqueId = ""; - HttpServletRequest request = null; - String userId = ""; - Response result; - - // default test - testSubject = createTestSubject(); - - } - - - @Test - public void testCreateServiceProxy() throws Exception { - ComponentInstanceServlet testSubject; - String data = ""; - String containerComponentId = ""; - String containerComponentType = ""; - String userId = ""; - HttpServletRequest request = null; - Response result; - - // default test - testSubject = createTestSubject(); - - } - - - @Test - public void testDeleteServiceProxy() throws Exception { - ComponentInstanceServlet testSubject; - String containerComponentId = ""; - String serviceProxyId = ""; - String containerComponentType = ""; - HttpServletRequest request = null; - Response result; - - // default test - testSubject = createTestSubject(); - - } - - - @Test - public void testChangeServiceProxyVersion() throws Exception { - ComponentInstanceServlet testSubject; - String containerComponentId = ""; - String serviceProxyId = ""; - String containerComponentType = ""; - HttpServletRequest request = null; - Response result; - - // default test - testSubject = createTestSubject(); - - } - - - -}
\ No newline at end of file +/** + * The test suite designed for test functionality of ComponentInstanceServlet class + */ +public class ComponentInstanceServletTest extends JerseyTest { + + private final static String USER_ID = "jh0003"; + private static HttpServletRequest request; + private static HttpSession session; + private static ServletContext servletContext; + private static WebAppContextWrapper webAppContextWrapper; + private static WebApplicationContext webApplicationContext; + private static VFComponentInstanceBusinessLogic vfBusinessLogic; + private static ServiceComponentInstanceBusinessLogic serviceBusinessLogic; + private static ComponentsUtils componentsUtils; + private static ServletUtils servletUtils; + private static ResponseFormat responseFormat; + + @BeforeClass + public static void setup() { + createMocks(); + stubMethods(); + } + + @Test + public void testGetRelationByIdSuccess(){ + + String containerComponentType = "resources"; + String componentId = "componentId"; + String relationId = "relationId"; + String path = "/v1/catalog/" + containerComponentType + "/" + componentId + "/" + relationId + "/relationId"; + Either<RequirementCapabilityRelDef, ResponseFormat> successResponse = Either.left(new RequirementCapabilityRelDef()); + when(vfBusinessLogic.getRelationById(eq(componentId), eq(relationId), eq(USER_ID), eq(ComponentTypeEnum.RESOURCE))).thenReturn(successResponse); + when(responseFormat.getStatus()).thenReturn(HttpStatus.OK_200.getStatusCode()); + when(componentsUtils.getResponseFormat(ActionStatus.OK)).thenReturn(responseFormat); + Response response = target() + .path(path) + .request(MediaType.APPLICATION_JSON) + .header("USER_ID", USER_ID) + .get( Response.class); + + assertTrue(response.getStatus() == HttpStatus.OK_200.getStatusCode()); + } + + @Test + public void testGetRelationByIdFailure(){ + + String containerComponentType = "unknown_type"; + String componentId = "componentId"; + String relationId = "relationId"; + String path = "/v1/catalog/" + containerComponentType + "/" + componentId + "/" + relationId + "/relationId"; + when(responseFormat.getStatus()).thenReturn(HttpStatus.BAD_REQUEST_400.getStatusCode()); + when(componentsUtils.getResponseFormat(eq(ActionStatus.UNSUPPORTED_ERROR), eq(containerComponentType))).thenReturn(responseFormat); + Response response = target() + .path(path) + .request(MediaType.APPLICATION_JSON) + .header("USER_ID", USER_ID) + .get( Response.class); + + assertTrue(response.getStatus() == HttpStatus.BAD_REQUEST_400.getStatusCode()); + } + + @Override + protected Application configure() { + + ResourceConfig resourceConfig = new ResourceConfig(ComponentInstanceServlet.class); + forceSet(TestProperties.CONTAINER_PORT, "0"); + + resourceConfig.register(new AbstractBinder() { + @Override + protected void configure() { + bind(request).to(HttpServletRequest.class); + } + }); + return resourceConfig; + } + + private static void createMocks() { + request = Mockito.mock(HttpServletRequest.class); + session = Mockito.mock(HttpSession.class); + servletContext = Mockito.mock(ServletContext.class); + webAppContextWrapper = Mockito.mock(WebAppContextWrapper.class); + webApplicationContext = Mockito.mock(WebApplicationContext.class); + vfBusinessLogic = Mockito.mock(VFComponentInstanceBusinessLogic.class); + serviceBusinessLogic = Mockito.mock(ServiceComponentInstanceBusinessLogic.class); + componentsUtils = Mockito.mock(ComponentsUtils.class); + servletUtils = Mockito.mock(ServletUtils.class); + responseFormat = Mockito.mock(ResponseFormat.class); + } + + private static void stubMethods() { + when(request.getSession()).thenReturn(session); + when(session.getServletContext()).thenReturn(servletContext); + when(servletContext.getAttribute(Constants.WEB_APPLICATION_CONTEXT_WRAPPER_ATTR)).thenReturn(webAppContextWrapper); + when(webAppContextWrapper.getWebAppContext(servletContext)).thenReturn(webApplicationContext); + when(webApplicationContext.getBean(VFComponentInstanceBusinessLogic.class)).thenReturn(vfBusinessLogic); + when(webApplicationContext.getBean(ServiceComponentInstanceBusinessLogic.class)).thenReturn(serviceBusinessLogic); + when(request.getHeader("USER_ID")).thenReturn(USER_ID); + when(webApplicationContext.getBean(ServletUtils.class)).thenReturn(servletUtils); + when(servletUtils.getComponentsUtils()).thenReturn(componentsUtils); + } +} @@ -2,7 +2,6 @@ package org.openecomp.sdc.be.servlets; import java.util.List; -import javax.annotation.Generated; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.core.Response; @@ -1,9 +1,7 @@ package org.openecomp.sdc.be.servlets; -import javax.annotation.Generated; import javax.servlet.http.HttpServletRequest; -import org.junit.Assert; import org.junit.Test; import com.datastax.driver.core.Configuration; @@ -1,6 +1,5 @@ package org.openecomp.sdc.be.servlets; -import javax.annotation.Generated; import javax.servlet.http.HttpServletRequest; import org.junit.Test; @@ -1,6 +1,5 @@ package org.openecomp.sdc.be.servlets; -import javax.annotation.Generated; import javax.servlet.ServletContext; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.core.Response; @@ -1,15 +1,9 @@ package org.openecomp.sdc.be.servlets; -import javax.annotation.Generated; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.core.Response; import org.junit.Test; -import org.openecomp.sdc.be.resources.data.ESArtifactData; - -import ch.qos.logback.classic.Logger; -import java.util.*; -import org.junit.Assert; public class CsarBuildServletTest { @@ -1,6 +1,5 @@ package org.openecomp.sdc.be.servlets; -import javax.annotation.Generated; import javax.servlet.ServletContext; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.core.Response; @@ -2,7 +2,6 @@ package org.openecomp.sdc.be.servlets; import java.util.List; -import javax.annotation.Generated; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.core.Response; @@ -1,6 +1,5 @@ package org.openecomp.sdc.be.servlets; -import javax.annotation.Generated; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.core.Response; @@ -1,6 +1,5 @@ package org.openecomp.sdc.be.servlets; -import javax.annotation.Generated; import javax.servlet.ServletContext; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.core.Response; @@ -1,6 +1,5 @@ package org.openecomp.sdc.be.servlets; -import javax.annotation.Generated; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.core.Response; @@ -1,6 +1,5 @@ package org.openecomp.sdc.be.servlets; -import javax.annotation.Generated; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.core.Response; @@ -2,7 +2,6 @@ package org.openecomp.sdc.be.servlets; import java.util.Map; -import javax.annotation.Generated; import javax.servlet.ServletContext; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.core.Response; @@ -13,8 +12,6 @@ import org.openecomp.sdc.be.components.impl.PropertyBusinessLogic; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.model.PropertyDefinition; -import com.google.common.collect.Multiset.Entry; - import fj.data.Either; public class PropertyServletTest { @@ -1,7 +1,5 @@ package org.openecomp.sdc.be.servlets; -import javax.annotation.Generated; - import org.apache.tinkerpop.gremlin.structure.T; import org.junit.Test; import org.openecomp.sdc.be.model.ArtifactDefinition; @@ -1,6 +1,5 @@ package org.openecomp.sdc.be.servlets; -import javax.annotation.Generated; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.core.Response; @@ -1,6 +1,5 @@ package org.openecomp.sdc.be.servlets; -import javax.annotation.Generated; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.core.Response; @@ -53,7 +53,6 @@ import org.openecomp.sdc.be.impl.WebAppContextWrapper; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.UploadResourceInfo; import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.be.servlets.ResourcesServlet; import org.openecomp.sdc.be.user.Role; import org.openecomp.sdc.be.user.UserBusinessLogic; import org.openecomp.sdc.common.api.Constants; @@ -20,8 +20,8 @@ package org.openecomp.sdc.be.servlets; -import static org.mockito.Matchers.anyObject; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.anyObject; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.when; import java.io.File; @@ -58,7 +58,6 @@ import org.openecomp.sdc.be.impl.WebAppContextWrapper; import org.openecomp.sdc.be.model.UploadResourceInfo; import org.openecomp.sdc.be.resources.api.IResourceUploader; import org.openecomp.sdc.be.resources.data.ESArtifactData; -import org.openecomp.sdc.be.servlets.ResourceUploadServlet; import org.openecomp.sdc.common.api.ConfigurationSource; import org.openecomp.sdc.common.api.Constants; import org.openecomp.sdc.common.impl.ExternalConfiguration; @@ -3,11 +3,9 @@ package org.openecomp.sdc.be.servlets; import java.util.List; import java.util.Map; -import javax.annotation.Generated; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.core.Response; -import org.junit.Assert; import org.junit.Test; import org.openecomp.sdc.be.model.PropertyDefinition; import org.openecomp.sdc.be.model.Resource; @@ -1,6 +1,5 @@ package org.openecomp.sdc.be.servlets; -import javax.annotation.Generated; import javax.servlet.ServletContext; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.core.Response; @@ -1,6 +1,5 @@ package org.openecomp.sdc.be.servlets; -import javax.annotation.Generated; import javax.servlet.ServletContext; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.core.Response; @@ -35,8 +35,6 @@ import javax.ws.rs.core.Application; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; -import org.apache.commons.lang3.tuple.ImmutablePair; -import org.apache.tinkerpop.gremlin.structure.T; import org.glassfish.grizzly.http.util.HttpStatus; import org.glassfish.hk2.utilities.binding.AbstractBinder; import org.glassfish.jersey.client.ClientConfig; @@ -61,15 +59,11 @@ import org.openecomp.sdc.be.user.Role; import org.openecomp.sdc.be.user.UserBusinessLogic; import org.openecomp.sdc.common.api.ConfigurationSource; import org.openecomp.sdc.common.api.Constants; -import org.openecomp.sdc.common.datastructure.FunctionalInterfaces.ConsumerTwoParam; import org.openecomp.sdc.common.impl.ExternalConfiguration; import org.openecomp.sdc.common.impl.FSConfigurationSource; import org.openecomp.sdc.exception.ResponseFormat; import org.springframework.web.context.WebApplicationContext; -import com.google.common.base.Equivalence.Wrapper; -import com.google.common.base.Supplier; - import fj.data.Either; public class TypesUploadServletTest extends JerseyTest { @@ -35,7 +35,6 @@ import javax.ws.rs.core.Response; import org.glassfish.hk2.utilities.binding.AbstractBinder; import org.glassfish.jersey.server.ResourceConfig; import org.glassfish.jersey.test.JerseyTest; -import org.junit.Assert; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; @@ -1,7 +1,5 @@ package org.openecomp.sdc.be.switchover.detector; -import javax.annotation.Generated; - import org.junit.Test; @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.tosca; import java.util.List; -import javax.annotation.Generated; - import org.junit.Test; import org.openecomp.sdc.generator.data.ArtifactType; @@ -32,13 +32,10 @@ import org.junit.Before; import org.junit.Test; import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.model.ArtifactDefinition; -import org.openecomp.sdc.be.model.Component; -import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.tosca.CsarUtils.NonMetaArtifactInfo; import org.openecomp.sdc.common.api.ConfigurationSource; import org.openecomp.sdc.common.impl.ExternalConfiguration; import org.openecomp.sdc.common.impl.FSConfigurationSource; -import org.openecomp.sdc.exception.ResponseFormat; import fj.data.Either; @@ -1,11 +1,13 @@ package org.openecomp.sdc.be.tosca; +import static org.assertj.core.api.Assertions.assertThat; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import java.util.ArrayList; +import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.List; @@ -13,6 +15,7 @@ import java.util.Map; import org.junit.Before; import org.junit.Test; +import org.openecomp.sdc.be.components.utils.PropertyDataDefinitionBuilder; import org.openecomp.sdc.be.model.DataTypeDefinition; import org.openecomp.sdc.be.model.PropertyDefinition; import org.openecomp.sdc.be.model.Resource; @@ -31,7 +34,7 @@ public class PropertyConvertorTest { property = new PropertyDefinition(); property.setName("myProperty"); property.setType(ToscaPropertyType.INTEGER.getType()); - dataTypes = new HashMap<String, DataTypeDefinition>(); + dataTypes = new HashMap(); dataTypes.put(property.getName(), new DataTypeDefinition()); } @@ -49,7 +52,7 @@ public class PropertyConvertorTest { property.setDefaultValue(def); ToscaProperty result = PropertyConvertor.getInstance().convertProperty(dataTypes, property, false); assertNotNull(result); - assertEquals(Integer.valueOf(def).intValue(), result.getDefaultp()); + assertEquals(Integer.valueOf(def), result.getDefaultp()); } @Test @@ -60,7 +63,7 @@ public class PropertyConvertorTest { property1.setDefaultValue("2"); dataTypes.put(property1.getName(), new DataTypeDefinition()); Resource resource = new Resource(); - List<PropertyDefinition> properties = new ArrayList<PropertyDefinition>(); + List<PropertyDefinition> properties = new ArrayList(); properties.add(property); properties.add(property1); resource.setProperties(properties); @@ -86,7 +89,7 @@ public class PropertyConvertorTest { property.setDefaultValue("1"); dataTypes.put(property1.getName(), new DataTypeDefinition()); Resource resource = new Resource(); - List<PropertyDefinition> properties = new ArrayList<PropertyDefinition>(); + List<PropertyDefinition> properties = new ArrayList(); properties.add(property); properties.add(property1); resource.setProperties(properties); @@ -106,7 +109,7 @@ public class PropertyConvertorTest { property1.setType(ToscaPropertyType.INTEGER.getType()); dataTypes.put(property1.getName(), new DataTypeDefinition()); Resource resource = new Resource(); - List<PropertyDefinition> properties = new ArrayList<PropertyDefinition>(); + List<PropertyDefinition> properties = new ArrayList(); properties.add(property); properties.add(property1); resource.setProperties(properties); @@ -118,4 +121,25 @@ public class PropertyConvertorTest { assertNull(prop.getDefaultp()); } } + + @Test + public void convertPropertyWhichStartsWithSemiColon() throws Exception { + PropertyDefinition property1 = new PropertyDataDefinitionBuilder() + .setDefaultValue("::") + .setType(ToscaPropertyType.STRING.getType()) + .build(); + ToscaProperty toscaProperty = PropertyConvertor.getInstance().convertProperty(Collections.emptyMap(), property1, false); + assertThat(toscaProperty.getDefaultp()).isEqualTo("::"); + } + + @Test + public void convertPropertyWhichStartsWithSlash() throws Exception { + PropertyDefinition property1 = new PropertyDataDefinitionBuilder() + .setDefaultValue("/") + .setType(ToscaPropertyType.STRING.getType()) + .build(); + ToscaProperty toscaProperty = PropertyConvertor.getInstance().convertProperty(Collections.emptyMap(), property1, false); + assertThat(toscaProperty.getDefaultp()).isEqualTo("/"); + } + } @@ -20,7 +20,8 @@ package org.openecomp.sdc.be.tosca; -import static org.junit.Assert.*; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; import java.io.FileInputStream; import java.io.IOException; @@ -1,7 +1,5 @@ package org.openecomp.sdc.be.tosca; -import javax.annotation.Generated; - import org.junit.Test; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.tosca.model.ToscaTemplate; @@ -0,0 +1,124 @@ +package org.openecomp.sdc.be.tosca; + +import org.junit.Test; +import org.openecomp.sdc.be.components.impl.ServiceComponentInstanceBusinessLogic; +import org.openecomp.sdc.be.components.impl.VFComponentInstanceBusinessLogic; +import org.openecomp.sdc.be.model.operations.impl.ComponentInstanceOperation; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; + +public class ToscaExportUtilsTest { + private static Logger log = LoggerFactory.getLogger(ToscaExportUtilsTest.class.getName()); + @javax.annotation.Resource + private VFComponentInstanceBusinessLogic componentInstanceBusinessLogic; + @javax.annotation.Resource + private ServiceComponentInstanceBusinessLogic serviceInstanceBusinessLogic; + @Autowired + private ToscaExportHandler exportUtils; + @Autowired + private ComponentInstanceOperation componentInstanceOperation; + + Gson gson = new GsonBuilder().setPrettyPrinting().create(); + + @Test + public void testExportService() { + /* Resource resource1 = ResourceTestUtils.prepareResource(0); + resource1.setResourceType(ResourceTypeEnum.VF); + Either<Resource, ResponseFormat> createResource1 = resourceBusinessLogic.createResource(resource1, getAdminUser(), null, null); + assertTrue(createResource1.isLeft()); + Resource certifiedVFC1 = changeResourceStateToCertify(createResource1.left().value()); + + Resource resource2 = ResourceTestUtils.prepareResource(1); + resource2.setResourceType(ResourceTypeEnum.VF); + Either<Resource, ResponseFormat> createResource2 = resourceBusinessLogic.createResource(resource2, getAdminUser(), null, null); + assertTrue(createResource2.isLeft()); + Resource certifiedVFC2 = changeResourceStateToCertify(createResource2.left().value()); + + Service service = ResourceTestUtils.prepareService(0); + Either<Service, ResponseFormat> createService = serviceBusinessLogic.createService(service, getAdminUser()); + assertTrue(createService.isLeft()); + + // add VFC instance to VF + ComponentInstance vfcResourceInstance1 = new ComponentInstance(); + vfcResourceInstance1.setDescription("VFC instance 1"); + vfcResourceInstance1.setName(certifiedVFC1.getName()); + vfcResourceInstance1.setComponentUid(certifiedVFC1.getUniqueId()); + + Either<ComponentInstance, ResponseFormat> createResourceVfcInstance1 = serviceInstanceBusinessLogic.createComponentInstance(ComponentTypeEnum.SERVICE_PARAM_NAME, createService.left().value().getUniqueId(), adminUser.getAttuid(), + vfcResourceInstance1); + assertTrue(createResourceVfcInstance1.isLeft()); + + ComponentInstance vfcResourceInstance2 = new ComponentInstance(); + vfcResourceInstance2.setDescription("VFC instance 2"); + vfcResourceInstance2.setName(certifiedVFC2.getName()); + vfcResourceInstance2.setComponentUid(certifiedVFC2.getUniqueId()); + Either<ComponentInstance, ResponseFormat> createResourceVfcInstance2 = serviceInstanceBusinessLogic.createComponentInstance(ComponentTypeEnum.SERVICE_PARAM_NAME, createService.left().value().getUniqueId(), adminUser.getAttuid(), + vfcResourceInstance2); + assertTrue(createResourceVfcInstance2.isLeft()); + + Either<Service, ResponseFormat> serviceFetch = serviceBusinessLogic.getService(createService.left().value().getUniqueId(), adminUser); + assertTrue(serviceFetch.isLeft()); + + List<ComponentInstance> componentInstances = serviceFetch.left().value().getComponentInstances(); + String ciname1 = null; + String ciname2 = null; + + for (ComponentInstance ci : componentInstances) { + if (ci.getComponentUid().equals(certifiedVFC1.getUniqueId())) { + ciname1 = ci.getName(); + } + if (ci.getComponentUid().equals(certifiedVFC2.getUniqueId())) { + ciname2 = ci.getName(); + } + } + + Either<ToscaRepresentation, ToscaError> result = exportUtils.exportComponent(serviceFetch.left().value()); + assertTrue(result.isLeft()); + + String mainYaml = result.left().value().getMainYaml(); + assertNotNull(mainYaml); + + YamlToObjectConverter yamlToObjectConverter = new YamlToObjectConverter(); + assertTrue(yamlToObjectConverter.isValidYaml(mainYaml.getBytes())); + log.debug(mainYaml); + + Yaml yaml = new Yaml(); + + InputStream inputStream = new ByteArrayInputStream(mainYaml.getBytes()); + Map<String, Object> load = (Map<String, Object>) yaml.load(inputStream); + Map<String, Object> imports = (Map<String, Object>) load.get("imports"); + assertNotNull(imports); + assertEquals("Validate imports size in yml", 2, imports.size()); + + Map<String, Object> metadata = (Map<String, Object>) load.get("metadata"); + assertNotNull(metadata); + validateMetadata(metadata, serviceFetch.left().value(), false); + + Map<String, Object> vf1 = (Map<String, Object>) imports.get(certifiedVFC1.getName()); + String fileName = (String) vf1.get(ToscaExportHandler.IMPORTS_FILE_KEY); + ArtifactDefinition artifactDefinition = certifiedVFC1.getToscaArtifacts().get(ToscaExportHandler.ASSET_TOSCA_TEMPLATE); + assertEquals("Validate 1 file name", artifactDefinition.getArtifactName(), fileName); + + Map<String, Object> topology_template = (Map<String, Object>) load.get("topology_template"); + Map<String, Object> node_templates = (Map<String, Object>) topology_template.get("node_templates"); + Map<String, Object> inst1 = (Map<String, Object>) node_templates.get(ciname1); + Map<String, Object> inst2 = (Map<String, Object>) node_templates.get(ciname2); + + Map<String, Object> inst1MD = (Map<String, Object>) inst1.get("metadata"); + Map<String, Object> inst2MD = (Map<String, Object>) inst2.get("metadata"); + + validateMetadata(inst1MD, certifiedVFC1, true); + + Map<String, Object> vf2 = (Map<String, Object>) imports.get(certifiedVFC2.getName()); + fileName = (String) vf2.get(ToscaExportHandler.IMPORTS_FILE_KEY); + artifactDefinition = certifiedVFC2.getToscaArtifacts().get(ToscaExportHandler.ASSET_TOSCA_TEMPLATE); + assertEquals("Validate 2 file name", artifactDefinition.getArtifactName(), fileName); + + validateMetadata(inst2MD, certifiedVFC2, true);*/ + } + +} @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.tosca; import java.util.List; -import javax.annotation.Generated; - import org.apache.commons.lang3.tuple.Triple; import org.junit.Test; import org.openecomp.sdc.be.model.Component; @@ -3,8 +3,6 @@ package org.openecomp.sdc.be.tosca; import java.util.List; import java.util.Map; -import javax.annotation.Generated; - import org.junit.Test; import org.openecomp.sdc.be.model.Component; @@ -1,7 +1,5 @@ package org.openecomp.sdc.be.tosca.model; -import javax.annotation.Generated; - import org.junit.Test; @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.tosca.model; import java.util.Map; -import javax.annotation.Generated; - import org.junit.Test; @@ -3,8 +3,6 @@ package org.openecomp.sdc.be.tosca.model; import java.util.List; import java.util.Map; -import javax.annotation.Generated; - import org.junit.Test; @@ -3,8 +3,6 @@ package org.openecomp.sdc.be.tosca.model; import java.util.List; import java.util.Map; -import javax.annotation.Generated; - import org.junit.Test; @@ -1,7 +1,5 @@ package org.openecomp.sdc.be.tosca.model; -import javax.annotation.Generated; - import org.junit.Test; @@ -3,8 +3,6 @@ package org.openecomp.sdc.be.tosca.model; import java.util.List; import java.util.Map; -import javax.annotation.Generated; - import org.junit.Test; @@ -3,8 +3,6 @@ package org.openecomp.sdc.be.tosca.model; import java.util.List; import java.util.Map; -import javax.annotation.Generated; - import org.junit.Test; @@ -1,7 +1,5 @@ package org.openecomp.sdc.be.tosca.model; -import javax.annotation.Generated; - import org.junit.Test; @@ -3,8 +3,6 @@ package org.openecomp.sdc.be.tosca.model; import java.util.List; import java.util.Map; -import javax.annotation.Generated; - import org.junit.Test; @@ -3,8 +3,6 @@ package org.openecomp.sdc.be.tosca.model; import java.util.List; import java.util.Map; -import javax.annotation.Generated; - import org.junit.Test; @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.tosca.model; import java.util.Map; -import javax.annotation.Generated; - import org.junit.Test; @@ -3,8 +3,6 @@ package org.openecomp.sdc.be.tosca.model; import java.util.List; import java.util.Map; -import javax.annotation.Generated; - import org.junit.Test; @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.tosca.model; import java.util.Map; -import javax.annotation.Generated; - import org.junit.Test; @@ -1,7 +1,5 @@ package org.openecomp.sdc.be.tosca.model; -import javax.annotation.Generated; - import org.junit.Test; @@ -1,7 +1,5 @@ package org.openecomp.sdc.common.transaction.mngr; -import javax.annotation.Generated; - import org.junit.Test; import org.openecomp.sdc.common.transaction.api.RollbackHandler; import org.openecomp.sdc.common.transaction.api.TransactionUtils.DBActionCodeEnum; @@ -49,8 +49,6 @@ import org.openecomp.sdc.common.transaction.api.TransactionUtils.ESActionTypeEnu import org.openecomp.sdc.common.transaction.api.TransactionUtils.LogMessages; import org.openecomp.sdc.common.transaction.api.TransactionUtils.TransactionCodeEnum; import org.openecomp.sdc.common.transaction.api.TransactionUtils.TransactionStatusEnum; -import org.openecomp.sdc.common.transaction.mngr.CommitManager; -import org.openecomp.sdc.common.transaction.mngr.TransactionSdncImpl; import org.slf4j.Logger; import fj.data.Either; @@ -1,7 +1,5 @@ package org.openecomp.sdc.common.transaction.mngr; -import javax.annotation.Generated; - import org.junit.Test; import org.openecomp.sdc.common.transaction.api.ITransactionSdnc; import org.openecomp.sdc.common.transaction.api.TransactionUtils.ActionTypeEnum; @@ -22,7 +22,7 @@ beSslPort: 8443 version: 1.0 released: 2012-11-30 -toscaConformanceLevel: 4.0 +toscaConformanceLevel: 5.0 minToscaConformanceLevel: 3.0 titanCfgFile: /home/vagrant/catalog-be/config/catalog-be/titan.properties @@ -614,3 +614,21 @@ genericAssetNodeTypes: VF : org.openecomp.resource.abstract.nodes.VF PNF: org.openecomp.resource.abstract.nodes.PNF Service: org.openecomp.resource.abstract.nodes.service + +environmentContext: + defaultValue: General_Revenue-Bearing + validValues: + - Critical_Revenue-Bearing + - Vital_Revenue-Bearing + - Essential_Revenue-Bearing + - Important_Revenue-Bearing + - Needed_Revenue-Bearing + - Useful_Revenue-Bearing + - General_Revenue-Bearing + - Critical_Non-Revenue + - Vital_Non-Revenue + - Essential_Non-Revenue + - Important_Non-Revenue + - Needed_Non-Revenue + - Useful_Non-Revenue + - General_Non-Revenue @@ -0,0 +1,3585 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +metadata: + template_name: Main +imports: +- openecomp_heat_index: + file: openecomp-heat/_index.yml +- GlobalSubstitutionTypes: + file: GlobalSubstitutionTypesServiceTemplate.yaml +topology_template: + inputs: + vlc4_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc4_Internal2 + default: 00:80:37:0E:04:12 + sctp-a-egress_rule_application: + hidden: false + immutable: false + type: string + description: application for the SecurityGroup + default: any + sctp-b-ipv6-ingress-src_start_port: + hidden: false + immutable: false + type: float + description: IPV6 start port + default: 0 + constraints: + - in_range: + - 0 + - 65535 + ncb1_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to ncb1_Internal2 + default: 00:80:37:0E:09:12 + sctp-a-ipv6-ingress_ethertype: + hidden: false + immutable: false + type: string + description: IPV6 ethertype + default: IPv4 + gpb8_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb8_Internal1 + default: 00:80:37:0E:10:22 + sctp-a-ingress_rule_protocol: + hidden: false + immutable: false + type: string + description: protocol for the SecurityGroup + default: any + sctp-b-display_name: + hidden: false + immutable: false + type: string + description: display_name for the SecurityGroup + default: epc-sctp-b-ipv4v6-sec-group + sctp-a-ingress_ethertype: + hidden: false + immutable: false + type: string + description: ethertype for the SecurityGroup + default: IPv4 + sctp-a-egress-src_start_port: + hidden: false + immutable: false + type: float + description: start_port for the SecurityGroup + default: 0 + constraints: + - in_range: + - 0 + - 65535 + ncb_flavor_name: + hidden: false + immutable: false + type: string + description: Flavor to use for servers ncb + default: nv.c8r32d1 + vlc3_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc3_Internal1 + default: 00:80:37:0E:03:12 + Internal2_net_cidr: + hidden: false + immutable: false + type: string + description: CIDR for internal-2 network + default: 169.255.0.0 + sctp-a-egress-dst_start_port: + hidden: false + immutable: false + type: float + description: start_port for the SecurityGroup + default: 0 + constraints: + - in_range: + - 0 + - 65535 + sctp-a-egress_ethertype: + hidden: false + immutable: false + type: string + description: ethertype for the SecurityGroup + default: IPv4 + gpb4_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb4_Internal2 + default: 00:80:37:0E:0C:22 + sctp-b-ipv6-egress_rule_application: + hidden: false + immutable: false + type: string + description: IPV6 Rule-application + default: any + vlc8_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc8_Internal1 + default: 00:80:37:0E:08:12 + sctp-b-ipv6-ingress-src_end_port: + hidden: false + immutable: false + type: float + description: IPV6 ending port for destination + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + fsb2_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to fsb2_Internal1 + default: 00:80:37:0E:0D:12 + sctp-b-name: + hidden: false + immutable: false + type: string + description: name for the SecurityGroup + default: epc-sctp-b-ipv4v6-sec-group + sctp-b-ipv6-egress_ethertype: + hidden: false + immutable: false + type: string + description: IPV6 ethertype + default: IPv4 + internal_net_id_1: + hidden: false + immutable: false + type: string + description: UUID of Internal2_net + default: e3397c69-a942-49aa-81cb-fb91ff34abc8 + sctp-a-egress_dst_subnet_prefix: + hidden: false + immutable: false + type: string + description: ip_prefix for the SecurityGroup + default: 0.0.0.0 + internal_net_id_0: + hidden: false + immutable: false + type: string + description: UUID of Internal1_net + default: 871de971-22ac-47b6-befb-50e7d4cb67ea + sctp_b_net_fqdn: + hidden: false + immutable: false + type: string + description: Network FQDN SCTPB + default: default-domain:vMME-24474-Ericsson-WTC-Lab-vLCP1-4:vMME-24474-Ericsson-WTC-Lab-vLCP1-4_gn_SCTPB_net_1 + sctp-a-ipv6-ingress_rule_application: + hidden: false + immutable: false + type: string + description: IPV6 Rule-application + default: any + sctp-b-ipv6-ingress_src_subnet_prefix_len: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix length + default: '0' + ncb_name_1: + hidden: false + immutable: false + type: string + description: Name of ncb2 + default: zrdm3mmex59ncb002 + ncb_name_0: + hidden: false + immutable: false + type: string + description: Name of ncb1 + default: zrdm3mmex59ncb001 + vlc_st_virtualization_type: + hidden: false + immutable: false + type: string + description: Indicates virtualization type + default: virtual-machine + vlc2_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc2_Internal1 + default: 00:80:37:0E:02:12 + sctp-b-ingress-dst_start_port: + hidden: false + immutable: false + type: float + description: start_port for the SecurityGroup + default: 0 + constraints: + - in_range: + - 0 + - 65535 + sctp-a-display_name: + hidden: false + immutable: false + type: string + description: display_name for the SecurityGroup + default: epc-sctp-a-ipv4v6-sec-group + sctp-b-ingress_rule_application: + hidden: false + immutable: false + type: string + description: application for the SecurityGroup + default: any + int2_sec_group_name: + hidden: false + immutable: false + type: string + description: SecurityGroup name for internal-2 + default: int2-sec-group + gpb5_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb5_Internal2 + default: 00:80:37:0E:0D:22 + sctp-a-egress-dst_subnet_prefix_v6: + hidden: false + immutable: false + type: string + description: dst subnet + default: '::' + OS::stack_name: + type: string + required: false + sctp-b-egress-src_end_port: + hidden: false + immutable: false + type: float + description: end_port for the SecurityGroup + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + Internal2_shared: + hidden: false + immutable: false + type: string + description: Whether Shared or private internal-2 network + default: false + sctp-a-ipv6-egress_rule_protocol: + hidden: false + immutable: false + type: string + description: IPV6 Rule-protocol + default: any + Internal2_rpf: + hidden: false + immutable: false + type: string + description: Reverse Path Forwarding Enabled/Disabled internal-2 network + default: disable + vlc5_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc5_Internal2 + default: 00:80:37:0E:05:12 + sctp-a-ipv6-egress_src_end_port: + hidden: false + immutable: false + type: string + description: IPV6 end port + default: 65535 + Internal1_forwarding_mode: + hidden: false + immutable: false + type: string + description: L2 or L3 forwarding mode for internal-1 network + default: l2 + gpb3_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb3_Internal1 + default: 00:80:37:0E:0B:22 + vip_oam_management_v4_ip: + hidden: false + immutable: false + type: string + description: IP address of OAM service IP address to be provisioned in A&AI + default: 107.239.72.176 + vmi_oam_preference_primary: + hidden: false + immutable: false + type: float + description: Preference for primary interface/port + default: 200 + sctp-b-src_subnet_prefix_v6: + hidden: false + immutable: false + type: string + description: ip_prefix for the SecurityGroup + default: '::' + sctp-a-egress_dst_subnet_prefix_len: + hidden: false + immutable: false + type: float + description: ip_prefix_len for the SecurityGroup + default: '0' + constraints: + - in_range: + - 0 + - 32 + security_group_sctp_b_id: + hidden: false + immutable: false + type: string + description: Security Group UUID for output + default: 92a4ae54-1733-4d03-b488-f178bb9f7b82 + Internal2_forwarding_mode: + hidden: false + immutable: false + type: string + description: L2 or L3 forwarding mode for internal-2 network + default: l2 + sctp-a-ipv6-egress_dst_end_port: + hidden: false + immutable: false + type: string + description: IPV6 end port + default: 65535 + sctp-b-egress-dst_subnet_prefix_v6: + hidden: false + immutable: false + type: string + description: dst subnet + default: '::' + sctp-b-egress_dst_subnet_prefix: + hidden: false + immutable: false + type: string + description: ip_prefix for the SecurityGroup + default: 0.0.0.0 + security_group_oam_id: + hidden: false + immutable: false + type: string + description: Security Group UUID for output + default: 4ae4aa74-3e8e-4f2b-8b5f-a8bd262da96b + gpb2_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb2_Internal1 + default: 00:80:37:0E:0A:22 + security_group_int1_id: + hidden: false + immutable: false + type: string + description: UUID of Internal1_net security group + default: 94c62578-835d-4801-9372-70a2cfb22683 + sctp-a-egress_action: + hidden: false + immutable: false + type: string + description: simple_action for the SecurityGroup + default: pass + oam_net_fqdn: + hidden: false + immutable: false + type: string + description: Network FQDN OAM + default: default-domain:vMME-24474-Ericsson-WTC-Lab-vLCP1-4:vMME-24474-Ericsson-WTC-Lab-vLCP1-4_OAM_net_1 + ncb2_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to ncb2_Internal2 + default: 00:80:37:0E:0F:12 + vlc_st_interface_type_sctp_a: + hidden: false + immutable: false + type: string + description: service_interface_type for the ServiceTemplate + default: left + gpb3_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb3_Internal2 + default: 00:80:37:0E:0B:22 + vlc_st_interface_type_sctp_b: + hidden: false + immutable: false + type: string + description: service_interface_type for the ServiceTemplate + default: right + gpb1_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb1_Internal2 + default: 00:80:37:0E:09:22 + oam_net_name: + hidden: false + immutable: false + type: string + description: Network Name OAM + default: vMME-24474-Ericsson-WTC-Lab-vLCP1-4_OAM_net_1 + sctp-b-ingress-src_start_port: + hidden: false + immutable: false + type: float + description: start_port for the SecurityGroup + default: 0 + constraints: + - in_range: + - 0 + - 65535 + fsb1_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to fsb1_Internal1 + default: 00:80:37:0E:0B:12 + sctp-b-ingress_dst_addresses: + hidden: false + immutable: false + type: string + description: security_group for the SecurityGroup + default: local + vlc_st_interface_type_oam: + hidden: false + immutable: false + type: string + description: service_interface_type for the ServiceTemplate + default: management + shc_monitor_type: + hidden: false + immutable: false + type: string + description: health check + default: PING + oam_sec_group_name: + hidden: false + immutable: false + type: string + description: SecurityGroup name for OAM + default: oam-sec-group + Internal2_net_gateway: + hidden: false + immutable: false + type: string + description: gateway for internal-2 network + default: 169.255.0.3 + evac_policy: + hidden: false + immutable: false + type: string + description: CMHA Policy + default: Evacuate + server_group_id_0: + hidden: false + immutable: false + type: string + description: ID of Anti-Affinity Policy-based Server Group + default: ec99a73d-38f8-4280-8103-ba8ee584629f + vlc8_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc8_Internal2 + default: 00:80:37:0E:08:12 + sctp-b-ipv6-egress_rule_protocol: + hidden: false + immutable: false + type: string + description: IPV6 Rule-protocol + default: any + gtp_sec_group_name: + hidden: false + immutable: false + type: string + description: SecurityGroup name for GTP + default: gtp-sec-group + vlc_sctp_b_v6_ip_2: + hidden: false + immutable: false + type: string + description: Static IP vlc3 SCTPB + default: fd00:200:200:5:0:0:0:24 + vlc_sctp_b_v6_ip_1: + hidden: false + immutable: false + type: string + description: Static IP vlc2 SCTPB + default: fd00:200:200:5:0:0:0:17 + sctp-a-ipv6-egress_dst_subnet_prefix: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix + default: 0.0.0.0 + vlc_sctp_b_v6_ip_0: + hidden: false + immutable: false + type: string + description: Static IP vlc1 SCTPB + default: fd00:200:200:5:0:0:0:16 + vlc4_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc4_Internal1 + default: 00:80:37:0E:04:12 + vlc_sctp_b_v6_ip_6: + hidden: false + immutable: false + type: string + description: Static IP vlc7 SCTPB + default: fd00:200:200:5:0:0:0:28 + vlc_sctp_b_v6_ip_5: + hidden: false + immutable: false + type: string + description: Static IP vlc6 SCTPB + default: fd00:200:200:5:0:0:0:27 + vlc_sctp_b_v6_ip_4: + hidden: false + immutable: false + type: string + description: Static IP vlc5 SCTPB + default: fd00:200:200:5:0:0:0:26 + vlc_sctp_b_v6_ip_3: + hidden: false + immutable: false + type: string + description: Static IP vlc4 SCTPB + default: fd00:200:200:5:0:0:0:25 + sctp_b_net_name: + hidden: false + immutable: false + type: string + description: Network Name SCTPB + default: vMME-24474-Ericsson-WTC-Lab-vLCP1-4_gn_SCTPB_net_1 + sctp-b-ipv6-egress_dst_subnet_prefix_len: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix + default: '0' + sctp-a-egress_rule_protocol: + hidden: false + immutable: false + type: string + description: protocol for the SecurityGroup + default: any + Internal1_shared: + hidden: false + immutable: false + type: string + description: Whether Shared or private internal-1 network + default: false + shc_url_path: + hidden: false + immutable: false + type: string + description: health check + default: local-ip + Internal2_net_cidr_len: + hidden: false + immutable: false + type: string + description: CIDR length for internal-2 network + default: 17 + sctp-a-ingress-src_end_port: + hidden: false + immutable: false + type: float + description: end_port for the SecurityGroup + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + sctp-b-ipv6-ingress_src_subnet_prefix: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix + default: 0.0.0.0 + sctp-a-egress-dst_end_port: + hidden: false + immutable: false + type: float + description: end_port for the SecurityGroup + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + sctp-a-ingress_action: + hidden: false + immutable: false + type: string + description: simple_action for the SecurityGroup + default: pass + sctp-b-ipv6-ingress_action: + hidden: false + immutable: false + type: string + description: IPV6 action + default: pass + vlc_st_service_type: + hidden: false + immutable: false + type: string + description: service type + default: firewall + sctp-b-ipv6-ingress-dst_start_port: + hidden: false + immutable: false + type: string + description: IPV6 starting port for destination + default: 0 + vlc_st_availability_zone: + hidden: false + immutable: false + type: string + description: Indicates availability zone is enabled + default: true + vlc7_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc7_Internal1 + default: 00:80:37:0E:07:12 + fsb_volume_image_name_1: + label: MME_FSB2 + hidden: false + immutable: false + type: string + description: volume name + default: MME_FSB2_1_3_GA.qcow2 + vlc_oam_ip_6: + hidden: false + immutable: false + type: string + description: Static IP vlc7 OAM + default: 107.239.72.151 + sctp-a-ipv6-ingress_src_subnet_prefix_len: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix length + default: '0' + vlc_oam_ip_7: + hidden: false + immutable: false + type: string + description: Static IP vlc8 OAM + default: 107.239.72.152 + Internal1_allow_transit: + hidden: false + immutable: false + type: string + description: Allow/disallow transit internal-1 network + default: true + vlc_oam_ip_2: + hidden: false + immutable: false + type: string + description: Static IP vlc3 OAM + default: 107.239.72.157 + vlc_oam_ip_3: + hidden: false + immutable: false + type: string + description: Static IP vlc4 OAM + default: 107.239.72.158 + vlc_gtp_ip_0: + hidden: false + immutable: false + type: string + description: Static IP vlc1 GTP + default: 107.243.47.208 + vlc_oam_ip_4: + hidden: false + immutable: false + type: string + description: Static IP vlc5 OAM + default: 107.239.72.149 + fsb_volume_image_name_0: + label: MME_FSB1 + hidden: false + immutable: false + type: string + description: volume name + default: MME_FSB1_1_3_GA.qcow2 + vlc_gtp_ip_1: + hidden: false + immutable: false + type: string + description: Static IP vlc2 GTP + default: 107.243.47.209 + vlc_oam_ip_5: + hidden: false + immutable: false + type: string + description: Static IP vlc6 OAM + default: 107.239.72.150 + vlc_gtp_ip_2: + hidden: false + immutable: false + type: string + description: Static IP vlc3 GTP + default: 107.243.47.216 + vlc_name_6: + hidden: false + immutable: false + type: string + description: Name of vlc7 + default: zrdm3mmex59vlc007 + vlc_gtp_ip_3: + hidden: false + immutable: false + type: string + description: Static IP vlc4 GTP + default: 107.243.47.217 + vlc_name_7: + hidden: false + immutable: false + type: string + description: Name of vlc8 + default: zrdm3mmex59vlc008 + security_group_sctp_a_id: + hidden: false + immutable: false + type: string + description: Security Group UUID for output + default: 3cd8a524-77ff-4980-ae2a-d19ba70e0511 + vlc_gtp_ip_4: + hidden: false + immutable: false + type: string + description: Static IP vlc5 GTP + default: 107.243.47.218 + vlc_gtp_ip_5: + hidden: false + immutable: false + type: string + description: Static IP vlc6 GTP + default: 107.243.47.219 + vlc_gtp_ip_6: + hidden: false + immutable: false + type: string + description: Static IP vlc7 GTP + default: 107.243.47.220 + vlc_name_2: + hidden: false + immutable: false + type: string + description: Name of vlc3 + default: zrdm3mmex59vlc003 + vlc_gtp_ip_7: + hidden: false + immutable: false + type: string + description: Static IP vlc8 GTP + default: 107.243.47.221 + vlc_name_3: + hidden: false + immutable: false + type: string + description: Name of vlc4 + default: zrdm3mmex59vlc004 + vlc_name_4: + hidden: false + immutable: false + type: string + description: Name of vlc5 + default: zrdm3mmex59vlc005 + vlc_name_5: + hidden: false + immutable: false + type: string + description: Name of vlc6 + default: zrdm3mmex59vlc006 + fsb_volume_id_1: + hidden: false + immutable: false + type: string + description: ID of Cinder Volume for FSB2 + default: 5bd0560c-bfd0-47dc-a84a-554e2698c925 + sctp-a-ipv6-ingress_action: + hidden: false + immutable: false + type: string + description: IPV6 action + default: pass + vlc_name_0: + hidden: false + immutable: false + type: string + description: Name of vlc1 + default: zrdm3mmex59vlc001 + vlc_name_1: + hidden: false + immutable: false + type: string + description: Name of vlc2 + default: zrdm3mmex59vlc002 + vlc_oam_route_prefixes: + hidden: false + immutable: false + type: json + description: Route prefixes for static routing on OAM + sctp-b-egress_rule_application: + hidden: false + immutable: false + type: string + description: application for the SecurityGroup + default: any + vlc_oam_ip_0: + hidden: false + immutable: false + type: string + description: Static IP vlc1 OAM + default: 107.239.72.155 + vlc_oam_ip_1: + hidden: false + immutable: false + type: string + description: Static IP vlc2 OAM + default: 107.239.72.156 + vlc6_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc6_Internal1 + default: 00:80:37:0E:06:12 + fsb_volume_id_0: + hidden: false + immutable: false + type: string + description: ID of Cinder Volume for FSB1 + default: 27baa6a0-b701-4795-bf5e-4f546b350b1f + sctp-b-egress-dst_end_port: + hidden: false + immutable: false + type: float + description: end_port for the SecurityGroup + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + gpb2_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb2_Internal2 + default: 00:80:37:0E:0A:22 + sctp-a-ipv6-egress_rule_application: + hidden: false + immutable: false + type: string + description: IPV6 Rule-application + default: any + sctp-b-ipv6-egress_src_start_port: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix + default: 0 + Internal2_allow_transit: + hidden: false + immutable: false + type: string + description: Allow/disallow transit internal-2 network + default: true + fsb_volume_size: + label: volume size + hidden: false + immutable: false + type: float + description: volume size 320GB + default: 320 + constraints: + - in_range: + - 0 + - 340 + sctp-b-IPv6_ethertype: + hidden: false + immutable: false + type: string + description: IPV6 ethertype + default: IPv6 + gtp_net_fqdn: + hidden: false + immutable: false + type: string + description: Network FQDN GTP + default: default-domain:vMME-24474-Ericsson-WTC-Lab-vLCP1-4:vMME-24474-Ericsson-WTC-Lab-vLCP1-4_gn_GTP_net_1 + ncb2_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to ncb2_Internal1 + default: 00:80:37:0E:0F:12 + sctp-b-ingress_rule_protocol: + hidden: false + immutable: false + type: string + description: protocol for the SecurityGroup + default: any + sctp-b-ingress_action: + hidden: false + immutable: false + type: string + description: simple_action for the SecurityGroup + default: pass + sctp-b-egress_src_addresses: + hidden: false + immutable: false + type: string + description: security_group for the SecurityGroup + default: local + gpb7_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb7_Internal2 + default: 00:80:37:0E:0F:22 + sctp-a-ipv6-ingress-dst_start_port: + hidden: false + immutable: false + type: string + description: IPV6 starting port for destination + default: 0 + gtp_net_name: + hidden: false + immutable: false + type: string + description: Network Name GTP + default: vMME-24474-Ericsson-WTC-Lab-vLCP1-4_gn_GTP_net_1 + sctp-b-ipv6-ingress_rule_application: + hidden: false + immutable: false + type: string + description: IPV6 Rule-application + default: any + domain_name: + hidden: false + immutable: false + type: string + description: Unique name of vMME contrail domain + default: default-domain + vlc5_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc5_Internal1 + default: 00:80:37:0E:05:12 + sctp-a-egress_src_addresses: + hidden: false + immutable: false + type: string + description: security_group for the SecurityGroup + default: local + sctp-b-egress-src_start_port: + hidden: false + immutable: false + type: float + description: start_port for the SecurityGroup + default: 0 + constraints: + - in_range: + - 0 + - 65535 + shc_enabled: + hidden: false + immutable: false + type: string + description: health check + default: true + sctp-b-ipv6-ingress-dst_end_port: + hidden: false + immutable: false + type: string + description: IPV6 end port + default: 65535 + sctp-b-dst_subnet_prefix_v6: + hidden: false + immutable: false + type: string + description: ip_prefix for the SecurityGroup + default: '::' + sctp_a_net_fqdn: + hidden: false + immutable: false + type: string + description: Network FQDN SCTPA + default: default-domain:vMME-24474-Ericsson-WTC-Lab-vLCP1-4:vMME-24474-Ericsson-WTC-Lab-vLCP1-4_gn_SCTPA_net_1 + security_group_gtp_id: + hidden: false + immutable: false + type: string + description: Security Group UUID for output + default: e8ad3fe2-5f95-43e4-bbcc-da97b1c22588 + sctp-a-ipv6-ingress_src_subnet_prefix: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix + default: 0.0.0.0 + fsb_name_1: + hidden: false + immutable: false + type: string + description: Name of fsb1 + default: zrdm3mmex59fsb002 + sctp-b-egress-dst_start_port: + hidden: false + immutable: false + type: float + description: start_port for the SecurityGroup + default: 0 + constraints: + - in_range: + - 0 + - 65535 + fsb_name_0: + hidden: false + immutable: false + type: string + description: Name of fsb1 + default: zrdm3mmex59fsb001 + sctp_a_net_name: + hidden: false + immutable: false + type: string + description: Network Name SCTPA + default: vMME-24474-Ericsson-WTC-Lab-vLCP1-4_gn_SCTPA_net_1 + sctp-b-egress_dst_subnet_prefix_len: + hidden: false + immutable: false + type: float + description: ip_prefix_len for the SecurityGroup + default: '0' + constraints: + - in_range: + - 0 + - 32 + gpb1_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb1_Internal1 + default: 00:80:37:0E:09:22 + sctp-a-ingress-dst_start_port: + hidden: false + immutable: false + type: float + description: start_port for the SecurityGroup + default: 0 + constraints: + - in_range: + - 0 + - 65535 + fsb1_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to fsb1_Internal2 + default: 00:80:37:0E:0B:12 + vlc_st_service_mode: + hidden: false + immutable: false + type: string + description: service mode + default: in-network-nat + sctp-a-ipv6-egress_ethertype: + hidden: false + immutable: false + type: string + description: IPV6 ethertype + default: IPv4 + sctp-a-egress-src_end_port: + hidden: false + immutable: false + type: float + description: end_port for the SecurityGroup + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + sctp-b-egress_action: + hidden: false + immutable: false + type: string + description: simple_action for the SecurityGroup + default: pass + sctp-a-ingress-src_subnet_prefix_len: + hidden: false + immutable: false + type: float + description: ip_prefix_len for the SecurityGroup + default: '0' + constraints: + - in_range: + - 0 + - 32 + sctp-a-ipv6-ingress-src_start_port: + hidden: false + immutable: false + type: float + description: IPV6 start port + default: 0 + constraints: + - in_range: + - 0 + - 65535 + vf_module_id: + hidden: false + immutable: false + type: string + description: the vf_module_id for this instance. UUID provided by ECOMP + default: TWO + Internal1_net_cidr: + hidden: false + immutable: false + type: string + description: CIDR for internal-1 network + default: 169.253.0.0 + fsb_flavor_name: + hidden: false + immutable: false + type: string + description: Flavor to use for servers fsb1 + default: nv.c8r32d1 + sctp_rule_protocol: + hidden: false + immutable: false + type: string + description: protocol for the SecurityGroup + default: 132 + vnf_name: + hidden: false + immutable: false + type: string + description: the vnf_name for this instance. provided by ECOMP + default: zrdm3mmex59 + sctp-a-IPv6_ethertype: + hidden: false + immutable: false + type: string + description: IPV6 ethertype + default: IPv6 + vlc_sctp_b_v6_ip_7: + hidden: false + immutable: false + type: string + description: Static IP vlc8 SCTPB + default: fd00:200:200:5:0:0:0:29 + vlc6_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc6_Internal2 + default: 00:80:37:0E:06:12 + sctp-b-ingress-dst_end_port: + hidden: false + immutable: false + type: float + description: end_port for the SecurityGroup + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + vlc7_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc7_Internal2 + default: 00:80:37:0E:07:12 + sctp-a-ipv6-ingress-src_end_port: + hidden: false + immutable: false + type: float + description: IPV6 ending port for destination + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + vlc_flavor_name: + hidden: false + immutable: false + type: string + description: Flavor to use for servers vlc + default: nd.c16r64d1 + sctp-b-ipv6-egress_src_addresses: + hidden: false + immutable: false + type: string + description: IPV6 source + default: local + vlc_st_interface_type_int1: + hidden: false + immutable: false + type: string + description: service_interface_type for the ServiceTemplate + default: other1 + availability_zone_0: + hidden: false + immutable: false + type: string + description: cluster for spawnning fsb instances + default: rdm3-kvm-az02 + service_instance_id_0: + hidden: false + immutable: false + type: string + description: UUID of service instance for vLCs + default: 77c67cc8-d15f-47bc-aeb1-8d65d09e917a + availability_zone_1: + hidden: false + immutable: false + type: string + description: cluster for spawnning ncb instances + default: rdm3-kvm-az02 + vlc_st_interface_type_int2: + hidden: false + immutable: false + type: string + description: service_interface_type for the ServiceTemplate + default: other2 + sctp-a-ipv6-egress-dst_start_port: + hidden: false + immutable: false + type: string + description: IPV6 start port + default: 0 + sctp-a-ipv6-egress_dst_subnet_prefix_len: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix + default: '0' + vlc_sctp_a_ip_0: + hidden: false + immutable: false + type: string + description: Static IP vlc1 SCTPA + default: 107.243.47.144 + vlc_sctp_b_route_prefixes: + hidden: false + immutable: false + type: json + description: Route prefixes for static routing on SCTPB + vlc1_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc1_Internal1 + default: 00:80:37:0E:01:12 + sctp-b-ipv6-egress_src_end_port: + hidden: false + immutable: false + type: string + description: IPV6 end port + default: 65535 + sctp-a-ipv6-egress_src_addresses: + hidden: false + immutable: false + type: string + description: IPV6 source + default: local + vlc_sctp_a_ip_7: + hidden: false + immutable: false + type: string + description: Static IP vlc8 SCTPA + default: 107.243.47.157 + sctp-a-ingress-src_subnet_prefix_v6: + hidden: false + immutable: false + type: string + description: src subnet + default: '::' + vlc_sctp_a_ip_6: + hidden: false + immutable: false + type: string + description: Static IP vlc7 SCTPA + default: 107.243.47.156 + vlc_sctp_a_ip_5: + hidden: false + immutable: false + type: string + description: Static IP vlc6 SCTPA + default: 107.243.47.155 + sctp-a-ingress-dst_end_port: + hidden: false + immutable: false + type: float + description: end_port for the SecurityGroup + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + vlc_sctp_a_ip_4: + hidden: false + immutable: false + type: string + description: Static IP vlc5 SCTPA + default: 107.243.47.154 + vlc_sctp_a_ip_3: + hidden: false + immutable: false + type: string + description: Static IP vlc4 SCTPA + default: 107.243.47.153 + vlc_sctp_a_ip_2: + hidden: false + immutable: false + type: string + description: Static IP vlc3 SCTPA + default: 107.243.47.152 + vlc_sctp_a_ip_1: + hidden: false + immutable: false + type: string + description: Static IP vlc2 SCTPA + default: 107.243.47.145 + gpb6_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb6_Internal2 + default: 00:80:37:0E:0E:22 + security_group_int2_id: + hidden: false + immutable: false + type: string + description: UUID of Internal1_net security group + default: 1361f069-baf2-4b76-b321-7f68ba26c369 + Internal2_dhcp: + hidden: false + immutable: false + type: string + description: Whether DHCP/static IP addressing on internal-2 network + default: false + sctp-a-dst_subnet_prefix_v6: + hidden: false + immutable: false + type: string + description: ip_prefix for the SecurityGroup + default: '::' + pxe_image_name: + hidden: false + immutable: false + type: string + description: Name of image to use for server ncb + default: MME_PXE-Boot_1_3_GA.qcow2 + vlc_st_interface_type_gtp: + hidden: false + immutable: false + type: string + description: service_interface_type for the ServiceTemplate + default: other0 + ncb1_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to ncb1_Internal1 + default: 00:80:37:0E:09:12 + vlc_gtp_route_prefixes: + hidden: false + immutable: false + type: json + description: Route prefixes for static routing on GTP + int1_sec_group_name: + hidden: false + immutable: false + type: string + description: SecurityGroup name for internal-1 + default: int1-sec-group + vmi_oam_preference_secondary: + hidden: false + immutable: false + type: float + description: Preference for secondary interface/port + default: 100 + Internal1_dhcp: + hidden: false + immutable: false + type: string + description: Whether DHCP/static IP addressing on internal-1 network + default: false + fsb2_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to fsb2_Internal2 + default: 00:80:37:0E:0D:12 + Internal1_net_cidr_len: + hidden: false + immutable: false + type: string + description: CIDR length for internal-1 network + default: 17 + sctp-a-ingress_dst_addresses: + hidden: false + immutable: false + type: string + description: security_group for the SecurityGroup + default: local + sctp-b-ingress-src_subnet_prefix_len: + hidden: false + immutable: false + type: float + description: ip_prefix_len for the SecurityGroup + default: '0' + constraints: + - in_range: + - 0 + - 32 + fsb_oam_ip_1: + hidden: false + immutable: false + type: string + description: IP address of OAM vNIC for FSB2 + default: 107.239.72.154 + fsb_oam_ip_0: + hidden: false + immutable: false + type: string + description: IP address of OAM vNIC for FSB1 + default: 107.239.72.153 + shc_timeout: + hidden: false + immutable: false + type: string + description: health check + default: 5 + vlc_st_version: + hidden: false + immutable: false + type: string + description: Indicates service version + default: 2 + sctp-a-src_subnet_prefix_v6: + hidden: false + immutable: false + type: string + description: ip_prefix for the SecurityGroup + default: '::' + sctp-a-ingress_rule_application: + hidden: false + immutable: false + type: string + description: application for the SecurityGroup + default: any + sctp-b-egress_ethertype: + hidden: false + immutable: false + type: string + description: ethertype for the SecurityGroup + default: IPv4 + sctp-a-ipv6-egress_src_start_port: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix + default: 0 + instance_ip_family_v6: + hidden: false + immutable: false + type: string + description: Ipv6 instance type + default: v6 + sctp-b-ingress-src_subnet_prefix_v6: + hidden: false + immutable: false + type: string + description: src subnet + default: '::' + gpb8_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb8_Internal2 + default: 00:80:37:0E:10:22 + gpb4_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb4_Internal1 + default: 00:80:37:0E:0C:22 + sctp-a-ipv6-ingress-dst_end_port: + hidden: false + immutable: false + type: string + description: IPV6 end port + default: 65535 + Internal1_net_gateway: + hidden: false + immutable: false + type: string + description: gateway for internal-1 network + default: 169.253.0.3 + sctp-b-ipv6-egress-dst_start_port: + hidden: false + immutable: false + type: string + description: IPV6 start port + default: 0 + gpb_name_7: + hidden: false + immutable: false + type: string + description: Name of gpb8 + default: zrdm3mmex59gpb0016 + gpb_name_6: + hidden: false + immutable: false + type: string + description: Name of gpb7 + default: zrdm3mmex59gpb0015 + gpb_name_5: + hidden: false + immutable: false + type: string + description: Name of gpb6 + default: zrdm3mmex59gpb0014 + gpb_name_4: + hidden: false + immutable: false + type: string + description: Name of gpb5 + default: zrdm3mmex59gpb0013 + gpb_name_3: + hidden: false + immutable: false + type: string + description: Name of gpb4 + default: zrdm3mmex59gpb0012 + sctp-a-ipv6-ingress_dst_addresses: + hidden: false + immutable: false + type: string + description: IPV6 destination + default: local + gpb_name_2: + hidden: false + immutable: false + type: string + description: Name of gpb3 + default: zrdm3mmex59gpb0011 + shc_delay: + hidden: false + immutable: false + type: string + description: health check + default: 3 + gpb_name_1: + hidden: false + immutable: false + type: string + description: Name of gpb2 + default: zrdm3mmex59gpb0010 + sctp-b-ipv6-egress_action: + hidden: false + immutable: false + type: string + description: IPV6 action + default: pass + vlc3_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc3_Internal2 + default: 00:80:37:0E:03:12 + gpb_name_0: + hidden: false + immutable: false + type: string + description: Name of gpb1 + default: zrdm3mmex59gpb009 + sctp-a-ipv6-egress_action: + hidden: false + immutable: false + type: string + description: IPV6 action + default: pass + gpb5_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb5_Internal1 + default: 00:80:37:0E:0D:22 + sctp-b-ipv6-ingress_rule_protocol: + hidden: false + immutable: false + type: string + description: IPV6 Rule-protocol + default: any + shc_max_retries: + hidden: false + immutable: false + type: string + description: health check + default: 2 + fsb_volume_type: + label: volume type + hidden: false + immutable: false + type: string + description: volume type SolidFire + default: SF-Default-SSD + sctp-a-name: + hidden: false + immutable: false + type: string + description: name for the SecurityGroup + default: epc-sctp-a-ipv4v6-sec-group + vlc_sctp_b_ip_5: + hidden: false + immutable: false + type: string + description: Static IP vlc6 SCTPB + default: 107.243.47.187 + vlc_sctp_b_ip_4: + hidden: false + immutable: false + type: string + description: Static IP vlc5 SCTPB + default: 107.243.47.186 + vlc_sctp_b_ip_3: + hidden: false + immutable: false + type: string + description: Static IP vlc4 SCTPB + default: 107.243.47.185 + vlc_sctp_b_ip_2: + hidden: false + immutable: false + type: string + description: Static IP vlc3 SCTPB + default: 107.243.47.184 + sctp-b-egress_rule_protocol: + hidden: false + immutable: false + type: string + description: protocol for the SecurityGroup + default: any + vnf_id: + hidden: false + immutable: false + type: string + description: the vf_id for this instance. UUID provided by ECOMP + default: zrdm3mmex59 + vlc_sctp_b_ip_7: + hidden: false + immutable: false + type: string + description: Static IP vlc8 SCTPB + default: 107.243.47.189 + vlc_sctp_b_ip_6: + hidden: false + immutable: false + type: string + description: Static IP vlc7 SCTPB + default: 107.243.47.188 + vlc_sctp_b_ip_1: + hidden: false + immutable: false + type: string + description: Static IP vlc2 SCTPB + default: 107.243.47.177 + gpb6_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb6_Internal1 + default: 00:80:37:0E:0E:22 + sctp-b-ipv6-egress_dst_end_port: + hidden: false + immutable: false + type: string + description: IPV6 end port + default: 65535 + vlc_sctp_b_ip_0: + hidden: false + immutable: false + type: string + description: Static IP vlc1 SCTPB + default: 107.243.47.176 + vlc2_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc2_Internal2 + default: 00:80:37:0E:02:12 + sctp-b-ingress-src_subnet_prefix: + hidden: false + immutable: false + type: string + description: ip_prefix for the SecurityGroup + default: 0.0.0.0 + gpb_flavor_name: + hidden: false + immutable: false + type: string + description: Flavor to use for servers gpb + default: nv.c20r64d1 + vlc_sctp_a_route_prefixes: + hidden: false + immutable: false + type: json + description: Route prefixes for static routing on SCTPA + sctp-b-ipv6-ingress_dst_addresses: + hidden: false + immutable: false + type: string + description: IPV6 destination + default: local + sctp-b-ipv6-ingress_ethertype: + hidden: false + immutable: false + type: string + description: IPV6 ethertype + default: IPv4 + sctp-b-ipv6-egress_dst_subnet_prefix: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix + default: 0.0.0.0 + sctp-a-ingress-src_subnet_prefix: + hidden: false + immutable: false + type: string + description: ip_prefix for the SecurityGroup + default: 0.0.0.0 + vlc1_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc1_Internal2 + default: 00:80:37:0E:01:12 + Internal1_rpf: + hidden: false + immutable: false + type: string + description: Reverse Path Forwarding Enabled/Disabled internal-1 network + default: disable + sctp-b-ingress_ethertype: + hidden: false + immutable: false + type: string + description: ethertype for the SecurityGroup + default: IPv4 + sctp-b-ingress-src_end_port: + hidden: false + immutable: false + type: float + description: end_port for the SecurityGroup + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + sctp-a-ipv6-ingress_rule_protocol: + hidden: false + immutable: false + type: string + description: IPV6 Rule-protocol + default: any + vlc_sctp_a_v6_ip_7: + hidden: false + immutable: false + type: string + description: Static IP vlc8 SCTPA + default: fd00:200:200:4:0:0:0:29 + vlc_sctp_a_v6_ip_6: + hidden: false + immutable: false + type: string + description: Static IP vlc7 SCTPA + default: fd00:200:200:4:0:0:0:28 + gpb7_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb7_Internal1 + default: 00:80:37:0E:0F:22 + vlc_sctp_a_v6_ip_5: + hidden: false + immutable: false + type: string + description: Static IP vlc6 SCTPA + default: fd00:200:200:4:0:0:0:27 + vlc_sctp_a_v6_ip_4: + hidden: false + immutable: false + type: string + description: Static IP vlc5 SCTPA + default: fd00:200:200:4:0:0:0:26 + vlc_sctp_a_v6_ip_3: + hidden: false + immutable: false + type: string + description: Static IP vlc4 SCTPA + default: fd00:200:200:4:0:0:0:25 + vlc_sctp_a_v6_ip_2: + hidden: false + immutable: false + type: string + description: Static IP vlc3 SCTPA + default: fd00:200:200:4:0:0:0:24 + sctp-a-ingress-src_start_port: + hidden: false + immutable: false + type: float + description: start_port for the SecurityGroup + default: 0 + constraints: + - in_range: + - 0 + - 65535 + vlc_sctp_a_v6_ip_1: + hidden: false + immutable: false + type: string + description: Static IP vlc2 SCTPA + default: fd00:200:200:4:0:0:0:17 + vlc_sctp_a_v6_ip_0: + hidden: false + immutable: false + type: string + description: Static IP vlc1 SCTPA + default: fd00:200:200:4:0:0:0:16 + node_templates: + abstract_gpb_1: + type: org.openecomp.resource.abstract.nodes.gpb_1 + directives: + - substitutable + properties: + compute_gpb_name: + - get_input: gpb_name_1 + vm_flavor_name: + get_input: gpb_flavor_name + compute_gpb_scheduler_hints: + - group: + get_input: server_group_id_0 + port_gpb2_Internal1_security_groups: + - - get_input: security_group_int1_id + compute_gpb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + port_gpb2_Internal2_network: + - get_input: internal_net_id_1 + port_gpb2_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + vm_image_name: + get_input: pxe_image_name + port_gpb2_Internal1_replacement_policy: + - AUTO + port_gpb2_Internal1_network: + - get_input: internal_net_id_0 + port_gpb2_Internal2_replacement_policy: + - AUTO + port_gpb2_Internal1_mac_requirements: + mac_count_required: + is_required: true + compute_gpb_availability_zone: + - get_input: availability_zone_1 + port_gpb2_Internal1_mac_address: + get_input: gpb2_Internal1_mac + port_gpb2_Internal2_mac_requirements: + mac_count_required: + is_required: true + port_gpb2_Internal2_mac_address: + get_input: gpb2_Internal1_mac + port_gpb2_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb2_Internal2_security_groups: + - - get_input: security_group_int2_id + service_template_filter: + substitute_service_template: Nested_gpb_1ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: gpb + nfc_naming_code: gpb + requirements: + - link_gpb_gpb2_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_gpb_gpb2_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + abstract_gpb_2__different_name: + type: org.openecomp.resource.abstract.nodes.gpb_2 + directives: + - substitutable + properties: + port_gpb3_Internal1_replacement_policy: + - AUTO + compute_gpb_name: + - get_input: gpb_name_2 + port_gpb3_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb3_Internal2_replacement_policy: + - AUTO + vm_flavor_name: + get_input: gpb_flavor_name + port_gpb3_Internal2_security_groups: + - - get_input: security_group_int2_id + compute_gpb_scheduler_hints: + - group: + get_input: server_group_id_0 + compute_gpb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + vm_image_name: + get_input: pxe_image_name + port_gpb3_Internal1_security_groups: + - - get_input: security_group_int1_id + port_gpb3_Internal2_network: + - get_input: internal_net_id_1 + compute_gpb_availability_zone: + - get_input: availability_zone_0 + port_gpb3_Internal1_network: + - get_input: internal_net_id_0 + port_gpb3_Internal1_mac_requirements: + mac_count_required: + is_required: true + port_gpb3_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb3_Internal1_mac_address: + get_input: gpb3_Internal1_mac + port_gpb3_Internal2_mac_address: + get_input: gpb3_Internal1_mac + port_gpb3_Internal2_mac_requirements: + mac_count_required: + is_required: true + service_template_filter: + substitute_service_template: Nested_gpb_2ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: gpb + nfc_naming_code: gpb + requirements: + - link_gpb_gpb3_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_gpb_gpb3_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + abstract_vlc: + type: org.openecomp.resource.abstract.nodes.vlc + directives: + - substitutable + properties: + port_template_VMInt_SCTP_A_vlc_virtual_network_refs: + - - get_input: sctp_a_net_fqdn + port_template_VMInt_INT1_vlc_security_group_refs: + - - get_input: security_group_int1_id + vm_flavor_name: + get_input: vlc_flavor_name + port_template_VMInt_INT2_vlc_port_tuple_refs: + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc4 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc3 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc2 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc1 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc8 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc7 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc6 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc5 + vm_image_name: + get_input: pxe_image_name + port_template_VMInt_INT1_vlc_port_tuple_refs: + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc4 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc3 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc2 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc1 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc8 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc7 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc6 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc5 + port_template_VMInt_INT2_vlc_virtual_network_refs: + - - get_input: internal_net_id_1 + port_template_VMInt_OAM_vlc_virtual_network_refs: + - - get_input: oam_net_fqdn + port_template_VMInt_OAM_vlc_port_tuple_refs: + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc4 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc3 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc2 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc1 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc8 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc7 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc6 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc5 + port_template_VMInt_INT2_vlc_virtual_machine_interface_mac_addresses: + - - get_input: vlc4_Internal2_mac + - - get_input: vlc3_Internal2_mac + - - get_input: vlc2_Internal2_mac + - - get_input: vlc1_Internal2_mac + - - get_input: vlc8_Internal2_mac + - - get_input: vlc7_Internal2_mac + - - get_input: vlc6_Internal2_mac + - - get_input: vlc5_Internal2_mac + port_template_VMInt_SCTP_B_vlc_port_tuple_refs: + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc4 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc3 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc2 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc1 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc8 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc7 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc6 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc5 + port_template_VMInt_GTP_vlc_security_group_refs: + - - get_input: security_group_gtp_id + compute_vlc_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + port_template_VMInt_OAM_vlc_security_group_refs: + - - get_input: security_group_oam_id + compute_vlc_contrail_service_instance_ind: + - true + - true + - true + - true + - true + - true + - true + - true + port_template_VMInt_GTP_vlc_port_tuple_refs: + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc4 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc3 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc2 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc1 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc8 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc7 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc6 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc5 + port_template_VMInt_SCTP_B_vlc_virtual_network_refs: + - - get_input: sctp_b_net_fqdn + port_template_VMInt_INT2_vlc_security_group_refs: + - - get_input: security_group_int2_id + port_template_VMInt_SCTP_B_vlc_security_group_refs: + - - get_input: security_group_sctp_b_id + port_template_VMInt_INT1_vlc_virtual_network_refs: + - - get_input: internal_net_id_0 + port_template_VMInt_SCTP_A_vlc_port_tuple_refs: + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc4 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc3 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc2 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc1 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc8 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc7 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc6 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc5 + compute_vlc_scheduler_hints: + - group: + get_input: server_group_id_0 + - group: + get_input: server_group_id_0 + - group: + get_input: server_group_id_0 + - group: + get_input: server_group_id_0 + - group: + get_input: server_group_id_0 + - group: + get_input: server_group_id_0 + - group: + get_input: server_group_id_0 + - group: + get_input: server_group_id_0 + compute_vlc_name: + - get_input: vlc_name_3 + - get_input: vlc_name_2 + - get_input: vlc_name_1 + - get_input: vlc_name_0 + - get_input: vlc_name_7 + - get_input: vlc_name_6 + - get_input: vlc_name_5 + - get_input: vlc_name_4 + port_template_VMInt_SCTP_A_vlc_security_group_refs: + - - get_input: security_group_sctp_a_id + compute_vlc_availability_zone: + - get_input: availability_zone_1 + - get_input: availability_zone_0 + - get_input: availability_zone_1 + - get_input: availability_zone_0 + - get_input: availability_zone_1 + - get_input: availability_zone_0 + - get_input: availability_zone_1 + - get_input: availability_zone_0 + port_template_VMInt_INT1_vlc_virtual_machine_interface_mac_addresses: + - - get_input: vlc4_Internal1_mac + - - get_input: vlc3_Internal1_mac + - - get_input: vlc2_Internal1_mac + - - get_input: vlc1_Internal1_mac + - - get_input: vlc8_Internal1_mac + - - get_input: vlc7_Internal1_mac + - - get_input: vlc6_Internal1_mac + - - get_input: vlc5_Internal1_mac + port_template_VMInt_GTP_vlc_virtual_network_refs: + - - get_input: gtp_net_fqdn + service_template_filter: + substitute_service_template: Nested_vlcServiceTemplate.yaml + count: 8 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: vlc + nfc_naming_code: vlc + requirements: + - link_vlc_template_VMInt_INT2_vlc: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + - link_vlc_template_VMInt_INT1_vlc: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + abstract_gpb_7: + type: org.openecomp.resource.abstract.nodes.gpb_7 + directives: + - substitutable + properties: + compute_gpb_name: + - get_input: gpb_name_7 + port_gpb8_Internal1_mac_address: + get_input: gpb8_Internal1_mac + port_gpb8_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + vm_flavor_name: + get_input: gpb_flavor_name + compute_gpb_scheduler_hints: + - group: + get_input: server_group_id_0 + compute_gpb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + vm_image_name: + get_input: pxe_image_name + port_gpb8_Internal2_security_groups: + - - get_input: security_group_int2_id + port_gpb8_Internal1_replacement_policy: + - AUTO + port_gpb8_Internal2_replacement_policy: + - AUTO + compute_gpb_availability_zone: + - get_input: availability_zone_1 + port_gpb8_Internal1_mac_requirements: + mac_count_required: + is_required: true + port_gpb8_Internal1_network: + - get_input: internal_net_id_0 + port_gpb8_Internal2_mac_requirements: + mac_count_required: + is_required: true + port_gpb8_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb8_Internal1_security_groups: + - - get_input: security_group_int1_id + port_gpb8_Internal2_network: + - get_input: internal_net_id_1 + port_gpb8_Internal2_mac_address: + get_input: gpb8_Internal1_mac + service_template_filter: + substitute_service_template: Nested_gpb_7ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: gpb + nfc_naming_code: gpb + requirements: + - link_gpb_gpb8_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_gpb_gpb8_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + abstract_gpb_5: + type: org.openecomp.resource.abstract.nodes.gpb_5 + directives: + - substitutable + properties: + port_gpb6_Internal1_mac_requirements: + mac_count_required: + is_required: true + compute_gpb_name: + - get_input: gpb_name_5 + vm_flavor_name: + get_input: gpb_flavor_name + compute_gpb_scheduler_hints: + - group: + get_input: server_group_id_0 + compute_gpb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + port_gpb6_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + vm_image_name: + get_input: pxe_image_name + port_gpb6_Internal1_security_groups: + - - get_input: security_group_int1_id + port_gpb6_Internal2_network: + - get_input: internal_net_id_1 + compute_gpb_availability_zone: + - get_input: availability_zone_1 + port_gpb6_Internal1_network: + - get_input: internal_net_id_0 + port_gpb6_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb6_Internal2_mac_address: + get_input: gpb6_Internal1_mac + port_gpb6_Internal1_mac_address: + get_input: gpb6_Internal1_mac + port_gpb6_Internal2_mac_requirements: + mac_count_required: + is_required: true + port_gpb6_Internal2_replacement_policy: + - AUTO + port_gpb6_Internal1_replacement_policy: + - AUTO + port_gpb6_Internal2_security_groups: + - - get_input: security_group_int2_id + service_template_filter: + substitute_service_template: Nested_gpb_5ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: gpb + nfc_naming_code: gpb + requirements: + - link_gpb_gpb6_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_gpb_gpb6_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + abstract_gpb_6: + type: org.openecomp.resource.abstract.nodes.gpb_6 + directives: + - substitutable + properties: + port_gpb7_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb7_Internal1_network: + - get_input: internal_net_id_0 + compute_gpb_name: + - get_input: gpb_name_6 + port_gpb7_Internal2_network: + - get_input: internal_net_id_1 + vm_flavor_name: + get_input: gpb_flavor_name + port_gpb7_Internal1_replacement_policy: + - AUTO + port_gpb7_Internal2_replacement_policy: + - AUTO + port_gpb7_Internal2_security_groups: + - - get_input: security_group_int2_id + compute_gpb_scheduler_hints: + - group: + get_input: server_group_id_0 + compute_gpb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + vm_image_name: + get_input: pxe_image_name + port_gpb7_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb7_Internal1_security_groups: + - - get_input: security_group_int1_id + compute_gpb_availability_zone: + - get_input: availability_zone_0 + port_gpb7_Internal2_mac_address: + get_input: gpb7_Internal1_mac + port_gpb7_Internal1_mac_requirements: + mac_count_required: + is_required: true + port_gpb7_Internal1_mac_address: + get_input: gpb7_Internal1_mac + port_gpb7_Internal2_mac_requirements: + mac_count_required: + is_required: true + service_template_filter: + substitute_service_template: Nested_gpb_6ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: gpb + nfc_naming_code: gpb + requirements: + - link_gpb_gpb7_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_gpb_gpb7_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + abstract_gpb_3: + type: org.openecomp.resource.abstract.nodes.gpb_3 + directives: + - substitutable + properties: + compute_gpb_name: + - get_input: gpb_name_3 + port_gpb4_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + vm_flavor_name: + get_input: gpb_flavor_name + port_gpb4_Internal1_mac_address: + get_input: gpb4_Internal1_mac + compute_gpb_scheduler_hints: + - group: + get_input: server_group_id_0 + port_gpb4_Internal2_mac_requirements: + mac_count_required: + is_required: true + compute_gpb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + port_gpb4_Internal2_mac_address: + get_input: gpb4_Internal1_mac + vm_image_name: + get_input: pxe_image_name + port_gpb4_Internal2_security_groups: + - - get_input: security_group_int2_id + compute_gpb_availability_zone: + - get_input: availability_zone_1 + port_gpb4_Internal2_replacement_policy: + - AUTO + port_gpb4_Internal1_replacement_policy: + - AUTO + port_gpb4_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb4_Internal1_security_groups: + - - get_input: security_group_int1_id + port_gpb4_Internal2_network: + - get_input: internal_net_id_1 + port_gpb4_Internal1_mac_requirements: + mac_count_required: + is_required: true + port_gpb4_Internal1_network: + - get_input: internal_net_id_0 + service_template_filter: + substitute_service_template: Nested_gpb_3ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: gpb + nfc_naming_code: gpb + requirements: + - link_gpb_gpb4_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_gpb_gpb4_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + abstract_gpb_4: + type: org.openecomp.resource.abstract.nodes.gpb_4 + directives: + - substitutable + properties: + port_gpb5_Internal2_mac_requirements: + mac_count_required: + is_required: true + port_gpb5_Internal1_security_groups: + - - get_input: security_group_int1_id + compute_gpb_name: + - get_input: gpb_name_4 + vm_flavor_name: + get_input: gpb_flavor_name + port_gpb5_Internal1_mac_requirements: + mac_count_required: + is_required: true + compute_gpb_scheduler_hints: + - group: + get_input: server_group_id_0 + port_gpb5_Internal2_network: + - get_input: internal_net_id_1 + compute_gpb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + vm_image_name: + get_input: pxe_image_name + port_gpb5_Internal1_network: + - get_input: internal_net_id_0 + port_gpb5_Internal2_mac_address: + get_input: gpb5_Internal1_mac + port_gpb5_Internal1_mac_address: + get_input: gpb5_Internal1_mac + port_gpb5_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb5_Internal2_replacement_policy: + - AUTO + compute_gpb_availability_zone: + - get_input: availability_zone_0 + port_gpb5_Internal1_replacement_policy: + - AUTO + port_gpb5_Internal2_security_groups: + - - get_input: security_group_int2_id + port_gpb5_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + service_template_filter: + substitute_service_template: Nested_gpb_4ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: gpb + nfc_naming_code: gpb + requirements: + - link_gpb_gpb5_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_gpb_gpb5_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + abstract_gpb: + type: org.openecomp.resource.abstract.nodes.gpb + directives: + - substitutable + properties: + port_gpb1_Internal1_security_groups: + - - get_input: security_group_int1_id + compute_gpb_name: + - get_input: gpb_name_0 + port_gpb1_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + vm_flavor_name: + get_input: gpb_flavor_name + port_gpb1_Internal1_mac_requirements: + mac_count_required: + is_required: true + compute_gpb_scheduler_hints: + - group: + get_input: server_group_id_0 + compute_gpb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + vm_image_name: + get_input: pxe_image_name + port_gpb1_Internal1_mac_address: + get_input: gpb1_Internal1_mac + port_gpb1_Internal2_mac_address: + get_input: gpb1_Internal1_mac + port_gpb1_Internal2_mac_requirements: + mac_count_required: + is_required: true + compute_gpb_availability_zone: + - get_input: availability_zone_0 + port_gpb1_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb1_Internal2_security_groups: + - - get_input: security_group_int2_id + port_gpb1_Internal1_replacement_policy: + - AUTO + port_gpb1_Internal2_replacement_policy: + - AUTO + port_gpb1_Internal2_network: + - get_input: internal_net_id_1 + port_gpb1_Internal1_network: + - get_input: internal_net_id_0 + service_template_filter: + substitute_service_template: Nested_gpbServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: gpb + nfc_naming_code: gpb + requirements: + - link_gpb_gpb1_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_gpb_gpb1_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + Internal1_net: + type: org.openecomp.resource.vl.nodes.heat.network.contrailV2.VirtualNetwork + properties: + network_ipam_refs_data: + - network_ipam_refs_data_ipam_subnets: + - network_ipam_refs_data_ipam_subnets_enable_dhcp: + get_input: Internal1_dhcp + network_ipam_refs_data_ipam_subnets_default_gateway: + get_input: Internal1_net_gateway + network_ipam_refs_data_ipam_subnets_subnet: + network_ipam_refs_data_ipam_subnets_subnet_ip_prefix_len: + get_input: Internal1_net_cidr_len + network_ipam_refs_data_ipam_subnets_subnet_ip_prefix: + get_input: Internal1_net_cidr + network_name: + str_replace: + template: $VNF_NAME_int_net_1 + params: + $VNF_NAME: + get_input: vnf_name + network_ipam_refs: + - UNSUPPORTED_RESOURCE_template_NetworkIpam_Internal1 + abstract_fsb: + type: org.openecomp.resource.abstract.nodes.fsb + directives: + - substitutable + properties: + port_FSB1_Internal1_mac_address: + get_input: fsb1_Internal1_mac + port_FSB_OAM_network_role_tag: + - oam + port_FSB1_Internal2_network: + - Internal2_net + port_FSB1_Internal1_network: + - Internal1_net + vm_flavor_name: + get_input: fsb_flavor_name + port_FSB1_Internal2_mac_address: + get_input: fsb1_Internal1_mac + port_FSB_OAM_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: true + floating_ip_count_required: + is_required: false + compute_fsb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + port_FSB1_Internal1_security_groups: + - - int1_security_group + port_FSB1_Internal2_replacement_policy: + - AUTO + compute_fsb_scheduler_hints: + - group: VM_Affinity_group + port_FSB1_Internal1_replacement_policy: + - AUTO + compute_fsb_name: + - get_input: fsb_name_0 + port_FSB1_Internal1_mac_requirements: + mac_count_required: + is_required: true + port_FSB1_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_FSB_OAM_network: + - get_input: oam_net_name + port_FSB_OAM_security_groups: + - - oam_security_group + port_FSB_OAM_mac_requirements: + mac_count_required: + is_required: false + port_FSB_OAM_replacement_policy: + - AUTO + compute_fsb_availability_zone: + - get_input: availability_zone_0 + port_FSB1_Internal2_security_groups: + - - int2_security_group + port_FSB1_Internal2_mac_requirements: + mac_count_required: + is_required: true + port_FSB1_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_FSB_OAM_fixed_ips: + - ip_address: + get_input: fsb_oam_ip_0 + service_template_filter: + substitute_service_template: Nested_fsbServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: fsb + nfc_naming_code: fsb + requirements: + - link_fsb_FSB1_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_fsb_FSB1_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + gtp_security_group: + type: org.openecomp.resource.vfc.rules.nodes.heat.network.neutron.SecurityRules + properties: + name: + str_replace: + template: $VNF_NAME_$SECGROUPNAME + params: + $SECGROUPNAME: + get_input: gtp_sec_group_name + $VNF_NAME: + get_input: vnf_name + rules: + - protocol: tcp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: udp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: icmp + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + - protocol: tcp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: udp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: icmp + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + abstract_ncb_1: + type: org.openecomp.resource.abstract.nodes.ncb_1 + directives: + - substitutable + properties: + port_NCB2_Internal2_security_groups: + - - int2_security_group + port_NCB2_Internal1_replacement_policy: + - AUTO + port_NCB2_Internal2_replacement_policy: + - AUTO + vm_flavor_name: + get_input: ncb_flavor_name + port_NCB2_Internal2_mac_requirements: + mac_count_required: + is_required: true + port_NCB2_Internal1_mac_requirements: + mac_count_required: + is_required: true + vm_image_name: + get_input: pxe_image_name + compute_ncb_scheduler_hints: + - group: VM_Affinity_group + compute_ncb_availability_zone: + - get_input: availability_zone_1 + port_NCB2_Internal1_network: + - Internal1_net + port_NCB2_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_NCB2_Internal1_security_groups: + - - int1_security_group + port_NCB2_Internal2_network: + - Internal2_net + port_NCB2_Internal1_mac_address: + get_input: ncb2_Internal1_mac + port_NCB2_Internal2_mac_address: + get_input: ncb2_Internal1_mac + compute_ncb_name: + - get_input: ncb_name_1 + compute_ncb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + port_NCB2_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + service_template_filter: + substitute_service_template: Nested_ncb_1ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: ncb + nfc_naming_code: ncb + requirements: + - link_ncb_NCB2_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_ncb_NCB2_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + abstract_ncb: + type: org.openecomp.resource.abstract.nodes.ncb + directives: + - substitutable + properties: + vm_flavor_name: + get_input: ncb_flavor_name + port_NCB1_Internal2_mac_requirements: + mac_count_required: + is_required: true + vm_image_name: + get_input: pxe_image_name + port_NCB1_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + compute_ncb_scheduler_hints: + - group: VM_Affinity_group + port_NCB1_Internal1_security_groups: + - - int1_security_group + compute_ncb_availability_zone: + - get_input: availability_zone_0 + port_NCB1_Internal2_mac_address: + get_input: ncb1_Internal1_mac + port_NCB1_Internal1_mac_address: + get_input: ncb1_Internal1_mac + port_NCB1_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_NCB1_Internal1_mac_requirements: + mac_count_required: + is_required: true + port_NCB1_Internal2_replacement_policy: + - AUTO + port_NCB1_Internal1_network: + - Internal1_net + port_NCB1_Internal2_security_groups: + - - int2_security_group + port_NCB1_Internal1_replacement_policy: + - AUTO + compute_ncb_name: + - get_input: ncb_name_0 + compute_ncb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + port_NCB1_Internal2_network: + - Internal2_net + service_template_filter: + substitute_service_template: Nested_ncbServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: ncb + nfc_naming_code: ncb + requirements: + - link_ncb_NCB1_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_ncb_NCB1_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + int1_security_group: + type: org.openecomp.resource.vfc.rules.nodes.heat.network.neutron.SecurityRules + properties: + name: + str_replace: + template: $VNF_NAME_$SECGROUPNAME + params: + $SECGROUPNAME: + get_input: int1_sec_group_name + $VNF_NAME: + get_input: vnf_name + rules: + - protocol: tcp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: udp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: icmp + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + - protocol: tcp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: udp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: icmp + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + requirements: + - port: + capability: attachment_fsb_FSB1_Internal1 + node: abstract_fsb + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_fsb_FSB2_Internal1 + node: abstract_fsb_1 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_ncb_NCB1_Internal1 + node: abstract_ncb + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_ncb_NCB2_Internal1 + node: abstract_ncb_1 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb1_Internal1 + node: abstract_gpb + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb2_Internal1 + node: abstract_gpb_1 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb3_Internal1 + node: abstract_gpb_2 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb4_Internal1 + node: abstract_gpb_3 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb5_Internal1 + node: abstract_gpb_4 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb6_Internal1 + node: abstract_gpb_5 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb7_Internal1 + node: abstract_gpb_6 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb8_Internal1 + node: abstract_gpb_7 + relationship: org.openecomp.relationships.AttachesTo + fsb_volume_0: + type: org.openecomp.resource.vfc.nodes.heat.cinder.Volume + properties: + image: + get_input: fsb_volume_image_name_0 + volume_type: + get_input: fsb_volume_type + size: '(get_input : fsb_volume_size) * 1024' + name: + list_join: + - _ + - - get_input: OS::stack_name + - FSB1_Vol_1 + fsb_volume_1: + type: org.openecomp.resource.vfc.nodes.heat.cinder.Volume + properties: + image: + get_input: fsb_volume_image_name_1 + volume_type: + get_input: fsb_volume_type + size: '(get_input : fsb_volume_size) * 1024' + name: + list_join: + - _ + - - get_input: OS::stack_name + - FSB2_Vol_1 + Internal2_net: + type: org.openecomp.resource.vl.nodes.heat.network.contrailV2.VirtualNetwork + properties: + network_ipam_refs_data: + - network_ipam_refs_data_ipam_subnets: + - network_ipam_refs_data_ipam_subnets_enable_dhcp: + get_input: Internal2_dhcp + network_ipam_refs_data_ipam_subnets_default_gateway: + get_input: Internal2_net_gateway + network_ipam_refs_data_ipam_subnets_subnet: + network_ipam_refs_data_ipam_subnets_subnet_ip_prefix_len: + get_input: Internal2_net_cidr_len + network_ipam_refs_data_ipam_subnets_subnet_ip_prefix: + get_input: Internal2_net_cidr + network_name: + str_replace: + template: $VNF_NAME_int_net_2 + params: + $VNF_NAME: + get_input: vnf_name + network_ipam_refs: + - UNSUPPORTED_RESOURCE_template_NetworkIpam_Internal2 + int2_security_group: + type: org.openecomp.resource.vfc.rules.nodes.heat.network.neutron.SecurityRules + properties: + name: + str_replace: + template: $VNF_NAME_$SECGROUPNAME + params: + $SECGROUPNAME: + get_input: int2_sec_group_name + $VNF_NAME: + get_input: vnf_name + rules: + - protocol: tcp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: udp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: 132 + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: icmp + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + - protocol: tcp + ethertype: IPv6 + port_range_max: 65535 + remote_ip_prefix: ::/0 + direction: egress + port_range_min: 1 + - protocol: udp + ethertype: IPv6 + port_range_max: 65535 + remote_ip_prefix: ::/0 + direction: egress + port_range_min: 1 + - protocol: 132 + ethertype: IPv6 + port_range_max: 65535 + remote_ip_prefix: ::/0 + direction: egress + port_range_min: 1 + - protocol: icmp + ethertype: IPv6 + remote_ip_prefix: ::/0 + direction: egress + - protocol: tcp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: udp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: 132 + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: icmp + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + - protocol: tcp + ethertype: IPv6 + port_range_max: 65535 + remote_ip_prefix: ::/0 + direction: ingress + port_range_min: 1 + - protocol: udp + ethertype: IPv6 + port_range_max: 65535 + remote_ip_prefix: ::/0 + direction: ingress + port_range_min: 1 + - protocol: 132 + ethertype: IPv6 + port_range_max: 65535 + remote_ip_prefix: ::/0 + direction: ingress + port_range_min: 1 + - protocol: icmp + ethertype: IPv6 + remote_ip_prefix: ::/0 + direction: ingress + requirements: + - port: + capability: attachment_fsb_FSB1_Internal2 + node: abstract_fsb + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_fsb_FSB2_Internal2 + node: abstract_fsb_1 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_ncb_NCB1_Internal2 + node: abstract_ncb + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_ncb_NCB2_Internal2 + node: abstract_ncb_1 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb1_Internal2 + node: abstract_gpb + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb2_Internal2 + node: abstract_gpb_1 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb3_Internal2 + node: abstract_gpb_2 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb4_Internal2 + node: abstract_gpb_3 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb5_Internal2 + node: abstract_gpb_4 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb6_Internal2 + node: abstract_gpb_5 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb7_Internal2 + node: abstract_gpb_6 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb8_Internal2 + node: abstract_gpb_7 + relationship: org.openecomp.relationships.AttachesTo + abstract_fsb_1: + type: org.openecomp.resource.abstract.nodes.fsb_1 + directives: + - substitutable + properties: + port_FSB_OAM_network_role_tag: + - oam + vm_flavor_name: + get_input: fsb_flavor_name + port_FSB_OAM_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: true + floating_ip_count_required: + is_required: false + port_FSB2_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_FSB2_Internal2_security_groups: + - - int2_security_group + compute_fsb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + port_FSB2_Internal1_mac_address: + get_input: fsb2_Internal1_mac + compute_fsb_scheduler_hints: + - group: VM_Affinity_group + compute_fsb_name: + - get_input: fsb_name_1 + port_FSB2_Internal1_security_groups: + - - int1_security_group + port_FSB_OAM_network: + - get_input: oam_net_name + port_FSB_OAM_security_groups: + - - oam_security_group + port_FSB2_Internal1_network: + - Internal1_net + port_FSB2_Internal2_mac_address: + get_input: fsb2_Internal1_mac + port_FSB2_Internal2_mac_requirements: + mac_count_required: + is_required: true + port_FSB_OAM_mac_requirements: + mac_count_required: + is_required: false + port_FSB2_Internal2_replacement_policy: + - AUTO + port_FSB2_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_FSB_OAM_replacement_policy: + - AUTO + port_FSB2_Internal2_network: + - Internal2_net + port_FSB2_Internal1_replacement_policy: + - AUTO + compute_fsb_availability_zone: + - get_input: availability_zone_1 + port_FSB_OAM_fixed_ips: + - ip_address: + get_input: fsb_oam_ip_1 + port_FSB2_Internal1_mac_requirements: + mac_count_required: + is_required: true + service_template_filter: + substitute_service_template: Nested_fsb_1ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: fsb + nfc_naming_code: fsb + requirements: + - link_fsb_FSB2_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_fsb_FSB2_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + oam_security_group: + type: org.openecomp.resource.vfc.rules.nodes.heat.network.neutron.SecurityRules + properties: + name: + str_replace: + template: $VNF_NAME_$SECGROUPNAME + params: + $SECGROUPNAME: + get_input: oam_sec_group_name + $VNF_NAME: + get_input: vnf_name + rules: + - protocol: tcp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: udp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: icmp + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + - protocol: tcp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: udp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: icmp + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + requirements: + - port: + capability: attachment_fsb_FSB_OAM + node: abstract_fsb + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_fsb_FSB_OAM + node: abstract_fsb_1 + relationship: org.openecomp.relationships.AttachesTo + groups: + vmme_gpb3_group: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/vmme_gpb3.yml + description: | + Module HOT template to create vmme 1-8 gpb + members: + - abstract_gpb + - abstract_gpb_1 + - abstract_gpb_2 + - abstract_gpb_3 + - abstract_gpb_4 + - abstract_gpb_5 + - abstract_gpb_6 + - abstract_gpb_7 + base_vmme_group: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/base_vmme.yml + description: | + Base HOT template to create vmme 2 fsb 2 ncb + members: + - int2_security_group + - oam_security_group + - gtp_security_group + - Internal2_net + - int1_security_group + - Internal1_net + - abstract_ncb + - abstract_ncb_1 + - abstract_fsb + - abstract_fsb_1 + base_vmme_volume_group: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/base_vmme_volume.yml + description: HOT template for vMME Cinder Volumes + members: + - fsb_volume_0 + - fsb_volume_1 + vmme_gpb1_group: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/vmme_gpb1.yml + description: | + Module HOT template to create vmme 1-8 gpb + members: + - abstract_gpb + - abstract_gpb_1 + - abstract_gpb_2 + - abstract_gpb_3 + - abstract_gpb_4 + - abstract_gpb_5 + - abstract_gpb_6 + - abstract_gpb_7 + vmme_gpb4_group: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/vmme_gpb4.yml + description: | + Module HOT template to create vmme 1-8 gpb + members: + - abstract_gpb + - abstract_gpb_1 + - abstract_gpb_2 + - abstract_gpb_3 + - abstract_gpb_4 + - abstract_gpb_5 + - abstract_gpb_6 + - abstract_gpb_7 + vmme_gpb2_group: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/vmme_gpb2.yml + description: | + Module HOT template to create vmme 1-8 gpb + members: + - abstract_gpb + - abstract_gpb_1 + - abstract_gpb_2 + - abstract_gpb_3 + - abstract_gpb_4 + - abstract_gpb_5 + - abstract_gpb_6 + - abstract_gpb_7 + VM_Affinity_group: + type: tosca.groups.Root + members: + - abstract_ncb + - abstract_ncb_1 + - abstract_vlc + - abstract_fsb + - abstract_fsb_1 + - abstract_gpb + - abstract_gpb_1 + - abstract_gpb_2 + - abstract_gpb_3 + - abstract_gpb_4 + - abstract_gpb_5 + - abstract_gpb_6 + - abstract_gpb_7 + vmme_vlc_group: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/vmme_vlc.yml + description: | + Module HOT template to create vmme 8 vlcs + members: + - abstract_vlc + outputs: + oam_management_v4_address: + description: ID of OAM VIP to be provisioned in A&AI + value: + get_input: vip_oam_management_v4_ip + fsb_volume_id_1: + description: ID of Cinder Volume for FSB2 + value: fsb_volume_1 + security_group_sctp_b_id: + description: ID of sctpb_security_group + value: UNSUPPORTED_RESOURCE_sctpb_security_group + service_instance_id_0: + description: ID of Service Instance used for vLCs + value: UNSUPPORTED_RESOURCE_template_ServiceInstance_VLC + security_group_sctp_a_id: + description: ID of sctpa_security_group + value: UNSUPPORTED_RESOURCE_sctpa_security_group + fsb_volume_id_0: + description: ID of Cinder Volume for FSB1 + value: fsb_volume_0 + policies: + VM_Affinity_policy: + type: org.openecomp.policies.placement.Antilocate + properties: + container_type: host + targets: + - VM_Affinity_group @@ -0,0 +1,3585 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +metadata: + template_name: Main +imports: +- openecomp_heat_index: + file: openecomp-heat/_index.yml +- GlobalSubstitutionTypes: + file: GlobalSubstitutionTypesServiceTemplate.yaml +topology_template: + inputs: + vlc4_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc4_Internal2 + default: 00:80:37:0E:04:12 + sctp-a-egress_rule_application: + hidden: false + immutable: false + type: string + description: application for the SecurityGroup + default: any + sctp-b-ipv6-ingress-src_start_port: + hidden: false + immutable: false + type: float + description: IPV6 start port + default: 0 + constraints: + - in_range: + - 0 + - 65535 + ncb1_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to ncb1_Internal2 + default: 00:80:37:0E:09:12 + sctp-a-ipv6-ingress_ethertype: + hidden: false + immutable: false + type: string + description: IPV6 ethertype + default: IPv4 + gpb8_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb8_Internal1 + default: 00:80:37:0E:10:22 + sctp-a-ingress_rule_protocol: + hidden: false + immutable: false + type: string + description: protocol for the SecurityGroup + default: any + sctp-b-display_name: + hidden: false + immutable: false + type: string + description: display_name for the SecurityGroup + default: epc-sctp-b-ipv4v6-sec-group + sctp-a-ingress_ethertype: + hidden: false + immutable: false + type: string + description: ethertype for the SecurityGroup + default: IPv4 + sctp-a-egress-src_start_port: + hidden: false + immutable: false + type: float + description: start_port for the SecurityGroup + default: 0 + constraints: + - in_range: + - 0 + - 65535 + ncb_flavor_name: + hidden: false + immutable: false + type: string + description: Flavor to use for servers ncb + default: nv.c8r32d1 + vlc3_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc3_Internal1 + default: 00:80:37:0E:03:12 + Internal2_net_cidr: + hidden: false + immutable: false + type: string + description: CIDR for internal-2 network + default: 169.255.0.0 + sctp-a-egress-dst_start_port: + hidden: false + immutable: false + type: float + description: start_port for the SecurityGroup + default: 0 + constraints: + - in_range: + - 0 + - 65535 + sctp-a-egress_ethertype: + hidden: false + immutable: false + type: string + description: ethertype for the SecurityGroup + default: IPv4 + gpb4_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb4_Internal2 + default: 00:80:37:0E:0C:22 + sctp-b-ipv6-egress_rule_application: + hidden: false + immutable: false + type: string + description: IPV6 Rule-application + default: any + vlc8_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc8_Internal1 + default: 00:80:37:0E:08:12 + sctp-b-ipv6-ingress-src_end_port: + hidden: false + immutable: false + type: float + description: IPV6 ending port for destination + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + fsb2_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to fsb2_Internal1 + default: 00:80:37:0E:0D:12 + sctp-b-name: + hidden: false + immutable: false + type: string + description: name for the SecurityGroup + default: epc-sctp-b-ipv4v6-sec-group + sctp-b-ipv6-egress_ethertype: + hidden: false + immutable: false + type: string + description: IPV6 ethertype + default: IPv4 + internal_net_id_1: + hidden: false + immutable: false + type: string + description: UUID of Internal2_net + default: e3397c69-a942-49aa-81cb-fb91ff34abc8 + sctp-a-egress_dst_subnet_prefix: + hidden: false + immutable: false + type: string + description: ip_prefix for the SecurityGroup + default: 0.0.0.0 + internal_net_id_0: + hidden: false + immutable: false + type: string + description: UUID of Internal1_net + default: 871de971-22ac-47b6-befb-50e7d4cb67ea + sctp_b_net_fqdn: + hidden: false + immutable: false + type: string + description: Network FQDN SCTPB + default: default-domain:vMME-24474-Ericsson-WTC-Lab-vLCP1-4:vMME-24474-Ericsson-WTC-Lab-vLCP1-4_gn_SCTPB_net_1 + sctp-a-ipv6-ingress_rule_application: + hidden: false + immutable: false + type: string + description: IPV6 Rule-application + default: any + sctp-b-ipv6-ingress_src_subnet_prefix_len: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix length + default: '0' + ncb_name_1: + hidden: false + immutable: false + type: string + description: Name of ncb2 + default: zrdm3mmex59ncb002 + ncb_name_0: + hidden: false + immutable: false + type: string + description: Name of ncb1 + default: zrdm3mmex59ncb001 + vlc_st_virtualization_type: + hidden: false + immutable: false + type: string + description: Indicates virtualization type + default: virtual-machine + vlc2_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc2_Internal1 + default: 00:80:37:0E:02:12 + sctp-b-ingress-dst_start_port: + hidden: false + immutable: false + type: float + description: start_port for the SecurityGroup + default: 0 + constraints: + - in_range: + - 0 + - 65535 + sctp-a-display_name: + hidden: false + immutable: false + type: string + description: display_name for the SecurityGroup + default: epc-sctp-a-ipv4v6-sec-group + sctp-b-ingress_rule_application: + hidden: false + immutable: false + type: string + description: application for the SecurityGroup + default: any + int2_sec_group_name: + hidden: false + immutable: false + type: string + description: SecurityGroup name for internal-2 + default: int2-sec-group + gpb5_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb5_Internal2 + default: 00:80:37:0E:0D:22 + sctp-a-egress-dst_subnet_prefix_v6: + hidden: false + immutable: false + type: string + description: dst subnet + default: '::' + OS::stack_name: + type: string + required: false + sctp-b-egress-src_end_port: + hidden: false + immutable: false + type: float + description: end_port for the SecurityGroup + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + Internal2_shared: + hidden: false + immutable: false + type: string + description: Whether Shared or private internal-2 network + default: false + sctp-a-ipv6-egress_rule_protocol: + hidden: false + immutable: false + type: string + description: IPV6 Rule-protocol + default: any + Internal2_rpf: + hidden: false + immutable: false + type: string + description: Reverse Path Forwarding Enabled/Disabled internal-2 network + default: disable + vlc5_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc5_Internal2 + default: 00:80:37:0E:05:12 + sctp-a-ipv6-egress_src_end_port: + hidden: false + immutable: false + type: string + description: IPV6 end port + default: 65535 + Internal1_forwarding_mode: + hidden: false + immutable: false + type: string + description: L2 or L3 forwarding mode for internal-1 network + default: l2 + gpb3_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb3_Internal1 + default: 00:80:37:0E:0B:22 + vip_oam_management_v4_ip: + hidden: false + immutable: false + type: string + description: IP address of OAM service IP address to be provisioned in A&AI + default: 107.239.72.176 + vmi_oam_preference_primary: + hidden: false + immutable: false + type: float + description: Preference for primary interface/port + default: 200 + sctp-b-src_subnet_prefix_v6: + hidden: false + immutable: false + type: string + description: ip_prefix for the SecurityGroup + default: '::' + sctp-a-egress_dst_subnet_prefix_len: + hidden: false + immutable: false + type: float + description: ip_prefix_len for the SecurityGroup + default: '0' + constraints: + - in_range: + - 0 + - 32 + security_group_sctp_b_id: + hidden: false + immutable: false + type: string + description: Security Group UUID for output + default: 92a4ae54-1733-4d03-b488-f178bb9f7b82 + Internal2_forwarding_mode: + hidden: false + immutable: false + type: string + description: L2 or L3 forwarding mode for internal-2 network + default: l2 + sctp-a-ipv6-egress_dst_end_port: + hidden: false + immutable: false + type: string + description: IPV6 end port + default: 65535 + sctp-b-egress-dst_subnet_prefix_v6: + hidden: false + immutable: false + type: string + description: dst subnet + default: '::' + sctp-b-egress_dst_subnet_prefix: + hidden: false + immutable: false + type: string + description: ip_prefix for the SecurityGroup + default: 0.0.0.0 + security_group_oam_id: + hidden: false + immutable: false + type: string + description: Security Group UUID for output + default: 4ae4aa74-3e8e-4f2b-8b5f-a8bd262da96b + gpb2_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb2_Internal1 + default: 00:80:37:0E:0A:22 + security_group_int1_id: + hidden: false + immutable: false + type: string + description: UUID of Internal1_net security group + default: 94c62578-835d-4801-9372-70a2cfb22683 + sctp-a-egress_action: + hidden: false + immutable: false + type: string + description: simple_action for the SecurityGroup + default: pass + oam_net_fqdn: + hidden: false + immutable: false + type: string + description: Network FQDN OAM + default: default-domain:vMME-24474-Ericsson-WTC-Lab-vLCP1-4:vMME-24474-Ericsson-WTC-Lab-vLCP1-4_OAM_net_1 + ncb2_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to ncb2_Internal2 + default: 00:80:37:0E:0F:12 + vlc_st_interface_type_sctp_a: + hidden: false + immutable: false + type: string + description: service_interface_type for the ServiceTemplate + default: left + gpb3_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb3_Internal2 + default: 00:80:37:0E:0B:22 + vlc_st_interface_type_sctp_b: + hidden: false + immutable: false + type: string + description: service_interface_type for the ServiceTemplate + default: right + gpb1_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb1_Internal2 + default: 00:80:37:0E:09:22 + oam_net_name: + hidden: false + immutable: false + type: string + description: Network Name OAM + default: vMME-24474-Ericsson-WTC-Lab-vLCP1-4_OAM_net_1 + sctp-b-ingress-src_start_port: + hidden: false + immutable: false + type: float + description: start_port for the SecurityGroup + default: 0 + constraints: + - in_range: + - 0 + - 65535 + fsb1_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to fsb1_Internal1 + default: 00:80:37:0E:0B:12 + sctp-b-ingress_dst_addresses: + hidden: false + immutable: false + type: string + description: security_group for the SecurityGroup + default: local + vlc_st_interface_type_oam: + hidden: false + immutable: false + type: string + description: service_interface_type for the ServiceTemplate + default: management + shc_monitor_type: + hidden: false + immutable: false + type: string + description: health check + default: PING + oam_sec_group_name: + hidden: false + immutable: false + type: string + description: SecurityGroup name for OAM + default: oam-sec-group + Internal2_net_gateway: + hidden: false + immutable: false + type: string + description: gateway for internal-2 network + default: 169.255.0.3 + evac_policy: + hidden: false + immutable: false + type: string + description: CMHA Policy + default: Evacuate + server_group_id_0: + hidden: false + immutable: false + type: string + description: ID of Anti-Affinity Policy-based Server Group + default: ec99a73d-38f8-4280-8103-ba8ee584629f + vlc8_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc8_Internal2 + default: 00:80:37:0E:08:12 + sctp-b-ipv6-egress_rule_protocol: + hidden: false + immutable: false + type: string + description: IPV6 Rule-protocol + default: any + gtp_sec_group_name: + hidden: false + immutable: false + type: string + description: SecurityGroup name for GTP + default: gtp-sec-group + vlc_sctp_b_v6_ip_2: + hidden: false + immutable: false + type: string + description: Static IP vlc3 SCTPB + default: fd00:200:200:5:0:0:0:24 + vlc_sctp_b_v6_ip_1: + hidden: false + immutable: false + type: string + description: Static IP vlc2 SCTPB + default: fd00:200:200:5:0:0:0:17 + sctp-a-ipv6-egress_dst_subnet_prefix: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix + default: 0.0.0.0 + vlc_sctp_b_v6_ip_0: + hidden: false + immutable: false + type: string + description: Static IP vlc1 SCTPB + default: fd00:200:200:5:0:0:0:16 + vlc4_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc4_Internal1 + default: 00:80:37:0E:04:12 + vlc_sctp_b_v6_ip_6: + hidden: false + immutable: false + type: string + description: Static IP vlc7 SCTPB + default: fd00:200:200:5:0:0:0:28 + vlc_sctp_b_v6_ip_5: + hidden: false + immutable: false + type: string + description: Static IP vlc6 SCTPB + default: fd00:200:200:5:0:0:0:27 + vlc_sctp_b_v6_ip_4: + hidden: false + immutable: false + type: string + description: Static IP vlc5 SCTPB + default: fd00:200:200:5:0:0:0:26 + vlc_sctp_b_v6_ip_3: + hidden: false + immutable: false + type: string + description: Static IP vlc4 SCTPB + default: fd00:200:200:5:0:0:0:25 + sctp_b_net_name: + hidden: false + immutable: false + type: string + description: Network Name SCTPB + default: vMME-24474-Ericsson-WTC-Lab-vLCP1-4_gn_SCTPB_net_1 + sctp-b-ipv6-egress_dst_subnet_prefix_len: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix + default: '0' + sctp-a-egress_rule_protocol: + hidden: false + immutable: false + type: string + description: protocol for the SecurityGroup + default: any + Internal1_shared: + hidden: false + immutable: false + type: string + description: Whether Shared or private internal-1 network + default: false + shc_url_path: + hidden: false + immutable: false + type: string + description: health check + default: local-ip + Internal2_net_cidr_len: + hidden: false + immutable: false + type: string + description: CIDR length for internal-2 network + default: 17 + sctp-a-ingress-src_end_port: + hidden: false + immutable: false + type: float + description: end_port for the SecurityGroup + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + sctp-b-ipv6-ingress_src_subnet_prefix: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix + default: 0.0.0.0 + sctp-a-egress-dst_end_port: + hidden: false + immutable: false + type: float + description: end_port for the SecurityGroup + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + sctp-a-ingress_action: + hidden: false + immutable: false + type: string + description: simple_action for the SecurityGroup + default: pass + sctp-b-ipv6-ingress_action: + hidden: false + immutable: false + type: string + description: IPV6 action + default: pass + vlc_st_service_type: + hidden: false + immutable: false + type: string + description: service type + default: firewall + sctp-b-ipv6-ingress-dst_start_port: + hidden: false + immutable: false + type: string + description: IPV6 starting port for destination + default: 0 + vlc_st_availability_zone: + hidden: false + immutable: false + type: string + description: Indicates availability zone is enabled + default: true + vlc7_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc7_Internal1 + default: 00:80:37:0E:07:12 + fsb_volume_image_name_1: + label: MME_FSB2 + hidden: false + immutable: false + type: string + description: volume name + default: MME_FSB2_1_3_GA.qcow2 + vlc_oam_ip_6: + hidden: false + immutable: false + type: string + description: Static IP vlc7 OAM + default: 107.239.72.151 + sctp-a-ipv6-ingress_src_subnet_prefix_len: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix length + default: '0' + vlc_oam_ip_7: + hidden: false + immutable: false + type: string + description: Static IP vlc8 OAM + default: 107.239.72.152 + Internal1_allow_transit: + hidden: false + immutable: false + type: string + description: Allow/disallow transit internal-1 network + default: true + vlc_oam_ip_2: + hidden: false + immutable: false + type: string + description: Static IP vlc3 OAM + default: 107.239.72.157 + vlc_oam_ip_3: + hidden: false + immutable: false + type: string + description: Static IP vlc4 OAM + default: 107.239.72.158 + vlc_gtp_ip_0: + hidden: false + immutable: false + type: string + description: Static IP vlc1 GTP + default: 107.243.47.208 + vlc_oam_ip_4: + hidden: false + immutable: false + type: string + description: Static IP vlc5 OAM + default: 107.239.72.149 + fsb_volume_image_name_0: + label: MME_FSB1 + hidden: false + immutable: false + type: string + description: volume name + default: MME_FSB1_1_3_GA.qcow2 + vlc_gtp_ip_1: + hidden: false + immutable: false + type: string + description: Static IP vlc2 GTP + default: 107.243.47.209 + vlc_oam_ip_5: + hidden: false + immutable: false + type: string + description: Static IP vlc6 OAM + default: 107.239.72.150 + vlc_gtp_ip_2: + hidden: false + immutable: false + type: string + description: Static IP vlc3 GTP + default: 107.243.47.216 + vlc_name_6: + hidden: false + immutable: false + type: string + description: Name of vlc7 + default: zrdm3mmex59vlc007 + vlc_gtp_ip_3: + hidden: false + immutable: false + type: string + description: Static IP vlc4 GTP + default: 107.243.47.217 + vlc_name_7: + hidden: false + immutable: false + type: string + description: Name of vlc8 + default: zrdm3mmex59vlc008 + security_group_sctp_a_id: + hidden: false + immutable: false + type: string + description: Security Group UUID for output + default: 3cd8a524-77ff-4980-ae2a-d19ba70e0511 + vlc_gtp_ip_4: + hidden: false + immutable: false + type: string + description: Static IP vlc5 GTP + default: 107.243.47.218 + vlc_gtp_ip_5: + hidden: false + immutable: false + type: string + description: Static IP vlc6 GTP + default: 107.243.47.219 + vlc_gtp_ip_6: + hidden: false + immutable: false + type: string + description: Static IP vlc7 GTP + default: 107.243.47.220 + vlc_name_2: + hidden: false + immutable: false + type: string + description: Name of vlc3 + default: zrdm3mmex59vlc003 + vlc_gtp_ip_7: + hidden: false + immutable: false + type: string + description: Static IP vlc8 GTP + default: 107.243.47.221 + vlc_name_3: + hidden: false + immutable: false + type: string + description: Name of vlc4 + default: zrdm3mmex59vlc004 + vlc_name_4: + hidden: false + immutable: false + type: string + description: Name of vlc5 + default: zrdm3mmex59vlc005 + vlc_name_5: + hidden: false + immutable: false + type: string + description: Name of vlc6 + default: zrdm3mmex59vlc006 + fsb_volume_id_1: + hidden: false + immutable: false + type: string + description: ID of Cinder Volume for FSB2 + default: 5bd0560c-bfd0-47dc-a84a-554e2698c925 + sctp-a-ipv6-ingress_action: + hidden: false + immutable: false + type: string + description: IPV6 action + default: pass + vlc_name_0: + hidden: false + immutable: false + type: string + description: Name of vlc1 + default: zrdm3mmex59vlc001 + vlc_name_1: + hidden: false + immutable: false + type: string + description: Name of vlc2 + default: zrdm3mmex59vlc002 + vlc_oam_route_prefixes: + hidden: false + immutable: false + type: json + description: Route prefixes for static routing on OAM + sctp-b-egress_rule_application: + hidden: false + immutable: false + type: string + description: application for the SecurityGroup + default: any + vlc_oam_ip_0: + hidden: false + immutable: false + type: string + description: Static IP vlc1 OAM + default: 107.239.72.155 + vlc_oam_ip_1: + hidden: false + immutable: false + type: string + description: Static IP vlc2 OAM + default: 107.239.72.156 + vlc6_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc6_Internal1 + default: 00:80:37:0E:06:12 + fsb_volume_id_0: + hidden: false + immutable: false + type: string + description: ID of Cinder Volume for FSB1 + default: 27baa6a0-b701-4795-bf5e-4f546b350b1f + sctp-b-egress-dst_end_port: + hidden: false + immutable: false + type: float + description: end_port for the SecurityGroup + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + gpb2_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb2_Internal2 + default: 00:80:37:0E:0A:22 + sctp-a-ipv6-egress_rule_application: + hidden: false + immutable: false + type: string + description: IPV6 Rule-application + default: any + sctp-b-ipv6-egress_src_start_port: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix + default: 0 + Internal2_allow_transit: + hidden: false + immutable: false + type: string + description: Allow/disallow transit internal-2 network + default: true + fsb_volume_size: + label: volume size + hidden: false + immutable: false + type: float + description: volume size 320GB + default: 320 + constraints: + - in_range: + - 0 + - 340 + sctp-b-IPv6_ethertype: + hidden: false + immutable: false + type: string + description: IPV6 ethertype + default: IPv6 + gtp_net_fqdn: + hidden: false + immutable: false + type: string + description: Network FQDN GTP + default: default-domain:vMME-24474-Ericsson-WTC-Lab-vLCP1-4:vMME-24474-Ericsson-WTC-Lab-vLCP1-4_gn_GTP_net_1 + ncb2_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to ncb2_Internal1 + default: 00:80:37:0E:0F:12 + sctp-b-ingress_rule_protocol: + hidden: false + immutable: false + type: string + description: protocol for the SecurityGroup + default: any + sctp-b-ingress_action: + hidden: false + immutable: false + type: string + description: simple_action for the SecurityGroup + default: pass + sctp-b-egress_src_addresses: + hidden: false + immutable: false + type: string + description: security_group for the SecurityGroup + default: local + gpb7_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb7_Internal2 + default: 00:80:37:0E:0F:22 + sctp-a-ipv6-ingress-dst_start_port: + hidden: false + immutable: false + type: string + description: IPV6 starting port for destination + default: 0 + gtp_net_name: + hidden: false + immutable: false + type: string + description: Network Name GTP + default: vMME-24474-Ericsson-WTC-Lab-vLCP1-4_gn_GTP_net_1 + sctp-b-ipv6-ingress_rule_application: + hidden: false + immutable: false + type: string + description: IPV6 Rule-application + default: any + domain_name: + hidden: false + immutable: false + type: string + description: Unique name of vMME contrail domain + default: default-domain + vlc5_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc5_Internal1 + default: 00:80:37:0E:05:12 + sctp-a-egress_src_addresses: + hidden: false + immutable: false + type: string + description: security_group for the SecurityGroup + default: local + sctp-b-egress-src_start_port: + hidden: false + immutable: false + type: float + description: start_port for the SecurityGroup + default: 0 + constraints: + - in_range: + - 0 + - 65535 + shc_enabled: + hidden: false + immutable: false + type: string + description: health check + default: true + sctp-b-ipv6-ingress-dst_end_port: + hidden: false + immutable: false + type: string + description: IPV6 end port + default: 65535 + sctp-b-dst_subnet_prefix_v6: + hidden: false + immutable: false + type: string + description: ip_prefix for the SecurityGroup + default: '::' + sctp_a_net_fqdn: + hidden: false + immutable: false + type: string + description: Network FQDN SCTPA + default: default-domain:vMME-24474-Ericsson-WTC-Lab-vLCP1-4:vMME-24474-Ericsson-WTC-Lab-vLCP1-4_gn_SCTPA_net_1 + security_group_gtp_id: + hidden: false + immutable: false + type: string + description: Security Group UUID for output + default: e8ad3fe2-5f95-43e4-bbcc-da97b1c22588 + sctp-a-ipv6-ingress_src_subnet_prefix: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix + default: 0.0.0.0 + fsb_name_1: + hidden: false + immutable: false + type: string + description: Name of fsb1 + default: zrdm3mmex59fsb002 + sctp-b-egress-dst_start_port: + hidden: false + immutable: false + type: float + description: start_port for the SecurityGroup + default: 0 + constraints: + - in_range: + - 0 + - 65535 + fsb_name_0: + hidden: false + immutable: false + type: string + description: Name of fsb1 + default: zrdm3mmex59fsb001 + sctp_a_net_name: + hidden: false + immutable: false + type: string + description: Network Name SCTPA + default: vMME-24474-Ericsson-WTC-Lab-vLCP1-4_gn_SCTPA_net_1 + sctp-b-egress_dst_subnet_prefix_len: + hidden: false + immutable: false + type: float + description: ip_prefix_len for the SecurityGroup + default: '0' + constraints: + - in_range: + - 0 + - 32 + gpb1_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb1_Internal1 + default: 00:80:37:0E:09:22 + sctp-a-ingress-dst_start_port: + hidden: false + immutable: false + type: float + description: start_port for the SecurityGroup + default: 0 + constraints: + - in_range: + - 0 + - 65535 + fsb1_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to fsb1_Internal2 + default: 00:80:37:0E:0B:12 + vlc_st_service_mode: + hidden: false + immutable: false + type: string + description: service mode + default: in-network-nat + sctp-a-ipv6-egress_ethertype: + hidden: false + immutable: false + type: string + description: IPV6 ethertype + default: IPv4 + sctp-a-egress-src_end_port: + hidden: false + immutable: false + type: float + description: end_port for the SecurityGroup + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + sctp-b-egress_action: + hidden: false + immutable: false + type: string + description: simple_action for the SecurityGroup + default: pass + sctp-a-ingress-src_subnet_prefix_len: + hidden: false + immutable: false + type: float + description: ip_prefix_len for the SecurityGroup + default: '0' + constraints: + - in_range: + - 0 + - 32 + sctp-a-ipv6-ingress-src_start_port: + hidden: false + immutable: false + type: float + description: IPV6 start port + default: 0 + constraints: + - in_range: + - 0 + - 65535 + vf_module_id: + hidden: false + immutable: false + type: string + description: the vf_module_id for this instance. UUID provided by ECOMP + default: TWO + Internal1_net_cidr: + hidden: false + immutable: false + type: string + description: CIDR for internal-1 network + default: 169.253.0.0 + fsb_flavor_name: + hidden: false + immutable: false + type: string + description: Flavor to use for servers fsb1 + default: nv.c8r32d1 + sctp_rule_protocol: + hidden: false + immutable: false + type: string + description: protocol for the SecurityGroup + default: 132 + vnf_name: + hidden: false + immutable: false + type: string + description: the vnf_name for this instance. provided by ECOMP + default: zrdm3mmex59 + sctp-a-IPv6_ethertype: + hidden: false + immutable: false + type: string + description: IPV6 ethertype + default: IPv6 + vlc_sctp_b_v6_ip_7: + hidden: false + immutable: false + type: string + description: Static IP vlc8 SCTPB + default: fd00:200:200:5:0:0:0:29 + vlc6_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc6_Internal2 + default: 00:80:37:0E:06:12 + sctp-b-ingress-dst_end_port: + hidden: false + immutable: false + type: float + description: end_port for the SecurityGroup + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + vlc7_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc7_Internal2 + default: 00:80:37:0E:07:12 + sctp-a-ipv6-ingress-src_end_port: + hidden: false + immutable: false + type: float + description: IPV6 ending port for destination + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + vlc_flavor_name: + hidden: false + immutable: false + type: string + description: Flavor to use for servers vlc + default: nd.c16r64d1 + sctp-b-ipv6-egress_src_addresses: + hidden: false + immutable: false + type: string + description: IPV6 source + default: local + vlc_st_interface_type_int1: + hidden: false + immutable: false + type: string + description: service_interface_type for the ServiceTemplate + default: other1 + availability_zone_0: + hidden: false + immutable: false + type: string + description: cluster for spawnning fsb instances + default: rdm3-kvm-az02 + service_instance_id_0: + hidden: false + immutable: false + type: string + description: UUID of service instance for vLCs + default: 77c67cc8-d15f-47bc-aeb1-8d65d09e917a + availability_zone_1: + hidden: false + immutable: false + type: string + description: cluster for spawnning ncb instances + default: rdm3-kvm-az02 + vlc_st_interface_type_int2: + hidden: false + immutable: false + type: string + description: service_interface_type for the ServiceTemplate + default: other2 + sctp-a-ipv6-egress-dst_start_port: + hidden: false + immutable: false + type: string + description: IPV6 start port + default: 0 + sctp-a-ipv6-egress_dst_subnet_prefix_len: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix + default: '0' + vlc_sctp_a_ip_0: + hidden: false + immutable: false + type: string + description: Static IP vlc1 SCTPA + default: 107.243.47.144 + vlc_sctp_b_route_prefixes: + hidden: false + immutable: false + type: json + description: Route prefixes for static routing on SCTPB + vlc1_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc1_Internal1 + default: 00:80:37:0E:01:12 + sctp-b-ipv6-egress_src_end_port: + hidden: false + immutable: false + type: string + description: IPV6 end port + default: 65535 + sctp-a-ipv6-egress_src_addresses: + hidden: false + immutable: false + type: string + description: IPV6 source + default: local + vlc_sctp_a_ip_7: + hidden: false + immutable: false + type: string + description: Static IP vlc8 SCTPA + default: 107.243.47.157 + sctp-a-ingress-src_subnet_prefix_v6: + hidden: false + immutable: false + type: string + description: src subnet + default: '::' + vlc_sctp_a_ip_6: + hidden: false + immutable: false + type: string + description: Static IP vlc7 SCTPA + default: 107.243.47.156 + vlc_sctp_a_ip_5: + hidden: false + immutable: false + type: string + description: Static IP vlc6 SCTPA + default: 107.243.47.155 + sctp-a-ingress-dst_end_port: + hidden: false + immutable: false + type: float + description: end_port for the SecurityGroup + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + vlc_sctp_a_ip_4: + hidden: false + immutable: false + type: string + description: Static IP vlc5 SCTPA + default: 107.243.47.154 + vlc_sctp_a_ip_3: + hidden: false + immutable: false + type: string + description: Static IP vlc4 SCTPA + default: 107.243.47.153 + vlc_sctp_a_ip_2: + hidden: false + immutable: false + type: string + description: Static IP vlc3 SCTPA + default: 107.243.47.152 + vlc_sctp_a_ip_1: + hidden: false + immutable: false + type: string + description: Static IP vlc2 SCTPA + default: 107.243.47.145 + gpb6_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb6_Internal2 + default: 00:80:37:0E:0E:22 + security_group_int2_id: + hidden: false + immutable: false + type: string + description: UUID of Internal1_net security group + default: 1361f069-baf2-4b76-b321-7f68ba26c369 + Internal2_dhcp: + hidden: false + immutable: false + type: string + description: Whether DHCP/static IP addressing on internal-2 network + default: false + sctp-a-dst_subnet_prefix_v6: + hidden: false + immutable: false + type: string + description: ip_prefix for the SecurityGroup + default: '::' + pxe_image_name: + hidden: false + immutable: false + type: string + description: Name of image to use for server ncb + default: MME_PXE-Boot_1_3_GA.qcow2 + vlc_st_interface_type_gtp: + hidden: false + immutable: false + type: string + description: service_interface_type for the ServiceTemplate + default: other0 + ncb1_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to ncb1_Internal1 + default: 00:80:37:0E:09:12 + vlc_gtp_route_prefixes: + hidden: false + immutable: false + type: json + description: Route prefixes for static routing on GTP + int1_sec_group_name: + hidden: false + immutable: false + type: string + description: SecurityGroup name for internal-1 + default: int1-sec-group + vmi_oam_preference_secondary: + hidden: false + immutable: false + type: float + description: Preference for secondary interface/port + default: 100 + Internal1_dhcp: + hidden: false + immutable: false + type: string + description: Whether DHCP/static IP addressing on internal-1 network + default: false + fsb2_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to fsb2_Internal2 + default: 00:80:37:0E:0D:12 + Internal1_net_cidr_len: + hidden: false + immutable: false + type: string + description: CIDR length for internal-1 network + default: 17 + sctp-a-ingress_dst_addresses: + hidden: false + immutable: false + type: string + description: security_group for the SecurityGroup + default: local + sctp-b-ingress-src_subnet_prefix_len: + hidden: false + immutable: false + type: float + description: ip_prefix_len for the SecurityGroup + default: '0' + constraints: + - in_range: + - 0 + - 32 + fsb_oam_ip_1: + hidden: false + immutable: false + type: string + description: IP address of OAM vNIC for FSB2 + default: 107.239.72.154 + fsb_oam_ip_0: + hidden: false + immutable: false + type: string + description: IP address of OAM vNIC for FSB1 + default: 107.239.72.153 + shc_timeout: + hidden: false + immutable: false + type: string + description: health check + default: 5 + vlc_st_version: + hidden: false + immutable: false + type: string + description: Indicates service version + default: 2 + sctp-a-src_subnet_prefix_v6: + hidden: false + immutable: false + type: string + description: ip_prefix for the SecurityGroup + default: '::' + sctp-a-ingress_rule_application: + hidden: false + immutable: false + type: string + description: application for the SecurityGroup + default: any + sctp-b-egress_ethertype: + hidden: false + immutable: false + type: string + description: ethertype for the SecurityGroup + default: IPv4 + sctp-a-ipv6-egress_src_start_port: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix + default: 0 + instance_ip_family_v6: + hidden: false + immutable: false + type: string + description: Ipv6 instance type + default: v6 + sctp-b-ingress-src_subnet_prefix_v6: + hidden: false + immutable: false + type: string + description: src subnet + default: '::' + gpb8_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb8_Internal2 + default: 00:80:37:0E:10:22 + gpb4_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb4_Internal1 + default: 00:80:37:0E:0C:22 + sctp-a-ipv6-ingress-dst_end_port: + hidden: false + immutable: false + type: string + description: IPV6 end port + default: 65535 + Internal1_net_gateway: + hidden: false + immutable: false + type: string + description: gateway for internal-1 network + default: 169.253.0.3 + sctp-b-ipv6-egress-dst_start_port: + hidden: false + immutable: false + type: string + description: IPV6 start port + default: 0 + gpb_name_7: + hidden: false + immutable: false + type: string + description: Name of gpb8 + default: zrdm3mmex59gpb0016 + gpb_name_6: + hidden: false + immutable: false + type: string + description: Name of gpb7 + default: zrdm3mmex59gpb0015 + gpb_name_5: + hidden: false + immutable: false + type: string + description: Name of gpb6 + default: zrdm3mmex59gpb0014 + gpb_name_4: + hidden: false + immutable: false + type: string + description: Name of gpb5 + default: zrdm3mmex59gpb0013 + gpb_name_3: + hidden: false + immutable: false + type: string + description: Name of gpb4 + default: zrdm3mmex59gpb0012 + sctp-a-ipv6-ingress_dst_addresses: + hidden: false + immutable: false + type: string + description: IPV6 destination + default: local + gpb_name_2: + hidden: false + immutable: false + type: string + description: Name of gpb3 + default: zrdm3mmex59gpb0011 + shc_delay: + hidden: false + immutable: false + type: string + description: health check + default: 3 + gpb_name_1: + hidden: false + immutable: false + type: string + description: Name of gpb2 + default: zrdm3mmex59gpb0010 + sctp-b-ipv6-egress_action: + hidden: false + immutable: false + type: string + description: IPV6 action + default: pass + vlc3_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc3_Internal2 + default: 00:80:37:0E:03:12 + gpb_name_0: + hidden: false + immutable: false + type: string + description: Name of gpb1 + default: zrdm3mmex59gpb009 + sctp-a-ipv6-egress_action: + hidden: false + immutable: false + type: string + description: IPV6 action + default: pass + gpb5_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb5_Internal1 + default: 00:80:37:0E:0D:22 + sctp-b-ipv6-ingress_rule_protocol: + hidden: false + immutable: false + type: string + description: IPV6 Rule-protocol + default: any + shc_max_retries: + hidden: false + immutable: false + type: string + description: health check + default: 2 + fsb_volume_type: + label: volume type + hidden: false + immutable: false + type: string + description: volume type SolidFire + default: SF-Default-SSD + sctp-a-name: + hidden: false + immutable: false + type: string + description: name for the SecurityGroup + default: epc-sctp-a-ipv4v6-sec-group + vlc_sctp_b_ip_5: + hidden: false + immutable: false + type: string + description: Static IP vlc6 SCTPB + default: 107.243.47.187 + vlc_sctp_b_ip_4: + hidden: false + immutable: false + type: string + description: Static IP vlc5 SCTPB + default: 107.243.47.186 + vlc_sctp_b_ip_3: + hidden: false + immutable: false + type: string + description: Static IP vlc4 SCTPB + default: 107.243.47.185 + vlc_sctp_b_ip_2: + hidden: false + immutable: false + type: string + description: Static IP vlc3 SCTPB + default: 107.243.47.184 + sctp-b-egress_rule_protocol: + hidden: false + immutable: false + type: string + description: protocol for the SecurityGroup + default: any + vnf_id: + hidden: false + immutable: false + type: string + description: the vf_id for this instance. UUID provided by ECOMP + default: zrdm3mmex59 + vlc_sctp_b_ip_7: + hidden: false + immutable: false + type: string + description: Static IP vlc8 SCTPB + default: 107.243.47.189 + vlc_sctp_b_ip_6: + hidden: false + immutable: false + type: string + description: Static IP vlc7 SCTPB + default: 107.243.47.188 + vlc_sctp_b_ip_1: + hidden: false + immutable: false + type: string + description: Static IP vlc2 SCTPB + default: 107.243.47.177 + gpb6_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb6_Internal1 + default: 00:80:37:0E:0E:22 + sctp-b-ipv6-egress_dst_end_port: + hidden: false + immutable: false + type: string + description: IPV6 end port + default: 65535 + vlc_sctp_b_ip_0: + hidden: false + immutable: false + type: string + description: Static IP vlc1 SCTPB + default: 107.243.47.176 + vlc2_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc2_Internal2 + default: 00:80:37:0E:02:12 + sctp-b-ingress-src_subnet_prefix: + hidden: false + immutable: false + type: string + description: ip_prefix for the SecurityGroup + default: 0.0.0.0 + gpb_flavor_name: + hidden: false + immutable: false + type: string + description: Flavor to use for servers gpb + default: nv.c20r64d1 + vlc_sctp_a_route_prefixes: + hidden: false + immutable: false + type: json + description: Route prefixes for static routing on SCTPA + sctp-b-ipv6-ingress_dst_addresses: + hidden: false + immutable: false + type: string + description: IPV6 destination + default: local + sctp-b-ipv6-ingress_ethertype: + hidden: false + immutable: false + type: string + description: IPV6 ethertype + default: IPv4 + sctp-b-ipv6-egress_dst_subnet_prefix: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix + default: 0.0.0.0 + sctp-a-ingress-src_subnet_prefix: + hidden: false + immutable: false + type: string + description: ip_prefix for the SecurityGroup + default: 0.0.0.0 + vlc1_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc1_Internal2 + default: 00:80:37:0E:01:12 + Internal1_rpf: + hidden: false + immutable: false + type: string + description: Reverse Path Forwarding Enabled/Disabled internal-1 network + default: disable + sctp-b-ingress_ethertype: + hidden: false + immutable: false + type: string + description: ethertype for the SecurityGroup + default: IPv4 + sctp-b-ingress-src_end_port: + hidden: false + immutable: false + type: float + description: end_port for the SecurityGroup + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + sctp-a-ipv6-ingress_rule_protocol: + hidden: false + immutable: false + type: string + description: IPV6 Rule-protocol + default: any + vlc_sctp_a_v6_ip_7: + hidden: false + immutable: false + type: string + description: Static IP vlc8 SCTPA + default: fd00:200:200:4:0:0:0:29 + vlc_sctp_a_v6_ip_6: + hidden: false + immutable: false + type: string + description: Static IP vlc7 SCTPA + default: fd00:200:200:4:0:0:0:28 + gpb7_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb7_Internal1 + default: 00:80:37:0E:0F:22 + vlc_sctp_a_v6_ip_5: + hidden: false + immutable: false + type: string + description: Static IP vlc6 SCTPA + default: fd00:200:200:4:0:0:0:27 + vlc_sctp_a_v6_ip_4: + hidden: false + immutable: false + type: string + description: Static IP vlc5 SCTPA + default: fd00:200:200:4:0:0:0:26 + vlc_sctp_a_v6_ip_3: + hidden: false + immutable: false + type: string + description: Static IP vlc4 SCTPA + default: fd00:200:200:4:0:0:0:25 + vlc_sctp_a_v6_ip_2: + hidden: false + immutable: false + type: string + description: Static IP vlc3 SCTPA + default: fd00:200:200:4:0:0:0:24 + sctp-a-ingress-src_start_port: + hidden: false + immutable: false + type: float + description: start_port for the SecurityGroup + default: 0 + constraints: + - in_range: + - 0 + - 65535 + vlc_sctp_a_v6_ip_1: + hidden: false + immutable: false + type: string + description: Static IP vlc2 SCTPA + default: fd00:200:200:4:0:0:0:17 + vlc_sctp_a_v6_ip_0: + hidden: false + immutable: false + type: string + description: Static IP vlc1 SCTPA + default: fd00:200:200:4:0:0:0:16 + node_templates: + abstract_gpb_1: + type: org.openecomp.resource.abstract.nodes.gpb_1 + directives: + - substitutable + properties: + compute_gpb_name: + - get_input: gpb_name_1 + vm_flavor_name: + get_input: gpb_flavor_name + compute_gpb_scheduler_hints: + - group: + get_input: server_group_id_0 + port_gpb2_Internal1_security_groups: + - - get_input: security_group_int1_id + compute_gpb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + port_gpb2_Internal2_network: + - get_input: internal_net_id_1 + port_gpb2_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + vm_image_name: + get_input: pxe_image_name + port_gpb2_Internal1_replacement_policy: + - AUTO + port_gpb2_Internal1_network: + - get_input: internal_net_id_0 + port_gpb2_Internal2_replacement_policy: + - AUTO + port_gpb2_Internal1_mac_requirements: + mac_count_required: + is_required: true + compute_gpb_availability_zone: + - get_input: availability_zone_1 + port_gpb2_Internal1_mac_address: + get_input: gpb2_Internal1_mac + port_gpb2_Internal2_mac_requirements: + mac_count_required: + is_required: true + port_gpb2_Internal2_mac_address: + get_input: gpb2_Internal1_mac + port_gpb2_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb2_Internal2_security_groups: + - - get_input: security_group_int2_id + service_template_filter: + substitute_service_template: Nested_gpb_1ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: gpb + nfc_naming_code: gpb + requirements: + - link_gpb_gpb2_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_gpb_gpb2_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.BindsTo + abstract_gpb_2: + type: org.openecomp.resource.abstract.nodes.gpb_2 + directives: + - substitutable + properties: + port_gpb3_Internal1_replacement_policy: + - AUTO + compute_gpb_name: + - get_input: gpb_name_2 + port_gpb3_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb3_Internal2_replacement_policy: + - AUTO + vm_flavor_name: + get_input: gpb_flavor_name + port_gpb3_Internal2_security_groups: + - - get_input: security_group_int2_id + compute_gpb_scheduler_hints: + - group: + get_input: server_group_id_0 + compute_gpb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + vm_image_name: + get_input: pxe_image_name + port_gpb3_Internal1_security_groups: + - - get_input: security_group_int1_id + port_gpb3_Internal2_network: + - get_input: internal_net_id_1 + compute_gpb_availability_zone: + - get_input: availability_zone_0 + port_gpb3_Internal1_network: + - get_input: internal_net_id_0 + port_gpb3_Internal1_mac_requirements: + mac_count_required: + is_required: true + port_gpb3_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb3_Internal1_mac_address: + get_input: gpb3_Internal1_mac + port_gpb3_Internal2_mac_address: + get_input: gpb3_Internal1_mac + port_gpb3_Internal2_mac_requirements: + mac_count_required: + is_required: true + service_template_filter: + substitute_service_template: Nested_gpb_2ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: gpb + nfc_naming_code: gpb + requirements: + - link_gpb_gpb3_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_gpb_gpb3_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + abstract_vlc: + type: org.openecomp.resource.abstract.nodes.vlc + directives: + - substitutable + properties: + port_template_VMInt_SCTP_A_vlc_virtual_network_refs: + - - get_input: sctp_a_net_fqdn + port_template_VMInt_INT1_vlc_security_group_refs: + - - get_input: security_group_int1_id + vm_flavor_name: + get_input: vlc_flavor_name + port_template_VMInt_INT2_vlc_port_tuple_refs: + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc4 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc3 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc2 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc1 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc8 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc7 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc6 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc5 + vm_image_name: + get_input: pxe_image_name + port_template_VMInt_INT1_vlc_port_tuple_refs: + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc4 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc3 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc2 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc1 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc8 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc7 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc6 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc5 + port_template_VMInt_INT2_vlc_virtual_network_refs: + - - get_input: internal_net_id_1 + port_template_VMInt_OAM_vlc_virtual_network_refs: + - - get_input: oam_net_fqdn + port_template_VMInt_OAM_vlc_port_tuple_refs: + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc4 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc3 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc2 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc1 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc8 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc7 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc6 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc5 + port_template_VMInt_INT2_vlc_virtual_machine_interface_mac_addresses: + - - get_input: vlc4_Internal2_mac + - - get_input: vlc3_Internal2_mac + - - get_input: vlc2_Internal2_mac + - - get_input: vlc1_Internal2_mac + - - get_input: vlc8_Internal2_mac + - - get_input: vlc7_Internal2_mac + - - get_input: vlc6_Internal2_mac + - - get_input: vlc5_Internal2_mac + port_template_VMInt_SCTP_B_vlc_port_tuple_refs: + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc4 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc3 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc2 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc1 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc8 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc7 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc6 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc5 + port_template_VMInt_GTP_vlc_security_group_refs: + - - get_input: security_group_gtp_id + compute_vlc_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + port_template_VMInt_OAM_vlc_security_group_refs: + - - get_input: security_group_oam_id + compute_vlc_contrail_service_instance_ind: + - true + - true + - true + - true + - true + - true + - true + - true + port_template_VMInt_GTP_vlc_port_tuple_refs: + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc4 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc3 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc2 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc1 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc8 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc7 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc6 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc5 + port_template_VMInt_SCTP_B_vlc_virtual_network_refs: + - - get_input: sctp_b_net_fqdn + port_template_VMInt_INT2_vlc_security_group_refs: + - - get_input: security_group_int2_id + port_template_VMInt_SCTP_B_vlc_security_group_refs: + - - get_input: security_group_sctp_b_id + port_template_VMInt_INT1_vlc_virtual_network_refs: + - - get_input: internal_net_id_0 + port_template_VMInt_SCTP_A_vlc_port_tuple_refs: + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc4 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc3 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc2 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc1 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc8 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc7 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc6 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc5 + compute_vlc_scheduler_hints: + - group: + get_input: server_group_id_0 + - group: + get_input: server_group_id_0 + - group: + get_input: server_group_id_0 + - group: + get_input: server_group_id_0 + - group: + get_input: server_group_id_0 + - group: + get_input: server_group_id_0 + - group: + get_input: server_group_id_0 + - group: + get_input: server_group_id_0 + compute_vlc_name: + - get_input: vlc_name_3 + - get_input: vlc_name_2 + - get_input: vlc_name_1 + - get_input: vlc_name_0 + - get_input: vlc_name_7 + - get_input: vlc_name_6 + - get_input: vlc_name_5 + - get_input: vlc_name_4 + port_template_VMInt_SCTP_A_vlc_security_group_refs: + - - get_input: security_group_sctp_a_id + compute_vlc_availability_zone: + - get_input: availability_zone_1 + - get_input: availability_zone_0 + - get_input: availability_zone_1 + - get_input: availability_zone_0 + - get_input: availability_zone_1 + - get_input: availability_zone_0 + - get_input: availability_zone_1 + - get_input: availability_zone_0 + port_template_VMInt_INT1_vlc_virtual_machine_interface_mac_addresses: + - - get_input: vlc4_Internal1_mac + - - get_input: vlc3_Internal1_mac + - - get_input: vlc2_Internal1_mac + - - get_input: vlc1_Internal1_mac + - - get_input: vlc8_Internal1_mac + - - get_input: vlc7_Internal1_mac + - - get_input: vlc6_Internal1_mac + - - get_input: vlc5_Internal1_mac + port_template_VMInt_GTP_vlc_virtual_network_refs: + - - get_input: gtp_net_fqdn + service_template_filter: + substitute_service_template: Nested_vlcServiceTemplate.yaml + count: 8 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: vlc + nfc_naming_code: vlc + requirements: + - link_vlc_template_VMInt_INT2_vlc: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + - link_vlc_template_VMInt_INT1_vlc: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + abstract_gpb_7: + type: org.openecomp.resource.abstract.nodes.gpb_7 + directives: + - substitutable + properties: + compute_gpb_name: + - get_input: gpb_name_7 + port_gpb8_Internal1_mac_address: + get_input: gpb8_Internal1_mac + port_gpb8_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + vm_flavor_name: + get_input: gpb_flavor_name + compute_gpb_scheduler_hints: + - group: + get_input: server_group_id_0 + compute_gpb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + vm_image_name: + get_input: pxe_image_name + port_gpb8_Internal2_security_groups: + - - get_input: security_group_int2_id + port_gpb8_Internal1_replacement_policy: + - AUTO + port_gpb8_Internal2_replacement_policy: + - AUTO + compute_gpb_availability_zone: + - get_input: availability_zone_1 + port_gpb8_Internal1_mac_requirements: + mac_count_required: + is_required: true + port_gpb8_Internal1_network: + - get_input: internal_net_id_0 + port_gpb8_Internal2_mac_requirements: + mac_count_required: + is_required: true + port_gpb8_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb8_Internal1_security_groups: + - - get_input: security_group_int1_id + port_gpb8_Internal2_network: + - get_input: internal_net_id_1 + port_gpb8_Internal2_mac_address: + get_input: gpb8_Internal1_mac + service_template_filter: + substitute_service_template: Nested_gpb_7ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: gpb + nfc_naming_code: gpb + requirements: + - link_gpb_gpb8_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_gpb_gpb8_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + abstract_gpb_5: + type: org.openecomp.resource.abstract.nodes.gpb_5 + directives: + - substitutable + properties: + port_gpb6_Internal1_mac_requirements: + mac_count_required: + is_required: true + compute_gpb_name: + - get_input: gpb_name_5 + vm_flavor_name: + get_input: gpb_flavor_name + compute_gpb_scheduler_hints: + - group: + get_input: server_group_id_0 + compute_gpb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + port_gpb6_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + vm_image_name: + get_input: pxe_image_name + port_gpb6_Internal1_security_groups: + - - get_input: security_group_int1_id + port_gpb6_Internal2_network: + - get_input: internal_net_id_1 + compute_gpb_availability_zone: + - get_input: availability_zone_1 + port_gpb6_Internal1_network: + - get_input: internal_net_id_0 + port_gpb6_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb6_Internal2_mac_address: + get_input: gpb6_Internal1_mac + port_gpb6_Internal1_mac_address: + get_input: gpb6_Internal1_mac + port_gpb6_Internal2_mac_requirements: + mac_count_required: + is_required: true + port_gpb6_Internal2_replacement_policy: + - AUTO + port_gpb6_Internal1_replacement_policy: + - AUTO + port_gpb6_Internal2_security_groups: + - - get_input: security_group_int2_id + service_template_filter: + substitute_service_template: Nested_gpb_5ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: gpb + nfc_naming_code: gpb + requirements: + - link_gpb_gpb6_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_gpb_gpb6_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + abstract_gpb_6: + type: org.openecomp.resource.abstract.nodes.gpb_6 + directives: + - substitutable + properties: + port_gpb7_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb7_Internal1_network: + - get_input: internal_net_id_0 + compute_gpb_name: + - get_input: gpb_name_6 + port_gpb7_Internal2_network: + - get_input: internal_net_id_1 + vm_flavor_name: + get_input: gpb_flavor_name + port_gpb7_Internal1_replacement_policy: + - AUTO + port_gpb7_Internal2_replacement_policy: + - AUTO + port_gpb7_Internal2_security_groups: + - - get_input: security_group_int2_id + compute_gpb_scheduler_hints: + - group: + get_input: server_group_id_0 + compute_gpb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + vm_image_name: + get_input: pxe_image_name + port_gpb7_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb7_Internal1_security_groups: + - - get_input: security_group_int1_id + compute_gpb_availability_zone: + - get_input: availability_zone_0 + port_gpb7_Internal2_mac_address: + get_input: gpb7_Internal1_mac + port_gpb7_Internal1_mac_requirements: + mac_count_required: + is_required: true + port_gpb7_Internal1_mac_address: + get_input: gpb7_Internal1_mac + port_gpb7_Internal2_mac_requirements: + mac_count_required: + is_required: true + service_template_filter: + substitute_service_template: Nested_gpb_6ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: gpb + nfc_naming_code: gpb + requirements: + - link_gpb_gpb7_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_gpb_gpb7_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + abstract_gpb_3: + type: org.openecomp.resource.abstract.nodes.gpb_3 + directives: + - substitutable + properties: + compute_gpb_name: + - get_input: gpb_name_3 + port_gpb4_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + vm_flavor_name: + get_input: gpb_flavor_name + port_gpb4_Internal1_mac_address: + get_input: gpb4_Internal1_mac + compute_gpb_scheduler_hints: + - group: + get_input: server_group_id_0 + port_gpb4_Internal2_mac_requirements: + mac_count_required: + is_required: true + compute_gpb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + port_gpb4_Internal2_mac_address: + get_input: gpb4_Internal1_mac + vm_image_name: + get_input: pxe_image_name + port_gpb4_Internal2_security_groups: + - - get_input: security_group_int2_id + compute_gpb_availability_zone: + - get_input: availability_zone_1 + port_gpb4_Internal2_replacement_policy: + - AUTO + port_gpb4_Internal1_replacement_policy: + - AUTO + port_gpb4_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb4_Internal1_security_groups: + - - get_input: security_group_int1_id + port_gpb4_Internal2_network: + - get_input: internal_net_id_1 + port_gpb4_Internal1_mac_requirements: + mac_count_required: + is_required: true + port_gpb4_Internal1_network: + - get_input: internal_net_id_0 + service_template_filter: + substitute_service_template: Nested_gpb_3ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: gpb + nfc_naming_code: gpb + requirements: + - link_gpb_gpb4_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_gpb_gpb4_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + abstract_gpb_4: + type: org.openecomp.resource.abstract.nodes.gpb_4 + directives: + - substitutable + properties: + port_gpb5_Internal2_mac_requirements: + mac_count_required: + is_required: true + port_gpb5_Internal1_security_groups: + - - get_input: security_group_int1_id + compute_gpb_name: + - get_input: gpb_name_4 + vm_flavor_name: + get_input: gpb_flavor_name + port_gpb5_Internal1_mac_requirements: + mac_count_required: + is_required: true + compute_gpb_scheduler_hints: + - group: + get_input: server_group_id_0 + port_gpb5_Internal2_network: + - get_input: internal_net_id_1 + compute_gpb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + vm_image_name: + get_input: pxe_image_name + port_gpb5_Internal1_network: + - get_input: internal_net_id_0 + port_gpb5_Internal2_mac_address: + get_input: gpb5_Internal1_mac + port_gpb5_Internal1_mac_address: + get_input: gpb5_Internal1_mac + port_gpb5_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb5_Internal2_replacement_policy: + - AUTO + compute_gpb_availability_zone: + - get_input: availability_zone_0 + port_gpb5_Internal1_replacement_policy: + - AUTO + port_gpb5_Internal2_security_groups: + - - get_input: security_group_int2_id + port_gpb5_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + service_template_filter: + substitute_service_template: Nested_gpb_4ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: gpb + nfc_naming_code: gpb + requirements: + - link_gpb_gpb5_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_gpb_gpb5_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + abstract_gpb: + type: org.openecomp.resource.abstract.nodes.gpb + directives: + - substitutable + properties: + port_gpb1_Internal1_security_groups: + - - get_input: security_group_int1_id + compute_gpb_name: + - get_input: gpb_name_0 + port_gpb1_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + vm_flavor_name: + get_input: gpb_flavor_name + port_gpb1_Internal1_mac_requirements: + mac_count_required: + is_required: true + compute_gpb_scheduler_hints: + - group: + get_input: server_group_id_0 + compute_gpb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + vm_image_name: + get_input: pxe_image_name + port_gpb1_Internal1_mac_address: + get_input: gpb1_Internal1_mac + port_gpb1_Internal2_mac_address: + get_input: gpb1_Internal1_mac + port_gpb1_Internal2_mac_requirements: + mac_count_required: + is_required: true + compute_gpb_availability_zone: + - get_input: availability_zone_0 + port_gpb1_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb1_Internal2_security_groups: + - - get_input: security_group_int2_id + port_gpb1_Internal1_replacement_policy: + - AUTO + port_gpb1_Internal2_replacement_policy: + - AUTO + port_gpb1_Internal2_network: + - get_input: internal_net_id_1 + port_gpb1_Internal1_network: + - get_input: internal_net_id_0 + service_template_filter: + substitute_service_template: Nested_gpbServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: gpb + nfc_naming_code: gpb + requirements: + - link_gpb_gpb1_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_gpb_gpb1_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + Internal1_net: + type: org.openecomp.resource.vl.nodes.heat.network.contrailV2.VirtualNetwork + properties: + network_ipam_refs_data: + - network_ipam_refs_data_ipam_subnets: + - network_ipam_refs_data_ipam_subnets_enable_dhcp: + get_input: Internal1_dhcp + network_ipam_refs_data_ipam_subnets_default_gateway: + get_input: Internal1_net_gateway + network_ipam_refs_data_ipam_subnets_subnet: + network_ipam_refs_data_ipam_subnets_subnet_ip_prefix_len: + get_input: Internal1_net_cidr_len + network_ipam_refs_data_ipam_subnets_subnet_ip_prefix: + get_input: Internal1_net_cidr + network_name: + str_replace: + template: $VNF_NAME_int_net_1 + params: + $VNF_NAME: + get_input: vnf_name + network_ipam_refs: + - UNSUPPORTED_RESOURCE_template_NetworkIpam_Internal1 + abstract_fsb: + type: org.openecomp.resource.abstract.nodes.fsb + directives: + - substitutable + properties: + port_FSB1_Internal1_mac_address: + get_input: fsb1_Internal1_mac + port_FSB_OAM_network_role_tag: + - oam + port_FSB1_Internal2_network: + - Internal2_net + port_FSB1_Internal1_network: + - Internal1_net + vm_flavor_name: + get_input: fsb_flavor_name + port_FSB1_Internal2_mac_address: + get_input: fsb1_Internal1_mac + port_FSB_OAM_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: true + floating_ip_count_required: + is_required: false + compute_fsb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + port_FSB1_Internal1_security_groups: + - - int1_security_group + port_FSB1_Internal2_replacement_policy: + - AUTO + compute_fsb_scheduler_hints: + - group: VM_Affinity_group + port_FSB1_Internal1_replacement_policy: + - AUTO + compute_fsb_name: + - get_input: fsb_name_0 + port_FSB1_Internal1_mac_requirements: + mac_count_required: + is_required: true + port_FSB1_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_FSB_OAM_network: + - get_input: oam_net_name + port_FSB_OAM_security_groups: + - - oam_security_group + port_FSB_OAM_mac_requirements: + mac_count_required: + is_required: false + port_FSB_OAM_replacement_policy: + - AUTO + compute_fsb_availability_zone: + - get_input: availability_zone_0 + port_FSB1_Internal2_security_groups: + - - int2_security_group + port_FSB1_Internal2_mac_requirements: + mac_count_required: + is_required: true + port_FSB1_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_FSB_OAM_fixed_ips: + - ip_address: + get_input: fsb_oam_ip_0 + service_template_filter: + substitute_service_template: Nested_fsbServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: fsb + nfc_naming_code: fsb + requirements: + - link_fsb_FSB1_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_fsb_FSB1_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + gtp_security_group: + type: org.openecomp.resource.vfc.rules.nodes.heat.network.neutron.SecurityRules + properties: + name: + str_replace: + template: $VNF_NAME_$SECGROUPNAME + params: + $SECGROUPNAME: + get_input: gtp_sec_group_name + $VNF_NAME: + get_input: vnf_name + rules: + - protocol: tcp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: udp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: icmp + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + - protocol: tcp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: udp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: icmp + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + abstract_ncb_1: + type: org.openecomp.resource.abstract.nodes.ncb_1 + directives: + - substitutable + properties: + port_NCB2_Internal2_security_groups: + - - int2_security_group + port_NCB2_Internal1_replacement_policy: + - AUTO + port_NCB2_Internal2_replacement_policy: + - AUTO + vm_flavor_name: + get_input: ncb_flavor_name + port_NCB2_Internal2_mac_requirements: + mac_count_required: + is_required: true + port_NCB2_Internal1_mac_requirements: + mac_count_required: + is_required: true + vm_image_name: + get_input: pxe_image_name + compute_ncb_scheduler_hints: + - group: VM_Affinity_group + compute_ncb_availability_zone: + - get_input: availability_zone_1 + port_NCB2_Internal1_network: + - Internal1_net + port_NCB2_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_NCB2_Internal1_security_groups: + - - int1_security_group + port_NCB2_Internal2_network: + - Internal2_net + port_NCB2_Internal1_mac_address: + get_input: ncb2_Internal1_mac + port_NCB2_Internal2_mac_address: + get_input: ncb2_Internal1_mac + compute_ncb_name: + - get_input: ncb_name_1 + compute_ncb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + port_NCB2_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + service_template_filter: + substitute_service_template: Nested_ncb_1ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: ncb + nfc_naming_code: ncb + requirements: + - link_ncb_NCB2_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_ncb_NCB2_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + abstract_ncb: + type: org.openecomp.resource.abstract.nodes.ncb + directives: + - substitutable + properties: + vm_flavor_name: + get_input: ncb_flavor_name + port_NCB1_Internal2_mac_requirements: + mac_count_required: + is_required: true + vm_image_name: + get_input: pxe_image_name + port_NCB1_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + compute_ncb_scheduler_hints: + - group: VM_Affinity_group + port_NCB1_Internal1_security_groups: + - - int1_security_group + compute_ncb_availability_zone: + - get_input: availability_zone_0 + port_NCB1_Internal2_mac_address: + get_input: ncb1_Internal1_mac + port_NCB1_Internal1_mac_address: + get_input: ncb1_Internal1_mac + port_NCB1_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_NCB1_Internal1_mac_requirements: + mac_count_required: + is_required: true + port_NCB1_Internal2_replacement_policy: + - AUTO + port_NCB1_Internal1_network: + - Internal1_net + port_NCB1_Internal2_security_groups: + - - int2_security_group + port_NCB1_Internal1_replacement_policy: + - AUTO + compute_ncb_name: + - get_input: ncb_name_0 + compute_ncb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + port_NCB1_Internal2_network: + - Internal2_net + service_template_filter: + substitute_service_template: Nested_ncbServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: ncb + nfc_naming_code: ncb + requirements: + - link_ncb_NCB1_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_ncb_NCB1_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + int1_security_group: + type: org.openecomp.resource.vfc.rules.nodes.heat.network.neutron.SecurityRules + properties: + name: + str_replace: + template: $VNF_NAME_$SECGROUPNAME + params: + $SECGROUPNAME: + get_input: int1_sec_group_name + $VNF_NAME: + get_input: vnf_name + rules: + - protocol: tcp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: udp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: icmp + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + - protocol: tcp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: udp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: icmp + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + requirements: + - port: + capability: attachment_fsb_FSB1_Internal1 + node: abstract_fsb + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_fsb_FSB2_Internal1 + node: abstract_fsb_1 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_ncb_NCB1_Internal1 + node: abstract_ncb + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_ncb_NCB2_Internal1 + node: abstract_ncb_1 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb1_Internal1 + node: abstract_gpb + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb2_Internal1 + node: abstract_gpb_1 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb3_Internal1 + node: abstract_gpb_2 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb4_Internal1 + node: abstract_gpb_3 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb5_Internal1 + node: abstract_gpb_4 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb6_Internal1 + node: abstract_gpb_5 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb7_Internal1 + node: abstract_gpb_6 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb8_Internal1 + node: abstract_gpb_7 + relationship: org.openecomp.relationships.AttachesTo + fsb_volume_0: + type: org.openecomp.resource.vfc.nodes.heat.cinder.Volume + properties: + image: + get_input: fsb_volume_image_name_0 + volume_type: + get_input: fsb_volume_type + size: '(get_input : fsb_volume_size) * 1024' + name: + list_join: + - _ + - - get_input: OS::stack_name + - FSB1_Vol_1 + fsb_volume_1: + type: org.openecomp.resource.vfc.nodes.heat.cinder.Volume + properties: + image: + get_input: fsb_volume_image_name_1 + volume_type: + get_input: fsb_volume_type + size: '(get_input : fsb_volume_size) * 1024' + name: + list_join: + - _ + - - get_input: OS::stack_name + - FSB2_Vol_1 + Internal2_net: + type: org.openecomp.resource.vl.nodes.heat.network.contrailV2.VirtualNetwork + properties: + network_ipam_refs_data: + - network_ipam_refs_data_ipam_subnets: + - network_ipam_refs_data_ipam_subnets_enable_dhcp: + get_input: Internal2_dhcp + network_ipam_refs_data_ipam_subnets_default_gateway: + get_input: Internal2_net_gateway + network_ipam_refs_data_ipam_subnets_subnet: + network_ipam_refs_data_ipam_subnets_subnet_ip_prefix_len: + get_input: Internal2_net_cidr_len + network_ipam_refs_data_ipam_subnets_subnet_ip_prefix: + get_input: Internal2_net_cidr + network_name: + str_replace: + template: $VNF_NAME_int_net_2 + params: + $VNF_NAME: + get_input: vnf_name + network_ipam_refs: + - UNSUPPORTED_RESOURCE_template_NetworkIpam_Internal2 + int2_security_group: + type: org.openecomp.resource.vfc.rules.nodes.heat.network.neutron.SecurityRules + properties: + name: + str_replace: + template: $VNF_NAME_$SECGROUPNAME + params: + $SECGROUPNAME: + get_input: int2_sec_group_name + $VNF_NAME: + get_input: vnf_name + rules: + - protocol: tcp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: udp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: 132 + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: icmp + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + - protocol: tcp + ethertype: IPv6 + port_range_max: 65535 + remote_ip_prefix: ::/0 + direction: egress + port_range_min: 1 + - protocol: udp + ethertype: IPv6 + port_range_max: 65535 + remote_ip_prefix: ::/0 + direction: egress + port_range_min: 1 + - protocol: 132 + ethertype: IPv6 + port_range_max: 65535 + remote_ip_prefix: ::/0 + direction: egress + port_range_min: 1 + - protocol: icmp + ethertype: IPv6 + remote_ip_prefix: ::/0 + direction: egress + - protocol: tcp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: udp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: 132 + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: icmp + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + - protocol: tcp + ethertype: IPv6 + port_range_max: 65535 + remote_ip_prefix: ::/0 + direction: ingress + port_range_min: 1 + - protocol: udp + ethertype: IPv6 + port_range_max: 65535 + remote_ip_prefix: ::/0 + direction: ingress + port_range_min: 1 + - protocol: 132 + ethertype: IPv6 + port_range_max: 65535 + remote_ip_prefix: ::/0 + direction: ingress + port_range_min: 1 + - protocol: icmp + ethertype: IPv6 + remote_ip_prefix: ::/0 + direction: ingress + requirements: + - port: + capability: attachment_fsb_FSB1_Internal2 + node: abstract_fsb + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_fsb_FSB2_Internal2 + node: abstract_fsb_1 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_ncb_NCB1_Internal2 + node: abstract_ncb + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_ncb_NCB2_Internal2 + node: abstract_ncb_1 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb1_Internal2 + node: abstract_gpb + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb2_Internal2 + node: abstract_gpb_1 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb3_Internal2 + node: abstract_gpb_2 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb4_Internal2 + node: abstract_gpb_3 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb5_Internal2 + node: abstract_gpb_4 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb6_Internal2 + node: abstract_gpb_5 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb7_Internal2 + node: abstract_gpb_6 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb8_Internal2 + node: abstract_gpb_7 + relationship: org.openecomp.relationships.AttachesTo + abstract_fsb_1: + type: org.openecomp.resource.abstract.nodes.fsb_1 + directives: + - substitutable + properties: + port_FSB_OAM_network_role_tag: + - oam + vm_flavor_name: + get_input: fsb_flavor_name + port_FSB_OAM_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: true + floating_ip_count_required: + is_required: false + port_FSB2_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_FSB2_Internal2_security_groups: + - - int2_security_group + compute_fsb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + port_FSB2_Internal1_mac_address: + get_input: fsb2_Internal1_mac + compute_fsb_scheduler_hints: + - group: VM_Affinity_group + compute_fsb_name: + - get_input: fsb_name_1 + port_FSB2_Internal1_security_groups: + - - int1_security_group + port_FSB_OAM_network: + - get_input: oam_net_name + port_FSB_OAM_security_groups: + - - oam_security_group + port_FSB2_Internal1_network: + - Internal1_net + port_FSB2_Internal2_mac_address: + get_input: fsb2_Internal1_mac + port_FSB2_Internal2_mac_requirements: + mac_count_required: + is_required: true + port_FSB_OAM_mac_requirements: + mac_count_required: + is_required: false + port_FSB2_Internal2_replacement_policy: + - AUTO + port_FSB2_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_FSB_OAM_replacement_policy: + - AUTO + port_FSB2_Internal2_network: + - Internal2_net + port_FSB2_Internal1_replacement_policy: + - AUTO + compute_fsb_availability_zone: + - get_input: availability_zone_1 + port_FSB_OAM_fixed_ips: + - ip_address: + get_input: fsb_oam_ip_1 + port_FSB2_Internal1_mac_requirements: + mac_count_required: + is_required: true + service_template_filter: + substitute_service_template: Nested_fsb_1ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: fsb + nfc_naming_code: fsb + requirements: + - link_fsb_FSB2_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_fsb_FSB2_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + oam_security_group: + type: org.openecomp.resource.vfc.rules.nodes.heat.network.neutron.SecurityRules + properties: + name: + str_replace: + template: $VNF_NAME_$SECGROUPNAME + params: + $SECGROUPNAME: + get_input: oam_sec_group_name + $VNF_NAME: + get_input: vnf_name + rules: + - protocol: tcp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: udp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: icmp + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + - protocol: tcp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: udp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: icmp + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + requirements: + - port: + capability: attachment_fsb_FSB_OAM + node: abstract_fsb + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_fsb_FSB_OAM + node: abstract_fsb_1 + relationship: org.openecomp.relationships.AttachesTo + groups: + vmme_gpb3_group: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/vmme_gpb3.yml + description: | + Module HOT template to create vmme 1-8 gpb + members: + - abstract_gpb + - abstract_gpb_1 + - abstract_gpb_2 + - abstract_gpb_3 + - abstract_gpb_4 + - abstract_gpb_5 + - abstract_gpb_6 + - abstract_gpb_7 + base_vmme_group: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/base_vmme.yml + description: | + Base HOT template to create vmme 2 fsb 2 ncb + members: + - int2_security_group + - oam_security_group + - gtp_security_group + - Internal2_net + - int1_security_group + - Internal1_net + - abstract_ncb + - abstract_ncb_1 + - abstract_fsb + - abstract_fsb_1 + base_vmme_volume_group: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/base_vmme_volume.yml + description: HOT template for vMME Cinder Volumes + members: + - fsb_volume_0 + - fsb_volume_1 + vmme_gpb1_group: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/vmme_gpb1.yml + description: | + Module HOT template to create vmme 1-8 gpb + members: + - abstract_gpb + - abstract_gpb_1 + - abstract_gpb_2 + - abstract_gpb_3 + - abstract_gpb_4 + - abstract_gpb_5 + - abstract_gpb_6 + - abstract_gpb_7 + vmme_gpb4_group: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/vmme_gpb4.yml + description: | + Module HOT template to create vmme 1-8 gpb + members: + - abstract_gpb + - abstract_gpb_1 + - abstract_gpb_2 + - abstract_gpb_3 + - abstract_gpb_4 + - abstract_gpb_5 + - abstract_gpb_6 + - abstract_gpb_7 + vmme_gpb2_group: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/vmme_gpb2.yml + description: | + Module HOT template to create vmme 1-8 gpb + members: + - abstract_gpb + - abstract_gpb_1 + - abstract_gpb_2 + - abstract_gpb_3 + - abstract_gpb_4 + - abstract_gpb_5 + - abstract_gpb_6 + - abstract_gpb_7 + VM_Affinity_group: + type: tosca.groups.Root + members: + - abstract_ncb + - abstract_ncb_1 + - abstract_vlc + - abstract_fsb + - abstract_fsb_1 + - abstract_gpb + - abstract_gpb_1 + - abstract_gpb_2 + - abstract_gpb_3 + - abstract_gpb_4 + - abstract_gpb_5 + - abstract_gpb_6 + - abstract_gpb_7 + vmme_vlc_group: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/vmme_vlc.yml + description: | + Module HOT template to create vmme 8 vlcs + members: + - abstract_vlc + outputs: + oam_management_v4_address: + description: ID of OAM VIP to be provisioned in A&AI + value: + get_input: vip_oam_management_v4_ip + fsb_volume_id_1: + description: ID of Cinder Volume for FSB2 + value: fsb_volume_1 + security_group_sctp_b_id: + description: ID of sctpb_security_group + value: UNSUPPORTED_RESOURCE_sctpb_security_group + service_instance_id_0: + description: ID of Service Instance used for vLCs + value: UNSUPPORTED_RESOURCE_template_ServiceInstance_VLC + security_group_sctp_a_id: + description: ID of sctpa_security_group + value: UNSUPPORTED_RESOURCE_sctpa_security_group + fsb_volume_id_0: + description: ID of Cinder Volume for FSB1 + value: fsb_volume_0 + policies: + VM_Affinity_policy: + type: org.openecomp.policies.placement.Antilocate + properties: + container_type: host + targets: + - VM_Affinity_group @@ -0,0 +1,3585 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +metadata: + template_name: Main +imports: +- openecomp_heat_index: + file: openecomp-heat/_index.yml +- GlobalSubstitutionTypes: + file: GlobalSubstitutionTypesServiceTemplate.yaml +topology_template: + inputs: + vlc4_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc4_Internal2 + default: 00:80:37:0E:04:12 + sctp-a-egress_rule_application: + hidden: false + immutable: false + type: string + description: application for the SecurityGroup + default: any + sctp-b-ipv6-ingress-src_start_port: + hidden: false + immutable: false + type: float + description: IPV6 start port + default: 0 + constraints: + - in_range: + - 0 + - 65535 + ncb1_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to ncb1_Internal2 + default: 00:80:37:0E:09:12 + sctp-a-ipv6-ingress_ethertype: + hidden: false + immutable: false + type: string + description: IPV6 ethertype + default: IPv4 + gpb8_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb8_Internal1 + default: 00:80:37:0E:10:22 + sctp-a-ingress_rule_protocol: + hidden: false + immutable: false + type: string + description: protocol for the SecurityGroup + default: any + sctp-b-display_name: + hidden: false + immutable: false + type: string + description: display_name for the SecurityGroup + default: epc-sctp-b-ipv4v6-sec-group + sctp-a-ingress_ethertype: + hidden: false + immutable: false + type: string + description: ethertype for the SecurityGroup + default: IPv4 + sctp-a-egress-src_start_port: + hidden: false + immutable: false + type: float + description: start_port for the SecurityGroup + default: 0 + constraints: + - in_range: + - 0 + - 65535 + ncb_flavor_name: + hidden: false + immutable: false + type: string + description: Flavor to use for servers ncb + default: nv.c8r32d1 + vlc3_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc3_Internal1 + default: 00:80:37:0E:03:12 + Internal2_net_cidr: + hidden: false + immutable: false + type: string + description: CIDR for internal-2 network + default: 169.255.0.0 + sctp-a-egress-dst_start_port: + hidden: false + immutable: false + type: float + description: start_port for the SecurityGroup + default: 0 + constraints: + - in_range: + - 0 + - 65535 + sctp-a-egress_ethertype: + hidden: false + immutable: false + type: string + description: ethertype for the SecurityGroup + default: IPv4 + gpb4_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb4_Internal2 + default: 00:80:37:0E:0C:22 + sctp-b-ipv6-egress_rule_application: + hidden: false + immutable: false + type: string + description: IPV6 Rule-application + default: any + vlc8_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc8_Internal1 + default: 00:80:37:0E:08:12 + sctp-b-ipv6-ingress-src_end_port: + hidden: false + immutable: false + type: float + description: IPV6 ending port for destination + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + fsb2_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to fsb2_Internal1 + default: 00:80:37:0E:0D:12 + sctp-b-name: + hidden: false + immutable: false + type: string + description: name for the SecurityGroup + default: epc-sctp-b-ipv4v6-sec-group + sctp-b-ipv6-egress_ethertype: + hidden: false + immutable: false + type: string + description: IPV6 ethertype + default: IPv4 + internal_net_id_1: + hidden: false + immutable: false + type: string + description: UUID of Internal2_net + default: e3397c69-a942-49aa-81cb-fb91ff34abc8 + sctp-a-egress_dst_subnet_prefix: + hidden: false + immutable: false + type: string + description: ip_prefix for the SecurityGroup + default: 0.0.0.0 + internal_net_id_0: + hidden: false + immutable: false + type: string + description: UUID of Internal1_net + default: 871de971-22ac-47b6-befb-50e7d4cb67ea + sctp_b_net_fqdn: + hidden: false + immutable: false + type: string + description: Network FQDN SCTPB + default: default-domain:vMME-24474-Ericsson-WTC-Lab-vLCP1-4:vMME-24474-Ericsson-WTC-Lab-vLCP1-4_gn_SCTPB_net_1 + sctp-a-ipv6-ingress_rule_application: + hidden: false + immutable: false + type: string + description: IPV6 Rule-application + default: any + sctp-b-ipv6-ingress_src_subnet_prefix_len: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix length + default: '0' + ncb_name_1: + hidden: false + immutable: false + type: string + description: Name of ncb2 + default: zrdm3mmex59ncb002 + ncb_name_0: + hidden: false + immutable: false + type: string + description: Name of ncb1 + default: zrdm3mmex59ncb001 + vlc_st_virtualization_type: + hidden: false + immutable: false + type: string + description: Indicates virtualization type + default: virtual-machine + vlc2_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc2_Internal1 + default: 00:80:37:0E:02:12 + sctp-b-ingress-dst_start_port: + hidden: false + immutable: false + type: float + description: start_port for the SecurityGroup + default: 0 + constraints: + - in_range: + - 0 + - 65535 + sctp-a-display_name: + hidden: false + immutable: false + type: string + description: display_name for the SecurityGroup + default: epc-sctp-a-ipv4v6-sec-group + sctp-b-ingress_rule_application: + hidden: false + immutable: false + type: string + description: application for the SecurityGroup + default: any + int2_sec_group_name: + hidden: false + immutable: false + type: string + description: SecurityGroup name for internal-2 + default: int2-sec-group + gpb5_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb5_Internal2 + default: 00:80:37:0E:0D:22 + sctp-a-egress-dst_subnet_prefix_v6: + hidden: false + immutable: false + type: string + description: dst subnet + default: '::' + OS::stack_name: + type: string + required: false + sctp-b-egress-src_end_port: + hidden: false + immutable: false + type: float + description: end_port for the SecurityGroup + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + Internal2_shared: + hidden: false + immutable: false + type: string + description: Whether Shared or private internal-2 network + default: false + sctp-a-ipv6-egress_rule_protocol: + hidden: false + immutable: false + type: string + description: IPV6 Rule-protocol + default: any + Internal2_rpf: + hidden: false + immutable: false + type: string + description: Reverse Path Forwarding Enabled/Disabled internal-2 network + default: disable + vlc5_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc5_Internal2 + default: 00:80:37:0E:05:12 + sctp-a-ipv6-egress_src_end_port: + hidden: false + immutable: false + type: string + description: IPV6 end port + default: 65535 + Internal1_forwarding_mode: + hidden: false + immutable: false + type: string + description: L2 or L3 forwarding mode for internal-1 network + default: l2 + gpb3_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb3_Internal1 + default: 00:80:37:0E:0B:22 + vip_oam_management_v4_ip: + hidden: false + immutable: false + type: string + description: IP address of OAM service IP address to be provisioned in A&AI + default: 107.239.72.176 + vmi_oam_preference_primary: + hidden: false + immutable: false + type: float + description: Preference for primary interface/port + default: 200 + sctp-b-src_subnet_prefix_v6: + hidden: false + immutable: false + type: string + description: ip_prefix for the SecurityGroup + default: '::' + sctp-a-egress_dst_subnet_prefix_len: + hidden: false + immutable: false + type: float + description: ip_prefix_len for the SecurityGroup + default: '0' + constraints: + - in_range: + - 0 + - 32 + security_group_sctp_b_id: + hidden: false + immutable: false + type: string + description: Security Group UUID for output + default: 92a4ae54-1733-4d03-b488-f178bb9f7b82 + Internal2_forwarding_mode: + hidden: false + immutable: false + type: string + description: L2 or L3 forwarding mode for internal-2 network + default: l2 + sctp-a-ipv6-egress_dst_end_port: + hidden: false + immutable: false + type: string + description: IPV6 end port + default: 65535 + sctp-b-egress-dst_subnet_prefix_v6: + hidden: false + immutable: false + type: string + description: dst subnet + default: '::' + sctp-b-egress_dst_subnet_prefix: + hidden: false + immutable: false + type: string + description: ip_prefix for the SecurityGroup + default: 0.0.0.0 + security_group_oam_id: + hidden: false + immutable: false + type: string + description: Security Group UUID for output + default: 4ae4aa74-3e8e-4f2b-8b5f-a8bd262da96b + gpb2_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb2_Internal1 + default: 00:80:37:0E:0A:22 + security_group_int1_id: + hidden: false + immutable: false + type: string + description: UUID of Internal1_net security group + default: 94c62578-835d-4801-9372-70a2cfb22683 + sctp-a-egress_action: + hidden: false + immutable: false + type: string + description: simple_action for the SecurityGroup + default: pass + oam_net_fqdn: + hidden: false + immutable: false + type: string + description: Network FQDN OAM + default: default-domain:vMME-24474-Ericsson-WTC-Lab-vLCP1-4:vMME-24474-Ericsson-WTC-Lab-vLCP1-4_OAM_net_1 + ncb2_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to ncb2_Internal2 + default: 00:80:37:0E:0F:12 + vlc_st_interface_type_sctp_a: + hidden: false + immutable: false + type: string + description: service_interface_type for the ServiceTemplate + default: left + gpb3_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb3_Internal2 + default: 00:80:37:0E:0B:22 + vlc_st_interface_type_sctp_b: + hidden: false + immutable: false + type: string + description: service_interface_type for the ServiceTemplate + default: right + gpb1_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb1_Internal2 + default: 00:80:37:0E:09:22 + oam_net_name: + hidden: false + immutable: false + type: string + description: Network Name OAM + default: vMME-24474-Ericsson-WTC-Lab-vLCP1-4_OAM_net_1 + sctp-b-ingress-src_start_port: + hidden: false + immutable: false + type: float + description: start_port for the SecurityGroup + default: 0 + constraints: + - in_range: + - 0 + - 65535 + fsb1_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to fsb1_Internal1 + default: 00:80:37:0E:0B:12 + sctp-b-ingress_dst_addresses: + hidden: false + immutable: false + type: string + description: security_group for the SecurityGroup + default: local + vlc_st_interface_type_oam: + hidden: false + immutable: false + type: string + description: service_interface_type for the ServiceTemplate + default: management + shc_monitor_type: + hidden: false + immutable: false + type: string + description: health check + default: PING + oam_sec_group_name: + hidden: false + immutable: false + type: string + description: SecurityGroup name for OAM + default: oam-sec-group + Internal2_net_gateway: + hidden: false + immutable: false + type: string + description: gateway for internal-2 network + default: 169.255.0.3 + evac_policy: + hidden: false + immutable: false + type: string + description: CMHA Policy + default: Evacuate + server_group_id_0: + hidden: false + immutable: false + type: string + description: ID of Anti-Affinity Policy-based Server Group + default: ec99a73d-38f8-4280-8103-ba8ee584629f + vlc8_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc8_Internal2 + default: 00:80:37:0E:08:12 + sctp-b-ipv6-egress_rule_protocol: + hidden: false + immutable: false + type: string + description: IPV6 Rule-protocol + default: any + gtp_sec_group_name: + hidden: false + immutable: false + type: string + description: SecurityGroup name for GTP + default: gtp-sec-group + vlc_sctp_b_v6_ip_2: + hidden: false + immutable: false + type: string + description: Static IP vlc3 SCTPB + default: fd00:200:200:5:0:0:0:24 + vlc_sctp_b_v6_ip_1: + hidden: false + immutable: false + type: string + description: Static IP vlc2 SCTPB + default: fd00:200:200:5:0:0:0:17 + sctp-a-ipv6-egress_dst_subnet_prefix: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix + default: 0.0.0.0 + vlc_sctp_b_v6_ip_0: + hidden: false + immutable: false + type: string + description: Static IP vlc1 SCTPB + default: fd00:200:200:5:0:0:0:16 + vlc4_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc4_Internal1 + default: 00:80:37:0E:04:12 + vlc_sctp_b_v6_ip_6: + hidden: false + immutable: false + type: string + description: Static IP vlc7 SCTPB + default: fd00:200:200:5:0:0:0:28 + vlc_sctp_b_v6_ip_5: + hidden: false + immutable: false + type: string + description: Static IP vlc6 SCTPB + default: fd00:200:200:5:0:0:0:27 + vlc_sctp_b_v6_ip_4: + hidden: false + immutable: false + type: string + description: Static IP vlc5 SCTPB + default: fd00:200:200:5:0:0:0:26 + vlc_sctp_b_v6_ip_3: + hidden: false + immutable: false + type: string + description: Static IP vlc4 SCTPB + default: fd00:200:200:5:0:0:0:25 + sctp_b_net_name: + hidden: false + immutable: false + type: string + description: Network Name SCTPB + default: vMME-24474-Ericsson-WTC-Lab-vLCP1-4_gn_SCTPB_net_1 + sctp-b-ipv6-egress_dst_subnet_prefix_len: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix + default: '0' + sctp-a-egress_rule_protocol: + hidden: false + immutable: false + type: string + description: protocol for the SecurityGroup + default: any + Internal1_shared: + hidden: false + immutable: false + type: string + description: Whether Shared or private internal-1 network + default: false + shc_url_path: + hidden: false + immutable: false + type: string + description: health check + default: local-ip + Internal2_net_cidr_len: + hidden: false + immutable: false + type: string + description: CIDR length for internal-2 network + default: 17 + sctp-a-ingress-src_end_port: + hidden: false + immutable: false + type: float + description: end_port for the SecurityGroup + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + sctp-b-ipv6-ingress_src_subnet_prefix: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix + default: 0.0.0.0 + sctp-a-egress-dst_end_port: + hidden: false + immutable: false + type: float + description: end_port for the SecurityGroup + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + sctp-a-ingress_action: + hidden: false + immutable: false + type: string + description: simple_action for the SecurityGroup + default: pass + sctp-b-ipv6-ingress_action: + hidden: false + immutable: false + type: string + description: IPV6 action + default: pass + vlc_st_service_type: + hidden: false + immutable: false + type: string + description: service type + default: firewall + sctp-b-ipv6-ingress-dst_start_port: + hidden: false + immutable: false + type: string + description: IPV6 starting port for destination + default: 0 + vlc_st_availability_zone: + hidden: false + immutable: false + type: string + description: Indicates availability zone is enabled + default: true + vlc7_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc7_Internal1 + default: 00:80:37:0E:07:12 + fsb_volume_image_name_1: + label: MME_FSB2 + hidden: false + immutable: false + type: string + description: volume name + default: MME_FSB2_1_3_GA.qcow2 + vlc_oam_ip_6: + hidden: false + immutable: false + type: string + description: Static IP vlc7 OAM + default: 107.239.72.151 + sctp-a-ipv6-ingress_src_subnet_prefix_len: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix length + default: '0' + vlc_oam_ip_7: + hidden: false + immutable: false + type: string + description: Static IP vlc8 OAM + default: 107.239.72.152 + Internal1_allow_transit: + hidden: false + immutable: false + type: string + description: Allow/disallow transit internal-1 network + default: true + vlc_oam_ip_2: + hidden: false + immutable: false + type: string + description: Static IP vlc3 OAM + default: 107.239.72.157 + vlc_oam_ip_3: + hidden: false + immutable: false + type: string + description: Static IP vlc4 OAM + default: 107.239.72.158 + vlc_gtp_ip_0: + hidden: false + immutable: false + type: string + description: Static IP vlc1 GTP + default: 107.243.47.208 + vlc_oam_ip_4: + hidden: false + immutable: false + type: string + description: Static IP vlc5 OAM + default: 107.239.72.149 + fsb_volume_image_name_0: + label: MME_FSB1 + hidden: false + immutable: false + type: string + description: volume name + default: MME_FSB1_1_3_GA.qcow2 + vlc_gtp_ip_1: + hidden: false + immutable: false + type: string + description: Static IP vlc2 GTP + default: 107.243.47.209 + vlc_oam_ip_5: + hidden: false + immutable: false + type: string + description: Static IP vlc6 OAM + default: 107.239.72.150 + vlc_gtp_ip_2: + hidden: false + immutable: false + type: string + description: Static IP vlc3 GTP + default: 107.243.47.216 + vlc_name_6: + hidden: false + immutable: false + type: string + description: Name of vlc7 + default: zrdm3mmex59vlc007 + vlc_gtp_ip_3: + hidden: false + immutable: false + type: string + description: Static IP vlc4 GTP + default: 107.243.47.217 + vlc_name_7: + hidden: false + immutable: false + type: string + description: Name of vlc8 + default: zrdm3mmex59vlc008 + security_group_sctp_a_id: + hidden: false + immutable: false + type: string + description: Security Group UUID for output + default: 3cd8a524-77ff-4980-ae2a-d19ba70e0511 + vlc_gtp_ip_4: + hidden: false + immutable: false + type: string + description: Static IP vlc5 GTP + default: 107.243.47.218 + vlc_gtp_ip_5: + hidden: false + immutable: false + type: string + description: Static IP vlc6 GTP + default: 107.243.47.219 + vlc_gtp_ip_6: + hidden: false + immutable: false + type: string + description: Static IP vlc7 GTP + default: 107.243.47.220 + vlc_name_2: + hidden: false + immutable: false + type: string + description: Name of vlc3 + default: zrdm3mmex59vlc003 + vlc_gtp_ip_7: + hidden: false + immutable: false + type: string + description: Static IP vlc8 GTP + default: 107.243.47.221 + vlc_name_3: + hidden: false + immutable: false + type: string + description: Name of vlc4 + default: zrdm3mmex59vlc004 + vlc_name_4: + hidden: false + immutable: false + type: string + description: Name of vlc5 + default: zrdm3mmex59vlc005 + vlc_name_5: + hidden: false + immutable: false + type: string + description: Name of vlc6 + default: zrdm3mmex59vlc006 + fsb_volume_id_1: + hidden: false + immutable: false + type: string + description: ID of Cinder Volume for FSB2 + default: 5bd0560c-bfd0-47dc-a84a-554e2698c925 + sctp-a-ipv6-ingress_action: + hidden: false + immutable: false + type: string + description: IPV6 action + default: pass + vlc_name_0: + hidden: false + immutable: false + type: string + description: Name of vlc1 + default: zrdm3mmex59vlc001 + vlc_name_1: + hidden: false + immutable: false + type: string + description: Name of vlc2 + default: zrdm3mmex59vlc002 + vlc_oam_route_prefixes: + hidden: false + immutable: false + type: json + description: Route prefixes for static routing on OAM + sctp-b-egress_rule_application: + hidden: false + immutable: false + type: string + description: application for the SecurityGroup + default: any + vlc_oam_ip_0: + hidden: false + immutable: false + type: string + description: Static IP vlc1 OAM + default: 107.239.72.155 + vlc_oam_ip_1: + hidden: false + immutable: false + type: string + description: Static IP vlc2 OAM + default: 107.239.72.156 + vlc6_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc6_Internal1 + default: 00:80:37:0E:06:12 + fsb_volume_id_0: + hidden: false + immutable: false + type: string + description: ID of Cinder Volume for FSB1 + default: 27baa6a0-b701-4795-bf5e-4f546b350b1f + sctp-b-egress-dst_end_port: + hidden: false + immutable: false + type: float + description: end_port for the SecurityGroup + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + gpb2_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb2_Internal2 + default: 00:80:37:0E:0A:22 + sctp-a-ipv6-egress_rule_application: + hidden: false + immutable: false + type: string + description: IPV6 Rule-application + default: any + sctp-b-ipv6-egress_src_start_port: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix + default: 0 + Internal2_allow_transit: + hidden: false + immutable: false + type: string + description: Allow/disallow transit internal-2 network + default: true + fsb_volume_size: + label: volume size + hidden: false + immutable: false + type: float + description: volume size 320GB + default: 320 + constraints: + - in_range: + - 0 + - 340 + sctp-b-IPv6_ethertype: + hidden: false + immutable: false + type: string + description: IPV6 ethertype + default: IPv6 + gtp_net_fqdn: + hidden: false + immutable: false + type: string + description: Network FQDN GTP + default: default-domain:vMME-24474-Ericsson-WTC-Lab-vLCP1-4:vMME-24474-Ericsson-WTC-Lab-vLCP1-4_gn_GTP_net_1 + ncb2_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to ncb2_Internal1 + default: 00:80:37:0E:0F:12 + sctp-b-ingress_rule_protocol: + hidden: false + immutable: false + type: string + description: protocol for the SecurityGroup + default: any + sctp-b-ingress_action: + hidden: false + immutable: false + type: string + description: simple_action for the SecurityGroup + default: pass + sctp-b-egress_src_addresses: + hidden: false + immutable: false + type: string + description: security_group for the SecurityGroup + default: local + gpb7_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb7_Internal2 + default: 00:80:37:0E:0F:22 + sctp-a-ipv6-ingress-dst_start_port: + hidden: false + immutable: false + type: string + description: IPV6 starting port for destination + default: 0 + gtp_net_name: + hidden: false + immutable: false + type: string + description: Network Name GTP + default: vMME-24474-Ericsson-WTC-Lab-vLCP1-4_gn_GTP_net_1 + sctp-b-ipv6-ingress_rule_application: + hidden: false + immutable: false + type: string + description: IPV6 Rule-application + default: any + domain_name: + hidden: false + immutable: false + type: string + description: Unique name of vMME contrail domain + default: default-domain + vlc5_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc5_Internal1 + default: 00:80:37:0E:05:12 + sctp-a-egress_src_addresses: + hidden: false + immutable: false + type: string + description: security_group for the SecurityGroup + default: local + sctp-b-egress-src_start_port: + hidden: false + immutable: false + type: float + description: start_port for the SecurityGroup + default: 0 + constraints: + - in_range: + - 0 + - 65535 + shc_enabled: + hidden: false + immutable: false + type: string + description: health check + default: true + sctp-b-ipv6-ingress-dst_end_port: + hidden: false + immutable: false + type: string + description: IPV6 end port + default: 65535 + sctp-b-dst_subnet_prefix_v6: + hidden: false + immutable: false + type: string + description: ip_prefix for the SecurityGroup + default: '::' + sctp_a_net_fqdn: + hidden: false + immutable: false + type: string + description: Network FQDN SCTPA + default: default-domain:vMME-24474-Ericsson-WTC-Lab-vLCP1-4:vMME-24474-Ericsson-WTC-Lab-vLCP1-4_gn_SCTPA_net_1 + security_group_gtp_id: + hidden: false + immutable: false + type: string + description: Security Group UUID for output + default: e8ad3fe2-5f95-43e4-bbcc-da97b1c22588 + sctp-a-ipv6-ingress_src_subnet_prefix: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix + default: 0.0.0.0 + fsb_name_1: + hidden: false + immutable: false + type: string + description: Name of fsb1 + default: zrdm3mmex59fsb002 + sctp-b-egress-dst_start_port: + hidden: false + immutable: false + type: float + description: start_port for the SecurityGroup + default: 0 + constraints: + - in_range: + - 0 + - 65535 + fsb_name_0: + hidden: false + immutable: false + type: string + description: Name of fsb1 + default: zrdm3mmex59fsb001 + sctp_a_net_name: + hidden: false + immutable: false + type: string + description: Network Name SCTPA + default: vMME-24474-Ericsson-WTC-Lab-vLCP1-4_gn_SCTPA_net_1 + sctp-b-egress_dst_subnet_prefix_len: + hidden: false + immutable: false + type: float + description: ip_prefix_len for the SecurityGroup + default: '0' + constraints: + - in_range: + - 0 + - 32 + gpb1_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb1_Internal1 + default: 00:80:37:0E:09:22 + sctp-a-ingress-dst_start_port: + hidden: false + immutable: false + type: float + description: start_port for the SecurityGroup + default: 0 + constraints: + - in_range: + - 0 + - 65535 + fsb1_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to fsb1_Internal2 + default: 00:80:37:0E:0B:12 + vlc_st_service_mode: + hidden: false + immutable: false + type: string + description: service mode + default: in-network-nat + sctp-a-ipv6-egress_ethertype: + hidden: false + immutable: false + type: string + description: IPV6 ethertype + default: IPv4 + sctp-a-egress-src_end_port: + hidden: false + immutable: false + type: float + description: end_port for the SecurityGroup + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + sctp-b-egress_action: + hidden: false + immutable: false + type: string + description: simple_action for the SecurityGroup + default: pass + sctp-a-ingress-src_subnet_prefix_len: + hidden: false + immutable: false + type: float + description: ip_prefix_len for the SecurityGroup + default: '0' + constraints: + - in_range: + - 0 + - 32 + sctp-a-ipv6-ingress-src_start_port: + hidden: false + immutable: false + type: float + description: IPV6 start port + default: 0 + constraints: + - in_range: + - 0 + - 65535 + vf_module_id: + hidden: false + immutable: false + type: string + description: the vf_module_id for this instance. UUID provided by ECOMP + default: TWO + Internal1_net_cidr: + hidden: false + immutable: false + type: string + description: CIDR for internal-1 network + default: 169.253.0.0 + fsb_flavor_name: + hidden: false + immutable: false + type: string + description: Flavor to use for servers fsb1 + default: nv.c8r32d1 + sctp_rule_protocol: + hidden: false + immutable: false + type: string + description: protocol for the SecurityGroup + default: 132 + vnf_name: + hidden: false + immutable: false + type: string + description: the vnf_name for this instance. provided by ECOMP + default: zrdm3mmex59 + sctp-a-IPv6_ethertype: + hidden: false + immutable: false + type: string + description: IPV6 ethertype + default: IPv6 + vlc_sctp_b_v6_ip_7: + hidden: false + immutable: false + type: string + description: Static IP vlc8 SCTPB + default: fd00:200:200:5:0:0:0:29 + vlc6_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc6_Internal2 + default: 00:80:37:0E:06:12 + sctp-b-ingress-dst_end_port: + hidden: false + immutable: false + type: float + description: end_port for the SecurityGroup + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + vlc7_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc7_Internal2 + default: 00:80:37:0E:07:12 + sctp-a-ipv6-ingress-src_end_port: + hidden: false + immutable: false + type: float + description: IPV6 ending port for destination + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + vlc_flavor_name: + hidden: false + immutable: false + type: string + description: Flavor to use for servers vlc + default: nd.c16r64d1 + sctp-b-ipv6-egress_src_addresses: + hidden: false + immutable: false + type: string + description: IPV6 source + default: local + vlc_st_interface_type_int1: + hidden: false + immutable: false + type: string + description: service_interface_type for the ServiceTemplate + default: other1 + availability_zone_0: + hidden: false + immutable: false + type: string + description: cluster for spawnning fsb instances + default: rdm3-kvm-az02 + service_instance_id_0: + hidden: false + immutable: false + type: string + description: UUID of service instance for vLCs + default: 77c67cc8-d15f-47bc-aeb1-8d65d09e917a + availability_zone_1: + hidden: false + immutable: false + type: string + description: cluster for spawnning ncb instances + default: rdm3-kvm-az02 + vlc_st_interface_type_int2: + hidden: false + immutable: false + type: string + description: service_interface_type for the ServiceTemplate + default: other2 + sctp-a-ipv6-egress-dst_start_port: + hidden: false + immutable: false + type: string + description: IPV6 start port + default: 0 + sctp-a-ipv6-egress_dst_subnet_prefix_len: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix + default: '0' + vlc_sctp_a_ip_0: + hidden: false + immutable: false + type: string + description: Static IP vlc1 SCTPA + default: 107.243.47.144 + vlc_sctp_b_route_prefixes: + hidden: false + immutable: false + type: json + description: Route prefixes for static routing on SCTPB + vlc1_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc1_Internal1 + default: 00:80:37:0E:01:12 + sctp-b-ipv6-egress_src_end_port: + hidden: false + immutable: false + type: string + description: IPV6 end port + default: 65535 + sctp-a-ipv6-egress_src_addresses: + hidden: false + immutable: false + type: string + description: IPV6 source + default: local + vlc_sctp_a_ip_7: + hidden: false + immutable: false + type: string + description: Static IP vlc8 SCTPA + default: 107.243.47.157 + sctp-a-ingress-src_subnet_prefix_v6: + hidden: false + immutable: false + type: string + description: src subnet + default: '::' + vlc_sctp_a_ip_6: + hidden: false + immutable: false + type: string + description: Static IP vlc7 SCTPA + default: 107.243.47.156 + vlc_sctp_a_ip_5: + hidden: false + immutable: false + type: string + description: Static IP vlc6 SCTPA + default: 107.243.47.155 + sctp-a-ingress-dst_end_port: + hidden: false + immutable: false + type: float + description: end_port for the SecurityGroup + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + vlc_sctp_a_ip_4: + hidden: false + immutable: false + type: string + description: Static IP vlc5 SCTPA + default: 107.243.47.154 + vlc_sctp_a_ip_3: + hidden: false + immutable: false + type: string + description: Static IP vlc4 SCTPA + default: 107.243.47.153 + vlc_sctp_a_ip_2: + hidden: false + immutable: false + type: string + description: Static IP vlc3 SCTPA + default: 107.243.47.152 + vlc_sctp_a_ip_1: + hidden: false + immutable: false + type: string + description: Static IP vlc2 SCTPA + default: 107.243.47.145 + gpb6_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb6_Internal2 + default: 00:80:37:0E:0E:22 + security_group_int2_id: + hidden: false + immutable: false + type: string + description: UUID of Internal1_net security group + default: 1361f069-baf2-4b76-b321-7f68ba26c369 + Internal2_dhcp: + hidden: false + immutable: false + type: string + description: Whether DHCP/static IP addressing on internal-2 network + default: false + sctp-a-dst_subnet_prefix_v6: + hidden: false + immutable: false + type: string + description: ip_prefix for the SecurityGroup + default: '::' + pxe_image_name: + hidden: false + immutable: false + type: string + description: Name of image to use for server ncb + default: MME_PXE-Boot_1_3_GA.qcow2 + vlc_st_interface_type_gtp: + hidden: false + immutable: false + type: string + description: service_interface_type for the ServiceTemplate + default: other0 + ncb1_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to ncb1_Internal1 + default: 00:80:37:0E:09:12 + vlc_gtp_route_prefixes: + hidden: false + immutable: false + type: json + description: Route prefixes for static routing on GTP + int1_sec_group_name: + hidden: false + immutable: false + type: string + description: SecurityGroup name for internal-1 + default: int1-sec-group + vmi_oam_preference_secondary: + hidden: false + immutable: false + type: float + description: Preference for secondary interface/port + default: 100 + Internal1_dhcp: + hidden: false + immutable: false + type: string + description: Whether DHCP/static IP addressing on internal-1 network + default: false + fsb2_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to fsb2_Internal2 + default: 00:80:37:0E:0D:12 + Internal1_net_cidr_len: + hidden: false + immutable: false + type: string + description: CIDR length for internal-1 network + default: 17 + sctp-a-ingress_dst_addresses: + hidden: false + immutable: false + type: string + description: security_group for the SecurityGroup + default: local + sctp-b-ingress-src_subnet_prefix_len: + hidden: false + immutable: false + type: float + description: ip_prefix_len for the SecurityGroup + default: '0' + constraints: + - in_range: + - 0 + - 32 + fsb_oam_ip_1: + hidden: false + immutable: false + type: string + description: IP address of OAM vNIC for FSB2 + default: 107.239.72.154 + fsb_oam_ip_0: + hidden: false + immutable: false + type: string + description: IP address of OAM vNIC for FSB1 + default: 107.239.72.153 + shc_timeout: + hidden: false + immutable: false + type: string + description: health check + default: 5 + vlc_st_version: + hidden: false + immutable: false + type: string + description: Indicates service version + default: 2 + sctp-a-src_subnet_prefix_v6: + hidden: false + immutable: false + type: string + description: ip_prefix for the SecurityGroup + default: '::' + sctp-a-ingress_rule_application: + hidden: false + immutable: false + type: string + description: application for the SecurityGroup + default: any + sctp-b-egress_ethertype: + hidden: false + immutable: false + type: string + description: ethertype for the SecurityGroup + default: IPv4 + sctp-a-ipv6-egress_src_start_port: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix + default: 0 + instance_ip_family_v6: + hidden: false + immutable: false + type: string + description: Ipv6 instance type + default: v6 + sctp-b-ingress-src_subnet_prefix_v6: + hidden: false + immutable: false + type: string + description: src subnet + default: '::' + gpb8_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb8_Internal2 + default: 00:80:37:0E:10:22 + gpb4_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb4_Internal1 + default: 00:80:37:0E:0C:22 + sctp-a-ipv6-ingress-dst_end_port: + hidden: false + immutable: false + type: string + description: IPV6 end port + default: 65535 + Internal1_net_gateway: + hidden: false + immutable: false + type: string + description: gateway for internal-1 network + default: 169.253.0.3 + sctp-b-ipv6-egress-dst_start_port: + hidden: false + immutable: false + type: string + description: IPV6 start port + default: 0 + gpb_name_7: + hidden: false + immutable: false + type: string + description: Name of gpb8 + default: zrdm3mmex59gpb0016 + gpb_name_6: + hidden: false + immutable: false + type: string + description: Name of gpb7 + default: zrdm3mmex59gpb0015 + gpb_name_5: + hidden: false + immutable: false + type: string + description: Name of gpb6 + default: zrdm3mmex59gpb0014 + gpb_name_4: + hidden: false + immutable: false + type: string + description: Name of gpb5 + default: zrdm3mmex59gpb0013 + gpb_name_3: + hidden: false + immutable: false + type: string + description: Name of gpb4 + default: zrdm3mmex59gpb0012 + sctp-a-ipv6-ingress_dst_addresses: + hidden: false + immutable: false + type: string + description: IPV6 destination + default: local + gpb_name_2: + hidden: false + immutable: false + type: string + description: Name of gpb3 + default: zrdm3mmex59gpb0011 + shc_delay: + hidden: false + immutable: false + type: string + description: health check + default: 3 + gpb_name_1: + hidden: false + immutable: false + type: string + description: Name of gpb2 + default: zrdm3mmex59gpb0010 + sctp-b-ipv6-egress_action: + hidden: false + immutable: false + type: string + description: IPV6 action + default: pass + vlc3_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc3_Internal2 + default: 00:80:37:0E:03:12 + gpb_name_0: + hidden: false + immutable: false + type: string + description: Name of gpb1 + default: zrdm3mmex59gpb009 + sctp-a-ipv6-egress_action: + hidden: false + immutable: false + type: string + description: IPV6 action + default: pass + gpb5_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb5_Internal1 + default: 00:80:37:0E:0D:22 + sctp-b-ipv6-ingress_rule_protocol: + hidden: false + immutable: false + type: string + description: IPV6 Rule-protocol + default: any + shc_max_retries: + hidden: false + immutable: false + type: string + description: health check + default: 2 + fsb_volume_type: + label: volume type + hidden: false + immutable: false + type: string + description: volume type SolidFire + default: SF-Default-SSD + sctp-a-name: + hidden: false + immutable: false + type: string + description: name for the SecurityGroup + default: epc-sctp-a-ipv4v6-sec-group + vlc_sctp_b_ip_5: + hidden: false + immutable: false + type: string + description: Static IP vlc6 SCTPB + default: 107.243.47.187 + vlc_sctp_b_ip_4: + hidden: false + immutable: false + type: string + description: Static IP vlc5 SCTPB + default: 107.243.47.186 + vlc_sctp_b_ip_3: + hidden: false + immutable: false + type: string + description: Static IP vlc4 SCTPB + default: 107.243.47.185 + vlc_sctp_b_ip_2: + hidden: false + immutable: false + type: string + description: Static IP vlc3 SCTPB + default: 107.243.47.184 + sctp-b-egress_rule_protocol: + hidden: false + immutable: false + type: string + description: protocol for the SecurityGroup + default: any + vnf_id: + hidden: false + immutable: false + type: string + description: the vf_id for this instance. UUID provided by ECOMP + default: zrdm3mmex59 + vlc_sctp_b_ip_7: + hidden: false + immutable: false + type: string + description: Static IP vlc8 SCTPB + default: 107.243.47.189 + vlc_sctp_b_ip_6: + hidden: false + immutable: false + type: string + description: Static IP vlc7 SCTPB + default: 107.243.47.188 + vlc_sctp_b_ip_1: + hidden: false + immutable: false + type: string + description: Static IP vlc2 SCTPB + default: 107.243.47.177 + gpb6_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb6_Internal1 + default: 00:80:37:0E:0E:22 + sctp-b-ipv6-egress_dst_end_port: + hidden: false + immutable: false + type: string + description: IPV6 end port + default: 65535 + vlc_sctp_b_ip_0: + hidden: false + immutable: false + type: string + description: Static IP vlc1 SCTPB + default: 107.243.47.176 + vlc2_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc2_Internal2 + default: 00:80:37:0E:02:12 + sctp-b-ingress-src_subnet_prefix: + hidden: false + immutable: false + type: string + description: ip_prefix for the SecurityGroup + default: 0.0.0.0 + gpb_flavor_name: + hidden: false + immutable: false + type: string + description: Flavor to use for servers gpb + default: nv.c20r64d1 + vlc_sctp_a_route_prefixes: + hidden: false + immutable: false + type: json + description: Route prefixes for static routing on SCTPA + sctp-b-ipv6-ingress_dst_addresses: + hidden: false + immutable: false + type: string + description: IPV6 destination + default: local + sctp-b-ipv6-ingress_ethertype: + hidden: false + immutable: false + type: string + description: IPV6 ethertype + default: IPv4 + sctp-b-ipv6-egress_dst_subnet_prefix: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix + default: 0.0.0.0 + sctp-a-ingress-src_subnet_prefix: + hidden: false + immutable: false + type: string + description: ip_prefix for the SecurityGroup + default: 0.0.0.0 + vlc1_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc1_Internal2 + default: 00:80:37:0E:01:12 + Internal1_rpf: + hidden: false + immutable: false + type: string + description: Reverse Path Forwarding Enabled/Disabled internal-1 network + default: disable + sctp-b-ingress_ethertype: + hidden: false + immutable: false + type: string + description: ethertype for the SecurityGroup + default: IPv4 + sctp-b-ingress-src_end_port: + hidden: false + immutable: false + type: float + description: end_port for the SecurityGroup + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + sctp-a-ipv6-ingress_rule_protocol: + hidden: false + immutable: false + type: string + description: IPV6 Rule-protocol + default: any + vlc_sctp_a_v6_ip_7: + hidden: false + immutable: false + type: string + description: Static IP vlc8 SCTPA + default: fd00:200:200:4:0:0:0:29 + vlc_sctp_a_v6_ip_6: + hidden: false + immutable: false + type: string + description: Static IP vlc7 SCTPA + default: fd00:200:200:4:0:0:0:28 + gpb7_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb7_Internal1 + default: 00:80:37:0E:0F:22 + vlc_sctp_a_v6_ip_5: + hidden: false + immutable: false + type: string + description: Static IP vlc6 SCTPA + default: fd00:200:200:4:0:0:0:27 + vlc_sctp_a_v6_ip_4: + hidden: false + immutable: false + type: string + description: Static IP vlc5 SCTPA + default: fd00:200:200:4:0:0:0:26 + vlc_sctp_a_v6_ip_3: + hidden: false + immutable: false + type: string + description: Static IP vlc4 SCTPA + default: fd00:200:200:4:0:0:0:25 + vlc_sctp_a_v6_ip_2: + hidden: false + immutable: false + type: string + description: Static IP vlc3 SCTPA + default: fd00:200:200:4:0:0:0:24 + sctp-a-ingress-src_start_port: + hidden: false + immutable: false + type: float + description: start_port for the SecurityGroup + default: 0 + constraints: + - in_range: + - 0 + - 65535 + vlc_sctp_a_v6_ip_1: + hidden: false + immutable: false + type: string + description: Static IP vlc2 SCTPA + default: fd00:200:200:4:0:0:0:17 + vlc_sctp_a_v6_ip_0: + hidden: false + immutable: false + type: string + description: Static IP vlc1 SCTPA + default: fd00:200:200:4:0:0:0:16 + node_templates: + abstract_gpb_1: + type: org.openecomp.resource.abstract.nodes.gpb_1 + directives: + - substitutable + properties: + compute_gpb_name: + - get_input: gpb_name_1 + vm_flavor_name: + get_input: gpb_flavor_name + compute_gpb_scheduler_hints: + - group: + get_input: server_group_id_0 + port_gpb2_Internal1_security_groups: + - - get_input: security_group_int1_id + compute_gpb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + port_gpb2_Internal2_network: + - get_input: internal_net_id_1 + port_gpb2_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + vm_image_name: + get_input: pxe_image_name + port_gpb2_Internal1_replacement_policy: + - AUTO + port_gpb2_Internal1_network: + - get_input: internal_net_id_0 + port_gpb2_Internal2_replacement_policy: + - AUTO + port_gpb2_Internal1_mac_requirements: + mac_count_required: + is_required: true + compute_gpb_availability_zone: + - get_input: availability_zone_1 + port_gpb2_Internal1_mac_address: + get_input: gpb2_Internal1_mac + port_gpb2_Internal2_mac_requirements: + mac_count_required: + is_required: true + port_gpb2_Internal2_mac_address: + get_input: gpb2_Internal1_mac + port_gpb2_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb2_Internal2_security_groups: + - - get_input: security_group_int2_id + service_template_filter: + substitute_service_template: Nested_gpb_1ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: gpb + nfc_naming_code: gpb + requirements: + - link_gpb_gpb2_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_gpb_gpb2_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + abstract_gpb_2: + type: org.openecomp.resource.abstract.nodes.gpb_2 + directives: + - substitutable + properties: + port_gpb3_Internal1_replacement_policy: + - AUTO + compute_gpb_name: + - get_input: gpb_name_2 + port_gpb3_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb3_Internal2_replacement_policy: + - AUTO + vm_flavor_name: + get_input: gpb_flavor_name + port_gpb3_Internal2_security_groups: + - - get_input: security_group_int2_id + compute_gpb_scheduler_hints: + - group: + get_input: server_group_id_0 + compute_gpb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + vm_image_name: + get_input: pxe_image_name + port_gpb3_Internal1_security_groups: + - - get_input: security_group_int1_id + port_gpb3_Internal2_network: + - get_input: internal_net_id_1 + compute_gpb_availability_zone: + - get_input: availability_zone_0 + port_gpb3_Internal1_network: + - get_input: internal_net_id_0 + port_gpb3_Internal1_mac_requirements: + mac_count_required: + is_required: true + port_gpb3_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb3_Internal1_mac_address: + get_input: gpb3_Internal1_mac + port_gpb3_Internal2_mac_address: + get_input: gpb3_Internal1_mac + port_gpb3_Internal2_mac_requirements: + mac_count_required: + is_required: true + service_template_filter: + substitute_service_template: Nested_gpb_2ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: gpb + nfc_naming_code: gpb + requirements: + - link_gpb_gpb3_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_gpb_gpb3_Internal2_diferent_name: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + abstract_vlc: + type: org.openecomp.resource.abstract.nodes.vlc + directives: + - substitutable + properties: + port_template_VMInt_SCTP_A_vlc_virtual_network_refs: + - - get_input: sctp_a_net_fqdn + port_template_VMInt_INT1_vlc_security_group_refs: + - - get_input: security_group_int1_id + vm_flavor_name: + get_input: vlc_flavor_name + port_template_VMInt_INT2_vlc_port_tuple_refs: + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc4 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc3 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc2 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc1 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc8 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc7 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc6 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc5 + vm_image_name: + get_input: pxe_image_name + port_template_VMInt_INT1_vlc_port_tuple_refs: + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc4 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc3 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc2 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc1 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc8 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc7 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc6 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc5 + port_template_VMInt_INT2_vlc_virtual_network_refs: + - - get_input: internal_net_id_1 + port_template_VMInt_OAM_vlc_virtual_network_refs: + - - get_input: oam_net_fqdn + port_template_VMInt_OAM_vlc_port_tuple_refs: + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc4 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc3 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc2 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc1 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc8 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc7 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc6 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc5 + port_template_VMInt_INT2_vlc_virtual_machine_interface_mac_addresses: + - - get_input: vlc4_Internal2_mac + - - get_input: vlc3_Internal2_mac + - - get_input: vlc2_Internal2_mac + - - get_input: vlc1_Internal2_mac + - - get_input: vlc8_Internal2_mac + - - get_input: vlc7_Internal2_mac + - - get_input: vlc6_Internal2_mac + - - get_input: vlc5_Internal2_mac + port_template_VMInt_SCTP_B_vlc_port_tuple_refs: + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc4 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc3 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc2 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc1 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc8 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc7 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc6 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc5 + port_template_VMInt_GTP_vlc_security_group_refs: + - - get_input: security_group_gtp_id + compute_vlc_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + port_template_VMInt_OAM_vlc_security_group_refs: + - - get_input: security_group_oam_id + compute_vlc_contrail_service_instance_ind: + - true + - true + - true + - true + - true + - true + - true + - true + port_template_VMInt_GTP_vlc_port_tuple_refs: + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc4 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc3 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc2 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc1 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc8 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc7 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc6 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc5 + port_template_VMInt_SCTP_B_vlc_virtual_network_refs: + - - get_input: sctp_b_net_fqdn + port_template_VMInt_INT2_vlc_security_group_refs: + - - get_input: security_group_int2_id + port_template_VMInt_SCTP_B_vlc_security_group_refs: + - - get_input: security_group_sctp_b_id + port_template_VMInt_INT1_vlc_virtual_network_refs: + - - get_input: internal_net_id_0 + port_template_VMInt_SCTP_A_vlc_port_tuple_refs: + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc4 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc3 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc2 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc1 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc8 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc7 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc6 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc5 + compute_vlc_scheduler_hints: + - group: + get_input: server_group_id_0 + - group: + get_input: server_group_id_0 + - group: + get_input: server_group_id_0 + - group: + get_input: server_group_id_0 + - group: + get_input: server_group_id_0 + - group: + get_input: server_group_id_0 + - group: + get_input: server_group_id_0 + - group: + get_input: server_group_id_0 + compute_vlc_name: + - get_input: vlc_name_3 + - get_input: vlc_name_2 + - get_input: vlc_name_1 + - get_input: vlc_name_0 + - get_input: vlc_name_7 + - get_input: vlc_name_6 + - get_input: vlc_name_5 + - get_input: vlc_name_4 + port_template_VMInt_SCTP_A_vlc_security_group_refs: + - - get_input: security_group_sctp_a_id + compute_vlc_availability_zone: + - get_input: availability_zone_1 + - get_input: availability_zone_0 + - get_input: availability_zone_1 + - get_input: availability_zone_0 + - get_input: availability_zone_1 + - get_input: availability_zone_0 + - get_input: availability_zone_1 + - get_input: availability_zone_0 + port_template_VMInt_INT1_vlc_virtual_machine_interface_mac_addresses: + - - get_input: vlc4_Internal1_mac + - - get_input: vlc3_Internal1_mac + - - get_input: vlc2_Internal1_mac + - - get_input: vlc1_Internal1_mac + - - get_input: vlc8_Internal1_mac + - - get_input: vlc7_Internal1_mac + - - get_input: vlc6_Internal1_mac + - - get_input: vlc5_Internal1_mac + port_template_VMInt_GTP_vlc_virtual_network_refs: + - - get_input: gtp_net_fqdn + service_template_filter: + substitute_service_template: Nested_vlcServiceTemplate.yaml + count: 8 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: vlc + nfc_naming_code: vlc + requirements: + - link_vlc_template_VMInt_INT2_vlc: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + - link_vlc_template_VMInt_INT1_vlc: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + abstract_gpb_7: + type: org.openecomp.resource.abstract.nodes.gpb_7 + directives: + - substitutable + properties: + compute_gpb_name: + - get_input: gpb_name_7 + port_gpb8_Internal1_mac_address: + get_input: gpb8_Internal1_mac + port_gpb8_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + vm_flavor_name: + get_input: gpb_flavor_name + compute_gpb_scheduler_hints: + - group: + get_input: server_group_id_0 + compute_gpb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + vm_image_name: + get_input: pxe_image_name + port_gpb8_Internal2_security_groups: + - - get_input: security_group_int2_id + port_gpb8_Internal1_replacement_policy: + - AUTO + port_gpb8_Internal2_replacement_policy: + - AUTO + compute_gpb_availability_zone: + - get_input: availability_zone_1 + port_gpb8_Internal1_mac_requirements: + mac_count_required: + is_required: true + port_gpb8_Internal1_network: + - get_input: internal_net_id_0 + port_gpb8_Internal2_mac_requirements: + mac_count_required: + is_required: true + port_gpb8_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb8_Internal1_security_groups: + - - get_input: security_group_int1_id + port_gpb8_Internal2_network: + - get_input: internal_net_id_1 + port_gpb8_Internal2_mac_address: + get_input: gpb8_Internal1_mac + service_template_filter: + substitute_service_template: Nested_gpb_7ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: gpb + nfc_naming_code: gpb + requirements: + - link_gpb_gpb8_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_gpb_gpb8_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + abstract_gpb_5: + type: org.openecomp.resource.abstract.nodes.gpb_5 + directives: + - substitutable + properties: + port_gpb6_Internal1_mac_requirements: + mac_count_required: + is_required: true + compute_gpb_name: + - get_input: gpb_name_5 + vm_flavor_name: + get_input: gpb_flavor_name + compute_gpb_scheduler_hints: + - group: + get_input: server_group_id_0 + compute_gpb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + port_gpb6_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + vm_image_name: + get_input: pxe_image_name + port_gpb6_Internal1_security_groups: + - - get_input: security_group_int1_id + port_gpb6_Internal2_network: + - get_input: internal_net_id_1 + compute_gpb_availability_zone: + - get_input: availability_zone_1 + port_gpb6_Internal1_network: + - get_input: internal_net_id_0 + port_gpb6_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb6_Internal2_mac_address: + get_input: gpb6_Internal1_mac + port_gpb6_Internal1_mac_address: + get_input: gpb6_Internal1_mac + port_gpb6_Internal2_mac_requirements: + mac_count_required: + is_required: true + port_gpb6_Internal2_replacement_policy: + - AUTO + port_gpb6_Internal1_replacement_policy: + - AUTO + port_gpb6_Internal2_security_groups: + - - get_input: security_group_int2_id + service_template_filter: + substitute_service_template: Nested_gpb_5ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: gpb + nfc_naming_code: gpb + requirements: + - link_gpb_gpb6_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_gpb_gpb6_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + abstract_gpb_6: + type: org.openecomp.resource.abstract.nodes.gpb_6 + directives: + - substitutable + properties: + port_gpb7_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb7_Internal1_network: + - get_input: internal_net_id_0 + compute_gpb_name: + - get_input: gpb_name_6 + port_gpb7_Internal2_network: + - get_input: internal_net_id_1 + vm_flavor_name: + get_input: gpb_flavor_name + port_gpb7_Internal1_replacement_policy: + - AUTO + port_gpb7_Internal2_replacement_policy: + - AUTO + port_gpb7_Internal2_security_groups: + - - get_input: security_group_int2_id + compute_gpb_scheduler_hints: + - group: + get_input: server_group_id_0 + compute_gpb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + vm_image_name: + get_input: pxe_image_name + port_gpb7_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb7_Internal1_security_groups: + - - get_input: security_group_int1_id + compute_gpb_availability_zone: + - get_input: availability_zone_0 + port_gpb7_Internal2_mac_address: + get_input: gpb7_Internal1_mac + port_gpb7_Internal1_mac_requirements: + mac_count_required: + is_required: true + port_gpb7_Internal1_mac_address: + get_input: gpb7_Internal1_mac + port_gpb7_Internal2_mac_requirements: + mac_count_required: + is_required: true + service_template_filter: + substitute_service_template: Nested_gpb_6ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: gpb + nfc_naming_code: gpb + requirements: + - link_gpb_gpb7_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_gpb_gpb7_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + abstract_gpb_3: + type: org.openecomp.resource.abstract.nodes.gpb_3 + directives: + - substitutable + properties: + compute_gpb_name: + - get_input: gpb_name_3 + port_gpb4_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + vm_flavor_name: + get_input: gpb_flavor_name + port_gpb4_Internal1_mac_address: + get_input: gpb4_Internal1_mac + compute_gpb_scheduler_hints: + - group: + get_input: server_group_id_0 + port_gpb4_Internal2_mac_requirements: + mac_count_required: + is_required: true + compute_gpb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + port_gpb4_Internal2_mac_address: + get_input: gpb4_Internal1_mac + vm_image_name: + get_input: pxe_image_name + port_gpb4_Internal2_security_groups: + - - get_input: security_group_int2_id + compute_gpb_availability_zone: + - get_input: availability_zone_1 + port_gpb4_Internal2_replacement_policy: + - AUTO + port_gpb4_Internal1_replacement_policy: + - AUTO + port_gpb4_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb4_Internal1_security_groups: + - - get_input: security_group_int1_id + port_gpb4_Internal2_network: + - get_input: internal_net_id_1 + port_gpb4_Internal1_mac_requirements: + mac_count_required: + is_required: true + port_gpb4_Internal1_network: + - get_input: internal_net_id_0 + service_template_filter: + substitute_service_template: Nested_gpb_3ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: gpb + nfc_naming_code: gpb + requirements: + - link_gpb_gpb4_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_gpb_gpb4_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + abstract_gpb_4: + type: org.openecomp.resource.abstract.nodes.gpb_4 + directives: + - substitutable + properties: + port_gpb5_Internal2_mac_requirements: + mac_count_required: + is_required: true + port_gpb5_Internal1_security_groups: + - - get_input: security_group_int1_id + compute_gpb_name: + - get_input: gpb_name_4 + vm_flavor_name: + get_input: gpb_flavor_name + port_gpb5_Internal1_mac_requirements: + mac_count_required: + is_required: true + compute_gpb_scheduler_hints: + - group: + get_input: server_group_id_0 + port_gpb5_Internal2_network: + - get_input: internal_net_id_1 + compute_gpb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + vm_image_name: + get_input: pxe_image_name + port_gpb5_Internal1_network: + - get_input: internal_net_id_0 + port_gpb5_Internal2_mac_address: + get_input: gpb5_Internal1_mac + port_gpb5_Internal1_mac_address: + get_input: gpb5_Internal1_mac + port_gpb5_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb5_Internal2_replacement_policy: + - AUTO + compute_gpb_availability_zone: + - get_input: availability_zone_0 + port_gpb5_Internal1_replacement_policy: + - AUTO + port_gpb5_Internal2_security_groups: + - - get_input: security_group_int2_id + port_gpb5_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + service_template_filter: + substitute_service_template: Nested_gpb_4ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: gpb + nfc_naming_code: gpb + requirements: + - link_gpb_gpb5_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_gpb_gpb5_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + abstract_gpb: + type: org.openecomp.resource.abstract.nodes.gpb + directives: + - substitutable + properties: + port_gpb1_Internal1_security_groups: + - - get_input: security_group_int1_id + compute_gpb_name: + - get_input: gpb_name_0 + port_gpb1_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + vm_flavor_name: + get_input: gpb_flavor_name + port_gpb1_Internal1_mac_requirements: + mac_count_required: + is_required: true + compute_gpb_scheduler_hints: + - group: + get_input: server_group_id_0 + compute_gpb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + vm_image_name: + get_input: pxe_image_name + port_gpb1_Internal1_mac_address: + get_input: gpb1_Internal1_mac + port_gpb1_Internal2_mac_address: + get_input: gpb1_Internal1_mac + port_gpb1_Internal2_mac_requirements: + mac_count_required: + is_required: true + compute_gpb_availability_zone: + - get_input: availability_zone_0 + port_gpb1_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb1_Internal2_security_groups: + - - get_input: security_group_int2_id + port_gpb1_Internal1_replacement_policy: + - AUTO + port_gpb1_Internal2_replacement_policy: + - AUTO + port_gpb1_Internal2_network: + - get_input: internal_net_id_1 + port_gpb1_Internal1_network: + - get_input: internal_net_id_0 + service_template_filter: + substitute_service_template: Nested_gpbServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: gpb + nfc_naming_code: gpb + requirements: + - link_gpb_gpb1_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_gpb_gpb1_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + Internal1_net: + type: org.openecomp.resource.vl.nodes.heat.network.contrailV2.VirtualNetwork + properties: + network_ipam_refs_data: + - network_ipam_refs_data_ipam_subnets: + - network_ipam_refs_data_ipam_subnets_enable_dhcp: + get_input: Internal1_dhcp + network_ipam_refs_data_ipam_subnets_default_gateway: + get_input: Internal1_net_gateway + network_ipam_refs_data_ipam_subnets_subnet: + network_ipam_refs_data_ipam_subnets_subnet_ip_prefix_len: + get_input: Internal1_net_cidr_len + network_ipam_refs_data_ipam_subnets_subnet_ip_prefix: + get_input: Internal1_net_cidr + network_name: + str_replace: + template: $VNF_NAME_int_net_1 + params: + $VNF_NAME: + get_input: vnf_name + network_ipam_refs: + - UNSUPPORTED_RESOURCE_template_NetworkIpam_Internal1 + abstract_fsb: + type: org.openecomp.resource.abstract.nodes.fsb + directives: + - substitutable + properties: + port_FSB1_Internal1_mac_address: + get_input: fsb1_Internal1_mac + port_FSB_OAM_network_role_tag: + - oam + port_FSB1_Internal2_network: + - Internal2_net + port_FSB1_Internal1_network: + - Internal1_net + vm_flavor_name: + get_input: fsb_flavor_name + port_FSB1_Internal2_mac_address: + get_input: fsb1_Internal1_mac + port_FSB_OAM_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: true + floating_ip_count_required: + is_required: false + compute_fsb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + port_FSB1_Internal1_security_groups: + - - int1_security_group + port_FSB1_Internal2_replacement_policy: + - AUTO + compute_fsb_scheduler_hints: + - group: VM_Affinity_group + port_FSB1_Internal1_replacement_policy: + - AUTO + compute_fsb_name: + - get_input: fsb_name_0 + port_FSB1_Internal1_mac_requirements: + mac_count_required: + is_required: true + port_FSB1_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_FSB_OAM_network: + - get_input: oam_net_name + port_FSB_OAM_security_groups: + - - oam_security_group + port_FSB_OAM_mac_requirements: + mac_count_required: + is_required: false + port_FSB_OAM_replacement_policy: + - AUTO + compute_fsb_availability_zone: + - get_input: availability_zone_0 + port_FSB1_Internal2_security_groups: + - - int2_security_group + port_FSB1_Internal2_mac_requirements: + mac_count_required: + is_required: true + port_FSB1_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_FSB_OAM_fixed_ips: + - ip_address: + get_input: fsb_oam_ip_0 + service_template_filter: + substitute_service_template: Nested_fsbServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: fsb + nfc_naming_code: fsb + requirements: + - link_fsb_FSB1_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_fsb_FSB1_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + gtp_security_group: + type: org.openecomp.resource.vfc.rules.nodes.heat.network.neutron.SecurityRules + properties: + name: + str_replace: + template: $VNF_NAME_$SECGROUPNAME + params: + $SECGROUPNAME: + get_input: gtp_sec_group_name + $VNF_NAME: + get_input: vnf_name + rules: + - protocol: tcp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: udp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: icmp + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + - protocol: tcp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: udp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: icmp + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + abstract_ncb_1: + type: org.openecomp.resource.abstract.nodes.ncb_1 + directives: + - substitutable + properties: + port_NCB2_Internal2_security_groups: + - - int2_security_group + port_NCB2_Internal1_replacement_policy: + - AUTO + port_NCB2_Internal2_replacement_policy: + - AUTO + vm_flavor_name: + get_input: ncb_flavor_name + port_NCB2_Internal2_mac_requirements: + mac_count_required: + is_required: true + port_NCB2_Internal1_mac_requirements: + mac_count_required: + is_required: true + vm_image_name: + get_input: pxe_image_name + compute_ncb_scheduler_hints: + - group: VM_Affinity_group + compute_ncb_availability_zone: + - get_input: availability_zone_1 + port_NCB2_Internal1_network: + - Internal1_net + port_NCB2_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_NCB2_Internal1_security_groups: + - - int1_security_group + port_NCB2_Internal2_network: + - Internal2_net + port_NCB2_Internal1_mac_address: + get_input: ncb2_Internal1_mac + port_NCB2_Internal2_mac_address: + get_input: ncb2_Internal1_mac + compute_ncb_name: + - get_input: ncb_name_1 + compute_ncb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + port_NCB2_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + service_template_filter: + substitute_service_template: Nested_ncb_1ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: ncb + nfc_naming_code: ncb + requirements: + - link_ncb_NCB2_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_ncb_NCB2_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + abstract_ncb: + type: org.openecomp.resource.abstract.nodes.ncb + directives: + - substitutable + properties: + vm_flavor_name: + get_input: ncb_flavor_name + port_NCB1_Internal2_mac_requirements: + mac_count_required: + is_required: true + vm_image_name: + get_input: pxe_image_name + port_NCB1_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + compute_ncb_scheduler_hints: + - group: VM_Affinity_group + port_NCB1_Internal1_security_groups: + - - int1_security_group + compute_ncb_availability_zone: + - get_input: availability_zone_0 + port_NCB1_Internal2_mac_address: + get_input: ncb1_Internal1_mac + port_NCB1_Internal1_mac_address: + get_input: ncb1_Internal1_mac + port_NCB1_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_NCB1_Internal1_mac_requirements: + mac_count_required: + is_required: true + port_NCB1_Internal2_replacement_policy: + - AUTO + port_NCB1_Internal1_network: + - Internal1_net + port_NCB1_Internal2_security_groups: + - - int2_security_group + port_NCB1_Internal1_replacement_policy: + - AUTO + compute_ncb_name: + - get_input: ncb_name_0 + compute_ncb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + port_NCB1_Internal2_network: + - Internal2_net + service_template_filter: + substitute_service_template: Nested_ncbServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: ncb + nfc_naming_code: ncb + requirements: + - link_ncb_NCB1_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_ncb_NCB1_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + int1_security_group: + type: org.openecomp.resource.vfc.rules.nodes.heat.network.neutron.SecurityRules + properties: + name: + str_replace: + template: $VNF_NAME_$SECGROUPNAME + params: + $SECGROUPNAME: + get_input: int1_sec_group_name + $VNF_NAME: + get_input: vnf_name + rules: + - protocol: tcp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: udp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: icmp + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + - protocol: tcp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: udp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: icmp + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + requirements: + - port: + capability: attachment_fsb_FSB1_Internal1 + node: abstract_fsb + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_fsb_FSB2_Internal1 + node: abstract_fsb_1 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_ncb_NCB1_Internal1 + node: abstract_ncb + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_ncb_NCB2_Internal1 + node: abstract_ncb_1 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb1_Internal1 + node: abstract_gpb + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb2_Internal1 + node: abstract_gpb_1 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb3_Internal1 + node: abstract_gpb_2 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb4_Internal1 + node: abstract_gpb_3 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb5_Internal1 + node: abstract_gpb_4 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb6_Internal1 + node: abstract_gpb_5 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb7_Internal1 + node: abstract_gpb_6 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb8_Internal1 + node: abstract_gpb_7 + relationship: org.openecomp.relationships.AttachesTo + fsb_volume_0: + type: org.openecomp.resource.vfc.nodes.heat.cinder.Volume + properties: + image: + get_input: fsb_volume_image_name_0 + volume_type: + get_input: fsb_volume_type + size: '(get_input : fsb_volume_size) * 1024' + name: + list_join: + - _ + - - get_input: OS::stack_name + - FSB1_Vol_1 + fsb_volume_1: + type: org.openecomp.resource.vfc.nodes.heat.cinder.Volume + properties: + image: + get_input: fsb_volume_image_name_1 + volume_type: + get_input: fsb_volume_type + size: '(get_input : fsb_volume_size) * 1024' + name: + list_join: + - _ + - - get_input: OS::stack_name + - FSB2_Vol_1 + Internal2_net: + type: org.openecomp.resource.vl.nodes.heat.network.contrailV2.VirtualNetwork + properties: + network_ipam_refs_data: + - network_ipam_refs_data_ipam_subnets: + - network_ipam_refs_data_ipam_subnets_enable_dhcp: + get_input: Internal2_dhcp + network_ipam_refs_data_ipam_subnets_default_gateway: + get_input: Internal2_net_gateway + network_ipam_refs_data_ipam_subnets_subnet: + network_ipam_refs_data_ipam_subnets_subnet_ip_prefix_len: + get_input: Internal2_net_cidr_len + network_ipam_refs_data_ipam_subnets_subnet_ip_prefix: + get_input: Internal2_net_cidr + network_name: + str_replace: + template: $VNF_NAME_int_net_2 + params: + $VNF_NAME: + get_input: vnf_name + network_ipam_refs: + - UNSUPPORTED_RESOURCE_template_NetworkIpam_Internal2 + int2_security_group: + type: org.openecomp.resource.vfc.rules.nodes.heat.network.neutron.SecurityRules + properties: + name: + str_replace: + template: $VNF_NAME_$SECGROUPNAME + params: + $SECGROUPNAME: + get_input: int2_sec_group_name + $VNF_NAME: + get_input: vnf_name + rules: + - protocol: tcp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: udp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: 132 + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: icmp + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + - protocol: tcp + ethertype: IPv6 + port_range_max: 65535 + remote_ip_prefix: ::/0 + direction: egress + port_range_min: 1 + - protocol: udp + ethertype: IPv6 + port_range_max: 65535 + remote_ip_prefix: ::/0 + direction: egress + port_range_min: 1 + - protocol: 132 + ethertype: IPv6 + port_range_max: 65535 + remote_ip_prefix: ::/0 + direction: egress + port_range_min: 1 + - protocol: icmp + ethertype: IPv6 + remote_ip_prefix: ::/0 + direction: egress + - protocol: tcp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: udp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: 132 + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: icmp + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + - protocol: tcp + ethertype: IPv6 + port_range_max: 65535 + remote_ip_prefix: ::/0 + direction: ingress + port_range_min: 1 + - protocol: udp + ethertype: IPv6 + port_range_max: 65535 + remote_ip_prefix: ::/0 + direction: ingress + port_range_min: 1 + - protocol: 132 + ethertype: IPv6 + port_range_max: 65535 + remote_ip_prefix: ::/0 + direction: ingress + port_range_min: 1 + - protocol: icmp + ethertype: IPv6 + remote_ip_prefix: ::/0 + direction: ingress + requirements: + - port: + capability: attachment_fsb_FSB1_Internal2 + node: abstract_fsb + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_fsb_FSB2_Internal2 + node: abstract_fsb_1 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_ncb_NCB1_Internal2 + node: abstract_ncb + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_ncb_NCB2_Internal2 + node: abstract_ncb_1 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb1_Internal2 + node: abstract_gpb + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb2_Internal2 + node: abstract_gpb_1 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb3_Internal2 + node: abstract_gpb_2 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb4_Internal2 + node: abstract_gpb_3 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb5_Internal2 + node: abstract_gpb_4 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb6_Internal2 + node: abstract_gpb_5 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb7_Internal2 + node: abstract_gpb_6 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb8_Internal2 + node: abstract_gpb_7 + relationship: org.openecomp.relationships.AttachesTo + abstract_fsb_1: + type: org.openecomp.resource.abstract.nodes.fsb_1 + directives: + - substitutable + properties: + port_FSB_OAM_network_role_tag: + - oam + vm_flavor_name: + get_input: fsb_flavor_name + port_FSB_OAM_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: true + floating_ip_count_required: + is_required: false + port_FSB2_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_FSB2_Internal2_security_groups: + - - int2_security_group + compute_fsb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + port_FSB2_Internal1_mac_address: + get_input: fsb2_Internal1_mac + compute_fsb_scheduler_hints: + - group: VM_Affinity_group + compute_fsb_name: + - get_input: fsb_name_1 + port_FSB2_Internal1_security_groups: + - - int1_security_group + port_FSB_OAM_network: + - get_input: oam_net_name + port_FSB_OAM_security_groups: + - - oam_security_group + port_FSB2_Internal1_network: + - Internal1_net + port_FSB2_Internal2_mac_address: + get_input: fsb2_Internal1_mac + port_FSB2_Internal2_mac_requirements: + mac_count_required: + is_required: true + port_FSB_OAM_mac_requirements: + mac_count_required: + is_required: false + port_FSB2_Internal2_replacement_policy: + - AUTO + port_FSB2_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_FSB_OAM_replacement_policy: + - AUTO + port_FSB2_Internal2_network: + - Internal2_net + port_FSB2_Internal1_replacement_policy: + - AUTO + compute_fsb_availability_zone: + - get_input: availability_zone_1 + port_FSB_OAM_fixed_ips: + - ip_address: + get_input: fsb_oam_ip_1 + port_FSB2_Internal1_mac_requirements: + mac_count_required: + is_required: true + service_template_filter: + substitute_service_template: Nested_fsb_1ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: fsb + nfc_naming_code: fsb + requirements: + - link_fsb_FSB2_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_fsb_FSB2_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + oam_security_group: + type: org.openecomp.resource.vfc.rules.nodes.heat.network.neutron.SecurityRules + properties: + name: + str_replace: + template: $VNF_NAME_$SECGROUPNAME + params: + $SECGROUPNAME: + get_input: oam_sec_group_name + $VNF_NAME: + get_input: vnf_name + rules: + - protocol: tcp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: udp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: icmp + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + - protocol: tcp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: udp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: icmp + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + requirements: + - port: + capability: attachment_fsb_FSB_OAM + node: abstract_fsb + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_fsb_FSB_OAM + node: abstract_fsb_1 + relationship: org.openecomp.relationships.AttachesTo + groups: + vmme_gpb3_group: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/vmme_gpb3.yml + description: | + Module HOT template to create vmme 1-8 gpb + members: + - abstract_gpb + - abstract_gpb_1 + - abstract_gpb_2 + - abstract_gpb_3 + - abstract_gpb_4 + - abstract_gpb_5 + - abstract_gpb_6 + - abstract_gpb_7 + base_vmme_group: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/base_vmme.yml + description: | + Base HOT template to create vmme 2 fsb 2 ncb + members: + - int2_security_group + - oam_security_group + - gtp_security_group + - Internal2_net + - int1_security_group + - Internal1_net + - abstract_ncb + - abstract_ncb_1 + - abstract_fsb + - abstract_fsb_1 + base_vmme_volume_group: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/base_vmme_volume.yml + description: HOT template for vMME Cinder Volumes + members: + - fsb_volume_0 + - fsb_volume_1 + vmme_gpb1_group: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/vmme_gpb1.yml + description: | + Module HOT template to create vmme 1-8 gpb + members: + - abstract_gpb + - abstract_gpb_1 + - abstract_gpb_2 + - abstract_gpb_3 + - abstract_gpb_4 + - abstract_gpb_5 + - abstract_gpb_6 + - abstract_gpb_7 + vmme_gpb4_group: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/vmme_gpb4.yml + description: | + Module HOT template to create vmme 1-8 gpb + members: + - abstract_gpb + - abstract_gpb_1 + - abstract_gpb_2 + - abstract_gpb_3 + - abstract_gpb_4 + - abstract_gpb_5 + - abstract_gpb_6 + - abstract_gpb_7 + vmme_gpb2_group: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/vmme_gpb2.yml + description: | + Module HOT template to create vmme 1-8 gpb + members: + - abstract_gpb + - abstract_gpb_1 + - abstract_gpb_2 + - abstract_gpb_3 + - abstract_gpb_4 + - abstract_gpb_5 + - abstract_gpb_6 + - abstract_gpb_7 + VM_Affinity_group: + type: tosca.groups.Root + members: + - abstract_ncb + - abstract_ncb_1 + - abstract_vlc + - abstract_fsb + - abstract_fsb_1 + - abstract_gpb + - abstract_gpb_1 + - abstract_gpb_2 + - abstract_gpb_3 + - abstract_gpb_4 + - abstract_gpb_5 + - abstract_gpb_6 + - abstract_gpb_7 + vmme_vlc_group: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/vmme_vlc.yml + description: | + Module HOT template to create vmme 8 vlcs + members: + - abstract_vlc + outputs: + oam_management_v4_address: + description: ID of OAM VIP to be provisioned in A&AI + value: + get_input: vip_oam_management_v4_ip + fsb_volume_id_1: + description: ID of Cinder Volume for FSB2 + value: fsb_volume_1 + security_group_sctp_b_id: + description: ID of sctpb_security_group + value: UNSUPPORTED_RESOURCE_sctpb_security_group + service_instance_id_0: + description: ID of Service Instance used for vLCs + value: UNSUPPORTED_RESOURCE_template_ServiceInstance_VLC + security_group_sctp_a_id: + description: ID of sctpa_security_group + value: UNSUPPORTED_RESOURCE_sctpa_security_group + fsb_volume_id_0: + description: ID of Cinder Volume for FSB1 + value: fsb_volume_0 + policies: + VM_Affinity_policy: + type: org.openecomp.policies.placement.Antilocate + properties: + container_type: host + targets: + - VM_Affinity_group @@ -0,0 +1,3585 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +metadata: + template_name: Main +imports: +- openecomp_heat_index: + file: openecomp-heat/_index.yml +- GlobalSubstitutionTypes: + file: GlobalSubstitutionTypesServiceTemplate.yaml +topology_template: + inputs: + vlc4_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc4_Internal2 + default: 00:80:37:0E:04:12 + sctp-a-egress_rule_application: + hidden: false + immutable: false + type: string + description: application for the SecurityGroup + default: any + sctp-b-ipv6-ingress-src_start_port: + hidden: false + immutable: false + type: float + description: IPV6 start port + default: 0 + constraints: + - in_range: + - 0 + - 65535 + ncb1_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to ncb1_Internal2 + default: 00:80:37:0E:09:12 + sctp-a-ipv6-ingress_ethertype: + hidden: false + immutable: false + type: string + description: IPV6 ethertype + default: IPv4 + gpb8_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb8_Internal1 + default: 00:80:37:0E:10:22 + sctp-a-ingress_rule_protocol: + hidden: false + immutable: false + type: string + description: protocol for the SecurityGroup + default: any + sctp-b-display_name: + hidden: false + immutable: false + type: string + description: display_name for the SecurityGroup + default: epc-sctp-b-ipv4v6-sec-group + sctp-a-ingress_ethertype: + hidden: false + immutable: false + type: string + description: ethertype for the SecurityGroup + default: IPv4 + sctp-a-egress-src_start_port: + hidden: false + immutable: false + type: float + description: start_port for the SecurityGroup + default: 0 + constraints: + - in_range: + - 0 + - 65535 + ncb_flavor_name: + hidden: false + immutable: false + type: string + description: Flavor to use for servers ncb + default: nv.c8r32d1 + vlc3_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc3_Internal1 + default: 00:80:37:0E:03:12 + Internal2_net_cidr: + hidden: false + immutable: false + type: string + description: CIDR for internal-2 network + default: 169.255.0.0 + sctp-a-egress-dst_start_port: + hidden: false + immutable: false + type: float + description: start_port for the SecurityGroup + default: 0 + constraints: + - in_range: + - 0 + - 65535 + sctp-a-egress_ethertype: + hidden: false + immutable: false + type: string + description: ethertype for the SecurityGroup + default: IPv4 + gpb4_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb4_Internal2 + default: 00:80:37:0E:0C:22 + sctp-b-ipv6-egress_rule_application: + hidden: false + immutable: false + type: string + description: IPV6 Rule-application + default: any + vlc8_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc8_Internal1 + default: 00:80:37:0E:08:12 + sctp-b-ipv6-ingress-src_end_port: + hidden: false + immutable: false + type: float + description: IPV6 ending port for destination + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + fsb2_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to fsb2_Internal1 + default: 00:80:37:0E:0D:12 + sctp-b-name: + hidden: false + immutable: false + type: string + description: name for the SecurityGroup + default: epc-sctp-b-ipv4v6-sec-group + sctp-b-ipv6-egress_ethertype: + hidden: false + immutable: false + type: string + description: IPV6 ethertype + default: IPv4 + internal_net_id_1: + hidden: false + immutable: false + type: string + description: UUID of Internal2_net + default: e3397c69-a942-49aa-81cb-fb91ff34abc8 + sctp-a-egress_dst_subnet_prefix: + hidden: false + immutable: false + type: string + description: ip_prefix for the SecurityGroup + default: 0.0.0.0 + internal_net_id_0: + hidden: false + immutable: false + type: string + description: UUID of Internal1_net + default: 871de971-22ac-47b6-befb-50e7d4cb67ea + sctp_b_net_fqdn: + hidden: false + immutable: false + type: string + description: Network FQDN SCTPB + default: default-domain:vMME-24474-Ericsson-WTC-Lab-vLCP1-4:vMME-24474-Ericsson-WTC-Lab-vLCP1-4_gn_SCTPB_net_1 + sctp-a-ipv6-ingress_rule_application: + hidden: false + immutable: false + type: string + description: IPV6 Rule-application + default: any + sctp-b-ipv6-ingress_src_subnet_prefix_len: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix length + default: '0' + ncb_name_1: + hidden: false + immutable: false + type: string + description: Name of ncb2 + default: zrdm3mmex59ncb002 + ncb_name_0: + hidden: false + immutable: false + type: string + description: Name of ncb1 + default: zrdm3mmex59ncb001 + vlc_st_virtualization_type: + hidden: false + immutable: false + type: string + description: Indicates virtualization type + default: virtual-machine + vlc2_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc2_Internal1 + default: 00:80:37:0E:02:12 + sctp-b-ingress-dst_start_port: + hidden: false + immutable: false + type: float + description: start_port for the SecurityGroup + default: 0 + constraints: + - in_range: + - 0 + - 65535 + sctp-a-display_name: + hidden: false + immutable: false + type: string + description: display_name for the SecurityGroup + default: epc-sctp-a-ipv4v6-sec-group + sctp-b-ingress_rule_application: + hidden: false + immutable: false + type: string + description: application for the SecurityGroup + default: any + int2_sec_group_name: + hidden: false + immutable: false + type: string + description: SecurityGroup name for internal-2 + default: int2-sec-group + gpb5_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb5_Internal2 + default: 00:80:37:0E:0D:22 + sctp-a-egress-dst_subnet_prefix_v6: + hidden: false + immutable: false + type: string + description: dst subnet + default: '::' + OS::stack_name: + type: string + required: false + sctp-b-egress-src_end_port: + hidden: false + immutable: false + type: float + description: end_port for the SecurityGroup + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + Internal2_shared: + hidden: false + immutable: false + type: string + description: Whether Shared or private internal-2 network + default: false + sctp-a-ipv6-egress_rule_protocol: + hidden: false + immutable: false + type: string + description: IPV6 Rule-protocol + default: any + Internal2_rpf: + hidden: false + immutable: false + type: string + description: Reverse Path Forwarding Enabled/Disabled internal-2 network + default: disable + vlc5_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc5_Internal2 + default: 00:80:37:0E:05:12 + sctp-a-ipv6-egress_src_end_port: + hidden: false + immutable: false + type: string + description: IPV6 end port + default: 65535 + Internal1_forwarding_mode: + hidden: false + immutable: false + type: string + description: L2 or L3 forwarding mode for internal-1 network + default: l2 + gpb3_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb3_Internal1 + default: 00:80:37:0E:0B:22 + vip_oam_management_v4_ip: + hidden: false + immutable: false + type: string + description: IP address of OAM service IP address to be provisioned in A&AI + default: 107.239.72.176 + vmi_oam_preference_primary: + hidden: false + immutable: false + type: float + description: Preference for primary interface/port + default: 200 + sctp-b-src_subnet_prefix_v6: + hidden: false + immutable: false + type: string + description: ip_prefix for the SecurityGroup + default: '::' + sctp-a-egress_dst_subnet_prefix_len: + hidden: false + immutable: false + type: float + description: ip_prefix_len for the SecurityGroup + default: '0' + constraints: + - in_range: + - 0 + - 32 + security_group_sctp_b_id: + hidden: false + immutable: false + type: string + description: Security Group UUID for output + default: 92a4ae54-1733-4d03-b488-f178bb9f7b82 + Internal2_forwarding_mode: + hidden: false + immutable: false + type: string + description: L2 or L3 forwarding mode for internal-2 network + default: l2 + sctp-a-ipv6-egress_dst_end_port: + hidden: false + immutable: false + type: string + description: IPV6 end port + default: 65535 + sctp-b-egress-dst_subnet_prefix_v6: + hidden: false + immutable: false + type: string + description: dst subnet + default: '::' + sctp-b-egress_dst_subnet_prefix: + hidden: false + immutable: false + type: string + description: ip_prefix for the SecurityGroup + default: 0.0.0.0 + security_group_oam_id: + hidden: false + immutable: false + type: string + description: Security Group UUID for output + default: 4ae4aa74-3e8e-4f2b-8b5f-a8bd262da96b + gpb2_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb2_Internal1 + default: 00:80:37:0E:0A:22 + security_group_int1_id: + hidden: false + immutable: false + type: string + description: UUID of Internal1_net security group + default: 94c62578-835d-4801-9372-70a2cfb22683 + sctp-a-egress_action: + hidden: false + immutable: false + type: string + description: simple_action for the SecurityGroup + default: pass + oam_net_fqdn: + hidden: false + immutable: false + type: string + description: Network FQDN OAM + default: default-domain:vMME-24474-Ericsson-WTC-Lab-vLCP1-4:vMME-24474-Ericsson-WTC-Lab-vLCP1-4_OAM_net_1 + ncb2_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to ncb2_Internal2 + default: 00:80:37:0E:0F:12 + vlc_st_interface_type_sctp_a: + hidden: false + immutable: false + type: string + description: service_interface_type for the ServiceTemplate + default: left + gpb3_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb3_Internal2 + default: 00:80:37:0E:0B:22 + vlc_st_interface_type_sctp_b: + hidden: false + immutable: false + type: string + description: service_interface_type for the ServiceTemplate + default: right + gpb1_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb1_Internal2 + default: 00:80:37:0E:09:22 + oam_net_name: + hidden: false + immutable: false + type: string + description: Network Name OAM + default: vMME-24474-Ericsson-WTC-Lab-vLCP1-4_OAM_net_1 + sctp-b-ingress-src_start_port: + hidden: false + immutable: false + type: float + description: start_port for the SecurityGroup + default: 0 + constraints: + - in_range: + - 0 + - 65535 + fsb1_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to fsb1_Internal1 + default: 00:80:37:0E:0B:12 + sctp-b-ingress_dst_addresses: + hidden: false + immutable: false + type: string + description: security_group for the SecurityGroup + default: local + vlc_st_interface_type_oam: + hidden: false + immutable: false + type: string + description: service_interface_type for the ServiceTemplate + default: management + shc_monitor_type: + hidden: false + immutable: false + type: string + description: health check + default: PING + oam_sec_group_name: + hidden: false + immutable: false + type: string + description: SecurityGroup name for OAM + default: oam-sec-group + Internal2_net_gateway: + hidden: false + immutable: false + type: string + description: gateway for internal-2 network + default: 169.255.0.3 + evac_policy: + hidden: false + immutable: false + type: string + description: CMHA Policy + default: Evacuate + server_group_id_0: + hidden: false + immutable: false + type: string + description: ID of Anti-Affinity Policy-based Server Group + default: ec99a73d-38f8-4280-8103-ba8ee584629f + vlc8_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc8_Internal2 + default: 00:80:37:0E:08:12 + sctp-b-ipv6-egress_rule_protocol: + hidden: false + immutable: false + type: string + description: IPV6 Rule-protocol + default: any + gtp_sec_group_name: + hidden: false + immutable: false + type: string + description: SecurityGroup name for GTP + default: gtp-sec-group + vlc_sctp_b_v6_ip_2: + hidden: false + immutable: false + type: string + description: Static IP vlc3 SCTPB + default: fd00:200:200:5:0:0:0:24 + vlc_sctp_b_v6_ip_1: + hidden: false + immutable: false + type: string + description: Static IP vlc2 SCTPB + default: fd00:200:200:5:0:0:0:17 + sctp-a-ipv6-egress_dst_subnet_prefix: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix + default: 0.0.0.0 + vlc_sctp_b_v6_ip_0: + hidden: false + immutable: false + type: string + description: Static IP vlc1 SCTPB + default: fd00:200:200:5:0:0:0:16 + vlc4_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc4_Internal1 + default: 00:80:37:0E:04:12 + vlc_sctp_b_v6_ip_6: + hidden: false + immutable: false + type: string + description: Static IP vlc7 SCTPB + default: fd00:200:200:5:0:0:0:28 + vlc_sctp_b_v6_ip_5: + hidden: false + immutable: false + type: string + description: Static IP vlc6 SCTPB + default: fd00:200:200:5:0:0:0:27 + vlc_sctp_b_v6_ip_4: + hidden: false + immutable: false + type: string + description: Static IP vlc5 SCTPB + default: fd00:200:200:5:0:0:0:26 + vlc_sctp_b_v6_ip_3: + hidden: false + immutable: false + type: string + description: Static IP vlc4 SCTPB + default: fd00:200:200:5:0:0:0:25 + sctp_b_net_name: + hidden: false + immutable: false + type: string + description: Network Name SCTPB + default: vMME-24474-Ericsson-WTC-Lab-vLCP1-4_gn_SCTPB_net_1 + sctp-b-ipv6-egress_dst_subnet_prefix_len: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix + default: '0' + sctp-a-egress_rule_protocol: + hidden: false + immutable: false + type: string + description: protocol for the SecurityGroup + default: any + Internal1_shared: + hidden: false + immutable: false + type: string + description: Whether Shared or private internal-1 network + default: false + shc_url_path: + hidden: false + immutable: false + type: string + description: health check + default: local-ip + Internal2_net_cidr_len: + hidden: false + immutable: false + type: string + description: CIDR length for internal-2 network + default: 17 + sctp-a-ingress-src_end_port: + hidden: false + immutable: false + type: float + description: end_port for the SecurityGroup + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + sctp-b-ipv6-ingress_src_subnet_prefix: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix + default: 0.0.0.0 + sctp-a-egress-dst_end_port: + hidden: false + immutable: false + type: float + description: end_port for the SecurityGroup + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + sctp-a-ingress_action: + hidden: false + immutable: false + type: string + description: simple_action for the SecurityGroup + default: pass + sctp-b-ipv6-ingress_action: + hidden: false + immutable: false + type: string + description: IPV6 action + default: pass + vlc_st_service_type: + hidden: false + immutable: false + type: string + description: service type + default: firewall + sctp-b-ipv6-ingress-dst_start_port: + hidden: false + immutable: false + type: string + description: IPV6 starting port for destination + default: 0 + vlc_st_availability_zone: + hidden: false + immutable: false + type: string + description: Indicates availability zone is enabled + default: true + vlc7_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc7_Internal1 + default: 00:80:37:0E:07:12 + fsb_volume_image_name_1: + label: MME_FSB2 + hidden: false + immutable: false + type: string + description: volume name + default: MME_FSB2_1_3_GA.qcow2 + vlc_oam_ip_6: + hidden: false + immutable: false + type: string + description: Static IP vlc7 OAM + default: 107.239.72.151 + sctp-a-ipv6-ingress_src_subnet_prefix_len: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix length + default: '0' + vlc_oam_ip_7: + hidden: false + immutable: false + type: string + description: Static IP vlc8 OAM + default: 107.239.72.152 + Internal1_allow_transit: + hidden: false + immutable: false + type: string + description: Allow/disallow transit internal-1 network + default: true + vlc_oam_ip_2: + hidden: false + immutable: false + type: string + description: Static IP vlc3 OAM + default: 107.239.72.157 + vlc_oam_ip_3: + hidden: false + immutable: false + type: string + description: Static IP vlc4 OAM + default: 107.239.72.158 + vlc_gtp_ip_0: + hidden: false + immutable: false + type: string + description: Static IP vlc1 GTP + default: 107.243.47.208 + vlc_oam_ip_4: + hidden: false + immutable: false + type: string + description: Static IP vlc5 OAM + default: 107.239.72.149 + fsb_volume_image_name_0: + label: MME_FSB1 + hidden: false + immutable: false + type: string + description: volume name + default: MME_FSB1_1_3_GA.qcow2 + vlc_gtp_ip_1: + hidden: false + immutable: false + type: string + description: Static IP vlc2 GTP + default: 107.243.47.209 + vlc_oam_ip_5: + hidden: false + immutable: false + type: string + description: Static IP vlc6 OAM + default: 107.239.72.150 + vlc_gtp_ip_2: + hidden: false + immutable: false + type: string + description: Static IP vlc3 GTP + default: 107.243.47.216 + vlc_name_6: + hidden: false + immutable: false + type: string + description: Name of vlc7 + default: zrdm3mmex59vlc007 + vlc_gtp_ip_3: + hidden: false + immutable: false + type: string + description: Static IP vlc4 GTP + default: 107.243.47.217 + vlc_name_7: + hidden: false + immutable: false + type: string + description: Name of vlc8 + default: zrdm3mmex59vlc008 + security_group_sctp_a_id: + hidden: false + immutable: false + type: string + description: Security Group UUID for output + default: 3cd8a524-77ff-4980-ae2a-d19ba70e0511 + vlc_gtp_ip_4: + hidden: false + immutable: false + type: string + description: Static IP vlc5 GTP + default: 107.243.47.218 + vlc_gtp_ip_5: + hidden: false + immutable: false + type: string + description: Static IP vlc6 GTP + default: 107.243.47.219 + vlc_gtp_ip_6: + hidden: false + immutable: false + type: string + description: Static IP vlc7 GTP + default: 107.243.47.220 + vlc_name_2: + hidden: false + immutable: false + type: string + description: Name of vlc3 + default: zrdm3mmex59vlc003 + vlc_gtp_ip_7: + hidden: false + immutable: false + type: string + description: Static IP vlc8 GTP + default: 107.243.47.221 + vlc_name_3: + hidden: false + immutable: false + type: string + description: Name of vlc4 + default: zrdm3mmex59vlc004 + vlc_name_4: + hidden: false + immutable: false + type: string + description: Name of vlc5 + default: zrdm3mmex59vlc005 + vlc_name_5: + hidden: false + immutable: false + type: string + description: Name of vlc6 + default: zrdm3mmex59vlc006 + fsb_volume_id_1: + hidden: false + immutable: false + type: string + description: ID of Cinder Volume for FSB2 + default: 5bd0560c-bfd0-47dc-a84a-554e2698c925 + sctp-a-ipv6-ingress_action: + hidden: false + immutable: false + type: string + description: IPV6 action + default: pass + vlc_name_0: + hidden: false + immutable: false + type: string + description: Name of vlc1 + default: zrdm3mmex59vlc001 + vlc_name_1: + hidden: false + immutable: false + type: string + description: Name of vlc2 + default: zrdm3mmex59vlc002 + vlc_oam_route_prefixes: + hidden: false + immutable: false + type: json + description: Route prefixes for static routing on OAM + sctp-b-egress_rule_application: + hidden: false + immutable: false + type: string + description: application for the SecurityGroup + default: any + vlc_oam_ip_0: + hidden: false + immutable: false + type: string + description: Static IP vlc1 OAM + default: 107.239.72.155 + vlc_oam_ip_1: + hidden: false + immutable: false + type: string + description: Static IP vlc2 OAM + default: 107.239.72.156 + vlc6_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc6_Internal1 + default: 00:80:37:0E:06:12 + fsb_volume_id_0: + hidden: false + immutable: false + type: string + description: ID of Cinder Volume for FSB1 + default: 27baa6a0-b701-4795-bf5e-4f546b350b1f + sctp-b-egress-dst_end_port: + hidden: false + immutable: false + type: float + description: end_port for the SecurityGroup + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + gpb2_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb2_Internal2 + default: 00:80:37:0E:0A:22 + sctp-a-ipv6-egress_rule_application: + hidden: false + immutable: false + type: string + description: IPV6 Rule-application + default: any + sctp-b-ipv6-egress_src_start_port: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix + default: 0 + Internal2_allow_transit: + hidden: false + immutable: false + type: string + description: Allow/disallow transit internal-2 network + default: true + fsb_volume_size: + label: volume size + hidden: false + immutable: false + type: float + description: volume size 320GB + default: 320 + constraints: + - in_range: + - 0 + - 340 + sctp-b-IPv6_ethertype: + hidden: false + immutable: false + type: string + description: IPV6 ethertype + default: IPv6 + gtp_net_fqdn: + hidden: false + immutable: false + type: string + description: Network FQDN GTP + default: default-domain:vMME-24474-Ericsson-WTC-Lab-vLCP1-4:vMME-24474-Ericsson-WTC-Lab-vLCP1-4_gn_GTP_net_1 + ncb2_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to ncb2_Internal1 + default: 00:80:37:0E:0F:12 + sctp-b-ingress_rule_protocol: + hidden: false + immutable: false + type: string + description: protocol for the SecurityGroup + default: any + sctp-b-ingress_action: + hidden: false + immutable: false + type: string + description: simple_action for the SecurityGroup + default: pass + sctp-b-egress_src_addresses: + hidden: false + immutable: false + type: string + description: security_group for the SecurityGroup + default: local + gpb7_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb7_Internal2 + default: 00:80:37:0E:0F:22 + sctp-a-ipv6-ingress-dst_start_port: + hidden: false + immutable: false + type: string + description: IPV6 starting port for destination + default: 0 + gtp_net_name: + hidden: false + immutable: false + type: string + description: Network Name GTP + default: vMME-24474-Ericsson-WTC-Lab-vLCP1-4_gn_GTP_net_1 + sctp-b-ipv6-ingress_rule_application: + hidden: false + immutable: false + type: string + description: IPV6 Rule-application + default: any + domain_name: + hidden: false + immutable: false + type: string + description: Unique name of vMME contrail domain + default: default-domain + vlc5_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc5_Internal1 + default: 00:80:37:0E:05:12 + sctp-a-egress_src_addresses: + hidden: false + immutable: false + type: string + description: security_group for the SecurityGroup + default: local + sctp-b-egress-src_start_port: + hidden: false + immutable: false + type: float + description: start_port for the SecurityGroup + default: 0 + constraints: + - in_range: + - 0 + - 65535 + shc_enabled: + hidden: false + immutable: false + type: string + description: health check + default: true + sctp-b-ipv6-ingress-dst_end_port: + hidden: false + immutable: false + type: string + description: IPV6 end port + default: 65535 + sctp-b-dst_subnet_prefix_v6: + hidden: false + immutable: false + type: string + description: ip_prefix for the SecurityGroup + default: '::' + sctp_a_net_fqdn: + hidden: false + immutable: false + type: string + description: Network FQDN SCTPA + default: default-domain:vMME-24474-Ericsson-WTC-Lab-vLCP1-4:vMME-24474-Ericsson-WTC-Lab-vLCP1-4_gn_SCTPA_net_1 + security_group_gtp_id: + hidden: false + immutable: false + type: string + description: Security Group UUID for output + default: e8ad3fe2-5f95-43e4-bbcc-da97b1c22588 + sctp-a-ipv6-ingress_src_subnet_prefix: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix + default: 0.0.0.0 + fsb_name_1: + hidden: false + immutable: false + type: string + description: Name of fsb1 + default: zrdm3mmex59fsb002 + sctp-b-egress-dst_start_port: + hidden: false + immutable: false + type: float + description: start_port for the SecurityGroup + default: 0 + constraints: + - in_range: + - 0 + - 65535 + fsb_name_0: + hidden: false + immutable: false + type: string + description: Name of fsb1 + default: zrdm3mmex59fsb001 + sctp_a_net_name: + hidden: false + immutable: false + type: string + description: Network Name SCTPA + default: vMME-24474-Ericsson-WTC-Lab-vLCP1-4_gn_SCTPA_net_1 + sctp-b-egress_dst_subnet_prefix_len: + hidden: false + immutable: false + type: float + description: ip_prefix_len for the SecurityGroup + default: '0' + constraints: + - in_range: + - 0 + - 32 + gpb1_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb1_Internal1 + default: 00:80:37:0E:09:22 + sctp-a-ingress-dst_start_port: + hidden: false + immutable: false + type: float + description: start_port for the SecurityGroup + default: 0 + constraints: + - in_range: + - 0 + - 65535 + fsb1_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to fsb1_Internal2 + default: 00:80:37:0E:0B:12 + vlc_st_service_mode: + hidden: false + immutable: false + type: string + description: service mode + default: in-network-nat + sctp-a-ipv6-egress_ethertype: + hidden: false + immutable: false + type: string + description: IPV6 ethertype + default: IPv4 + sctp-a-egress-src_end_port: + hidden: false + immutable: false + type: float + description: end_port for the SecurityGroup + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + sctp-b-egress_action: + hidden: false + immutable: false + type: string + description: simple_action for the SecurityGroup + default: pass + sctp-a-ingress-src_subnet_prefix_len: + hidden: false + immutable: false + type: float + description: ip_prefix_len for the SecurityGroup + default: '0' + constraints: + - in_range: + - 0 + - 32 + sctp-a-ipv6-ingress-src_start_port: + hidden: false + immutable: false + type: float + description: IPV6 start port + default: 0 + constraints: + - in_range: + - 0 + - 65535 + vf_module_id: + hidden: false + immutable: false + type: string + description: the vf_module_id for this instance. UUID provided by ECOMP + default: TWO + Internal1_net_cidr: + hidden: false + immutable: false + type: string + description: CIDR for internal-1 network + default: 169.253.0.0 + fsb_flavor_name: + hidden: false + immutable: false + type: string + description: Flavor to use for servers fsb1 + default: nv.c8r32d1 + sctp_rule_protocol: + hidden: false + immutable: false + type: string + description: protocol for the SecurityGroup + default: 132 + vnf_name: + hidden: false + immutable: false + type: string + description: the vnf_name for this instance. provided by ECOMP + default: zrdm3mmex59 + sctp-a-IPv6_ethertype: + hidden: false + immutable: false + type: string + description: IPV6 ethertype + default: IPv6 + vlc_sctp_b_v6_ip_7: + hidden: false + immutable: false + type: string + description: Static IP vlc8 SCTPB + default: fd00:200:200:5:0:0:0:29 + vlc6_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc6_Internal2 + default: 00:80:37:0E:06:12 + sctp-b-ingress-dst_end_port: + hidden: false + immutable: false + type: float + description: end_port for the SecurityGroup + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + vlc7_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc7_Internal2 + default: 00:80:37:0E:07:12 + sctp-a-ipv6-ingress-src_end_port: + hidden: false + immutable: false + type: float + description: IPV6 ending port for destination + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + vlc_flavor_name: + hidden: false + immutable: false + type: string + description: Flavor to use for servers vlc + default: nd.c16r64d1 + sctp-b-ipv6-egress_src_addresses: + hidden: false + immutable: false + type: string + description: IPV6 source + default: local + vlc_st_interface_type_int1: + hidden: false + immutable: false + type: string + description: service_interface_type for the ServiceTemplate + default: other1 + availability_zone_0: + hidden: false + immutable: false + type: string + description: cluster for spawnning fsb instances + default: rdm3-kvm-az02 + service_instance_id_0: + hidden: false + immutable: false + type: string + description: UUID of service instance for vLCs + default: 77c67cc8-d15f-47bc-aeb1-8d65d09e917a + availability_zone_1: + hidden: false + immutable: false + type: string + description: cluster for spawnning ncb instances + default: rdm3-kvm-az02 + vlc_st_interface_type_int2: + hidden: false + immutable: false + type: string + description: service_interface_type for the ServiceTemplate + default: other2 + sctp-a-ipv6-egress-dst_start_port: + hidden: false + immutable: false + type: string + description: IPV6 start port + default: 0 + sctp-a-ipv6-egress_dst_subnet_prefix_len: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix + default: '0' + vlc_sctp_a_ip_0: + hidden: false + immutable: false + type: string + description: Static IP vlc1 SCTPA + default: 107.243.47.144 + vlc_sctp_b_route_prefixes: + hidden: false + immutable: false + type: json + description: Route prefixes for static routing on SCTPB + vlc1_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc1_Internal1 + default: 00:80:37:0E:01:12 + sctp-b-ipv6-egress_src_end_port: + hidden: false + immutable: false + type: string + description: IPV6 end port + default: 65535 + sctp-a-ipv6-egress_src_addresses: + hidden: false + immutable: false + type: string + description: IPV6 source + default: local + vlc_sctp_a_ip_7: + hidden: false + immutable: false + type: string + description: Static IP vlc8 SCTPA + default: 107.243.47.157 + sctp-a-ingress-src_subnet_prefix_v6: + hidden: false + immutable: false + type: string + description: src subnet + default: '::' + vlc_sctp_a_ip_6: + hidden: false + immutable: false + type: string + description: Static IP vlc7 SCTPA + default: 107.243.47.156 + vlc_sctp_a_ip_5: + hidden: false + immutable: false + type: string + description: Static IP vlc6 SCTPA + default: 107.243.47.155 + sctp-a-ingress-dst_end_port: + hidden: false + immutable: false + type: float + description: end_port for the SecurityGroup + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + vlc_sctp_a_ip_4: + hidden: false + immutable: false + type: string + description: Static IP vlc5 SCTPA + default: 107.243.47.154 + vlc_sctp_a_ip_3: + hidden: false + immutable: false + type: string + description: Static IP vlc4 SCTPA + default: 107.243.47.153 + vlc_sctp_a_ip_2: + hidden: false + immutable: false + type: string + description: Static IP vlc3 SCTPA + default: 107.243.47.152 + vlc_sctp_a_ip_1: + hidden: false + immutable: false + type: string + description: Static IP vlc2 SCTPA + default: 107.243.47.145 + gpb6_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb6_Internal2 + default: 00:80:37:0E:0E:22 + security_group_int2_id: + hidden: false + immutable: false + type: string + description: UUID of Internal1_net security group + default: 1361f069-baf2-4b76-b321-7f68ba26c369 + Internal2_dhcp: + hidden: false + immutable: false + type: string + description: Whether DHCP/static IP addressing on internal-2 network + default: false + sctp-a-dst_subnet_prefix_v6: + hidden: false + immutable: false + type: string + description: ip_prefix for the SecurityGroup + default: '::' + pxe_image_name: + hidden: false + immutable: false + type: string + description: Name of image to use for server ncb + default: MME_PXE-Boot_1_3_GA.qcow2 + vlc_st_interface_type_gtp: + hidden: false + immutable: false + type: string + description: service_interface_type for the ServiceTemplate + default: other0 + ncb1_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to ncb1_Internal1 + default: 00:80:37:0E:09:12 + vlc_gtp_route_prefixes: + hidden: false + immutable: false + type: json + description: Route prefixes for static routing on GTP + int1_sec_group_name: + hidden: false + immutable: false + type: string + description: SecurityGroup name for internal-1 + default: int1-sec-group + vmi_oam_preference_secondary: + hidden: false + immutable: false + type: float + description: Preference for secondary interface/port + default: 100 + Internal1_dhcp: + hidden: false + immutable: false + type: string + description: Whether DHCP/static IP addressing on internal-1 network + default: false + fsb2_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to fsb2_Internal2 + default: 00:80:37:0E:0D:12 + Internal1_net_cidr_len: + hidden: false + immutable: false + type: string + description: CIDR length for internal-1 network + default: 17 + sctp-a-ingress_dst_addresses: + hidden: false + immutable: false + type: string + description: security_group for the SecurityGroup + default: local + sctp-b-ingress-src_subnet_prefix_len: + hidden: false + immutable: false + type: float + description: ip_prefix_len for the SecurityGroup + default: '0' + constraints: + - in_range: + - 0 + - 32 + fsb_oam_ip_1: + hidden: false + immutable: false + type: string + description: IP address of OAM vNIC for FSB2 + default: 107.239.72.154 + fsb_oam_ip_0: + hidden: false + immutable: false + type: string + description: IP address of OAM vNIC for FSB1 + default: 107.239.72.153 + shc_timeout: + hidden: false + immutable: false + type: string + description: health check + default: 5 + vlc_st_version: + hidden: false + immutable: false + type: string + description: Indicates service version + default: 2 + sctp-a-src_subnet_prefix_v6: + hidden: false + immutable: false + type: string + description: ip_prefix for the SecurityGroup + default: '::' + sctp-a-ingress_rule_application: + hidden: false + immutable: false + type: string + description: application for the SecurityGroup + default: any + sctp-b-egress_ethertype: + hidden: false + immutable: false + type: string + description: ethertype for the SecurityGroup + default: IPv4 + sctp-a-ipv6-egress_src_start_port: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix + default: 0 + instance_ip_family_v6: + hidden: false + immutable: false + type: string + description: Ipv6 instance type + default: v6 + sctp-b-ingress-src_subnet_prefix_v6: + hidden: false + immutable: false + type: string + description: src subnet + default: '::' + gpb8_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb8_Internal2 + default: 00:80:37:0E:10:22 + gpb4_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb4_Internal1 + default: 00:80:37:0E:0C:22 + sctp-a-ipv6-ingress-dst_end_port: + hidden: false + immutable: false + type: string + description: IPV6 end port + default: 65535 + Internal1_net_gateway: + hidden: false + immutable: false + type: string + description: gateway for internal-1 network + default: 169.253.0.3 + sctp-b-ipv6-egress-dst_start_port: + hidden: false + immutable: false + type: string + description: IPV6 start port + default: 0 + gpb_name_7: + hidden: false + immutable: false + type: string + description: Name of gpb8 + default: zrdm3mmex59gpb0016 + gpb_name_6: + hidden: false + immutable: false + type: string + description: Name of gpb7 + default: zrdm3mmex59gpb0015 + gpb_name_5: + hidden: false + immutable: false + type: string + description: Name of gpb6 + default: zrdm3mmex59gpb0014 + gpb_name_4: + hidden: false + immutable: false + type: string + description: Name of gpb5 + default: zrdm3mmex59gpb0013 + gpb_name_3: + hidden: false + immutable: false + type: string + description: Name of gpb4 + default: zrdm3mmex59gpb0012 + sctp-a-ipv6-ingress_dst_addresses: + hidden: false + immutable: false + type: string + description: IPV6 destination + default: local + gpb_name_2: + hidden: false + immutable: false + type: string + description: Name of gpb3 + default: zrdm3mmex59gpb0011 + shc_delay: + hidden: false + immutable: false + type: string + description: health check + default: 3 + gpb_name_1: + hidden: false + immutable: false + type: string + description: Name of gpb2 + default: zrdm3mmex59gpb0010 + sctp-b-ipv6-egress_action: + hidden: false + immutable: false + type: string + description: IPV6 action + default: pass + vlc3_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc3_Internal2 + default: 00:80:37:0E:03:12 + gpb_name_0: + hidden: false + immutable: false + type: string + description: Name of gpb1 + default: zrdm3mmex59gpb009 + sctp-a-ipv6-egress_action: + hidden: false + immutable: false + type: string + description: IPV6 action + default: pass + gpb5_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb5_Internal1 + default: 00:80:37:0E:0D:22 + sctp-b-ipv6-ingress_rule_protocol: + hidden: false + immutable: false + type: string + description: IPV6 Rule-protocol + default: any + shc_max_retries: + hidden: false + immutable: false + type: string + description: health check + default: 2 + fsb_volume_type: + label: volume type + hidden: false + immutable: false + type: string + description: volume type SolidFire + default: SF-Default-SSD + sctp-a-name: + hidden: false + immutable: false + type: string + description: name for the SecurityGroup + default: epc-sctp-a-ipv4v6-sec-group + vlc_sctp_b_ip_5: + hidden: false + immutable: false + type: string + description: Static IP vlc6 SCTPB + default: 107.243.47.187 + vlc_sctp_b_ip_4: + hidden: false + immutable: false + type: string + description: Static IP vlc5 SCTPB + default: 107.243.47.186 + vlc_sctp_b_ip_3: + hidden: false + immutable: false + type: string + description: Static IP vlc4 SCTPB + default: 107.243.47.185 + vlc_sctp_b_ip_2: + hidden: false + immutable: false + type: string + description: Static IP vlc3 SCTPB + default: 107.243.47.184 + sctp-b-egress_rule_protocol: + hidden: false + immutable: false + type: string + description: protocol for the SecurityGroup + default: any + vnf_id: + hidden: false + immutable: false + type: string + description: the vf_id for this instance. UUID provided by ECOMP + default: zrdm3mmex59 + vlc_sctp_b_ip_7: + hidden: false + immutable: false + type: string + description: Static IP vlc8 SCTPB + default: 107.243.47.189 + vlc_sctp_b_ip_6: + hidden: false + immutable: false + type: string + description: Static IP vlc7 SCTPB + default: 107.243.47.188 + vlc_sctp_b_ip_1: + hidden: false + immutable: false + type: string + description: Static IP vlc2 SCTPB + default: 107.243.47.177 + gpb6_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb6_Internal1 + default: 00:80:37:0E:0E:22 + sctp-b-ipv6-egress_dst_end_port: + hidden: false + immutable: false + type: string + description: IPV6 end port + default: 65535 + vlc_sctp_b_ip_0: + hidden: false + immutable: false + type: string + description: Static IP vlc1 SCTPB + default: 107.243.47.176 + vlc2_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc2_Internal2 + default: 00:80:37:0E:02:12 + sctp-b-ingress-src_subnet_prefix: + hidden: false + immutable: false + type: string + description: ip_prefix for the SecurityGroup + default: 0.0.0.0 + gpb_flavor_name: + hidden: false + immutable: false + type: string + description: Flavor to use for servers gpb + default: nv.c20r64d1 + vlc_sctp_a_route_prefixes: + hidden: false + immutable: false + type: json + description: Route prefixes for static routing on SCTPA + sctp-b-ipv6-ingress_dst_addresses: + hidden: false + immutable: false + type: string + description: IPV6 destination + default: local + sctp-b-ipv6-ingress_ethertype: + hidden: false + immutable: false + type: string + description: IPV6 ethertype + default: IPv4 + sctp-b-ipv6-egress_dst_subnet_prefix: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix + default: 0.0.0.0 + sctp-a-ingress-src_subnet_prefix: + hidden: false + immutable: false + type: string + description: ip_prefix for the SecurityGroup + default: 0.0.0.0 + vlc1_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc1_Internal2 + default: 00:80:37:0E:01:12 + Internal1_rpf: + hidden: false + immutable: false + type: string + description: Reverse Path Forwarding Enabled/Disabled internal-1 network + default: disable + sctp-b-ingress_ethertype: + hidden: false + immutable: false + type: string + description: ethertype for the SecurityGroup + default: IPv4 + sctp-b-ingress-src_end_port: + hidden: false + immutable: false + type: float + description: end_port for the SecurityGroup + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + sctp-a-ipv6-ingress_rule_protocol: + hidden: false + immutable: false + type: string + description: IPV6 Rule-protocol + default: any + vlc_sctp_a_v6_ip_7: + hidden: false + immutable: false + type: string + description: Static IP vlc8 SCTPA + default: fd00:200:200:4:0:0:0:29 + vlc_sctp_a_v6_ip_6: + hidden: false + immutable: false + type: string + description: Static IP vlc7 SCTPA + default: fd00:200:200:4:0:0:0:28 + gpb7_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb7_Internal1 + default: 00:80:37:0E:0F:22 + vlc_sctp_a_v6_ip_5: + hidden: false + immutable: false + type: string + description: Static IP vlc6 SCTPA + default: fd00:200:200:4:0:0:0:27 + vlc_sctp_a_v6_ip_4: + hidden: false + immutable: false + type: string + description: Static IP vlc5 SCTPA + default: fd00:200:200:4:0:0:0:26 + vlc_sctp_a_v6_ip_3: + hidden: false + immutable: false + type: string + description: Static IP vlc4 SCTPA + default: fd00:200:200:4:0:0:0:25 + vlc_sctp_a_v6_ip_2: + hidden: false + immutable: false + type: string + description: Static IP vlc3 SCTPA + default: fd00:200:200:4:0:0:0:24 + sctp-a-ingress-src_start_port: + hidden: false + immutable: false + type: float + description: start_port for the SecurityGroup + default: 0 + constraints: + - in_range: + - 0 + - 65535 + vlc_sctp_a_v6_ip_1: + hidden: false + immutable: false + type: string + description: Static IP vlc2 SCTPA + default: fd00:200:200:4:0:0:0:17 + vlc_sctp_a_v6_ip_0: + hidden: false + immutable: false + type: string + description: Static IP vlc1 SCTPA + default: fd00:200:200:4:0:0:0:16 + node_templates: + abstract_gpb_1: + type: org.openecomp.resource.abstract.nodes.gpb_1 + directives: + - substitutable + properties: + compute_gpb_name: + - get_input: gpb_name_1 + vm_flavor_name: + get_input: gpb_flavor_name + compute_gpb_scheduler_hints: + - group: + get_input: server_group_id_0 + port_gpb2_Internal1_security_groups: + - - get_input: security_group_int1_id + compute_gpb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + port_gpb2_Internal2_network: + - get_input: internal_net_id_1 + port_gpb2_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + vm_image_name: + get_input: pxe_image_name + port_gpb2_Internal1_replacement_policy: + - AUTO + port_gpb2_Internal1_network: + - get_input: internal_net_id_0 + port_gpb2_Internal2_replacement_policy: + - AUTO + port_gpb2_Internal1_mac_requirements: + mac_count_required: + is_required: true + compute_gpb_availability_zone: + - get_input: availability_zone_1 + port_gpb2_Internal1_mac_address: + get_input: gpb2_Internal1_mac + port_gpb2_Internal2_mac_requirements: + mac_count_required: + is_required: true + port_gpb2_Internal2_mac_address: + get_input: gpb2_Internal1_mac + port_gpb2_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb2_Internal2_security_groups: + - - get_input: security_group_int2_id + service_template_filter: + substitute_service_template: Nested_gpb_1ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: gpb + nfc_naming_code: gpb + requirements: + - link_gpb_gpb2_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + - link_gpb_gpb2_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + abstract_gpb_2: + type: org.openecomp.resource.abstract.nodes.gpb_2 + directives: + - substitutable + properties: + port_gpb3_Internal1_replacement_policy: + - AUTO + compute_gpb_name: + - get_input: gpb_name_2 + port_gpb3_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb3_Internal2_replacement_policy: + - AUTO + vm_flavor_name: + get_input: gpb_flavor_name + port_gpb3_Internal2_security_groups: + - - get_input: security_group_int2_id + compute_gpb_scheduler_hints: + - group: + get_input: server_group_id_0 + compute_gpb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + vm_image_name: + get_input: pxe_image_name + port_gpb3_Internal1_security_groups: + - - get_input: security_group_int1_id + port_gpb3_Internal2_network: + - get_input: internal_net_id_1 + compute_gpb_availability_zone: + - get_input: availability_zone_0 + port_gpb3_Internal1_network: + - get_input: internal_net_id_0 + port_gpb3_Internal1_mac_requirements: + mac_count_required: + is_required: true + port_gpb3_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb3_Internal1_mac_address: + get_input: gpb3_Internal1_mac + port_gpb3_Internal2_mac_address: + get_input: gpb3_Internal1_mac + port_gpb3_Internal2_mac_requirements: + mac_count_required: + is_required: true + service_template_filter: + substitute_service_template: Nested_gpb_2ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: gpb + nfc_naming_code: gpb + requirements: + - link_gpb_gpb3_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_gpb_gpb3_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + abstract_vlc: + type: org.openecomp.resource.abstract.nodes.vlc + directives: + - substitutable + properties: + port_template_VMInt_SCTP_A_vlc_virtual_network_refs: + - - get_input: sctp_a_net_fqdn + port_template_VMInt_INT1_vlc_security_group_refs: + - - get_input: security_group_int1_id + vm_flavor_name: + get_input: vlc_flavor_name + port_template_VMInt_INT2_vlc_port_tuple_refs: + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc4 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc3 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc2 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc1 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc8 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc7 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc6 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc5 + vm_image_name: + get_input: pxe_image_name + port_template_VMInt_INT1_vlc_port_tuple_refs: + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc4 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc3 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc2 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc1 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc8 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc7 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc6 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc5 + port_template_VMInt_INT2_vlc_virtual_network_refs: + - - get_input: internal_net_id_1 + port_template_VMInt_OAM_vlc_virtual_network_refs: + - - get_input: oam_net_fqdn + port_template_VMInt_OAM_vlc_port_tuple_refs: + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc4 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc3 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc2 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc1 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc8 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc7 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc6 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc5 + port_template_VMInt_INT2_vlc_virtual_machine_interface_mac_addresses: + - - get_input: vlc4_Internal2_mac + - - get_input: vlc3_Internal2_mac + - - get_input: vlc2_Internal2_mac + - - get_input: vlc1_Internal2_mac + - - get_input: vlc8_Internal2_mac + - - get_input: vlc7_Internal2_mac + - - get_input: vlc6_Internal2_mac + - - get_input: vlc5_Internal2_mac + port_template_VMInt_SCTP_B_vlc_port_tuple_refs: + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc4 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc3 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc2 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc1 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc8 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc7 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc6 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc5 + port_template_VMInt_GTP_vlc_security_group_refs: + - - get_input: security_group_gtp_id + compute_vlc_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + port_template_VMInt_OAM_vlc_security_group_refs: + - - get_input: security_group_oam_id + compute_vlc_contrail_service_instance_ind: + - true + - true + - true + - true + - true + - true + - true + - true + port_template_VMInt_GTP_vlc_port_tuple_refs: + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc4 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc3 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc2 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc1 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc8 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc7 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc6 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc5 + port_template_VMInt_SCTP_B_vlc_virtual_network_refs: + - - get_input: sctp_b_net_fqdn + port_template_VMInt_INT2_vlc_security_group_refs: + - - get_input: security_group_int2_id + port_template_VMInt_SCTP_B_vlc_security_group_refs: + - - get_input: security_group_sctp_b_id + port_template_VMInt_INT1_vlc_virtual_network_refs: + - - get_input: internal_net_id_0 + port_template_VMInt_SCTP_A_vlc_port_tuple_refs: + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc4 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc3 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc2 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc1 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc8 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc7 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc6 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc5 + compute_vlc_scheduler_hints: + - group: + get_input: server_group_id_0 + - group: + get_input: server_group_id_0 + - group: + get_input: server_group_id_0 + - group: + get_input: server_group_id_0 + - group: + get_input: server_group_id_0 + - group: + get_input: server_group_id_0 + - group: + get_input: server_group_id_0 + - group: + get_input: server_group_id_0 + compute_vlc_name: + - get_input: vlc_name_3 + - get_input: vlc_name_2 + - get_input: vlc_name_1 + - get_input: vlc_name_0 + - get_input: vlc_name_7 + - get_input: vlc_name_6 + - get_input: vlc_name_5 + - get_input: vlc_name_4 + port_template_VMInt_SCTP_A_vlc_security_group_refs: + - - get_input: security_group_sctp_a_id + compute_vlc_availability_zone: + - get_input: availability_zone_1 + - get_input: availability_zone_0 + - get_input: availability_zone_1 + - get_input: availability_zone_0 + - get_input: availability_zone_1 + - get_input: availability_zone_0 + - get_input: availability_zone_1 + - get_input: availability_zone_0 + port_template_VMInt_INT1_vlc_virtual_machine_interface_mac_addresses: + - - get_input: vlc4_Internal1_mac + - - get_input: vlc3_Internal1_mac + - - get_input: vlc2_Internal1_mac + - - get_input: vlc1_Internal1_mac + - - get_input: vlc8_Internal1_mac + - - get_input: vlc7_Internal1_mac + - - get_input: vlc6_Internal1_mac + - - get_input: vlc5_Internal1_mac + port_template_VMInt_GTP_vlc_virtual_network_refs: + - - get_input: gtp_net_fqdn + service_template_filter: + substitute_service_template: Nested_vlcServiceTemplate.yaml + count: 8 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: vlc + nfc_naming_code: vlc + requirements: + - link_vlc_template_VMInt_INT2_vlc: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + - link_vlc_template_VMInt_INT1_vlc: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + abstract_gpb_7: + type: org.openecomp.resource.abstract.nodes.gpb_7 + directives: + - substitutable + properties: + compute_gpb_name: + - get_input: gpb_name_7 + port_gpb8_Internal1_mac_address: + get_input: gpb8_Internal1_mac + port_gpb8_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + vm_flavor_name: + get_input: gpb_flavor_name + compute_gpb_scheduler_hints: + - group: + get_input: server_group_id_0 + compute_gpb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + vm_image_name: + get_input: pxe_image_name + port_gpb8_Internal2_security_groups: + - - get_input: security_group_int2_id + port_gpb8_Internal1_replacement_policy: + - AUTO + port_gpb8_Internal2_replacement_policy: + - AUTO + compute_gpb_availability_zone: + - get_input: availability_zone_1 + port_gpb8_Internal1_mac_requirements: + mac_count_required: + is_required: true + port_gpb8_Internal1_network: + - get_input: internal_net_id_0 + port_gpb8_Internal2_mac_requirements: + mac_count_required: + is_required: true + port_gpb8_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb8_Internal1_security_groups: + - - get_input: security_group_int1_id + port_gpb8_Internal2_network: + - get_input: internal_net_id_1 + port_gpb8_Internal2_mac_address: + get_input: gpb8_Internal1_mac + service_template_filter: + substitute_service_template: Nested_gpb_7ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: gpb + nfc_naming_code: gpb + requirements: + - link_gpb_gpb8_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_gpb_gpb8_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + abstract_gpb_5: + type: org.openecomp.resource.abstract.nodes.gpb_5 + directives: + - substitutable + properties: + port_gpb6_Internal1_mac_requirements: + mac_count_required: + is_required: true + compute_gpb_name: + - get_input: gpb_name_5 + vm_flavor_name: + get_input: gpb_flavor_name + compute_gpb_scheduler_hints: + - group: + get_input: server_group_id_0 + compute_gpb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + port_gpb6_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + vm_image_name: + get_input: pxe_image_name + port_gpb6_Internal1_security_groups: + - - get_input: security_group_int1_id + port_gpb6_Internal2_network: + - get_input: internal_net_id_1 + compute_gpb_availability_zone: + - get_input: availability_zone_1 + port_gpb6_Internal1_network: + - get_input: internal_net_id_0 + port_gpb6_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb6_Internal2_mac_address: + get_input: gpb6_Internal1_mac + port_gpb6_Internal1_mac_address: + get_input: gpb6_Internal1_mac + port_gpb6_Internal2_mac_requirements: + mac_count_required: + is_required: true + port_gpb6_Internal2_replacement_policy: + - AUTO + port_gpb6_Internal1_replacement_policy: + - AUTO + port_gpb6_Internal2_security_groups: + - - get_input: security_group_int2_id + service_template_filter: + substitute_service_template: Nested_gpb_5ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: gpb + nfc_naming_code: gpb + requirements: + - link_gpb_gpb6_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_gpb_gpb6_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + abstract_gpb_6: + type: org.openecomp.resource.abstract.nodes.gpb_6 + directives: + - substitutable + properties: + port_gpb7_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb7_Internal1_network: + - get_input: internal_net_id_0 + compute_gpb_name: + - get_input: gpb_name_6 + port_gpb7_Internal2_network: + - get_input: internal_net_id_1 + vm_flavor_name: + get_input: gpb_flavor_name + port_gpb7_Internal1_replacement_policy: + - AUTO + port_gpb7_Internal2_replacement_policy: + - AUTO + port_gpb7_Internal2_security_groups: + - - get_input: security_group_int2_id + compute_gpb_scheduler_hints: + - group: + get_input: server_group_id_0 + compute_gpb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + vm_image_name: + get_input: pxe_image_name + port_gpb7_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb7_Internal1_security_groups: + - - get_input: security_group_int1_id + compute_gpb_availability_zone: + - get_input: availability_zone_0 + port_gpb7_Internal2_mac_address: + get_input: gpb7_Internal1_mac + port_gpb7_Internal1_mac_requirements: + mac_count_required: + is_required: true + port_gpb7_Internal1_mac_address: + get_input: gpb7_Internal1_mac + port_gpb7_Internal2_mac_requirements: + mac_count_required: + is_required: true + service_template_filter: + substitute_service_template: Nested_gpb_6ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: gpb + nfc_naming_code: gpb + requirements: + - link_gpb_gpb7_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_gpb_gpb7_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + abstract_gpb_3: + type: org.openecomp.resource.abstract.nodes.gpb_3 + directives: + - substitutable + properties: + compute_gpb_name: + - get_input: gpb_name_3 + port_gpb4_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + vm_flavor_name: + get_input: gpb_flavor_name + port_gpb4_Internal1_mac_address: + get_input: gpb4_Internal1_mac + compute_gpb_scheduler_hints: + - group: + get_input: server_group_id_0 + port_gpb4_Internal2_mac_requirements: + mac_count_required: + is_required: true + compute_gpb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + port_gpb4_Internal2_mac_address: + get_input: gpb4_Internal1_mac + vm_image_name: + get_input: pxe_image_name + port_gpb4_Internal2_security_groups: + - - get_input: security_group_int2_id + compute_gpb_availability_zone: + - get_input: availability_zone_1 + port_gpb4_Internal2_replacement_policy: + - AUTO + port_gpb4_Internal1_replacement_policy: + - AUTO + port_gpb4_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb4_Internal1_security_groups: + - - get_input: security_group_int1_id + port_gpb4_Internal2_network: + - get_input: internal_net_id_1 + port_gpb4_Internal1_mac_requirements: + mac_count_required: + is_required: true + port_gpb4_Internal1_network: + - get_input: internal_net_id_0 + service_template_filter: + substitute_service_template: Nested_gpb_3ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: gpb + nfc_naming_code: gpb + requirements: + - link_gpb_gpb4_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_gpb_gpb4_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + abstract_gpb_4: + type: org.openecomp.resource.abstract.nodes.gpb_4 + directives: + - substitutable + properties: + port_gpb5_Internal2_mac_requirements: + mac_count_required: + is_required: true + port_gpb5_Internal1_security_groups: + - - get_input: security_group_int1_id + compute_gpb_name: + - get_input: gpb_name_4 + vm_flavor_name: + get_input: gpb_flavor_name + port_gpb5_Internal1_mac_requirements: + mac_count_required: + is_required: true + compute_gpb_scheduler_hints: + - group: + get_input: server_group_id_0 + port_gpb5_Internal2_network: + - get_input: internal_net_id_1 + compute_gpb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + vm_image_name: + get_input: pxe_image_name + port_gpb5_Internal1_network: + - get_input: internal_net_id_0 + port_gpb5_Internal2_mac_address: + get_input: gpb5_Internal1_mac + port_gpb5_Internal1_mac_address: + get_input: gpb5_Internal1_mac + port_gpb5_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb5_Internal2_replacement_policy: + - AUTO + compute_gpb_availability_zone: + - get_input: availability_zone_0 + port_gpb5_Internal1_replacement_policy: + - AUTO + port_gpb5_Internal2_security_groups: + - - get_input: security_group_int2_id + port_gpb5_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + service_template_filter: + substitute_service_template: Nested_gpb_4ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: gpb + nfc_naming_code: gpb + requirements: + - link_gpb_gpb5_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_gpb_gpb5_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + abstract_gpb: + type: org.openecomp.resource.abstract.nodes.gpb + directives: + - substitutable + properties: + port_gpb1_Internal1_security_groups: + - - get_input: security_group_int1_id + compute_gpb_name: + - get_input: gpb_name_0 + port_gpb1_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + vm_flavor_name: + get_input: gpb_flavor_name + port_gpb1_Internal1_mac_requirements: + mac_count_required: + is_required: true + compute_gpb_scheduler_hints: + - group: + get_input: server_group_id_0 + compute_gpb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + vm_image_name: + get_input: pxe_image_name + port_gpb1_Internal1_mac_address: + get_input: gpb1_Internal1_mac + port_gpb1_Internal2_mac_address: + get_input: gpb1_Internal1_mac + port_gpb1_Internal2_mac_requirements: + mac_count_required: + is_required: true + compute_gpb_availability_zone: + - get_input: availability_zone_0 + port_gpb1_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb1_Internal2_security_groups: + - - get_input: security_group_int2_id + port_gpb1_Internal1_replacement_policy: + - AUTO + port_gpb1_Internal2_replacement_policy: + - AUTO + port_gpb1_Internal2_network: + - get_input: internal_net_id_1 + port_gpb1_Internal1_network: + - get_input: internal_net_id_0 + service_template_filter: + substitute_service_template: Nested_gpbServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: gpb + nfc_naming_code: gpb + requirements: + - link_gpb_gpb1_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_gpb_gpb1_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + Internal1_net: + type: org.openecomp.resource.vl.nodes.heat.network.contrailV2.VirtualNetwork + properties: + network_ipam_refs_data: + - network_ipam_refs_data_ipam_subnets: + - network_ipam_refs_data_ipam_subnets_enable_dhcp: + get_input: Internal1_dhcp + network_ipam_refs_data_ipam_subnets_default_gateway: + get_input: Internal1_net_gateway + network_ipam_refs_data_ipam_subnets_subnet: + network_ipam_refs_data_ipam_subnets_subnet_ip_prefix_len: + get_input: Internal1_net_cidr_len + network_ipam_refs_data_ipam_subnets_subnet_ip_prefix: + get_input: Internal1_net_cidr + network_name: + str_replace: + template: $VNF_NAME_int_net_1 + params: + $VNF_NAME: + get_input: vnf_name + network_ipam_refs: + - UNSUPPORTED_RESOURCE_template_NetworkIpam_Internal1 + abstract_fsb: + type: org.openecomp.resource.abstract.nodes.fsb + directives: + - substitutable + properties: + port_FSB1_Internal1_mac_address: + get_input: fsb1_Internal1_mac + port_FSB_OAM_network_role_tag: + - oam + port_FSB1_Internal2_network: + - Internal2_net + port_FSB1_Internal1_network: + - Internal1_net + vm_flavor_name: + get_input: fsb_flavor_name + port_FSB1_Internal2_mac_address: + get_input: fsb1_Internal1_mac + port_FSB_OAM_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: true + floating_ip_count_required: + is_required: false + compute_fsb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + port_FSB1_Internal1_security_groups: + - - int1_security_group + port_FSB1_Internal2_replacement_policy: + - AUTO + compute_fsb_scheduler_hints: + - group: VM_Affinity_group + port_FSB1_Internal1_replacement_policy: + - AUTO + compute_fsb_name: + - get_input: fsb_name_0 + port_FSB1_Internal1_mac_requirements: + mac_count_required: + is_required: true + port_FSB1_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_FSB_OAM_network: + - get_input: oam_net_name + port_FSB_OAM_security_groups: + - - oam_security_group + port_FSB_OAM_mac_requirements: + mac_count_required: + is_required: false + port_FSB_OAM_replacement_policy: + - AUTO + compute_fsb_availability_zone: + - get_input: availability_zone_0 + port_FSB1_Internal2_security_groups: + - - int2_security_group + port_FSB1_Internal2_mac_requirements: + mac_count_required: + is_required: true + port_FSB1_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_FSB_OAM_fixed_ips: + - ip_address: + get_input: fsb_oam_ip_0 + service_template_filter: + substitute_service_template: Nested_fsbServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: fsb + nfc_naming_code: fsb + requirements: + - link_fsb_FSB1_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_fsb_FSB1_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + gtp_security_group: + type: org.openecomp.resource.vfc.rules.nodes.heat.network.neutron.SecurityRules + properties: + name: + str_replace: + template: $VNF_NAME_$SECGROUPNAME + params: + $SECGROUPNAME: + get_input: gtp_sec_group_name + $VNF_NAME: + get_input: vnf_name + rules: + - protocol: tcp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: udp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: icmp + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + - protocol: tcp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: udp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: icmp + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + abstract_ncb_1: + type: org.openecomp.resource.abstract.nodes.ncb_1 + directives: + - substitutable + properties: + port_NCB2_Internal2_security_groups: + - - int2_security_group + port_NCB2_Internal1_replacement_policy: + - AUTO + port_NCB2_Internal2_replacement_policy: + - AUTO + vm_flavor_name: + get_input: ncb_flavor_name + port_NCB2_Internal2_mac_requirements: + mac_count_required: + is_required: true + port_NCB2_Internal1_mac_requirements: + mac_count_required: + is_required: true + vm_image_name: + get_input: pxe_image_name + compute_ncb_scheduler_hints: + - group: VM_Affinity_group + compute_ncb_availability_zone: + - get_input: availability_zone_1 + port_NCB2_Internal1_network: + - Internal1_net + port_NCB2_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_NCB2_Internal1_security_groups: + - - int1_security_group + port_NCB2_Internal2_network: + - Internal2_net + port_NCB2_Internal1_mac_address: + get_input: ncb2_Internal1_mac + port_NCB2_Internal2_mac_address: + get_input: ncb2_Internal1_mac + compute_ncb_name: + - get_input: ncb_name_1 + compute_ncb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + port_NCB2_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + service_template_filter: + substitute_service_template: Nested_ncb_1ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: ncb + nfc_naming_code: ncb + requirements: + - link_ncb_NCB2_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_ncb_NCB2_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + abstract_ncb: + type: org.openecomp.resource.abstract.nodes.ncb + directives: + - substitutable + properties: + vm_flavor_name: + get_input: ncb_flavor_name + port_NCB1_Internal2_mac_requirements: + mac_count_required: + is_required: true + vm_image_name: + get_input: pxe_image_name + port_NCB1_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + compute_ncb_scheduler_hints: + - group: VM_Affinity_group + port_NCB1_Internal1_security_groups: + - - int1_security_group + compute_ncb_availability_zone: + - get_input: availability_zone_0 + port_NCB1_Internal2_mac_address: + get_input: ncb1_Internal1_mac + port_NCB1_Internal1_mac_address: + get_input: ncb1_Internal1_mac + port_NCB1_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_NCB1_Internal1_mac_requirements: + mac_count_required: + is_required: true + port_NCB1_Internal2_replacement_policy: + - AUTO + port_NCB1_Internal1_network: + - Internal1_net + port_NCB1_Internal2_security_groups: + - - int2_security_group + port_NCB1_Internal1_replacement_policy: + - AUTO + compute_ncb_name: + - get_input: ncb_name_0 + compute_ncb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + port_NCB1_Internal2_network: + - Internal2_net + service_template_filter: + substitute_service_template: Nested_ncbServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: ncb + nfc_naming_code: ncb + requirements: + - link_ncb_NCB1_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_ncb_NCB1_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + int1_security_group: + type: org.openecomp.resource.vfc.rules.nodes.heat.network.neutron.SecurityRules + properties: + name: + str_replace: + template: $VNF_NAME_$SECGROUPNAME + params: + $SECGROUPNAME: + get_input: int1_sec_group_name + $VNF_NAME: + get_input: vnf_name + rules: + - protocol: tcp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: udp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: icmp + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + - protocol: tcp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: udp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: icmp + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + requirements: + - port: + capability: attachment_fsb_FSB1_Internal1 + node: abstract_fsb + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_fsb_FSB2_Internal1 + node: abstract_fsb_1 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_ncb_NCB1_Internal1 + node: abstract_ncb + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_ncb_NCB2_Internal1 + node: abstract_ncb_1 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb1_Internal1 + node: abstract_gpb + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb2_Internal1 + node: abstract_gpb_1 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb3_Internal1 + node: abstract_gpb_2 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb4_Internal1 + node: abstract_gpb_3 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb5_Internal1 + node: abstract_gpb_4 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb6_Internal1 + node: abstract_gpb_5 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb7_Internal1 + node: abstract_gpb_6 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb8_Internal1 + node: abstract_gpb_7 + relationship: org.openecomp.relationships.AttachesTo + fsb_volume_0: + type: org.openecomp.resource.vfc.nodes.heat.cinder.Volume + properties: + image: + get_input: fsb_volume_image_name_0 + volume_type: + get_input: fsb_volume_type + size: '(get_input : fsb_volume_size) * 1024' + name: + list_join: + - _ + - - get_input: OS::stack_name + - FSB1_Vol_1 + fsb_volume_1: + type: org.openecomp.resource.vfc.nodes.heat.cinder.Volume + properties: + image: + get_input: fsb_volume_image_name_1 + volume_type: + get_input: fsb_volume_type + size: '(get_input : fsb_volume_size) * 1024' + name: + list_join: + - _ + - - get_input: OS::stack_name + - FSB2_Vol_1 + Internal2_net: + type: org.openecomp.resource.vl.nodes.heat.network.contrailV2.VirtualNetwork + properties: + network_ipam_refs_data: + - network_ipam_refs_data_ipam_subnets: + - network_ipam_refs_data_ipam_subnets_enable_dhcp: + get_input: Internal2_dhcp + network_ipam_refs_data_ipam_subnets_default_gateway: + get_input: Internal2_net_gateway + network_ipam_refs_data_ipam_subnets_subnet: + network_ipam_refs_data_ipam_subnets_subnet_ip_prefix_len: + get_input: Internal2_net_cidr_len + network_ipam_refs_data_ipam_subnets_subnet_ip_prefix: + get_input: Internal2_net_cidr + network_name: + str_replace: + template: $VNF_NAME_int_net_2 + params: + $VNF_NAME: + get_input: vnf_name + network_ipam_refs: + - UNSUPPORTED_RESOURCE_template_NetworkIpam_Internal2 + int2_security_group: + type: org.openecomp.resource.vfc.rules.nodes.heat.network.neutron.SecurityRules + properties: + name: + str_replace: + template: $VNF_NAME_$SECGROUPNAME + params: + $SECGROUPNAME: + get_input: int2_sec_group_name + $VNF_NAME: + get_input: vnf_name + rules: + - protocol: tcp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: udp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: 132 + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: icmp + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + - protocol: tcp + ethertype: IPv6 + port_range_max: 65535 + remote_ip_prefix: ::/0 + direction: egress + port_range_min: 1 + - protocol: udp + ethertype: IPv6 + port_range_max: 65535 + remote_ip_prefix: ::/0 + direction: egress + port_range_min: 1 + - protocol: 132 + ethertype: IPv6 + port_range_max: 65535 + remote_ip_prefix: ::/0 + direction: egress + port_range_min: 1 + - protocol: icmp + ethertype: IPv6 + remote_ip_prefix: ::/0 + direction: egress + - protocol: tcp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: udp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: 132 + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: icmp + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + - protocol: tcp + ethertype: IPv6 + port_range_max: 65535 + remote_ip_prefix: ::/0 + direction: ingress + port_range_min: 1 + - protocol: udp + ethertype: IPv6 + port_range_max: 65535 + remote_ip_prefix: ::/0 + direction: ingress + port_range_min: 1 + - protocol: 132 + ethertype: IPv6 + port_range_max: 65535 + remote_ip_prefix: ::/0 + direction: ingress + port_range_min: 1 + - protocol: icmp + ethertype: IPv6 + remote_ip_prefix: ::/0 + direction: ingress + requirements: + - port: + capability: attachment_fsb_FSB1_Internal2 + node: abstract_fsb + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_fsb_FSB2_Internal2 + node: abstract_fsb_1 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_ncb_NCB1_Internal2 + node: abstract_ncb + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_ncb_NCB2_Internal2 + node: abstract_ncb_1 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb1_Internal2 + node: abstract_gpb + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb2_Internal2 + node: abstract_gpb_1 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb3_Internal2 + node: abstract_gpb_2 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb4_Internal2 + node: abstract_gpb_3 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb5_Internal2 + node: abstract_gpb_4 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb6_Internal2 + node: abstract_gpb_5 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb7_Internal2 + node: abstract_gpb_6 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb8_Internal2 + node: abstract_gpb_7 + relationship: org.openecomp.relationships.AttachesTo + abstract_fsb_1: + type: org.openecomp.resource.abstract.nodes.fsb_1 + directives: + - substitutable + properties: + port_FSB_OAM_network_role_tag: + - oam + vm_flavor_name: + get_input: fsb_flavor_name + port_FSB_OAM_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: true + floating_ip_count_required: + is_required: false + port_FSB2_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_FSB2_Internal2_security_groups: + - - int2_security_group + compute_fsb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + port_FSB2_Internal1_mac_address: + get_input: fsb2_Internal1_mac + compute_fsb_scheduler_hints: + - group: VM_Affinity_group + compute_fsb_name: + - get_input: fsb_name_1 + port_FSB2_Internal1_security_groups: + - - int1_security_group + port_FSB_OAM_network: + - get_input: oam_net_name + port_FSB_OAM_security_groups: + - - oam_security_group + port_FSB2_Internal1_network: + - Internal1_net + port_FSB2_Internal2_mac_address: + get_input: fsb2_Internal1_mac + port_FSB2_Internal2_mac_requirements: + mac_count_required: + is_required: true + port_FSB_OAM_mac_requirements: + mac_count_required: + is_required: false + port_FSB2_Internal2_replacement_policy: + - AUTO + port_FSB2_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_FSB_OAM_replacement_policy: + - AUTO + port_FSB2_Internal2_network: + - Internal2_net + port_FSB2_Internal1_replacement_policy: + - AUTO + compute_fsb_availability_zone: + - get_input: availability_zone_1 + port_FSB_OAM_fixed_ips: + - ip_address: + get_input: fsb_oam_ip_1 + port_FSB2_Internal1_mac_requirements: + mac_count_required: + is_required: true + service_template_filter: + substitute_service_template: Nested_fsb_1ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: fsb + nfc_naming_code: fsb + requirements: + - link_fsb_FSB2_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_fsb_FSB2_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + oam_security_group: + type: org.openecomp.resource.vfc.rules.nodes.heat.network.neutron.SecurityRules + properties: + name: + str_replace: + template: $VNF_NAME_$SECGROUPNAME + params: + $SECGROUPNAME: + get_input: oam_sec_group_name + $VNF_NAME: + get_input: vnf_name + rules: + - protocol: tcp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: udp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: icmp + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + - protocol: tcp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: udp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: icmp + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + requirements: + - port: + capability: attachment_fsb_FSB_OAM + node: abstract_fsb + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_fsb_FSB_OAM + node: abstract_fsb_1 + relationship: org.openecomp.relationships.AttachesTo + groups: + vmme_gpb3_group: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/vmme_gpb3.yml + description: | + Module HOT template to create vmme 1-8 gpb + members: + - abstract_gpb + - abstract_gpb_1 + - abstract_gpb_2 + - abstract_gpb_3 + - abstract_gpb_4 + - abstract_gpb_5 + - abstract_gpb_6 + - abstract_gpb_7 + base_vmme_group: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/base_vmme.yml + description: | + Base HOT template to create vmme 2 fsb 2 ncb + members: + - int2_security_group + - oam_security_group + - gtp_security_group + - Internal2_net + - int1_security_group + - Internal1_net + - abstract_ncb + - abstract_ncb_1 + - abstract_fsb + - abstract_fsb_1 + base_vmme_volume_group: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/base_vmme_volume.yml + description: HOT template for vMME Cinder Volumes + members: + - fsb_volume_0 + - fsb_volume_1 + vmme_gpb1_group: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/vmme_gpb1.yml + description: | + Module HOT template to create vmme 1-8 gpb + members: + - abstract_gpb + - abstract_gpb_1 + - abstract_gpb_2 + - abstract_gpb_3 + - abstract_gpb_4 + - abstract_gpb_5 + - abstract_gpb_6 + - abstract_gpb_7 + vmme_gpb4_group: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/vmme_gpb4.yml + description: | + Module HOT template to create vmme 1-8 gpb + members: + - abstract_gpb + - abstract_gpb_1 + - abstract_gpb_2 + - abstract_gpb_3 + - abstract_gpb_4 + - abstract_gpb_5 + - abstract_gpb_6 + - abstract_gpb_7 + vmme_gpb2_group: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/vmme_gpb2.yml + description: | + Module HOT template to create vmme 1-8 gpb + members: + - abstract_gpb + - abstract_gpb_1 + - abstract_gpb_2 + - abstract_gpb_3 + - abstract_gpb_4 + - abstract_gpb_5 + - abstract_gpb_6 + - abstract_gpb_7 + VM_Affinity_group: + type: tosca.groups.Root + members: + - abstract_ncb + - abstract_ncb_1 + - abstract_vlc + - abstract_fsb + - abstract_fsb_1 + - abstract_gpb + - abstract_gpb_1 + - abstract_gpb_2 + - abstract_gpb_3 + - abstract_gpb_4 + - abstract_gpb_5 + - abstract_gpb_6 + - abstract_gpb_7 + vmme_vlc_group: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/vmme_vlc.yml + description: | + Module HOT template to create vmme 8 vlcs + members: + - abstract_vlc + outputs: + oam_management_v4_address: + description: ID of OAM VIP to be provisioned in A&AI + value: + get_input: vip_oam_management_v4_ip + fsb_volume_id_1: + description: ID of Cinder Volume for FSB2 + value: fsb_volume_1 + security_group_sctp_b_id: + description: ID of sctpb_security_group + value: UNSUPPORTED_RESOURCE_sctpb_security_group + service_instance_id_0: + description: ID of Service Instance used for vLCs + value: UNSUPPORTED_RESOURCE_template_ServiceInstance_VLC + security_group_sctp_a_id: + description: ID of sctpa_security_group + value: UNSUPPORTED_RESOURCE_sctpa_security_group + fsb_volume_id_0: + description: ID of Cinder Volume for FSB1 + value: fsb_volume_0 + policies: + VM_Affinity_policy: + type: org.openecomp.policies.placement.Antilocate + properties: + container_type: host + targets: + - VM_Affinity_group @@ -0,0 +1,3585 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +metadata: + template_name: Main +imports: +- openecomp_heat_index: + file: openecomp-heat/_index.yml +- GlobalSubstitutionTypes: + file: GlobalSubstitutionTypesServiceTemplate.yaml +topology_template: + inputs: + vlc4_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc4_Internal2 + default: 00:80:37:0E:04:12 + sctp-a-egress_rule_application: + hidden: false + immutable: false + type: string + description: application for the SecurityGroup + default: any + sctp-b-ipv6-ingress-src_start_port: + hidden: false + immutable: false + type: float + description: IPV6 start port + default: 0 + constraints: + - in_range: + - 0 + - 65535 + ncb1_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to ncb1_Internal2 + default: 00:80:37:0E:09:12 + sctp-a-ipv6-ingress_ethertype: + hidden: false + immutable: false + type: string + description: IPV6 ethertype + default: IPv4 + gpb8_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb8_Internal1 + default: 00:80:37:0E:10:22 + sctp-a-ingress_rule_protocol: + hidden: false + immutable: false + type: string + description: protocol for the SecurityGroup + default: any + sctp-b-display_name: + hidden: false + immutable: false + type: string + description: display_name for the SecurityGroup + default: epc-sctp-b-ipv4v6-sec-group + sctp-a-ingress_ethertype: + hidden: false + immutable: false + type: string + description: ethertype for the SecurityGroup + default: IPv4 + sctp-a-egress-src_start_port: + hidden: false + immutable: false + type: float + description: start_port for the SecurityGroup + default: 0 + constraints: + - in_range: + - 0 + - 65535 + ncb_flavor_name: + hidden: false + immutable: false + type: string + description: Flavor to use for servers ncb + default: nv.c8r32d1 + vlc3_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc3_Internal1 + default: 00:80:37:0E:03:12 + Internal2_net_cidr: + hidden: false + immutable: false + type: string + description: CIDR for internal-2 network + default: 169.255.0.0 + sctp-a-egress-dst_start_port: + hidden: false + immutable: false + type: float + description: start_port for the SecurityGroup + default: 0 + constraints: + - in_range: + - 0 + - 65535 + sctp-a-egress_ethertype: + hidden: false + immutable: false + type: string + description: ethertype for the SecurityGroup + default: IPv4 + gpb4_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb4_Internal2 + default: 00:80:37:0E:0C:22 + sctp-b-ipv6-egress_rule_application: + hidden: false + immutable: false + type: string + description: IPV6 Rule-application + default: any + vlc8_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc8_Internal1 + default: 00:80:37:0E:08:12 + sctp-b-ipv6-ingress-src_end_port: + hidden: false + immutable: false + type: float + description: IPV6 ending port for destination + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + fsb2_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to fsb2_Internal1 + default: 00:80:37:0E:0D:12 + sctp-b-name: + hidden: false + immutable: false + type: string + description: name for the SecurityGroup + default: epc-sctp-b-ipv4v6-sec-group + sctp-b-ipv6-egress_ethertype: + hidden: false + immutable: false + type: string + description: IPV6 ethertype + default: IPv4 + internal_net_id_1: + hidden: false + immutable: false + type: string + description: UUID of Internal2_net + default: e3397c69-a942-49aa-81cb-fb91ff34abc8 + sctp-a-egress_dst_subnet_prefix: + hidden: false + immutable: false + type: string + description: ip_prefix for the SecurityGroup + default: 0.0.0.0 + internal_net_id_0: + hidden: false + immutable: false + type: string + description: UUID of Internal1_net + default: 871de971-22ac-47b6-befb-50e7d4cb67ea + sctp_b_net_fqdn: + hidden: false + immutable: false + type: string + description: Network FQDN SCTPB + default: default-domain:vMME-24474-Ericsson-WTC-Lab-vLCP1-4:vMME-24474-Ericsson-WTC-Lab-vLCP1-4_gn_SCTPB_net_1 + sctp-a-ipv6-ingress_rule_application: + hidden: false + immutable: false + type: string + description: IPV6 Rule-application + default: any + sctp-b-ipv6-ingress_src_subnet_prefix_len: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix length + default: '0' + ncb_name_1: + hidden: false + immutable: false + type: string + description: Name of ncb2 + default: zrdm3mmex59ncb002 + ncb_name_0: + hidden: false + immutable: false + type: string + description: Name of ncb1 + default: zrdm3mmex59ncb001 + vlc_st_virtualization_type: + hidden: false + immutable: false + type: string + description: Indicates virtualization type + default: virtual-machine + vlc2_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc2_Internal1 + default: 00:80:37:0E:02:12 + sctp-b-ingress-dst_start_port: + hidden: false + immutable: false + type: float + description: start_port for the SecurityGroup + default: 0 + constraints: + - in_range: + - 0 + - 65535 + sctp-a-display_name: + hidden: false + immutable: false + type: string + description: display_name for the SecurityGroup + default: epc-sctp-a-ipv4v6-sec-group + sctp-b-ingress_rule_application: + hidden: false + immutable: false + type: string + description: application for the SecurityGroup + default: any + int2_sec_group_name: + hidden: false + immutable: false + type: string + description: SecurityGroup name for internal-2 + default: int2-sec-group + gpb5_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb5_Internal2 + default: 00:80:37:0E:0D:22 + sctp-a-egress-dst_subnet_prefix_v6: + hidden: false + immutable: false + type: string + description: dst subnet + default: '::' + OS::stack_name: + type: string + required: false + sctp-b-egress-src_end_port: + hidden: false + immutable: false + type: float + description: end_port for the SecurityGroup + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + Internal2_shared: + hidden: false + immutable: false + type: string + description: Whether Shared or private internal-2 network + default: false + sctp-a-ipv6-egress_rule_protocol: + hidden: false + immutable: false + type: string + description: IPV6 Rule-protocol + default: any + Internal2_rpf: + hidden: false + immutable: false + type: string + description: Reverse Path Forwarding Enabled/Disabled internal-2 network + default: disable + vlc5_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc5_Internal2 + default: 00:80:37:0E:05:12 + sctp-a-ipv6-egress_src_end_port: + hidden: false + immutable: false + type: string + description: IPV6 end port + default: 65535 + Internal1_forwarding_mode: + hidden: false + immutable: false + type: string + description: L2 or L3 forwarding mode for internal-1 network + default: l2 + gpb3_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb3_Internal1 + default: 00:80:37:0E:0B:22 + vip_oam_management_v4_ip: + hidden: false + immutable: false + type: string + description: IP address of OAM service IP address to be provisioned in A&AI + default: 107.239.72.176 + vmi_oam_preference_primary: + hidden: false + immutable: false + type: float + description: Preference for primary interface/port + default: 200 + sctp-b-src_subnet_prefix_v6: + hidden: false + immutable: false + type: string + description: ip_prefix for the SecurityGroup + default: '::' + sctp-a-egress_dst_subnet_prefix_len: + hidden: false + immutable: false + type: float + description: ip_prefix_len for the SecurityGroup + default: '0' + constraints: + - in_range: + - 0 + - 32 + security_group_sctp_b_id: + hidden: false + immutable: false + type: string + description: Security Group UUID for output + default: 92a4ae54-1733-4d03-b488-f178bb9f7b82 + Internal2_forwarding_mode: + hidden: false + immutable: false + type: string + description: L2 or L3 forwarding mode for internal-2 network + default: l2 + sctp-a-ipv6-egress_dst_end_port: + hidden: false + immutable: false + type: string + description: IPV6 end port + default: 65535 + sctp-b-egress-dst_subnet_prefix_v6: + hidden: false + immutable: false + type: string + description: dst subnet + default: '::' + sctp-b-egress_dst_subnet_prefix: + hidden: false + immutable: false + type: string + description: ip_prefix for the SecurityGroup + default: 0.0.0.0 + security_group_oam_id: + hidden: false + immutable: false + type: string + description: Security Group UUID for output + default: 4ae4aa74-3e8e-4f2b-8b5f-a8bd262da96b + gpb2_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb2_Internal1 + default: 00:80:37:0E:0A:22 + security_group_int1_id: + hidden: false + immutable: false + type: string + description: UUID of Internal1_net security group + default: 94c62578-835d-4801-9372-70a2cfb22683 + sctp-a-egress_action: + hidden: false + immutable: false + type: string + description: simple_action for the SecurityGroup + default: pass + oam_net_fqdn: + hidden: false + immutable: false + type: string + description: Network FQDN OAM + default: default-domain:vMME-24474-Ericsson-WTC-Lab-vLCP1-4:vMME-24474-Ericsson-WTC-Lab-vLCP1-4_OAM_net_1 + ncb2_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to ncb2_Internal2 + default: 00:80:37:0E:0F:12 + vlc_st_interface_type_sctp_a: + hidden: false + immutable: false + type: string + description: service_interface_type for the ServiceTemplate + default: left + gpb3_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb3_Internal2 + default: 00:80:37:0E:0B:22 + vlc_st_interface_type_sctp_b: + hidden: false + immutable: false + type: string + description: service_interface_type for the ServiceTemplate + default: right + gpb1_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb1_Internal2 + default: 00:80:37:0E:09:22 + oam_net_name: + hidden: false + immutable: false + type: string + description: Network Name OAM + default: vMME-24474-Ericsson-WTC-Lab-vLCP1-4_OAM_net_1 + sctp-b-ingress-src_start_port: + hidden: false + immutable: false + type: float + description: start_port for the SecurityGroup + default: 0 + constraints: + - in_range: + - 0 + - 65535 + fsb1_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to fsb1_Internal1 + default: 00:80:37:0E:0B:12 + sctp-b-ingress_dst_addresses: + hidden: false + immutable: false + type: string + description: security_group for the SecurityGroup + default: local + vlc_st_interface_type_oam: + hidden: false + immutable: false + type: string + description: service_interface_type for the ServiceTemplate + default: management + shc_monitor_type: + hidden: false + immutable: false + type: string + description: health check + default: PING + oam_sec_group_name: + hidden: false + immutable: false + type: string + description: SecurityGroup name for OAM + default: oam-sec-group + Internal2_net_gateway: + hidden: false + immutable: false + type: string + description: gateway for internal-2 network + default: 169.255.0.3 + evac_policy: + hidden: false + immutable: false + type: string + description: CMHA Policy + default: Evacuate + server_group_id_0: + hidden: false + immutable: false + type: string + description: ID of Anti-Affinity Policy-based Server Group + default: ec99a73d-38f8-4280-8103-ba8ee584629f + vlc8_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc8_Internal2 + default: 00:80:37:0E:08:12 + sctp-b-ipv6-egress_rule_protocol: + hidden: false + immutable: false + type: string + description: IPV6 Rule-protocol + default: any + gtp_sec_group_name: + hidden: false + immutable: false + type: string + description: SecurityGroup name for GTP + default: gtp-sec-group + vlc_sctp_b_v6_ip_2: + hidden: false + immutable: false + type: string + description: Static IP vlc3 SCTPB + default: fd00:200:200:5:0:0:0:24 + vlc_sctp_b_v6_ip_1: + hidden: false + immutable: false + type: string + description: Static IP vlc2 SCTPB + default: fd00:200:200:5:0:0:0:17 + sctp-a-ipv6-egress_dst_subnet_prefix: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix + default: 0.0.0.0 + vlc_sctp_b_v6_ip_0: + hidden: false + immutable: false + type: string + description: Static IP vlc1 SCTPB + default: fd00:200:200:5:0:0:0:16 + vlc4_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc4_Internal1 + default: 00:80:37:0E:04:12 + vlc_sctp_b_v6_ip_6: + hidden: false + immutable: false + type: string + description: Static IP vlc7 SCTPB + default: fd00:200:200:5:0:0:0:28 + vlc_sctp_b_v6_ip_5: + hidden: false + immutable: false + type: string + description: Static IP vlc6 SCTPB + default: fd00:200:200:5:0:0:0:27 + vlc_sctp_b_v6_ip_4: + hidden: false + immutable: false + type: string + description: Static IP vlc5 SCTPB + default: fd00:200:200:5:0:0:0:26 + vlc_sctp_b_v6_ip_3: + hidden: false + immutable: false + type: string + description: Static IP vlc4 SCTPB + default: fd00:200:200:5:0:0:0:25 + sctp_b_net_name: + hidden: false + immutable: false + type: string + description: Network Name SCTPB + default: vMME-24474-Ericsson-WTC-Lab-vLCP1-4_gn_SCTPB_net_1 + sctp-b-ipv6-egress_dst_subnet_prefix_len: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix + default: '0' + sctp-a-egress_rule_protocol: + hidden: false + immutable: false + type: string + description: protocol for the SecurityGroup + default: any + Internal1_shared: + hidden: false + immutable: false + type: string + description: Whether Shared or private internal-1 network + default: false + shc_url_path: + hidden: false + immutable: false + type: string + description: health check + default: local-ip + Internal2_net_cidr_len: + hidden: false + immutable: false + type: string + description: CIDR length for internal-2 network + default: 17 + sctp-a-ingress-src_end_port: + hidden: false + immutable: false + type: float + description: end_port for the SecurityGroup + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + sctp-b-ipv6-ingress_src_subnet_prefix: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix + default: 0.0.0.0 + sctp-a-egress-dst_end_port: + hidden: false + immutable: false + type: float + description: end_port for the SecurityGroup + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + sctp-a-ingress_action: + hidden: false + immutable: false + type: string + description: simple_action for the SecurityGroup + default: pass + sctp-b-ipv6-ingress_action: + hidden: false + immutable: false + type: string + description: IPV6 action + default: pass + vlc_st_service_type: + hidden: false + immutable: false + type: string + description: service type + default: firewall + sctp-b-ipv6-ingress-dst_start_port: + hidden: false + immutable: false + type: string + description: IPV6 starting port for destination + default: 0 + vlc_st_availability_zone: + hidden: false + immutable: false + type: string + description: Indicates availability zone is enabled + default: true + vlc7_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc7_Internal1 + default: 00:80:37:0E:07:12 + fsb_volume_image_name_1: + label: MME_FSB2 + hidden: false + immutable: false + type: string + description: volume name + default: MME_FSB2_1_3_GA.qcow2 + vlc_oam_ip_6: + hidden: false + immutable: false + type: string + description: Static IP vlc7 OAM + default: 107.239.72.151 + sctp-a-ipv6-ingress_src_subnet_prefix_len: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix length + default: '0' + vlc_oam_ip_7: + hidden: false + immutable: false + type: string + description: Static IP vlc8 OAM + default: 107.239.72.152 + Internal1_allow_transit: + hidden: false + immutable: false + type: string + description: Allow/disallow transit internal-1 network + default: true + vlc_oam_ip_2: + hidden: false + immutable: false + type: string + description: Static IP vlc3 OAM + default: 107.239.72.157 + vlc_oam_ip_3: + hidden: false + immutable: false + type: string + description: Static IP vlc4 OAM + default: 107.239.72.158 + vlc_gtp_ip_0: + hidden: false + immutable: false + type: string + description: Static IP vlc1 GTP + default: 107.243.47.208 + vlc_oam_ip_4: + hidden: false + immutable: false + type: string + description: Static IP vlc5 OAM + default: 107.239.72.149 + fsb_volume_image_name_0: + label: MME_FSB1 + hidden: false + immutable: false + type: string + description: volume name + default: MME_FSB1_1_3_GA.qcow2 + vlc_gtp_ip_1: + hidden: false + immutable: false + type: string + description: Static IP vlc2 GTP + default: 107.243.47.209 + vlc_oam_ip_5: + hidden: false + immutable: false + type: string + description: Static IP vlc6 OAM + default: 107.239.72.150 + vlc_gtp_ip_2: + hidden: false + immutable: false + type: string + description: Static IP vlc3 GTP + default: 107.243.47.216 + vlc_name_6: + hidden: false + immutable: false + type: string + description: Name of vlc7 + default: zrdm3mmex59vlc007 + vlc_gtp_ip_3: + hidden: false + immutable: false + type: string + description: Static IP vlc4 GTP + default: 107.243.47.217 + vlc_name_7: + hidden: false + immutable: false + type: string + description: Name of vlc8 + default: zrdm3mmex59vlc008 + security_group_sctp_a_id: + hidden: false + immutable: false + type: string + description: Security Group UUID for output + default: 3cd8a524-77ff-4980-ae2a-d19ba70e0511 + vlc_gtp_ip_4: + hidden: false + immutable: false + type: string + description: Static IP vlc5 GTP + default: 107.243.47.218 + vlc_gtp_ip_5: + hidden: false + immutable: false + type: string + description: Static IP vlc6 GTP + default: 107.243.47.219 + vlc_gtp_ip_6: + hidden: false + immutable: false + type: string + description: Static IP vlc7 GTP + default: 107.243.47.220 + vlc_name_2: + hidden: false + immutable: false + type: string + description: Name of vlc3 + default: zrdm3mmex59vlc003 + vlc_gtp_ip_7: + hidden: false + immutable: false + type: string + description: Static IP vlc8 GTP + default: 107.243.47.221 + vlc_name_3: + hidden: false + immutable: false + type: string + description: Name of vlc4 + default: zrdm3mmex59vlc004 + vlc_name_4: + hidden: false + immutable: false + type: string + description: Name of vlc5 + default: zrdm3mmex59vlc005 + vlc_name_5: + hidden: false + immutable: false + type: string + description: Name of vlc6 + default: zrdm3mmex59vlc006 + fsb_volume_id_1: + hidden: false + immutable: false + type: string + description: ID of Cinder Volume for FSB2 + default: 5bd0560c-bfd0-47dc-a84a-554e2698c925 + sctp-a-ipv6-ingress_action: + hidden: false + immutable: false + type: string + description: IPV6 action + default: pass + vlc_name_0: + hidden: false + immutable: false + type: string + description: Name of vlc1 + default: zrdm3mmex59vlc001 + vlc_name_1: + hidden: false + immutable: false + type: string + description: Name of vlc2 + default: zrdm3mmex59vlc002 + vlc_oam_route_prefixes: + hidden: false + immutable: false + type: json + description: Route prefixes for static routing on OAM + sctp-b-egress_rule_application: + hidden: false + immutable: false + type: string + description: application for the SecurityGroup + default: any + vlc_oam_ip_0: + hidden: false + immutable: false + type: string + description: Static IP vlc1 OAM + default: 107.239.72.155 + vlc_oam_ip_1: + hidden: false + immutable: false + type: string + description: Static IP vlc2 OAM + default: 107.239.72.156 + vlc6_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc6_Internal1 + default: 00:80:37:0E:06:12 + fsb_volume_id_0: + hidden: false + immutable: false + type: string + description: ID of Cinder Volume for FSB1 + default: 27baa6a0-b701-4795-bf5e-4f546b350b1f + sctp-b-egress-dst_end_port: + hidden: false + immutable: false + type: float + description: end_port for the SecurityGroup + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + gpb2_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb2_Internal2 + default: 00:80:37:0E:0A:22 + sctp-a-ipv6-egress_rule_application: + hidden: false + immutable: false + type: string + description: IPV6 Rule-application + default: any + sctp-b-ipv6-egress_src_start_port: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix + default: 0 + Internal2_allow_transit: + hidden: false + immutable: false + type: string + description: Allow/disallow transit internal-2 network + default: true + fsb_volume_size: + label: volume size + hidden: false + immutable: false + type: float + description: volume size 320GB + default: 320 + constraints: + - in_range: + - 0 + - 340 + sctp-b-IPv6_ethertype: + hidden: false + immutable: false + type: string + description: IPV6 ethertype + default: IPv6 + gtp_net_fqdn: + hidden: false + immutable: false + type: string + description: Network FQDN GTP + default: default-domain:vMME-24474-Ericsson-WTC-Lab-vLCP1-4:vMME-24474-Ericsson-WTC-Lab-vLCP1-4_gn_GTP_net_1 + ncb2_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to ncb2_Internal1 + default: 00:80:37:0E:0F:12 + sctp-b-ingress_rule_protocol: + hidden: false + immutable: false + type: string + description: protocol for the SecurityGroup + default: any + sctp-b-ingress_action: + hidden: false + immutable: false + type: string + description: simple_action for the SecurityGroup + default: pass + sctp-b-egress_src_addresses: + hidden: false + immutable: false + type: string + description: security_group for the SecurityGroup + default: local + gpb7_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb7_Internal2 + default: 00:80:37:0E:0F:22 + sctp-a-ipv6-ingress-dst_start_port: + hidden: false + immutable: false + type: string + description: IPV6 starting port for destination + default: 0 + gtp_net_name: + hidden: false + immutable: false + type: string + description: Network Name GTP + default: vMME-24474-Ericsson-WTC-Lab-vLCP1-4_gn_GTP_net_1 + sctp-b-ipv6-ingress_rule_application: + hidden: false + immutable: false + type: string + description: IPV6 Rule-application + default: any + domain_name: + hidden: false + immutable: false + type: string + description: Unique name of vMME contrail domain + default: default-domain + vlc5_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc5_Internal1 + default: 00:80:37:0E:05:12 + sctp-a-egress_src_addresses: + hidden: false + immutable: false + type: string + description: security_group for the SecurityGroup + default: local + sctp-b-egress-src_start_port: + hidden: false + immutable: false + type: float + description: start_port for the SecurityGroup + default: 0 + constraints: + - in_range: + - 0 + - 65535 + shc_enabled: + hidden: false + immutable: false + type: string + description: health check + default: true + sctp-b-ipv6-ingress-dst_end_port: + hidden: false + immutable: false + type: string + description: IPV6 end port + default: 65535 + sctp-b-dst_subnet_prefix_v6: + hidden: false + immutable: false + type: string + description: ip_prefix for the SecurityGroup + default: '::' + sctp_a_net_fqdn: + hidden: false + immutable: false + type: string + description: Network FQDN SCTPA + default: default-domain:vMME-24474-Ericsson-WTC-Lab-vLCP1-4:vMME-24474-Ericsson-WTC-Lab-vLCP1-4_gn_SCTPA_net_1 + security_group_gtp_id: + hidden: false + immutable: false + type: string + description: Security Group UUID for output + default: e8ad3fe2-5f95-43e4-bbcc-da97b1c22588 + sctp-a-ipv6-ingress_src_subnet_prefix: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix + default: 0.0.0.0 + fsb_name_1: + hidden: false + immutable: false + type: string + description: Name of fsb1 + default: zrdm3mmex59fsb002 + sctp-b-egress-dst_start_port: + hidden: false + immutable: false + type: float + description: start_port for the SecurityGroup + default: 0 + constraints: + - in_range: + - 0 + - 65535 + fsb_name_0: + hidden: false + immutable: false + type: string + description: Name of fsb1 + default: zrdm3mmex59fsb001 + sctp_a_net_name: + hidden: false + immutable: false + type: string + description: Network Name SCTPA + default: vMME-24474-Ericsson-WTC-Lab-vLCP1-4_gn_SCTPA_net_1 + sctp-b-egress_dst_subnet_prefix_len: + hidden: false + immutable: false + type: float + description: ip_prefix_len for the SecurityGroup + default: '0' + constraints: + - in_range: + - 0 + - 32 + gpb1_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb1_Internal1 + default: 00:80:37:0E:09:22 + sctp-a-ingress-dst_start_port: + hidden: false + immutable: false + type: float + description: start_port for the SecurityGroup + default: 0 + constraints: + - in_range: + - 0 + - 65535 + fsb1_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to fsb1_Internal2 + default: 00:80:37:0E:0B:12 + vlc_st_service_mode: + hidden: false + immutable: false + type: string + description: service mode + default: in-network-nat + sctp-a-ipv6-egress_ethertype: + hidden: false + immutable: false + type: string + description: IPV6 ethertype + default: IPv4 + sctp-a-egress-src_end_port: + hidden: false + immutable: false + type: float + description: end_port for the SecurityGroup + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + sctp-b-egress_action: + hidden: false + immutable: false + type: string + description: simple_action for the SecurityGroup + default: pass + sctp-a-ingress-src_subnet_prefix_len: + hidden: false + immutable: false + type: float + description: ip_prefix_len for the SecurityGroup + default: '0' + constraints: + - in_range: + - 0 + - 32 + sctp-a-ipv6-ingress-src_start_port: + hidden: false + immutable: false + type: float + description: IPV6 start port + default: 0 + constraints: + - in_range: + - 0 + - 65535 + vf_module_id: + hidden: false + immutable: false + type: string + description: the vf_module_id for this instance. UUID provided by ECOMP + default: TWO + Internal1_net_cidr: + hidden: false + immutable: false + type: string + description: CIDR for internal-1 network + default: 169.253.0.0 + fsb_flavor_name: + hidden: false + immutable: false + type: string + description: Flavor to use for servers fsb1 + default: nv.c8r32d1 + sctp_rule_protocol: + hidden: false + immutable: false + type: string + description: protocol for the SecurityGroup + default: 132 + vnf_name: + hidden: false + immutable: false + type: string + description: the vnf_name for this instance. provided by ECOMP + default: zrdm3mmex59 + sctp-a-IPv6_ethertype: + hidden: false + immutable: false + type: string + description: IPV6 ethertype + default: IPv6 + vlc_sctp_b_v6_ip_7: + hidden: false + immutable: false + type: string + description: Static IP vlc8 SCTPB + default: fd00:200:200:5:0:0:0:29 + vlc6_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc6_Internal2 + default: 00:80:37:0E:06:12 + sctp-b-ingress-dst_end_port: + hidden: false + immutable: false + type: float + description: end_port for the SecurityGroup + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + vlc7_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc7_Internal2 + default: 00:80:37:0E:07:12 + sctp-a-ipv6-ingress-src_end_port: + hidden: false + immutable: false + type: float + description: IPV6 ending port for destination + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + vlc_flavor_name: + hidden: false + immutable: false + type: string + description: Flavor to use for servers vlc + default: nd.c16r64d1 + sctp-b-ipv6-egress_src_addresses: + hidden: false + immutable: false + type: string + description: IPV6 source + default: local + vlc_st_interface_type_int1: + hidden: false + immutable: false + type: string + description: service_interface_type for the ServiceTemplate + default: other1 + availability_zone_0: + hidden: false + immutable: false + type: string + description: cluster for spawnning fsb instances + default: rdm3-kvm-az02 + service_instance_id_0: + hidden: false + immutable: false + type: string + description: UUID of service instance for vLCs + default: 77c67cc8-d15f-47bc-aeb1-8d65d09e917a + availability_zone_1: + hidden: false + immutable: false + type: string + description: cluster for spawnning ncb instances + default: rdm3-kvm-az02 + vlc_st_interface_type_int2: + hidden: false + immutable: false + type: string + description: service_interface_type for the ServiceTemplate + default: other2 + sctp-a-ipv6-egress-dst_start_port: + hidden: false + immutable: false + type: string + description: IPV6 start port + default: 0 + sctp-a-ipv6-egress_dst_subnet_prefix_len: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix + default: '0' + vlc_sctp_a_ip_0: + hidden: false + immutable: false + type: string + description: Static IP vlc1 SCTPA + default: 107.243.47.144 + vlc_sctp_b_route_prefixes: + hidden: false + immutable: false + type: json + description: Route prefixes for static routing on SCTPB + vlc1_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc1_Internal1 + default: 00:80:37:0E:01:12 + sctp-b-ipv6-egress_src_end_port: + hidden: false + immutable: false + type: string + description: IPV6 end port + default: 65535 + sctp-a-ipv6-egress_src_addresses: + hidden: false + immutable: false + type: string + description: IPV6 source + default: local + vlc_sctp_a_ip_7: + hidden: false + immutable: false + type: string + description: Static IP vlc8 SCTPA + default: 107.243.47.157 + sctp-a-ingress-src_subnet_prefix_v6: + hidden: false + immutable: false + type: string + description: src subnet + default: '::' + vlc_sctp_a_ip_6: + hidden: false + immutable: false + type: string + description: Static IP vlc7 SCTPA + default: 107.243.47.156 + vlc_sctp_a_ip_5: + hidden: false + immutable: false + type: string + description: Static IP vlc6 SCTPA + default: 107.243.47.155 + sctp-a-ingress-dst_end_port: + hidden: false + immutable: false + type: float + description: end_port for the SecurityGroup + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + vlc_sctp_a_ip_4: + hidden: false + immutable: false + type: string + description: Static IP vlc5 SCTPA + default: 107.243.47.154 + vlc_sctp_a_ip_3: + hidden: false + immutable: false + type: string + description: Static IP vlc4 SCTPA + default: 107.243.47.153 + vlc_sctp_a_ip_2: + hidden: false + immutable: false + type: string + description: Static IP vlc3 SCTPA + default: 107.243.47.152 + vlc_sctp_a_ip_1: + hidden: false + immutable: false + type: string + description: Static IP vlc2 SCTPA + default: 107.243.47.145 + gpb6_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb6_Internal2 + default: 00:80:37:0E:0E:22 + security_group_int2_id: + hidden: false + immutable: false + type: string + description: UUID of Internal1_net security group + default: 1361f069-baf2-4b76-b321-7f68ba26c369 + Internal2_dhcp: + hidden: false + immutable: false + type: string + description: Whether DHCP/static IP addressing on internal-2 network + default: false + sctp-a-dst_subnet_prefix_v6: + hidden: false + immutable: false + type: string + description: ip_prefix for the SecurityGroup + default: '::' + pxe_image_name: + hidden: false + immutable: false + type: string + description: Name of image to use for server ncb + default: MME_PXE-Boot_1_3_GA.qcow2 + vlc_st_interface_type_gtp: + hidden: false + immutable: false + type: string + description: service_interface_type for the ServiceTemplate + default: other0 + ncb1_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to ncb1_Internal1 + default: 00:80:37:0E:09:12 + vlc_gtp_route_prefixes: + hidden: false + immutable: false + type: json + description: Route prefixes for static routing on GTP + int1_sec_group_name: + hidden: false + immutable: false + type: string + description: SecurityGroup name for internal-1 + default: int1-sec-group + vmi_oam_preference_secondary: + hidden: false + immutable: false + type: float + description: Preference for secondary interface/port + default: 100 + Internal1_dhcp: + hidden: false + immutable: false + type: string + description: Whether DHCP/static IP addressing on internal-1 network + default: false + fsb2_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to fsb2_Internal2 + default: 00:80:37:0E:0D:12 + Internal1_net_cidr_len: + hidden: false + immutable: false + type: string + description: CIDR length for internal-1 network + default: 17 + sctp-a-ingress_dst_addresses: + hidden: false + immutable: false + type: string + description: security_group for the SecurityGroup + default: local + sctp-b-ingress-src_subnet_prefix_len: + hidden: false + immutable: false + type: float + description: ip_prefix_len for the SecurityGroup + default: '0' + constraints: + - in_range: + - 0 + - 32 + fsb_oam_ip_1: + hidden: false + immutable: false + type: string + description: IP address of OAM vNIC for FSB2 + default: 107.239.72.154 + fsb_oam_ip_0: + hidden: false + immutable: false + type: string + description: IP address of OAM vNIC for FSB1 + default: 107.239.72.153 + shc_timeout: + hidden: false + immutable: false + type: string + description: health check + default: 5 + vlc_st_version: + hidden: false + immutable: false + type: string + description: Indicates service version + default: 2 + sctp-a-src_subnet_prefix_v6: + hidden: false + immutable: false + type: string + description: ip_prefix for the SecurityGroup + default: '::' + sctp-a-ingress_rule_application: + hidden: false + immutable: false + type: string + description: application for the SecurityGroup + default: any + sctp-b-egress_ethertype: + hidden: false + immutable: false + type: string + description: ethertype for the SecurityGroup + default: IPv4 + sctp-a-ipv6-egress_src_start_port: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix + default: 0 + instance_ip_family_v6: + hidden: false + immutable: false + type: string + description: Ipv6 instance type + default: v6 + sctp-b-ingress-src_subnet_prefix_v6: + hidden: false + immutable: false + type: string + description: src subnet + default: '::' + gpb8_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb8_Internal2 + default: 00:80:37:0E:10:22 + gpb4_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb4_Internal1 + default: 00:80:37:0E:0C:22 + sctp-a-ipv6-ingress-dst_end_port: + hidden: false + immutable: false + type: string + description: IPV6 end port + default: 65535 + Internal1_net_gateway: + hidden: false + immutable: false + type: string + description: gateway for internal-1 network + default: 169.253.0.3 + sctp-b-ipv6-egress-dst_start_port: + hidden: false + immutable: false + type: string + description: IPV6 start port + default: 0 + gpb_name_7: + hidden: false + immutable: false + type: string + description: Name of gpb8 + default: zrdm3mmex59gpb0016 + gpb_name_6: + hidden: false + immutable: false + type: string + description: Name of gpb7 + default: zrdm3mmex59gpb0015 + gpb_name_5: + hidden: false + immutable: false + type: string + description: Name of gpb6 + default: zrdm3mmex59gpb0014 + gpb_name_4: + hidden: false + immutable: false + type: string + description: Name of gpb5 + default: zrdm3mmex59gpb0013 + gpb_name_3: + hidden: false + immutable: false + type: string + description: Name of gpb4 + default: zrdm3mmex59gpb0012 + sctp-a-ipv6-ingress_dst_addresses: + hidden: false + immutable: false + type: string + description: IPV6 destination + default: local + gpb_name_2: + hidden: false + immutable: false + type: string + description: Name of gpb3 + default: zrdm3mmex59gpb0011 + shc_delay: + hidden: false + immutable: false + type: string + description: health check + default: 3 + gpb_name_1: + hidden: false + immutable: false + type: string + description: Name of gpb2 + default: zrdm3mmex59gpb0010 + sctp-b-ipv6-egress_action: + hidden: false + immutable: false + type: string + description: IPV6 action + default: pass + vlc3_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc3_Internal2 + default: 00:80:37:0E:03:12 + gpb_name_0: + hidden: false + immutable: false + type: string + description: Name of gpb1 + default: zrdm3mmex59gpb009 + sctp-a-ipv6-egress_action: + hidden: false + immutable: false + type: string + description: IPV6 action + default: pass + gpb5_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb5_Internal1 + default: 00:80:37:0E:0D:22 + sctp-b-ipv6-ingress_rule_protocol: + hidden: false + immutable: false + type: string + description: IPV6 Rule-protocol + default: any + shc_max_retries: + hidden: false + immutable: false + type: string + description: health check + default: 2 + fsb_volume_type: + label: volume type + hidden: false + immutable: false + type: string + description: volume type SolidFire + default: SF-Default-SSD + sctp-a-name: + hidden: false + immutable: false + type: string + description: name for the SecurityGroup + default: epc-sctp-a-ipv4v6-sec-group + vlc_sctp_b_ip_5: + hidden: false + immutable: false + type: string + description: Static IP vlc6 SCTPB + default: 107.243.47.187 + vlc_sctp_b_ip_4: + hidden: false + immutable: false + type: string + description: Static IP vlc5 SCTPB + default: 107.243.47.186 + vlc_sctp_b_ip_3: + hidden: false + immutable: false + type: string + description: Static IP vlc4 SCTPB + default: 107.243.47.185 + vlc_sctp_b_ip_2: + hidden: false + immutable: false + type: string + description: Static IP vlc3 SCTPB + default: 107.243.47.184 + sctp-b-egress_rule_protocol: + hidden: false + immutable: false + type: string + description: protocol for the SecurityGroup + default: any + vnf_id: + hidden: false + immutable: false + type: string + description: the vf_id for this instance. UUID provided by ECOMP + default: zrdm3mmex59 + vlc_sctp_b_ip_7: + hidden: false + immutable: false + type: string + description: Static IP vlc8 SCTPB + default: 107.243.47.189 + vlc_sctp_b_ip_6: + hidden: false + immutable: false + type: string + description: Static IP vlc7 SCTPB + default: 107.243.47.188 + vlc_sctp_b_ip_1: + hidden: false + immutable: false + type: string + description: Static IP vlc2 SCTPB + default: 107.243.47.177 + gpb6_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb6_Internal1 + default: 00:80:37:0E:0E:22 + sctp-b-ipv6-egress_dst_end_port: + hidden: false + immutable: false + type: string + description: IPV6 end port + default: 65535 + vlc_sctp_b_ip_0: + hidden: false + immutable: false + type: string + description: Static IP vlc1 SCTPB + default: 107.243.47.176 + vlc2_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc2_Internal2 + default: 00:80:37:0E:02:12 + sctp-b-ingress-src_subnet_prefix: + hidden: false + immutable: false + type: string + description: ip_prefix for the SecurityGroup + default: 0.0.0.0 + gpb_flavor_name: + hidden: false + immutable: false + type: string + description: Flavor to use for servers gpb + default: nv.c20r64d1 + vlc_sctp_a_route_prefixes: + hidden: false + immutable: false + type: json + description: Route prefixes for static routing on SCTPA + sctp-b-ipv6-ingress_dst_addresses: + hidden: false + immutable: false + type: string + description: IPV6 destination + default: local + sctp-b-ipv6-ingress_ethertype: + hidden: false + immutable: false + type: string + description: IPV6 ethertype + default: IPv4 + sctp-b-ipv6-egress_dst_subnet_prefix: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix + default: 0.0.0.0 + sctp-a-ingress-src_subnet_prefix: + hidden: false + immutable: false + type: string + description: ip_prefix for the SecurityGroup + default: 0.0.0.0 + vlc1_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc1_Internal2 + default: 00:80:37:0E:01:12 + Internal1_rpf: + hidden: false + immutable: false + type: string + description: Reverse Path Forwarding Enabled/Disabled internal-1 network + default: disable + sctp-b-ingress_ethertype: + hidden: false + immutable: false + type: string + description: ethertype for the SecurityGroup + default: IPv4 + sctp-b-ingress-src_end_port: + hidden: false + immutable: false + type: float + description: end_port for the SecurityGroup + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + sctp-a-ipv6-ingress_rule_protocol: + hidden: false + immutable: false + type: string + description: IPV6 Rule-protocol + default: any + vlc_sctp_a_v6_ip_7: + hidden: false + immutable: false + type: string + description: Static IP vlc8 SCTPA + default: fd00:200:200:4:0:0:0:29 + vlc_sctp_a_v6_ip_6: + hidden: false + immutable: false + type: string + description: Static IP vlc7 SCTPA + default: fd00:200:200:4:0:0:0:28 + gpb7_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb7_Internal1 + default: 00:80:37:0E:0F:22 + vlc_sctp_a_v6_ip_5: + hidden: false + immutable: false + type: string + description: Static IP vlc6 SCTPA + default: fd00:200:200:4:0:0:0:27 + vlc_sctp_a_v6_ip_4: + hidden: false + immutable: false + type: string + description: Static IP vlc5 SCTPA + default: fd00:200:200:4:0:0:0:26 + vlc_sctp_a_v6_ip_3: + hidden: false + immutable: false + type: string + description: Static IP vlc4 SCTPA + default: fd00:200:200:4:0:0:0:25 + vlc_sctp_a_v6_ip_2: + hidden: false + immutable: false + type: string + description: Static IP vlc3 SCTPA + default: fd00:200:200:4:0:0:0:24 + sctp-a-ingress-src_start_port: + hidden: false + immutable: false + type: float + description: start_port for the SecurityGroup + default: 0 + constraints: + - in_range: + - 0 + - 65535 + vlc_sctp_a_v6_ip_1: + hidden: false + immutable: false + type: string + description: Static IP vlc2 SCTPA + default: fd00:200:200:4:0:0:0:17 + vlc_sctp_a_v6_ip_0: + hidden: false + immutable: false + type: string + description: Static IP vlc1 SCTPA + default: fd00:200:200:4:0:0:0:16 + node_templates: + abstract_gpb_1: + type: org.openecomp.resource.abstract.nodes.gpb_1 + directives: + - substitutable + properties: + compute_gpb_name: + - get_input: gpb_name_1 + vm_flavor_name: + get_input: gpb_flavor_name + compute_gpb_scheduler_hints: + - group: + get_input: server_group_id_0 + port_gpb2_Internal1_security_groups: + - - get_input: security_group_int1_id + compute_gpb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + port_gpb2_Internal2_network: + - get_input: internal_net_id_1 + port_gpb2_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + vm_image_name: + get_input: pxe_image_name + port_gpb2_Internal1_replacement_policy: + - AUTO + port_gpb2_Internal1_network: + - get_input: internal_net_id_0 + port_gpb2_Internal2_replacement_policy: + - AUTO + port_gpb2_Internal1_mac_requirements: + mac_count_required: + is_required: true + compute_gpb_availability_zone: + - get_input: availability_zone_1 + port_gpb2_Internal1_mac_address: + get_input: gpb2_Internal1_mac + port_gpb2_Internal2_mac_requirements: + mac_count_required: + is_required: true + port_gpb2_Internal2_mac_address: + get_input: gpb2_Internal1_mac + port_gpb2_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb2_Internal2_security_groups: + - - get_input: security_group_int2_id + service_template_filter: + substitute_service_template: Nested_gpb_1ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: gpb + nfc_naming_code: gpb + requirements: + - link_gpb_gpb2_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_gpb_gpb2_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + abstract_gpb_2: + type: org.openecomp.resource.abstract.nodes.gpb_1 + directives: + - substitutable + properties: + port_gpb3_Internal1_replacement_policy: + - AUTO + compute_gpb_name: + - get_input: gpb_name_2 + port_gpb3_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb3_Internal2_replacement_policy: + - AUTO + vm_flavor_name: + get_input: gpb_flavor_name + port_gpb3_Internal2_security_groups: + - - get_input: security_group_int2_id + compute_gpb_scheduler_hints: + - group: + get_input: server_group_id_0 + compute_gpb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + vm_image_name: + get_input: pxe_image_name + port_gpb3_Internal1_security_groups: + - - get_input: security_group_int1_id + port_gpb3_Internal2_network: + - get_input: internal_net_id_1 + compute_gpb_availability_zone: + - get_input: availability_zone_0 + port_gpb3_Internal1_network: + - get_input: internal_net_id_0 + port_gpb3_Internal1_mac_requirements: + mac_count_required: + is_required: true + port_gpb3_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb3_Internal1_mac_address: + get_input: gpb3_Internal1_mac + port_gpb3_Internal2_mac_address: + get_input: gpb3_Internal1_mac + port_gpb3_Internal2_mac_requirements: + mac_count_required: + is_required: true + service_template_filter: + substitute_service_template: Nested_gpb_2ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: gpb + nfc_naming_code: gpb + requirements: + - link_gpb_gpb3_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_gpb_gpb3_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + abstract_vlc: + type: org.openecomp.resource.abstract.nodes.vlc + directives: + - substitutable + properties: + port_template_VMInt_SCTP_A_vlc_virtual_network_refs: + - - get_input: sctp_a_net_fqdn + port_template_VMInt_INT1_vlc_security_group_refs: + - - get_input: security_group_int1_id + vm_flavor_name: + get_input: vlc_flavor_name + port_template_VMInt_INT2_vlc_port_tuple_refs: + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc4 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc3 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc2 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc1 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc8 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc7 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc6 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc5 + vm_image_name: + get_input: pxe_image_name + port_template_VMInt_INT1_vlc_port_tuple_refs: + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc4 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc3 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc2 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc1 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc8 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc7 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc6 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc5 + port_template_VMInt_INT2_vlc_virtual_network_refs: + - - get_input: internal_net_id_1 + port_template_VMInt_OAM_vlc_virtual_network_refs: + - - get_input: oam_net_fqdn + port_template_VMInt_OAM_vlc_port_tuple_refs: + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc4 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc3 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc2 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc1 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc8 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc7 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc6 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc5 + port_template_VMInt_INT2_vlc_virtual_machine_interface_mac_addresses: + - - get_input: vlc4_Internal2_mac + - - get_input: vlc3_Internal2_mac + - - get_input: vlc2_Internal2_mac + - - get_input: vlc1_Internal2_mac + - - get_input: vlc8_Internal2_mac + - - get_input: vlc7_Internal2_mac + - - get_input: vlc6_Internal2_mac + - - get_input: vlc5_Internal2_mac + port_template_VMInt_SCTP_B_vlc_port_tuple_refs: + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc4 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc3 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc2 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc1 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc8 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc7 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc6 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc5 + port_template_VMInt_GTP_vlc_security_group_refs: + - - get_input: security_group_gtp_id + compute_vlc_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + port_template_VMInt_OAM_vlc_security_group_refs: + - - get_input: security_group_oam_id + compute_vlc_contrail_service_instance_ind: + - true + - true + - true + - true + - true + - true + - true + - true + port_template_VMInt_GTP_vlc_port_tuple_refs: + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc4 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc3 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc2 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc1 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc8 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc7 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc6 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc5 + port_template_VMInt_SCTP_B_vlc_virtual_network_refs: + - - get_input: sctp_b_net_fqdn + port_template_VMInt_INT2_vlc_security_group_refs: + - - get_input: security_group_int2_id + port_template_VMInt_SCTP_B_vlc_security_group_refs: + - - get_input: security_group_sctp_b_id + port_template_VMInt_INT1_vlc_virtual_network_refs: + - - get_input: internal_net_id_0 + port_template_VMInt_SCTP_A_vlc_port_tuple_refs: + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc4 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc3 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc2 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc1 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc8 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc7 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc6 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc5 + compute_vlc_scheduler_hints: + - group: + get_input: server_group_id_0 + - group: + get_input: server_group_id_0 + - group: + get_input: server_group_id_0 + - group: + get_input: server_group_id_0 + - group: + get_input: server_group_id_0 + - group: + get_input: server_group_id_0 + - group: + get_input: server_group_id_0 + - group: + get_input: server_group_id_0 + compute_vlc_name: + - get_input: vlc_name_3 + - get_input: vlc_name_2 + - get_input: vlc_name_1 + - get_input: vlc_name_0 + - get_input: vlc_name_7 + - get_input: vlc_name_6 + - get_input: vlc_name_5 + - get_input: vlc_name_4 + port_template_VMInt_SCTP_A_vlc_security_group_refs: + - - get_input: security_group_sctp_a_id + compute_vlc_availability_zone: + - get_input: availability_zone_1 + - get_input: availability_zone_0 + - get_input: availability_zone_1 + - get_input: availability_zone_0 + - get_input: availability_zone_1 + - get_input: availability_zone_0 + - get_input: availability_zone_1 + - get_input: availability_zone_0 + port_template_VMInt_INT1_vlc_virtual_machine_interface_mac_addresses: + - - get_input: vlc4_Internal1_mac + - - get_input: vlc3_Internal1_mac + - - get_input: vlc2_Internal1_mac + - - get_input: vlc1_Internal1_mac + - - get_input: vlc8_Internal1_mac + - - get_input: vlc7_Internal1_mac + - - get_input: vlc6_Internal1_mac + - - get_input: vlc5_Internal1_mac + port_template_VMInt_GTP_vlc_virtual_network_refs: + - - get_input: gtp_net_fqdn + service_template_filter: + substitute_service_template: Nested_vlcServiceTemplate.yaml + count: 8 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: vlc + nfc_naming_code: vlc + requirements: + - link_vlc_template_VMInt_INT2_vlc: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + - link_vlc_template_VMInt_INT1_vlc: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + abstract_gpb_7: + type: org.openecomp.resource.abstract.nodes.gpb_7 + directives: + - substitutable + properties: + compute_gpb_name: + - get_input: gpb_name_7 + port_gpb8_Internal1_mac_address: + get_input: gpb8_Internal1_mac + port_gpb8_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + vm_flavor_name: + get_input: gpb_flavor_name + compute_gpb_scheduler_hints: + - group: + get_input: server_group_id_0 + compute_gpb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + vm_image_name: + get_input: pxe_image_name + port_gpb8_Internal2_security_groups: + - - get_input: security_group_int2_id + port_gpb8_Internal1_replacement_policy: + - AUTO + port_gpb8_Internal2_replacement_policy: + - AUTO + compute_gpb_availability_zone: + - get_input: availability_zone_1 + port_gpb8_Internal1_mac_requirements: + mac_count_required: + is_required: true + port_gpb8_Internal1_network: + - get_input: internal_net_id_0 + port_gpb8_Internal2_mac_requirements: + mac_count_required: + is_required: true + port_gpb8_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb8_Internal1_security_groups: + - - get_input: security_group_int1_id + port_gpb8_Internal2_network: + - get_input: internal_net_id_1 + port_gpb8_Internal2_mac_address: + get_input: gpb8_Internal1_mac + service_template_filter: + substitute_service_template: Nested_gpb_7ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: gpb + nfc_naming_code: gpb + requirements: + - link_gpb_gpb8_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_gpb_gpb8_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + abstract_gpb_5: + type: org.openecomp.resource.abstract.nodes.gpb_5 + directives: + - substitutable + properties: + port_gpb6_Internal1_mac_requirements: + mac_count_required: + is_required: true + compute_gpb_name: + - get_input: gpb_name_5 + vm_flavor_name: + get_input: gpb_flavor_name + compute_gpb_scheduler_hints: + - group: + get_input: server_group_id_0 + compute_gpb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + port_gpb6_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + vm_image_name: + get_input: pxe_image_name + port_gpb6_Internal1_security_groups: + - - get_input: security_group_int1_id + port_gpb6_Internal2_network: + - get_input: internal_net_id_1 + compute_gpb_availability_zone: + - get_input: availability_zone_1 + port_gpb6_Internal1_network: + - get_input: internal_net_id_0 + port_gpb6_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb6_Internal2_mac_address: + get_input: gpb6_Internal1_mac + port_gpb6_Internal1_mac_address: + get_input: gpb6_Internal1_mac + port_gpb6_Internal2_mac_requirements: + mac_count_required: + is_required: true + port_gpb6_Internal2_replacement_policy: + - AUTO + port_gpb6_Internal1_replacement_policy: + - AUTO + port_gpb6_Internal2_security_groups: + - - get_input: security_group_int2_id + service_template_filter: + substitute_service_template: Nested_gpb_5ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: gpb + nfc_naming_code: gpb + requirements: + - link_gpb_gpb6_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_gpb_gpb6_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + abstract_gpb_6: + type: org.openecomp.resource.abstract.nodes.gpb_6 + directives: + - substitutable + properties: + port_gpb7_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb7_Internal1_network: + - get_input: internal_net_id_0 + compute_gpb_name: + - get_input: gpb_name_6 + port_gpb7_Internal2_network: + - get_input: internal_net_id_1 + vm_flavor_name: + get_input: gpb_flavor_name + port_gpb7_Internal1_replacement_policy: + - AUTO + port_gpb7_Internal2_replacement_policy: + - AUTO + port_gpb7_Internal2_security_groups: + - - get_input: security_group_int2_id + compute_gpb_scheduler_hints: + - group: + get_input: server_group_id_0 + compute_gpb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + vm_image_name: + get_input: pxe_image_name + port_gpb7_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb7_Internal1_security_groups: + - - get_input: security_group_int1_id + compute_gpb_availability_zone: + - get_input: availability_zone_0 + port_gpb7_Internal2_mac_address: + get_input: gpb7_Internal1_mac + port_gpb7_Internal1_mac_requirements: + mac_count_required: + is_required: true + port_gpb7_Internal1_mac_address: + get_input: gpb7_Internal1_mac + port_gpb7_Internal2_mac_requirements: + mac_count_required: + is_required: true + service_template_filter: + substitute_service_template: Nested_gpb_6ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: gpb + nfc_naming_code: gpb + requirements: + - link_gpb_gpb7_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_gpb_gpb7_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + abstract_gpb_3: + type: org.openecomp.resource.abstract.nodes.gpb_3 + directives: + - substitutable + properties: + compute_gpb_name: + - get_input: gpb_name_3 + port_gpb4_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + vm_flavor_name: + get_input: gpb_flavor_name + port_gpb4_Internal1_mac_address: + get_input: gpb4_Internal1_mac + compute_gpb_scheduler_hints: + - group: + get_input: server_group_id_0 + port_gpb4_Internal2_mac_requirements: + mac_count_required: + is_required: true + compute_gpb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + port_gpb4_Internal2_mac_address: + get_input: gpb4_Internal1_mac + vm_image_name: + get_input: pxe_image_name + port_gpb4_Internal2_security_groups: + - - get_input: security_group_int2_id + compute_gpb_availability_zone: + - get_input: availability_zone_1 + port_gpb4_Internal2_replacement_policy: + - AUTO + port_gpb4_Internal1_replacement_policy: + - AUTO + port_gpb4_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb4_Internal1_security_groups: + - - get_input: security_group_int1_id + port_gpb4_Internal2_network: + - get_input: internal_net_id_1 + port_gpb4_Internal1_mac_requirements: + mac_count_required: + is_required: true + port_gpb4_Internal1_network: + - get_input: internal_net_id_0 + service_template_filter: + substitute_service_template: Nested_gpb_3ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: gpb + nfc_naming_code: gpb + requirements: + - link_gpb_gpb4_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_gpb_gpb4_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + abstract_gpb_4: + type: org.openecomp.resource.abstract.nodes.gpb_4 + directives: + - substitutable + properties: + port_gpb5_Internal2_mac_requirements: + mac_count_required: + is_required: true + port_gpb5_Internal1_security_groups: + - - get_input: security_group_int1_id + compute_gpb_name: + - get_input: gpb_name_4 + vm_flavor_name: + get_input: gpb_flavor_name + port_gpb5_Internal1_mac_requirements: + mac_count_required: + is_required: true + compute_gpb_scheduler_hints: + - group: + get_input: server_group_id_0 + port_gpb5_Internal2_network: + - get_input: internal_net_id_1 + compute_gpb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + vm_image_name: + get_input: pxe_image_name + port_gpb5_Internal1_network: + - get_input: internal_net_id_0 + port_gpb5_Internal2_mac_address: + get_input: gpb5_Internal1_mac + port_gpb5_Internal1_mac_address: + get_input: gpb5_Internal1_mac + port_gpb5_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb5_Internal2_replacement_policy: + - AUTO + compute_gpb_availability_zone: + - get_input: availability_zone_0 + port_gpb5_Internal1_replacement_policy: + - AUTO + port_gpb5_Internal2_security_groups: + - - get_input: security_group_int2_id + port_gpb5_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + service_template_filter: + substitute_service_template: Nested_gpb_4ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: gpb + nfc_naming_code: gpb + requirements: + - link_gpb_gpb5_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_gpb_gpb5_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + abstract_gpb: + type: org.openecomp.resource.abstract.nodes.gpb + directives: + - substitutable + properties: + port_gpb1_Internal1_security_groups: + - - get_input: security_group_int1_id + compute_gpb_name: + - get_input: gpb_name_0 + port_gpb1_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + vm_flavor_name: + get_input: gpb_flavor_name + port_gpb1_Internal1_mac_requirements: + mac_count_required: + is_required: true + compute_gpb_scheduler_hints: + - group: + get_input: server_group_id_0 + compute_gpb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + vm_image_name: + get_input: pxe_image_name + port_gpb1_Internal1_mac_address: + get_input: gpb1_Internal1_mac + port_gpb1_Internal2_mac_address: + get_input: gpb1_Internal1_mac + port_gpb1_Internal2_mac_requirements: + mac_count_required: + is_required: true + compute_gpb_availability_zone: + - get_input: availability_zone_0 + port_gpb1_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb1_Internal2_security_groups: + - - get_input: security_group_int2_id + port_gpb1_Internal1_replacement_policy: + - AUTO + port_gpb1_Internal2_replacement_policy: + - AUTO + port_gpb1_Internal2_network: + - get_input: internal_net_id_1 + port_gpb1_Internal1_network: + - get_input: internal_net_id_0 + service_template_filter: + substitute_service_template: Nested_gpbServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: gpb + nfc_naming_code: gpb + requirements: + - link_gpb_gpb1_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_gpb_gpb1_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + Internal1_net: + type: org.openecomp.resource.vl.nodes.heat.network.contrailV2.VirtualNetwork + properties: + network_ipam_refs_data: + - network_ipam_refs_data_ipam_subnets: + - network_ipam_refs_data_ipam_subnets_enable_dhcp: + get_input: Internal1_dhcp + network_ipam_refs_data_ipam_subnets_default_gateway: + get_input: Internal1_net_gateway + network_ipam_refs_data_ipam_subnets_subnet: + network_ipam_refs_data_ipam_subnets_subnet_ip_prefix_len: + get_input: Internal1_net_cidr_len + network_ipam_refs_data_ipam_subnets_subnet_ip_prefix: + get_input: Internal1_net_cidr + network_name: + str_replace: + template: $VNF_NAME_int_net_1 + params: + $VNF_NAME: + get_input: vnf_name + network_ipam_refs: + - UNSUPPORTED_RESOURCE_template_NetworkIpam_Internal1 + abstract_fsb: + type: org.openecomp.resource.abstract.nodes.fsb + directives: + - substitutable + properties: + port_FSB1_Internal1_mac_address: + get_input: fsb1_Internal1_mac + port_FSB_OAM_network_role_tag: + - oam + port_FSB1_Internal2_network: + - Internal2_net + port_FSB1_Internal1_network: + - Internal1_net + vm_flavor_name: + get_input: fsb_flavor_name + port_FSB1_Internal2_mac_address: + get_input: fsb1_Internal1_mac + port_FSB_OAM_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: true + floating_ip_count_required: + is_required: false + compute_fsb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + port_FSB1_Internal1_security_groups: + - - int1_security_group + port_FSB1_Internal2_replacement_policy: + - AUTO + compute_fsb_scheduler_hints: + - group: VM_Affinity_group + port_FSB1_Internal1_replacement_policy: + - AUTO + compute_fsb_name: + - get_input: fsb_name_0 + port_FSB1_Internal1_mac_requirements: + mac_count_required: + is_required: true + port_FSB1_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_FSB_OAM_network: + - get_input: oam_net_name + port_FSB_OAM_security_groups: + - - oam_security_group + port_FSB_OAM_mac_requirements: + mac_count_required: + is_required: false + port_FSB_OAM_replacement_policy: + - AUTO + compute_fsb_availability_zone: + - get_input: availability_zone_0 + port_FSB1_Internal2_security_groups: + - - int2_security_group + port_FSB1_Internal2_mac_requirements: + mac_count_required: + is_required: true + port_FSB1_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_FSB_OAM_fixed_ips: + - ip_address: + get_input: fsb_oam_ip_0 + service_template_filter: + substitute_service_template: Nested_fsbServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: fsb + nfc_naming_code: fsb + requirements: + - link_fsb_FSB1_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_fsb_FSB1_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + gtp_security_group: + type: org.openecomp.resource.vfc.rules.nodes.heat.network.neutron.SecurityRules + properties: + name: + str_replace: + template: $VNF_NAME_$SECGROUPNAME + params: + $SECGROUPNAME: + get_input: gtp_sec_group_name + $VNF_NAME: + get_input: vnf_name + rules: + - protocol: tcp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: udp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: icmp + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + - protocol: tcp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: udp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: icmp + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + abstract_ncb_1: + type: org.openecomp.resource.abstract.nodes.ncb_1 + directives: + - substitutable + properties: + port_NCB2_Internal2_security_groups: + - - int2_security_group + port_NCB2_Internal1_replacement_policy: + - AUTO + port_NCB2_Internal2_replacement_policy: + - AUTO + vm_flavor_name: + get_input: ncb_flavor_name + port_NCB2_Internal2_mac_requirements: + mac_count_required: + is_required: true + port_NCB2_Internal1_mac_requirements: + mac_count_required: + is_required: true + vm_image_name: + get_input: pxe_image_name + compute_ncb_scheduler_hints: + - group: VM_Affinity_group + compute_ncb_availability_zone: + - get_input: availability_zone_1 + port_NCB2_Internal1_network: + - Internal1_net + port_NCB2_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_NCB2_Internal1_security_groups: + - - int1_security_group + port_NCB2_Internal2_network: + - Internal2_net + port_NCB2_Internal1_mac_address: + get_input: ncb2_Internal1_mac + port_NCB2_Internal2_mac_address: + get_input: ncb2_Internal1_mac + compute_ncb_name: + - get_input: ncb_name_1 + compute_ncb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + port_NCB2_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + service_template_filter: + substitute_service_template: Nested_ncb_1ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: ncb + nfc_naming_code: ncb + requirements: + - link_ncb_NCB2_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_ncb_NCB2_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + abstract_ncb: + type: org.openecomp.resource.abstract.nodes.ncb + directives: + - substitutable + properties: + vm_flavor_name: + get_input: ncb_flavor_name + port_NCB1_Internal2_mac_requirements: + mac_count_required: + is_required: true + vm_image_name: + get_input: pxe_image_name + port_NCB1_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + compute_ncb_scheduler_hints: + - group: VM_Affinity_group + port_NCB1_Internal1_security_groups: + - - int1_security_group + compute_ncb_availability_zone: + - get_input: availability_zone_0 + port_NCB1_Internal2_mac_address: + get_input: ncb1_Internal1_mac + port_NCB1_Internal1_mac_address: + get_input: ncb1_Internal1_mac + port_NCB1_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_NCB1_Internal1_mac_requirements: + mac_count_required: + is_required: true + port_NCB1_Internal2_replacement_policy: + - AUTO + port_NCB1_Internal1_network: + - Internal1_net + port_NCB1_Internal2_security_groups: + - - int2_security_group + port_NCB1_Internal1_replacement_policy: + - AUTO + compute_ncb_name: + - get_input: ncb_name_0 + compute_ncb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + port_NCB1_Internal2_network: + - Internal2_net + service_template_filter: + substitute_service_template: Nested_ncbServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: ncb + nfc_naming_code: ncb + requirements: + - link_ncb_NCB1_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_ncb_NCB1_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + int1_security_group: + type: org.openecomp.resource.vfc.rules.nodes.heat.network.neutron.SecurityRules + properties: + name: + str_replace: + template: $VNF_NAME_$SECGROUPNAME + params: + $SECGROUPNAME: + get_input: int1_sec_group_name + $VNF_NAME: + get_input: vnf_name + rules: + - protocol: tcp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: udp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: icmp + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + - protocol: tcp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: udp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: icmp + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + requirements: + - port: + capability: attachment_fsb_FSB1_Internal1 + node: abstract_fsb + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_fsb_FSB2_Internal1 + node: abstract_fsb_1 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_ncb_NCB1_Internal1 + node: abstract_ncb + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_ncb_NCB2_Internal1 + node: abstract_ncb_1 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb1_Internal1 + node: abstract_gpb + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb2_Internal1 + node: abstract_gpb_1 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb3_Internal1 + node: abstract_gpb_2 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb4_Internal1 + node: abstract_gpb_3 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb5_Internal1 + node: abstract_gpb_4 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb6_Internal1 + node: abstract_gpb_5 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb7_Internal1 + node: abstract_gpb_6 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb8_Internal1 + node: abstract_gpb_7 + relationship: org.openecomp.relationships.AttachesTo + fsb_volume_0: + type: org.openecomp.resource.vfc.nodes.heat.cinder.Volume + properties: + image: + get_input: fsb_volume_image_name_0 + volume_type: + get_input: fsb_volume_type + size: '(get_input : fsb_volume_size) * 1024' + name: + list_join: + - _ + - - get_input: OS::stack_name + - FSB1_Vol_1 + fsb_volume_1: + type: org.openecomp.resource.vfc.nodes.heat.cinder.Volume + properties: + image: + get_input: fsb_volume_image_name_1 + volume_type: + get_input: fsb_volume_type + size: '(get_input : fsb_volume_size) * 1024' + name: + list_join: + - _ + - - get_input: OS::stack_name + - FSB2_Vol_1 + Internal2_net: + type: org.openecomp.resource.vl.nodes.heat.network.contrailV2.VirtualNetwork + properties: + network_ipam_refs_data: + - network_ipam_refs_data_ipam_subnets: + - network_ipam_refs_data_ipam_subnets_enable_dhcp: + get_input: Internal2_dhcp + network_ipam_refs_data_ipam_subnets_default_gateway: + get_input: Internal2_net_gateway + network_ipam_refs_data_ipam_subnets_subnet: + network_ipam_refs_data_ipam_subnets_subnet_ip_prefix_len: + get_input: Internal2_net_cidr_len + network_ipam_refs_data_ipam_subnets_subnet_ip_prefix: + get_input: Internal2_net_cidr + network_name: + str_replace: + template: $VNF_NAME_int_net_2 + params: + $VNF_NAME: + get_input: vnf_name + network_ipam_refs: + - UNSUPPORTED_RESOURCE_template_NetworkIpam_Internal2 + int2_security_group: + type: org.openecomp.resource.vfc.rules.nodes.heat.network.neutron.SecurityRules + properties: + name: + str_replace: + template: $VNF_NAME_$SECGROUPNAME + params: + $SECGROUPNAME: + get_input: int2_sec_group_name + $VNF_NAME: + get_input: vnf_name + rules: + - protocol: tcp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: udp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: 132 + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: icmp + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + - protocol: tcp + ethertype: IPv6 + port_range_max: 65535 + remote_ip_prefix: ::/0 + direction: egress + port_range_min: 1 + - protocol: udp + ethertype: IPv6 + port_range_max: 65535 + remote_ip_prefix: ::/0 + direction: egress + port_range_min: 1 + - protocol: 132 + ethertype: IPv6 + port_range_max: 65535 + remote_ip_prefix: ::/0 + direction: egress + port_range_min: 1 + - protocol: icmp + ethertype: IPv6 + remote_ip_prefix: ::/0 + direction: egress + - protocol: tcp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: udp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: 132 + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: icmp + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + - protocol: tcp + ethertype: IPv6 + port_range_max: 65535 + remote_ip_prefix: ::/0 + direction: ingress + port_range_min: 1 + - protocol: udp + ethertype: IPv6 + port_range_max: 65535 + remote_ip_prefix: ::/0 + direction: ingress + port_range_min: 1 + - protocol: 132 + ethertype: IPv6 + port_range_max: 65535 + remote_ip_prefix: ::/0 + direction: ingress + port_range_min: 1 + - protocol: icmp + ethertype: IPv6 + remote_ip_prefix: ::/0 + direction: ingress + requirements: + - port: + capability: attachment_fsb_FSB1_Internal2 + node: abstract_fsb + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_fsb_FSB2_Internal2 + node: abstract_fsb_1 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_ncb_NCB1_Internal2 + node: abstract_ncb + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_ncb_NCB2_Internal2 + node: abstract_ncb_1 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb1_Internal2 + node: abstract_gpb + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb2_Internal2 + node: abstract_gpb_1 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb3_Internal2 + node: abstract_gpb_2 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb4_Internal2 + node: abstract_gpb_3 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb5_Internal2 + node: abstract_gpb_4 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb6_Internal2 + node: abstract_gpb_5 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb7_Internal2 + node: abstract_gpb_6 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb8_Internal2 + node: abstract_gpb_7 + relationship: org.openecomp.relationships.AttachesTo + abstract_fsb_1: + type: org.openecomp.resource.abstract.nodes.fsb_1 + directives: + - substitutable + properties: + port_FSB_OAM_network_role_tag: + - oam + vm_flavor_name: + get_input: fsb_flavor_name + port_FSB_OAM_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: true + floating_ip_count_required: + is_required: false + port_FSB2_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_FSB2_Internal2_security_groups: + - - int2_security_group + compute_fsb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + port_FSB2_Internal1_mac_address: + get_input: fsb2_Internal1_mac + compute_fsb_scheduler_hints: + - group: VM_Affinity_group + compute_fsb_name: + - get_input: fsb_name_1 + port_FSB2_Internal1_security_groups: + - - int1_security_group + port_FSB_OAM_network: + - get_input: oam_net_name + port_FSB_OAM_security_groups: + - - oam_security_group + port_FSB2_Internal1_network: + - Internal1_net + port_FSB2_Internal2_mac_address: + get_input: fsb2_Internal1_mac + port_FSB2_Internal2_mac_requirements: + mac_count_required: + is_required: true + port_FSB_OAM_mac_requirements: + mac_count_required: + is_required: false + port_FSB2_Internal2_replacement_policy: + - AUTO + port_FSB2_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_FSB_OAM_replacement_policy: + - AUTO + port_FSB2_Internal2_network: + - Internal2_net + port_FSB2_Internal1_replacement_policy: + - AUTO + compute_fsb_availability_zone: + - get_input: availability_zone_1 + port_FSB_OAM_fixed_ips: + - ip_address: + get_input: fsb_oam_ip_1 + port_FSB2_Internal1_mac_requirements: + mac_count_required: + is_required: true + service_template_filter: + substitute_service_template: Nested_fsb_1ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: fsb + nfc_naming_code: fsb + requirements: + - link_fsb_FSB2_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_fsb_FSB2_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + oam_security_group: + type: org.openecomp.resource.vfc.rules.nodes.heat.network.neutron.SecurityRules + properties: + name: + str_replace: + template: $VNF_NAME_$SECGROUPNAME + params: + $SECGROUPNAME: + get_input: oam_sec_group_name + $VNF_NAME: + get_input: vnf_name + rules: + - protocol: tcp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: udp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: icmp + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + - protocol: tcp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: udp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: icmp + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + requirements: + - port: + capability: attachment_fsb_FSB_OAM + node: abstract_fsb + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_fsb_FSB_OAM + node: abstract_fsb_1 + relationship: org.openecomp.relationships.AttachesTo + groups: + vmme_gpb3_group: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/vmme_gpb3.yml + description: | + Module HOT template to create vmme 1-8 gpb + members: + - abstract_gpb + - abstract_gpb_1 + - abstract_gpb_2 + - abstract_gpb_3 + - abstract_gpb_4 + - abstract_gpb_5 + - abstract_gpb_6 + - abstract_gpb_7 + base_vmme_group: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/base_vmme.yml + description: | + Base HOT template to create vmme 2 fsb 2 ncb + members: + - int2_security_group + - oam_security_group + - gtp_security_group + - Internal2_net + - int1_security_group + - Internal1_net + - abstract_ncb + - abstract_ncb_1 + - abstract_fsb + - abstract_fsb_1 + base_vmme_volume_group: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/base_vmme_volume.yml + description: HOT template for vMME Cinder Volumes + members: + - fsb_volume_0 + - fsb_volume_1 + vmme_gpb1_group: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/vmme_gpb1.yml + description: | + Module HOT template to create vmme 1-8 gpb + members: + - abstract_gpb + - abstract_gpb_1 + - abstract_gpb_2 + - abstract_gpb_3 + - abstract_gpb_4 + - abstract_gpb_5 + - abstract_gpb_6 + - abstract_gpb_7 + vmme_gpb4_group: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/vmme_gpb4.yml + description: | + Module HOT template to create vmme 1-8 gpb + members: + - abstract_gpb + - abstract_gpb_1 + - abstract_gpb_2 + - abstract_gpb_3 + - abstract_gpb_4 + - abstract_gpb_5 + - abstract_gpb_6 + - abstract_gpb_7 + vmme_gpb2_group: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/vmme_gpb2.yml + description: | + Module HOT template to create vmme 1-8 gpb + members: + - abstract_gpb + - abstract_gpb_1 + - abstract_gpb_2 + - abstract_gpb_3 + - abstract_gpb_4 + - abstract_gpb_5 + - abstract_gpb_6 + - abstract_gpb_7 + VM_Affinity_group: + type: tosca.groups.Root + members: + - abstract_ncb + - abstract_ncb_1 + - abstract_vlc + - abstract_fsb + - abstract_fsb_1 + - abstract_gpb + - abstract_gpb_1 + - abstract_gpb_2 + - abstract_gpb_3 + - abstract_gpb_4 + - abstract_gpb_5 + - abstract_gpb_6 + - abstract_gpb_7 + vmme_vlc_group: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/vmme_vlc.yml + description: | + Module HOT template to create vmme 8 vlcs + members: + - abstract_vlc + outputs: + oam_management_v4_address: + description: ID of OAM VIP to be provisioned in A&AI + value: + get_input: vip_oam_management_v4_ip + fsb_volume_id_1: + description: ID of Cinder Volume for FSB2 + value: fsb_volume_1 + security_group_sctp_b_id: + description: ID of sctpb_security_group + value: UNSUPPORTED_RESOURCE_sctpb_security_group + service_instance_id_0: + description: ID of Service Instance used for vLCs + value: UNSUPPORTED_RESOURCE_template_ServiceInstance_VLC + security_group_sctp_a_id: + description: ID of sctpa_security_group + value: UNSUPPORTED_RESOURCE_sctpa_security_group + fsb_volume_id_0: + description: ID of Cinder Volume for FSB1 + value: fsb_volume_0 + policies: + VM_Affinity_policy: + type: org.openecomp.policies.placement.Antilocate + properties: + container_type: host + targets: + - VM_Affinity_group @@ -0,0 +1,3509 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +metadata: + template_name: Main +imports: +- openecomp_heat_index: + file: openecomp-heat/_index.yml +- GlobalSubstitutionTypes: + file: GlobalSubstitutionTypesServiceTemplate.yaml +topology_template: + inputs: + vlc4_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc4_Internal2 + default: 00:80:37:0E:04:12 + sctp-a-egress_rule_application: + hidden: false + immutable: false + type: string + description: application for the SecurityGroup + default: any + sctp-b-ipv6-ingress-src_start_port: + hidden: false + immutable: false + type: float + description: IPV6 start port + default: 0 + constraints: + - in_range: + - 0 + - 65535 + ncb1_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to ncb1_Internal2 + default: 00:80:37:0E:09:12 + sctp-a-ipv6-ingress_ethertype: + hidden: false + immutable: false + type: string + description: IPV6 ethertype + default: IPv4 + gpb8_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb8_Internal1 + default: 00:80:37:0E:10:22 + sctp-a-ingress_rule_protocol: + hidden: false + immutable: false + type: string + description: protocol for the SecurityGroup + default: any + sctp-b-display_name: + hidden: false + immutable: false + type: string + description: display_name for the SecurityGroup + default: epc-sctp-b-ipv4v6-sec-group + sctp-a-ingress_ethertype: + hidden: false + immutable: false + type: string + description: ethertype for the SecurityGroup + default: IPv4 + sctp-a-egress-src_start_port: + hidden: false + immutable: false + type: float + description: start_port for the SecurityGroup + default: 0 + constraints: + - in_range: + - 0 + - 65535 + ncb_flavor_name: + hidden: false + immutable: false + type: string + description: Flavor to use for servers ncb + default: nv.c8r32d1 + vlc3_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc3_Internal1 + default: 00:80:37:0E:03:12 + Internal2_net_cidr: + hidden: false + immutable: false + type: string + description: CIDR for internal-2 network + default: 169.255.0.0 + sctp-a-egress-dst_start_port: + hidden: false + immutable: false + type: float + description: start_port for the SecurityGroup + default: 0 + constraints: + - in_range: + - 0 + - 65535 + sctp-a-egress_ethertype: + hidden: false + immutable: false + type: string + description: ethertype for the SecurityGroup + default: IPv4 + gpb4_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb4_Internal2 + default: 00:80:37:0E:0C:22 + sctp-b-ipv6-egress_rule_application: + hidden: false + immutable: false + type: string + description: IPV6 Rule-application + default: any + vlc8_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc8_Internal1 + default: 00:80:37:0E:08:12 + sctp-b-ipv6-ingress-src_end_port: + hidden: false + immutable: false + type: float + description: IPV6 ending port for destination + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + fsb2_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to fsb2_Internal1 + default: 00:80:37:0E:0D:12 + sctp-b-name: + hidden: false + immutable: false + type: string + description: name for the SecurityGroup + default: epc-sctp-b-ipv4v6-sec-group + sctp-b-ipv6-egress_ethertype: + hidden: false + immutable: false + type: string + description: IPV6 ethertype + default: IPv4 + internal_net_id_1: + hidden: false + immutable: false + type: string + description: UUID of Internal2_net + default: e3397c69-a942-49aa-81cb-fb91ff34abc8 + sctp-a-egress_dst_subnet_prefix: + hidden: false + immutable: false + type: string + description: ip_prefix for the SecurityGroup + default: 0.0.0.0 + internal_net_id_0: + hidden: false + immutable: false + type: string + description: UUID of Internal1_net + default: 871de971-22ac-47b6-befb-50e7d4cb67ea + sctp_b_net_fqdn: + hidden: false + immutable: false + type: string + description: Network FQDN SCTPB + default: default-domain:vMME-24474-Ericsson-WTC-Lab-vLCP1-4:vMME-24474-Ericsson-WTC-Lab-vLCP1-4_gn_SCTPB_net_1 + sctp-a-ipv6-ingress_rule_application: + hidden: false + immutable: false + type: string + description: IPV6 Rule-application + default: any + sctp-b-ipv6-ingress_src_subnet_prefix_len: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix length + default: '0' + ncb_name_1: + hidden: false + immutable: false + type: string + description: Name of ncb2 + default: zrdm3mmex59ncb002 + ncb_name_0: + hidden: false + immutable: false + type: string + description: Name of ncb1 + default: zrdm3mmex59ncb001 + vlc_st_virtualization_type: + hidden: false + immutable: false + type: string + description: Indicates virtualization type + default: virtual-machine + vlc2_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc2_Internal1 + default: 00:80:37:0E:02:12 + sctp-b-ingress-dst_start_port: + hidden: false + immutable: false + type: float + description: start_port for the SecurityGroup + default: 0 + constraints: + - in_range: + - 0 + - 65535 + sctp-a-display_name: + hidden: false + immutable: false + type: string + description: display_name for the SecurityGroup + default: epc-sctp-a-ipv4v6-sec-group + sctp-b-ingress_rule_application: + hidden: false + immutable: false + type: string + description: application for the SecurityGroup + default: any + int2_sec_group_name: + hidden: false + immutable: false + type: string + description: SecurityGroup name for internal-2 + default: int2-sec-group + gpb5_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb5_Internal2 + default: 00:80:37:0E:0D:22 + sctp-a-egress-dst_subnet_prefix_v6: + hidden: false + immutable: false + type: string + description: dst subnet + default: '::' + OS::stack_name: + type: string + required: false + sctp-b-egress-src_end_port: + hidden: false + immutable: false + type: float + description: end_port for the SecurityGroup + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + Internal2_shared: + hidden: false + immutable: false + type: string + description: Whether Shared or private internal-2 network + default: false + sctp-a-ipv6-egress_rule_protocol: + hidden: false + immutable: false + type: string + description: IPV6 Rule-protocol + default: any + Internal2_rpf: + hidden: false + immutable: false + type: string + description: Reverse Path Forwarding Enabled/Disabled internal-2 network + default: disable + vlc5_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc5_Internal2 + default: 00:80:37:0E:05:12 + sctp-a-ipv6-egress_src_end_port: + hidden: false + immutable: false + type: string + description: IPV6 end port + default: 65535 + Internal1_forwarding_mode: + hidden: false + immutable: false + type: string + description: L2 or L3 forwarding mode for internal-1 network + default: l2 + gpb3_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb3_Internal1 + default: 00:80:37:0E:0B:22 + vip_oam_management_v4_ip: + hidden: false + immutable: false + type: string + description: IP address of OAM service IP address to be provisioned in A&AI + default: 107.239.72.176 + vmi_oam_preference_primary: + hidden: false + immutable: false + type: float + description: Preference for primary interface/port + default: 200 + sctp-b-src_subnet_prefix_v6: + hidden: false + immutable: false + type: string + description: ip_prefix for the SecurityGroup + default: '::' + sctp-a-egress_dst_subnet_prefix_len: + hidden: false + immutable: false + type: float + description: ip_prefix_len for the SecurityGroup + default: '0' + constraints: + - in_range: + - 0 + - 32 + security_group_sctp_b_id: + hidden: false + immutable: false + type: string + description: Security Group UUID for output + default: 92a4ae54-1733-4d03-b488-f178bb9f7b82 + Internal2_forwarding_mode: + hidden: false + immutable: false + type: string + description: L2 or L3 forwarding mode for internal-2 network + default: l2 + sctp-a-ipv6-egress_dst_end_port: + hidden: false + immutable: false + type: string + description: IPV6 end port + default: 65535 + sctp-b-egress-dst_subnet_prefix_v6: + hidden: false + immutable: false + type: string + description: dst subnet + default: '::' + sctp-b-egress_dst_subnet_prefix: + hidden: false + immutable: false + type: string + description: ip_prefix for the SecurityGroup + default: 0.0.0.0 + security_group_oam_id: + hidden: false + immutable: false + type: string + description: Security Group UUID for output + default: 4ae4aa74-3e8e-4f2b-8b5f-a8bd262da96b + gpb2_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb2_Internal1 + default: 00:80:37:0E:0A:22 + security_group_int1_id: + hidden: false + immutable: false + type: string + description: UUID of Internal1_net security group + default: 94c62578-835d-4801-9372-70a2cfb22683 + sctp-a-egress_action: + hidden: false + immutable: false + type: string + description: simple_action for the SecurityGroup + default: pass + oam_net_fqdn: + hidden: false + immutable: false + type: string + description: Network FQDN OAM + default: default-domain:vMME-24474-Ericsson-WTC-Lab-vLCP1-4:vMME-24474-Ericsson-WTC-Lab-vLCP1-4_OAM_net_1 + ncb2_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to ncb2_Internal2 + default: 00:80:37:0E:0F:12 + vlc_st_interface_type_sctp_a: + hidden: false + immutable: false + type: string + description: service_interface_type for the ServiceTemplate + default: left + gpb3_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb3_Internal2 + default: 00:80:37:0E:0B:22 + vlc_st_interface_type_sctp_b: + hidden: false + immutable: false + type: string + description: service_interface_type for the ServiceTemplate + default: right + gpb1_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb1_Internal2 + default: 00:80:37:0E:09:22 + oam_net_name: + hidden: false + immutable: false + type: string + description: Network Name OAM + default: vMME-24474-Ericsson-WTC-Lab-vLCP1-4_OAM_net_1 + sctp-b-ingress-src_start_port: + hidden: false + immutable: false + type: float + description: start_port for the SecurityGroup + default: 0 + constraints: + - in_range: + - 0 + - 65535 + fsb1_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to fsb1_Internal1 + default: 00:80:37:0E:0B:12 + sctp-b-ingress_dst_addresses: + hidden: false + immutable: false + type: string + description: security_group for the SecurityGroup + default: local + vlc_st_interface_type_oam: + hidden: false + immutable: false + type: string + description: service_interface_type for the ServiceTemplate + default: management + shc_monitor_type: + hidden: false + immutable: false + type: string + description: health check + default: PING + oam_sec_group_name: + hidden: false + immutable: false + type: string + description: SecurityGroup name for OAM + default: oam-sec-group + Internal2_net_gateway: + hidden: false + immutable: false + type: string + description: gateway for internal-2 network + default: 169.255.0.3 + evac_policy: + hidden: false + immutable: false + type: string + description: CMHA Policy + default: Evacuate + server_group_id_0: + hidden: false + immutable: false + type: string + description: ID of Anti-Affinity Policy-based Server Group + default: ec99a73d-38f8-4280-8103-ba8ee584629f + vlc8_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc8_Internal2 + default: 00:80:37:0E:08:12 + sctp-b-ipv6-egress_rule_protocol: + hidden: false + immutable: false + type: string + description: IPV6 Rule-protocol + default: any + gtp_sec_group_name: + hidden: false + immutable: false + type: string + description: SecurityGroup name for GTP + default: gtp-sec-group + vlc_sctp_b_v6_ip_2: + hidden: false + immutable: false + type: string + description: Static IP vlc3 SCTPB + default: fd00:200:200:5:0:0:0:24 + vlc_sctp_b_v6_ip_1: + hidden: false + immutable: false + type: string + description: Static IP vlc2 SCTPB + default: fd00:200:200:5:0:0:0:17 + sctp-a-ipv6-egress_dst_subnet_prefix: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix + default: 0.0.0.0 + vlc_sctp_b_v6_ip_0: + hidden: false + immutable: false + type: string + description: Static IP vlc1 SCTPB + default: fd00:200:200:5:0:0:0:16 + vlc4_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc4_Internal1 + default: 00:80:37:0E:04:12 + vlc_sctp_b_v6_ip_6: + hidden: false + immutable: false + type: string + description: Static IP vlc7 SCTPB + default: fd00:200:200:5:0:0:0:28 + vlc_sctp_b_v6_ip_5: + hidden: false + immutable: false + type: string + description: Static IP vlc6 SCTPB + default: fd00:200:200:5:0:0:0:27 + vlc_sctp_b_v6_ip_4: + hidden: false + immutable: false + type: string + description: Static IP vlc5 SCTPB + default: fd00:200:200:5:0:0:0:26 + vlc_sctp_b_v6_ip_3: + hidden: false + immutable: false + type: string + description: Static IP vlc4 SCTPB + default: fd00:200:200:5:0:0:0:25 + sctp_b_net_name: + hidden: false + immutable: false + type: string + description: Network Name SCTPB + default: vMME-24474-Ericsson-WTC-Lab-vLCP1-4_gn_SCTPB_net_1 + sctp-b-ipv6-egress_dst_subnet_prefix_len: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix + default: '0' + sctp-a-egress_rule_protocol: + hidden: false + immutable: false + type: string + description: protocol for the SecurityGroup + default: any + Internal1_shared: + hidden: false + immutable: false + type: string + description: Whether Shared or private internal-1 network + default: false + shc_url_path: + hidden: false + immutable: false + type: string + description: health check + default: local-ip + Internal2_net_cidr_len: + hidden: false + immutable: false + type: string + description: CIDR length for internal-2 network + default: 17 + sctp-a-ingress-src_end_port: + hidden: false + immutable: false + type: float + description: end_port for the SecurityGroup + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + sctp-b-ipv6-ingress_src_subnet_prefix: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix + default: 0.0.0.0 + sctp-a-egress-dst_end_port: + hidden: false + immutable: false + type: float + description: end_port for the SecurityGroup + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + sctp-a-ingress_action: + hidden: false + immutable: false + type: string + description: simple_action for the SecurityGroup + default: pass + sctp-b-ipv6-ingress_action: + hidden: false + immutable: false + type: string + description: IPV6 action + default: pass + vlc_st_service_type: + hidden: false + immutable: false + type: string + description: service type + default: firewall + sctp-b-ipv6-ingress-dst_start_port: + hidden: false + immutable: false + type: string + description: IPV6 starting port for destination + default: 0 + vlc_st_availability_zone: + hidden: false + immutable: false + type: string + description: Indicates availability zone is enabled + default: true + vlc7_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc7_Internal1 + default: 00:80:37:0E:07:12 + fsb_volume_image_name_1: + label: MME_FSB2 + hidden: false + immutable: false + type: string + description: volume name + default: MME_FSB2_1_3_GA.qcow2 + vlc_oam_ip_6: + hidden: false + immutable: false + type: string + description: Static IP vlc7 OAM + default: 107.239.72.151 + sctp-a-ipv6-ingress_src_subnet_prefix_len: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix length + default: '0' + vlc_oam_ip_7: + hidden: false + immutable: false + type: string + description: Static IP vlc8 OAM + default: 107.239.72.152 + Internal1_allow_transit: + hidden: false + immutable: false + type: string + description: Allow/disallow transit internal-1 network + default: true + vlc_oam_ip_2: + hidden: false + immutable: false + type: string + description: Static IP vlc3 OAM + default: 107.239.72.157 + vlc_oam_ip_3: + hidden: false + immutable: false + type: string + description: Static IP vlc4 OAM + default: 107.239.72.158 + vlc_gtp_ip_0: + hidden: false + immutable: false + type: string + description: Static IP vlc1 GTP + default: 107.243.47.208 + vlc_oam_ip_4: + hidden: false + immutable: false + type: string + description: Static IP vlc5 OAM + default: 107.239.72.149 + fsb_volume_image_name_0: + label: MME_FSB1 + hidden: false + immutable: false + type: string + description: volume name + default: MME_FSB1_1_3_GA.qcow2 + vlc_gtp_ip_1: + hidden: false + immutable: false + type: string + description: Static IP vlc2 GTP + default: 107.243.47.209 + vlc_oam_ip_5: + hidden: false + immutable: false + type: string + description: Static IP vlc6 OAM + default: 107.239.72.150 + vlc_gtp_ip_2: + hidden: false + immutable: false + type: string + description: Static IP vlc3 GTP + default: 107.243.47.216 + vlc_name_6: + hidden: false + immutable: false + type: string + description: Name of vlc7 + default: zrdm3mmex59vlc007 + vlc_gtp_ip_3: + hidden: false + immutable: false + type: string + description: Static IP vlc4 GTP + default: 107.243.47.217 + vlc_name_7: + hidden: false + immutable: false + type: string + description: Name of vlc8 + default: zrdm3mmex59vlc008 + security_group_sctp_a_id: + hidden: false + immutable: false + type: string + description: Security Group UUID for output + default: 3cd8a524-77ff-4980-ae2a-d19ba70e0511 + vlc_gtp_ip_4: + hidden: false + immutable: false + type: string + description: Static IP vlc5 GTP + default: 107.243.47.218 + vlc_gtp_ip_5: + hidden: false + immutable: false + type: string + description: Static IP vlc6 GTP + default: 107.243.47.219 + vlc_gtp_ip_6: + hidden: false + immutable: false + type: string + description: Static IP vlc7 GTP + default: 107.243.47.220 + vlc_name_2: + hidden: false + immutable: false + type: string + description: Name of vlc3 + default: zrdm3mmex59vlc003 + vlc_gtp_ip_7: + hidden: false + immutable: false + type: string + description: Static IP vlc8 GTP + default: 107.243.47.221 + vlc_name_3: + hidden: false + immutable: false + type: string + description: Name of vlc4 + default: zrdm3mmex59vlc004 + vlc_name_4: + hidden: false + immutable: false + type: string + description: Name of vlc5 + default: zrdm3mmex59vlc005 + vlc_name_5: + hidden: false + immutable: false + type: string + description: Name of vlc6 + default: zrdm3mmex59vlc006 + fsb_volume_id_1: + hidden: false + immutable: false + type: string + description: ID of Cinder Volume for FSB2 + default: 5bd0560c-bfd0-47dc-a84a-554e2698c925 + sctp-a-ipv6-ingress_action: + hidden: false + immutable: false + type: string + description: IPV6 action + default: pass + vlc_name_0: + hidden: false + immutable: false + type: string + description: Name of vlc1 + default: zrdm3mmex59vlc001 + vlc_name_1: + hidden: false + immutable: false + type: string + description: Name of vlc2 + default: zrdm3mmex59vlc002 + vlc_oam_route_prefixes: + hidden: false + immutable: false + type: json + description: Route prefixes for static routing on OAM + sctp-b-egress_rule_application: + hidden: false + immutable: false + type: string + description: application for the SecurityGroup + default: any + vlc_oam_ip_0: + hidden: false + immutable: false + type: string + description: Static IP vlc1 OAM + default: 107.239.72.155 + vlc_oam_ip_1: + hidden: false + immutable: false + type: string + description: Static IP vlc2 OAM + default: 107.239.72.156 + vlc6_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc6_Internal1 + default: 00:80:37:0E:06:12 + fsb_volume_id_0: + hidden: false + immutable: false + type: string + description: ID of Cinder Volume for FSB1 + default: 27baa6a0-b701-4795-bf5e-4f546b350b1f + sctp-b-egress-dst_end_port: + hidden: false + immutable: false + type: float + description: end_port for the SecurityGroup + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + gpb2_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb2_Internal2 + default: 00:80:37:0E:0A:22 + sctp-a-ipv6-egress_rule_application: + hidden: false + immutable: false + type: string + description: IPV6 Rule-application + default: any + sctp-b-ipv6-egress_src_start_port: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix + default: 0 + Internal2_allow_transit: + hidden: false + immutable: false + type: string + description: Allow/disallow transit internal-2 network + default: true + fsb_volume_size: + label: volume size + hidden: false + immutable: false + type: float + description: volume size 320GB + default: 320 + constraints: + - in_range: + - 0 + - 340 + sctp-b-IPv6_ethertype: + hidden: false + immutable: false + type: string + description: IPV6 ethertype + default: IPv6 + gtp_net_fqdn: + hidden: false + immutable: false + type: string + description: Network FQDN GTP + default: default-domain:vMME-24474-Ericsson-WTC-Lab-vLCP1-4:vMME-24474-Ericsson-WTC-Lab-vLCP1-4_gn_GTP_net_1 + ncb2_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to ncb2_Internal1 + default: 00:80:37:0E:0F:12 + sctp-b-ingress_rule_protocol: + hidden: false + immutable: false + type: string + description: protocol for the SecurityGroup + default: any + sctp-b-ingress_action: + hidden: false + immutable: false + type: string + description: simple_action for the SecurityGroup + default: pass + sctp-b-egress_src_addresses: + hidden: false + immutable: false + type: string + description: security_group for the SecurityGroup + default: local + gpb7_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb7_Internal2 + default: 00:80:37:0E:0F:22 + sctp-a-ipv6-ingress-dst_start_port: + hidden: false + immutable: false + type: string + description: IPV6 starting port for destination + default: 0 + gtp_net_name: + hidden: false + immutable: false + type: string + description: Network Name GTP + default: vMME-24474-Ericsson-WTC-Lab-vLCP1-4_gn_GTP_net_1 + sctp-b-ipv6-ingress_rule_application: + hidden: false + immutable: false + type: string + description: IPV6 Rule-application + default: any + domain_name: + hidden: false + immutable: false + type: string + description: Unique name of vMME contrail domain + default: default-domain + vlc5_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc5_Internal1 + default: 00:80:37:0E:05:12 + sctp-a-egress_src_addresses: + hidden: false + immutable: false + type: string + description: security_group for the SecurityGroup + default: local + sctp-b-egress-src_start_port: + hidden: false + immutable: false + type: float + description: start_port for the SecurityGroup + default: 0 + constraints: + - in_range: + - 0 + - 65535 + shc_enabled: + hidden: false + immutable: false + type: string + description: health check + default: true + sctp-b-ipv6-ingress-dst_end_port: + hidden: false + immutable: false + type: string + description: IPV6 end port + default: 65535 + sctp-b-dst_subnet_prefix_v6: + hidden: false + immutable: false + type: string + description: ip_prefix for the SecurityGroup + default: '::' + sctp_a_net_fqdn: + hidden: false + immutable: false + type: string + description: Network FQDN SCTPA + default: default-domain:vMME-24474-Ericsson-WTC-Lab-vLCP1-4:vMME-24474-Ericsson-WTC-Lab-vLCP1-4_gn_SCTPA_net_1 + security_group_gtp_id: + hidden: false + immutable: false + type: string + description: Security Group UUID for output + default: e8ad3fe2-5f95-43e4-bbcc-da97b1c22588 + sctp-a-ipv6-ingress_src_subnet_prefix: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix + default: 0.0.0.0 + fsb_name_1: + hidden: false + immutable: false + type: string + description: Name of fsb1 + default: zrdm3mmex59fsb002 + sctp-b-egress-dst_start_port: + hidden: false + immutable: false + type: float + description: start_port for the SecurityGroup + default: 0 + constraints: + - in_range: + - 0 + - 65535 + fsb_name_0: + hidden: false + immutable: false + type: string + description: Name of fsb1 + default: zrdm3mmex59fsb001 + sctp_a_net_name: + hidden: false + immutable: false + type: string + description: Network Name SCTPA + default: vMME-24474-Ericsson-WTC-Lab-vLCP1-4_gn_SCTPA_net_1 + sctp-b-egress_dst_subnet_prefix_len: + hidden: false + immutable: false + type: float + description: ip_prefix_len for the SecurityGroup + default: '0' + constraints: + - in_range: + - 0 + - 32 + gpb1_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb1_Internal1 + default: 00:80:37:0E:09:22 + sctp-a-ingress-dst_start_port: + hidden: false + immutable: false + type: float + description: start_port for the SecurityGroup + default: 0 + constraints: + - in_range: + - 0 + - 65535 + fsb1_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to fsb1_Internal2 + default: 00:80:37:0E:0B:12 + vlc_st_service_mode: + hidden: false + immutable: false + type: string + description: service mode + default: in-network-nat + sctp-a-ipv6-egress_ethertype: + hidden: false + immutable: false + type: string + description: IPV6 ethertype + default: IPv4 + sctp-a-egress-src_end_port: + hidden: false + immutable: false + type: float + description: end_port for the SecurityGroup + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + sctp-b-egress_action: + hidden: false + immutable: false + type: string + description: simple_action for the SecurityGroup + default: pass + sctp-a-ingress-src_subnet_prefix_len: + hidden: false + immutable: false + type: float + description: ip_prefix_len for the SecurityGroup + default: '0' + constraints: + - in_range: + - 0 + - 32 + sctp-a-ipv6-ingress-src_start_port: + hidden: false + immutable: false + type: float + description: IPV6 start port + default: 0 + constraints: + - in_range: + - 0 + - 65535 + vf_module_id: + hidden: false + immutable: false + type: string + description: the vf_module_id for this instance. UUID provided by ECOMP + default: TWO + Internal1_net_cidr: + hidden: false + immutable: false + type: string + description: CIDR for internal-1 network + default: 169.253.0.0 + fsb_flavor_name: + hidden: false + immutable: false + type: string + description: Flavor to use for servers fsb1 + default: nv.c8r32d1 + sctp_rule_protocol: + hidden: false + immutable: false + type: string + description: protocol for the SecurityGroup + default: 132 + vnf_name: + hidden: false + immutable: false + type: string + description: the vnf_name for this instance. provided by ECOMP + default: zrdm3mmex59 + sctp-a-IPv6_ethertype: + hidden: false + immutable: false + type: string + description: IPV6 ethertype + default: IPv6 + vlc_sctp_b_v6_ip_7: + hidden: false + immutable: false + type: string + description: Static IP vlc8 SCTPB + default: fd00:200:200:5:0:0:0:29 + vlc6_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc6_Internal2 + default: 00:80:37:0E:06:12 + sctp-b-ingress-dst_end_port: + hidden: false + immutable: false + type: float + description: end_port for the SecurityGroup + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + vlc7_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc7_Internal2 + default: 00:80:37:0E:07:12 + sctp-a-ipv6-ingress-src_end_port: + hidden: false + immutable: false + type: float + description: IPV6 ending port for destination + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + vlc_flavor_name: + hidden: false + immutable: false + type: string + description: Flavor to use for servers vlc + default: nd.c16r64d1 + sctp-b-ipv6-egress_src_addresses: + hidden: false + immutable: false + type: string + description: IPV6 source + default: local + vlc_st_interface_type_int1: + hidden: false + immutable: false + type: string + description: service_interface_type for the ServiceTemplate + default: other1 + availability_zone_0: + hidden: false + immutable: false + type: string + description: cluster for spawnning fsb instances + default: rdm3-kvm-az02 + service_instance_id_0: + hidden: false + immutable: false + type: string + description: UUID of service instance for vLCs + default: 77c67cc8-d15f-47bc-aeb1-8d65d09e917a + availability_zone_1: + hidden: false + immutable: false + type: string + description: cluster for spawnning ncb instances + default: rdm3-kvm-az02 + vlc_st_interface_type_int2: + hidden: false + immutable: false + type: string + description: service_interface_type for the ServiceTemplate + default: other2 + sctp-a-ipv6-egress-dst_start_port: + hidden: false + immutable: false + type: string + description: IPV6 start port + default: 0 + sctp-a-ipv6-egress_dst_subnet_prefix_len: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix + default: '0' + vlc_sctp_a_ip_0: + hidden: false + immutable: false + type: string + description: Static IP vlc1 SCTPA + default: 107.243.47.144 + vlc_sctp_b_route_prefixes: + hidden: false + immutable: false + type: json + description: Route prefixes for static routing on SCTPB + vlc1_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc1_Internal1 + default: 00:80:37:0E:01:12 + sctp-b-ipv6-egress_src_end_port: + hidden: false + immutable: false + type: string + description: IPV6 end port + default: 65535 + sctp-a-ipv6-egress_src_addresses: + hidden: false + immutable: false + type: string + description: IPV6 source + default: local + vlc_sctp_a_ip_7: + hidden: false + immutable: false + type: string + description: Static IP vlc8 SCTPA + default: 107.243.47.157 + sctp-a-ingress-src_subnet_prefix_v6: + hidden: false + immutable: false + type: string + description: src subnet + default: '::' + vlc_sctp_a_ip_6: + hidden: false + immutable: false + type: string + description: Static IP vlc7 SCTPA + default: 107.243.47.156 + vlc_sctp_a_ip_5: + hidden: false + immutable: false + type: string + description: Static IP vlc6 SCTPA + default: 107.243.47.155 + sctp-a-ingress-dst_end_port: + hidden: false + immutable: false + type: float + description: end_port for the SecurityGroup + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + vlc_sctp_a_ip_4: + hidden: false + immutable: false + type: string + description: Static IP vlc5 SCTPA + default: 107.243.47.154 + vlc_sctp_a_ip_3: + hidden: false + immutable: false + type: string + description: Static IP vlc4 SCTPA + default: 107.243.47.153 + vlc_sctp_a_ip_2: + hidden: false + immutable: false + type: string + description: Static IP vlc3 SCTPA + default: 107.243.47.152 + vlc_sctp_a_ip_1: + hidden: false + immutable: false + type: string + description: Static IP vlc2 SCTPA + default: 107.243.47.145 + gpb6_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb6_Internal2 + default: 00:80:37:0E:0E:22 + security_group_int2_id: + hidden: false + immutable: false + type: string + description: UUID of Internal1_net security group + default: 1361f069-baf2-4b76-b321-7f68ba26c369 + Internal2_dhcp: + hidden: false + immutable: false + type: string + description: Whether DHCP/static IP addressing on internal-2 network + default: false + sctp-a-dst_subnet_prefix_v6: + hidden: false + immutable: false + type: string + description: ip_prefix for the SecurityGroup + default: '::' + pxe_image_name: + hidden: false + immutable: false + type: string + description: Name of image to use for server ncb + default: MME_PXE-Boot_1_3_GA.qcow2 + vlc_st_interface_type_gtp: + hidden: false + immutable: false + type: string + description: service_interface_type for the ServiceTemplate + default: other0 + ncb1_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to ncb1_Internal1 + default: 00:80:37:0E:09:12 + vlc_gtp_route_prefixes: + hidden: false + immutable: false + type: json + description: Route prefixes for static routing on GTP + int1_sec_group_name: + hidden: false + immutable: false + type: string + description: SecurityGroup name for internal-1 + default: int1-sec-group + vmi_oam_preference_secondary: + hidden: false + immutable: false + type: float + description: Preference for secondary interface/port + default: 100 + Internal1_dhcp: + hidden: false + immutable: false + type: string + description: Whether DHCP/static IP addressing on internal-1 network + default: false + fsb2_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to fsb2_Internal2 + default: 00:80:37:0E:0D:12 + Internal1_net_cidr_len: + hidden: false + immutable: false + type: string + description: CIDR length for internal-1 network + default: 17 + sctp-a-ingress_dst_addresses: + hidden: false + immutable: false + type: string + description: security_group for the SecurityGroup + default: local + sctp-b-ingress-src_subnet_prefix_len: + hidden: false + immutable: false + type: float + description: ip_prefix_len for the SecurityGroup + default: '0' + constraints: + - in_range: + - 0 + - 32 + fsb_oam_ip_1: + hidden: false + immutable: false + type: string + description: IP address of OAM vNIC for FSB2 + default: 107.239.72.154 + fsb_oam_ip_0: + hidden: false + immutable: false + type: string + description: IP address of OAM vNIC for FSB1 + default: 107.239.72.153 + shc_timeout: + hidden: false + immutable: false + type: string + description: health check + default: 5 + vlc_st_version: + hidden: false + immutable: false + type: string + description: Indicates service version + default: 2 + sctp-a-src_subnet_prefix_v6: + hidden: false + immutable: false + type: string + description: ip_prefix for the SecurityGroup + default: '::' + sctp-a-ingress_rule_application: + hidden: false + immutable: false + type: string + description: application for the SecurityGroup + default: any + sctp-b-egress_ethertype: + hidden: false + immutable: false + type: string + description: ethertype for the SecurityGroup + default: IPv4 + sctp-a-ipv6-egress_src_start_port: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix + default: 0 + instance_ip_family_v6: + hidden: false + immutable: false + type: string + description: Ipv6 instance type + default: v6 + sctp-b-ingress-src_subnet_prefix_v6: + hidden: false + immutable: false + type: string + description: src subnet + default: '::' + gpb8_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb8_Internal2 + default: 00:80:37:0E:10:22 + gpb4_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb4_Internal1 + default: 00:80:37:0E:0C:22 + sctp-a-ipv6-ingress-dst_end_port: + hidden: false + immutable: false + type: string + description: IPV6 end port + default: 65535 + Internal1_net_gateway: + hidden: false + immutable: false + type: string + description: gateway for internal-1 network + default: 169.253.0.3 + sctp-b-ipv6-egress-dst_start_port: + hidden: false + immutable: false + type: string + description: IPV6 start port + default: 0 + gpb_name_7: + hidden: false + immutable: false + type: string + description: Name of gpb8 + default: zrdm3mmex59gpb0016 + gpb_name_6: + hidden: false + immutable: false + type: string + description: Name of gpb7 + default: zrdm3mmex59gpb0015 + gpb_name_5: + hidden: false + immutable: false + type: string + description: Name of gpb6 + default: zrdm3mmex59gpb0014 + gpb_name_4: + hidden: false + immutable: false + type: string + description: Name of gpb5 + default: zrdm3mmex59gpb0013 + gpb_name_3: + hidden: false + immutable: false + type: string + description: Name of gpb4 + default: zrdm3mmex59gpb0012 + sctp-a-ipv6-ingress_dst_addresses: + hidden: false + immutable: false + type: string + description: IPV6 destination + default: local + gpb_name_2: + hidden: false + immutable: false + type: string + description: Name of gpb3 + default: zrdm3mmex59gpb0011 + shc_delay: + hidden: false + immutable: false + type: string + description: health check + default: 3 + gpb_name_1: + hidden: false + immutable: false + type: string + description: Name of gpb2 + default: zrdm3mmex59gpb0010 + sctp-b-ipv6-egress_action: + hidden: false + immutable: false + type: string + description: IPV6 action + default: pass + vlc3_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc3_Internal2 + default: 00:80:37:0E:03:12 + gpb_name_0: + hidden: false + immutable: false + type: string + description: Name of gpb1 + default: zrdm3mmex59gpb009 + sctp-a-ipv6-egress_action: + hidden: false + immutable: false + type: string + description: IPV6 action + default: pass + gpb5_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb5_Internal1 + default: 00:80:37:0E:0D:22 + sctp-b-ipv6-ingress_rule_protocol: + hidden: false + immutable: false + type: string + description: IPV6 Rule-protocol + default: any + shc_max_retries: + hidden: false + immutable: false + type: string + description: health check + default: 2 + fsb_volume_type: + label: volume type + hidden: false + immutable: false + type: string + description: volume type SolidFire + default: SF-Default-SSD + sctp-a-name: + hidden: false + immutable: false + type: string + description: name for the SecurityGroup + default: epc-sctp-a-ipv4v6-sec-group + vlc_sctp_b_ip_5: + hidden: false + immutable: false + type: string + description: Static IP vlc6 SCTPB + default: 107.243.47.187 + vlc_sctp_b_ip_4: + hidden: false + immutable: false + type: string + description: Static IP vlc5 SCTPB + default: 107.243.47.186 + vlc_sctp_b_ip_3: + hidden: false + immutable: false + type: string + description: Static IP vlc4 SCTPB + default: 107.243.47.185 + vlc_sctp_b_ip_2: + hidden: false + immutable: false + type: string + description: Static IP vlc3 SCTPB + default: 107.243.47.184 + sctp-b-egress_rule_protocol: + hidden: false + immutable: false + type: string + description: protocol for the SecurityGroup + default: any + vnf_id: + hidden: false + immutable: false + type: string + description: the vf_id for this instance. UUID provided by ECOMP + default: zrdm3mmex59 + vlc_sctp_b_ip_7: + hidden: false + immutable: false + type: string + description: Static IP vlc8 SCTPB + default: 107.243.47.189 + vlc_sctp_b_ip_6: + hidden: false + immutable: false + type: string + description: Static IP vlc7 SCTPB + default: 107.243.47.188 + vlc_sctp_b_ip_1: + hidden: false + immutable: false + type: string + description: Static IP vlc2 SCTPB + default: 107.243.47.177 + gpb6_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb6_Internal1 + default: 00:80:37:0E:0E:22 + sctp-b-ipv6-egress_dst_end_port: + hidden: false + immutable: false + type: string + description: IPV6 end port + default: 65535 + vlc_sctp_b_ip_0: + hidden: false + immutable: false + type: string + description: Static IP vlc1 SCTPB + default: 107.243.47.176 + vlc2_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc2_Internal2 + default: 00:80:37:0E:02:12 + sctp-b-ingress-src_subnet_prefix: + hidden: false + immutable: false + type: string + description: ip_prefix for the SecurityGroup + default: 0.0.0.0 + gpb_flavor_name: + hidden: false + immutable: false + type: string + description: Flavor to use for servers gpb + default: nv.c20r64d1 + vlc_sctp_a_route_prefixes: + hidden: false + immutable: false + type: json + description: Route prefixes for static routing on SCTPA + sctp-b-ipv6-ingress_dst_addresses: + hidden: false + immutable: false + type: string + description: IPV6 destination + default: local + sctp-b-ipv6-ingress_ethertype: + hidden: false + immutable: false + type: string + description: IPV6 ethertype + default: IPv4 + sctp-b-ipv6-egress_dst_subnet_prefix: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix + default: 0.0.0.0 + sctp-a-ingress-src_subnet_prefix: + hidden: false + immutable: false + type: string + description: ip_prefix for the SecurityGroup + default: 0.0.0.0 + vlc1_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc1_Internal2 + default: 00:80:37:0E:01:12 + Internal1_rpf: + hidden: false + immutable: false + type: string + description: Reverse Path Forwarding Enabled/Disabled internal-1 network + default: disable + sctp-b-ingress_ethertype: + hidden: false + immutable: false + type: string + description: ethertype for the SecurityGroup + default: IPv4 + sctp-b-ingress-src_end_port: + hidden: false + immutable: false + type: float + description: end_port for the SecurityGroup + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + sctp-a-ipv6-ingress_rule_protocol: + hidden: false + immutable: false + type: string + description: IPV6 Rule-protocol + default: any + vlc_sctp_a_v6_ip_7: + hidden: false + immutable: false + type: string + description: Static IP vlc8 SCTPA + default: fd00:200:200:4:0:0:0:29 + vlc_sctp_a_v6_ip_6: + hidden: false + immutable: false + type: string + description: Static IP vlc7 SCTPA + default: fd00:200:200:4:0:0:0:28 + gpb7_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb7_Internal1 + default: 00:80:37:0E:0F:22 + vlc_sctp_a_v6_ip_5: + hidden: false + immutable: false + type: string + description: Static IP vlc6 SCTPA + default: fd00:200:200:4:0:0:0:27 + vlc_sctp_a_v6_ip_4: + hidden: false + immutable: false + type: string + description: Static IP vlc5 SCTPA + default: fd00:200:200:4:0:0:0:26 + vlc_sctp_a_v6_ip_3: + hidden: false + immutable: false + type: string + description: Static IP vlc4 SCTPA + default: fd00:200:200:4:0:0:0:25 + vlc_sctp_a_v6_ip_2: + hidden: false + immutable: false + type: string + description: Static IP vlc3 SCTPA + default: fd00:200:200:4:0:0:0:24 + sctp-a-ingress-src_start_port: + hidden: false + immutable: false + type: float + description: start_port for the SecurityGroup + default: 0 + constraints: + - in_range: + - 0 + - 65535 + vlc_sctp_a_v6_ip_1: + hidden: false + immutable: false + type: string + description: Static IP vlc2 SCTPA + default: fd00:200:200:4:0:0:0:17 + vlc_sctp_a_v6_ip_0: + hidden: false + immutable: false + type: string + description: Static IP vlc1 SCTPA + default: fd00:200:200:4:0:0:0:16 + node_templates: + abstract_gpb_2: + type: org.openecomp.resource.abstract.nodes.gpb_2 + directives: + - substitutable + properties: + port_gpb3_Internal1_replacement_policy: + - AUTO + compute_gpb_name: + - get_input: gpb_name_2 + port_gpb3_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb3_Internal2_replacement_policy: + - AUTO + vm_flavor_name: + get_input: gpb_flavor_name + port_gpb3_Internal2_security_groups: + - - get_input: security_group_int2_id + compute_gpb_scheduler_hints: + - group: + get_input: server_group_id_0 + compute_gpb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + vm_image_name: + get_input: pxe_image_name + port_gpb3_Internal1_security_groups: + - - get_input: security_group_int1_id + port_gpb3_Internal2_network: + - get_input: internal_net_id_1 + compute_gpb_availability_zone: + - get_input: availability_zone_0 + port_gpb3_Internal1_network: + - get_input: internal_net_id_0 + port_gpb3_Internal1_mac_requirements: + mac_count_required: + is_required: true + port_gpb3_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb3_Internal1_mac_address: + get_input: gpb3_Internal1_mac + port_gpb3_Internal2_mac_address: + get_input: gpb3_Internal1_mac + port_gpb3_Internal2_mac_requirements: + mac_count_required: + is_required: true + service_template_filter: + substitute_service_template: Nested_gpb_2ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: gpb + nfc_naming_code: gpb + requirements: + - link_gpb_gpb3_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_gpb_gpb3_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + abstract_vlc: + type: org.openecomp.resource.abstract.nodes.vlc + directives: + - substitutable + properties: + port_template_VMInt_SCTP_A_vlc_virtual_network_refs: + - - get_input: sctp_a_net_fqdn + port_template_VMInt_INT1_vlc_security_group_refs: + - - get_input: security_group_int1_id + vm_flavor_name: + get_input: vlc_flavor_name + port_template_VMInt_INT2_vlc_port_tuple_refs: + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc4 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc3 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc2 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc1 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc8 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc7 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc6 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc5 + vm_image_name: + get_input: pxe_image_name + port_template_VMInt_INT1_vlc_port_tuple_refs: + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc4 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc3 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc2 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc1 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc8 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc7 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc6 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc5 + port_template_VMInt_INT2_vlc_virtual_network_refs: + - - get_input: internal_net_id_1 + port_template_VMInt_OAM_vlc_virtual_network_refs: + - - get_input: oam_net_fqdn + port_template_VMInt_OAM_vlc_port_tuple_refs: + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc4 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc3 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc2 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc1 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc8 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc7 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc6 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc5 + port_template_VMInt_INT2_vlc_virtual_machine_interface_mac_addresses: + - - get_input: vlc4_Internal2_mac + - - get_input: vlc3_Internal2_mac + - - get_input: vlc2_Internal2_mac + - - get_input: vlc1_Internal2_mac + - - get_input: vlc8_Internal2_mac + - - get_input: vlc7_Internal2_mac + - - get_input: vlc6_Internal2_mac + - - get_input: vlc5_Internal2_mac + port_template_VMInt_SCTP_B_vlc_port_tuple_refs: + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc4 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc3 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc2 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc1 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc8 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc7 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc6 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc5 + port_template_VMInt_GTP_vlc_security_group_refs: + - - get_input: security_group_gtp_id + compute_vlc_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + port_template_VMInt_OAM_vlc_security_group_refs: + - - get_input: security_group_oam_id + compute_vlc_contrail_service_instance_ind: + - true + - true + - true + - true + - true + - true + - true + - true + port_template_VMInt_GTP_vlc_port_tuple_refs: + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc4 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc3 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc2 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc1 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc8 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc7 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc6 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc5 + port_template_VMInt_SCTP_B_vlc_virtual_network_refs: + - - get_input: sctp_b_net_fqdn + port_template_VMInt_INT2_vlc_security_group_refs: + - - get_input: security_group_int2_id + port_template_VMInt_SCTP_B_vlc_security_group_refs: + - - get_input: security_group_sctp_b_id + port_template_VMInt_INT1_vlc_virtual_network_refs: + - - get_input: internal_net_id_0 + port_template_VMInt_SCTP_A_vlc_port_tuple_refs: + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc4 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc3 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc2 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc1 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc8 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc7 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc6 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc5 + compute_vlc_scheduler_hints: + - group: + get_input: server_group_id_0 + - group: + get_input: server_group_id_0 + - group: + get_input: server_group_id_0 + - group: + get_input: server_group_id_0 + - group: + get_input: server_group_id_0 + - group: + get_input: server_group_id_0 + - group: + get_input: server_group_id_0 + - group: + get_input: server_group_id_0 + compute_vlc_name: + - get_input: vlc_name_3 + - get_input: vlc_name_2 + - get_input: vlc_name_1 + - get_input: vlc_name_0 + - get_input: vlc_name_7 + - get_input: vlc_name_6 + - get_input: vlc_name_5 + - get_input: vlc_name_4 + port_template_VMInt_SCTP_A_vlc_security_group_refs: + - - get_input: security_group_sctp_a_id + compute_vlc_availability_zone: + - get_input: availability_zone_1 + - get_input: availability_zone_0 + - get_input: availability_zone_1 + - get_input: availability_zone_0 + - get_input: availability_zone_1 + - get_input: availability_zone_0 + - get_input: availability_zone_1 + - get_input: availability_zone_0 + port_template_VMInt_INT1_vlc_virtual_machine_interface_mac_addresses: + - - get_input: vlc4_Internal1_mac + - - get_input: vlc3_Internal1_mac + - - get_input: vlc2_Internal1_mac + - - get_input: vlc1_Internal1_mac + - - get_input: vlc8_Internal1_mac + - - get_input: vlc7_Internal1_mac + - - get_input: vlc6_Internal1_mac + - - get_input: vlc5_Internal1_mac + port_template_VMInt_GTP_vlc_virtual_network_refs: + - - get_input: gtp_net_fqdn + service_template_filter: + substitute_service_template: Nested_vlcServiceTemplate.yaml + count: 8 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: vlc + nfc_naming_code: vlc + requirements: + - link_vlc_template_VMInt_INT2_vlc: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + - link_vlc_template_VMInt_INT1_vlc: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + abstract_gpb_7: + type: org.openecomp.resource.abstract.nodes.gpb_7 + directives: + - substitutable + properties: + compute_gpb_name: + - get_input: gpb_name_7 + port_gpb8_Internal1_mac_address: + get_input: gpb8_Internal1_mac + port_gpb8_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + vm_flavor_name: + get_input: gpb_flavor_name + compute_gpb_scheduler_hints: + - group: + get_input: server_group_id_0 + compute_gpb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + vm_image_name: + get_input: pxe_image_name + port_gpb8_Internal2_security_groups: + - - get_input: security_group_int2_id + port_gpb8_Internal1_replacement_policy: + - AUTO + port_gpb8_Internal2_replacement_policy: + - AUTO + compute_gpb_availability_zone: + - get_input: availability_zone_1 + port_gpb8_Internal1_mac_requirements: + mac_count_required: + is_required: true + port_gpb8_Internal1_network: + - get_input: internal_net_id_0 + port_gpb8_Internal2_mac_requirements: + mac_count_required: + is_required: true + port_gpb8_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb8_Internal1_security_groups: + - - get_input: security_group_int1_id + port_gpb8_Internal2_network: + - get_input: internal_net_id_1 + port_gpb8_Internal2_mac_address: + get_input: gpb8_Internal1_mac + service_template_filter: + substitute_service_template: Nested_gpb_7ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: gpb + nfc_naming_code: gpb + requirements: + - link_gpb_gpb8_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_gpb_gpb8_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + abstract_gpb_5: + type: org.openecomp.resource.abstract.nodes.gpb_5 + directives: + - substitutable + properties: + port_gpb6_Internal1_mac_requirements: + mac_count_required: + is_required: true + compute_gpb_name: + - get_input: gpb_name_5 + vm_flavor_name: + get_input: gpb_flavor_name + compute_gpb_scheduler_hints: + - group: + get_input: server_group_id_0 + compute_gpb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + port_gpb6_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + vm_image_name: + get_input: pxe_image_name + port_gpb6_Internal1_security_groups: + - - get_input: security_group_int1_id + port_gpb6_Internal2_network: + - get_input: internal_net_id_1 + compute_gpb_availability_zone: + - get_input: availability_zone_1 + port_gpb6_Internal1_network: + - get_input: internal_net_id_0 + port_gpb6_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb6_Internal2_mac_address: + get_input: gpb6_Internal1_mac + port_gpb6_Internal1_mac_address: + get_input: gpb6_Internal1_mac + port_gpb6_Internal2_mac_requirements: + mac_count_required: + is_required: true + port_gpb6_Internal2_replacement_policy: + - AUTO + port_gpb6_Internal1_replacement_policy: + - AUTO + port_gpb6_Internal2_security_groups: + - - get_input: security_group_int2_id + service_template_filter: + substitute_service_template: Nested_gpb_5ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: gpb + nfc_naming_code: gpb + requirements: + - link_gpb_gpb6_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_gpb_gpb6_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + abstract_gpb_6: + type: org.openecomp.resource.abstract.nodes.gpb_6 + directives: + - substitutable + properties: + port_gpb7_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb7_Internal1_network: + - get_input: internal_net_id_0 + compute_gpb_name: + - get_input: gpb_name_6 + port_gpb7_Internal2_network: + - get_input: internal_net_id_1 + vm_flavor_name: + get_input: gpb_flavor_name + port_gpb7_Internal1_replacement_policy: + - AUTO + port_gpb7_Internal2_replacement_policy: + - AUTO + port_gpb7_Internal2_security_groups: + - - get_input: security_group_int2_id + compute_gpb_scheduler_hints: + - group: + get_input: server_group_id_0 + compute_gpb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + vm_image_name: + get_input: pxe_image_name + port_gpb7_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb7_Internal1_security_groups: + - - get_input: security_group_int1_id + compute_gpb_availability_zone: + - get_input: availability_zone_0 + port_gpb7_Internal2_mac_address: + get_input: gpb7_Internal1_mac + port_gpb7_Internal1_mac_requirements: + mac_count_required: + is_required: true + port_gpb7_Internal1_mac_address: + get_input: gpb7_Internal1_mac + port_gpb7_Internal2_mac_requirements: + mac_count_required: + is_required: true + service_template_filter: + substitute_service_template: Nested_gpb_6ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: gpb + nfc_naming_code: gpb + requirements: + - link_gpb_gpb7_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_gpb_gpb7_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + abstract_gpb_3: + type: org.openecomp.resource.abstract.nodes.gpb_3 + directives: + - substitutable + properties: + compute_gpb_name: + - get_input: gpb_name_3 + port_gpb4_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + vm_flavor_name: + get_input: gpb_flavor_name + port_gpb4_Internal1_mac_address: + get_input: gpb4_Internal1_mac + compute_gpb_scheduler_hints: + - group: + get_input: server_group_id_0 + port_gpb4_Internal2_mac_requirements: + mac_count_required: + is_required: true + compute_gpb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + port_gpb4_Internal2_mac_address: + get_input: gpb4_Internal1_mac + vm_image_name: + get_input: pxe_image_name + port_gpb4_Internal2_security_groups: + - - get_input: security_group_int2_id + compute_gpb_availability_zone: + - get_input: availability_zone_1 + port_gpb4_Internal2_replacement_policy: + - AUTO + port_gpb4_Internal1_replacement_policy: + - AUTO + port_gpb4_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb4_Internal1_security_groups: + - - get_input: security_group_int1_id + port_gpb4_Internal2_network: + - get_input: internal_net_id_1 + port_gpb4_Internal1_mac_requirements: + mac_count_required: + is_required: true + port_gpb4_Internal1_network: + - get_input: internal_net_id_0 + service_template_filter: + substitute_service_template: Nested_gpb_3ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: gpb + nfc_naming_code: gpb + requirements: + - link_gpb_gpb4_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_gpb_gpb4_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + abstract_gpb_4: + type: org.openecomp.resource.abstract.nodes.gpb_4 + directives: + - substitutable + properties: + port_gpb5_Internal2_mac_requirements: + mac_count_required: + is_required: true + port_gpb5_Internal1_security_groups: + - - get_input: security_group_int1_id + compute_gpb_name: + - get_input: gpb_name_4 + vm_flavor_name: + get_input: gpb_flavor_name + port_gpb5_Internal1_mac_requirements: + mac_count_required: + is_required: true + compute_gpb_scheduler_hints: + - group: + get_input: server_group_id_0 + port_gpb5_Internal2_network: + - get_input: internal_net_id_1 + compute_gpb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + vm_image_name: + get_input: pxe_image_name + port_gpb5_Internal1_network: + - get_input: internal_net_id_0 + port_gpb5_Internal2_mac_address: + get_input: gpb5_Internal1_mac + port_gpb5_Internal1_mac_address: + get_input: gpb5_Internal1_mac + port_gpb5_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb5_Internal2_replacement_policy: + - AUTO + compute_gpb_availability_zone: + - get_input: availability_zone_0 + port_gpb5_Internal1_replacement_policy: + - AUTO + port_gpb5_Internal2_security_groups: + - - get_input: security_group_int2_id + port_gpb5_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + service_template_filter: + substitute_service_template: Nested_gpb_4ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: gpb + nfc_naming_code: gpb + requirements: + - link_gpb_gpb5_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_gpb_gpb5_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + abstract_gpb: + type: org.openecomp.resource.abstract.nodes.gpb + directives: + - substitutable + properties: + port_gpb1_Internal1_security_groups: + - - get_input: security_group_int1_id + compute_gpb_name: + - get_input: gpb_name_0 + port_gpb1_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + vm_flavor_name: + get_input: gpb_flavor_name + port_gpb1_Internal1_mac_requirements: + mac_count_required: + is_required: true + compute_gpb_scheduler_hints: + - group: + get_input: server_group_id_0 + compute_gpb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + vm_image_name: + get_input: pxe_image_name + port_gpb1_Internal1_mac_address: + get_input: gpb1_Internal1_mac + port_gpb1_Internal2_mac_address: + get_input: gpb1_Internal1_mac + port_gpb1_Internal2_mac_requirements: + mac_count_required: + is_required: true + compute_gpb_availability_zone: + - get_input: availability_zone_0 + port_gpb1_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb1_Internal2_security_groups: + - - get_input: security_group_int2_id + port_gpb1_Internal1_replacement_policy: + - AUTO + port_gpb1_Internal2_replacement_policy: + - AUTO + port_gpb1_Internal2_network: + - get_input: internal_net_id_1 + port_gpb1_Internal1_network: + - get_input: internal_net_id_0 + service_template_filter: + substitute_service_template: Nested_gpbServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: gpb + nfc_naming_code: gpb + requirements: + - link_gpb_gpb1_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_gpb_gpb1_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + Internal1_net: + type: org.openecomp.resource.vl.nodes.heat.network.contrailV2.VirtualNetwork + properties: + network_ipam_refs_data: + - network_ipam_refs_data_ipam_subnets: + - network_ipam_refs_data_ipam_subnets_enable_dhcp: + get_input: Internal1_dhcp + network_ipam_refs_data_ipam_subnets_default_gateway: + get_input: Internal1_net_gateway + network_ipam_refs_data_ipam_subnets_subnet: + network_ipam_refs_data_ipam_subnets_subnet_ip_prefix_len: + get_input: Internal1_net_cidr_len + network_ipam_refs_data_ipam_subnets_subnet_ip_prefix: + get_input: Internal1_net_cidr + network_name: + str_replace: + template: $VNF_NAME_int_net_1 + params: + $VNF_NAME: + get_input: vnf_name + network_ipam_refs: + - UNSUPPORTED_RESOURCE_template_NetworkIpam_Internal1 + abstract_fsb: + type: org.openecomp.resource.abstract.nodes.fsb + directives: + - substitutable + properties: + port_FSB1_Internal1_mac_address: + get_input: fsb1_Internal1_mac + port_FSB_OAM_network_role_tag: + - oam + port_FSB1_Internal2_network: + - Internal2_net + port_FSB1_Internal1_network: + - Internal1_net + vm_flavor_name: + get_input: fsb_flavor_name + port_FSB1_Internal2_mac_address: + get_input: fsb1_Internal1_mac + port_FSB_OAM_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: true + floating_ip_count_required: + is_required: false + compute_fsb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + port_FSB1_Internal1_security_groups: + - - int1_security_group + port_FSB1_Internal2_replacement_policy: + - AUTO + compute_fsb_scheduler_hints: + - group: VM_Affinity_group + port_FSB1_Internal1_replacement_policy: + - AUTO + compute_fsb_name: + - get_input: fsb_name_0 + port_FSB1_Internal1_mac_requirements: + mac_count_required: + is_required: true + port_FSB1_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_FSB_OAM_network: + - get_input: oam_net_name + port_FSB_OAM_security_groups: + - - oam_security_group + port_FSB_OAM_mac_requirements: + mac_count_required: + is_required: false + port_FSB_OAM_replacement_policy: + - AUTO + compute_fsb_availability_zone: + - get_input: availability_zone_0 + port_FSB1_Internal2_security_groups: + - - int2_security_group + port_FSB1_Internal2_mac_requirements: + mac_count_required: + is_required: true + port_FSB1_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_FSB_OAM_fixed_ips: + - ip_address: + get_input: fsb_oam_ip_0 + service_template_filter: + substitute_service_template: Nested_fsbServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: fsb + nfc_naming_code: fsb + requirements: + - link_fsb_FSB1_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_fsb_FSB1_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + gtp_security_group: + type: org.openecomp.resource.vfc.rules.nodes.heat.network.neutron.SecurityRules + properties: + name: + str_replace: + template: $VNF_NAME_$SECGROUPNAME + params: + $SECGROUPNAME: + get_input: gtp_sec_group_name + $VNF_NAME: + get_input: vnf_name + rules: + - protocol: tcp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: udp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: icmp + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + - protocol: tcp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: udp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: icmp + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + abstract_ncb_1: + type: org.openecomp.resource.abstract.nodes.ncb_1 + directives: + - substitutable + properties: + port_NCB2_Internal2_security_groups: + - - int2_security_group + port_NCB2_Internal1_replacement_policy: + - AUTO + port_NCB2_Internal2_replacement_policy: + - AUTO + vm_flavor_name: + get_input: ncb_flavor_name + port_NCB2_Internal2_mac_requirements: + mac_count_required: + is_required: true + port_NCB2_Internal1_mac_requirements: + mac_count_required: + is_required: true + vm_image_name: + get_input: pxe_image_name + compute_ncb_scheduler_hints: + - group: VM_Affinity_group + compute_ncb_availability_zone: + - get_input: availability_zone_1 + port_NCB2_Internal1_network: + - Internal1_net + port_NCB2_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_NCB2_Internal1_security_groups: + - - int1_security_group + port_NCB2_Internal2_network: + - Internal2_net + port_NCB2_Internal1_mac_address: + get_input: ncb2_Internal1_mac + port_NCB2_Internal2_mac_address: + get_input: ncb2_Internal1_mac + compute_ncb_name: + - get_input: ncb_name_1 + compute_ncb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + port_NCB2_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + service_template_filter: + substitute_service_template: Nested_ncb_1ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: ncb + nfc_naming_code: ncb + requirements: + - link_ncb_NCB2_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_ncb_NCB2_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + abstract_ncb: + type: org.openecomp.resource.abstract.nodes.ncb + directives: + - substitutable + properties: + vm_flavor_name: + get_input: ncb_flavor_name + port_NCB1_Internal2_mac_requirements: + mac_count_required: + is_required: true + vm_image_name: + get_input: pxe_image_name + port_NCB1_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + compute_ncb_scheduler_hints: + - group: VM_Affinity_group + port_NCB1_Internal1_security_groups: + - - int1_security_group + compute_ncb_availability_zone: + - get_input: availability_zone_0 + port_NCB1_Internal2_mac_address: + get_input: ncb1_Internal1_mac + port_NCB1_Internal1_mac_address: + get_input: ncb1_Internal1_mac + port_NCB1_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_NCB1_Internal1_mac_requirements: + mac_count_required: + is_required: true + port_NCB1_Internal2_replacement_policy: + - AUTO + port_NCB1_Internal1_network: + - Internal1_net + port_NCB1_Internal2_security_groups: + - - int2_security_group + port_NCB1_Internal1_replacement_policy: + - AUTO + compute_ncb_name: + - get_input: ncb_name_0 + compute_ncb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + port_NCB1_Internal2_network: + - Internal2_net + service_template_filter: + substitute_service_template: Nested_ncbServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: ncb + nfc_naming_code: ncb + requirements: + - link_ncb_NCB1_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_ncb_NCB1_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + int1_security_group: + type: org.openecomp.resource.vfc.rules.nodes.heat.network.neutron.SecurityRules + properties: + name: + str_replace: + template: $VNF_NAME_$SECGROUPNAME + params: + $SECGROUPNAME: + get_input: int1_sec_group_name + $VNF_NAME: + get_input: vnf_name + rules: + - protocol: tcp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: udp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: icmp + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + - protocol: tcp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: udp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: icmp + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + requirements: + - port: + capability: attachment_fsb_FSB1_Internal1 + node: abstract_fsb + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_fsb_FSB2_Internal1 + node: abstract_fsb_1 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_ncb_NCB1_Internal1 + node: abstract_ncb + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_ncb_NCB2_Internal1 + node: abstract_ncb_1 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb1_Internal1 + node: abstract_gpb + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb2_Internal1 + node: abstract_gpb_1 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb3_Internal1 + node: abstract_gpb_2 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb4_Internal1 + node: abstract_gpb_3 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb5_Internal1 + node: abstract_gpb_4 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb6_Internal1 + node: abstract_gpb_5 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb7_Internal1 + node: abstract_gpb_6 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb8_Internal1 + node: abstract_gpb_7 + relationship: org.openecomp.relationships.AttachesTo + fsb_volume_0: + type: org.openecomp.resource.vfc.nodes.heat.cinder.Volume + properties: + image: + get_input: fsb_volume_image_name_0 + volume_type: + get_input: fsb_volume_type + size: '(get_input : fsb_volume_size) * 1024' + name: + list_join: + - _ + - - get_input: OS::stack_name + - FSB1_Vol_1 + fsb_volume_1: + type: org.openecomp.resource.vfc.nodes.heat.cinder.Volume + properties: + image: + get_input: fsb_volume_image_name_1 + volume_type: + get_input: fsb_volume_type + size: '(get_input : fsb_volume_size) * 1024' + name: + list_join: + - _ + - - get_input: OS::stack_name + - FSB2_Vol_1 + Internal2_net: + type: org.openecomp.resource.vl.nodes.heat.network.contrailV2.VirtualNetwork + properties: + network_ipam_refs_data: + - network_ipam_refs_data_ipam_subnets: + - network_ipam_refs_data_ipam_subnets_enable_dhcp: + get_input: Internal2_dhcp + network_ipam_refs_data_ipam_subnets_default_gateway: + get_input: Internal2_net_gateway + network_ipam_refs_data_ipam_subnets_subnet: + network_ipam_refs_data_ipam_subnets_subnet_ip_prefix_len: + get_input: Internal2_net_cidr_len + network_ipam_refs_data_ipam_subnets_subnet_ip_prefix: + get_input: Internal2_net_cidr + network_name: + str_replace: + template: $VNF_NAME_int_net_2 + params: + $VNF_NAME: + get_input: vnf_name + network_ipam_refs: + - UNSUPPORTED_RESOURCE_template_NetworkIpam_Internal2 + int2_security_group: + type: org.openecomp.resource.vfc.rules.nodes.heat.network.neutron.SecurityRules + properties: + name: + str_replace: + template: $VNF_NAME_$SECGROUPNAME + params: + $SECGROUPNAME: + get_input: int2_sec_group_name + $VNF_NAME: + get_input: vnf_name + rules: + - protocol: tcp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: udp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: 132 + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: icmp + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + - protocol: tcp + ethertype: IPv6 + port_range_max: 65535 + remote_ip_prefix: ::/0 + direction: egress + port_range_min: 1 + - protocol: udp + ethertype: IPv6 + port_range_max: 65535 + remote_ip_prefix: ::/0 + direction: egress + port_range_min: 1 + - protocol: 132 + ethertype: IPv6 + port_range_max: 65535 + remote_ip_prefix: ::/0 + direction: egress + port_range_min: 1 + - protocol: icmp + ethertype: IPv6 + remote_ip_prefix: ::/0 + direction: egress + - protocol: tcp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: udp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: 132 + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: icmp + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + - protocol: tcp + ethertype: IPv6 + port_range_max: 65535 + remote_ip_prefix: ::/0 + direction: ingress + port_range_min: 1 + - protocol: udp + ethertype: IPv6 + port_range_max: 65535 + remote_ip_prefix: ::/0 + direction: ingress + port_range_min: 1 + - protocol: 132 + ethertype: IPv6 + port_range_max: 65535 + remote_ip_prefix: ::/0 + direction: ingress + port_range_min: 1 + - protocol: icmp + ethertype: IPv6 + remote_ip_prefix: ::/0 + direction: ingress + requirements: + - port: + capability: attachment_fsb_FSB1_Internal2 + node: abstract_fsb + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_fsb_FSB2_Internal2 + node: abstract_fsb_1 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_ncb_NCB1_Internal2 + node: abstract_ncb + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_ncb_NCB2_Internal2 + node: abstract_ncb_1 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb1_Internal2 + node: abstract_gpb + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb2_Internal2 + node: abstract_gpb_1 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb3_Internal2 + node: abstract_gpb_2 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb4_Internal2 + node: abstract_gpb_3 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb5_Internal2 + node: abstract_gpb_4 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb6_Internal2 + node: abstract_gpb_5 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb7_Internal2 + node: abstract_gpb_6 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb8_Internal2 + node: abstract_gpb_7 + relationship: org.openecomp.relationships.AttachesTo + abstract_fsb_1: + type: org.openecomp.resource.abstract.nodes.fsb_1 + directives: + - substitutable + properties: + port_FSB_OAM_network_role_tag: + - oam + vm_flavor_name: + get_input: fsb_flavor_name + port_FSB_OAM_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: true + floating_ip_count_required: + is_required: false + port_FSB2_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_FSB2_Internal2_security_groups: + - - int2_security_group + compute_fsb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + port_FSB2_Internal1_mac_address: + get_input: fsb2_Internal1_mac + compute_fsb_scheduler_hints: + - group: VM_Affinity_group + compute_fsb_name: + - get_input: fsb_name_1 + port_FSB2_Internal1_security_groups: + - - int1_security_group + port_FSB_OAM_network: + - get_input: oam_net_name + port_FSB_OAM_security_groups: + - - oam_security_group + port_FSB2_Internal1_network: + - Internal1_net + port_FSB2_Internal2_mac_address: + get_input: fsb2_Internal1_mac + port_FSB2_Internal2_mac_requirements: + mac_count_required: + is_required: true + port_FSB_OAM_mac_requirements: + mac_count_required: + is_required: false + port_FSB2_Internal2_replacement_policy: + - AUTO + port_FSB2_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_FSB_OAM_replacement_policy: + - AUTO + port_FSB2_Internal2_network: + - Internal2_net + port_FSB2_Internal1_replacement_policy: + - AUTO + compute_fsb_availability_zone: + - get_input: availability_zone_1 + port_FSB_OAM_fixed_ips: + - ip_address: + get_input: fsb_oam_ip_1 + port_FSB2_Internal1_mac_requirements: + mac_count_required: + is_required: true + service_template_filter: + substitute_service_template: Nested_fsb_1ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: fsb + nfc_naming_code: fsb + requirements: + - link_fsb_FSB2_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_fsb_FSB2_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + oam_security_group: + type: org.openecomp.resource.vfc.rules.nodes.heat.network.neutron.SecurityRules + properties: + name: + str_replace: + template: $VNF_NAME_$SECGROUPNAME + params: + $SECGROUPNAME: + get_input: oam_sec_group_name + $VNF_NAME: + get_input: vnf_name + rules: + - protocol: tcp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: udp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: icmp + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + - protocol: tcp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: udp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: icmp + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + requirements: + - port: + capability: attachment_fsb_FSB_OAM + node: abstract_fsb + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_fsb_FSB_OAM + node: abstract_fsb_1 + relationship: org.openecomp.relationships.AttachesTo + groups: + vmme_gpb3_group: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/vmme_gpb3.yml + description: | + Module HOT template to create vmme 1-8 gpb + members: + - abstract_gpb + - abstract_gpb_1 + - abstract_gpb_2 + - abstract_gpb_3 + - abstract_gpb_4 + - abstract_gpb_5 + - abstract_gpb_6 + - abstract_gpb_7 + base_vmme_group: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/base_vmme.yml + description: | + Base HOT template to create vmme 2 fsb 2 ncb + members: + - int2_security_group + - oam_security_group + - gtp_security_group + - Internal2_net + - int1_security_group + - Internal1_net + - abstract_ncb + - abstract_ncb_1 + - abstract_fsb + - abstract_fsb_1 + base_vmme_volume_group: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/base_vmme_volume.yml + description: HOT template for vMME Cinder Volumes + members: + - fsb_volume_0 + - fsb_volume_1 + vmme_gpb1_group: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/vmme_gpb1.yml + description: | + Module HOT template to create vmme 1-8 gpb + members: + - abstract_gpb + - abstract_gpb_1 + - abstract_gpb_2 + - abstract_gpb_3 + - abstract_gpb_4 + - abstract_gpb_5 + - abstract_gpb_6 + - abstract_gpb_7 + vmme_gpb4_group: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/vmme_gpb4.yml + description: | + Module HOT template to create vmme 1-8 gpb + members: + - abstract_gpb + - abstract_gpb_1 + - abstract_gpb_2 + - abstract_gpb_3 + - abstract_gpb_4 + - abstract_gpb_5 + - abstract_gpb_6 + - abstract_gpb_7 + vmme_gpb2_group: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/vmme_gpb2.yml + description: | + Module HOT template to create vmme 1-8 gpb + members: + - abstract_gpb + - abstract_gpb_1 + - abstract_gpb_2 + - abstract_gpb_3 + - abstract_gpb_4 + - abstract_gpb_5 + - abstract_gpb_6 + - abstract_gpb_7 + VM_Affinity_group: + type: tosca.groups.Root + members: + - abstract_ncb + - abstract_ncb_1 + - abstract_vlc + - abstract_fsb + - abstract_fsb_1 + - abstract_gpb + - abstract_gpb_1 + - abstract_gpb_2 + - abstract_gpb_3 + - abstract_gpb_4 + - abstract_gpb_5 + - abstract_gpb_6 + - abstract_gpb_7 + vmme_vlc_group: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/vmme_vlc.yml + description: | + Module HOT template to create vmme 8 vlcs + members: + - abstract_vlc + outputs: + oam_management_v4_address: + description: ID of OAM VIP to be provisioned in A&AI + value: + get_input: vip_oam_management_v4_ip + fsb_volume_id_1: + description: ID of Cinder Volume for FSB2 + value: fsb_volume_1 + security_group_sctp_b_id: + description: ID of sctpb_security_group + value: UNSUPPORTED_RESOURCE_sctpb_security_group + service_instance_id_0: + description: ID of Service Instance used for vLCs + value: UNSUPPORTED_RESOURCE_template_ServiceInstance_VLC + security_group_sctp_a_id: + description: ID of sctpa_security_group + value: UNSUPPORTED_RESOURCE_sctpa_security_group + fsb_volume_id_0: + description: ID of Cinder Volume for FSB1 + value: fsb_volume_0 + policies: + VM_Affinity_policy: + type: org.openecomp.policies.placement.Antilocate + properties: + container_type: host + targets: + - VM_Affinity_group @@ -0,0 +1,3581 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +metadata: + template_name: Main +imports: +- openecomp_heat_index: + file: openecomp-heat/_index.yml +- GlobalSubstitutionTypes: + file: GlobalSubstitutionTypesServiceTemplate.yaml +topology_template: + inputs: + vlc4_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc4_Internal2 + default: 00:80:37:0E:04:12 + sctp-a-egress_rule_application: + hidden: false + immutable: false + type: string + description: application for the SecurityGroup + default: any + sctp-b-ipv6-ingress-src_start_port: + hidden: false + immutable: false + type: float + description: IPV6 start port + default: 0 + constraints: + - in_range: + - 0 + - 65535 + ncb1_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to ncb1_Internal2 + default: 00:80:37:0E:09:12 + sctp-a-ipv6-ingress_ethertype: + hidden: false + immutable: false + type: string + description: IPV6 ethertype + default: IPv4 + gpb8_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb8_Internal1 + default: 00:80:37:0E:10:22 + sctp-a-ingress_rule_protocol: + hidden: false + immutable: false + type: string + description: protocol for the SecurityGroup + default: any + sctp-b-display_name: + hidden: false + immutable: false + type: string + description: display_name for the SecurityGroup + default: epc-sctp-b-ipv4v6-sec-group + sctp-a-ingress_ethertype: + hidden: false + immutable: false + type: string + description: ethertype for the SecurityGroup + default: IPv4 + sctp-a-egress-src_start_port: + hidden: false + immutable: false + type: float + description: start_port for the SecurityGroup + default: 0 + constraints: + - in_range: + - 0 + - 65535 + ncb_flavor_name: + hidden: false + immutable: false + type: string + description: Flavor to use for servers ncb + default: nv.c8r32d1 + vlc3_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc3_Internal1 + default: 00:80:37:0E:03:12 + Internal2_net_cidr: + hidden: false + immutable: false + type: string + description: CIDR for internal-2 network + default: 169.255.0.0 + sctp-a-egress-dst_start_port: + hidden: false + immutable: false + type: float + description: start_port for the SecurityGroup + default: 0 + constraints: + - in_range: + - 0 + - 65535 + sctp-a-egress_ethertype: + hidden: false + immutable: false + type: string + description: ethertype for the SecurityGroup + default: IPv4 + gpb4_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb4_Internal2 + default: 00:80:37:0E:0C:22 + sctp-b-ipv6-egress_rule_application: + hidden: false + immutable: false + type: string + description: IPV6 Rule-application + default: any + vlc8_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc8_Internal1 + default: 00:80:37:0E:08:12 + sctp-b-ipv6-ingress-src_end_port: + hidden: false + immutable: false + type: float + description: IPV6 ending port for destination + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + fsb2_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to fsb2_Internal1 + default: 00:80:37:0E:0D:12 + sctp-b-name: + hidden: false + immutable: false + type: string + description: name for the SecurityGroup + default: epc-sctp-b-ipv4v6-sec-group + sctp-b-ipv6-egress_ethertype: + hidden: false + immutable: false + type: string + description: IPV6 ethertype + default: IPv4 + internal_net_id_1: + hidden: false + immutable: false + type: string + description: UUID of Internal2_net + default: e3397c69-a942-49aa-81cb-fb91ff34abc8 + sctp-a-egress_dst_subnet_prefix: + hidden: false + immutable: false + type: string + description: ip_prefix for the SecurityGroup + default: 0.0.0.0 + internal_net_id_0: + hidden: false + immutable: false + type: string + description: UUID of Internal1_net + default: 871de971-22ac-47b6-befb-50e7d4cb67ea + sctp_b_net_fqdn: + hidden: false + immutable: false + type: string + description: Network FQDN SCTPB + default: default-domain:vMME-24474-Ericsson-WTC-Lab-vLCP1-4:vMME-24474-Ericsson-WTC-Lab-vLCP1-4_gn_SCTPB_net_1 + sctp-a-ipv6-ingress_rule_application: + hidden: false + immutable: false + type: string + description: IPV6 Rule-application + default: any + sctp-b-ipv6-ingress_src_subnet_prefix_len: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix length + default: '0' + ncb_name_1: + hidden: false + immutable: false + type: string + description: Name of ncb2 + default: zrdm3mmex59ncb002 + ncb_name_0: + hidden: false + immutable: false + type: string + description: Name of ncb1 + default: zrdm3mmex59ncb001 + vlc_st_virtualization_type: + hidden: false + immutable: false + type: string + description: Indicates virtualization type + default: virtual-machine + vlc2_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc2_Internal1 + default: 00:80:37:0E:02:12 + sctp-b-ingress-dst_start_port: + hidden: false + immutable: false + type: float + description: start_port for the SecurityGroup + default: 0 + constraints: + - in_range: + - 0 + - 65535 + sctp-a-display_name: + hidden: false + immutable: false + type: string + description: display_name for the SecurityGroup + default: epc-sctp-a-ipv4v6-sec-group + sctp-b-ingress_rule_application: + hidden: false + immutable: false + type: string + description: application for the SecurityGroup + default: any + int2_sec_group_name: + hidden: false + immutable: false + type: string + description: SecurityGroup name for internal-2 + default: int2-sec-group + gpb5_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb5_Internal2 + default: 00:80:37:0E:0D:22 + sctp-a-egress-dst_subnet_prefix_v6: + hidden: false + immutable: false + type: string + description: dst subnet + default: '::' + OS::stack_name: + type: string + required: false + sctp-b-egress-src_end_port: + hidden: false + immutable: false + type: float + description: end_port for the SecurityGroup + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + Internal2_shared: + hidden: false + immutable: false + type: string + description: Whether Shared or private internal-2 network + default: false + sctp-a-ipv6-egress_rule_protocol: + hidden: false + immutable: false + type: string + description: IPV6 Rule-protocol + default: any + Internal2_rpf: + hidden: false + immutable: false + type: string + description: Reverse Path Forwarding Enabled/Disabled internal-2 network + default: disable + vlc5_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc5_Internal2 + default: 00:80:37:0E:05:12 + sctp-a-ipv6-egress_src_end_port: + hidden: false + immutable: false + type: string + description: IPV6 end port + default: 65535 + Internal1_forwarding_mode: + hidden: false + immutable: false + type: string + description: L2 or L3 forwarding mode for internal-1 network + default: l2 + gpb3_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb3_Internal1 + default: 00:80:37:0E:0B:22 + vip_oam_management_v4_ip: + hidden: false + immutable: false + type: string + description: IP address of OAM service IP address to be provisioned in A&AI + default: 107.239.72.176 + vmi_oam_preference_primary: + hidden: false + immutable: false + type: float + description: Preference for primary interface/port + default: 200 + sctp-b-src_subnet_prefix_v6: + hidden: false + immutable: false + type: string + description: ip_prefix for the SecurityGroup + default: '::' + sctp-a-egress_dst_subnet_prefix_len: + hidden: false + immutable: false + type: float + description: ip_prefix_len for the SecurityGroup + default: '0' + constraints: + - in_range: + - 0 + - 32 + security_group_sctp_b_id: + hidden: false + immutable: false + type: string + description: Security Group UUID for output + default: 92a4ae54-1733-4d03-b488-f178bb9f7b82 + Internal2_forwarding_mode: + hidden: false + immutable: false + type: string + description: L2 or L3 forwarding mode for internal-2 network + default: l2 + sctp-a-ipv6-egress_dst_end_port: + hidden: false + immutable: false + type: string + description: IPV6 end port + default: 65535 + sctp-b-egress-dst_subnet_prefix_v6: + hidden: false + immutable: false + type: string + description: dst subnet + default: '::' + sctp-b-egress_dst_subnet_prefix: + hidden: false + immutable: false + type: string + description: ip_prefix for the SecurityGroup + default: 0.0.0.0 + security_group_oam_id: + hidden: false + immutable: false + type: string + description: Security Group UUID for output + default: 4ae4aa74-3e8e-4f2b-8b5f-a8bd262da96b + gpb2_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb2_Internal1 + default: 00:80:37:0E:0A:22 + security_group_int1_id: + hidden: false + immutable: false + type: string + description: UUID of Internal1_net security group + default: 94c62578-835d-4801-9372-70a2cfb22683 + sctp-a-egress_action: + hidden: false + immutable: false + type: string + description: simple_action for the SecurityGroup + default: pass + oam_net_fqdn: + hidden: false + immutable: false + type: string + description: Network FQDN OAM + default: default-domain:vMME-24474-Ericsson-WTC-Lab-vLCP1-4:vMME-24474-Ericsson-WTC-Lab-vLCP1-4_OAM_net_1 + ncb2_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to ncb2_Internal2 + default: 00:80:37:0E:0F:12 + vlc_st_interface_type_sctp_a: + hidden: false + immutable: false + type: string + description: service_interface_type for the ServiceTemplate + default: left + gpb3_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb3_Internal2 + default: 00:80:37:0E:0B:22 + vlc_st_interface_type_sctp_b: + hidden: false + immutable: false + type: string + description: service_interface_type for the ServiceTemplate + default: right + gpb1_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb1_Internal2 + default: 00:80:37:0E:09:22 + oam_net_name: + hidden: false + immutable: false + type: string + description: Network Name OAM + default: vMME-24474-Ericsson-WTC-Lab-vLCP1-4_OAM_net_1 + sctp-b-ingress-src_start_port: + hidden: false + immutable: false + type: float + description: start_port for the SecurityGroup + default: 0 + constraints: + - in_range: + - 0 + - 65535 + fsb1_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to fsb1_Internal1 + default: 00:80:37:0E:0B:12 + sctp-b-ingress_dst_addresses: + hidden: false + immutable: false + type: string + description: security_group for the SecurityGroup + default: local + vlc_st_interface_type_oam: + hidden: false + immutable: false + type: string + description: service_interface_type for the ServiceTemplate + default: management + shc_monitor_type: + hidden: false + immutable: false + type: string + description: health check + default: PING + oam_sec_group_name: + hidden: false + immutable: false + type: string + description: SecurityGroup name for OAM + default: oam-sec-group + Internal2_net_gateway: + hidden: false + immutable: false + type: string + description: gateway for internal-2 network + default: 169.255.0.3 + evac_policy: + hidden: false + immutable: false + type: string + description: CMHA Policy + default: Evacuate + server_group_id_0: + hidden: false + immutable: false + type: string + description: ID of Anti-Affinity Policy-based Server Group + default: ec99a73d-38f8-4280-8103-ba8ee584629f + vlc8_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc8_Internal2 + default: 00:80:37:0E:08:12 + sctp-b-ipv6-egress_rule_protocol: + hidden: false + immutable: false + type: string + description: IPV6 Rule-protocol + default: any + gtp_sec_group_name: + hidden: false + immutable: false + type: string + description: SecurityGroup name for GTP + default: gtp-sec-group + vlc_sctp_b_v6_ip_2: + hidden: false + immutable: false + type: string + description: Static IP vlc3 SCTPB + default: fd00:200:200:5:0:0:0:24 + vlc_sctp_b_v6_ip_1: + hidden: false + immutable: false + type: string + description: Static IP vlc2 SCTPB + default: fd00:200:200:5:0:0:0:17 + sctp-a-ipv6-egress_dst_subnet_prefix: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix + default: 0.0.0.0 + vlc_sctp_b_v6_ip_0: + hidden: false + immutable: false + type: string + description: Static IP vlc1 SCTPB + default: fd00:200:200:5:0:0:0:16 + vlc4_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc4_Internal1 + default: 00:80:37:0E:04:12 + vlc_sctp_b_v6_ip_6: + hidden: false + immutable: false + type: string + description: Static IP vlc7 SCTPB + default: fd00:200:200:5:0:0:0:28 + vlc_sctp_b_v6_ip_5: + hidden: false + immutable: false + type: string + description: Static IP vlc6 SCTPB + default: fd00:200:200:5:0:0:0:27 + vlc_sctp_b_v6_ip_4: + hidden: false + immutable: false + type: string + description: Static IP vlc5 SCTPB + default: fd00:200:200:5:0:0:0:26 + vlc_sctp_b_v6_ip_3: + hidden: false + immutable: false + type: string + description: Static IP vlc4 SCTPB + default: fd00:200:200:5:0:0:0:25 + sctp_b_net_name: + hidden: false + immutable: false + type: string + description: Network Name SCTPB + default: vMME-24474-Ericsson-WTC-Lab-vLCP1-4_gn_SCTPB_net_1 + sctp-b-ipv6-egress_dst_subnet_prefix_len: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix + default: '0' + sctp-a-egress_rule_protocol: + hidden: false + immutable: false + type: string + description: protocol for the SecurityGroup + default: any + Internal1_shared: + hidden: false + immutable: false + type: string + description: Whether Shared or private internal-1 network + default: false + shc_url_path: + hidden: false + immutable: false + type: string + description: health check + default: local-ip + Internal2_net_cidr_len: + hidden: false + immutable: false + type: string + description: CIDR length for internal-2 network + default: 17 + sctp-a-ingress-src_end_port: + hidden: false + immutable: false + type: float + description: end_port for the SecurityGroup + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + sctp-b-ipv6-ingress_src_subnet_prefix: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix + default: 0.0.0.0 + sctp-a-egress-dst_end_port: + hidden: false + immutable: false + type: float + description: end_port for the SecurityGroup + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + sctp-a-ingress_action: + hidden: false + immutable: false + type: string + description: simple_action for the SecurityGroup + default: pass + sctp-b-ipv6-ingress_action: + hidden: false + immutable: false + type: string + description: IPV6 action + default: pass + vlc_st_service_type: + hidden: false + immutable: false + type: string + description: service type + default: firewall + sctp-b-ipv6-ingress-dst_start_port: + hidden: false + immutable: false + type: string + description: IPV6 starting port for destination + default: 0 + vlc_st_availability_zone: + hidden: false + immutable: false + type: string + description: Indicates availability zone is enabled + default: true + vlc7_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc7_Internal1 + default: 00:80:37:0E:07:12 + fsb_volume_image_name_1: + label: MME_FSB2 + hidden: false + immutable: false + type: string + description: volume name + default: MME_FSB2_1_3_GA.qcow2 + vlc_oam_ip_6: + hidden: false + immutable: false + type: string + description: Static IP vlc7 OAM + default: 107.239.72.151 + sctp-a-ipv6-ingress_src_subnet_prefix_len: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix length + default: '0' + vlc_oam_ip_7: + hidden: false + immutable: false + type: string + description: Static IP vlc8 OAM + default: 107.239.72.152 + Internal1_allow_transit: + hidden: false + immutable: false + type: string + description: Allow/disallow transit internal-1 network + default: true + vlc_oam_ip_2: + hidden: false + immutable: false + type: string + description: Static IP vlc3 OAM + default: 107.239.72.157 + vlc_oam_ip_3: + hidden: false + immutable: false + type: string + description: Static IP vlc4 OAM + default: 107.239.72.158 + vlc_gtp_ip_0: + hidden: false + immutable: false + type: string + description: Static IP vlc1 GTP + default: 107.243.47.208 + vlc_oam_ip_4: + hidden: false + immutable: false + type: string + description: Static IP vlc5 OAM + default: 107.239.72.149 + fsb_volume_image_name_0: + label: MME_FSB1 + hidden: false + immutable: false + type: string + description: volume name + default: MME_FSB1_1_3_GA.qcow2 + vlc_gtp_ip_1: + hidden: false + immutable: false + type: string + description: Static IP vlc2 GTP + default: 107.243.47.209 + vlc_oam_ip_5: + hidden: false + immutable: false + type: string + description: Static IP vlc6 OAM + default: 107.239.72.150 + vlc_gtp_ip_2: + hidden: false + immutable: false + type: string + description: Static IP vlc3 GTP + default: 107.243.47.216 + vlc_name_6: + hidden: false + immutable: false + type: string + description: Name of vlc7 + default: zrdm3mmex59vlc007 + vlc_gtp_ip_3: + hidden: false + immutable: false + type: string + description: Static IP vlc4 GTP + default: 107.243.47.217 + vlc_name_7: + hidden: false + immutable: false + type: string + description: Name of vlc8 + default: zrdm3mmex59vlc008 + security_group_sctp_a_id: + hidden: false + immutable: false + type: string + description: Security Group UUID for output + default: 3cd8a524-77ff-4980-ae2a-d19ba70e0511 + vlc_gtp_ip_4: + hidden: false + immutable: false + type: string + description: Static IP vlc5 GTP + default: 107.243.47.218 + vlc_gtp_ip_5: + hidden: false + immutable: false + type: string + description: Static IP vlc6 GTP + default: 107.243.47.219 + vlc_gtp_ip_6: + hidden: false + immutable: false + type: string + description: Static IP vlc7 GTP + default: 107.243.47.220 + vlc_name_2: + hidden: false + immutable: false + type: string + description: Name of vlc3 + default: zrdm3mmex59vlc003 + vlc_gtp_ip_7: + hidden: false + immutable: false + type: string + description: Static IP vlc8 GTP + default: 107.243.47.221 + vlc_name_3: + hidden: false + immutable: false + type: string + description: Name of vlc4 + default: zrdm3mmex59vlc004 + vlc_name_4: + hidden: false + immutable: false + type: string + description: Name of vlc5 + default: zrdm3mmex59vlc005 + vlc_name_5: + hidden: false + immutable: false + type: string + description: Name of vlc6 + default: zrdm3mmex59vlc006 + fsb_volume_id_1: + hidden: false + immutable: false + type: string + description: ID of Cinder Volume for FSB2 + default: 5bd0560c-bfd0-47dc-a84a-554e2698c925 + sctp-a-ipv6-ingress_action: + hidden: false + immutable: false + type: string + description: IPV6 action + default: pass + vlc_name_0: + hidden: false + immutable: false + type: string + description: Name of vlc1 + default: zrdm3mmex59vlc001 + vlc_name_1: + hidden: false + immutable: false + type: string + description: Name of vlc2 + default: zrdm3mmex59vlc002 + vlc_oam_route_prefixes: + hidden: false + immutable: false + type: json + description: Route prefixes for static routing on OAM + sctp-b-egress_rule_application: + hidden: false + immutable: false + type: string + description: application for the SecurityGroup + default: any + vlc_oam_ip_0: + hidden: false + immutable: false + type: string + description: Static IP vlc1 OAM + default: 107.239.72.155 + vlc_oam_ip_1: + hidden: false + immutable: false + type: string + description: Static IP vlc2 OAM + default: 107.239.72.156 + vlc6_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc6_Internal1 + default: 00:80:37:0E:06:12 + fsb_volume_id_0: + hidden: false + immutable: false + type: string + description: ID of Cinder Volume for FSB1 + default: 27baa6a0-b701-4795-bf5e-4f546b350b1f + sctp-b-egress-dst_end_port: + hidden: false + immutable: false + type: float + description: end_port for the SecurityGroup + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + gpb2_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb2_Internal2 + default: 00:80:37:0E:0A:22 + sctp-a-ipv6-egress_rule_application: + hidden: false + immutable: false + type: string + description: IPV6 Rule-application + default: any + sctp-b-ipv6-egress_src_start_port: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix + default: 0 + Internal2_allow_transit: + hidden: false + immutable: false + type: string + description: Allow/disallow transit internal-2 network + default: true + fsb_volume_size: + label: volume size + hidden: false + immutable: false + type: float + description: volume size 320GB + default: 320 + constraints: + - in_range: + - 0 + - 340 + sctp-b-IPv6_ethertype: + hidden: false + immutable: false + type: string + description: IPV6 ethertype + default: IPv6 + gtp_net_fqdn: + hidden: false + immutable: false + type: string + description: Network FQDN GTP + default: default-domain:vMME-24474-Ericsson-WTC-Lab-vLCP1-4:vMME-24474-Ericsson-WTC-Lab-vLCP1-4_gn_GTP_net_1 + ncb2_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to ncb2_Internal1 + default: 00:80:37:0E:0F:12 + sctp-b-ingress_rule_protocol: + hidden: false + immutable: false + type: string + description: protocol for the SecurityGroup + default: any + sctp-b-ingress_action: + hidden: false + immutable: false + type: string + description: simple_action for the SecurityGroup + default: pass + sctp-b-egress_src_addresses: + hidden: false + immutable: false + type: string + description: security_group for the SecurityGroup + default: local + gpb7_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb7_Internal2 + default: 00:80:37:0E:0F:22 + sctp-a-ipv6-ingress-dst_start_port: + hidden: false + immutable: false + type: string + description: IPV6 starting port for destination + default: 0 + gtp_net_name: + hidden: false + immutable: false + type: string + description: Network Name GTP + default: vMME-24474-Ericsson-WTC-Lab-vLCP1-4_gn_GTP_net_1 + sctp-b-ipv6-ingress_rule_application: + hidden: false + immutable: false + type: string + description: IPV6 Rule-application + default: any + domain_name: + hidden: false + immutable: false + type: string + description: Unique name of vMME contrail domain + default: default-domain + vlc5_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc5_Internal1 + default: 00:80:37:0E:05:12 + sctp-a-egress_src_addresses: + hidden: false + immutable: false + type: string + description: security_group for the SecurityGroup + default: local + sctp-b-egress-src_start_port: + hidden: false + immutable: false + type: float + description: start_port for the SecurityGroup + default: 0 + constraints: + - in_range: + - 0 + - 65535 + shc_enabled: + hidden: false + immutable: false + type: string + description: health check + default: true + sctp-b-ipv6-ingress-dst_end_port: + hidden: false + immutable: false + type: string + description: IPV6 end port + default: 65535 + sctp-b-dst_subnet_prefix_v6: + hidden: false + immutable: false + type: string + description: ip_prefix for the SecurityGroup + default: '::' + sctp_a_net_fqdn: + hidden: false + immutable: false + type: string + description: Network FQDN SCTPA + default: default-domain:vMME-24474-Ericsson-WTC-Lab-vLCP1-4:vMME-24474-Ericsson-WTC-Lab-vLCP1-4_gn_SCTPA_net_1 + security_group_gtp_id: + hidden: false + immutable: false + type: string + description: Security Group UUID for output + default: e8ad3fe2-5f95-43e4-bbcc-da97b1c22588 + sctp-a-ipv6-ingress_src_subnet_prefix: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix + default: 0.0.0.0 + fsb_name_1: + hidden: false + immutable: false + type: string + description: Name of fsb1 + default: zrdm3mmex59fsb002 + sctp-b-egress-dst_start_port: + hidden: false + immutable: false + type: float + description: start_port for the SecurityGroup + default: 0 + constraints: + - in_range: + - 0 + - 65535 + fsb_name_0: + hidden: false + immutable: false + type: string + description: Name of fsb1 + default: zrdm3mmex59fsb001 + sctp_a_net_name: + hidden: false + immutable: false + type: string + description: Network Name SCTPA + default: vMME-24474-Ericsson-WTC-Lab-vLCP1-4_gn_SCTPA_net_1 + sctp-b-egress_dst_subnet_prefix_len: + hidden: false + immutable: false + type: float + description: ip_prefix_len for the SecurityGroup + default: '0' + constraints: + - in_range: + - 0 + - 32 + gpb1_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb1_Internal1 + default: 00:80:37:0E:09:22 + sctp-a-ingress-dst_start_port: + hidden: false + immutable: false + type: float + description: start_port for the SecurityGroup + default: 0 + constraints: + - in_range: + - 0 + - 65535 + fsb1_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to fsb1_Internal2 + default: 00:80:37:0E:0B:12 + vlc_st_service_mode: + hidden: false + immutable: false + type: string + description: service mode + default: in-network-nat + sctp-a-ipv6-egress_ethertype: + hidden: false + immutable: false + type: string + description: IPV6 ethertype + default: IPv4 + sctp-a-egress-src_end_port: + hidden: false + immutable: false + type: float + description: end_port for the SecurityGroup + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + sctp-b-egress_action: + hidden: false + immutable: false + type: string + description: simple_action for the SecurityGroup + default: pass + sctp-a-ingress-src_subnet_prefix_len: + hidden: false + immutable: false + type: float + description: ip_prefix_len for the SecurityGroup + default: '0' + constraints: + - in_range: + - 0 + - 32 + sctp-a-ipv6-ingress-src_start_port: + hidden: false + immutable: false + type: float + description: IPV6 start port + default: 0 + constraints: + - in_range: + - 0 + - 65535 + vf_module_id: + hidden: false + immutable: false + type: string + description: the vf_module_id for this instance. UUID provided by ECOMP + default: TWO + Internal1_net_cidr: + hidden: false + immutable: false + type: string + description: CIDR for internal-1 network + default: 169.253.0.0 + fsb_flavor_name: + hidden: false + immutable: false + type: string + description: Flavor to use for servers fsb1 + default: nv.c8r32d1 + sctp_rule_protocol: + hidden: false + immutable: false + type: string + description: protocol for the SecurityGroup + default: 132 + vnf_name: + hidden: false + immutable: false + type: string + description: the vnf_name for this instance. provided by ECOMP + default: zrdm3mmex59 + sctp-a-IPv6_ethertype: + hidden: false + immutable: false + type: string + description: IPV6 ethertype + default: IPv6 + vlc_sctp_b_v6_ip_7: + hidden: false + immutable: false + type: string + description: Static IP vlc8 SCTPB + default: fd00:200:200:5:0:0:0:29 + vlc6_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc6_Internal2 + default: 00:80:37:0E:06:12 + sctp-b-ingress-dst_end_port: + hidden: false + immutable: false + type: float + description: end_port for the SecurityGroup + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + vlc7_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc7_Internal2 + default: 00:80:37:0E:07:12 + sctp-a-ipv6-ingress-src_end_port: + hidden: false + immutable: false + type: float + description: IPV6 ending port for destination + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + vlc_flavor_name: + hidden: false + immutable: false + type: string + description: Flavor to use for servers vlc + default: nd.c16r64d1 + sctp-b-ipv6-egress_src_addresses: + hidden: false + immutable: false + type: string + description: IPV6 source + default: local + vlc_st_interface_type_int1: + hidden: false + immutable: false + type: string + description: service_interface_type for the ServiceTemplate + default: other1 + availability_zone_0: + hidden: false + immutable: false + type: string + description: cluster for spawnning fsb instances + default: rdm3-kvm-az02 + service_instance_id_0: + hidden: false + immutable: false + type: string + description: UUID of service instance for vLCs + default: 77c67cc8-d15f-47bc-aeb1-8d65d09e917a + availability_zone_1: + hidden: false + immutable: false + type: string + description: cluster for spawnning ncb instances + default: rdm3-kvm-az02 + vlc_st_interface_type_int2: + hidden: false + immutable: false + type: string + description: service_interface_type for the ServiceTemplate + default: other2 + sctp-a-ipv6-egress-dst_start_port: + hidden: false + immutable: false + type: string + description: IPV6 start port + default: 0 + sctp-a-ipv6-egress_dst_subnet_prefix_len: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix + default: '0' + vlc_sctp_a_ip_0: + hidden: false + immutable: false + type: string + description: Static IP vlc1 SCTPA + default: 107.243.47.144 + vlc_sctp_b_route_prefixes: + hidden: false + immutable: false + type: json + description: Route prefixes for static routing on SCTPB + vlc1_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc1_Internal1 + default: 00:80:37:0E:01:12 + sctp-b-ipv6-egress_src_end_port: + hidden: false + immutable: false + type: string + description: IPV6 end port + default: 65535 + sctp-a-ipv6-egress_src_addresses: + hidden: false + immutable: false + type: string + description: IPV6 source + default: local + vlc_sctp_a_ip_7: + hidden: false + immutable: false + type: string + description: Static IP vlc8 SCTPA + default: 107.243.47.157 + sctp-a-ingress-src_subnet_prefix_v6: + hidden: false + immutable: false + type: string + description: src subnet + default: '::' + vlc_sctp_a_ip_6: + hidden: false + immutable: false + type: string + description: Static IP vlc7 SCTPA + default: 107.243.47.156 + vlc_sctp_a_ip_5: + hidden: false + immutable: false + type: string + description: Static IP vlc6 SCTPA + default: 107.243.47.155 + sctp-a-ingress-dst_end_port: + hidden: false + immutable: false + type: float + description: end_port for the SecurityGroup + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + vlc_sctp_a_ip_4: + hidden: false + immutable: false + type: string + description: Static IP vlc5 SCTPA + default: 107.243.47.154 + vlc_sctp_a_ip_3: + hidden: false + immutable: false + type: string + description: Static IP vlc4 SCTPA + default: 107.243.47.153 + vlc_sctp_a_ip_2: + hidden: false + immutable: false + type: string + description: Static IP vlc3 SCTPA + default: 107.243.47.152 + vlc_sctp_a_ip_1: + hidden: false + immutable: false + type: string + description: Static IP vlc2 SCTPA + default: 107.243.47.145 + gpb6_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb6_Internal2 + default: 00:80:37:0E:0E:22 + security_group_int2_id: + hidden: false + immutable: false + type: string + description: UUID of Internal1_net security group + default: 1361f069-baf2-4b76-b321-7f68ba26c369 + Internal2_dhcp: + hidden: false + immutable: false + type: string + description: Whether DHCP/static IP addressing on internal-2 network + default: false + sctp-a-dst_subnet_prefix_v6: + hidden: false + immutable: false + type: string + description: ip_prefix for the SecurityGroup + default: '::' + pxe_image_name: + hidden: false + immutable: false + type: string + description: Name of image to use for server ncb + default: MME_PXE-Boot_1_3_GA.qcow2 + vlc_st_interface_type_gtp: + hidden: false + immutable: false + type: string + description: service_interface_type for the ServiceTemplate + default: other0 + ncb1_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to ncb1_Internal1 + default: 00:80:37:0E:09:12 + vlc_gtp_route_prefixes: + hidden: false + immutable: false + type: json + description: Route prefixes for static routing on GTP + int1_sec_group_name: + hidden: false + immutable: false + type: string + description: SecurityGroup name for internal-1 + default: int1-sec-group + vmi_oam_preference_secondary: + hidden: false + immutable: false + type: float + description: Preference for secondary interface/port + default: 100 + Internal1_dhcp: + hidden: false + immutable: false + type: string + description: Whether DHCP/static IP addressing on internal-1 network + default: false + fsb2_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to fsb2_Internal2 + default: 00:80:37:0E:0D:12 + Internal1_net_cidr_len: + hidden: false + immutable: false + type: string + description: CIDR length for internal-1 network + default: 17 + sctp-a-ingress_dst_addresses: + hidden: false + immutable: false + type: string + description: security_group for the SecurityGroup + default: local + sctp-b-ingress-src_subnet_prefix_len: + hidden: false + immutable: false + type: float + description: ip_prefix_len for the SecurityGroup + default: '0' + constraints: + - in_range: + - 0 + - 32 + fsb_oam_ip_1: + hidden: false + immutable: false + type: string + description: IP address of OAM vNIC for FSB2 + default: 107.239.72.154 + fsb_oam_ip_0: + hidden: false + immutable: false + type: string + description: IP address of OAM vNIC for FSB1 + default: 107.239.72.153 + shc_timeout: + hidden: false + immutable: false + type: string + description: health check + default: 5 + vlc_st_version: + hidden: false + immutable: false + type: string + description: Indicates service version + default: 2 + sctp-a-src_subnet_prefix_v6: + hidden: false + immutable: false + type: string + description: ip_prefix for the SecurityGroup + default: '::' + sctp-a-ingress_rule_application: + hidden: false + immutable: false + type: string + description: application for the SecurityGroup + default: any + sctp-b-egress_ethertype: + hidden: false + immutable: false + type: string + description: ethertype for the SecurityGroup + default: IPv4 + sctp-a-ipv6-egress_src_start_port: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix + default: 0 + instance_ip_family_v6: + hidden: false + immutable: false + type: string + description: Ipv6 instance type + default: v6 + sctp-b-ingress-src_subnet_prefix_v6: + hidden: false + immutable: false + type: string + description: src subnet + default: '::' + gpb8_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb8_Internal2 + default: 00:80:37:0E:10:22 + gpb4_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb4_Internal1 + default: 00:80:37:0E:0C:22 + sctp-a-ipv6-ingress-dst_end_port: + hidden: false + immutable: false + type: string + description: IPV6 end port + default: 65535 + Internal1_net_gateway: + hidden: false + immutable: false + type: string + description: gateway for internal-1 network + default: 169.253.0.3 + sctp-b-ipv6-egress-dst_start_port: + hidden: false + immutable: false + type: string + description: IPV6 start port + default: 0 + gpb_name_7: + hidden: false + immutable: false + type: string + description: Name of gpb8 + default: zrdm3mmex59gpb0016 + gpb_name_6: + hidden: false + immutable: false + type: string + description: Name of gpb7 + default: zrdm3mmex59gpb0015 + gpb_name_5: + hidden: false + immutable: false + type: string + description: Name of gpb6 + default: zrdm3mmex59gpb0014 + gpb_name_4: + hidden: false + immutable: false + type: string + description: Name of gpb5 + default: zrdm3mmex59gpb0013 + gpb_name_3: + hidden: false + immutable: false + type: string + description: Name of gpb4 + default: zrdm3mmex59gpb0012 + sctp-a-ipv6-ingress_dst_addresses: + hidden: false + immutable: false + type: string + description: IPV6 destination + default: local + gpb_name_2: + hidden: false + immutable: false + type: string + description: Name of gpb3 + default: zrdm3mmex59gpb0011 + shc_delay: + hidden: false + immutable: false + type: string + description: health check + default: 3 + gpb_name_1: + hidden: false + immutable: false + type: string + description: Name of gpb2 + default: zrdm3mmex59gpb0010 + sctp-b-ipv6-egress_action: + hidden: false + immutable: false + type: string + description: IPV6 action + default: pass + vlc3_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc3_Internal2 + default: 00:80:37:0E:03:12 + gpb_name_0: + hidden: false + immutable: false + type: string + description: Name of gpb1 + default: zrdm3mmex59gpb009 + sctp-a-ipv6-egress_action: + hidden: false + immutable: false + type: string + description: IPV6 action + default: pass + gpb5_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb5_Internal1 + default: 00:80:37:0E:0D:22 + sctp-b-ipv6-ingress_rule_protocol: + hidden: false + immutable: false + type: string + description: IPV6 Rule-protocol + default: any + shc_max_retries: + hidden: false + immutable: false + type: string + description: health check + default: 2 + fsb_volume_type: + label: volume type + hidden: false + immutable: false + type: string + description: volume type SolidFire + default: SF-Default-SSD + sctp-a-name: + hidden: false + immutable: false + type: string + description: name for the SecurityGroup + default: epc-sctp-a-ipv4v6-sec-group + vlc_sctp_b_ip_5: + hidden: false + immutable: false + type: string + description: Static IP vlc6 SCTPB + default: 107.243.47.187 + vlc_sctp_b_ip_4: + hidden: false + immutable: false + type: string + description: Static IP vlc5 SCTPB + default: 107.243.47.186 + vlc_sctp_b_ip_3: + hidden: false + immutable: false + type: string + description: Static IP vlc4 SCTPB + default: 107.243.47.185 + vlc_sctp_b_ip_2: + hidden: false + immutable: false + type: string + description: Static IP vlc3 SCTPB + default: 107.243.47.184 + sctp-b-egress_rule_protocol: + hidden: false + immutable: false + type: string + description: protocol for the SecurityGroup + default: any + vnf_id: + hidden: false + immutable: false + type: string + description: the vf_id for this instance. UUID provided by ECOMP + default: zrdm3mmex59 + vlc_sctp_b_ip_7: + hidden: false + immutable: false + type: string + description: Static IP vlc8 SCTPB + default: 107.243.47.189 + vlc_sctp_b_ip_6: + hidden: false + immutable: false + type: string + description: Static IP vlc7 SCTPB + default: 107.243.47.188 + vlc_sctp_b_ip_1: + hidden: false + immutable: false + type: string + description: Static IP vlc2 SCTPB + default: 107.243.47.177 + gpb6_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb6_Internal1 + default: 00:80:37:0E:0E:22 + sctp-b-ipv6-egress_dst_end_port: + hidden: false + immutable: false + type: string + description: IPV6 end port + default: 65535 + vlc_sctp_b_ip_0: + hidden: false + immutable: false + type: string + description: Static IP vlc1 SCTPB + default: 107.243.47.176 + vlc2_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc2_Internal2 + default: 00:80:37:0E:02:12 + sctp-b-ingress-src_subnet_prefix: + hidden: false + immutable: false + type: string + description: ip_prefix for the SecurityGroup + default: 0.0.0.0 + gpb_flavor_name: + hidden: false + immutable: false + type: string + description: Flavor to use for servers gpb + default: nv.c20r64d1 + vlc_sctp_a_route_prefixes: + hidden: false + immutable: false + type: json + description: Route prefixes for static routing on SCTPA + sctp-b-ipv6-ingress_dst_addresses: + hidden: false + immutable: false + type: string + description: IPV6 destination + default: local + sctp-b-ipv6-ingress_ethertype: + hidden: false + immutable: false + type: string + description: IPV6 ethertype + default: IPv4 + sctp-b-ipv6-egress_dst_subnet_prefix: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix + default: 0.0.0.0 + sctp-a-ingress-src_subnet_prefix: + hidden: false + immutable: false + type: string + description: ip_prefix for the SecurityGroup + default: 0.0.0.0 + vlc1_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc1_Internal2 + default: 00:80:37:0E:01:12 + Internal1_rpf: + hidden: false + immutable: false + type: string + description: Reverse Path Forwarding Enabled/Disabled internal-1 network + default: disable + sctp-b-ingress_ethertype: + hidden: false + immutable: false + type: string + description: ethertype for the SecurityGroup + default: IPv4 + sctp-b-ingress-src_end_port: + hidden: false + immutable: false + type: float + description: end_port for the SecurityGroup + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + sctp-a-ipv6-ingress_rule_protocol: + hidden: false + immutable: false + type: string + description: IPV6 Rule-protocol + default: any + vlc_sctp_a_v6_ip_7: + hidden: false + immutable: false + type: string + description: Static IP vlc8 SCTPA + default: fd00:200:200:4:0:0:0:29 + vlc_sctp_a_v6_ip_6: + hidden: false + immutable: false + type: string + description: Static IP vlc7 SCTPA + default: fd00:200:200:4:0:0:0:28 + gpb7_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb7_Internal1 + default: 00:80:37:0E:0F:22 + vlc_sctp_a_v6_ip_5: + hidden: false + immutable: false + type: string + description: Static IP vlc6 SCTPA + default: fd00:200:200:4:0:0:0:27 + vlc_sctp_a_v6_ip_4: + hidden: false + immutable: false + type: string + description: Static IP vlc5 SCTPA + default: fd00:200:200:4:0:0:0:26 + vlc_sctp_a_v6_ip_3: + hidden: false + immutable: false + type: string + description: Static IP vlc4 SCTPA + default: fd00:200:200:4:0:0:0:25 + vlc_sctp_a_v6_ip_2: + hidden: false + immutable: false + type: string + description: Static IP vlc3 SCTPA + default: fd00:200:200:4:0:0:0:24 + sctp-a-ingress-src_start_port: + hidden: false + immutable: false + type: float + description: start_port for the SecurityGroup + default: 0 + constraints: + - in_range: + - 0 + - 65535 + vlc_sctp_a_v6_ip_1: + hidden: false + immutable: false + type: string + description: Static IP vlc2 SCTPA + default: fd00:200:200:4:0:0:0:17 + vlc_sctp_a_v6_ip_0: + hidden: false + immutable: false + type: string + description: Static IP vlc1 SCTPA + default: fd00:200:200:4:0:0:0:16 + node_templates: + abstract_gpb_1: + type: org.openecomp.resource.abstract.nodes.gpb_1 + directives: + - substitutable + properties: + compute_gpb_name: + - get_input: gpb_name_1 + vm_flavor_name: + get_input: gpb_flavor_name + compute_gpb_scheduler_hints: + - group: + get_input: server_group_id_0 + port_gpb2_Internal1_security_groups: + - - get_input: security_group_int1_id + compute_gpb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + port_gpb2_Internal2_network: + - get_input: internal_net_id_1 + port_gpb2_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + vm_image_name: + get_input: pxe_image_name + port_gpb2_Internal1_replacement_policy: + - AUTO + port_gpb2_Internal1_network: + - get_input: internal_net_id_0 + port_gpb2_Internal2_replacement_policy: + - AUTO + port_gpb2_Internal1_mac_requirements: + mac_count_required: + is_required: true + compute_gpb_availability_zone: + - get_input: availability_zone_1 + port_gpb2_Internal1_mac_address: + get_input: gpb2_Internal1_mac + port_gpb2_Internal2_mac_requirements: + mac_count_required: + is_required: true + port_gpb2_Internal2_mac_address: + get_input: gpb2_Internal1_mac + port_gpb2_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb2_Internal2_security_groups: + - - get_input: security_group_int2_id + service_template_filter: + substitute_service_template: Nested_gpb_1ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: gpb + nfc_naming_code: gpb + requirements: + - link_gpb_gpb2_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + abstract_gpb_2: + type: org.openecomp.resource.abstract.nodes.gpb_2 + directives: + - substitutable + properties: + port_gpb3_Internal1_replacement_policy: + - AUTO + compute_gpb_name: + - get_input: gpb_name_2 + port_gpb3_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb3_Internal2_replacement_policy: + - AUTO + vm_flavor_name: + get_input: gpb_flavor_name + port_gpb3_Internal2_security_groups: + - - get_input: security_group_int2_id + compute_gpb_scheduler_hints: + - group: + get_input: server_group_id_0 + compute_gpb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + vm_image_name: + get_input: pxe_image_name + port_gpb3_Internal1_security_groups: + - - get_input: security_group_int1_id + port_gpb3_Internal2_network: + - get_input: internal_net_id_1 + compute_gpb_availability_zone: + - get_input: availability_zone_0 + port_gpb3_Internal1_network: + - get_input: internal_net_id_0 + port_gpb3_Internal1_mac_requirements: + mac_count_required: + is_required: true + port_gpb3_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb3_Internal1_mac_address: + get_input: gpb3_Internal1_mac + port_gpb3_Internal2_mac_address: + get_input: gpb3_Internal1_mac + port_gpb3_Internal2_mac_requirements: + mac_count_required: + is_required: true + service_template_filter: + substitute_service_template: Nested_gpb_2ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: gpb + nfc_naming_code: gpb + requirements: + - link_gpb_gpb3_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_gpb_gpb3_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + abstract_vlc: + type: org.openecomp.resource.abstract.nodes.vlc + directives: + - substitutable + properties: + port_template_VMInt_SCTP_A_vlc_virtual_network_refs: + - - get_input: sctp_a_net_fqdn + port_template_VMInt_INT1_vlc_security_group_refs: + - - get_input: security_group_int1_id + vm_flavor_name: + get_input: vlc_flavor_name + port_template_VMInt_INT2_vlc_port_tuple_refs: + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc4 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc3 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc2 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc1 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc8 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc7 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc6 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc5 + vm_image_name: + get_input: pxe_image_name + port_template_VMInt_INT1_vlc_port_tuple_refs: + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc4 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc3 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc2 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc1 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc8 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc7 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc6 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc5 + port_template_VMInt_INT2_vlc_virtual_network_refs: + - - get_input: internal_net_id_1 + port_template_VMInt_OAM_vlc_virtual_network_refs: + - - get_input: oam_net_fqdn + port_template_VMInt_OAM_vlc_port_tuple_refs: + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc4 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc3 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc2 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc1 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc8 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc7 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc6 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc5 + port_template_VMInt_INT2_vlc_virtual_machine_interface_mac_addresses: + - - get_input: vlc4_Internal2_mac + - - get_input: vlc3_Internal2_mac + - - get_input: vlc2_Internal2_mac + - - get_input: vlc1_Internal2_mac + - - get_input: vlc8_Internal2_mac + - - get_input: vlc7_Internal2_mac + - - get_input: vlc6_Internal2_mac + - - get_input: vlc5_Internal2_mac + port_template_VMInt_SCTP_B_vlc_port_tuple_refs: + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc4 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc3 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc2 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc1 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc8 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc7 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc6 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc5 + port_template_VMInt_GTP_vlc_security_group_refs: + - - get_input: security_group_gtp_id + compute_vlc_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + port_template_VMInt_OAM_vlc_security_group_refs: + - - get_input: security_group_oam_id + compute_vlc_contrail_service_instance_ind: + - true + - true + - true + - true + - true + - true + - true + - true + port_template_VMInt_GTP_vlc_port_tuple_refs: + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc4 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc3 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc2 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc1 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc8 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc7 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc6 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc5 + port_template_VMInt_SCTP_B_vlc_virtual_network_refs: + - - get_input: sctp_b_net_fqdn + port_template_VMInt_INT2_vlc_security_group_refs: + - - get_input: security_group_int2_id + port_template_VMInt_SCTP_B_vlc_security_group_refs: + - - get_input: security_group_sctp_b_id + port_template_VMInt_INT1_vlc_virtual_network_refs: + - - get_input: internal_net_id_0 + port_template_VMInt_SCTP_A_vlc_port_tuple_refs: + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc4 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc3 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc2 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc1 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc8 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc7 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc6 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc5 + compute_vlc_scheduler_hints: + - group: + get_input: server_group_id_0 + - group: + get_input: server_group_id_0 + - group: + get_input: server_group_id_0 + - group: + get_input: server_group_id_0 + - group: + get_input: server_group_id_0 + - group: + get_input: server_group_id_0 + - group: + get_input: server_group_id_0 + - group: + get_input: server_group_id_0 + compute_vlc_name: + - get_input: vlc_name_3 + - get_input: vlc_name_2 + - get_input: vlc_name_1 + - get_input: vlc_name_0 + - get_input: vlc_name_7 + - get_input: vlc_name_6 + - get_input: vlc_name_5 + - get_input: vlc_name_4 + port_template_VMInt_SCTP_A_vlc_security_group_refs: + - - get_input: security_group_sctp_a_id + compute_vlc_availability_zone: + - get_input: availability_zone_1 + - get_input: availability_zone_0 + - get_input: availability_zone_1 + - get_input: availability_zone_0 + - get_input: availability_zone_1 + - get_input: availability_zone_0 + - get_input: availability_zone_1 + - get_input: availability_zone_0 + port_template_VMInt_INT1_vlc_virtual_machine_interface_mac_addresses: + - - get_input: vlc4_Internal1_mac + - - get_input: vlc3_Internal1_mac + - - get_input: vlc2_Internal1_mac + - - get_input: vlc1_Internal1_mac + - - get_input: vlc8_Internal1_mac + - - get_input: vlc7_Internal1_mac + - - get_input: vlc6_Internal1_mac + - - get_input: vlc5_Internal1_mac + port_template_VMInt_GTP_vlc_virtual_network_refs: + - - get_input: gtp_net_fqdn + service_template_filter: + substitute_service_template: Nested_vlcServiceTemplate.yaml + count: 8 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: vlc + nfc_naming_code: vlc + requirements: + - link_vlc_template_VMInt_INT2_vlc: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + - link_vlc_template_VMInt_INT1_vlc: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + abstract_gpb_7: + type: org.openecomp.resource.abstract.nodes.gpb_7 + directives: + - substitutable + properties: + compute_gpb_name: + - get_input: gpb_name_7 + port_gpb8_Internal1_mac_address: + get_input: gpb8_Internal1_mac + port_gpb8_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + vm_flavor_name: + get_input: gpb_flavor_name + compute_gpb_scheduler_hints: + - group: + get_input: server_group_id_0 + compute_gpb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + vm_image_name: + get_input: pxe_image_name + port_gpb8_Internal2_security_groups: + - - get_input: security_group_int2_id + port_gpb8_Internal1_replacement_policy: + - AUTO + port_gpb8_Internal2_replacement_policy: + - AUTO + compute_gpb_availability_zone: + - get_input: availability_zone_1 + port_gpb8_Internal1_mac_requirements: + mac_count_required: + is_required: true + port_gpb8_Internal1_network: + - get_input: internal_net_id_0 + port_gpb8_Internal2_mac_requirements: + mac_count_required: + is_required: true + port_gpb8_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb8_Internal1_security_groups: + - - get_input: security_group_int1_id + port_gpb8_Internal2_network: + - get_input: internal_net_id_1 + port_gpb8_Internal2_mac_address: + get_input: gpb8_Internal1_mac + service_template_filter: + substitute_service_template: Nested_gpb_7ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: gpb + nfc_naming_code: gpb + requirements: + - link_gpb_gpb8_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_gpb_gpb8_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + abstract_gpb_5: + type: org.openecomp.resource.abstract.nodes.gpb_5 + directives: + - substitutable + properties: + port_gpb6_Internal1_mac_requirements: + mac_count_required: + is_required: true + compute_gpb_name: + - get_input: gpb_name_5 + vm_flavor_name: + get_input: gpb_flavor_name + compute_gpb_scheduler_hints: + - group: + get_input: server_group_id_0 + compute_gpb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + port_gpb6_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + vm_image_name: + get_input: pxe_image_name + port_gpb6_Internal1_security_groups: + - - get_input: security_group_int1_id + port_gpb6_Internal2_network: + - get_input: internal_net_id_1 + compute_gpb_availability_zone: + - get_input: availability_zone_1 + port_gpb6_Internal1_network: + - get_input: internal_net_id_0 + port_gpb6_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb6_Internal2_mac_address: + get_input: gpb6_Internal1_mac + port_gpb6_Internal1_mac_address: + get_input: gpb6_Internal1_mac + port_gpb6_Internal2_mac_requirements: + mac_count_required: + is_required: true + port_gpb6_Internal2_replacement_policy: + - AUTO + port_gpb6_Internal1_replacement_policy: + - AUTO + port_gpb6_Internal2_security_groups: + - - get_input: security_group_int2_id + service_template_filter: + substitute_service_template: Nested_gpb_5ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: gpb + nfc_naming_code: gpb + requirements: + - link_gpb_gpb6_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_gpb_gpb6_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + abstract_gpb_6: + type: org.openecomp.resource.abstract.nodes.gpb_6 + directives: + - substitutable + properties: + port_gpb7_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb7_Internal1_network: + - get_input: internal_net_id_0 + compute_gpb_name: + - get_input: gpb_name_6 + port_gpb7_Internal2_network: + - get_input: internal_net_id_1 + vm_flavor_name: + get_input: gpb_flavor_name + port_gpb7_Internal1_replacement_policy: + - AUTO + port_gpb7_Internal2_replacement_policy: + - AUTO + port_gpb7_Internal2_security_groups: + - - get_input: security_group_int2_id + compute_gpb_scheduler_hints: + - group: + get_input: server_group_id_0 + compute_gpb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + vm_image_name: + get_input: pxe_image_name + port_gpb7_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb7_Internal1_security_groups: + - - get_input: security_group_int1_id + compute_gpb_availability_zone: + - get_input: availability_zone_0 + port_gpb7_Internal2_mac_address: + get_input: gpb7_Internal1_mac + port_gpb7_Internal1_mac_requirements: + mac_count_required: + is_required: true + port_gpb7_Internal1_mac_address: + get_input: gpb7_Internal1_mac + port_gpb7_Internal2_mac_requirements: + mac_count_required: + is_required: true + service_template_filter: + substitute_service_template: Nested_gpb_6ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: gpb + nfc_naming_code: gpb + requirements: + - link_gpb_gpb7_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_gpb_gpb7_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + abstract_gpb_3: + type: org.openecomp.resource.abstract.nodes.gpb_3 + directives: + - substitutable + properties: + compute_gpb_name: + - get_input: gpb_name_3 + port_gpb4_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + vm_flavor_name: + get_input: gpb_flavor_name + port_gpb4_Internal1_mac_address: + get_input: gpb4_Internal1_mac + compute_gpb_scheduler_hints: + - group: + get_input: server_group_id_0 + port_gpb4_Internal2_mac_requirements: + mac_count_required: + is_required: true + compute_gpb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + port_gpb4_Internal2_mac_address: + get_input: gpb4_Internal1_mac + vm_image_name: + get_input: pxe_image_name + port_gpb4_Internal2_security_groups: + - - get_input: security_group_int2_id + compute_gpb_availability_zone: + - get_input: availability_zone_1 + port_gpb4_Internal2_replacement_policy: + - AUTO + port_gpb4_Internal1_replacement_policy: + - AUTO + port_gpb4_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb4_Internal1_security_groups: + - - get_input: security_group_int1_id + port_gpb4_Internal2_network: + - get_input: internal_net_id_1 + port_gpb4_Internal1_mac_requirements: + mac_count_required: + is_required: true + port_gpb4_Internal1_network: + - get_input: internal_net_id_0 + service_template_filter: + substitute_service_template: Nested_gpb_3ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: gpb + nfc_naming_code: gpb + requirements: + - link_gpb_gpb4_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_gpb_gpb4_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + abstract_gpb_4: + type: org.openecomp.resource.abstract.nodes.gpb_4 + directives: + - substitutable + properties: + port_gpb5_Internal2_mac_requirements: + mac_count_required: + is_required: true + port_gpb5_Internal1_security_groups: + - - get_input: security_group_int1_id + compute_gpb_name: + - get_input: gpb_name_4 + vm_flavor_name: + get_input: gpb_flavor_name + port_gpb5_Internal1_mac_requirements: + mac_count_required: + is_required: true + compute_gpb_scheduler_hints: + - group: + get_input: server_group_id_0 + port_gpb5_Internal2_network: + - get_input: internal_net_id_1 + compute_gpb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + vm_image_name: + get_input: pxe_image_name + port_gpb5_Internal1_network: + - get_input: internal_net_id_0 + port_gpb5_Internal2_mac_address: + get_input: gpb5_Internal1_mac + port_gpb5_Internal1_mac_address: + get_input: gpb5_Internal1_mac + port_gpb5_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb5_Internal2_replacement_policy: + - AUTO + compute_gpb_availability_zone: + - get_input: availability_zone_0 + port_gpb5_Internal1_replacement_policy: + - AUTO + port_gpb5_Internal2_security_groups: + - - get_input: security_group_int2_id + port_gpb5_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + service_template_filter: + substitute_service_template: Nested_gpb_4ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: gpb + nfc_naming_code: gpb + requirements: + - link_gpb_gpb5_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_gpb_gpb5_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + abstract_gpb: + type: org.openecomp.resource.abstract.nodes.gpb + directives: + - substitutable + properties: + port_gpb1_Internal1_security_groups: + - - get_input: security_group_int1_id + compute_gpb_name: + - get_input: gpb_name_0 + port_gpb1_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + vm_flavor_name: + get_input: gpb_flavor_name + port_gpb1_Internal1_mac_requirements: + mac_count_required: + is_required: true + compute_gpb_scheduler_hints: + - group: + get_input: server_group_id_0 + compute_gpb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + vm_image_name: + get_input: pxe_image_name + port_gpb1_Internal1_mac_address: + get_input: gpb1_Internal1_mac + port_gpb1_Internal2_mac_address: + get_input: gpb1_Internal1_mac + port_gpb1_Internal2_mac_requirements: + mac_count_required: + is_required: true + compute_gpb_availability_zone: + - get_input: availability_zone_0 + port_gpb1_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb1_Internal2_security_groups: + - - get_input: security_group_int2_id + port_gpb1_Internal1_replacement_policy: + - AUTO + port_gpb1_Internal2_replacement_policy: + - AUTO + port_gpb1_Internal2_network: + - get_input: internal_net_id_1 + port_gpb1_Internal1_network: + - get_input: internal_net_id_0 + service_template_filter: + substitute_service_template: Nested_gpbServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: gpb + nfc_naming_code: gpb + requirements: + - link_gpb_gpb1_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_gpb_gpb1_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + Internal1_net: + type: org.openecomp.resource.vl.nodes.heat.network.contrailV2.VirtualNetwork + properties: + network_ipam_refs_data: + - network_ipam_refs_data_ipam_subnets: + - network_ipam_refs_data_ipam_subnets_enable_dhcp: + get_input: Internal1_dhcp + network_ipam_refs_data_ipam_subnets_default_gateway: + get_input: Internal1_net_gateway + network_ipam_refs_data_ipam_subnets_subnet: + network_ipam_refs_data_ipam_subnets_subnet_ip_prefix_len: + get_input: Internal1_net_cidr_len + network_ipam_refs_data_ipam_subnets_subnet_ip_prefix: + get_input: Internal1_net_cidr + network_name: + str_replace: + template: $VNF_NAME_int_net_1 + params: + $VNF_NAME: + get_input: vnf_name + network_ipam_refs: + - UNSUPPORTED_RESOURCE_template_NetworkIpam_Internal1 + abstract_fsb: + type: org.openecomp.resource.abstract.nodes.fsb + directives: + - substitutable + properties: + port_FSB1_Internal1_mac_address: + get_input: fsb1_Internal1_mac + port_FSB_OAM_network_role_tag: + - oam + port_FSB1_Internal2_network: + - Internal2_net + port_FSB1_Internal1_network: + - Internal1_net + vm_flavor_name: + get_input: fsb_flavor_name + port_FSB1_Internal2_mac_address: + get_input: fsb1_Internal1_mac + port_FSB_OAM_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: true + floating_ip_count_required: + is_required: false + compute_fsb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + port_FSB1_Internal1_security_groups: + - - int1_security_group + port_FSB1_Internal2_replacement_policy: + - AUTO + compute_fsb_scheduler_hints: + - group: VM_Affinity_group + port_FSB1_Internal1_replacement_policy: + - AUTO + compute_fsb_name: + - get_input: fsb_name_0 + port_FSB1_Internal1_mac_requirements: + mac_count_required: + is_required: true + port_FSB1_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_FSB_OAM_network: + - get_input: oam_net_name + port_FSB_OAM_security_groups: + - - oam_security_group + port_FSB_OAM_mac_requirements: + mac_count_required: + is_required: false + port_FSB_OAM_replacement_policy: + - AUTO + compute_fsb_availability_zone: + - get_input: availability_zone_0 + port_FSB1_Internal2_security_groups: + - - int2_security_group + port_FSB1_Internal2_mac_requirements: + mac_count_required: + is_required: true + port_FSB1_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_FSB_OAM_fixed_ips: + - ip_address: + get_input: fsb_oam_ip_0 + service_template_filter: + substitute_service_template: Nested_fsbServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: fsb + nfc_naming_code: fsb + requirements: + - link_fsb_FSB1_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_fsb_FSB1_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + gtp_security_group: + type: org.openecomp.resource.vfc.rules.nodes.heat.network.neutron.SecurityRules + properties: + name: + str_replace: + template: $VNF_NAME_$SECGROUPNAME + params: + $SECGROUPNAME: + get_input: gtp_sec_group_name + $VNF_NAME: + get_input: vnf_name + rules: + - protocol: tcp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: udp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: icmp + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + - protocol: tcp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: udp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: icmp + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + abstract_ncb_1: + type: org.openecomp.resource.abstract.nodes.ncb_1 + directives: + - substitutable + properties: + port_NCB2_Internal2_security_groups: + - - int2_security_group + port_NCB2_Internal1_replacement_policy: + - AUTO + port_NCB2_Internal2_replacement_policy: + - AUTO + vm_flavor_name: + get_input: ncb_flavor_name + port_NCB2_Internal2_mac_requirements: + mac_count_required: + is_required: true + port_NCB2_Internal1_mac_requirements: + mac_count_required: + is_required: true + vm_image_name: + get_input: pxe_image_name + compute_ncb_scheduler_hints: + - group: VM_Affinity_group + compute_ncb_availability_zone: + - get_input: availability_zone_1 + port_NCB2_Internal1_network: + - Internal1_net + port_NCB2_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_NCB2_Internal1_security_groups: + - - int1_security_group + port_NCB2_Internal2_network: + - Internal2_net + port_NCB2_Internal1_mac_address: + get_input: ncb2_Internal1_mac + port_NCB2_Internal2_mac_address: + get_input: ncb2_Internal1_mac + compute_ncb_name: + - get_input: ncb_name_1 + compute_ncb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + port_NCB2_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + service_template_filter: + substitute_service_template: Nested_ncb_1ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: ncb + nfc_naming_code: ncb + requirements: + - link_ncb_NCB2_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_ncb_NCB2_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + abstract_ncb: + type: org.openecomp.resource.abstract.nodes.ncb + directives: + - substitutable + properties: + vm_flavor_name: + get_input: ncb_flavor_name + port_NCB1_Internal2_mac_requirements: + mac_count_required: + is_required: true + vm_image_name: + get_input: pxe_image_name + port_NCB1_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + compute_ncb_scheduler_hints: + - group: VM_Affinity_group + port_NCB1_Internal1_security_groups: + - - int1_security_group + compute_ncb_availability_zone: + - get_input: availability_zone_0 + port_NCB1_Internal2_mac_address: + get_input: ncb1_Internal1_mac + port_NCB1_Internal1_mac_address: + get_input: ncb1_Internal1_mac + port_NCB1_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_NCB1_Internal1_mac_requirements: + mac_count_required: + is_required: true + port_NCB1_Internal2_replacement_policy: + - AUTO + port_NCB1_Internal1_network: + - Internal1_net + port_NCB1_Internal2_security_groups: + - - int2_security_group + port_NCB1_Internal1_replacement_policy: + - AUTO + compute_ncb_name: + - get_input: ncb_name_0 + compute_ncb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + port_NCB1_Internal2_network: + - Internal2_net + service_template_filter: + substitute_service_template: Nested_ncbServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: ncb + nfc_naming_code: ncb + requirements: + - link_ncb_NCB1_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_ncb_NCB1_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + int1_security_group: + type: org.openecomp.resource.vfc.rules.nodes.heat.network.neutron.SecurityRules + properties: + name: + str_replace: + template: $VNF_NAME_$SECGROUPNAME + params: + $SECGROUPNAME: + get_input: int1_sec_group_name + $VNF_NAME: + get_input: vnf_name + rules: + - protocol: tcp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: udp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: icmp + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + - protocol: tcp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: udp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: icmp + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + requirements: + - port: + capability: attachment_fsb_FSB1_Internal1 + node: abstract_fsb + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_fsb_FSB2_Internal1 + node: abstract_fsb_1 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_ncb_NCB1_Internal1 + node: abstract_ncb + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_ncb_NCB2_Internal1 + node: abstract_ncb_1 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb1_Internal1 + node: abstract_gpb + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb2_Internal1 + node: abstract_gpb_1 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb3_Internal1 + node: abstract_gpb_2 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb4_Internal1 + node: abstract_gpb_3 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb5_Internal1 + node: abstract_gpb_4 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb6_Internal1 + node: abstract_gpb_5 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb7_Internal1 + node: abstract_gpb_6 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb8_Internal1 + node: abstract_gpb_7 + relationship: org.openecomp.relationships.AttachesTo + fsb_volume_0: + type: org.openecomp.resource.vfc.nodes.heat.cinder.Volume + properties: + image: + get_input: fsb_volume_image_name_0 + volume_type: + get_input: fsb_volume_type + size: '(get_input : fsb_volume_size) * 1024' + name: + list_join: + - _ + - - get_input: OS::stack_name + - FSB1_Vol_1 + fsb_volume_1: + type: org.openecomp.resource.vfc.nodes.heat.cinder.Volume + properties: + image: + get_input: fsb_volume_image_name_1 + volume_type: + get_input: fsb_volume_type + size: '(get_input : fsb_volume_size) * 1024' + name: + list_join: + - _ + - - get_input: OS::stack_name + - FSB2_Vol_1 + Internal2_net: + type: org.openecomp.resource.vl.nodes.heat.network.contrailV2.VirtualNetwork + properties: + network_ipam_refs_data: + - network_ipam_refs_data_ipam_subnets: + - network_ipam_refs_data_ipam_subnets_enable_dhcp: + get_input: Internal2_dhcp + network_ipam_refs_data_ipam_subnets_default_gateway: + get_input: Internal2_net_gateway + network_ipam_refs_data_ipam_subnets_subnet: + network_ipam_refs_data_ipam_subnets_subnet_ip_prefix_len: + get_input: Internal2_net_cidr_len + network_ipam_refs_data_ipam_subnets_subnet_ip_prefix: + get_input: Internal2_net_cidr + network_name: + str_replace: + template: $VNF_NAME_int_net_2 + params: + $VNF_NAME: + get_input: vnf_name + network_ipam_refs: + - UNSUPPORTED_RESOURCE_template_NetworkIpam_Internal2 + int2_security_group: + type: org.openecomp.resource.vfc.rules.nodes.heat.network.neutron.SecurityRules + properties: + name: + str_replace: + template: $VNF_NAME_$SECGROUPNAME + params: + $SECGROUPNAME: + get_input: int2_sec_group_name + $VNF_NAME: + get_input: vnf_name + rules: + - protocol: tcp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: udp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: 132 + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: icmp + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + - protocol: tcp + ethertype: IPv6 + port_range_max: 65535 + remote_ip_prefix: ::/0 + direction: egress + port_range_min: 1 + - protocol: udp + ethertype: IPv6 + port_range_max: 65535 + remote_ip_prefix: ::/0 + direction: egress + port_range_min: 1 + - protocol: 132 + ethertype: IPv6 + port_range_max: 65535 + remote_ip_prefix: ::/0 + direction: egress + port_range_min: 1 + - protocol: icmp + ethertype: IPv6 + remote_ip_prefix: ::/0 + direction: egress + - protocol: tcp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: udp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: 132 + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: icmp + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + - protocol: tcp + ethertype: IPv6 + port_range_max: 65535 + remote_ip_prefix: ::/0 + direction: ingress + port_range_min: 1 + - protocol: udp + ethertype: IPv6 + port_range_max: 65535 + remote_ip_prefix: ::/0 + direction: ingress + port_range_min: 1 + - protocol: 132 + ethertype: IPv6 + port_range_max: 65535 + remote_ip_prefix: ::/0 + direction: ingress + port_range_min: 1 + - protocol: icmp + ethertype: IPv6 + remote_ip_prefix: ::/0 + direction: ingress + requirements: + - port: + capability: attachment_fsb_FSB1_Internal2 + node: abstract_fsb + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_fsb_FSB2_Internal2 + node: abstract_fsb_1 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_ncb_NCB1_Internal2 + node: abstract_ncb + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_ncb_NCB2_Internal2 + node: abstract_ncb_1 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb1_Internal2 + node: abstract_gpb + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb2_Internal2 + node: abstract_gpb_1 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb3_Internal2 + node: abstract_gpb_2 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb4_Internal2 + node: abstract_gpb_3 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb5_Internal2 + node: abstract_gpb_4 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb6_Internal2 + node: abstract_gpb_5 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb7_Internal2 + node: abstract_gpb_6 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb8_Internal2 + node: abstract_gpb_7 + relationship: org.openecomp.relationships.AttachesTo + abstract_fsb_1: + type: org.openecomp.resource.abstract.nodes.fsb_1 + directives: + - substitutable + properties: + port_FSB_OAM_network_role_tag: + - oam + vm_flavor_name: + get_input: fsb_flavor_name + port_FSB_OAM_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: true + floating_ip_count_required: + is_required: false + port_FSB2_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_FSB2_Internal2_security_groups: + - - int2_security_group + compute_fsb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + port_FSB2_Internal1_mac_address: + get_input: fsb2_Internal1_mac + compute_fsb_scheduler_hints: + - group: VM_Affinity_group + compute_fsb_name: + - get_input: fsb_name_1 + port_FSB2_Internal1_security_groups: + - - int1_security_group + port_FSB_OAM_network: + - get_input: oam_net_name + port_FSB_OAM_security_groups: + - - oam_security_group + port_FSB2_Internal1_network: + - Internal1_net + port_FSB2_Internal2_mac_address: + get_input: fsb2_Internal1_mac + port_FSB2_Internal2_mac_requirements: + mac_count_required: + is_required: true + port_FSB_OAM_mac_requirements: + mac_count_required: + is_required: false + port_FSB2_Internal2_replacement_policy: + - AUTO + port_FSB2_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_FSB_OAM_replacement_policy: + - AUTO + port_FSB2_Internal2_network: + - Internal2_net + port_FSB2_Internal1_replacement_policy: + - AUTO + compute_fsb_availability_zone: + - get_input: availability_zone_1 + port_FSB_OAM_fixed_ips: + - ip_address: + get_input: fsb_oam_ip_1 + port_FSB2_Internal1_mac_requirements: + mac_count_required: + is_required: true + service_template_filter: + substitute_service_template: Nested_fsb_1ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: fsb + nfc_naming_code: fsb + requirements: + - link_fsb_FSB2_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_fsb_FSB2_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + oam_security_group: + type: org.openecomp.resource.vfc.rules.nodes.heat.network.neutron.SecurityRules + properties: + name: + str_replace: + template: $VNF_NAME_$SECGROUPNAME + params: + $SECGROUPNAME: + get_input: oam_sec_group_name + $VNF_NAME: + get_input: vnf_name + rules: + - protocol: tcp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: udp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: icmp + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + - protocol: tcp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: udp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: icmp + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + requirements: + - port: + capability: attachment_fsb_FSB_OAM + node: abstract_fsb + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_fsb_FSB_OAM + node: abstract_fsb_1 + relationship: org.openecomp.relationships.AttachesTo + groups: + vmme_gpb3_group: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/vmme_gpb3.yml + description: | + Module HOT template to create vmme 1-8 gpb + members: + - abstract_gpb + - abstract_gpb_1 + - abstract_gpb_2 + - abstract_gpb_3 + - abstract_gpb_4 + - abstract_gpb_5 + - abstract_gpb_6 + - abstract_gpb_7 + base_vmme_group: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/base_vmme.yml + description: | + Base HOT template to create vmme 2 fsb 2 ncb + members: + - int2_security_group + - oam_security_group + - gtp_security_group + - Internal2_net + - int1_security_group + - Internal1_net + - abstract_ncb + - abstract_ncb_1 + - abstract_fsb + - abstract_fsb_1 + base_vmme_volume_group: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/base_vmme_volume.yml + description: HOT template for vMME Cinder Volumes + members: + - fsb_volume_0 + - fsb_volume_1 + vmme_gpb1_group: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/vmme_gpb1.yml + description: | + Module HOT template to create vmme 1-8 gpb + members: + - abstract_gpb + - abstract_gpb_1 + - abstract_gpb_2 + - abstract_gpb_3 + - abstract_gpb_4 + - abstract_gpb_5 + - abstract_gpb_6 + - abstract_gpb_7 + vmme_gpb4_group: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/vmme_gpb4.yml + description: | + Module HOT template to create vmme 1-8 gpb + members: + - abstract_gpb + - abstract_gpb_1 + - abstract_gpb_2 + - abstract_gpb_3 + - abstract_gpb_4 + - abstract_gpb_5 + - abstract_gpb_6 + - abstract_gpb_7 + vmme_gpb2_group: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/vmme_gpb2.yml + description: | + Module HOT template to create vmme 1-8 gpb + members: + - abstract_gpb + - abstract_gpb_1 + - abstract_gpb_2 + - abstract_gpb_3 + - abstract_gpb_4 + - abstract_gpb_5 + - abstract_gpb_6 + - abstract_gpb_7 + VM_Affinity_group: + type: tosca.groups.Root + members: + - abstract_ncb + - abstract_ncb_1 + - abstract_vlc + - abstract_fsb + - abstract_fsb_1 + - abstract_gpb + - abstract_gpb_1 + - abstract_gpb_2 + - abstract_gpb_3 + - abstract_gpb_4 + - abstract_gpb_5 + - abstract_gpb_6 + - abstract_gpb_7 + vmme_vlc_group: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/vmme_vlc.yml + description: | + Module HOT template to create vmme 8 vlcs + members: + - abstract_vlc + outputs: + oam_management_v4_address: + description: ID of OAM VIP to be provisioned in A&AI + value: + get_input: vip_oam_management_v4_ip + fsb_volume_id_1: + description: ID of Cinder Volume for FSB2 + value: fsb_volume_1 + security_group_sctp_b_id: + description: ID of sctpb_security_group + value: UNSUPPORTED_RESOURCE_sctpb_security_group + service_instance_id_0: + description: ID of Service Instance used for vLCs + value: UNSUPPORTED_RESOURCE_template_ServiceInstance_VLC + security_group_sctp_a_id: + description: ID of sctpa_security_group + value: UNSUPPORTED_RESOURCE_sctpa_security_group + fsb_volume_id_0: + description: ID of Cinder Volume for FSB1 + value: fsb_volume_0 + policies: + VM_Affinity_policy: + type: org.openecomp.policies.placement.Antilocate + properties: + container_type: host + targets: + - VM_Affinity_group @@ -0,0 +1,3585 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +metadata: + template_name: Main +imports: +- openecomp_heat_index: + file: openecomp-heat/_index.yml +- GlobalSubstitutionTypes: + file: GlobalSubstitutionTypesServiceTemplate.yaml +topology_template: + inputs: + vlc4_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc4_Internal2 + default: 00:80:37:0E:04:12 + sctp-a-egress_rule_application: + hidden: false + immutable: false + type: string + description: application for the SecurityGroup + default: any + sctp-b-ipv6-ingress-src_start_port: + hidden: false + immutable: false + type: float + description: IPV6 start port + default: 0 + constraints: + - in_range: + - 0 + - 65535 + ncb1_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to ncb1_Internal2 + default: 00:80:37:0E:09:12 + sctp-a-ipv6-ingress_ethertype: + hidden: false + immutable: false + type: string + description: IPV6 ethertype + default: IPv4 + gpb8_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb8_Internal1 + default: 00:80:37:0E:10:22 + sctp-a-ingress_rule_protocol: + hidden: false + immutable: false + type: string + description: protocol for the SecurityGroup + default: any + sctp-b-display_name: + hidden: false + immutable: false + type: string + description: display_name for the SecurityGroup + default: epc-sctp-b-ipv4v6-sec-group + sctp-a-ingress_ethertype: + hidden: false + immutable: false + type: string + description: ethertype for the SecurityGroup + default: IPv4 + sctp-a-egress-src_start_port: + hidden: false + immutable: false + type: float + description: start_port for the SecurityGroup + default: 0 + constraints: + - in_range: + - 0 + - 65535 + ncb_flavor_name: + hidden: false + immutable: false + type: string + description: Flavor to use for servers ncb + default: nv.c8r32d1 + vlc3_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc3_Internal1 + default: 00:80:37:0E:03:12 + Internal2_net_cidr: + hidden: false + immutable: false + type: string + description: CIDR for internal-2 network + default: 169.255.0.0 + sctp-a-egress-dst_start_port: + hidden: false + immutable: false + type: float + description: start_port for the SecurityGroup + default: 0 + constraints: + - in_range: + - 0 + - 65535 + sctp-a-egress_ethertype: + hidden: false + immutable: false + type: string + description: ethertype for the SecurityGroup + default: IPv4 + gpb4_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb4_Internal2 + default: 00:80:37:0E:0C:22 + sctp-b-ipv6-egress_rule_application: + hidden: false + immutable: false + type: string + description: IPV6 Rule-application + default: any + vlc8_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc8_Internal1 + default: 00:80:37:0E:08:12 + sctp-b-ipv6-ingress-src_end_port: + hidden: false + immutable: false + type: float + description: IPV6 ending port for destination + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + fsb2_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to fsb2_Internal1 + default: 00:80:37:0E:0D:12 + sctp-b-name: + hidden: false + immutable: false + type: string + description: name for the SecurityGroup + default: epc-sctp-b-ipv4v6-sec-group + sctp-b-ipv6-egress_ethertype: + hidden: false + immutable: false + type: string + description: IPV6 ethertype + default: IPv4 + internal_net_id_1: + hidden: false + immutable: false + type: string + description: UUID of Internal2_net + default: e3397c69-a942-49aa-81cb-fb91ff34abc8 + sctp-a-egress_dst_subnet_prefix: + hidden: false + immutable: false + type: string + description: ip_prefix for the SecurityGroup + default: 0.0.0.0 + internal_net_id_0: + hidden: false + immutable: false + type: string + description: UUID of Internal1_net + default: 871de971-22ac-47b6-befb-50e7d4cb67ea + sctp_b_net_fqdn: + hidden: false + immutable: false + type: string + description: Network FQDN SCTPB + default: default-domain:vMME-24474-Ericsson-WTC-Lab-vLCP1-4:vMME-24474-Ericsson-WTC-Lab-vLCP1-4_gn_SCTPB_net_1 + sctp-a-ipv6-ingress_rule_application: + hidden: false + immutable: false + type: string + description: IPV6 Rule-application + default: any + sctp-b-ipv6-ingress_src_subnet_prefix_len: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix length + default: '0' + ncb_name_1: + hidden: false + immutable: false + type: string + description: Name of ncb2 + default: zrdm3mmex59ncb002 + ncb_name_0: + hidden: false + immutable: false + type: string + description: Name of ncb1 + default: zrdm3mmex59ncb001 + vlc_st_virtualization_type: + hidden: false + immutable: false + type: string + description: Indicates virtualization type + default: virtual-machine + vlc2_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc2_Internal1 + default: 00:80:37:0E:02:12 + sctp-b-ingress-dst_start_port: + hidden: false + immutable: false + type: float + description: start_port for the SecurityGroup + default: 0 + constraints: + - in_range: + - 0 + - 65535 + sctp-a-display_name: + hidden: false + immutable: false + type: string + description: display_name for the SecurityGroup + default: epc-sctp-a-ipv4v6-sec-group + sctp-b-ingress_rule_application: + hidden: false + immutable: false + type: string + description: application for the SecurityGroup + default: any + int2_sec_group_name: + hidden: false + immutable: false + type: string + description: SecurityGroup name for internal-2 + default: int2-sec-group + gpb5_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb5_Internal2 + default: 00:80:37:0E:0D:22 + sctp-a-egress-dst_subnet_prefix_v6: + hidden: false + immutable: false + type: string + description: dst subnet + default: '::' + OS::stack_name: + type: string + required: false + sctp-b-egress-src_end_port: + hidden: false + immutable: false + type: float + description: end_port for the SecurityGroup + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + Internal2_shared: + hidden: false + immutable: false + type: string + description: Whether Shared or private internal-2 network + default: false + sctp-a-ipv6-egress_rule_protocol: + hidden: false + immutable: false + type: string + description: IPV6 Rule-protocol + default: any + Internal2_rpf: + hidden: false + immutable: false + type: string + description: Reverse Path Forwarding Enabled/Disabled internal-2 network + default: disable + vlc5_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc5_Internal2 + default: 00:80:37:0E:05:12 + sctp-a-ipv6-egress_src_end_port: + hidden: false + immutable: false + type: string + description: IPV6 end port + default: 65535 + Internal1_forwarding_mode: + hidden: false + immutable: false + type: string + description: L2 or L3 forwarding mode for internal-1 network + default: l2 + gpb3_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb3_Internal1 + default: 00:80:37:0E:0B:22 + vip_oam_management_v4_ip: + hidden: false + immutable: false + type: string + description: IP address of OAM service IP address to be provisioned in A&AI + default: 107.239.72.176 + vmi_oam_preference_primary: + hidden: false + immutable: false + type: float + description: Preference for primary interface/port + default: 200 + sctp-b-src_subnet_prefix_v6: + hidden: false + immutable: false + type: string + description: ip_prefix for the SecurityGroup + default: '::' + sctp-a-egress_dst_subnet_prefix_len: + hidden: false + immutable: false + type: float + description: ip_prefix_len for the SecurityGroup + default: '0' + constraints: + - in_range: + - 0 + - 32 + security_group_sctp_b_id: + hidden: false + immutable: false + type: string + description: Security Group UUID for output + default: 92a4ae54-1733-4d03-b488-f178bb9f7b82 + Internal2_forwarding_mode: + hidden: false + immutable: false + type: string + description: L2 or L3 forwarding mode for internal-2 network + default: l2 + sctp-a-ipv6-egress_dst_end_port: + hidden: false + immutable: false + type: string + description: IPV6 end port + default: 65535 + sctp-b-egress-dst_subnet_prefix_v6: + hidden: false + immutable: false + type: string + description: dst subnet + default: '::' + sctp-b-egress_dst_subnet_prefix: + hidden: false + immutable: false + type: string + description: ip_prefix for the SecurityGroup + default: 0.0.0.0 + security_group_oam_id: + hidden: false + immutable: false + type: string + description: Security Group UUID for output + default: 4ae4aa74-3e8e-4f2b-8b5f-a8bd262da96b + gpb2_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb2_Internal1 + default: 00:80:37:0E:0A:22 + security_group_int1_id: + hidden: false + immutable: false + type: string + description: UUID of Internal1_net security group + default: 94c62578-835d-4801-9372-70a2cfb22683 + sctp-a-egress_action: + hidden: false + immutable: false + type: string + description: simple_action for the SecurityGroup + default: pass + oam_net_fqdn: + hidden: false + immutable: false + type: string + description: Network FQDN OAM + default: default-domain:vMME-24474-Ericsson-WTC-Lab-vLCP1-4:vMME-24474-Ericsson-WTC-Lab-vLCP1-4_OAM_net_1 + ncb2_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to ncb2_Internal2 + default: 00:80:37:0E:0F:12 + vlc_st_interface_type_sctp_a: + hidden: false + immutable: false + type: string + description: service_interface_type for the ServiceTemplate + default: left + gpb3_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb3_Internal2 + default: 00:80:37:0E:0B:22 + vlc_st_interface_type_sctp_b: + hidden: false + immutable: false + type: string + description: service_interface_type for the ServiceTemplate + default: right + gpb1_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb1_Internal2 + default: 00:80:37:0E:09:22 + oam_net_name: + hidden: false + immutable: false + type: string + description: Network Name OAM + default: vMME-24474-Ericsson-WTC-Lab-vLCP1-4_OAM_net_1 + sctp-b-ingress-src_start_port: + hidden: false + immutable: false + type: float + description: start_port for the SecurityGroup + default: 0 + constraints: + - in_range: + - 0 + - 65535 + fsb1_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to fsb1_Internal1 + default: 00:80:37:0E:0B:12 + sctp-b-ingress_dst_addresses: + hidden: false + immutable: false + type: string + description: security_group for the SecurityGroup + default: local + vlc_st_interface_type_oam: + hidden: false + immutable: false + type: string + description: service_interface_type for the ServiceTemplate + default: management + shc_monitor_type: + hidden: false + immutable: false + type: string + description: health check + default: PING + oam_sec_group_name: + hidden: false + immutable: false + type: string + description: SecurityGroup name for OAM + default: oam-sec-group + Internal2_net_gateway: + hidden: false + immutable: false + type: string + description: gateway for internal-2 network + default: 169.255.0.3 + evac_policy: + hidden: false + immutable: false + type: string + description: CMHA Policy + default: Evacuate + server_group_id_0: + hidden: false + immutable: false + type: string + description: ID of Anti-Affinity Policy-based Server Group + default: ec99a73d-38f8-4280-8103-ba8ee584629f + vlc8_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc8_Internal2 + default: 00:80:37:0E:08:12 + sctp-b-ipv6-egress_rule_protocol: + hidden: false + immutable: false + type: string + description: IPV6 Rule-protocol + default: any + gtp_sec_group_name: + hidden: false + immutable: false + type: string + description: SecurityGroup name for GTP + default: gtp-sec-group + vlc_sctp_b_v6_ip_2: + hidden: false + immutable: false + type: string + description: Static IP vlc3 SCTPB + default: fd00:200:200:5:0:0:0:24 + vlc_sctp_b_v6_ip_1: + hidden: false + immutable: false + type: string + description: Static IP vlc2 SCTPB + default: fd00:200:200:5:0:0:0:17 + sctp-a-ipv6-egress_dst_subnet_prefix: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix + default: 0.0.0.0 + vlc_sctp_b_v6_ip_0: + hidden: false + immutable: false + type: string + description: Static IP vlc1 SCTPB + default: fd00:200:200:5:0:0:0:16 + vlc4_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc4_Internal1 + default: 00:80:37:0E:04:12 + vlc_sctp_b_v6_ip_6: + hidden: false + immutable: false + type: string + description: Static IP vlc7 SCTPB + default: fd00:200:200:5:0:0:0:28 + vlc_sctp_b_v6_ip_5: + hidden: false + immutable: false + type: string + description: Static IP vlc6 SCTPB + default: fd00:200:200:5:0:0:0:27 + vlc_sctp_b_v6_ip_4: + hidden: false + immutable: false + type: string + description: Static IP vlc5 SCTPB + default: fd00:200:200:5:0:0:0:26 + vlc_sctp_b_v6_ip_3: + hidden: false + immutable: false + type: string + description: Static IP vlc4 SCTPB + default: fd00:200:200:5:0:0:0:25 + sctp_b_net_name: + hidden: false + immutable: false + type: string + description: Network Name SCTPB + default: vMME-24474-Ericsson-WTC-Lab-vLCP1-4_gn_SCTPB_net_1 + sctp-b-ipv6-egress_dst_subnet_prefix_len: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix + default: '0' + sctp-a-egress_rule_protocol: + hidden: false + immutable: false + type: string + description: protocol for the SecurityGroup + default: any + Internal1_shared: + hidden: false + immutable: false + type: string + description: Whether Shared or private internal-1 network + default: false + shc_url_path: + hidden: false + immutable: false + type: string + description: health check + default: local-ip + Internal2_net_cidr_len: + hidden: false + immutable: false + type: string + description: CIDR length for internal-2 network + default: 17 + sctp-a-ingress-src_end_port: + hidden: false + immutable: false + type: float + description: end_port for the SecurityGroup + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + sctp-b-ipv6-ingress_src_subnet_prefix: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix + default: 0.0.0.0 + sctp-a-egress-dst_end_port: + hidden: false + immutable: false + type: float + description: end_port for the SecurityGroup + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + sctp-a-ingress_action: + hidden: false + immutable: false + type: string + description: simple_action for the SecurityGroup + default: pass + sctp-b-ipv6-ingress_action: + hidden: false + immutable: false + type: string + description: IPV6 action + default: pass + vlc_st_service_type: + hidden: false + immutable: false + type: string + description: service type + default: firewall + sctp-b-ipv6-ingress-dst_start_port: + hidden: false + immutable: false + type: string + description: IPV6 starting port for destination + default: 0 + vlc_st_availability_zone: + hidden: false + immutable: false + type: string + description: Indicates availability zone is enabled + default: true + vlc7_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc7_Internal1 + default: 00:80:37:0E:07:12 + fsb_volume_image_name_1: + label: MME_FSB2 + hidden: false + immutable: false + type: string + description: volume name + default: MME_FSB2_1_3_GA.qcow2 + vlc_oam_ip_6: + hidden: false + immutable: false + type: string + description: Static IP vlc7 OAM + default: 107.239.72.151 + sctp-a-ipv6-ingress_src_subnet_prefix_len: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix length + default: '0' + vlc_oam_ip_7: + hidden: false + immutable: false + type: string + description: Static IP vlc8 OAM + default: 107.239.72.152 + Internal1_allow_transit: + hidden: false + immutable: false + type: string + description: Allow/disallow transit internal-1 network + default: true + vlc_oam_ip_2: + hidden: false + immutable: false + type: string + description: Static IP vlc3 OAM + default: 107.239.72.157 + vlc_oam_ip_3: + hidden: false + immutable: false + type: string + description: Static IP vlc4 OAM + default: 107.239.72.158 + vlc_gtp_ip_0: + hidden: false + immutable: false + type: string + description: Static IP vlc1 GTP + default: 107.243.47.208 + vlc_oam_ip_4: + hidden: false + immutable: false + type: string + description: Static IP vlc5 OAM + default: 107.239.72.149 + fsb_volume_image_name_0: + label: MME_FSB1 + hidden: false + immutable: false + type: string + description: volume name + default: MME_FSB1_1_3_GA.qcow2 + vlc_gtp_ip_1: + hidden: false + immutable: false + type: string + description: Static IP vlc2 GTP + default: 107.243.47.209 + vlc_oam_ip_5: + hidden: false + immutable: false + type: string + description: Static IP vlc6 OAM + default: 107.239.72.150 + vlc_gtp_ip_2: + hidden: false + immutable: false + type: string + description: Static IP vlc3 GTP + default: 107.243.47.216 + vlc_name_6: + hidden: false + immutable: false + type: string + description: Name of vlc7 + default: zrdm3mmex59vlc007 + vlc_gtp_ip_3: + hidden: false + immutable: false + type: string + description: Static IP vlc4 GTP + default: 107.243.47.217 + vlc_name_7: + hidden: false + immutable: false + type: string + description: Name of vlc8 + default: zrdm3mmex59vlc008 + security_group_sctp_a_id: + hidden: false + immutable: false + type: string + description: Security Group UUID for output + default: 3cd8a524-77ff-4980-ae2a-d19ba70e0511 + vlc_gtp_ip_4: + hidden: false + immutable: false + type: string + description: Static IP vlc5 GTP + default: 107.243.47.218 + vlc_gtp_ip_5: + hidden: false + immutable: false + type: string + description: Static IP vlc6 GTP + default: 107.243.47.219 + vlc_gtp_ip_6: + hidden: false + immutable: false + type: string + description: Static IP vlc7 GTP + default: 107.243.47.220 + vlc_name_2: + hidden: false + immutable: false + type: string + description: Name of vlc3 + default: zrdm3mmex59vlc003 + vlc_gtp_ip_7: + hidden: false + immutable: false + type: string + description: Static IP vlc8 GTP + default: 107.243.47.221 + vlc_name_3: + hidden: false + immutable: false + type: string + description: Name of vlc4 + default: zrdm3mmex59vlc004 + vlc_name_4: + hidden: false + immutable: false + type: string + description: Name of vlc5 + default: zrdm3mmex59vlc005 + vlc_name_5: + hidden: false + immutable: false + type: string + description: Name of vlc6 + default: zrdm3mmex59vlc006 + fsb_volume_id_1: + hidden: false + immutable: false + type: string + description: ID of Cinder Volume for FSB2 + default: 5bd0560c-bfd0-47dc-a84a-554e2698c925 + sctp-a-ipv6-ingress_action: + hidden: false + immutable: false + type: string + description: IPV6 action + default: pass + vlc_name_0: + hidden: false + immutable: false + type: string + description: Name of vlc1 + default: zrdm3mmex59vlc001 + vlc_name_1: + hidden: false + immutable: false + type: string + description: Name of vlc2 + default: zrdm3mmex59vlc002 + vlc_oam_route_prefixes: + hidden: false + immutable: false + type: json + description: Route prefixes for static routing on OAM + sctp-b-egress_rule_application: + hidden: false + immutable: false + type: string + description: application for the SecurityGroup + default: any + vlc_oam_ip_0: + hidden: false + immutable: false + type: string + description: Static IP vlc1 OAM + default: 107.239.72.155 + vlc_oam_ip_1: + hidden: false + immutable: false + type: string + description: Static IP vlc2 OAM + default: 107.239.72.156 + vlc6_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc6_Internal1 + default: 00:80:37:0E:06:12 + fsb_volume_id_0: + hidden: false + immutable: false + type: string + description: ID of Cinder Volume for FSB1 + default: 27baa6a0-b701-4795-bf5e-4f546b350b1f + sctp-b-egress-dst_end_port: + hidden: false + immutable: false + type: float + description: end_port for the SecurityGroup + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + gpb2_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb2_Internal2 + default: 00:80:37:0E:0A:22 + sctp-a-ipv6-egress_rule_application: + hidden: false + immutable: false + type: string + description: IPV6 Rule-application + default: any + sctp-b-ipv6-egress_src_start_port: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix + default: 0 + Internal2_allow_transit: + hidden: false + immutable: false + type: string + description: Allow/disallow transit internal-2 network + default: true + fsb_volume_size: + label: volume size + hidden: false + immutable: false + type: float + description: volume size 320GB + default: 320 + constraints: + - in_range: + - 0 + - 340 + sctp-b-IPv6_ethertype: + hidden: false + immutable: false + type: string + description: IPV6 ethertype + default: IPv6 + gtp_net_fqdn: + hidden: false + immutable: false + type: string + description: Network FQDN GTP + default: default-domain:vMME-24474-Ericsson-WTC-Lab-vLCP1-4:vMME-24474-Ericsson-WTC-Lab-vLCP1-4_gn_GTP_net_1 + ncb2_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to ncb2_Internal1 + default: 00:80:37:0E:0F:12 + sctp-b-ingress_rule_protocol: + hidden: false + immutable: false + type: string + description: protocol for the SecurityGroup + default: any + sctp-b-ingress_action: + hidden: false + immutable: false + type: string + description: simple_action for the SecurityGroup + default: pass + sctp-b-egress_src_addresses: + hidden: false + immutable: false + type: string + description: security_group for the SecurityGroup + default: local + gpb7_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb7_Internal2 + default: 00:80:37:0E:0F:22 + sctp-a-ipv6-ingress-dst_start_port: + hidden: false + immutable: false + type: string + description: IPV6 starting port for destination + default: 0 + gtp_net_name: + hidden: false + immutable: false + type: string + description: Network Name GTP + default: vMME-24474-Ericsson-WTC-Lab-vLCP1-4_gn_GTP_net_1 + sctp-b-ipv6-ingress_rule_application: + hidden: false + immutable: false + type: string + description: IPV6 Rule-application + default: any + domain_name: + hidden: false + immutable: false + type: string + description: Unique name of vMME contrail domain + default: default-domain + vlc5_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc5_Internal1 + default: 00:80:37:0E:05:12 + sctp-a-egress_src_addresses: + hidden: false + immutable: false + type: string + description: security_group for the SecurityGroup + default: local + sctp-b-egress-src_start_port: + hidden: false + immutable: false + type: float + description: start_port for the SecurityGroup + default: 0 + constraints: + - in_range: + - 0 + - 65535 + shc_enabled: + hidden: false + immutable: false + type: string + description: health check + default: true + sctp-b-ipv6-ingress-dst_end_port: + hidden: false + immutable: false + type: string + description: IPV6 end port + default: 65535 + sctp-b-dst_subnet_prefix_v6: + hidden: false + immutable: false + type: string + description: ip_prefix for the SecurityGroup + default: '::' + sctp_a_net_fqdn: + hidden: false + immutable: false + type: string + description: Network FQDN SCTPA + default: default-domain:vMME-24474-Ericsson-WTC-Lab-vLCP1-4:vMME-24474-Ericsson-WTC-Lab-vLCP1-4_gn_SCTPA_net_1 + security_group_gtp_id: + hidden: false + immutable: false + type: string + description: Security Group UUID for output + default: e8ad3fe2-5f95-43e4-bbcc-da97b1c22588 + sctp-a-ipv6-ingress_src_subnet_prefix: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix + default: 0.0.0.0 + fsb_name_1: + hidden: false + immutable: false + type: string + description: Name of fsb1 + default: zrdm3mmex59fsb002 + sctp-b-egress-dst_start_port: + hidden: false + immutable: false + type: float + description: start_port for the SecurityGroup + default: 0 + constraints: + - in_range: + - 0 + - 65535 + fsb_name_0: + hidden: false + immutable: false + type: string + description: Name of fsb1 + default: zrdm3mmex59fsb001 + sctp_a_net_name: + hidden: false + immutable: false + type: string + description: Network Name SCTPA + default: vMME-24474-Ericsson-WTC-Lab-vLCP1-4_gn_SCTPA_net_1 + sctp-b-egress_dst_subnet_prefix_len: + hidden: false + immutable: false + type: float + description: ip_prefix_len for the SecurityGroup + default: '0' + constraints: + - in_range: + - 0 + - 32 + gpb1_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb1_Internal1 + default: 00:80:37:0E:09:22 + sctp-a-ingress-dst_start_port: + hidden: false + immutable: false + type: float + description: start_port for the SecurityGroup + default: 0 + constraints: + - in_range: + - 0 + - 65535 + fsb1_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to fsb1_Internal2 + default: 00:80:37:0E:0B:12 + vlc_st_service_mode: + hidden: false + immutable: false + type: string + description: service mode + default: in-network-nat + sctp-a-ipv6-egress_ethertype: + hidden: false + immutable: false + type: string + description: IPV6 ethertype + default: IPv4 + sctp-a-egress-src_end_port: + hidden: false + immutable: false + type: float + description: end_port for the SecurityGroup + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + sctp-b-egress_action: + hidden: false + immutable: false + type: string + description: simple_action for the SecurityGroup + default: pass + sctp-a-ingress-src_subnet_prefix_len: + hidden: false + immutable: false + type: float + description: ip_prefix_len for the SecurityGroup + default: '0' + constraints: + - in_range: + - 0 + - 32 + sctp-a-ipv6-ingress-src_start_port: + hidden: false + immutable: false + type: float + description: IPV6 start port + default: 0 + constraints: + - in_range: + - 0 + - 65535 + vf_module_id: + hidden: false + immutable: false + type: string + description: the vf_module_id for this instance. UUID provided by ECOMP + default: TWO + Internal1_net_cidr: + hidden: false + immutable: false + type: string + description: CIDR for internal-1 network + default: 169.253.0.0 + fsb_flavor_name: + hidden: false + immutable: false + type: string + description: Flavor to use for servers fsb1 + default: nv.c8r32d1 + sctp_rule_protocol: + hidden: false + immutable: false + type: string + description: protocol for the SecurityGroup + default: 132 + vnf_name: + hidden: false + immutable: false + type: string + description: the vnf_name for this instance. provided by ECOMP + default: zrdm3mmex59 + sctp-a-IPv6_ethertype: + hidden: false + immutable: false + type: string + description: IPV6 ethertype + default: IPv6 + vlc_sctp_b_v6_ip_7: + hidden: false + immutable: false + type: string + description: Static IP vlc8 SCTPB + default: fd00:200:200:5:0:0:0:29 + vlc6_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc6_Internal2 + default: 00:80:37:0E:06:12 + sctp-b-ingress-dst_end_port: + hidden: false + immutable: false + type: float + description: end_port for the SecurityGroup + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + vlc7_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc7_Internal2 + default: 00:80:37:0E:07:12 + sctp-a-ipv6-ingress-src_end_port: + hidden: false + immutable: false + type: float + description: IPV6 ending port for destination + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + vlc_flavor_name: + hidden: false + immutable: false + type: string + description: Flavor to use for servers vlc + default: nd.c16r64d1 + sctp-b-ipv6-egress_src_addresses: + hidden: false + immutable: false + type: string + description: IPV6 source + default: local + vlc_st_interface_type_int1: + hidden: false + immutable: false + type: string + description: service_interface_type for the ServiceTemplate + default: other1 + availability_zone_0: + hidden: false + immutable: false + type: string + description: cluster for spawnning fsb instances + default: rdm3-kvm-az02 + service_instance_id_0: + hidden: false + immutable: false + type: string + description: UUID of service instance for vLCs + default: 77c67cc8-d15f-47bc-aeb1-8d65d09e917a + availability_zone_1: + hidden: false + immutable: false + type: string + description: cluster for spawnning ncb instances + default: rdm3-kvm-az02 + vlc_st_interface_type_int2: + hidden: false + immutable: false + type: string + description: service_interface_type for the ServiceTemplate + default: other2 + sctp-a-ipv6-egress-dst_start_port: + hidden: false + immutable: false + type: string + description: IPV6 start port + default: 0 + sctp-a-ipv6-egress_dst_subnet_prefix_len: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix + default: '0' + vlc_sctp_a_ip_0: + hidden: false + immutable: false + type: string + description: Static IP vlc1 SCTPA + default: 107.243.47.144 + vlc_sctp_b_route_prefixes: + hidden: false + immutable: false + type: json + description: Route prefixes for static routing on SCTPB + vlc1_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc1_Internal1 + default: 00:80:37:0E:01:12 + sctp-b-ipv6-egress_src_end_port: + hidden: false + immutable: false + type: string + description: IPV6 end port + default: 65535 + sctp-a-ipv6-egress_src_addresses: + hidden: false + immutable: false + type: string + description: IPV6 source + default: local + vlc_sctp_a_ip_7: + hidden: false + immutable: false + type: string + description: Static IP vlc8 SCTPA + default: 107.243.47.157 + sctp-a-ingress-src_subnet_prefix_v6: + hidden: false + immutable: false + type: string + description: src subnet + default: '::' + vlc_sctp_a_ip_6: + hidden: false + immutable: false + type: string + description: Static IP vlc7 SCTPA + default: 107.243.47.156 + vlc_sctp_a_ip_5: + hidden: false + immutable: false + type: string + description: Static IP vlc6 SCTPA + default: 107.243.47.155 + sctp-a-ingress-dst_end_port: + hidden: false + immutable: false + type: float + description: end_port for the SecurityGroup + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + vlc_sctp_a_ip_4: + hidden: false + immutable: false + type: string + description: Static IP vlc5 SCTPA + default: 107.243.47.154 + vlc_sctp_a_ip_3: + hidden: false + immutable: false + type: string + description: Static IP vlc4 SCTPA + default: 107.243.47.153 + vlc_sctp_a_ip_2: + hidden: false + immutable: false + type: string + description: Static IP vlc3 SCTPA + default: 107.243.47.152 + vlc_sctp_a_ip_1: + hidden: false + immutable: false + type: string + description: Static IP vlc2 SCTPA + default: 107.243.47.145 + gpb6_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb6_Internal2 + default: 00:80:37:0E:0E:22 + security_group_int2_id: + hidden: false + immutable: false + type: string + description: UUID of Internal1_net security group + default: 1361f069-baf2-4b76-b321-7f68ba26c369 + Internal2_dhcp: + hidden: false + immutable: false + type: string + description: Whether DHCP/static IP addressing on internal-2 network + default: false + sctp-a-dst_subnet_prefix_v6: + hidden: false + immutable: false + type: string + description: ip_prefix for the SecurityGroup + default: '::' + pxe_image_name: + hidden: false + immutable: false + type: string + description: Name of image to use for server ncb + default: MME_PXE-Boot_1_3_GA.qcow2 + vlc_st_interface_type_gtp: + hidden: false + immutable: false + type: string + description: service_interface_type for the ServiceTemplate + default: other0 + ncb1_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to ncb1_Internal1 + default: 00:80:37:0E:09:12 + vlc_gtp_route_prefixes: + hidden: false + immutable: false + type: json + description: Route prefixes for static routing on GTP + int1_sec_group_name: + hidden: false + immutable: false + type: string + description: SecurityGroup name for internal-1 + default: int1-sec-group + vmi_oam_preference_secondary: + hidden: false + immutable: false + type: float + description: Preference for secondary interface/port + default: 100 + Internal1_dhcp: + hidden: false + immutable: false + type: string + description: Whether DHCP/static IP addressing on internal-1 network + default: false + fsb2_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to fsb2_Internal2 + default: 00:80:37:0E:0D:12 + Internal1_net_cidr_len: + hidden: false + immutable: false + type: string + description: CIDR length for internal-1 network + default: 17 + sctp-a-ingress_dst_addresses: + hidden: false + immutable: false + type: string + description: security_group for the SecurityGroup + default: local + sctp-b-ingress-src_subnet_prefix_len: + hidden: false + immutable: false + type: float + description: ip_prefix_len for the SecurityGroup + default: '0' + constraints: + - in_range: + - 0 + - 32 + fsb_oam_ip_1: + hidden: false + immutable: false + type: string + description: IP address of OAM vNIC for FSB2 + default: 107.239.72.154 + fsb_oam_ip_0: + hidden: false + immutable: false + type: string + description: IP address of OAM vNIC for FSB1 + default: 107.239.72.153 + shc_timeout: + hidden: false + immutable: false + type: string + description: health check + default: 5 + vlc_st_version: + hidden: false + immutable: false + type: string + description: Indicates service version + default: 2 + sctp-a-src_subnet_prefix_v6: + hidden: false + immutable: false + type: string + description: ip_prefix for the SecurityGroup + default: '::' + sctp-a-ingress_rule_application: + hidden: false + immutable: false + type: string + description: application for the SecurityGroup + default: any + sctp-b-egress_ethertype: + hidden: false + immutable: false + type: string + description: ethertype for the SecurityGroup + default: IPv4 + sctp-a-ipv6-egress_src_start_port: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix + default: 0 + instance_ip_family_v6: + hidden: false + immutable: false + type: string + description: Ipv6 instance type + default: v6 + sctp-b-ingress-src_subnet_prefix_v6: + hidden: false + immutable: false + type: string + description: src subnet + default: '::' + gpb8_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb8_Internal2 + default: 00:80:37:0E:10:22 + gpb4_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb4_Internal1 + default: 00:80:37:0E:0C:22 + sctp-a-ipv6-ingress-dst_end_port: + hidden: false + immutable: false + type: string + description: IPV6 end port + default: 65535 + Internal1_net_gateway: + hidden: false + immutable: false + type: string + description: gateway for internal-1 network + default: 169.253.0.3 + sctp-b-ipv6-egress-dst_start_port: + hidden: false + immutable: false + type: string + description: IPV6 start port + default: 0 + gpb_name_7: + hidden: false + immutable: false + type: string + description: Name of gpb8 + default: zrdm3mmex59gpb0016 + gpb_name_6: + hidden: false + immutable: false + type: string + description: Name of gpb7 + default: zrdm3mmex59gpb0015 + gpb_name_5: + hidden: false + immutable: false + type: string + description: Name of gpb6 + default: zrdm3mmex59gpb0014 + gpb_name_4: + hidden: false + immutable: false + type: string + description: Name of gpb5 + default: zrdm3mmex59gpb0013 + gpb_name_3: + hidden: false + immutable: false + type: string + description: Name of gpb4 + default: zrdm3mmex59gpb0012 + sctp-a-ipv6-ingress_dst_addresses: + hidden: false + immutable: false + type: string + description: IPV6 destination + default: local + gpb_name_2: + hidden: false + immutable: false + type: string + description: Name of gpb3 + default: zrdm3mmex59gpb0011 + shc_delay: + hidden: false + immutable: false + type: string + description: health check + default: 3 + gpb_name_1: + hidden: false + immutable: false + type: string + description: Name of gpb2 + default: zrdm3mmex59gpb0010 + sctp-b-ipv6-egress_action: + hidden: false + immutable: false + type: string + description: IPV6 action + default: pass + vlc3_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc3_Internal2 + default: 00:80:37:0E:03:12 + gpb_name_0: + hidden: false + immutable: false + type: string + description: Name of gpb1 + default: zrdm3mmex59gpb009 + sctp-a-ipv6-egress_action: + hidden: false + immutable: false + type: string + description: IPV6 action + default: pass + gpb5_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb5_Internal1 + default: 00:80:37:0E:0D:22 + sctp-b-ipv6-ingress_rule_protocol: + hidden: false + immutable: false + type: string + description: IPV6 Rule-protocol + default: any + shc_max_retries: + hidden: false + immutable: false + type: string + description: health check + default: 2 + fsb_volume_type: + label: volume type + hidden: false + immutable: false + type: string + description: volume type SolidFire + default: SF-Default-SSD + sctp-a-name: + hidden: false + immutable: false + type: string + description: name for the SecurityGroup + default: epc-sctp-a-ipv4v6-sec-group + vlc_sctp_b_ip_5: + hidden: false + immutable: false + type: string + description: Static IP vlc6 SCTPB + default: 107.243.47.187 + vlc_sctp_b_ip_4: + hidden: false + immutable: false + type: string + description: Static IP vlc5 SCTPB + default: 107.243.47.186 + vlc_sctp_b_ip_3: + hidden: false + immutable: false + type: string + description: Static IP vlc4 SCTPB + default: 107.243.47.185 + vlc_sctp_b_ip_2: + hidden: false + immutable: false + type: string + description: Static IP vlc3 SCTPB + default: 107.243.47.184 + sctp-b-egress_rule_protocol: + hidden: false + immutable: false + type: string + description: protocol for the SecurityGroup + default: any + vnf_id: + hidden: false + immutable: false + type: string + description: the vf_id for this instance. UUID provided by ECOMP + default: zrdm3mmex59 + vlc_sctp_b_ip_7: + hidden: false + immutable: false + type: string + description: Static IP vlc8 SCTPB + default: 107.243.47.189 + vlc_sctp_b_ip_6: + hidden: false + immutable: false + type: string + description: Static IP vlc7 SCTPB + default: 107.243.47.188 + vlc_sctp_b_ip_1: + hidden: false + immutable: false + type: string + description: Static IP vlc2 SCTPB + default: 107.243.47.177 + gpb6_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb6_Internal1 + default: 00:80:37:0E:0E:22 + sctp-b-ipv6-egress_dst_end_port: + hidden: false + immutable: false + type: string + description: IPV6 end port + default: 65535 + vlc_sctp_b_ip_0: + hidden: false + immutable: false + type: string + description: Static IP vlc1 SCTPB + default: 107.243.47.176 + vlc2_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc2_Internal2 + default: 00:80:37:0E:02:12 + sctp-b-ingress-src_subnet_prefix: + hidden: false + immutable: false + type: string + description: ip_prefix for the SecurityGroup + default: 0.0.0.0 + gpb_flavor_name: + hidden: false + immutable: false + type: string + description: Flavor to use for servers gpb + default: nv.c20r64d1 + vlc_sctp_a_route_prefixes: + hidden: false + immutable: false + type: json + description: Route prefixes for static routing on SCTPA + sctp-b-ipv6-ingress_dst_addresses: + hidden: false + immutable: false + type: string + description: IPV6 destination + default: local + sctp-b-ipv6-ingress_ethertype: + hidden: false + immutable: false + type: string + description: IPV6 ethertype + default: IPv4 + sctp-b-ipv6-egress_dst_subnet_prefix: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix + default: 0.0.0.0 + sctp-a-ingress-src_subnet_prefix: + hidden: false + immutable: false + type: string + description: ip_prefix for the SecurityGroup + default: 0.0.0.0 + vlc1_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc1_Internal2 + default: 00:80:37:0E:01:12 + Internal1_rpf: + hidden: false + immutable: false + type: string + description: Reverse Path Forwarding Enabled/Disabled internal-1 network + default: disable + sctp-b-ingress_ethertype: + hidden: false + immutable: false + type: string + description: ethertype for the SecurityGroup + default: IPv4 + sctp-b-ingress-src_end_port: + hidden: false + immutable: false + type: float + description: end_port for the SecurityGroup + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + sctp-a-ipv6-ingress_rule_protocol: + hidden: false + immutable: false + type: string + description: IPV6 Rule-protocol + default: any + vlc_sctp_a_v6_ip_7: + hidden: false + immutable: false + type: string + description: Static IP vlc8 SCTPA + default: fd00:200:200:4:0:0:0:29 + vlc_sctp_a_v6_ip_6: + hidden: false + immutable: false + type: string + description: Static IP vlc7 SCTPA + default: fd00:200:200:4:0:0:0:28 + gpb7_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb7_Internal1 + default: 00:80:37:0E:0F:22 + vlc_sctp_a_v6_ip_5: + hidden: false + immutable: false + type: string + description: Static IP vlc6 SCTPA + default: fd00:200:200:4:0:0:0:27 + vlc_sctp_a_v6_ip_4: + hidden: false + immutable: false + type: string + description: Static IP vlc5 SCTPA + default: fd00:200:200:4:0:0:0:26 + vlc_sctp_a_v6_ip_3: + hidden: false + immutable: false + type: string + description: Static IP vlc4 SCTPA + default: fd00:200:200:4:0:0:0:25 + vlc_sctp_a_v6_ip_2: + hidden: false + immutable: false + type: string + description: Static IP vlc3 SCTPA + default: fd00:200:200:4:0:0:0:24 + sctp-a-ingress-src_start_port: + hidden: false + immutable: false + type: float + description: start_port for the SecurityGroup + default: 0 + constraints: + - in_range: + - 0 + - 65535 + vlc_sctp_a_v6_ip_1: + hidden: false + immutable: false + type: string + description: Static IP vlc2 SCTPA + default: fd00:200:200:4:0:0:0:17 + vlc_sctp_a_v6_ip_0: + hidden: false + immutable: false + type: string + description: Static IP vlc1 SCTPA + default: fd00:200:200:4:0:0:0:16 + node_templates: + abstract_gpb_1: + type: org.openecomp.resource.abstract.nodes.gpb_1 + directives: + - substitutable + properties: + compute_gpb_name: + - get_input: gpb_name_1 + vm_flavor_name: + get_input: gpb_flavor_name + compute_gpb_scheduler_hints: + - group: + get_input: server_group_id_0 + port_gpb2_Internal1_security_groups: + - - get_input: security_group_int1_id + compute_gpb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + port_gpb2_Internal2_network: + - get_input: internal_net_id_1 + port_gpb2_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + vm_image_name: + get_input: pxe_image_name + port_gpb2_Internal1_replacement_policy: + - AUTO + port_gpb2_Internal1_network: + - get_input: internal_net_id_0 + port_gpb2_Internal2_replacement_policy: + - AUTO + port_gpb2_Internal1_mac_requirements: + mac_count_required: + is_required: true + compute_gpb_availability_zone: + - get_input: availability_zone_1 + port_gpb2_Internal1_mac_address: + get_input: gpb2_Internal1_mac + port_gpb2_Internal2_mac_requirements: + mac_count_required: + is_required: true + port_gpb2_Internal2_mac_address: + get_input: gpb2_Internal1_mac + port_gpb2_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb2_Internal2_security_groups: + - - get_input: security_group_int2_id + service_template_filter: + substitute_service_template: Nested_gpb_1ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: gpb + nfc_naming_code: gpb + requirements: + - link_gpb_gpb2_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_gpb_gpb2_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + abstract_gpb_2: + type: org.openecomp.resource.abstract.nodes.gpb_2 + directives: + - substitutable + properties: + port_gpb3_Internal1_replacement_policy: + - AUTO + compute_gpb_name: + - get_input: gpb_name_2 + port_gpb3_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb3_Internal2_replacement_policy: + - AUTO + vm_flavor_name: + get_input: gpb_flavor_name + port_gpb3_Internal2_security_groups: + - - get_input: security_group_int2_id + compute_gpb_scheduler_hints: + - group: + get_input: server_group_id_0 + compute_gpb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + vm_image_name: + get_input: pxe_image_name + port_gpb3_Internal1_security_groups: + - - get_input: security_group_int1_id + port_gpb3_Internal2_network: + - get_input: internal_net_id_1 + compute_gpb_availability_zone: + - get_input: availability_zone_0 + port_gpb3_Internal1_network: + - get_input: internal_net_id_0 + port_gpb3_Internal1_mac_requirements: + mac_count_required: + is_required: true + port_gpb3_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb3_Internal1_mac_address: + get_input: gpb3_Internal1_mac + port_gpb3_Internal2_mac_address: + get_input: gpb3_Internal1_mac + port_gpb3_Internal2_mac_requirements: + mac_count_required: + is_required: true + service_template_filter: + substitute_service_template: Nested_gpb_2ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: gpb + nfc_naming_code: gpb + requirements: + - link_gpb_gpb3_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_gpb_gpb3_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + abstract_vlc: + type: org.openecomp.resource.abstract.nodes.vlc + directives: + - substitutable + properties: + port_template_VMInt_SCTP_A_vlc_virtual_network_refs: + - - get_input: sctp_a_net_fqdn + port_template_VMInt_INT1_vlc_security_group_refs: + - - get_input: security_group_int1_id + vm_flavor_name: + get_input: vlc_flavor_name + port_template_VMInt_INT2_vlc_port_tuple_refs: + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc4 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc3 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc2 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc1 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc8 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc7 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc6 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc5 + vm_image_name: + get_input: pxe_image_name + port_template_VMInt_INT1_vlc_port_tuple_refs: + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc4 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc3 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc2 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc1 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc8 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc7 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc6 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc5 + port_template_VMInt_INT2_vlc_virtual_network_refs: + - - get_input: internal_net_id_1 + port_template_VMInt_OAM_vlc_virtual_network_refs: + - - get_input: oam_net_fqdn + port_template_VMInt_OAM_vlc_port_tuple_refs: + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc4 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc3 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc2 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc1 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc8 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc7 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc6 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc5 + port_template_VMInt_INT2_vlc_virtual_machine_interface_mac_addresses: + - - get_input: vlc4_Internal2_mac + - - get_input: vlc3_Internal2_mac + - - get_input: vlc2_Internal2_mac + - - get_input: vlc1_Internal2_mac + - - get_input: vlc8_Internal2_mac + - - get_input: vlc7_Internal2_mac + - - get_input: vlc6_Internal2_mac + - - get_input: vlc5_Internal2_mac + port_template_VMInt_SCTP_B_vlc_port_tuple_refs: + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc4 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc3 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc2 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc1 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc8 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc7 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc6 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc5 + port_template_VMInt_GTP_vlc_security_group_refs: + - - get_input: security_group_gtp_id + compute_vlc_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + port_template_VMInt_OAM_vlc_security_group_refs: + - - get_input: security_group_oam_id + compute_vlc_contrail_service_instance_ind: + - true + - true + - true + - true + - true + - true + - true + - true + port_template_VMInt_GTP_vlc_port_tuple_refs: + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc4 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc3 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc2 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc1 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc8 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc7 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc6 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc5 + port_template_VMInt_SCTP_B_vlc_virtual_network_refs: + - - get_input: sctp_b_net_fqdn + port_template_VMInt_INT2_vlc_security_group_refs: + - - get_input: security_group_int2_id + port_template_VMInt_SCTP_B_vlc_security_group_refs: + - - get_input: security_group_sctp_b_id + port_template_VMInt_INT1_vlc_virtual_network_refs: + - - get_input: internal_net_id_0 + port_template_VMInt_SCTP_A_vlc_port_tuple_refs: + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc4 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc3 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc2 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc1 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc8 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc7 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc6 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc5 + compute_vlc_scheduler_hints: + - group: + get_input: server_group_id_0 + - group: + get_input: server_group_id_0 + - group: + get_input: server_group_id_0 + - group: + get_input: server_group_id_0 + - group: + get_input: server_group_id_0 + - group: + get_input: server_group_id_0 + - group: + get_input: server_group_id_0 + - group: + get_input: server_group_id_0 + compute_vlc_name: + - get_input: vlc_name_3 + - get_input: vlc_name_2 + - get_input: vlc_name_1 + - get_input: vlc_name_0 + - get_input: vlc_name_7 + - get_input: vlc_name_6 + - get_input: vlc_name_5 + - get_input: vlc_name_4 + port_template_VMInt_SCTP_A_vlc_security_group_refs: + - - get_input: security_group_sctp_a_id + compute_vlc_availability_zone: + - get_input: availability_zone_1 + - get_input: availability_zone_0 + - get_input: availability_zone_1 + - get_input: availability_zone_0 + - get_input: availability_zone_1 + - get_input: availability_zone_0 + - get_input: availability_zone_1 + - get_input: availability_zone_0 + port_template_VMInt_INT1_vlc_virtual_machine_interface_mac_addresses: + - - get_input: vlc4_Internal1_mac + - - get_input: vlc3_Internal1_mac + - - get_input: vlc2_Internal1_mac + - - get_input: vlc1_Internal1_mac + - - get_input: vlc8_Internal1_mac + - - get_input: vlc7_Internal1_mac + - - get_input: vlc6_Internal1_mac + - - get_input: vlc5_Internal1_mac + port_template_VMInt_GTP_vlc_virtual_network_refs: + - - get_input: gtp_net_fqdn + service_template_filter: + substitute_service_template: Nested_vlcServiceTemplate.yaml + count: 8 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: vlc + nfc_naming_code: vlc + requirements: + - link_vlc_template_VMInt_INT2_vlc: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + - link_vlc_template_VMInt_INT1_vlc: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + abstract_gpb_7: + type: org.openecomp.resource.abstract.nodes.gpb_7 + directives: + - substitutable + properties: + compute_gpb_name: + - get_input: gpb_name_7 + port_gpb8_Internal1_mac_address: + get_input: gpb8_Internal1_mac + port_gpb8_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + vm_flavor_name: + get_input: gpb_flavor_name + compute_gpb_scheduler_hints: + - group: + get_input: server_group_id_0 + compute_gpb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + vm_image_name: + get_input: pxe_image_name + port_gpb8_Internal2_security_groups: + - - get_input: security_group_int2_id + port_gpb8_Internal1_replacement_policy: + - AUTO + port_gpb8_Internal2_replacement_policy: + - AUTO + compute_gpb_availability_zone: + - get_input: availability_zone_1 + port_gpb8_Internal1_mac_requirements: + mac_count_required: + is_required: true + port_gpb8_Internal1_network: + - get_input: internal_net_id_0 + port_gpb8_Internal2_mac_requirements: + mac_count_required: + is_required: true + port_gpb8_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb8_Internal1_security_groups: + - - get_input: security_group_int1_id + port_gpb8_Internal2_network: + - get_input: internal_net_id_1 + port_gpb8_Internal2_mac_address: + get_input: gpb8_Internal1_mac + service_template_filter: + substitute_service_template: Nested_gpb_7ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: gpb + nfc_naming_code: gpb + requirements: + - link_gpb_gpb8_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_gpb_gpb8_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + abstract_gpb_5: + type: org.openecomp.resource.abstract.nodes.gpb_5 + directives: + - substitutable + properties: + port_gpb6_Internal1_mac_requirements: + mac_count_required: + is_required: true + compute_gpb_name: + - get_input: gpb_name_5 + vm_flavor_name: + get_input: gpb_flavor_name + compute_gpb_scheduler_hints: + - group: + get_input: server_group_id_0 + compute_gpb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + port_gpb6_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + vm_image_name: + get_input: pxe_image_name + port_gpb6_Internal1_security_groups: + - - get_input: security_group_int1_id + port_gpb6_Internal2_network: + - get_input: internal_net_id_1 + compute_gpb_availability_zone: + - get_input: availability_zone_1 + port_gpb6_Internal1_network: + - get_input: internal_net_id_0 + port_gpb6_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb6_Internal2_mac_address: + get_input: gpb6_Internal1_mac + port_gpb6_Internal1_mac_address: + get_input: gpb6_Internal1_mac + port_gpb6_Internal2_mac_requirements: + mac_count_required: + is_required: true + port_gpb6_Internal2_replacement_policy: + - AUTO + port_gpb6_Internal1_replacement_policy: + - AUTO + port_gpb6_Internal2_security_groups: + - - get_input: security_group_int2_id + service_template_filter: + substitute_service_template: Nested_gpb_5ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: gpb + nfc_naming_code: gpb + requirements: + - link_gpb_gpb6_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_gpb_gpb6_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + abstract_gpb_6: + type: org.openecomp.resource.abstract.nodes.gpb_6 + directives: + - substitutable + properties: + port_gpb7_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb7_Internal1_network: + - get_input: internal_net_id_0 + compute_gpb_name: + - get_input: gpb_name_6 + port_gpb7_Internal2_network: + - get_input: internal_net_id_1 + vm_flavor_name: + get_input: gpb_flavor_name + port_gpb7_Internal1_replacement_policy: + - AUTO + port_gpb7_Internal2_replacement_policy: + - AUTO + port_gpb7_Internal2_security_groups: + - - get_input: security_group_int2_id + compute_gpb_scheduler_hints: + - group: + get_input: server_group_id_0 + compute_gpb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + vm_image_name: + get_input: pxe_image_name + port_gpb7_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb7_Internal1_security_groups: + - - get_input: security_group_int1_id + compute_gpb_availability_zone: + - get_input: availability_zone_0 + port_gpb7_Internal2_mac_address: + get_input: gpb7_Internal1_mac + port_gpb7_Internal1_mac_requirements: + mac_count_required: + is_required: true + port_gpb7_Internal1_mac_address: + get_input: gpb7_Internal1_mac + port_gpb7_Internal2_mac_requirements: + mac_count_required: + is_required: true + service_template_filter: + substitute_service_template: Nested_gpb_6ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: gpb + nfc_naming_code: gpb + requirements: + - link_gpb_gpb7_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_gpb_gpb7_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + abstract_gpb_3: + type: org.openecomp.resource.abstract.nodes.gpb_3 + directives: + - substitutable + properties: + compute_gpb_name: + - get_input: gpb_name_3 + port_gpb4_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + vm_flavor_name: + get_input: gpb_flavor_name + port_gpb4_Internal1_mac_address: + get_input: gpb4_Internal1_mac + compute_gpb_scheduler_hints: + - group: + get_input: server_group_id_0 + port_gpb4_Internal2_mac_requirements: + mac_count_required: + is_required: true + compute_gpb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + port_gpb4_Internal2_mac_address: + get_input: gpb4_Internal1_mac + vm_image_name: + get_input: pxe_image_name + port_gpb4_Internal2_security_groups: + - - get_input: security_group_int2_id + compute_gpb_availability_zone: + - get_input: availability_zone_1 + port_gpb4_Internal2_replacement_policy: + - AUTO + port_gpb4_Internal1_replacement_policy: + - AUTO + port_gpb4_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb4_Internal1_security_groups: + - - get_input: security_group_int1_id + port_gpb4_Internal2_network: + - get_input: internal_net_id_1 + port_gpb4_Internal1_mac_requirements: + mac_count_required: + is_required: true + port_gpb4_Internal1_network: + - get_input: internal_net_id_0 + service_template_filter: + substitute_service_template: Nested_gpb_3ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: gpb + nfc_naming_code: gpb + requirements: + - link_gpb_gpb4_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_gpb_gpb4_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + abstract_gpb_4: + type: org.openecomp.resource.abstract.nodes.gpb_4 + directives: + - substitutable + properties: + port_gpb5_Internal2_mac_requirements: + mac_count_required: + is_required: true + port_gpb5_Internal1_security_groups: + - - get_input: security_group_int1_id + compute_gpb_name: + - get_input: gpb_name_4 + vm_flavor_name: + get_input: gpb_flavor_name + port_gpb5_Internal1_mac_requirements: + mac_count_required: + is_required: true + compute_gpb_scheduler_hints: + - group: + get_input: server_group_id_0 + port_gpb5_Internal2_network: + - get_input: internal_net_id_1 + compute_gpb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + vm_image_name: + get_input: pxe_image_name + port_gpb5_Internal1_network: + - get_input: internal_net_id_0 + port_gpb5_Internal2_mac_address: + get_input: gpb5_Internal1_mac + port_gpb5_Internal1_mac_address: + get_input: gpb5_Internal1_mac + port_gpb5_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb5_Internal2_replacement_policy: + - AUTO + compute_gpb_availability_zone: + - get_input: availability_zone_0 + port_gpb5_Internal1_replacement_policy: + - AUTO + port_gpb5_Internal2_security_groups: + - - get_input: security_group_int2_id + port_gpb5_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + service_template_filter: + substitute_service_template: Nested_gpb_4ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: gpb + nfc_naming_code: gpb + requirements: + - link_gpb_gpb5_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_gpb_gpb5_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + abstract_gpb: + type: org.openecomp.resource.abstract.nodes.gpb + directives: + - substitutable + properties: + port_gpb1_Internal1_security_groups: + - - get_input: security_group_int1_id + compute_gpb_name: + - get_input: gpb_name_0 + port_gpb1_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + vm_flavor_name: + get_input: gpb_flavor_name + port_gpb1_Internal1_mac_requirements: + mac_count_required: + is_required: true + compute_gpb_scheduler_hints: + - group: + get_input: server_group_id_0 + compute_gpb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + vm_image_name: + get_input: pxe_image_name + port_gpb1_Internal1_mac_address: + get_input: gpb1_Internal1_mac + port_gpb1_Internal2_mac_address: + get_input: gpb1_Internal1_mac + port_gpb1_Internal2_mac_requirements: + mac_count_required: + is_required: true + compute_gpb_availability_zone: + - get_input: availability_zone_0 + port_gpb1_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb1_Internal2_security_groups: + - - get_input: security_group_int2_id + port_gpb1_Internal1_replacement_policy: + - AUTO + port_gpb1_Internal2_replacement_policy: + - AUTO + port_gpb1_Internal2_network: + - get_input: internal_net_id_1 + port_gpb1_Internal1_network: + - get_input: internal_net_id_0 + service_template_filter: + substitute_service_template: Nested_gpbServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: gpb + nfc_naming_code: gpb + requirements: + - link_gpb_gpb1_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_gpb_gpb1_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + Internal1_net: + type: org.openecomp.resource.vl.nodes.heat.network.contrailV2.VirtualNetwork + properties: + network_ipam_refs_data: + - network_ipam_refs_data_ipam_subnets: + - network_ipam_refs_data_ipam_subnets_enable_dhcp: + get_input: Internal1_dhcp + network_ipam_refs_data_ipam_subnets_default_gateway: + get_input: Internal1_net_gateway + network_ipam_refs_data_ipam_subnets_subnet: + network_ipam_refs_data_ipam_subnets_subnet_ip_prefix_len: + get_input: Internal1_net_cidr_len + network_ipam_refs_data_ipam_subnets_subnet_ip_prefix: + get_input: Internal1_net_cidr + network_name: + str_replace: + template: $VNF_NAME_int_net_1 + params: + $VNF_NAME: + get_input: vnf_name + network_ipam_refs: + - UNSUPPORTED_RESOURCE_template_NetworkIpam_Internal1 + abstract_fsb: + type: org.openecomp.resource.abstract.nodes.fsb + directives: + - substitutable + properties: + port_FSB1_Internal1_mac_address: + get_input: fsb1_Internal1_mac + port_FSB_OAM_network_role_tag: + - oam + port_FSB1_Internal2_network: + - Internal2_net + port_FSB1_Internal1_network: + - Internal1_net + vm_flavor_name: + get_input: fsb_flavor_name + port_FSB1_Internal2_mac_address: + get_input: fsb1_Internal1_mac + port_FSB_OAM_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: true + floating_ip_count_required: + is_required: false + compute_fsb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + port_FSB1_Internal1_security_groups: + - - int1_security_group + port_FSB1_Internal2_replacement_policy: + - AUTO + compute_fsb_scheduler_hints: + - group: VM_Affinity_group + port_FSB1_Internal1_replacement_policy: + - AUTO + compute_fsb_name: + - get_input: fsb_name_0 + port_FSB1_Internal1_mac_requirements: + mac_count_required: + is_required: true + port_FSB1_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_FSB_OAM_network: + - get_input: oam_net_name + port_FSB_OAM_security_groups: + - - oam_security_group + port_FSB_OAM_mac_requirements: + mac_count_required: + is_required: false + port_FSB_OAM_replacement_policy: + - AUTO + compute_fsb_availability_zone: + - get_input: availability_zone_0 + port_FSB1_Internal2_security_groups: + - - int2_security_group + port_FSB1_Internal2_mac_requirements: + mac_count_required: + is_required: true + port_FSB1_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_FSB_OAM_fixed_ips: + - ip_address: + get_input: fsb_oam_ip_0 + service_template_filter: + substitute_service_template: Nested_fsbServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: fsb + nfc_naming_code: fsb + requirements: + - link_fsb_FSB1_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_fsb_FSB1_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + gtp_security_group: + type: org.openecomp.resource.vfc.rules.nodes.heat.network.neutron.SecurityRules + properties: + name: + str_replace: + template: $VNF_NAME_$SECGROUPNAME + params: + $SECGROUPNAME: + get_input: gtp_sec_group_name + $VNF_NAME: + get_input: vnf_name + rules: + - protocol: tcp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: udp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: icmp + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + - protocol: tcp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: udp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: icmp + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + abstract_ncb_1: + type: org.openecomp.resource.abstract.nodes.ncb_1 + directives: + - substitutable + properties: + port_NCB2_Internal2_security_groups: + - - int2_security_group + port_NCB2_Internal1_replacement_policy: + - AUTO + port_NCB2_Internal2_replacement_policy: + - AUTO + vm_flavor_name: + get_input: ncb_flavor_name + port_NCB2_Internal2_mac_requirements: + mac_count_required: + is_required: true + port_NCB2_Internal1_mac_requirements: + mac_count_required: + is_required: true + vm_image_name: + get_input: pxe_image_name + compute_ncb_scheduler_hints: + - group: VM_Affinity_group + compute_ncb_availability_zone: + - get_input: availability_zone_1 + port_NCB2_Internal1_network: + - Internal1_net + port_NCB2_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_NCB2_Internal1_security_groups: + - - int1_security_group + port_NCB2_Internal2_network: + - Internal2_net + port_NCB2_Internal1_mac_address: + get_input: ncb2_Internal1_mac + port_NCB2_Internal2_mac_address: + get_input: ncb2_Internal1_mac + compute_ncb_name: + - get_input: ncb_name_1 + compute_ncb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + port_NCB2_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + service_template_filter: + substitute_service_template: Nested_ncb_1ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: ncb + nfc_naming_code: ncb + requirements: + - link_ncb_NCB2_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_ncb_NCB2_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + abstract_ncb: + type: org.openecomp.resource.abstract.nodes.ncb + directives: + - substitutable + properties: + vm_flavor_name: + get_input: ncb_flavor_name + port_NCB1_Internal2_mac_requirements: + mac_count_required: + is_required: true + vm_image_name: + get_input: pxe_image_name + port_NCB1_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + compute_ncb_scheduler_hints: + - group: VM_Affinity_group + port_NCB1_Internal1_security_groups: + - - int1_security_group + compute_ncb_availability_zone: + - get_input: availability_zone_0 + port_NCB1_Internal2_mac_address: + get_input: ncb1_Internal1_mac + port_NCB1_Internal1_mac_address: + get_input: ncb1_Internal1_mac + port_NCB1_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_NCB1_Internal1_mac_requirements: + mac_count_required: + is_required: true + port_NCB1_Internal2_replacement_policy: + - AUTO + port_NCB1_Internal1_network: + - Internal1_net + port_NCB1_Internal2_security_groups: + - - int2_security_group + port_NCB1_Internal1_replacement_policy: + - AUTO + compute_ncb_name: + - get_input: ncb_name_0 + compute_ncb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + port_NCB1_Internal2_network: + - Internal2_net + service_template_filter: + substitute_service_template: Nested_ncbServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: ncb + nfc_naming_code: ncb + requirements: + - link_ncb_NCB1_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_ncb_NCB1_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + int1_security_group: + type: org.openecomp.resource.vfc.rules.nodes.heat.network.neutron.SecurityRules + properties: + name: + str_replace: + template: $VNF_NAME_$SECGROUPNAME + params: + $SECGROUPNAME: + get_input: int1_sec_group_name + $VNF_NAME: + get_input: vnf_name + rules: + - protocol: tcp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: udp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: icmp + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + - protocol: tcp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: udp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: icmp + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + requirements: + - port: + capability: attachment_fsb_FSB1_Internal1 + node: abstract_fsb + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_fsb_FSB2_Internal1 + node: abstract_fsb_1 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_ncb_NCB1_Internal1 + node: abstract_ncb + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_ncb_NCB2_Internal1 + node: abstract_ncb_1 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb1_Internal1 + node: abstract_gpb + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb2_Internal1 + node: abstract_gpb_1 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb3_Internal1 + node: abstract_gpb_2 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb4_Internal1 + node: abstract_gpb_3 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb5_Internal1 + node: abstract_gpb_4 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb6_Internal1 + node: abstract_gpb_5 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb7_Internal1 + node: abstract_gpb_6 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb8_Internal1 + node: abstract_gpb_7 + relationship: org.openecomp.relationships.AttachesTo + fsb_volume_0: + type: org.openecomp.resource.vfc.nodes.heat.cinder.Volume + properties: + image: + get_input: fsb_volume_image_name_0 + volume_type: + get_input: fsb_volume_type + size: '(get_input : fsb_volume_size) * 1024' + name: + list_join: + - _ + - - get_input: OS::stack_name + - FSB1_Vol_1 + fsb_volume_1: + type: org.openecomp.resource.vfc.nodes.heat.cinder.Volume + properties: + image: + get_input: fsb_volume_image_name_1 + volume_type: + get_input: fsb_volume_type + size: '(get_input : fsb_volume_size) * 1024' + name: + list_join: + - _ + - - get_input: OS::stack_name + - FSB2_Vol_1 + Internal2_net: + type: org.openecomp.resource.vl.nodes.heat.network.contrailV2.VirtualNetwork + properties: + network_ipam_refs_data: + - network_ipam_refs_data_ipam_subnets: + - network_ipam_refs_data_ipam_subnets_enable_dhcp: + get_input: Internal2_dhcp + network_ipam_refs_data_ipam_subnets_default_gateway: + get_input: Internal2_net_gateway + network_ipam_refs_data_ipam_subnets_subnet: + network_ipam_refs_data_ipam_subnets_subnet_ip_prefix_len: + get_input: Internal2_net_cidr_len + network_ipam_refs_data_ipam_subnets_subnet_ip_prefix: + get_input: Internal2_net_cidr + network_name: + str_replace: + template: $VNF_NAME_int_net_2 + params: + $VNF_NAME: + get_input: vnf_name + network_ipam_refs: + - UNSUPPORTED_RESOURCE_template_NetworkIpam_Internal2 + int2_security_group: + type: org.openecomp.resource.vfc.rules.nodes.heat.network.neutron.SecurityRules + properties: + name: + str_replace: + template: $VNF_NAME_$SECGROUPNAME + params: + $SECGROUPNAME: + get_input: int2_sec_group_name + $VNF_NAME: + get_input: vnf_name + rules: + - protocol: tcp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: udp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: 132 + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: icmp + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + - protocol: tcp + ethertype: IPv6 + port_range_max: 65535 + remote_ip_prefix: ::/0 + direction: egress + port_range_min: 1 + - protocol: udp + ethertype: IPv6 + port_range_max: 65535 + remote_ip_prefix: ::/0 + direction: egress + port_range_min: 1 + - protocol: 132 + ethertype: IPv6 + port_range_max: 65535 + remote_ip_prefix: ::/0 + direction: egress + port_range_min: 1 + - protocol: icmp + ethertype: IPv6 + remote_ip_prefix: ::/0 + direction: egress + - protocol: tcp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: udp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: 132 + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: icmp + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + - protocol: tcp + ethertype: IPv6 + port_range_max: 65535 + remote_ip_prefix: ::/0 + direction: ingress + port_range_min: 1 + - protocol: udp + ethertype: IPv6 + port_range_max: 65535 + remote_ip_prefix: ::/0 + direction: ingress + port_range_min: 1 + - protocol: 132 + ethertype: IPv6 + port_range_max: 65535 + remote_ip_prefix: ::/0 + direction: ingress + port_range_min: 1 + - protocol: icmp + ethertype: IPv6 + remote_ip_prefix: ::/0 + direction: ingress + requirements: + - port: + capability: attachment_fsb_FSB1_Internal2 + node: abstract_fsb + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_fsb_FSB2_Internal2 + node: abstract_fsb_1 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_ncb_NCB1_Internal2 + node: abstract_ncb + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_ncb_NCB2_Internal2 + node: abstract_ncb_1 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb1_Internal2 + node: abstract_gpb + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb2_Internal2 + node: abstract_gpb_1 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb3_Internal2 + node: abstract_gpb_2 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb4_Internal2 + node: abstract_gpb_3 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb5_Internal2 + node: abstract_gpb_4 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb6_Internal2 + node: abstract_gpb_5 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb7_Internal2 + node: abstract_gpb_6 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb8_Internal2 + node: abstract_gpb_7 + relationship: org.openecomp.relationships.AttachesTo + abstract_fsb_1: + type: org.openecomp.resource.abstract.nodes.fsb_1 + directives: + - substitutable + properties: + port_FSB_OAM_network_role_tag: + - oam + vm_flavor_name: + get_input: fsb_flavor_name + port_FSB_OAM_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: true + floating_ip_count_required: + is_required: false + port_FSB2_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_FSB2_Internal2_security_groups: + - - int2_security_group + compute_fsb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + port_FSB2_Internal1_mac_address: + get_input: fsb2_Internal1_mac + compute_fsb_scheduler_hints: + - group: VM_Affinity_group + compute_fsb_name: + - get_input: fsb_name_1 + port_FSB2_Internal1_security_groups: + - - int1_security_group + port_FSB_OAM_network: + - get_input: oam_net_name + port_FSB_OAM_security_groups: + - - oam_security_group + port_FSB2_Internal1_network: + - Internal1_net + port_FSB2_Internal2_mac_address: + get_input: fsb2_Internal1_mac + port_FSB2_Internal2_mac_requirements: + mac_count_required: + is_required: true + port_FSB_OAM_mac_requirements: + mac_count_required: + is_required: false + port_FSB2_Internal2_replacement_policy: + - AUTO + port_FSB2_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_FSB_OAM_replacement_policy: + - AUTO + port_FSB2_Internal2_network: + - Internal2_net + port_FSB2_Internal1_replacement_policy: + - AUTO + compute_fsb_availability_zone: + - get_input: availability_zone_1 + port_FSB_OAM_fixed_ips: + - ip_address: + get_input: fsb_oam_ip_1 + port_FSB2_Internal1_mac_requirements: + mac_count_required: + is_required: true + service_template_filter: + substitute_service_template: Nested_fsb_1ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: fsb + nfc_naming_code: fsb + requirements: + - link_fsb_FSB2_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_fsb_FSB2_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + oam_security_group: + type: org.openecomp.resource.vfc.rules.nodes.heat.network.neutron.SecurityRules + properties: + name: + str_replace: + template: $VNF_NAME_$SECGROUPNAME + params: + $SECGROUPNAME: + get_input: oam_sec_group_name + $VNF_NAME: + get_input: vnf_name + rules: + - protocol: tcp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: udp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: icmp + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + - protocol: tcp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: udp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: icmp + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + requirements: + - port: + capability: attachment_fsb_FSB_OAM + node: abstract_fsb + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_fsb_FSB_OAM + node: abstract_fsb_1 + relationship: org.openecomp.relationships.AttachesTo + groups: + vmme_gpb3_group: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/vmme_gpb3.yml + description: | + Module HOT template to create vmme 1-8 gpb + members: + - abstract_gpb + - abstract_gpb_1 + - abstract_gpb_2 + - abstract_gpb_3 + - abstract_gpb_4 + - abstract_gpb_5 + - abstract_gpb_6 + - abstract_gpb_7 + base_vmme_group: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/base_vmme.yml + description: | + Base HOT template to create vmme 2 fsb 2 ncb + members: + - int2_security_group + - oam_security_group + - gtp_security_group + - Internal2_net + - int1_security_group + - Internal1_net + - abstract_ncb + - abstract_ncb_1 + - abstract_fsb + - abstract_fsb_1 + base_vmme_volume_group: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/base_vmme_volume.yml + description: HOT template for vMME Cinder Volumes + members: + - fsb_volume_0 + - fsb_volume_1 + vmme_gpb1_group: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/vmme_gpb1.yml + description: | + Module HOT template to create vmme 1-8 gpb + members: + - abstract_gpb + - abstract_gpb_1 + - abstract_gpb_2 + - abstract_gpb_3 + - abstract_gpb_4 + - abstract_gpb_5 + - abstract_gpb_6 + - abstract_gpb_7 + vmme_gpb4_group: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/vmme_gpb4.yml + description: | + Module HOT template to create vmme 1-8 gpb + members: + - abstract_gpb + - abstract_gpb_1 + - abstract_gpb_2 + - abstract_gpb_3 + - abstract_gpb_4 + - abstract_gpb_5 + - abstract_gpb_6 + - abstract_gpb_7 + vmme_gpb2_group: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/vmme_gpb2.yml + description: | + Module HOT template to create vmme 1-8 gpb + members: + - abstract_gpb + - abstract_gpb_1 + - abstract_gpb_2 + - abstract_gpb_3 + - abstract_gpb_4 + - abstract_gpb_5 + - abstract_gpb_6 + - abstract_gpb_7 + VM_Affinity_group: + type: tosca.groups.Root + members: + - abstract_ncb + - abstract_ncb_1 + - abstract_vlc + - abstract_fsb + - abstract_fsb_1 + - abstract_gpb + - abstract_gpb_1 + - abstract_gpb_2 + - abstract_gpb_3 + - abstract_gpb_4 + - abstract_gpb_5 + - abstract_gpb_6 + - abstract_gpb_7 + vmme_vlc_group: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/vmme_vlc.yml + description: | + Module HOT template to create vmme 8 vlcs + members: + - abstract_vlc + outputs: + oam_management_v4_address: + description: ID of OAM VIP to be provisioned in A&AI + value: + get_input: vip_oam_management_v4_ip + fsb_volume_id_1: + description: ID of Cinder Volume for FSB2 + value: fsb_volume_1 + security_group_sctp_b_id: + description: ID of sctpb_security_group + value: UNSUPPORTED_RESOURCE_sctpb_security_group + service_instance_id_0: + description: ID of Service Instance used for vLCs + value: UNSUPPORTED_RESOURCE_template_ServiceInstance_VLC + security_group_sctp_a_id: + description: ID of sctpa_security_group + value: UNSUPPORTED_RESOURCE_sctpa_security_group + fsb_volume_id_0: + description: ID of Cinder Volume for FSB1 + value: fsb_volume_0 + policies: + VM_Affinity_policy: + type: org.openecomp.policies.placement.Antilocate + properties: + container_type: host + targets: + - VM_Affinity_group @@ -0,0 +1,3585 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +metadata: + template_name: Main +imports: +- openecomp_heat_index: + file: openecomp-heat/_index.yml +- GlobalSubstitutionTypes: + file: GlobalSubstitutionTypesServiceTemplate.yaml +topology_template: + inputs: + vlc4_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc4_Internal2 + default: 00:80:37:0E:04:12 + sctp-a-egress_rule_application: + hidden: false + immutable: false + type: string + description: application for the SecurityGroup + default: any + sctp-b-ipv6-ingress-src_start_port: + hidden: false + immutable: false + type: float + description: IPV6 start port + default: 0 + constraints: + - in_range: + - 0 + - 65535 + ncb1_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to ncb1_Internal2 + default: 00:80:37:0E:09:12 + sctp-a-ipv6-ingress_ethertype: + hidden: false + immutable: false + type: string + description: IPV6 ethertype + default: IPv4 + gpb8_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb8_Internal1 + default: 00:80:37:0E:10:22 + sctp-a-ingress_rule_protocol: + hidden: false + immutable: false + type: string + description: protocol for the SecurityGroup + default: any + sctp-b-display_name: + hidden: false + immutable: false + type: string + description: display_name for the SecurityGroup + default: epc-sctp-b-ipv4v6-sec-group + sctp-a-ingress_ethertype: + hidden: false + immutable: false + type: string + description: ethertype for the SecurityGroup + default: IPv4 + sctp-a-egress-src_start_port: + hidden: false + immutable: false + type: float + description: start_port for the SecurityGroup + default: 0 + constraints: + - in_range: + - 0 + - 65535 + ncb_flavor_name: + hidden: false + immutable: false + type: string + description: Flavor to use for servers ncb + default: nv.c8r32d1 + vlc3_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc3_Internal1 + default: 00:80:37:0E:03:12 + Internal2_net_cidr: + hidden: false + immutable: false + type: string + description: CIDR for internal-2 network + default: 169.255.0.0 + sctp-a-egress-dst_start_port: + hidden: false + immutable: false + type: float + description: start_port for the SecurityGroup + default: 0 + constraints: + - in_range: + - 0 + - 65535 + sctp-a-egress_ethertype: + hidden: false + immutable: false + type: string + description: ethertype for the SecurityGroup + default: IPv4 + gpb4_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb4_Internal2 + default: 00:80:37:0E:0C:22 + sctp-b-ipv6-egress_rule_application: + hidden: false + immutable: false + type: string + description: IPV6 Rule-application + default: any + vlc8_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc8_Internal1 + default: 00:80:37:0E:08:12 + sctp-b-ipv6-ingress-src_end_port: + hidden: false + immutable: false + type: float + description: IPV6 ending port for destination + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + fsb2_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to fsb2_Internal1 + default: 00:80:37:0E:0D:12 + sctp-b-name: + hidden: false + immutable: false + type: string + description: name for the SecurityGroup + default: epc-sctp-b-ipv4v6-sec-group + sctp-b-ipv6-egress_ethertype: + hidden: false + immutable: false + type: string + description: IPV6 ethertype + default: IPv4 + internal_net_id_1: + hidden: false + immutable: false + type: string + description: UUID of Internal2_net + default: e3397c69-a942-49aa-81cb-fb91ff34abc8 + sctp-a-egress_dst_subnet_prefix: + hidden: false + immutable: false + type: string + description: ip_prefix for the SecurityGroup + default: 0.0.0.0 + internal_net_id_0: + hidden: false + immutable: false + type: string + description: UUID of Internal1_net + default: 871de971-22ac-47b6-befb-50e7d4cb67ea + sctp_b_net_fqdn: + hidden: false + immutable: false + type: string + description: Network FQDN SCTPB + default: default-domain:vMME-24474-Ericsson-WTC-Lab-vLCP1-4:vMME-24474-Ericsson-WTC-Lab-vLCP1-4_gn_SCTPB_net_1 + sctp-a-ipv6-ingress_rule_application: + hidden: false + immutable: false + type: string + description: IPV6 Rule-application + default: any + sctp-b-ipv6-ingress_src_subnet_prefix_len: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix length + default: '0' + ncb_name_1: + hidden: false + immutable: false + type: string + description: Name of ncb2 + default: zrdm3mmex59ncb002 + ncb_name_0: + hidden: false + immutable: false + type: string + description: Name of ncb1 + default: zrdm3mmex59ncb001 + vlc_st_virtualization_type: + hidden: false + immutable: false + type: string + description: Indicates virtualization type + default: virtual-machine + vlc2_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc2_Internal1 + default: 00:80:37:0E:02:12 + sctp-b-ingress-dst_start_port: + hidden: false + immutable: false + type: float + description: start_port for the SecurityGroup + default: 0 + constraints: + - in_range: + - 0 + - 65535 + sctp-a-display_name: + hidden: false + immutable: false + type: string + description: display_name for the SecurityGroup + default: epc-sctp-a-ipv4v6-sec-group + sctp-b-ingress_rule_application: + hidden: false + immutable: false + type: string + description: application for the SecurityGroup + default: any + int2_sec_group_name: + hidden: false + immutable: false + type: string + description: SecurityGroup name for internal-2 + default: int2-sec-group + gpb5_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb5_Internal2 + default: 00:80:37:0E:0D:22 + sctp-a-egress-dst_subnet_prefix_v6: + hidden: false + immutable: false + type: string + description: dst subnet + default: '::' + OS::stack_name: + type: string + required: false + sctp-b-egress-src_end_port: + hidden: false + immutable: false + type: float + description: end_port for the SecurityGroup + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + Internal2_shared: + hidden: false + immutable: false + type: string + description: Whether Shared or private internal-2 network + default: false + sctp-a-ipv6-egress_rule_protocol: + hidden: false + immutable: false + type: string + description: IPV6 Rule-protocol + default: any + Internal2_rpf: + hidden: false + immutable: false + type: string + description: Reverse Path Forwarding Enabled/Disabled internal-2 network + default: disable + vlc5_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc5_Internal2 + default: 00:80:37:0E:05:12 + sctp-a-ipv6-egress_src_end_port: + hidden: false + immutable: false + type: string + description: IPV6 end port + default: 65535 + Internal1_forwarding_mode: + hidden: false + immutable: false + type: string + description: L2 or L3 forwarding mode for internal-1 network + default: l2 + gpb3_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb3_Internal1 + default: 00:80:37:0E:0B:22 + vip_oam_management_v4_ip: + hidden: false + immutable: false + type: string + description: IP address of OAM service IP address to be provisioned in A&AI + default: 107.239.72.176 + vmi_oam_preference_primary: + hidden: false + immutable: false + type: float + description: Preference for primary interface/port + default: 200 + sctp-b-src_subnet_prefix_v6: + hidden: false + immutable: false + type: string + description: ip_prefix for the SecurityGroup + default: '::' + sctp-a-egress_dst_subnet_prefix_len: + hidden: false + immutable: false + type: float + description: ip_prefix_len for the SecurityGroup + default: '0' + constraints: + - in_range: + - 0 + - 32 + security_group_sctp_b_id: + hidden: false + immutable: false + type: string + description: Security Group UUID for output + default: 92a4ae54-1733-4d03-b488-f178bb9f7b82 + Internal2_forwarding_mode: + hidden: false + immutable: false + type: string + description: L2 or L3 forwarding mode for internal-2 network + default: l2 + sctp-a-ipv6-egress_dst_end_port: + hidden: false + immutable: false + type: string + description: IPV6 end port + default: 65535 + sctp-b-egress-dst_subnet_prefix_v6: + hidden: false + immutable: false + type: string + description: dst subnet + default: '::' + sctp-b-egress_dst_subnet_prefix: + hidden: false + immutable: false + type: string + description: ip_prefix for the SecurityGroup + default: 0.0.0.0 + security_group_oam_id: + hidden: false + immutable: false + type: string + description: Security Group UUID for output + default: 4ae4aa74-3e8e-4f2b-8b5f-a8bd262da96b + gpb2_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb2_Internal1 + default: 00:80:37:0E:0A:22 + security_group_int1_id: + hidden: false + immutable: false + type: string + description: UUID of Internal1_net security group + default: 94c62578-835d-4801-9372-70a2cfb22683 + sctp-a-egress_action: + hidden: false + immutable: false + type: string + description: simple_action for the SecurityGroup + default: pass + oam_net_fqdn: + hidden: false + immutable: false + type: string + description: Network FQDN OAM + default: default-domain:vMME-24474-Ericsson-WTC-Lab-vLCP1-4:vMME-24474-Ericsson-WTC-Lab-vLCP1-4_OAM_net_1 + ncb2_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to ncb2_Internal2 + default: 00:80:37:0E:0F:12 + vlc_st_interface_type_sctp_a: + hidden: false + immutable: false + type: string + description: service_interface_type for the ServiceTemplate + default: left + gpb3_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb3_Internal2 + default: 00:80:37:0E:0B:22 + vlc_st_interface_type_sctp_b: + hidden: false + immutable: false + type: string + description: service_interface_type for the ServiceTemplate + default: right + gpb1_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb1_Internal2 + default: 00:80:37:0E:09:22 + oam_net_name: + hidden: false + immutable: false + type: string + description: Network Name OAM + default: vMME-24474-Ericsson-WTC-Lab-vLCP1-4_OAM_net_1 + sctp-b-ingress-src_start_port: + hidden: false + immutable: false + type: float + description: start_port for the SecurityGroup + default: 0 + constraints: + - in_range: + - 0 + - 65535 + fsb1_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to fsb1_Internal1 + default: 00:80:37:0E:0B:12 + sctp-b-ingress_dst_addresses: + hidden: false + immutable: false + type: string + description: security_group for the SecurityGroup + default: local + vlc_st_interface_type_oam: + hidden: false + immutable: false + type: string + description: service_interface_type for the ServiceTemplate + default: management + shc_monitor_type: + hidden: false + immutable: false + type: string + description: health check + default: PING + oam_sec_group_name: + hidden: false + immutable: false + type: string + description: SecurityGroup name for OAM + default: oam-sec-group + Internal2_net_gateway: + hidden: false + immutable: false + type: string + description: gateway for internal-2 network + default: 169.255.0.3 + evac_policy: + hidden: false + immutable: false + type: string + description: CMHA Policy + default: Evacuate + server_group_id_0: + hidden: false + immutable: false + type: string + description: ID of Anti-Affinity Policy-based Server Group + default: ec99a73d-38f8-4280-8103-ba8ee584629f + vlc8_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc8_Internal2 + default: 00:80:37:0E:08:12 + sctp-b-ipv6-egress_rule_protocol: + hidden: false + immutable: false + type: string + description: IPV6 Rule-protocol + default: any + gtp_sec_group_name: + hidden: false + immutable: false + type: string + description: SecurityGroup name for GTP + default: gtp-sec-group + vlc_sctp_b_v6_ip_2: + hidden: false + immutable: false + type: string + description: Static IP vlc3 SCTPB + default: fd00:200:200:5:0:0:0:24 + vlc_sctp_b_v6_ip_1: + hidden: false + immutable: false + type: string + description: Static IP vlc2 SCTPB + default: fd00:200:200:5:0:0:0:17 + sctp-a-ipv6-egress_dst_subnet_prefix: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix + default: 0.0.0.0 + vlc_sctp_b_v6_ip_0: + hidden: false + immutable: false + type: string + description: Static IP vlc1 SCTPB + default: fd00:200:200:5:0:0:0:16 + vlc4_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc4_Internal1 + default: 00:80:37:0E:04:12 + vlc_sctp_b_v6_ip_6: + hidden: false + immutable: false + type: string + description: Static IP vlc7 SCTPB + default: fd00:200:200:5:0:0:0:28 + vlc_sctp_b_v6_ip_5: + hidden: false + immutable: false + type: string + description: Static IP vlc6 SCTPB + default: fd00:200:200:5:0:0:0:27 + vlc_sctp_b_v6_ip_4: + hidden: false + immutable: false + type: string + description: Static IP vlc5 SCTPB + default: fd00:200:200:5:0:0:0:26 + vlc_sctp_b_v6_ip_3: + hidden: false + immutable: false + type: string + description: Static IP vlc4 SCTPB + default: fd00:200:200:5:0:0:0:25 + sctp_b_net_name: + hidden: false + immutable: false + type: string + description: Network Name SCTPB + default: vMME-24474-Ericsson-WTC-Lab-vLCP1-4_gn_SCTPB_net_1 + sctp-b-ipv6-egress_dst_subnet_prefix_len: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix + default: '0' + sctp-a-egress_rule_protocol: + hidden: false + immutable: false + type: string + description: protocol for the SecurityGroup + default: any + Internal1_shared: + hidden: false + immutable: false + type: string + description: Whether Shared or private internal-1 network + default: false + shc_url_path: + hidden: false + immutable: false + type: string + description: health check + default: local-ip + Internal2_net_cidr_len: + hidden: false + immutable: false + type: string + description: CIDR length for internal-2 network + default: 17 + sctp-a-ingress-src_end_port: + hidden: false + immutable: false + type: float + description: end_port for the SecurityGroup + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + sctp-b-ipv6-ingress_src_subnet_prefix: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix + default: 0.0.0.0 + sctp-a-egress-dst_end_port: + hidden: false + immutable: false + type: float + description: end_port for the SecurityGroup + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + sctp-a-ingress_action: + hidden: false + immutable: false + type: string + description: simple_action for the SecurityGroup + default: pass + sctp-b-ipv6-ingress_action: + hidden: false + immutable: false + type: string + description: IPV6 action + default: pass + vlc_st_service_type: + hidden: false + immutable: false + type: string + description: service type + default: firewall + sctp-b-ipv6-ingress-dst_start_port: + hidden: false + immutable: false + type: string + description: IPV6 starting port for destination + default: 0 + vlc_st_availability_zone: + hidden: false + immutable: false + type: string + description: Indicates availability zone is enabled + default: true + vlc7_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc7_Internal1 + default: 00:80:37:0E:07:12 + fsb_volume_image_name_1: + label: MME_FSB2 + hidden: false + immutable: false + type: string + description: volume name + default: MME_FSB2_1_3_GA.qcow2 + vlc_oam_ip_6: + hidden: false + immutable: false + type: string + description: Static IP vlc7 OAM + default: 107.239.72.151 + sctp-a-ipv6-ingress_src_subnet_prefix_len: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix length + default: '0' + vlc_oam_ip_7: + hidden: false + immutable: false + type: string + description: Static IP vlc8 OAM + default: 107.239.72.152 + Internal1_allow_transit: + hidden: false + immutable: false + type: string + description: Allow/disallow transit internal-1 network + default: true + vlc_oam_ip_2: + hidden: false + immutable: false + type: string + description: Static IP vlc3 OAM + default: 107.239.72.157 + vlc_oam_ip_3: + hidden: false + immutable: false + type: string + description: Static IP vlc4 OAM + default: 107.239.72.158 + vlc_gtp_ip_0: + hidden: false + immutable: false + type: string + description: Static IP vlc1 GTP + default: 107.243.47.208 + vlc_oam_ip_4: + hidden: false + immutable: false + type: string + description: Static IP vlc5 OAM + default: 107.239.72.149 + fsb_volume_image_name_0: + label: MME_FSB1 + hidden: false + immutable: false + type: string + description: volume name + default: MME_FSB1_1_3_GA.qcow2 + vlc_gtp_ip_1: + hidden: false + immutable: false + type: string + description: Static IP vlc2 GTP + default: 107.243.47.209 + vlc_oam_ip_5: + hidden: false + immutable: false + type: string + description: Static IP vlc6 OAM + default: 107.239.72.150 + vlc_gtp_ip_2: + hidden: false + immutable: false + type: string + description: Static IP vlc3 GTP + default: 107.243.47.216 + vlc_name_6: + hidden: false + immutable: false + type: string + description: Name of vlc7 + default: zrdm3mmex59vlc007 + vlc_gtp_ip_3: + hidden: false + immutable: false + type: string + description: Static IP vlc4 GTP + default: 107.243.47.217 + vlc_name_7: + hidden: false + immutable: false + type: string + description: Name of vlc8 + default: zrdm3mmex59vlc008 + security_group_sctp_a_id: + hidden: false + immutable: false + type: string + description: Security Group UUID for output + default: 3cd8a524-77ff-4980-ae2a-d19ba70e0511 + vlc_gtp_ip_4: + hidden: false + immutable: false + type: string + description: Static IP vlc5 GTP + default: 107.243.47.218 + vlc_gtp_ip_5: + hidden: false + immutable: false + type: string + description: Static IP vlc6 GTP + default: 107.243.47.219 + vlc_gtp_ip_6: + hidden: false + immutable: false + type: string + description: Static IP vlc7 GTP + default: 107.243.47.220 + vlc_name_2: + hidden: false + immutable: false + type: string + description: Name of vlc3 + default: zrdm3mmex59vlc003 + vlc_gtp_ip_7: + hidden: false + immutable: false + type: string + description: Static IP vlc8 GTP + default: 107.243.47.221 + vlc_name_3: + hidden: false + immutable: false + type: string + description: Name of vlc4 + default: zrdm3mmex59vlc004 + vlc_name_4: + hidden: false + immutable: false + type: string + description: Name of vlc5 + default: zrdm3mmex59vlc005 + vlc_name_5: + hidden: false + immutable: false + type: string + description: Name of vlc6 + default: zrdm3mmex59vlc006 + fsb_volume_id_1: + hidden: false + immutable: false + type: string + description: ID of Cinder Volume for FSB2 + default: 5bd0560c-bfd0-47dc-a84a-554e2698c925 + sctp-a-ipv6-ingress_action: + hidden: false + immutable: false + type: string + description: IPV6 action + default: pass + vlc_name_0: + hidden: false + immutable: false + type: string + description: Name of vlc1 + default: zrdm3mmex59vlc001 + vlc_name_1: + hidden: false + immutable: false + type: string + description: Name of vlc2 + default: zrdm3mmex59vlc002 + vlc_oam_route_prefixes: + hidden: false + immutable: false + type: json + description: Route prefixes for static routing on OAM + sctp-b-egress_rule_application: + hidden: false + immutable: false + type: string + description: application for the SecurityGroup + default: any + vlc_oam_ip_0: + hidden: false + immutable: false + type: string + description: Static IP vlc1 OAM + default: 107.239.72.155 + vlc_oam_ip_1: + hidden: false + immutable: false + type: string + description: Static IP vlc2 OAM + default: 107.239.72.156 + vlc6_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc6_Internal1 + default: 00:80:37:0E:06:12 + fsb_volume_id_0: + hidden: false + immutable: false + type: string + description: ID of Cinder Volume for FSB1 + default: 27baa6a0-b701-4795-bf5e-4f546b350b1f + sctp-b-egress-dst_end_port: + hidden: false + immutable: false + type: float + description: end_port for the SecurityGroup + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + gpb2_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb2_Internal2 + default: 00:80:37:0E:0A:22 + sctp-a-ipv6-egress_rule_application: + hidden: false + immutable: false + type: string + description: IPV6 Rule-application + default: any + sctp-b-ipv6-egress_src_start_port: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix + default: 0 + Internal2_allow_transit: + hidden: false + immutable: false + type: string + description: Allow/disallow transit internal-2 network + default: true + fsb_volume_size: + label: volume size + hidden: false + immutable: false + type: float + description: volume size 320GB + default: 320 + constraints: + - in_range: + - 0 + - 340 + sctp-b-IPv6_ethertype: + hidden: false + immutable: false + type: string + description: IPV6 ethertype + default: IPv6 + gtp_net_fqdn: + hidden: false + immutable: false + type: string + description: Network FQDN GTP + default: default-domain:vMME-24474-Ericsson-WTC-Lab-vLCP1-4:vMME-24474-Ericsson-WTC-Lab-vLCP1-4_gn_GTP_net_1 + ncb2_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to ncb2_Internal1 + default: 00:80:37:0E:0F:12 + sctp-b-ingress_rule_protocol: + hidden: false + immutable: false + type: string + description: protocol for the SecurityGroup + default: any + sctp-b-ingress_action: + hidden: false + immutable: false + type: string + description: simple_action for the SecurityGroup + default: pass + sctp-b-egress_src_addresses: + hidden: false + immutable: false + type: string + description: security_group for the SecurityGroup + default: local + gpb7_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb7_Internal2 + default: 00:80:37:0E:0F:22 + sctp-a-ipv6-ingress-dst_start_port: + hidden: false + immutable: false + type: string + description: IPV6 starting port for destination + default: 0 + gtp_net_name: + hidden: false + immutable: false + type: string + description: Network Name GTP + default: vMME-24474-Ericsson-WTC-Lab-vLCP1-4_gn_GTP_net_1 + sctp-b-ipv6-ingress_rule_application: + hidden: false + immutable: false + type: string + description: IPV6 Rule-application + default: any + domain_name: + hidden: false + immutable: false + type: string + description: Unique name of vMME contrail domain + default: default-domain + vlc5_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc5_Internal1 + default: 00:80:37:0E:05:12 + sctp-a-egress_src_addresses: + hidden: false + immutable: false + type: string + description: security_group for the SecurityGroup + default: local + sctp-b-egress-src_start_port: + hidden: false + immutable: false + type: float + description: start_port for the SecurityGroup + default: 0 + constraints: + - in_range: + - 0 + - 65535 + shc_enabled: + hidden: false + immutable: false + type: string + description: health check + default: true + sctp-b-ipv6-ingress-dst_end_port: + hidden: false + immutable: false + type: string + description: IPV6 end port + default: 65535 + sctp-b-dst_subnet_prefix_v6: + hidden: false + immutable: false + type: string + description: ip_prefix for the SecurityGroup + default: '::' + sctp_a_net_fqdn: + hidden: false + immutable: false + type: string + description: Network FQDN SCTPA + default: default-domain:vMME-24474-Ericsson-WTC-Lab-vLCP1-4:vMME-24474-Ericsson-WTC-Lab-vLCP1-4_gn_SCTPA_net_1 + security_group_gtp_id: + hidden: false + immutable: false + type: string + description: Security Group UUID for output + default: e8ad3fe2-5f95-43e4-bbcc-da97b1c22588 + sctp-a-ipv6-ingress_src_subnet_prefix: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix + default: 0.0.0.0 + fsb_name_1: + hidden: false + immutable: false + type: string + description: Name of fsb1 + default: zrdm3mmex59fsb002 + sctp-b-egress-dst_start_port: + hidden: false + immutable: false + type: float + description: start_port for the SecurityGroup + default: 0 + constraints: + - in_range: + - 0 + - 65535 + fsb_name_0: + hidden: false + immutable: false + type: string + description: Name of fsb1 + default: zrdm3mmex59fsb001 + sctp_a_net_name: + hidden: false + immutable: false + type: string + description: Network Name SCTPA + default: vMME-24474-Ericsson-WTC-Lab-vLCP1-4_gn_SCTPA_net_1 + sctp-b-egress_dst_subnet_prefix_len: + hidden: false + immutable: false + type: float + description: ip_prefix_len for the SecurityGroup + default: '0' + constraints: + - in_range: + - 0 + - 32 + gpb1_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb1_Internal1 + default: 00:80:37:0E:09:22 + sctp-a-ingress-dst_start_port: + hidden: false + immutable: false + type: float + description: start_port for the SecurityGroup + default: 0 + constraints: + - in_range: + - 0 + - 65535 + fsb1_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to fsb1_Internal2 + default: 00:80:37:0E:0B:12 + vlc_st_service_mode: + hidden: false + immutable: false + type: string + description: service mode + default: in-network-nat + sctp-a-ipv6-egress_ethertype: + hidden: false + immutable: false + type: string + description: IPV6 ethertype + default: IPv4 + sctp-a-egress-src_end_port: + hidden: false + immutable: false + type: float + description: end_port for the SecurityGroup + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + sctp-b-egress_action: + hidden: false + immutable: false + type: string + description: simple_action for the SecurityGroup + default: pass + sctp-a-ingress-src_subnet_prefix_len: + hidden: false + immutable: false + type: float + description: ip_prefix_len for the SecurityGroup + default: '0' + constraints: + - in_range: + - 0 + - 32 + sctp-a-ipv6-ingress-src_start_port: + hidden: false + immutable: false + type: float + description: IPV6 start port + default: 0 + constraints: + - in_range: + - 0 + - 65535 + vf_module_id: + hidden: false + immutable: false + type: string + description: the vf_module_id for this instance. UUID provided by ECOMP + default: TWO + Internal1_net_cidr: + hidden: false + immutable: false + type: string + description: CIDR for internal-1 network + default: 169.253.0.0 + fsb_flavor_name: + hidden: false + immutable: false + type: string + description: Flavor to use for servers fsb1 + default: nv.c8r32d1 + sctp_rule_protocol: + hidden: false + immutable: false + type: string + description: protocol for the SecurityGroup + default: 132 + vnf_name: + hidden: false + immutable: false + type: string + description: the vnf_name for this instance. provided by ECOMP + default: zrdm3mmex59 + sctp-a-IPv6_ethertype: + hidden: false + immutable: false + type: string + description: IPV6 ethertype + default: IPv6 + vlc_sctp_b_v6_ip_7: + hidden: false + immutable: false + type: string + description: Static IP vlc8 SCTPB + default: fd00:200:200:5:0:0:0:29 + vlc6_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc6_Internal2 + default: 00:80:37:0E:06:12 + sctp-b-ingress-dst_end_port: + hidden: false + immutable: false + type: float + description: end_port for the SecurityGroup + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + vlc7_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc7_Internal2 + default: 00:80:37:0E:07:12 + sctp-a-ipv6-ingress-src_end_port: + hidden: false + immutable: false + type: float + description: IPV6 ending port for destination + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + vlc_flavor_name: + hidden: false + immutable: false + type: string + description: Flavor to use for servers vlc + default: nd.c16r64d1 + sctp-b-ipv6-egress_src_addresses: + hidden: false + immutable: false + type: string + description: IPV6 source + default: local + vlc_st_interface_type_int1: + hidden: false + immutable: false + type: string + description: service_interface_type for the ServiceTemplate + default: other1 + availability_zone_0: + hidden: false + immutable: false + type: string + description: cluster for spawnning fsb instances + default: rdm3-kvm-az02 + service_instance_id_0: + hidden: false + immutable: false + type: string + description: UUID of service instance for vLCs + default: 77c67cc8-d15f-47bc-aeb1-8d65d09e917a + availability_zone_1: + hidden: false + immutable: false + type: string + description: cluster for spawnning ncb instances + default: rdm3-kvm-az02 + vlc_st_interface_type_int2: + hidden: false + immutable: false + type: string + description: service_interface_type for the ServiceTemplate + default: other2 + sctp-a-ipv6-egress-dst_start_port: + hidden: false + immutable: false + type: string + description: IPV6 start port + default: 0 + sctp-a-ipv6-egress_dst_subnet_prefix_len: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix + default: '0' + vlc_sctp_a_ip_0: + hidden: false + immutable: false + type: string + description: Static IP vlc1 SCTPA + default: 107.243.47.144 + vlc_sctp_b_route_prefixes: + hidden: false + immutable: false + type: json + description: Route prefixes for static routing on SCTPB + vlc1_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc1_Internal1 + default: 00:80:37:0E:01:12 + sctp-b-ipv6-egress_src_end_port: + hidden: false + immutable: false + type: string + description: IPV6 end port + default: 65535 + sctp-a-ipv6-egress_src_addresses: + hidden: false + immutable: false + type: string + description: IPV6 source + default: local + vlc_sctp_a_ip_7: + hidden: false + immutable: false + type: string + description: Static IP vlc8 SCTPA + default: 107.243.47.157 + sctp-a-ingress-src_subnet_prefix_v6: + hidden: false + immutable: false + type: string + description: src subnet + default: '::' + vlc_sctp_a_ip_6: + hidden: false + immutable: false + type: string + description: Static IP vlc7 SCTPA + default: 107.243.47.156 + vlc_sctp_a_ip_5: + hidden: false + immutable: false + type: string + description: Static IP vlc6 SCTPA + default: 107.243.47.155 + sctp-a-ingress-dst_end_port: + hidden: false + immutable: false + type: float + description: end_port for the SecurityGroup + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + vlc_sctp_a_ip_4: + hidden: false + immutable: false + type: string + description: Static IP vlc5 SCTPA + default: 107.243.47.154 + vlc_sctp_a_ip_3: + hidden: false + immutable: false + type: string + description: Static IP vlc4 SCTPA + default: 107.243.47.153 + vlc_sctp_a_ip_2: + hidden: false + immutable: false + type: string + description: Static IP vlc3 SCTPA + default: 107.243.47.152 + vlc_sctp_a_ip_1: + hidden: false + immutable: false + type: string + description: Static IP vlc2 SCTPA + default: 107.243.47.145 + gpb6_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb6_Internal2 + default: 00:80:37:0E:0E:22 + security_group_int2_id: + hidden: false + immutable: false + type: string + description: UUID of Internal1_net security group + default: 1361f069-baf2-4b76-b321-7f68ba26c369 + Internal2_dhcp: + hidden: false + immutable: false + type: string + description: Whether DHCP/static IP addressing on internal-2 network + default: false + sctp-a-dst_subnet_prefix_v6: + hidden: false + immutable: false + type: string + description: ip_prefix for the SecurityGroup + default: '::' + pxe_image_name: + hidden: false + immutable: false + type: string + description: Name of image to use for server ncb + default: MME_PXE-Boot_1_3_GA.qcow2 + vlc_st_interface_type_gtp: + hidden: false + immutable: false + type: string + description: service_interface_type for the ServiceTemplate + default: other0 + ncb1_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to ncb1_Internal1 + default: 00:80:37:0E:09:12 + vlc_gtp_route_prefixes: + hidden: false + immutable: false + type: json + description: Route prefixes for static routing on GTP + int1_sec_group_name: + hidden: false + immutable: false + type: string + description: SecurityGroup name for internal-1 + default: int1-sec-group + vmi_oam_preference_secondary: + hidden: false + immutable: false + type: float + description: Preference for secondary interface/port + default: 100 + Internal1_dhcp: + hidden: false + immutable: false + type: string + description: Whether DHCP/static IP addressing on internal-1 network + default: false + fsb2_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to fsb2_Internal2 + default: 00:80:37:0E:0D:12 + Internal1_net_cidr_len: + hidden: false + immutable: false + type: string + description: CIDR length for internal-1 network + default: 17 + sctp-a-ingress_dst_addresses: + hidden: false + immutable: false + type: string + description: security_group for the SecurityGroup + default: local + sctp-b-ingress-src_subnet_prefix_len: + hidden: false + immutable: false + type: float + description: ip_prefix_len for the SecurityGroup + default: '0' + constraints: + - in_range: + - 0 + - 32 + fsb_oam_ip_1: + hidden: false + immutable: false + type: string + description: IP address of OAM vNIC for FSB2 + default: 107.239.72.154 + fsb_oam_ip_0: + hidden: false + immutable: false + type: string + description: IP address of OAM vNIC for FSB1 + default: 107.239.72.153 + shc_timeout: + hidden: false + immutable: false + type: string + description: health check + default: 5 + vlc_st_version: + hidden: false + immutable: false + type: string + description: Indicates service version + default: 2 + sctp-a-src_subnet_prefix_v6: + hidden: false + immutable: false + type: string + description: ip_prefix for the SecurityGroup + default: '::' + sctp-a-ingress_rule_application: + hidden: false + immutable: false + type: string + description: application for the SecurityGroup + default: any + sctp-b-egress_ethertype: + hidden: false + immutable: false + type: string + description: ethertype for the SecurityGroup + default: IPv4 + sctp-a-ipv6-egress_src_start_port: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix + default: 0 + instance_ip_family_v6: + hidden: false + immutable: false + type: string + description: Ipv6 instance type + default: v6 + sctp-b-ingress-src_subnet_prefix_v6: + hidden: false + immutable: false + type: string + description: src subnet + default: '::' + gpb8_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb8_Internal2 + default: 00:80:37:0E:10:22 + gpb4_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb4_Internal1 + default: 00:80:37:0E:0C:22 + sctp-a-ipv6-ingress-dst_end_port: + hidden: false + immutable: false + type: string + description: IPV6 end port + default: 65535 + Internal1_net_gateway: + hidden: false + immutable: false + type: string + description: gateway for internal-1 network + default: 169.253.0.3 + sctp-b-ipv6-egress-dst_start_port: + hidden: false + immutable: false + type: string + description: IPV6 start port + default: 0 + gpb_name_7: + hidden: false + immutable: false + type: string + description: Name of gpb8 + default: zrdm3mmex59gpb0016 + gpb_name_6: + hidden: false + immutable: false + type: string + description: Name of gpb7 + default: zrdm3mmex59gpb0015 + gpb_name_5: + hidden: false + immutable: false + type: string + description: Name of gpb6 + default: zrdm3mmex59gpb0014 + gpb_name_4: + hidden: false + immutable: false + type: string + description: Name of gpb5 + default: zrdm3mmex59gpb0013 + gpb_name_3: + hidden: false + immutable: false + type: string + description: Name of gpb4 + default: zrdm3mmex59gpb0012 + sctp-a-ipv6-ingress_dst_addresses: + hidden: false + immutable: false + type: string + description: IPV6 destination + default: local + gpb_name_2: + hidden: false + immutable: false + type: string + description: Name of gpb3 + default: zrdm3mmex59gpb0011 + shc_delay: + hidden: false + immutable: false + type: string + description: health check + default: 3 + gpb_name_1: + hidden: false + immutable: false + type: string + description: Name of gpb2 + default: zrdm3mmex59gpb0010 + sctp-b-ipv6-egress_action: + hidden: false + immutable: false + type: string + description: IPV6 action + default: pass + vlc3_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc3_Internal2 + default: 00:80:37:0E:03:12 + gpb_name_0: + hidden: false + immutable: false + type: string + description: Name of gpb1 + default: zrdm3mmex59gpb009 + sctp-a-ipv6-egress_action: + hidden: false + immutable: false + type: string + description: IPV6 action + default: pass + gpb5_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb5_Internal1 + default: 00:80:37:0E:0D:22 + sctp-b-ipv6-ingress_rule_protocol: + hidden: false + immutable: false + type: string + description: IPV6 Rule-protocol + default: any + shc_max_retries: + hidden: false + immutable: false + type: string + description: health check + default: 2 + fsb_volume_type: + label: volume type + hidden: false + immutable: false + type: string + description: volume type SolidFire + default: SF-Default-SSD + sctp-a-name: + hidden: false + immutable: false + type: string + description: name for the SecurityGroup + default: epc-sctp-a-ipv4v6-sec-group + vlc_sctp_b_ip_5: + hidden: false + immutable: false + type: string + description: Static IP vlc6 SCTPB + default: 107.243.47.187 + vlc_sctp_b_ip_4: + hidden: false + immutable: false + type: string + description: Static IP vlc5 SCTPB + default: 107.243.47.186 + vlc_sctp_b_ip_3: + hidden: false + immutable: false + type: string + description: Static IP vlc4 SCTPB + default: 107.243.47.185 + vlc_sctp_b_ip_2: + hidden: false + immutable: false + type: string + description: Static IP vlc3 SCTPB + default: 107.243.47.184 + sctp-b-egress_rule_protocol: + hidden: false + immutable: false + type: string + description: protocol for the SecurityGroup + default: any + vnf_id: + hidden: false + immutable: false + type: string + description: the vf_id for this instance. UUID provided by ECOMP + default: zrdm3mmex59 + vlc_sctp_b_ip_7: + hidden: false + immutable: false + type: string + description: Static IP vlc8 SCTPB + default: 107.243.47.189 + vlc_sctp_b_ip_6: + hidden: false + immutable: false + type: string + description: Static IP vlc7 SCTPB + default: 107.243.47.188 + vlc_sctp_b_ip_1: + hidden: false + immutable: false + type: string + description: Static IP vlc2 SCTPB + default: 107.243.47.177 + gpb6_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb6_Internal1 + default: 00:80:37:0E:0E:22 + sctp-b-ipv6-egress_dst_end_port: + hidden: false + immutable: false + type: string + description: IPV6 end port + default: 65535 + vlc_sctp_b_ip_0: + hidden: false + immutable: false + type: string + description: Static IP vlc1 SCTPB + default: 107.243.47.176 + vlc2_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc2_Internal2 + default: 00:80:37:0E:02:12 + sctp-b-ingress-src_subnet_prefix: + hidden: false + immutable: false + type: string + description: ip_prefix for the SecurityGroup + default: 0.0.0.0 + gpb_flavor_name: + hidden: false + immutable: false + type: string + description: Flavor to use for servers gpb + default: nv.c20r64d1 + vlc_sctp_a_route_prefixes: + hidden: false + immutable: false + type: json + description: Route prefixes for static routing on SCTPA + sctp-b-ipv6-ingress_dst_addresses: + hidden: false + immutable: false + type: string + description: IPV6 destination + default: local + sctp-b-ipv6-ingress_ethertype: + hidden: false + immutable: false + type: string + description: IPV6 ethertype + default: IPv4 + sctp-b-ipv6-egress_dst_subnet_prefix: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix + default: 0.0.0.0 + sctp-a-ingress-src_subnet_prefix: + hidden: false + immutable: false + type: string + description: ip_prefix for the SecurityGroup + default: 0.0.0.0 + vlc1_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc1_Internal2 + default: 00:80:37:0E:01:12 + Internal1_rpf: + hidden: false + immutable: false + type: string + description: Reverse Path Forwarding Enabled/Disabled internal-1 network + default: disable + sctp-b-ingress_ethertype: + hidden: false + immutable: false + type: string + description: ethertype for the SecurityGroup + default: IPv4 + sctp-b-ingress-src_end_port: + hidden: false + immutable: false + type: float + description: end_port for the SecurityGroup + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + sctp-a-ipv6-ingress_rule_protocol: + hidden: false + immutable: false + type: string + description: IPV6 Rule-protocol + default: any + vlc_sctp_a_v6_ip_7: + hidden: false + immutable: false + type: string + description: Static IP vlc8 SCTPA + default: fd00:200:200:4:0:0:0:29 + vlc_sctp_a_v6_ip_6: + hidden: false + immutable: false + type: string + description: Static IP vlc7 SCTPA + default: fd00:200:200:4:0:0:0:28 + gpb7_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb7_Internal1 + default: 00:80:37:0E:0F:22 + vlc_sctp_a_v6_ip_5: + hidden: false + immutable: false + type: string + description: Static IP vlc6 SCTPA + default: fd00:200:200:4:0:0:0:27 + vlc_sctp_a_v6_ip_4: + hidden: false + immutable: false + type: string + description: Static IP vlc5 SCTPA + default: fd00:200:200:4:0:0:0:26 + vlc_sctp_a_v6_ip_3: + hidden: false + immutable: false + type: string + description: Static IP vlc4 SCTPA + default: fd00:200:200:4:0:0:0:25 + vlc_sctp_a_v6_ip_2: + hidden: false + immutable: false + type: string + description: Static IP vlc3 SCTPA + default: fd00:200:200:4:0:0:0:24 + sctp-a-ingress-src_start_port: + hidden: false + immutable: false + type: float + description: start_port for the SecurityGroup + default: 0 + constraints: + - in_range: + - 0 + - 65535 + vlc_sctp_a_v6_ip_1: + hidden: false + immutable: false + type: string + description: Static IP vlc2 SCTPA + default: fd00:200:200:4:0:0:0:17 + vlc_sctp_a_v6_ip_0: + hidden: false + immutable: false + type: string + description: Static IP vlc1 SCTPA + default: fd00:200:200:4:0:0:0:16 + node_templates: + abstract_gpb_1: + type: org.openecomp.resource.abstract.nodes.gpb_1 + directives: + - substitutable + properties: + compute_gpb_name: + - get_input: gpb_name_1 + vm_flavor_name: + get_input: gpb_flavor_name + compute_gpb_scheduler_hints: + - group: + get_input: server_group_id_0 + port_gpb2_Internal1_security_groups: + - - get_input: security_group_int1_id + compute_gpb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + port_gpb2_Internal2_network: + - get_input: internal_net_id_1 + port_gpb2_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + vm_image_name: + get_input: pxe_image_name + port_gpb2_Internal1_replacement_policy: + - AUTO + port_gpb2_Internal1_network: + - get_input: internal_net_id_0 + port_gpb2_Internal2_replacement_policy: + - AUTO + port_gpb2_Internal1_mac_requirements: + mac_count_required: + is_required: true + compute_gpb_availability_zone: + - get_input: availability_zone_1 + port_gpb2_Internal1_mac_address: + get_input: gpb2_Internal1_mac + port_gpb2_Internal2_mac_requirements: + mac_count_required: + is_required: true + port_gpb2_Internal2_mac_address: + get_input: gpb2_Internal1_mac + port_gpb2_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb2_Internal2_security_groups: + - - get_input: security_group_int2_id + service_template_filter: + substitute_service_template: Nested_gpb_1ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: gpb + nfc_naming_code: gpb + requirements: + - link_gpb_gpb2_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_gpb_gpb2_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + abstract_gpb_2: + type: org.openecomp.resource.abstract.nodes.gpb_2 + directives: + - substitutable + properties: + port_gpb3_Internal1_replacement_policy: + - AUTO + compute_gpb_name: + - get_input: gpb_name_2 + port_gpb3_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb3_Internal2_replacement_policy: + - AUTO + vm_flavor_name: + get_input: gpb_flavor_name + port_gpb3_Internal2_security_groups: + - - get_input: security_group_int2_id + compute_gpb_scheduler_hints: + - group: + get_input: server_group_id_0 + compute_gpb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + vm_image_name: + get_input: pxe_image_name + port_gpb3_Internal1_security_groups: + - - get_input: security_group_int1_id + port_gpb3_Internal2_network: + - get_input: internal_net_id_1 + compute_gpb_availability_zone: + - get_input: availability_zone_0 + port_gpb3_Internal1_network: + - get_input: internal_net_id_0 + port_gpb3_Internal1_mac_requirements: + mac_count_required: + is_required: true + port_gpb3_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb3_Internal1_mac_address: + get_input: gpb3_Internal1_mac + port_gpb3_Internal2_mac_address: + get_input: gpb3_Internal1_mac + port_gpb3_Internal2_mac_requirements: + mac_count_required: + is_required: true + service_template_filter: + substitute_service_template: Nested_gpb_2ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: gpb + nfc_naming_code: gpb + requirements: + - link_gpb_gpb3_Internal1: + capability: tosca.capabilities.network.Bindable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_gpb_gpb3_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + abstract_vlc: + type: org.openecomp.resource.abstract.nodes.vlc + directives: + - substitutable + properties: + port_template_VMInt_SCTP_A_vlc_virtual_network_refs: + - - get_input: sctp_a_net_fqdn + port_template_VMInt_INT1_vlc_security_group_refs: + - - get_input: security_group_int1_id + vm_flavor_name: + get_input: vlc_flavor_name + port_template_VMInt_INT2_vlc_port_tuple_refs: + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc4 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc3 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc2 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc1 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc8 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc7 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc6 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc5 + vm_image_name: + get_input: pxe_image_name + port_template_VMInt_INT1_vlc_port_tuple_refs: + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc4 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc3 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc2 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc1 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc8 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc7 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc6 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc5 + port_template_VMInt_INT2_vlc_virtual_network_refs: + - - get_input: internal_net_id_1 + port_template_VMInt_OAM_vlc_virtual_network_refs: + - - get_input: oam_net_fqdn + port_template_VMInt_OAM_vlc_port_tuple_refs: + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc4 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc3 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc2 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc1 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc8 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc7 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc6 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc5 + port_template_VMInt_INT2_vlc_virtual_machine_interface_mac_addresses: + - - get_input: vlc4_Internal2_mac + - - get_input: vlc3_Internal2_mac + - - get_input: vlc2_Internal2_mac + - - get_input: vlc1_Internal2_mac + - - get_input: vlc8_Internal2_mac + - - get_input: vlc7_Internal2_mac + - - get_input: vlc6_Internal2_mac + - - get_input: vlc5_Internal2_mac + port_template_VMInt_SCTP_B_vlc_port_tuple_refs: + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc4 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc3 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc2 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc1 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc8 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc7 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc6 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc5 + port_template_VMInt_GTP_vlc_security_group_refs: + - - get_input: security_group_gtp_id + compute_vlc_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + port_template_VMInt_OAM_vlc_security_group_refs: + - - get_input: security_group_oam_id + compute_vlc_contrail_service_instance_ind: + - true + - true + - true + - true + - true + - true + - true + - true + port_template_VMInt_GTP_vlc_port_tuple_refs: + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc4 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc3 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc2 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc1 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc8 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc7 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc6 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc5 + port_template_VMInt_SCTP_B_vlc_virtual_network_refs: + - - get_input: sctp_b_net_fqdn + port_template_VMInt_INT2_vlc_security_group_refs: + - - get_input: security_group_int2_id + port_template_VMInt_SCTP_B_vlc_security_group_refs: + - - get_input: security_group_sctp_b_id + port_template_VMInt_INT1_vlc_virtual_network_refs: + - - get_input: internal_net_id_0 + port_template_VMInt_SCTP_A_vlc_port_tuple_refs: + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc4 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc3 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc2 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc1 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc8 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc7 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc6 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc5 + compute_vlc_scheduler_hints: + - group: + get_input: server_group_id_0 + - group: + get_input: server_group_id_0 + - group: + get_input: server_group_id_0 + - group: + get_input: server_group_id_0 + - group: + get_input: server_group_id_0 + - group: + get_input: server_group_id_0 + - group: + get_input: server_group_id_0 + - group: + get_input: server_group_id_0 + compute_vlc_name: + - get_input: vlc_name_3 + - get_input: vlc_name_2 + - get_input: vlc_name_1 + - get_input: vlc_name_0 + - get_input: vlc_name_7 + - get_input: vlc_name_6 + - get_input: vlc_name_5 + - get_input: vlc_name_4 + port_template_VMInt_SCTP_A_vlc_security_group_refs: + - - get_input: security_group_sctp_a_id + compute_vlc_availability_zone: + - get_input: availability_zone_1 + - get_input: availability_zone_0 + - get_input: availability_zone_1 + - get_input: availability_zone_0 + - get_input: availability_zone_1 + - get_input: availability_zone_0 + - get_input: availability_zone_1 + - get_input: availability_zone_0 + port_template_VMInt_INT1_vlc_virtual_machine_interface_mac_addresses: + - - get_input: vlc4_Internal1_mac + - - get_input: vlc3_Internal1_mac + - - get_input: vlc2_Internal1_mac + - - get_input: vlc1_Internal1_mac + - - get_input: vlc8_Internal1_mac + - - get_input: vlc7_Internal1_mac + - - get_input: vlc6_Internal1_mac + - - get_input: vlc5_Internal1_mac + port_template_VMInt_GTP_vlc_virtual_network_refs: + - - get_input: gtp_net_fqdn + service_template_filter: + substitute_service_template: Nested_vlcServiceTemplate.yaml + count: 8 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: vlc + nfc_naming_code: vlc + requirements: + - link_vlc_template_VMInt_INT2_vlc: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + - link_vlc_template_VMInt_INT1_vlc: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + abstract_gpb_7: + type: org.openecomp.resource.abstract.nodes.gpb_7 + directives: + - substitutable + properties: + compute_gpb_name: + - get_input: gpb_name_7 + port_gpb8_Internal1_mac_address: + get_input: gpb8_Internal1_mac + port_gpb8_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + vm_flavor_name: + get_input: gpb_flavor_name + compute_gpb_scheduler_hints: + - group: + get_input: server_group_id_0 + compute_gpb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + vm_image_name: + get_input: pxe_image_name + port_gpb8_Internal2_security_groups: + - - get_input: security_group_int2_id + port_gpb8_Internal1_replacement_policy: + - AUTO + port_gpb8_Internal2_replacement_policy: + - AUTO + compute_gpb_availability_zone: + - get_input: availability_zone_1 + port_gpb8_Internal1_mac_requirements: + mac_count_required: + is_required: true + port_gpb8_Internal1_network: + - get_input: internal_net_id_0 + port_gpb8_Internal2_mac_requirements: + mac_count_required: + is_required: true + port_gpb8_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb8_Internal1_security_groups: + - - get_input: security_group_int1_id + port_gpb8_Internal2_network: + - get_input: internal_net_id_1 + port_gpb8_Internal2_mac_address: + get_input: gpb8_Internal1_mac + service_template_filter: + substitute_service_template: Nested_gpb_7ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: gpb + nfc_naming_code: gpb + requirements: + - link_gpb_gpb8_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_gpb_gpb8_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + abstract_gpb_5: + type: org.openecomp.resource.abstract.nodes.gpb_5 + directives: + - substitutable + properties: + port_gpb6_Internal1_mac_requirements: + mac_count_required: + is_required: true + compute_gpb_name: + - get_input: gpb_name_5 + vm_flavor_name: + get_input: gpb_flavor_name + compute_gpb_scheduler_hints: + - group: + get_input: server_group_id_0 + compute_gpb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + port_gpb6_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + vm_image_name: + get_input: pxe_image_name + port_gpb6_Internal1_security_groups: + - - get_input: security_group_int1_id + port_gpb6_Internal2_network: + - get_input: internal_net_id_1 + compute_gpb_availability_zone: + - get_input: availability_zone_1 + port_gpb6_Internal1_network: + - get_input: internal_net_id_0 + port_gpb6_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb6_Internal2_mac_address: + get_input: gpb6_Internal1_mac + port_gpb6_Internal1_mac_address: + get_input: gpb6_Internal1_mac + port_gpb6_Internal2_mac_requirements: + mac_count_required: + is_required: true + port_gpb6_Internal2_replacement_policy: + - AUTO + port_gpb6_Internal1_replacement_policy: + - AUTO + port_gpb6_Internal2_security_groups: + - - get_input: security_group_int2_id + service_template_filter: + substitute_service_template: Nested_gpb_5ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: gpb + nfc_naming_code: gpb + requirements: + - link_gpb_gpb6_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_gpb_gpb6_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + abstract_gpb_6: + type: org.openecomp.resource.abstract.nodes.gpb_6 + directives: + - substitutable + properties: + port_gpb7_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb7_Internal1_network: + - get_input: internal_net_id_0 + compute_gpb_name: + - get_input: gpb_name_6 + port_gpb7_Internal2_network: + - get_input: internal_net_id_1 + vm_flavor_name: + get_input: gpb_flavor_name + port_gpb7_Internal1_replacement_policy: + - AUTO + port_gpb7_Internal2_replacement_policy: + - AUTO + port_gpb7_Internal2_security_groups: + - - get_input: security_group_int2_id + compute_gpb_scheduler_hints: + - group: + get_input: server_group_id_0 + compute_gpb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + vm_image_name: + get_input: pxe_image_name + port_gpb7_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb7_Internal1_security_groups: + - - get_input: security_group_int1_id + compute_gpb_availability_zone: + - get_input: availability_zone_0 + port_gpb7_Internal2_mac_address: + get_input: gpb7_Internal1_mac + port_gpb7_Internal1_mac_requirements: + mac_count_required: + is_required: true + port_gpb7_Internal1_mac_address: + get_input: gpb7_Internal1_mac + port_gpb7_Internal2_mac_requirements: + mac_count_required: + is_required: true + service_template_filter: + substitute_service_template: Nested_gpb_6ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: gpb + nfc_naming_code: gpb + requirements: + - link_gpb_gpb7_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_gpb_gpb7_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + abstract_gpb_3: + type: org.openecomp.resource.abstract.nodes.gpb_3 + directives: + - substitutable + properties: + compute_gpb_name: + - get_input: gpb_name_3 + port_gpb4_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + vm_flavor_name: + get_input: gpb_flavor_name + port_gpb4_Internal1_mac_address: + get_input: gpb4_Internal1_mac + compute_gpb_scheduler_hints: + - group: + get_input: server_group_id_0 + port_gpb4_Internal2_mac_requirements: + mac_count_required: + is_required: true + compute_gpb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + port_gpb4_Internal2_mac_address: + get_input: gpb4_Internal1_mac + vm_image_name: + get_input: pxe_image_name + port_gpb4_Internal2_security_groups: + - - get_input: security_group_int2_id + compute_gpb_availability_zone: + - get_input: availability_zone_1 + port_gpb4_Internal2_replacement_policy: + - AUTO + port_gpb4_Internal1_replacement_policy: + - AUTO + port_gpb4_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb4_Internal1_security_groups: + - - get_input: security_group_int1_id + port_gpb4_Internal2_network: + - get_input: internal_net_id_1 + port_gpb4_Internal1_mac_requirements: + mac_count_required: + is_required: true + port_gpb4_Internal1_network: + - get_input: internal_net_id_0 + service_template_filter: + substitute_service_template: Nested_gpb_3ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: gpb + nfc_naming_code: gpb + requirements: + - link_gpb_gpb4_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_gpb_gpb4_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + abstract_gpb_4: + type: org.openecomp.resource.abstract.nodes.gpb_4 + directives: + - substitutable + properties: + port_gpb5_Internal2_mac_requirements: + mac_count_required: + is_required: true + port_gpb5_Internal1_security_groups: + - - get_input: security_group_int1_id + compute_gpb_name: + - get_input: gpb_name_4 + vm_flavor_name: + get_input: gpb_flavor_name + port_gpb5_Internal1_mac_requirements: + mac_count_required: + is_required: true + compute_gpb_scheduler_hints: + - group: + get_input: server_group_id_0 + port_gpb5_Internal2_network: + - get_input: internal_net_id_1 + compute_gpb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + vm_image_name: + get_input: pxe_image_name + port_gpb5_Internal1_network: + - get_input: internal_net_id_0 + port_gpb5_Internal2_mac_address: + get_input: gpb5_Internal1_mac + port_gpb5_Internal1_mac_address: + get_input: gpb5_Internal1_mac + port_gpb5_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb5_Internal2_replacement_policy: + - AUTO + compute_gpb_availability_zone: + - get_input: availability_zone_0 + port_gpb5_Internal1_replacement_policy: + - AUTO + port_gpb5_Internal2_security_groups: + - - get_input: security_group_int2_id + port_gpb5_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + service_template_filter: + substitute_service_template: Nested_gpb_4ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: gpb + nfc_naming_code: gpb + requirements: + - link_gpb_gpb5_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_gpb_gpb5_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + abstract_gpb: + type: org.openecomp.resource.abstract.nodes.gpb + directives: + - substitutable + properties: + port_gpb1_Internal1_security_groups: + - - get_input: security_group_int1_id + compute_gpb_name: + - get_input: gpb_name_0 + port_gpb1_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + vm_flavor_name: + get_input: gpb_flavor_name + port_gpb1_Internal1_mac_requirements: + mac_count_required: + is_required: true + compute_gpb_scheduler_hints: + - group: + get_input: server_group_id_0 + compute_gpb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + vm_image_name: + get_input: pxe_image_name + port_gpb1_Internal1_mac_address: + get_input: gpb1_Internal1_mac + port_gpb1_Internal2_mac_address: + get_input: gpb1_Internal1_mac + port_gpb1_Internal2_mac_requirements: + mac_count_required: + is_required: true + compute_gpb_availability_zone: + - get_input: availability_zone_0 + port_gpb1_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb1_Internal2_security_groups: + - - get_input: security_group_int2_id + port_gpb1_Internal1_replacement_policy: + - AUTO + port_gpb1_Internal2_replacement_policy: + - AUTO + port_gpb1_Internal2_network: + - get_input: internal_net_id_1 + port_gpb1_Internal1_network: + - get_input: internal_net_id_0 + service_template_filter: + substitute_service_template: Nested_gpbServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: gpb + nfc_naming_code: gpb + requirements: + - link_gpb_gpb1_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_gpb_gpb1_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + Internal1_net: + type: org.openecomp.resource.vl.nodes.heat.network.contrailV2.VirtualNetwork + properties: + network_ipam_refs_data: + - network_ipam_refs_data_ipam_subnets: + - network_ipam_refs_data_ipam_subnets_enable_dhcp: + get_input: Internal1_dhcp + network_ipam_refs_data_ipam_subnets_default_gateway: + get_input: Internal1_net_gateway + network_ipam_refs_data_ipam_subnets_subnet: + network_ipam_refs_data_ipam_subnets_subnet_ip_prefix_len: + get_input: Internal1_net_cidr_len + network_ipam_refs_data_ipam_subnets_subnet_ip_prefix: + get_input: Internal1_net_cidr + network_name: + str_replace: + template: $VNF_NAME_int_net_1 + params: + $VNF_NAME: + get_input: vnf_name + network_ipam_refs: + - UNSUPPORTED_RESOURCE_template_NetworkIpam_Internal1 + abstract_fsb: + type: org.openecomp.resource.abstract.nodes.fsb + directives: + - substitutable + properties: + port_FSB1_Internal1_mac_address: + get_input: fsb1_Internal1_mac + port_FSB_OAM_network_role_tag: + - oam + port_FSB1_Internal2_network: + - Internal2_net + port_FSB1_Internal1_network: + - Internal1_net + vm_flavor_name: + get_input: fsb_flavor_name + port_FSB1_Internal2_mac_address: + get_input: fsb1_Internal1_mac + port_FSB_OAM_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: true + floating_ip_count_required: + is_required: false + compute_fsb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + port_FSB1_Internal1_security_groups: + - - int1_security_group + port_FSB1_Internal2_replacement_policy: + - AUTO + compute_fsb_scheduler_hints: + - group: VM_Affinity_group + port_FSB1_Internal1_replacement_policy: + - AUTO + compute_fsb_name: + - get_input: fsb_name_0 + port_FSB1_Internal1_mac_requirements: + mac_count_required: + is_required: true + port_FSB1_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_FSB_OAM_network: + - get_input: oam_net_name + port_FSB_OAM_security_groups: + - - oam_security_group + port_FSB_OAM_mac_requirements: + mac_count_required: + is_required: false + port_FSB_OAM_replacement_policy: + - AUTO + compute_fsb_availability_zone: + - get_input: availability_zone_0 + port_FSB1_Internal2_security_groups: + - - int2_security_group + port_FSB1_Internal2_mac_requirements: + mac_count_required: + is_required: true + port_FSB1_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_FSB_OAM_fixed_ips: + - ip_address: + get_input: fsb_oam_ip_0 + service_template_filter: + substitute_service_template: Nested_fsbServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: fsb + nfc_naming_code: fsb + requirements: + - link_fsb_FSB1_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_fsb_FSB1_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + gtp_security_group: + type: org.openecomp.resource.vfc.rules.nodes.heat.network.neutron.SecurityRules + properties: + name: + str_replace: + template: $VNF_NAME_$SECGROUPNAME + params: + $SECGROUPNAME: + get_input: gtp_sec_group_name + $VNF_NAME: + get_input: vnf_name + rules: + - protocol: tcp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: udp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: icmp + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + - protocol: tcp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: udp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: icmp + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + abstract_ncb_1: + type: org.openecomp.resource.abstract.nodes.ncb_1 + directives: + - substitutable + properties: + port_NCB2_Internal2_security_groups: + - - int2_security_group + port_NCB2_Internal1_replacement_policy: + - AUTO + port_NCB2_Internal2_replacement_policy: + - AUTO + vm_flavor_name: + get_input: ncb_flavor_name + port_NCB2_Internal2_mac_requirements: + mac_count_required: + is_required: true + port_NCB2_Internal1_mac_requirements: + mac_count_required: + is_required: true + vm_image_name: + get_input: pxe_image_name + compute_ncb_scheduler_hints: + - group: VM_Affinity_group + compute_ncb_availability_zone: + - get_input: availability_zone_1 + port_NCB2_Internal1_network: + - Internal1_net + port_NCB2_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_NCB2_Internal1_security_groups: + - - int1_security_group + port_NCB2_Internal2_network: + - Internal2_net + port_NCB2_Internal1_mac_address: + get_input: ncb2_Internal1_mac + port_NCB2_Internal2_mac_address: + get_input: ncb2_Internal1_mac + compute_ncb_name: + - get_input: ncb_name_1 + compute_ncb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + port_NCB2_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + service_template_filter: + substitute_service_template: Nested_ncb_1ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: ncb + nfc_naming_code: ncb + requirements: + - link_ncb_NCB2_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_ncb_NCB2_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + abstract_ncb: + type: org.openecomp.resource.abstract.nodes.ncb + directives: + - substitutable + properties: + vm_flavor_name: + get_input: ncb_flavor_name + port_NCB1_Internal2_mac_requirements: + mac_count_required: + is_required: true + vm_image_name: + get_input: pxe_image_name + port_NCB1_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + compute_ncb_scheduler_hints: + - group: VM_Affinity_group + port_NCB1_Internal1_security_groups: + - - int1_security_group + compute_ncb_availability_zone: + - get_input: availability_zone_0 + port_NCB1_Internal2_mac_address: + get_input: ncb1_Internal1_mac + port_NCB1_Internal1_mac_address: + get_input: ncb1_Internal1_mac + port_NCB1_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_NCB1_Internal1_mac_requirements: + mac_count_required: + is_required: true + port_NCB1_Internal2_replacement_policy: + - AUTO + port_NCB1_Internal1_network: + - Internal1_net + port_NCB1_Internal2_security_groups: + - - int2_security_group + port_NCB1_Internal1_replacement_policy: + - AUTO + compute_ncb_name: + - get_input: ncb_name_0 + compute_ncb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + port_NCB1_Internal2_network: + - Internal2_net + service_template_filter: + substitute_service_template: Nested_ncbServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: ncb + nfc_naming_code: ncb + requirements: + - link_ncb_NCB1_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_ncb_NCB1_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + int1_security_group: + type: org.openecomp.resource.vfc.rules.nodes.heat.network.neutron.SecurityRules + properties: + name: + str_replace: + template: $VNF_NAME_$SECGROUPNAME + params: + $SECGROUPNAME: + get_input: int1_sec_group_name + $VNF_NAME: + get_input: vnf_name + rules: + - protocol: tcp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: udp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: icmp + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + - protocol: tcp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: udp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: icmp + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + requirements: + - port: + capability: attachment_fsb_FSB1_Internal1 + node: abstract_fsb + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_fsb_FSB2_Internal1 + node: abstract_fsb_1 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_ncb_NCB1_Internal1 + node: abstract_ncb + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_ncb_NCB2_Internal1 + node: abstract_ncb_1 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb1_Internal1 + node: abstract_gpb + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb2_Internal1 + node: abstract_gpb_1 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb3_Internal1 + node: abstract_gpb_2 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb4_Internal1 + node: abstract_gpb_3 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb5_Internal1 + node: abstract_gpb_4 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb6_Internal1 + node: abstract_gpb_5 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb7_Internal1 + node: abstract_gpb_6 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb8_Internal1 + node: abstract_gpb_7 + relationship: org.openecomp.relationships.AttachesTo + fsb_volume_0: + type: org.openecomp.resource.vfc.nodes.heat.cinder.Volume + properties: + image: + get_input: fsb_volume_image_name_0 + volume_type: + get_input: fsb_volume_type + size: '(get_input : fsb_volume_size) * 1024' + name: + list_join: + - _ + - - get_input: OS::stack_name + - FSB1_Vol_1 + fsb_volume_1: + type: org.openecomp.resource.vfc.nodes.heat.cinder.Volume + properties: + image: + get_input: fsb_volume_image_name_1 + volume_type: + get_input: fsb_volume_type + size: '(get_input : fsb_volume_size) * 1024' + name: + list_join: + - _ + - - get_input: OS::stack_name + - FSB2_Vol_1 + Internal2_net: + type: org.openecomp.resource.vl.nodes.heat.network.contrailV2.VirtualNetwork + properties: + network_ipam_refs_data: + - network_ipam_refs_data_ipam_subnets: + - network_ipam_refs_data_ipam_subnets_enable_dhcp: + get_input: Internal2_dhcp + network_ipam_refs_data_ipam_subnets_default_gateway: + get_input: Internal2_net_gateway + network_ipam_refs_data_ipam_subnets_subnet: + network_ipam_refs_data_ipam_subnets_subnet_ip_prefix_len: + get_input: Internal2_net_cidr_len + network_ipam_refs_data_ipam_subnets_subnet_ip_prefix: + get_input: Internal2_net_cidr + network_name: + str_replace: + template: $VNF_NAME_int_net_2 + params: + $VNF_NAME: + get_input: vnf_name + network_ipam_refs: + - UNSUPPORTED_RESOURCE_template_NetworkIpam_Internal2 + int2_security_group: + type: org.openecomp.resource.vfc.rules.nodes.heat.network.neutron.SecurityRules + properties: + name: + str_replace: + template: $VNF_NAME_$SECGROUPNAME + params: + $SECGROUPNAME: + get_input: int2_sec_group_name + $VNF_NAME: + get_input: vnf_name + rules: + - protocol: tcp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: udp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: 132 + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: icmp + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + - protocol: tcp + ethertype: IPv6 + port_range_max: 65535 + remote_ip_prefix: ::/0 + direction: egress + port_range_min: 1 + - protocol: udp + ethertype: IPv6 + port_range_max: 65535 + remote_ip_prefix: ::/0 + direction: egress + port_range_min: 1 + - protocol: 132 + ethertype: IPv6 + port_range_max: 65535 + remote_ip_prefix: ::/0 + direction: egress + port_range_min: 1 + - protocol: icmp + ethertype: IPv6 + remote_ip_prefix: ::/0 + direction: egress + - protocol: tcp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: udp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: 132 + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: icmp + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + - protocol: tcp + ethertype: IPv6 + port_range_max: 65535 + remote_ip_prefix: ::/0 + direction: ingress + port_range_min: 1 + - protocol: udp + ethertype: IPv6 + port_range_max: 65535 + remote_ip_prefix: ::/0 + direction: ingress + port_range_min: 1 + - protocol: 132 + ethertype: IPv6 + port_range_max: 65535 + remote_ip_prefix: ::/0 + direction: ingress + port_range_min: 1 + - protocol: icmp + ethertype: IPv6 + remote_ip_prefix: ::/0 + direction: ingress + requirements: + - port: + capability: attachment_fsb_FSB1_Internal2 + node: abstract_fsb + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_fsb_FSB2_Internal2 + node: abstract_fsb_1 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_ncb_NCB1_Internal2 + node: abstract_ncb + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_ncb_NCB2_Internal2 + node: abstract_ncb_1 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb1_Internal2 + node: abstract_gpb + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb2_Internal2 + node: abstract_gpb_1 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb3_Internal2 + node: abstract_gpb_2 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb4_Internal2 + node: abstract_gpb_3 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb5_Internal2 + node: abstract_gpb_4 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb6_Internal2 + node: abstract_gpb_5 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb7_Internal2 + node: abstract_gpb_6 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb8_Internal2 + node: abstract_gpb_7 + relationship: org.openecomp.relationships.AttachesTo + abstract_fsb_1: + type: org.openecomp.resource.abstract.nodes.fsb_1 + directives: + - substitutable + properties: + port_FSB_OAM_network_role_tag: + - oam + vm_flavor_name: + get_input: fsb_flavor_name + port_FSB_OAM_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: true + floating_ip_count_required: + is_required: false + port_FSB2_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_FSB2_Internal2_security_groups: + - - int2_security_group + compute_fsb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + port_FSB2_Internal1_mac_address: + get_input: fsb2_Internal1_mac + compute_fsb_scheduler_hints: + - group: VM_Affinity_group + compute_fsb_name: + - get_input: fsb_name_1 + port_FSB2_Internal1_security_groups: + - - int1_security_group + port_FSB_OAM_network: + - get_input: oam_net_name + port_FSB_OAM_security_groups: + - - oam_security_group + port_FSB2_Internal1_network: + - Internal1_net + port_FSB2_Internal2_mac_address: + get_input: fsb2_Internal1_mac + port_FSB2_Internal2_mac_requirements: + mac_count_required: + is_required: true + port_FSB_OAM_mac_requirements: + mac_count_required: + is_required: false + port_FSB2_Internal2_replacement_policy: + - AUTO + port_FSB2_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_FSB_OAM_replacement_policy: + - AUTO + port_FSB2_Internal2_network: + - Internal2_net + port_FSB2_Internal1_replacement_policy: + - AUTO + compute_fsb_availability_zone: + - get_input: availability_zone_1 + port_FSB_OAM_fixed_ips: + - ip_address: + get_input: fsb_oam_ip_1 + port_FSB2_Internal1_mac_requirements: + mac_count_required: + is_required: true + service_template_filter: + substitute_service_template: Nested_fsb_1ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: fsb + nfc_naming_code: fsb + requirements: + - link_fsb_FSB2_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_fsb_FSB2_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + oam_security_group: + type: org.openecomp.resource.vfc.rules.nodes.heat.network.neutron.SecurityRules + properties: + name: + str_replace: + template: $VNF_NAME_$SECGROUPNAME + params: + $SECGROUPNAME: + get_input: oam_sec_group_name + $VNF_NAME: + get_input: vnf_name + rules: + - protocol: tcp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: udp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: icmp + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + - protocol: tcp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: udp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: icmp + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + requirements: + - port: + capability: attachment_fsb_FSB_OAM + node: abstract_fsb + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_fsb_FSB_OAM + node: abstract_fsb_1 + relationship: org.openecomp.relationships.AttachesTo + groups: + vmme_gpb3_group: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/vmme_gpb3.yml + description: | + Module HOT template to create vmme 1-8 gpb + members: + - abstract_gpb + - abstract_gpb_1 + - abstract_gpb_2 + - abstract_gpb_3 + - abstract_gpb_4 + - abstract_gpb_5 + - abstract_gpb_6 + - abstract_gpb_7 + base_vmme_group: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/base_vmme.yml + description: | + Base HOT template to create vmme 2 fsb 2 ncb + members: + - int2_security_group + - oam_security_group + - gtp_security_group + - Internal2_net + - int1_security_group + - Internal1_net + - abstract_ncb + - abstract_ncb_1 + - abstract_fsb + - abstract_fsb_1 + base_vmme_volume_group: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/base_vmme_volume.yml + description: HOT template for vMME Cinder Volumes + members: + - fsb_volume_0 + - fsb_volume_1 + vmme_gpb1_group: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/vmme_gpb1.yml + description: | + Module HOT template to create vmme 1-8 gpb + members: + - abstract_gpb + - abstract_gpb_1 + - abstract_gpb_2 + - abstract_gpb_3 + - abstract_gpb_4 + - abstract_gpb_5 + - abstract_gpb_6 + - abstract_gpb_7 + vmme_gpb4_group: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/vmme_gpb4.yml + description: | + Module HOT template to create vmme 1-8 gpb + members: + - abstract_gpb + - abstract_gpb_1 + - abstract_gpb_2 + - abstract_gpb_3 + - abstract_gpb_4 + - abstract_gpb_5 + - abstract_gpb_6 + - abstract_gpb_7 + vmme_gpb2_group: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/vmme_gpb2.yml + description: | + Module HOT template to create vmme 1-8 gpb + members: + - abstract_gpb + - abstract_gpb_1 + - abstract_gpb_2 + - abstract_gpb_3 + - abstract_gpb_4 + - abstract_gpb_5 + - abstract_gpb_6 + - abstract_gpb_7 + VM_Affinity_group: + type: tosca.groups.Root + members: + - abstract_ncb + - abstract_ncb_1 + - abstract_vlc + - abstract_fsb + - abstract_fsb_1 + - abstract_gpb + - abstract_gpb_1 + - abstract_gpb_2 + - abstract_gpb_3 + - abstract_gpb_4 + - abstract_gpb_5 + - abstract_gpb_6 + - abstract_gpb_7 + vmme_vlc_group: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/vmme_vlc.yml + description: | + Module HOT template to create vmme 8 vlcs + members: + - abstract_vlc + outputs: + oam_management_v4_address: + description: ID of OAM VIP to be provisioned in A&AI + value: + get_input: vip_oam_management_v4_ip + fsb_volume_id_1: + description: ID of Cinder Volume for FSB2 + value: fsb_volume_1 + security_group_sctp_b_id: + description: ID of sctpb_security_group + value: UNSUPPORTED_RESOURCE_sctpb_security_group + service_instance_id_0: + description: ID of Service Instance used for vLCs + value: UNSUPPORTED_RESOURCE_template_ServiceInstance_VLC + security_group_sctp_a_id: + description: ID of sctpa_security_group + value: UNSUPPORTED_RESOURCE_sctpa_security_group + fsb_volume_id_0: + description: ID of Cinder Volume for FSB1 + value: fsb_volume_0 + policies: + VM_Affinity_policy: + type: org.openecomp.policies.placement.Antilocate + properties: + container_type: host + targets: + - VM_Affinity_group @@ -0,0 +1,3584 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +metadata: + template_name: Main +imports: +- openecomp_heat_index: + file: openecomp-heat/_index.yml +- GlobalSubstitutionTypes: + file: GlobalSubstitutionTypesServiceTemplate.yaml +topology_template: + inputs: + vlc4_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc4_Internal2 + default: 00:80:37:0E:04:12 + sctp-a-egress_rule_application: + hidden: false + immutable: false + type: string + description: application for the SecurityGroup + default: any + sctp-b-ipv6-ingress-src_start_port: + hidden: false + immutable: false + type: float + description: IPV6 start port + default: 0 + constraints: + - in_range: + - 0 + - 65535 + ncb1_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to ncb1_Internal2 + default: 00:80:37:0E:09:12 + sctp-a-ipv6-ingress_ethertype: + hidden: false + immutable: false + type: string + description: IPV6 ethertype + default: IPv4 + gpb8_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb8_Internal1 + default: 00:80:37:0E:10:22 + sctp-a-ingress_rule_protocol: + hidden: false + immutable: false + type: string + description: protocol for the SecurityGroup + default: any + sctp-b-display_name: + hidden: false + immutable: false + type: string + description: display_name for the SecurityGroup + default: epc-sctp-b-ipv4v6-sec-group + sctp-a-ingress_ethertype: + hidden: false + immutable: false + type: string + description: ethertype for the SecurityGroup + default: IPv4 + sctp-a-egress-src_start_port: + hidden: false + immutable: false + type: float + description: start_port for the SecurityGroup + default: 0 + constraints: + - in_range: + - 0 + - 65535 + ncb_flavor_name: + hidden: false + immutable: false + type: string + description: Flavor to use for servers ncb + default: nv.c8r32d1 + vlc3_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc3_Internal1 + default: 00:80:37:0E:03:12 + Internal2_net_cidr: + hidden: false + immutable: false + type: string + description: CIDR for internal-2 network + default: 169.255.0.0 + sctp-a-egress-dst_start_port: + hidden: false + immutable: false + type: float + description: start_port for the SecurityGroup + default: 0 + constraints: + - in_range: + - 0 + - 65535 + sctp-a-egress_ethertype: + hidden: false + immutable: false + type: string + description: ethertype for the SecurityGroup + default: IPv4 + gpb4_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb4_Internal2 + default: 00:80:37:0E:0C:22 + sctp-b-ipv6-egress_rule_application: + hidden: false + immutable: false + type: string + description: IPV6 Rule-application + default: any + vlc8_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc8_Internal1 + default: 00:80:37:0E:08:12 + sctp-b-ipv6-ingress-src_end_port: + hidden: false + immutable: false + type: float + description: IPV6 ending port for destination + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + fsb2_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to fsb2_Internal1 + default: 00:80:37:0E:0D:12 + sctp-b-name: + hidden: false + immutable: false + type: string + description: name for the SecurityGroup + default: epc-sctp-b-ipv4v6-sec-group + sctp-b-ipv6-egress_ethertype: + hidden: false + immutable: false + type: string + description: IPV6 ethertype + default: IPv4 + internal_net_id_1: + hidden: false + immutable: false + type: string + description: UUID of Internal2_net + default: e3397c69-a942-49aa-81cb-fb91ff34abc8 + sctp-a-egress_dst_subnet_prefix: + hidden: false + immutable: false + type: string + description: ip_prefix for the SecurityGroup + default: 0.0.0.0 + internal_net_id_0: + hidden: false + immutable: false + type: string + description: UUID of Internal1_net + default: 871de971-22ac-47b6-befb-50e7d4cb67ea + sctp_b_net_fqdn: + hidden: false + immutable: false + type: string + description: Network FQDN SCTPB + default: default-domain:vMME-24474-Ericsson-WTC-Lab-vLCP1-4:vMME-24474-Ericsson-WTC-Lab-vLCP1-4_gn_SCTPB_net_1 + sctp-a-ipv6-ingress_rule_application: + hidden: false + immutable: false + type: string + description: IPV6 Rule-application + default: any + sctp-b-ipv6-ingress_src_subnet_prefix_len: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix length + default: '0' + ncb_name_1: + hidden: false + immutable: false + type: string + description: Name of ncb2 + default: zrdm3mmex59ncb002 + ncb_name_0: + hidden: false + immutable: false + type: string + description: Name of ncb1 + default: zrdm3mmex59ncb001 + vlc_st_virtualization_type: + hidden: false + immutable: false + type: string + description: Indicates virtualization type + default: virtual-machine + vlc2_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc2_Internal1 + default: 00:80:37:0E:02:12 + sctp-b-ingress-dst_start_port: + hidden: false + immutable: false + type: float + description: start_port for the SecurityGroup + default: 0 + constraints: + - in_range: + - 0 + - 65535 + sctp-a-display_name: + hidden: false + immutable: false + type: string + description: display_name for the SecurityGroup + default: epc-sctp-a-ipv4v6-sec-group + sctp-b-ingress_rule_application: + hidden: false + immutable: false + type: string + description: application for the SecurityGroup + default: any + int2_sec_group_name: + hidden: false + immutable: false + type: string + description: SecurityGroup name for internal-2 + default: int2-sec-group + gpb5_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb5_Internal2 + default: 00:80:37:0E:0D:22 + sctp-a-egress-dst_subnet_prefix_v6: + hidden: false + immutable: false + type: string + description: dst subnet + default: '::' + OS::stack_name: + type: string + required: false + sctp-b-egress-src_end_port: + hidden: false + immutable: false + type: float + description: end_port for the SecurityGroup + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + Internal2_shared: + hidden: false + immutable: false + type: string + description: Whether Shared or private internal-2 network + default: false + sctp-a-ipv6-egress_rule_protocol: + hidden: false + immutable: false + type: string + description: IPV6 Rule-protocol + default: any + Internal2_rpf: + hidden: false + immutable: false + type: string + description: Reverse Path Forwarding Enabled/Disabled internal-2 network + default: disable + vlc5_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc5_Internal2 + default: 00:80:37:0E:05:12 + sctp-a-ipv6-egress_src_end_port: + hidden: false + immutable: false + type: string + description: IPV6 end port + default: 65535 + Internal1_forwarding_mode: + hidden: false + immutable: false + type: string + description: L2 or L3 forwarding mode for internal-1 network + default: l2 + gpb3_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb3_Internal1 + default: 00:80:37:0E:0B:22 + vip_oam_management_v4_ip: + hidden: false + immutable: false + type: string + description: IP address of OAM service IP address to be provisioned in A&AI + default: 107.239.72.176 + vmi_oam_preference_primary: + hidden: false + immutable: false + type: float + description: Preference for primary interface/port + default: 200 + sctp-b-src_subnet_prefix_v6: + hidden: false + immutable: false + type: string + description: ip_prefix for the SecurityGroup + default: '::' + sctp-a-egress_dst_subnet_prefix_len: + hidden: false + immutable: false + type: float + description: ip_prefix_len for the SecurityGroup + default: '0' + constraints: + - in_range: + - 0 + - 32 + security_group_sctp_b_id: + hidden: false + immutable: false + type: string + description: Security Group UUID for output + default: 92a4ae54-1733-4d03-b488-f178bb9f7b82 + Internal2_forwarding_mode: + hidden: false + immutable: false + type: string + description: L2 or L3 forwarding mode for internal-2 network + default: l2 + sctp-a-ipv6-egress_dst_end_port: + hidden: false + immutable: false + type: string + description: IPV6 end port + default: 65535 + sctp-b-egress-dst_subnet_prefix_v6: + hidden: false + immutable: false + type: string + description: dst subnet + default: '::' + sctp-b-egress_dst_subnet_prefix: + hidden: false + immutable: false + type: string + description: ip_prefix for the SecurityGroup + default: 0.0.0.0 + security_group_oam_id: + hidden: false + immutable: false + type: string + description: Security Group UUID for output + default: 4ae4aa74-3e8e-4f2b-8b5f-a8bd262da96b + gpb2_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb2_Internal1 + default: 00:80:37:0E:0A:22 + security_group_int1_id: + hidden: false + immutable: false + type: string + description: UUID of Internal1_net security group + default: 94c62578-835d-4801-9372-70a2cfb22683 + sctp-a-egress_action: + hidden: false + immutable: false + type: string + description: simple_action for the SecurityGroup + default: pass + oam_net_fqdn: + hidden: false + immutable: false + type: string + description: Network FQDN OAM + default: default-domain:vMME-24474-Ericsson-WTC-Lab-vLCP1-4:vMME-24474-Ericsson-WTC-Lab-vLCP1-4_OAM_net_1 + ncb2_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to ncb2_Internal2 + default: 00:80:37:0E:0F:12 + vlc_st_interface_type_sctp_a: + hidden: false + immutable: false + type: string + description: service_interface_type for the ServiceTemplate + default: left + gpb3_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb3_Internal2 + default: 00:80:37:0E:0B:22 + vlc_st_interface_type_sctp_b: + hidden: false + immutable: false + type: string + description: service_interface_type for the ServiceTemplate + default: right + gpb1_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb1_Internal2 + default: 00:80:37:0E:09:22 + oam_net_name: + hidden: false + immutable: false + type: string + description: Network Name OAM + default: vMME-24474-Ericsson-WTC-Lab-vLCP1-4_OAM_net_1 + sctp-b-ingress-src_start_port: + hidden: false + immutable: false + type: float + description: start_port for the SecurityGroup + default: 0 + constraints: + - in_range: + - 0 + - 65535 + fsb1_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to fsb1_Internal1 + default: 00:80:37:0E:0B:12 + sctp-b-ingress_dst_addresses: + hidden: false + immutable: false + type: string + description: security_group for the SecurityGroup + default: local + vlc_st_interface_type_oam: + hidden: false + immutable: false + type: string + description: service_interface_type for the ServiceTemplate + default: management + shc_monitor_type: + hidden: false + immutable: false + type: string + description: health check + default: PING + oam_sec_group_name: + hidden: false + immutable: false + type: string + description: SecurityGroup name for OAM + default: oam-sec-group + Internal2_net_gateway: + hidden: false + immutable: false + type: string + description: gateway for internal-2 network + default: 169.255.0.3 + evac_policy: + hidden: false + immutable: false + type: string + description: CMHA Policy + default: Evacuate + server_group_id_0: + hidden: false + immutable: false + type: string + description: ID of Anti-Affinity Policy-based Server Group + default: ec99a73d-38f8-4280-8103-ba8ee584629f + vlc8_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc8_Internal2 + default: 00:80:37:0E:08:12 + sctp-b-ipv6-egress_rule_protocol: + hidden: false + immutable: false + type: string + description: IPV6 Rule-protocol + default: any + gtp_sec_group_name: + hidden: false + immutable: false + type: string + description: SecurityGroup name for GTP + default: gtp-sec-group + vlc_sctp_b_v6_ip_2: + hidden: false + immutable: false + type: string + description: Static IP vlc3 SCTPB + default: fd00:200:200:5:0:0:0:24 + vlc_sctp_b_v6_ip_1: + hidden: false + immutable: false + type: string + description: Static IP vlc2 SCTPB + default: fd00:200:200:5:0:0:0:17 + sctp-a-ipv6-egress_dst_subnet_prefix: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix + default: 0.0.0.0 + vlc_sctp_b_v6_ip_0: + hidden: false + immutable: false + type: string + description: Static IP vlc1 SCTPB + default: fd00:200:200:5:0:0:0:16 + vlc4_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc4_Internal1 + default: 00:80:37:0E:04:12 + vlc_sctp_b_v6_ip_6: + hidden: false + immutable: false + type: string + description: Static IP vlc7 SCTPB + default: fd00:200:200:5:0:0:0:28 + vlc_sctp_b_v6_ip_5: + hidden: false + immutable: false + type: string + description: Static IP vlc6 SCTPB + default: fd00:200:200:5:0:0:0:27 + vlc_sctp_b_v6_ip_4: + hidden: false + immutable: false + type: string + description: Static IP vlc5 SCTPB + default: fd00:200:200:5:0:0:0:26 + vlc_sctp_b_v6_ip_3: + hidden: false + immutable: false + type: string + description: Static IP vlc4 SCTPB + default: fd00:200:200:5:0:0:0:25 + sctp_b_net_name: + hidden: false + immutable: false + type: string + description: Network Name SCTPB + default: vMME-24474-Ericsson-WTC-Lab-vLCP1-4_gn_SCTPB_net_1 + sctp-b-ipv6-egress_dst_subnet_prefix_len: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix + default: '0' + sctp-a-egress_rule_protocol: + hidden: false + immutable: false + type: string + description: protocol for the SecurityGroup + default: any + Internal1_shared: + hidden: false + immutable: false + type: string + description: Whether Shared or private internal-1 network + default: false + shc_url_path: + hidden: false + immutable: false + type: string + description: health check + default: local-ip + Internal2_net_cidr_len: + hidden: false + immutable: false + type: string + description: CIDR length for internal-2 network + default: 17 + sctp-a-ingress-src_end_port: + hidden: false + immutable: false + type: float + description: end_port for the SecurityGroup + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + sctp-b-ipv6-ingress_src_subnet_prefix: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix + default: 0.0.0.0 + sctp-a-egress-dst_end_port: + hidden: false + immutable: false + type: float + description: end_port for the SecurityGroup + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + sctp-a-ingress_action: + hidden: false + immutable: false + type: string + description: simple_action for the SecurityGroup + default: pass + sctp-b-ipv6-ingress_action: + hidden: false + immutable: false + type: string + description: IPV6 action + default: pass + vlc_st_service_type: + hidden: false + immutable: false + type: string + description: service type + default: firewall + sctp-b-ipv6-ingress-dst_start_port: + hidden: false + immutable: false + type: string + description: IPV6 starting port for destination + default: 0 + vlc_st_availability_zone: + hidden: false + immutable: false + type: string + description: Indicates availability zone is enabled + default: true + vlc7_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc7_Internal1 + default: 00:80:37:0E:07:12 + fsb_volume_image_name_1: + label: MME_FSB2 + hidden: false + immutable: false + type: string + description: volume name + default: MME_FSB2_1_3_GA.qcow2 + vlc_oam_ip_6: + hidden: false + immutable: false + type: string + description: Static IP vlc7 OAM + default: 107.239.72.151 + sctp-a-ipv6-ingress_src_subnet_prefix_len: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix length + default: '0' + vlc_oam_ip_7: + hidden: false + immutable: false + type: string + description: Static IP vlc8 OAM + default: 107.239.72.152 + Internal1_allow_transit: + hidden: false + immutable: false + type: string + description: Allow/disallow transit internal-1 network + default: true + vlc_oam_ip_2: + hidden: false + immutable: false + type: string + description: Static IP vlc3 OAM + default: 107.239.72.157 + vlc_oam_ip_3: + hidden: false + immutable: false + type: string + description: Static IP vlc4 OAM + default: 107.239.72.158 + vlc_gtp_ip_0: + hidden: false + immutable: false + type: string + description: Static IP vlc1 GTP + default: 107.243.47.208 + vlc_oam_ip_4: + hidden: false + immutable: false + type: string + description: Static IP vlc5 OAM + default: 107.239.72.149 + fsb_volume_image_name_0: + label: MME_FSB1 + hidden: false + immutable: false + type: string + description: volume name + default: MME_FSB1_1_3_GA.qcow2 + vlc_gtp_ip_1: + hidden: false + immutable: false + type: string + description: Static IP vlc2 GTP + default: 107.243.47.209 + vlc_oam_ip_5: + hidden: false + immutable: false + type: string + description: Static IP vlc6 OAM + default: 107.239.72.150 + vlc_gtp_ip_2: + hidden: false + immutable: false + type: string + description: Static IP vlc3 GTP + default: 107.243.47.216 + vlc_name_6: + hidden: false + immutable: false + type: string + description: Name of vlc7 + default: zrdm3mmex59vlc007 + vlc_gtp_ip_3: + hidden: false + immutable: false + type: string + description: Static IP vlc4 GTP + default: 107.243.47.217 + vlc_name_7: + hidden: false + immutable: false + type: string + description: Name of vlc8 + default: zrdm3mmex59vlc008 + security_group_sctp_a_id: + hidden: false + immutable: false + type: string + description: Security Group UUID for output + default: 3cd8a524-77ff-4980-ae2a-d19ba70e0511 + vlc_gtp_ip_4: + hidden: false + immutable: false + type: string + description: Static IP vlc5 GTP + default: 107.243.47.218 + vlc_gtp_ip_5: + hidden: false + immutable: false + type: string + description: Static IP vlc6 GTP + default: 107.243.47.219 + vlc_gtp_ip_6: + hidden: false + immutable: false + type: string + description: Static IP vlc7 GTP + default: 107.243.47.220 + vlc_name_2: + hidden: false + immutable: false + type: string + description: Name of vlc3 + default: zrdm3mmex59vlc003 + vlc_gtp_ip_7: + hidden: false + immutable: false + type: string + description: Static IP vlc8 GTP + default: 107.243.47.221 + vlc_name_3: + hidden: false + immutable: false + type: string + description: Name of vlc4 + default: zrdm3mmex59vlc004 + vlc_name_4: + hidden: false + immutable: false + type: string + description: Name of vlc5 + default: zrdm3mmex59vlc005 + vlc_name_5: + hidden: false + immutable: false + type: string + description: Name of vlc6 + default: zrdm3mmex59vlc006 + fsb_volume_id_1: + hidden: false + immutable: false + type: string + description: ID of Cinder Volume for FSB2 + default: 5bd0560c-bfd0-47dc-a84a-554e2698c925 + sctp-a-ipv6-ingress_action: + hidden: false + immutable: false + type: string + description: IPV6 action + default: pass + vlc_name_0: + hidden: false + immutable: false + type: string + description: Name of vlc1 + default: zrdm3mmex59vlc001 + vlc_name_1: + hidden: false + immutable: false + type: string + description: Name of vlc2 + default: zrdm3mmex59vlc002 + vlc_oam_route_prefixes: + hidden: false + immutable: false + type: json + description: Route prefixes for static routing on OAM + sctp-b-egress_rule_application: + hidden: false + immutable: false + type: string + description: application for the SecurityGroup + default: any + vlc_oam_ip_0: + hidden: false + immutable: false + type: string + description: Static IP vlc1 OAM + default: 107.239.72.155 + vlc_oam_ip_1: + hidden: false + immutable: false + type: string + description: Static IP vlc2 OAM + default: 107.239.72.156 + vlc6_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc6_Internal1 + default: 00:80:37:0E:06:12 + fsb_volume_id_0: + hidden: false + immutable: false + type: string + description: ID of Cinder Volume for FSB1 + default: 27baa6a0-b701-4795-bf5e-4f546b350b1f + sctp-b-egress-dst_end_port: + hidden: false + immutable: false + type: float + description: end_port for the SecurityGroup + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + gpb2_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb2_Internal2 + default: 00:80:37:0E:0A:22 + sctp-a-ipv6-egress_rule_application: + hidden: false + immutable: false + type: string + description: IPV6 Rule-application + default: any + sctp-b-ipv6-egress_src_start_port: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix + default: 0 + Internal2_allow_transit: + hidden: false + immutable: false + type: string + description: Allow/disallow transit internal-2 network + default: true + fsb_volume_size: + label: volume size + hidden: false + immutable: false + type: float + description: volume size 320GB + default: 320 + constraints: + - in_range: + - 0 + - 340 + sctp-b-IPv6_ethertype: + hidden: false + immutable: false + type: string + description: IPV6 ethertype + default: IPv6 + gtp_net_fqdn: + hidden: false + immutable: false + type: string + description: Network FQDN GTP + default: default-domain:vMME-24474-Ericsson-WTC-Lab-vLCP1-4:vMME-24474-Ericsson-WTC-Lab-vLCP1-4_gn_GTP_net_1 + ncb2_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to ncb2_Internal1 + default: 00:80:37:0E:0F:12 + sctp-b-ingress_rule_protocol: + hidden: false + immutable: false + type: string + description: protocol for the SecurityGroup + default: any + sctp-b-ingress_action: + hidden: false + immutable: false + type: string + description: simple_action for the SecurityGroup + default: pass + sctp-b-egress_src_addresses: + hidden: false + immutable: false + type: string + description: security_group for the SecurityGroup + default: local + gpb7_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb7_Internal2 + default: 00:80:37:0E:0F:22 + sctp-a-ipv6-ingress-dst_start_port: + hidden: false + immutable: false + type: string + description: IPV6 starting port for destination + default: 0 + gtp_net_name: + hidden: false + immutable: false + type: string + description: Network Name GTP + default: vMME-24474-Ericsson-WTC-Lab-vLCP1-4_gn_GTP_net_1 + sctp-b-ipv6-ingress_rule_application: + hidden: false + immutable: false + type: string + description: IPV6 Rule-application + default: any + domain_name: + hidden: false + immutable: false + type: string + description: Unique name of vMME contrail domain + default: default-domain + vlc5_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc5_Internal1 + default: 00:80:37:0E:05:12 + sctp-a-egress_src_addresses: + hidden: false + immutable: false + type: string + description: security_group for the SecurityGroup + default: local + sctp-b-egress-src_start_port: + hidden: false + immutable: false + type: float + description: start_port for the SecurityGroup + default: 0 + constraints: + - in_range: + - 0 + - 65535 + shc_enabled: + hidden: false + immutable: false + type: string + description: health check + default: true + sctp-b-ipv6-ingress-dst_end_port: + hidden: false + immutable: false + type: string + description: IPV6 end port + default: 65535 + sctp-b-dst_subnet_prefix_v6: + hidden: false + immutable: false + type: string + description: ip_prefix for the SecurityGroup + default: '::' + sctp_a_net_fqdn: + hidden: false + immutable: false + type: string + description: Network FQDN SCTPA + default: default-domain:vMME-24474-Ericsson-WTC-Lab-vLCP1-4:vMME-24474-Ericsson-WTC-Lab-vLCP1-4_gn_SCTPA_net_1 + security_group_gtp_id: + hidden: false + immutable: false + type: string + description: Security Group UUID for output + default: e8ad3fe2-5f95-43e4-bbcc-da97b1c22588 + sctp-a-ipv6-ingress_src_subnet_prefix: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix + default: 0.0.0.0 + fsb_name_1: + hidden: false + immutable: false + type: string + description: Name of fsb1 + default: zrdm3mmex59fsb002 + sctp-b-egress-dst_start_port: + hidden: false + immutable: false + type: float + description: start_port for the SecurityGroup + default: 0 + constraints: + - in_range: + - 0 + - 65535 + fsb_name_0: + hidden: false + immutable: false + type: string + description: Name of fsb1 + default: zrdm3mmex59fsb001 + sctp_a_net_name: + hidden: false + immutable: false + type: string + description: Network Name SCTPA + default: vMME-24474-Ericsson-WTC-Lab-vLCP1-4_gn_SCTPA_net_1 + sctp-b-egress_dst_subnet_prefix_len: + hidden: false + immutable: false + type: float + description: ip_prefix_len for the SecurityGroup + default: '0' + constraints: + - in_range: + - 0 + - 32 + gpb1_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb1_Internal1 + default: 00:80:37:0E:09:22 + sctp-a-ingress-dst_start_port: + hidden: false + immutable: false + type: float + description: start_port for the SecurityGroup + default: 0 + constraints: + - in_range: + - 0 + - 65535 + fsb1_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to fsb1_Internal2 + default: 00:80:37:0E:0B:12 + vlc_st_service_mode: + hidden: false + immutable: false + type: string + description: service mode + default: in-network-nat + sctp-a-ipv6-egress_ethertype: + hidden: false + immutable: false + type: string + description: IPV6 ethertype + default: IPv4 + sctp-a-egress-src_end_port: + hidden: false + immutable: false + type: float + description: end_port for the SecurityGroup + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + sctp-b-egress_action: + hidden: false + immutable: false + type: string + description: simple_action for the SecurityGroup + default: pass + sctp-a-ingress-src_subnet_prefix_len: + hidden: false + immutable: false + type: float + description: ip_prefix_len for the SecurityGroup + default: '0' + constraints: + - in_range: + - 0 + - 32 + sctp-a-ipv6-ingress-src_start_port: + hidden: false + immutable: false + type: float + description: IPV6 start port + default: 0 + constraints: + - in_range: + - 0 + - 65535 + vf_module_id: + hidden: false + immutable: false + type: string + description: the vf_module_id for this instance. UUID provided by ECOMP + default: TWO + Internal1_net_cidr: + hidden: false + immutable: false + type: string + description: CIDR for internal-1 network + default: 169.253.0.0 + fsb_flavor_name: + hidden: false + immutable: false + type: string + description: Flavor to use for servers fsb1 + default: nv.c8r32d1 + sctp_rule_protocol: + hidden: false + immutable: false + type: string + description: protocol for the SecurityGroup + default: 132 + vnf_name: + hidden: false + immutable: false + type: string + description: the vnf_name for this instance. provided by ECOMP + default: zrdm3mmex59 + sctp-a-IPv6_ethertype: + hidden: false + immutable: false + type: string + description: IPV6 ethertype + default: IPv6 + vlc_sctp_b_v6_ip_7: + hidden: false + immutable: false + type: string + description: Static IP vlc8 SCTPB + default: fd00:200:200:5:0:0:0:29 + vlc6_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc6_Internal2 + default: 00:80:37:0E:06:12 + sctp-b-ingress-dst_end_port: + hidden: false + immutable: false + type: float + description: end_port for the SecurityGroup + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + vlc7_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc7_Internal2 + default: 00:80:37:0E:07:12 + sctp-a-ipv6-ingress-src_end_port: + hidden: false + immutable: false + type: float + description: IPV6 ending port for destination + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + vlc_flavor_name: + hidden: false + immutable: false + type: string + description: Flavor to use for servers vlc + default: nd.c16r64d1 + sctp-b-ipv6-egress_src_addresses: + hidden: false + immutable: false + type: string + description: IPV6 source + default: local + vlc_st_interface_type_int1: + hidden: false + immutable: false + type: string + description: service_interface_type for the ServiceTemplate + default: other1 + availability_zone_0: + hidden: false + immutable: false + type: string + description: cluster for spawnning fsb instances + default: rdm3-kvm-az02 + service_instance_id_0: + hidden: false + immutable: false + type: string + description: UUID of service instance for vLCs + default: 77c67cc8-d15f-47bc-aeb1-8d65d09e917a + availability_zone_1: + hidden: false + immutable: false + type: string + description: cluster for spawnning ncb instances + default: rdm3-kvm-az02 + vlc_st_interface_type_int2: + hidden: false + immutable: false + type: string + description: service_interface_type for the ServiceTemplate + default: other2 + sctp-a-ipv6-egress-dst_start_port: + hidden: false + immutable: false + type: string + description: IPV6 start port + default: 0 + sctp-a-ipv6-egress_dst_subnet_prefix_len: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix + default: '0' + vlc_sctp_a_ip_0: + hidden: false + immutable: false + type: string + description: Static IP vlc1 SCTPA + default: 107.243.47.144 + vlc_sctp_b_route_prefixes: + hidden: false + immutable: false + type: json + description: Route prefixes for static routing on SCTPB + vlc1_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc1_Internal1 + default: 00:80:37:0E:01:12 + sctp-b-ipv6-egress_src_end_port: + hidden: false + immutable: false + type: string + description: IPV6 end port + default: 65535 + sctp-a-ipv6-egress_src_addresses: + hidden: false + immutable: false + type: string + description: IPV6 source + default: local + vlc_sctp_a_ip_7: + hidden: false + immutable: false + type: string + description: Static IP vlc8 SCTPA + default: 107.243.47.157 + sctp-a-ingress-src_subnet_prefix_v6: + hidden: false + immutable: false + type: string + description: src subnet + default: '::' + vlc_sctp_a_ip_6: + hidden: false + immutable: false + type: string + description: Static IP vlc7 SCTPA + default: 107.243.47.156 + vlc_sctp_a_ip_5: + hidden: false + immutable: false + type: string + description: Static IP vlc6 SCTPA + default: 107.243.47.155 + sctp-a-ingress-dst_end_port: + hidden: false + immutable: false + type: float + description: end_port for the SecurityGroup + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + vlc_sctp_a_ip_4: + hidden: false + immutable: false + type: string + description: Static IP vlc5 SCTPA + default: 107.243.47.154 + vlc_sctp_a_ip_3: + hidden: false + immutable: false + type: string + description: Static IP vlc4 SCTPA + default: 107.243.47.153 + vlc_sctp_a_ip_2: + hidden: false + immutable: false + type: string + description: Static IP vlc3 SCTPA + default: 107.243.47.152 + vlc_sctp_a_ip_1: + hidden: false + immutable: false + type: string + description: Static IP vlc2 SCTPA + default: 107.243.47.145 + gpb6_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb6_Internal2 + default: 00:80:37:0E:0E:22 + security_group_int2_id: + hidden: false + immutable: false + type: string + description: UUID of Internal1_net security group + default: 1361f069-baf2-4b76-b321-7f68ba26c369 + Internal2_dhcp: + hidden: false + immutable: false + type: string + description: Whether DHCP/static IP addressing on internal-2 network + default: false + sctp-a-dst_subnet_prefix_v6: + hidden: false + immutable: false + type: string + description: ip_prefix for the SecurityGroup + default: '::' + pxe_image_name: + hidden: false + immutable: false + type: string + description: Name of image to use for server ncb + default: MME_PXE-Boot_1_3_GA.qcow2 + vlc_st_interface_type_gtp: + hidden: false + immutable: false + type: string + description: service_interface_type for the ServiceTemplate + default: other0 + ncb1_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to ncb1_Internal1 + default: 00:80:37:0E:09:12 + vlc_gtp_route_prefixes: + hidden: false + immutable: false + type: json + description: Route prefixes for static routing on GTP + int1_sec_group_name: + hidden: false + immutable: false + type: string + description: SecurityGroup name for internal-1 + default: int1-sec-group + vmi_oam_preference_secondary: + hidden: false + immutable: false + type: float + description: Preference for secondary interface/port + default: 100 + Internal1_dhcp: + hidden: false + immutable: false + type: string + description: Whether DHCP/static IP addressing on internal-1 network + default: false + fsb2_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to fsb2_Internal2 + default: 00:80:37:0E:0D:12 + Internal1_net_cidr_len: + hidden: false + immutable: false + type: string + description: CIDR length for internal-1 network + default: 17 + sctp-a-ingress_dst_addresses: + hidden: false + immutable: false + type: string + description: security_group for the SecurityGroup + default: local + sctp-b-ingress-src_subnet_prefix_len: + hidden: false + immutable: false + type: float + description: ip_prefix_len for the SecurityGroup + default: '0' + constraints: + - in_range: + - 0 + - 32 + fsb_oam_ip_1: + hidden: false + immutable: false + type: string + description: IP address of OAM vNIC for FSB2 + default: 107.239.72.154 + fsb_oam_ip_0: + hidden: false + immutable: false + type: string + description: IP address of OAM vNIC for FSB1 + default: 107.239.72.153 + shc_timeout: + hidden: false + immutable: false + type: string + description: health check + default: 5 + vlc_st_version: + hidden: false + immutable: false + type: string + description: Indicates service version + default: 2 + sctp-a-src_subnet_prefix_v6: + hidden: false + immutable: false + type: string + description: ip_prefix for the SecurityGroup + default: '::' + sctp-a-ingress_rule_application: + hidden: false + immutable: false + type: string + description: application for the SecurityGroup + default: any + sctp-b-egress_ethertype: + hidden: false + immutable: false + type: string + description: ethertype for the SecurityGroup + default: IPv4 + sctp-a-ipv6-egress_src_start_port: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix + default: 0 + instance_ip_family_v6: + hidden: false + immutable: false + type: string + description: Ipv6 instance type + default: v6 + sctp-b-ingress-src_subnet_prefix_v6: + hidden: false + immutable: false + type: string + description: src subnet + default: '::' + gpb8_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb8_Internal2 + default: 00:80:37:0E:10:22 + gpb4_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb4_Internal1 + default: 00:80:37:0E:0C:22 + sctp-a-ipv6-ingress-dst_end_port: + hidden: false + immutable: false + type: string + description: IPV6 end port + default: 65535 + Internal1_net_gateway: + hidden: false + immutable: false + type: string + description: gateway for internal-1 network + default: 169.253.0.3 + sctp-b-ipv6-egress-dst_start_port: + hidden: false + immutable: false + type: string + description: IPV6 start port + default: 0 + gpb_name_7: + hidden: false + immutable: false + type: string + description: Name of gpb8 + default: zrdm3mmex59gpb0016 + gpb_name_6: + hidden: false + immutable: false + type: string + description: Name of gpb7 + default: zrdm3mmex59gpb0015 + gpb_name_5: + hidden: false + immutable: false + type: string + description: Name of gpb6 + default: zrdm3mmex59gpb0014 + gpb_name_4: + hidden: false + immutable: false + type: string + description: Name of gpb5 + default: zrdm3mmex59gpb0013 + gpb_name_3: + hidden: false + immutable: false + type: string + description: Name of gpb4 + default: zrdm3mmex59gpb0012 + sctp-a-ipv6-ingress_dst_addresses: + hidden: false + immutable: false + type: string + description: IPV6 destination + default: local + gpb_name_2: + hidden: false + immutable: false + type: string + description: Name of gpb3 + default: zrdm3mmex59gpb0011 + shc_delay: + hidden: false + immutable: false + type: string + description: health check + default: 3 + gpb_name_1: + hidden: false + immutable: false + type: string + description: Name of gpb2 + default: zrdm3mmex59gpb0010 + sctp-b-ipv6-egress_action: + hidden: false + immutable: false + type: string + description: IPV6 action + default: pass + vlc3_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc3_Internal2 + default: 00:80:37:0E:03:12 + gpb_name_0: + hidden: false + immutable: false + type: string + description: Name of gpb1 + default: zrdm3mmex59gpb009 + sctp-a-ipv6-egress_action: + hidden: false + immutable: false + type: string + description: IPV6 action + default: pass + gpb5_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb5_Internal1 + default: 00:80:37:0E:0D:22 + sctp-b-ipv6-ingress_rule_protocol: + hidden: false + immutable: false + type: string + description: IPV6 Rule-protocol + default: any + shc_max_retries: + hidden: false + immutable: false + type: string + description: health check + default: 2 + fsb_volume_type: + label: volume type + hidden: false + immutable: false + type: string + description: volume type SolidFire + default: SF-Default-SSD + sctp-a-name: + hidden: false + immutable: false + type: string + description: name for the SecurityGroup + default: epc-sctp-a-ipv4v6-sec-group + vlc_sctp_b_ip_5: + hidden: false + immutable: false + type: string + description: Static IP vlc6 SCTPB + default: 107.243.47.187 + vlc_sctp_b_ip_4: + hidden: false + immutable: false + type: string + description: Static IP vlc5 SCTPB + default: 107.243.47.186 + vlc_sctp_b_ip_3: + hidden: false + immutable: false + type: string + description: Static IP vlc4 SCTPB + default: 107.243.47.185 + vlc_sctp_b_ip_2: + hidden: false + immutable: false + type: string + description: Static IP vlc3 SCTPB + default: 107.243.47.184 + sctp-b-egress_rule_protocol: + hidden: false + immutable: false + type: string + description: protocol for the SecurityGroup + default: any + vnf_id: + hidden: false + immutable: false + type: string + description: the vf_id for this instance. UUID provided by ECOMP + default: zrdm3mmex59 + vlc_sctp_b_ip_7: + hidden: false + immutable: false + type: string + description: Static IP vlc8 SCTPB + default: 107.243.47.189 + vlc_sctp_b_ip_6: + hidden: false + immutable: false + type: string + description: Static IP vlc7 SCTPB + default: 107.243.47.188 + vlc_sctp_b_ip_1: + hidden: false + immutable: false + type: string + description: Static IP vlc2 SCTPB + default: 107.243.47.177 + gpb6_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb6_Internal1 + default: 00:80:37:0E:0E:22 + sctp-b-ipv6-egress_dst_end_port: + hidden: false + immutable: false + type: string + description: IPV6 end port + default: 65535 + vlc_sctp_b_ip_0: + hidden: false + immutable: false + type: string + description: Static IP vlc1 SCTPB + default: 107.243.47.176 + vlc2_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc2_Internal2 + default: 00:80:37:0E:02:12 + sctp-b-ingress-src_subnet_prefix: + hidden: false + immutable: false + type: string + description: ip_prefix for the SecurityGroup + default: 0.0.0.0 + gpb_flavor_name: + hidden: false + immutable: false + type: string + description: Flavor to use for servers gpb + default: nv.c20r64d1 + vlc_sctp_a_route_prefixes: + hidden: false + immutable: false + type: json + description: Route prefixes for static routing on SCTPA + sctp-b-ipv6-ingress_dst_addresses: + hidden: false + immutable: false + type: string + description: IPV6 destination + default: local + sctp-b-ipv6-ingress_ethertype: + hidden: false + immutable: false + type: string + description: IPV6 ethertype + default: IPv4 + sctp-b-ipv6-egress_dst_subnet_prefix: + hidden: false + immutable: false + type: string + description: IPV6 subnet prefix + default: 0.0.0.0 + sctp-a-ingress-src_subnet_prefix: + hidden: false + immutable: false + type: string + description: ip_prefix for the SecurityGroup + default: 0.0.0.0 + vlc1_Internal2_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to vlc1_Internal2 + default: 00:80:37:0E:01:12 + Internal1_rpf: + hidden: false + immutable: false + type: string + description: Reverse Path Forwarding Enabled/Disabled internal-1 network + default: disable + sctp-b-ingress_ethertype: + hidden: false + immutable: false + type: string + description: ethertype for the SecurityGroup + default: IPv4 + sctp-b-ingress-src_end_port: + hidden: false + immutable: false + type: float + description: end_port for the SecurityGroup + default: 65535 + constraints: + - in_range: + - 0 + - 65535 + sctp-a-ipv6-ingress_rule_protocol: + hidden: false + immutable: false + type: string + description: IPV6 Rule-protocol + default: any + vlc_sctp_a_v6_ip_7: + hidden: false + immutable: false + type: string + description: Static IP vlc8 SCTPA + default: fd00:200:200:4:0:0:0:29 + vlc_sctp_a_v6_ip_6: + hidden: false + immutable: false + type: string + description: Static IP vlc7 SCTPA + default: fd00:200:200:4:0:0:0:28 + gpb7_Internal1_mac: + hidden: false + immutable: false + type: string + description: static mac address assigned to gpb7_Internal1 + default: 00:80:37:0E:0F:22 + vlc_sctp_a_v6_ip_5: + hidden: false + immutable: false + type: string + description: Static IP vlc6 SCTPA + default: fd00:200:200:4:0:0:0:27 + vlc_sctp_a_v6_ip_4: + hidden: false + immutable: false + type: string + description: Static IP vlc5 SCTPA + default: fd00:200:200:4:0:0:0:26 + vlc_sctp_a_v6_ip_3: + hidden: false + immutable: false + type: string + description: Static IP vlc4 SCTPA + default: fd00:200:200:4:0:0:0:25 + vlc_sctp_a_v6_ip_2: + hidden: false + immutable: false + type: string + description: Static IP vlc3 SCTPA + default: fd00:200:200:4:0:0:0:24 + sctp-a-ingress-src_start_port: + hidden: false + immutable: false + type: float + description: start_port for the SecurityGroup + default: 0 + constraints: + - in_range: + - 0 + - 65535 + vlc_sctp_a_v6_ip_1: + hidden: false + immutable: false + type: string + description: Static IP vlc2 SCTPA + default: fd00:200:200:4:0:0:0:17 + vlc_sctp_a_v6_ip_0: + hidden: false + immutable: false + type: string + description: Static IP vlc1 SCTPA + default: fd00:200:200:4:0:0:0:16 + node_templates: + abstract_gpb_1: + type: org.openecomp.resource.abstract.nodes.gpb_1 + directives: + - substitutable + properties: + compute_gpb_name: + - get_input: gpb_name_1 + vm_flavor_name: + get_input: gpb_flavor_name + compute_gpb_scheduler_hints: + - group: + get_input: server_group_id_0 + port_gpb2_Internal1_security_groups: + - - get_input: security_group_int1_id + compute_gpb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + port_gpb2_Internal2_network: + - get_input: internal_net_id_1 + port_gpb2_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + vm_image_name: + get_input: pxe_image_name + port_gpb2_Internal1_replacement_policy: + - AUTO + port_gpb2_Internal1_network: + - get_input: internal_net_id_0 + port_gpb2_Internal2_replacement_policy: + - AUTO + port_gpb2_Internal1_mac_requirements: + mac_count_required: + is_required: true + compute_gpb_availability_zone: + - get_input: availability_zone_1 + port_gpb2_Internal1_mac_address: + get_input: gpb2_Internal1_mac + port_gpb2_Internal2_mac_requirements: + mac_count_required: + is_required: true + port_gpb2_Internal2_mac_address: + get_input: gpb2_Internal1_mac + port_gpb2_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb2_Internal2_security_groups: + - - get_input: security_group_int2_id + service_template_filter: + substitute_service_template: Nested_gpb_1ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: gpb + nfc_naming_code: gpb + requirements: + - link_gpb_gpb2_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_gpb_gpb2_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + abstract_gpb_2: + type: org.openecomp.resource.abstract.nodes.gpb_2 + directives: + - substitutable + properties: + port_gpb3_Internal1_replacement_policy: + - AUTO + compute_gpb_name: + - get_input: gpb_name_2 + port_gpb3_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb3_Internal2_replacement_policy: + - AUTO + vm_flavor_name: + get_input: gpb_flavor_name + port_gpb3_Internal2_security_groups: + - - get_input: security_group_int2_id + compute_gpb_scheduler_hints: + - group: + get_input: server_group_id_0 + compute_gpb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + vm_image_name: + get_input: pxe_image_name + port_gpb3_Internal1_security_groups: + - - get_input: security_group_int1_id + port_gpb3_Internal2_network: + - get_input: internal_net_id_1 + compute_gpb_availability_zone: + - get_input: availability_zone_0 + port_gpb3_Internal1_network: + - get_input: internal_net_id_0 + port_gpb3_Internal1_mac_requirements: + mac_count_required: + is_required: true + port_gpb3_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb3_Internal1_mac_address: + get_input: gpb3_Internal1_mac + port_gpb3_Internal2_mac_address: + get_input: gpb3_Internal1_mac + port_gpb3_Internal2_mac_requirements: + mac_count_required: + is_required: true + service_template_filter: + substitute_service_template: Nested_gpb_2ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: gpb + nfc_naming_code: gpb + requirements: + - link_gpb_gpb3_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_gpb_gpb3_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + abstract_vlc: + type: org.openecomp.resource.abstract.nodes.vlc + directives: + - substitutable + properties: + port_template_VMInt_SCTP_A_vlc_virtual_network_refs: + - - get_input: sctp_a_net_fqdn + port_template_VMInt_INT1_vlc_security_group_refs: + - - get_input: security_group_int1_id + vm_flavor_name: + get_input: vlc_flavor_name + port_template_VMInt_INT2_vlc_port_tuple_refs: + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc4 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc3 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc2 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc1 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc8 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc7 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc6 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc5 + vm_image_name: + get_input: pxe_image_name + port_template_VMInt_INT1_vlc_port_tuple_refs: + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc4 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc3 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc2 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc1 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc8 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc7 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc6 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc5 + port_template_VMInt_INT2_vlc_virtual_network_refs: + - - get_input: internal_net_id_1 + port_template_VMInt_OAM_vlc_virtual_network_refs: + - - get_input: oam_net_fqdn + port_template_VMInt_OAM_vlc_port_tuple_refs: + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc4 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc3 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc2 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc1 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc8 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc7 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc6 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc5 + port_template_VMInt_INT2_vlc_virtual_machine_interface_mac_addresses: + - - get_input: vlc4_Internal2_mac + - - get_input: vlc3_Internal2_mac + - - get_input: vlc2_Internal2_mac + - - get_input: vlc1_Internal2_mac + - - get_input: vlc8_Internal2_mac + - - get_input: vlc7_Internal2_mac + - - get_input: vlc6_Internal2_mac + - - get_input: vlc5_Internal2_mac + port_template_VMInt_SCTP_B_vlc_port_tuple_refs: + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc4 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc3 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc2 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc1 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc8 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc7 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc6 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc5 + port_template_VMInt_GTP_vlc_security_group_refs: + - - get_input: security_group_gtp_id + compute_vlc_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + port_template_VMInt_OAM_vlc_security_group_refs: + - - get_input: security_group_oam_id + compute_vlc_contrail_service_instance_ind: + - true + - true + - true + - true + - true + - true + - true + - true + port_template_VMInt_GTP_vlc_port_tuple_refs: + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc4 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc3 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc2 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc1 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc8 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc7 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc6 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc5 + port_template_VMInt_SCTP_B_vlc_virtual_network_refs: + - - get_input: sctp_b_net_fqdn + port_template_VMInt_INT2_vlc_security_group_refs: + - - get_input: security_group_int2_id + port_template_VMInt_SCTP_B_vlc_security_group_refs: + - - get_input: security_group_sctp_b_id + port_template_VMInt_INT1_vlc_virtual_network_refs: + - - get_input: internal_net_id_0 + port_template_VMInt_SCTP_A_vlc_port_tuple_refs: + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc4 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc3 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc2 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc1 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc8 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc7 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc6 + - - UNSUPPORTED_RESOURCE_template_PortTuple_vlc5 + compute_vlc_scheduler_hints: + - group: + get_input: server_group_id_0 + - group: + get_input: server_group_id_0 + - group: + get_input: server_group_id_0 + - group: + get_input: server_group_id_0 + - group: + get_input: server_group_id_0 + - group: + get_input: server_group_id_0 + - group: + get_input: server_group_id_0 + - group: + get_input: server_group_id_0 + compute_vlc_name: + - get_input: vlc_name_3 + - get_input: vlc_name_2 + - get_input: vlc_name_1 + - get_input: vlc_name_0 + - get_input: vlc_name_7 + - get_input: vlc_name_6 + - get_input: vlc_name_5 + - get_input: vlc_name_4 + port_template_VMInt_SCTP_A_vlc_security_group_refs: + - - get_input: security_group_sctp_a_id + compute_vlc_availability_zone: + - get_input: availability_zone_1 + - get_input: availability_zone_0 + - get_input: availability_zone_1 + - get_input: availability_zone_0 + - get_input: availability_zone_1 + - get_input: availability_zone_0 + - get_input: availability_zone_1 + - get_input: availability_zone_0 + port_template_VMInt_INT1_vlc_virtual_machine_interface_mac_addresses: + - - get_input: vlc4_Internal1_mac + - - get_input: vlc3_Internal1_mac + - - get_input: vlc2_Internal1_mac + - - get_input: vlc1_Internal1_mac + - - get_input: vlc8_Internal1_mac + - - get_input: vlc7_Internal1_mac + - - get_input: vlc6_Internal1_mac + - - get_input: vlc5_Internal1_mac + port_template_VMInt_GTP_vlc_virtual_network_refs: + - - get_input: gtp_net_fqdn + service_template_filter: + substitute_service_template: Nested_vlcServiceTemplate.yaml + count: 8 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: vlc + nfc_naming_code: vlc + requirements: + - link_vlc_template_VMInt_INT2_vlc: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + - link_vlc_template_VMInt_INT1_vlc: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + abstract_gpb_7: + type: org.openecomp.resource.abstract.nodes.gpb_7 + directives: + - substitutable + properties: + compute_gpb_name: + - get_input: gpb_name_7 + port_gpb8_Internal1_mac_address: + get_input: gpb8_Internal1_mac + port_gpb8_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + vm_flavor_name: + get_input: gpb_flavor_name + compute_gpb_scheduler_hints: + - group: + get_input: server_group_id_0 + compute_gpb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + vm_image_name: + get_input: pxe_image_name + port_gpb8_Internal2_security_groups: + - - get_input: security_group_int2_id + port_gpb8_Internal1_replacement_policy: + - AUTO + port_gpb8_Internal2_replacement_policy: + - AUTO + compute_gpb_availability_zone: + - get_input: availability_zone_1 + port_gpb8_Internal1_mac_requirements: + mac_count_required: + is_required: true + port_gpb8_Internal1_network: + - get_input: internal_net_id_0 + port_gpb8_Internal2_mac_requirements: + mac_count_required: + is_required: true + port_gpb8_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb8_Internal1_security_groups: + - - get_input: security_group_int1_id + port_gpb8_Internal2_network: + - get_input: internal_net_id_1 + port_gpb8_Internal2_mac_address: + get_input: gpb8_Internal1_mac + service_template_filter: + substitute_service_template: Nested_gpb_7ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: gpb + nfc_naming_code: gpb + requirements: + - link_gpb_gpb8_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_gpb_gpb8_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + abstract_gpb_5: + type: org.openecomp.resource.abstract.nodes.gpb_5 + directives: + - substitutable + properties: + port_gpb6_Internal1_mac_requirements: + mac_count_required: + is_required: true + compute_gpb_name: + - get_input: gpb_name_5 + vm_flavor_name: + get_input: gpb_flavor_name + compute_gpb_scheduler_hints: + - group: + get_input: server_group_id_0 + compute_gpb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + port_gpb6_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + vm_image_name: + get_input: pxe_image_name + port_gpb6_Internal1_security_groups: + - - get_input: security_group_int1_id + port_gpb6_Internal2_network: + - get_input: internal_net_id_1 + compute_gpb_availability_zone: + - get_input: availability_zone_1 + port_gpb6_Internal1_network: + - get_input: internal_net_id_0 + port_gpb6_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb6_Internal2_mac_address: + get_input: gpb6_Internal1_mac + port_gpb6_Internal1_mac_address: + get_input: gpb6_Internal1_mac + port_gpb6_Internal2_mac_requirements: + mac_count_required: + is_required: true + port_gpb6_Internal2_replacement_policy: + - AUTO + port_gpb6_Internal1_replacement_policy: + - AUTO + port_gpb6_Internal2_security_groups: + - - get_input: security_group_int2_id + service_template_filter: + substitute_service_template: Nested_gpb_5ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: gpb + nfc_naming_code: gpb + requirements: + - link_gpb_gpb6_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_gpb_gpb6_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + abstract_gpb_6: + type: org.openecomp.resource.abstract.nodes.gpb_6 + directives: + - substitutable + properties: + port_gpb7_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb7_Internal1_network: + - get_input: internal_net_id_0 + compute_gpb_name: + - get_input: gpb_name_6 + port_gpb7_Internal2_network: + - get_input: internal_net_id_1 + vm_flavor_name: + get_input: gpb_flavor_name + port_gpb7_Internal1_replacement_policy: + - AUTO + port_gpb7_Internal2_replacement_policy: + - AUTO + port_gpb7_Internal2_security_groups: + - - get_input: security_group_int2_id + compute_gpb_scheduler_hints: + - group: + get_input: server_group_id_0 + compute_gpb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + vm_image_name: + get_input: pxe_image_name + port_gpb7_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb7_Internal1_security_groups: + - - get_input: security_group_int1_id + compute_gpb_availability_zone: + - get_input: availability_zone_0 + port_gpb7_Internal2_mac_address: + get_input: gpb7_Internal1_mac + port_gpb7_Internal1_mac_requirements: + mac_count_required: + is_required: true + port_gpb7_Internal1_mac_address: + get_input: gpb7_Internal1_mac + port_gpb7_Internal2_mac_requirements: + mac_count_required: + is_required: true + service_template_filter: + substitute_service_template: Nested_gpb_6ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: gpb + nfc_naming_code: gpb + requirements: + - link_gpb_gpb7_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_gpb_gpb7_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + abstract_gpb_3: + type: org.openecomp.resource.abstract.nodes.gpb_3 + directives: + - substitutable + properties: + compute_gpb_name: + - get_input: gpb_name_3 + port_gpb4_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + vm_flavor_name: + get_input: gpb_flavor_name + port_gpb4_Internal1_mac_address: + get_input: gpb4_Internal1_mac + compute_gpb_scheduler_hints: + - group: + get_input: server_group_id_0 + port_gpb4_Internal2_mac_requirements: + mac_count_required: + is_required: true + compute_gpb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + port_gpb4_Internal2_mac_address: + get_input: gpb4_Internal1_mac + vm_image_name: + get_input: pxe_image_name + port_gpb4_Internal2_security_groups: + - - get_input: security_group_int2_id + compute_gpb_availability_zone: + - get_input: availability_zone_1 + port_gpb4_Internal2_replacement_policy: + - AUTO + port_gpb4_Internal1_replacement_policy: + - AUTO + port_gpb4_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb4_Internal1_security_groups: + - - get_input: security_group_int1_id + port_gpb4_Internal2_network: + - get_input: internal_net_id_1 + port_gpb4_Internal1_mac_requirements: + mac_count_required: + is_required: true + port_gpb4_Internal1_network: + - get_input: internal_net_id_0 + service_template_filter: + substitute_service_template: Nested_gpb_3ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: gpb + nfc_naming_code: gpb + requirements: + - link_gpb_gpb4_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_gpb_gpb4_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + abstract_gpb_4: + type: org.openecomp.resource.abstract.nodes.gpb_4 + directives: + - substitutable + properties: + port_gpb5_Internal2_mac_requirements: + mac_count_required: + is_required: true + port_gpb5_Internal1_security_groups: + - - get_input: security_group_int1_id + compute_gpb_name: + - get_input: gpb_name_4 + vm_flavor_name: + get_input: gpb_flavor_name + port_gpb5_Internal1_mac_requirements: + mac_count_required: + is_required: true + compute_gpb_scheduler_hints: + - group: + get_input: server_group_id_0 + port_gpb5_Internal2_network: + - get_input: internal_net_id_1 + compute_gpb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + vm_image_name: + get_input: pxe_image_name + port_gpb5_Internal1_network: + - get_input: internal_net_id_0 + port_gpb5_Internal2_mac_address: + get_input: gpb5_Internal1_mac + port_gpb5_Internal1_mac_address: + get_input: gpb5_Internal1_mac + port_gpb5_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb5_Internal2_replacement_policy: + - AUTO + compute_gpb_availability_zone: + - get_input: availability_zone_0 + port_gpb5_Internal1_replacement_policy: + - AUTO + port_gpb5_Internal2_security_groups: + - - get_input: security_group_int2_id + port_gpb5_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + service_template_filter: + substitute_service_template: Nested_gpb_4ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: gpb + nfc_naming_code: gpb + requirements: + - link_gpb_gpb5_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_gpb_gpb5_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + abstract_gpb: + type: org.openecomp.resource.abstract.nodes.gpb + directives: + - substitutable + properties: + port_gpb1_Internal1_security_groups: + - - get_input: security_group_int1_id + compute_gpb_name: + - get_input: gpb_name_0 + port_gpb1_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + vm_flavor_name: + get_input: gpb_flavor_name + port_gpb1_Internal1_mac_requirements: + mac_count_required: + is_required: true + compute_gpb_scheduler_hints: + - group: + get_input: server_group_id_0 + compute_gpb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + vm_image_name: + get_input: pxe_image_name + port_gpb1_Internal1_mac_address: + get_input: gpb1_Internal1_mac + port_gpb1_Internal2_mac_address: + get_input: gpb1_Internal1_mac + port_gpb1_Internal2_mac_requirements: + mac_count_required: + is_required: true + compute_gpb_availability_zone: + - get_input: availability_zone_0 + port_gpb1_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_gpb1_Internal2_security_groups: + - - get_input: security_group_int2_id + port_gpb1_Internal1_replacement_policy: + - AUTO + port_gpb1_Internal2_replacement_policy: + - AUTO + port_gpb1_Internal2_network: + - get_input: internal_net_id_1 + port_gpb1_Internal1_network: + - get_input: internal_net_id_0 + service_template_filter: + substitute_service_template: Nested_gpbServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: gpb + nfc_naming_code: gpb + requirements: + - link_gpb_gpb1_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_gpb_gpb1_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + Internal1_net: + type: org.openecomp.resource.vl.nodes.heat.network.contrailV2.VirtualNetwork + properties: + network_ipam_refs_data: + - network_ipam_refs_data_ipam_subnets: + - network_ipam_refs_data_ipam_subnets_enable_dhcp: + get_input: Internal1_dhcp + network_ipam_refs_data_ipam_subnets_default_gateway: + get_input: Internal1_net_gateway + network_ipam_refs_data_ipam_subnets_subnet: + network_ipam_refs_data_ipam_subnets_subnet_ip_prefix_len: + get_input: Internal1_net_cidr_len + network_ipam_refs_data_ipam_subnets_subnet_ip_prefix: + get_input: Internal1_net_cidr + network_name: + str_replace: + template: $VNF_NAME_int_net_1 + params: + $VNF_NAME: + get_input: vnf_name + network_ipam_refs: + - UNSUPPORTED_RESOURCE_template_NetworkIpam_Internal1 + abstract_fsb: + type: org.openecomp.resource.abstract.nodes.fsb + directives: + - substitutable + properties: + port_FSB1_Internal1_mac_address: + get_input: fsb1_Internal1_mac + port_FSB_OAM_network_role_tag: + - oam + port_FSB1_Internal2_network: + - Internal2_net + port_FSB1_Internal1_network: + - Internal1_net + vm_flavor_name: + get_input: fsb_flavor_name + port_FSB1_Internal2_mac_address: + get_input: fsb1_Internal1_mac + port_FSB_OAM_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: true + floating_ip_count_required: + is_required: false + compute_fsb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + port_FSB1_Internal1_security_groups: + - - int1_security_group + port_FSB1_Internal2_replacement_policy: + - AUTO + compute_fsb_scheduler_hints: + - group: VM_Affinity_group + port_FSB1_Internal1_replacement_policy: + - AUTO + compute_fsb_name: + - get_input: fsb_name_0 + port_FSB1_Internal1_mac_requirements: + mac_count_required: + is_required: true + port_FSB1_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_FSB_OAM_network: + - get_input: oam_net_name + port_FSB_OAM_security_groups: + - - oam_security_group + port_FSB_OAM_mac_requirements: + mac_count_required: + is_required: false + port_FSB_OAM_replacement_policy: + - AUTO + compute_fsb_availability_zone: + - get_input: availability_zone_0 + port_FSB1_Internal2_security_groups: + - - int2_security_group + port_FSB1_Internal2_mac_requirements: + mac_count_required: + is_required: true + port_FSB1_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_FSB_OAM_fixed_ips: + - ip_address: + get_input: fsb_oam_ip_0 + service_template_filter: + substitute_service_template: Nested_fsbServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: fsb + nfc_naming_code: fsb + requirements: + - link_fsb_FSB1_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_fsb_FSB1_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + gtp_security_group: + type: org.openecomp.resource.vfc.rules.nodes.heat.network.neutron.SecurityRules + properties: + name: + str_replace: + template: $VNF_NAME_$SECGROUPNAME + params: + $SECGROUPNAME: + get_input: gtp_sec_group_name + $VNF_NAME: + get_input: vnf_name + rules: + - protocol: tcp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: udp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: icmp + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + - protocol: tcp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: udp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: icmp + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + abstract_ncb_1: + type: org.openecomp.resource.abstract.nodes.ncb_1 + directives: + - substitutable + properties: + port_NCB2_Internal2_security_groups: + - - int2_security_group + port_NCB2_Internal1_replacement_policy: + - AUTO + port_NCB2_Internal2_replacement_policy: + - AUTO + vm_flavor_name: + get_input: ncb_flavor_name + port_NCB2_Internal2_mac_requirements: + mac_count_required: + is_required: true + port_NCB2_Internal1_mac_requirements: + mac_count_required: + is_required: true + vm_image_name: + get_input: pxe_image_name + compute_ncb_scheduler_hints: + - group: VM_Affinity_group + compute_ncb_availability_zone: + - get_input: availability_zone_1 + port_NCB2_Internal1_network: + - Internal1_net + port_NCB2_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_NCB2_Internal1_security_groups: + - - int1_security_group + port_NCB2_Internal2_network: + - Internal2_net + port_NCB2_Internal1_mac_address: + get_input: ncb2_Internal1_mac + port_NCB2_Internal2_mac_address: + get_input: ncb2_Internal1_mac + compute_ncb_name: + - get_input: ncb_name_1 + compute_ncb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + port_NCB2_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + service_template_filter: + substitute_service_template: Nested_ncb_1ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: ncb + nfc_naming_code: ncb + requirements: + - link_ncb_NCB2_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_ncb_NCB2_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + abstract_ncb: + type: org.openecomp.resource.abstract.nodes.ncb + directives: + - substitutable + properties: + vm_flavor_name: + get_input: ncb_flavor_name + port_NCB1_Internal2_mac_requirements: + mac_count_required: + is_required: true + vm_image_name: + get_input: pxe_image_name + port_NCB1_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + compute_ncb_scheduler_hints: + - group: VM_Affinity_group + port_NCB1_Internal1_security_groups: + - - int1_security_group + compute_ncb_availability_zone: + - get_input: availability_zone_0 + port_NCB1_Internal2_mac_address: + get_input: ncb1_Internal1_mac + port_NCB1_Internal1_mac_address: + get_input: ncb1_Internal1_mac + port_NCB1_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_NCB1_Internal1_mac_requirements: + mac_count_required: + is_required: true + port_NCB1_Internal2_replacement_policy: + - AUTO + port_NCB1_Internal1_network: + - Internal1_net + port_NCB1_Internal2_security_groups: + - - int2_security_group + port_NCB1_Internal1_replacement_policy: + - AUTO + compute_ncb_name: + - get_input: ncb_name_0 + compute_ncb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + port_NCB1_Internal2_network: + - Internal2_net + service_template_filter: + substitute_service_template: Nested_ncbServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: ncb + nfc_naming_code: ncb + requirements: + - link_ncb_NCB1_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_ncb_NCB1_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + int1_security_group: + type: org.openecomp.resource.vfc.rules.nodes.heat.network.neutron.SecurityRules + properties: + name: + str_replace: + template: $VNF_NAME_$SECGROUPNAME + params: + $SECGROUPNAME: + get_input: int1_sec_group_name + $VNF_NAME: + get_input: vnf_name + rules: + - protocol: tcp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: udp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: icmp + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + - protocol: tcp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: udp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: icmp + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + requirements: + - port: + capability: attachment_fsb_FSB1_Internal1 + node: abstract_fsb + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_fsb_FSB2_Internal1 + node: abstract_fsb_1 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_ncb_NCB1_Internal1 + node: abstract_ncb + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_ncb_NCB2_Internal1 + node: abstract_ncb_1 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb1_Internal1 + node: abstract_gpb + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb2_Internal1 + node: abstract_gpb_1 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb3_Internal1 + node: abstract_gpb_2 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb4_Internal1 + node: abstract_gpb_3 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb5_Internal1 + node: abstract_gpb_4 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb6_Internal1 + node: abstract_gpb_5 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb7_Internal1 + node: abstract_gpb_6 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb8_Internal1 + node: abstract_gpb_7 + relationship: org.openecomp.relationships.AttachesTo + fsb_volume_0: + type: org.openecomp.resource.vfc.nodes.heat.cinder.Volume + properties: + image: + get_input: fsb_volume_image_name_0 + volume_type: + get_input: fsb_volume_type + size: '(get_input : fsb_volume_size) * 1024' + name: + list_join: + - _ + - - get_input: OS::stack_name + - FSB1_Vol_1 + fsb_volume_1: + type: org.openecomp.resource.vfc.nodes.heat.cinder.Volume + properties: + image: + get_input: fsb_volume_image_name_1 + volume_type: + get_input: fsb_volume_type + size: '(get_input : fsb_volume_size) * 1024' + name: + list_join: + - _ + - - get_input: OS::stack_name + - FSB2_Vol_1 + Internal2_net: + type: org.openecomp.resource.vl.nodes.heat.network.contrailV2.VirtualNetwork + properties: + network_ipam_refs_data: + - network_ipam_refs_data_ipam_subnets: + - network_ipam_refs_data_ipam_subnets_enable_dhcp: + get_input: Internal2_dhcp + network_ipam_refs_data_ipam_subnets_default_gateway: + get_input: Internal2_net_gateway + network_ipam_refs_data_ipam_subnets_subnet: + network_ipam_refs_data_ipam_subnets_subnet_ip_prefix_len: + get_input: Internal2_net_cidr_len + network_ipam_refs_data_ipam_subnets_subnet_ip_prefix: + get_input: Internal2_net_cidr + network_name: + str_replace: + template: $VNF_NAME_int_net_2 + params: + $VNF_NAME: + get_input: vnf_name + network_ipam_refs: + - UNSUPPORTED_RESOURCE_template_NetworkIpam_Internal2 + int2_security_group: + type: org.openecomp.resource.vfc.rules.nodes.heat.network.neutron.SecurityRules + properties: + name: + str_replace: + template: $VNF_NAME_$SECGROUPNAME + params: + $SECGROUPNAME: + get_input: int2_sec_group_name + $VNF_NAME: + get_input: vnf_name + rules: + - protocol: tcp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: udp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: 132 + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: icmp + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + - protocol: tcp + ethertype: IPv6 + port_range_max: 65535 + remote_ip_prefix: ::/0 + direction: egress + port_range_min: 1 + - protocol: udp + ethertype: IPv6 + port_range_max: 65535 + remote_ip_prefix: ::/0 + direction: egress + port_range_min: 1 + - protocol: 132 + ethertype: IPv6 + port_range_max: 65535 + remote_ip_prefix: ::/0 + direction: egress + port_range_min: 1 + - protocol: icmp + ethertype: IPv6 + remote_ip_prefix: ::/0 + direction: egress + - protocol: tcp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: udp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: 132 + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: icmp + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + - protocol: tcp + ethertype: IPv6 + port_range_max: 65535 + remote_ip_prefix: ::/0 + direction: ingress + port_range_min: 1 + - protocol: udp + ethertype: IPv6 + port_range_max: 65535 + remote_ip_prefix: ::/0 + direction: ingress + port_range_min: 1 + - protocol: 132 + ethertype: IPv6 + port_range_max: 65535 + remote_ip_prefix: ::/0 + direction: ingress + port_range_min: 1 + - protocol: icmp + ethertype: IPv6 + remote_ip_prefix: ::/0 + direction: ingress + requirements: + - port: + capability: attachment_fsb_FSB1_Internal2 + node: abstract_fsb + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_fsb_FSB2_Internal2 + node: abstract_fsb_1 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_ncb_NCB1_Internal2 + node: abstract_ncb + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_ncb_NCB2_Internal2 + node: abstract_ncb_1 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb1_Internal2 + node: abstract_gpb + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb2_Internal2 + node: abstract_gpb_1 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb3_Internal2 + node: abstract_gpb_2 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb4_Internal2 + node: abstract_gpb_3 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb5_Internal2 + node: abstract_gpb_4 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb6_Internal2 + node: abstract_gpb_5 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb7_Internal2 + node: abstract_gpb_6 + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_gpb_gpb8_Internal2 + node: abstract_gpb_7 + relationship: org.openecomp.relationships.AttachesTo + abstract_fsb_1: + type: org.openecomp.resource.abstract.nodes.fsb_1 + directives: + - substitutable + properties: + port_FSB_OAM_network_role_tag: + - oam + vm_flavor_name: + get_input: fsb_flavor_name + port_FSB_OAM_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: true + floating_ip_count_required: + is_required: false + port_FSB2_Internal1_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_FSB2_Internal2_security_groups: + - - int2_security_group + compute_fsb_metadata: + - vf_module_id: + get_input: vf_module_id + vnf_id: + get_input: vnf_id + vnf_name: + get_input: vnf_name + port_FSB2_Internal1_mac_address: + get_input: fsb2_Internal1_mac + compute_fsb_scheduler_hints: + - group: VM_Affinity_group + compute_fsb_name: + - get_input: fsb_name_1 + port_FSB2_Internal1_security_groups: + - - int1_security_group + port_FSB_OAM_network: + - get_input: oam_net_name + port_FSB_OAM_security_groups: + - - oam_security_group + port_FSB2_Internal1_network: + - Internal1_net + port_FSB2_Internal2_mac_address: + get_input: fsb2_Internal1_mac + port_FSB2_Internal2_mac_requirements: + mac_count_required: + is_required: true + port_FSB_OAM_mac_requirements: + mac_count_required: + is_required: false + port_FSB2_Internal2_replacement_policy: + - AUTO + port_FSB2_Internal2_ip_requirements: + - ip_version: 4 + ip_count_required: + is_required: false + floating_ip_count_required: + is_required: false + port_FSB_OAM_replacement_policy: + - AUTO + port_FSB2_Internal2_network: + - Internal2_net + port_FSB2_Internal1_replacement_policy: + - AUTO + compute_fsb_availability_zone: + - get_input: availability_zone_1 + port_FSB_OAM_fixed_ips: + - ip_address: + get_input: fsb_oam_ip_1 + port_FSB2_Internal1_mac_requirements: + mac_count_required: + is_required: true + service_template_filter: + substitute_service_template: Nested_fsb_1ServiceTemplate.yaml + count: 1 + index_value: + get_property: + - SELF + - service_template_filter + - index_value + vm_type_tag: fsb + nfc_naming_code: fsb + requirements: + - link_fsb_FSB2_Internal1: + capability: tosca.capabilities.network.Linkable + node: Internal1_net + relationship: tosca.relationships.network.LinksTo + - link_fsb_FSB2_Internal2: + capability: tosca.capabilities.network.Linkable + node: Internal2_net + relationship: tosca.relationships.network.LinksTo + oam_security_group: + type: org.openecomp.resource.vfc.rules.nodes.heat.network.neutron.SecurityRules + properties: + name: + str_replace: + template: $VNF_NAME_$SECGROUPNAME + params: + $SECGROUPNAME: + get_input: oam_sec_group_name + $VNF_NAME: + get_input: vnf_name + rules: + - protocol: tcp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: udp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + port_range_min: 1 + - protocol: icmp + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + direction: egress + - protocol: tcp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: udp + ethertype: IPv4 + port_range_max: 65535 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + port_range_min: 1 + - protocol: icmp + ethertype: IPv4 + remote_ip_prefix: 0.0.0.0/0 + direction: ingress + requirements: + - port: + capability: attachment_fsb_FSB_OAM + node: abstract_fsb + relationship: org.openecomp.relationships.AttachesTo + - port: + capability: attachment_fsb_FSB_OAM + node: abstract_fsb_1 + relationship: org.openecomp.relationships.AttachesTo + groups: + vmme_gpb3_group: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/vmme_gpb3.yml + description: | + Module HOT template to create vmme 1-8 gpb + members: + - abstract_gpb + - abstract_gpb_1 + - abstract_gpb_2 + - abstract_gpb_3 + - abstract_gpb_4 + - abstract_gpb_5 + - abstract_gpb_6 + - abstract_gpb_7 + base_vmme_group: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/base_vmme.yml + description: | + Base HOT template to create vmme 2 fsb 2 ncb + members: + - int2_security_group + - oam_security_group + - gtp_security_group + - Internal2_net + - int1_security_group + - Internal1_net + - abstract_ncb + - abstract_ncb_1 + - abstract_fsb + - abstract_fsb_1 + base_vmme_volume_group: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/base_vmme_volume.yml + description: HOT template for vMME Cinder Volumes + members: + - fsb_volume_0 + - fsb_volume_1 + vmme_gpb1_group: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/vmme_gpb1.yml + description: | + Module HOT template to create vmme 1-8 gpb + members: + - abstract_gpb + - abstract_gpb_1 + - abstract_gpb_2 + - abstract_gpb_3 + - abstract_gpb_4 + - abstract_gpb_5 + - abstract_gpb_6 + - abstract_gpb_7 + vmme_gpb4_group: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/vmme_gpb4.yml + description: | + Module HOT template to create vmme 1-8 gpb + members: + - abstract_gpb + - abstract_gpb_1 + - abstract_gpb_2 + - abstract_gpb_3 + - abstract_gpb_4 + - abstract_gpb_5 + - abstract_gpb_6 + - abstract_gpb_7 + vmme_gpb2_group: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/vmme_gpb2.yml + description: | + Module HOT template to create vmme 1-8 gpb + members: + - abstract_gpb + - abstract_gpb_1 + - abstract_gpb_2 + - abstract_gpb_3 + - abstract_gpb_4 + - abstract_gpb_5 + - abstract_gpb_6 + - abstract_gpb_7 + VM_Affinity_group: + type: tosca.groups.Root + members: + - abstract_ncb + - abstract_ncb_1 + - abstract_vlc + - abstract_fsb + - abstract_fsb_1 + - abstract_gpb + - abstract_gpb_1 + - abstract_gpb_2 + - abstract_gpb_3 + - abstract_gpb_4 + - abstract_gpb_5 + - abstract_gpb_6 + - abstract_gpb_7 + vmme_vlc_group: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/vmme_vlc.yml + description: | + Module HOT template to create vmme 8 vlcs + members: + - abstract_vlc + outputs: + oam_management_v4_address: + description: ID of OAM VIP to be provisioned in A&AI + value: + get_input: vip_oam_management_v4_ip + fsb_volume_id_1: + description: ID of Cinder Volume for FSB2 + value: fsb_volume_1 + security_group_sctp_b_id: + description: ID of sctpb_security_group + value: UNSUPPORTED_RESOURCE_sctpb_security_group + service_instance_id_0: + description: ID of Service Instance used for vLCs + value: UNSUPPORTED_RESOURCE_template_ServiceInstance_VLC + security_group_sctp_a_id: + description: ID of sctpa_security_group + value: UNSUPPORTED_RESOURCE_sctpa_security_group + fsb_volume_id_0: + description: ID of Cinder Volume for FSB1 + value: fsb_volume_0 + policies: + VM_Affinity_policy: + type: org.openecomp.policies.placement.Antilocate + properties: + container_type: host + targets: + - VM_Affinity_group diff --git a/catalog-dao/.gitignore b/catalog-dao/.gitignore deleted file mode 100644 index ea8c4bf7f3..0000000000 --- a/ catalog-dao/.gitignore+++ /dev/null @@ -1 +0,0 @@ -/target @@ -11,8 +11,11 @@ <version>1.2.0-SNAPSHOT</version> </parent> + <properties> + <sonar.skip>true</sonar.skip> + </properties> + <dependencies> - <!-- Common of SDC --> <dependency> <groupId>org.openecomp.sdc</groupId> @@ -118,8 +121,7 @@ <dependency> <groupId>org.mockito</groupId> - <artifactId>mockito-all</artifactId> - <version>${mockito.version}</version> + <artifactId>mockito-core</artifactId> <scope>test</scope> </dependency> @@ -26,6 +26,7 @@ public enum ActionStatus { USER_ALREADY_EXIST, USER_INACTIVE, USER_NOT_FOUND, USER_HAS_ACTIVE_ELEMENTS, INVALID_EMAIL_ADDRESS, INVALID_ROLE, DELETE_USER_ADMIN_CONFLICT, UPDATE_USER_ADMIN_CONFLICT, CANNOT_DELETE_USER_WITH_ACTIVE_ELEMENTS, CANNOT_UPDATE_USER_WITH_ACTIVE_ELEMENTS, INVALID_USER_ID, // CapabilityType related CAPABILITY_TYPE_ALREADY_EXIST, MISSING_CAPABILITY_TYPE, REQ_CAP_NOT_SATISFIED_BEFORE_CERTIFICATION, IMPORT_DUPLICATE_REQ_CAP_NAME, IMPORT_REQ_CAP_NAME_EXISTS_IN_DERIVED, + CAPABILITY_OF_INSTANCE_NOT_FOUND_ON_CONTAINER, REQUIREMENT_OF_INSTANCE_NOT_FOUND_ON_CONTAINER, RELATION_NOT_FOUND, // Resource related RESOURCE_NOT_FOUND, MISSING_DERIVED_FROM_TEMPLATE, PARENT_RESOURCE_NOT_FOUND, PARENT_RESOURCE_DOES_NOT_EXTEND, INVALID_DEFAULT_VALUE, INVALID_COMPLEX_DEFAULT_VALUE, MULTIPLE_PARENT_RESOURCE_FOUND, INVALID_RESOURCE_PAYLOAD, INVALID_TOSCA_FILE_EXTENSION, INVALID_YAML_FILE, INVALID_TOSCA_TEMPLATE, NOT_RESOURCE_TOSCA_TEMPLATE, NOT_SINGLE_RESOURCE, INVALID_RESOURCE_NAMESPACE, RESOURCE_ALREADY_EXISTS, INVALID_RESOURCE_CHECKSUM, RESOURCE_CANNOT_CONTAIN_RESOURCE_INSTANCES, NO_ASSETS_FOUND, GENERIC_TYPE_NOT_FOUND,INVALID_RESOURCE_TYPE, TOSCA_PARSE_ERROR, // Service related @@ -89,6 +90,5 @@ public enum ActionStatus { // Inputs INPUT_IS_NOT_CHILD_OF_COMPONENT, CFVC_LOOP_DETECTED, - ; } @@ -1,11 +1,9 @@ package org.openecomp.sdc.be.dao.cassandra; import com.datastax.driver.core.ResultSet; -import com.datastax.driver.mapping.Result; import com.datastax.driver.mapping.annotations.Accessor; import com.datastax.driver.mapping.annotations.Param; import com.datastax.driver.mapping.annotations.Query; -import org.openecomp.sdc.be.resources.data.auditing.DistributionStatusEvent; /** @@ -22,7 +22,6 @@ package org.openecomp.sdc.be.dao.cassandra; import javax.annotation.PostConstruct; -import com.datastax.driver.core.ResultSet; import org.apache.commons.lang3.tuple.ImmutablePair; import org.openecomp.sdc.be.resources.data.ESArtifactData; import org.openecomp.sdc.be.resources.data.auditing.AuditingTypesConstants; @@ -30,6 +29,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; +import com.datastax.driver.core.ResultSet; import com.datastax.driver.core.Session; import com.datastax.driver.mapping.MappingManager; @@ -24,7 +24,6 @@ import java.util.List; import javax.annotation.PreDestroy; -import com.datastax.driver.core.policies.*; import org.apache.commons.lang3.tuple.ImmutablePair; import org.openecomp.sdc.be.config.ConfigurationManager; import org.slf4j.Logger; @@ -33,6 +32,11 @@ import org.springframework.stereotype.Component; import com.datastax.driver.core.Cluster; import com.datastax.driver.core.Session; +import com.datastax.driver.core.policies.ConstantReconnectionPolicy; +import com.datastax.driver.core.policies.DCAwareRoundRobinPolicy; +import com.datastax.driver.core.policies.DefaultRetryPolicy; +import com.datastax.driver.core.policies.LoadBalancingPolicy; +import com.datastax.driver.core.policies.TokenAwarePolicy; import com.datastax.driver.mapping.Mapper; import com.datastax.driver.mapping.MappingManager; @@ -20,17 +20,18 @@ package org.openecomp.sdc.be.dao.cassandra; -import com.datastax.driver.core.ResultSet; -import com.datastax.driver.core.Statement; -import com.datastax.driver.core.querybuilder.QueryBuilder; -import fj.data.Either; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import com.datastax.driver.core.ResultSet; import com.datastax.driver.core.Session; +import com.datastax.driver.core.Statement; +import com.datastax.driver.core.querybuilder.QueryBuilder; import com.datastax.driver.mapping.MappingManager; +import fj.data.Either; + public abstract class CassandraDao { private static Logger logger = LoggerFactory.getLogger(CassandraDao.class.getName()); @@ -20,21 +20,29 @@ package org.openecomp.sdc.be.dao.cassandra.schema; -import com.datastax.driver.core.*; -import com.datastax.driver.core.schemabuilder.Alter; -import com.datastax.driver.core.schemabuilder.Create; -import com.datastax.driver.core.schemabuilder.SchemaBuilder; -import com.datastax.driver.core.schemabuilder.SchemaStatement; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.stream.Collectors; + import org.apache.commons.lang3.tuple.ImmutablePair; -import org.openecomp.sdc.be.config.*; import org.openecomp.sdc.be.config.Configuration; +import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.dao.cassandra.schema.tables.OldExternalApiEventTableDesc; import org.openecomp.sdc.be.resources.data.auditing.AuditingTypesConstants; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.*; -import java.util.stream.Collectors; +import com.datastax.driver.core.Cluster; +import com.datastax.driver.core.DataType; +import com.datastax.driver.core.KeyspaceMetadata; +import com.datastax.driver.core.Session; +import com.datastax.driver.core.schemabuilder.Alter; +import com.datastax.driver.core.schemabuilder.Create; +import com.datastax.driver.core.schemabuilder.SchemaBuilder; +import com.datastax.driver.core.schemabuilder.SchemaStatement; public class SdcSchemaBuilder { @@ -20,12 +20,14 @@ package org.openecomp.sdc.be.dao.cassandra.schema; -import com.datastax.driver.core.*; +import java.util.List; + import org.openecomp.sdc.be.config.ConfigurationManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.List; +import com.datastax.driver.core.Cluster; +import com.datastax.driver.core.Session; public class SdcSchemaUtils { @@ -20,7 +20,25 @@ package org.openecomp.sdc.be.dao.cassandra.schema; -import org.openecomp.sdc.be.dao.cassandra.schema.tables.*; +import org.openecomp.sdc.be.dao.cassandra.schema.tables.ArtifactTableDescription; +import org.openecomp.sdc.be.dao.cassandra.schema.tables.AuthEventTableDescription; +import org.openecomp.sdc.be.dao.cassandra.schema.tables.CategoryEventTableDescription; +import org.openecomp.sdc.be.dao.cassandra.schema.tables.ComponentCacheTableDescription; +import org.openecomp.sdc.be.dao.cassandra.schema.tables.ConsumerEventTableDefinition; +import org.openecomp.sdc.be.dao.cassandra.schema.tables.DistribDeployEventTableDesc; +import org.openecomp.sdc.be.dao.cassandra.schema.tables.DistribDownloadEventTableDesc; +import org.openecomp.sdc.be.dao.cassandra.schema.tables.DistribEngineEventTableDesc; +import org.openecomp.sdc.be.dao.cassandra.schema.tables.DistribNotifEventTableDesc; +import org.openecomp.sdc.be.dao.cassandra.schema.tables.DistribStatusEventTableDesc; +import org.openecomp.sdc.be.dao.cassandra.schema.tables.ExternalApiEventTableDesc; +import org.openecomp.sdc.be.dao.cassandra.schema.tables.GetCatHierEventTableDesc; +import org.openecomp.sdc.be.dao.cassandra.schema.tables.GetUebClusterEventTableDesc; +import org.openecomp.sdc.be.dao.cassandra.schema.tables.GetUsersListEventTableDesc; +import org.openecomp.sdc.be.dao.cassandra.schema.tables.MigrationTasksTableDescription; +import org.openecomp.sdc.be.dao.cassandra.schema.tables.ResAdminEventTableDescription; +import org.openecomp.sdc.be.dao.cassandra.schema.tables.SdcSchemaFilesTableDescription; +import org.openecomp.sdc.be.dao.cassandra.schema.tables.UserAccessEventTableDescription; +import org.openecomp.sdc.be.dao.cassandra.schema.tables.UserAdminEventTableDescription; public enum Table { @@ -26,12 +26,10 @@ import java.util.List; import java.util.Map; import org.apache.commons.lang3.tuple.ImmutablePair; -import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.dao.cassandra.schema.ITableDescription; import org.openecomp.sdc.be.resources.data.auditing.AuditingTypesConstants; import com.datastax.driver.core.DataType; -import com.datastax.driver.mapping.annotations.Column; public class CategoryEventTableDescription implements ITableDescription { @Override @@ -20,11 +20,12 @@ package org.openecomp.sdc.be.dao.cassandra.schema.tables; -import java.util.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.commons.lang3.tuple.ImmutablePair; -import org.openecomp.sdc.be.config.Configuration; -import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.dao.cassandra.schema.ITableDescription; import org.openecomp.sdc.be.resources.data.auditing.AuditingTypesConstants; @@ -27,7 +27,6 @@ import java.util.Map; import org.apache.commons.lang3.tuple.ImmutablePair; import org.openecomp.sdc.be.dao.cassandra.schema.ITableDescription; -import org.openecomp.sdc.be.dao.cassandra.schema.tables.GetUebClusterEventTableDesc.DEEFieldsDescription; import org.openecomp.sdc.be.resources.data.auditing.AuditingTypesConstants; import com.datastax.driver.core.DataType; @@ -27,7 +27,6 @@ import java.util.Map; import org.apache.commons.lang3.tuple.ImmutablePair; import org.openecomp.sdc.be.dao.cassandra.schema.ITableDescription; -import org.openecomp.sdc.be.dao.cassandra.schema.tables.DistribDownloadEventTableDesc.DSEFieldsDescription; import org.openecomp.sdc.be.resources.data.auditing.AuditingTypesConstants; import com.datastax.driver.core.DataType; @@ -26,7 +26,6 @@ import java.util.List; import java.util.Map; import org.apache.commons.lang3.tuple.ImmutablePair; -import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.dao.cassandra.schema.ITableDescription; import org.openecomp.sdc.be.resources.data.auditing.AuditingTypesConstants; @@ -24,6 +24,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; + import org.apache.commons.lang3.tuple.ImmutablePair; import org.openecomp.sdc.be.dao.cassandra.schema.ITableDescription; import org.openecomp.sdc.be.resources.data.auditing.AuditingTypesConstants; @@ -27,7 +27,6 @@ import java.util.Map; import org.apache.commons.lang3.tuple.ImmutablePair; import org.openecomp.sdc.be.dao.cassandra.schema.ITableDescription; -import org.openecomp.sdc.be.dao.cassandra.schema.tables.GetUsersListEventTableDesc.DEEFieldsDescription; import org.openecomp.sdc.be.resources.data.auditing.AuditingTypesConstants; import com.datastax.driver.core.DataType; @@ -27,7 +27,6 @@ import java.util.Map; import org.apache.commons.lang3.tuple.ImmutablePair; import org.openecomp.sdc.be.dao.cassandra.schema.ITableDescription; -import org.openecomp.sdc.be.dao.cassandra.schema.tables.DistribEngineEventTableDesc.DEEFieldsDescription; import org.openecomp.sdc.be.resources.data.auditing.AuditingTypesConstants; import com.datastax.driver.core.DataType; @@ -27,7 +27,6 @@ import java.util.Map; import org.apache.commons.lang3.tuple.ImmutablePair; import org.openecomp.sdc.be.dao.cassandra.schema.ITableDescription; -import org.openecomp.sdc.be.dao.cassandra.schema.tables.GetUebClusterEventTableDesc.DEEFieldsDescription; import org.openecomp.sdc.be.resources.data.auditing.AuditingTypesConstants; import com.datastax.driver.core.DataType; @@ -1,9 +1,7 @@ package org.openecomp.sdc.be.dao.cassandra.schema.tables; -import com.datastax.driver.core.DataType; -import org.apache.commons.lang3.tuple.ImmutablePair; -import org.openecomp.sdc.be.dao.cassandra.schema.ITableDescription; -import org.openecomp.sdc.be.resources.data.auditing.AuditingTypesConstants; +import static org.openecomp.sdc.be.dao.cassandra.schema.tables.MigrationTasksTableDescription.SdcRepoFieldsDescription.MAJOR_VERSION; +import static org.openecomp.sdc.be.dao.cassandra.schema.tables.MigrationTasksTableDescription.SdcRepoFieldsDescription.MINOR_VERSION; import java.util.Arrays; import java.util.Collections; @@ -11,8 +9,11 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import static org.openecomp.sdc.be.dao.cassandra.schema.tables.MigrationTasksTableDescription.SdcRepoFieldsDescription.MAJOR_VERSION; -import static org.openecomp.sdc.be.dao.cassandra.schema.tables.MigrationTasksTableDescription.SdcRepoFieldsDescription.MINOR_VERSION; +import org.apache.commons.lang3.tuple.ImmutablePair; +import org.openecomp.sdc.be.dao.cassandra.schema.ITableDescription; +import org.openecomp.sdc.be.resources.data.auditing.AuditingTypesConstants; + +import com.datastax.driver.core.DataType; public class MigrationTasksTableDescription implements ITableDescription { @@ -24,6 +24,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; + import org.apache.commons.lang3.tuple.ImmutablePair; import org.openecomp.sdc.be.dao.cassandra.schema.ITableDescription; import org.openecomp.sdc.be.resources.data.auditing.AuditingTypesConstants; @@ -26,12 +26,10 @@ import java.util.List; import java.util.Map; import org.apache.commons.lang3.tuple.ImmutablePair; -import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.dao.cassandra.schema.ITableDescription; import org.openecomp.sdc.be.resources.data.auditing.AuditingTypesConstants; import com.datastax.driver.core.DataType; -import com.datastax.driver.mapping.annotations.Column; public class ResAdminEventTableDescription implements ITableDescription { @@ -26,7 +26,6 @@ import java.util.List; import java.util.Map; import org.apache.commons.lang3.tuple.ImmutablePair; -import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.dao.cassandra.schema.ITableDescription; import org.openecomp.sdc.be.resources.data.auditing.AuditingTypesConstants; @@ -22,9 +22,7 @@ package org.openecomp.sdc.be.dao.graph.datatype; import java.util.Map; -import org.apache.commons.lang3.tuple.ImmutablePair; import org.openecomp.sdc.be.dao.neo4j.GraphEdgeLabels; -import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; public class GraphEdge { @@ -35,8 +35,8 @@ import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.index.query.QueryBuilder; import org.elasticsearch.search.sort.SortBuilder; -import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.config.Configuration.ElasticSearchConfig.IndicesTimeFrequencyEntry; +import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.dao.es.ElasticSearchClient; import org.openecomp.sdc.common.api.Constants; @@ -30,7 +30,6 @@ import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum; import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; -import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; import com.thinkaurelius.titan.core.TitanVertex; @@ -20,7 +20,20 @@ package org.openecomp.sdc.be.dao.jsongraph.types; -import org.openecomp.sdc.be.datatypes.elements.*; +import org.openecomp.sdc.be.datatypes.elements.AdditionalInfoParameterDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.ArtifactDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.CompositionDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.GroupDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.InterfaceDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.ListCapabilityDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.ListRequirementDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.MapArtifactDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.MapCapabiltyProperty; +import org.openecomp.sdc.be.datatypes.elements.MapGroupsDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.MapListCapabiltyDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.MapListRequirementDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.MapPropertiesDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; public enum VertexTypeEnum { @@ -21,6 +21,7 @@ package org.openecomp.sdc.be.dao.jsongraph.utils; import java.util.UUID; + import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum; public class IdBuilderUtils { @@ -23,8 +23,6 @@ package org.openecomp.sdc.be.dao.neo4j; import java.util.ArrayList; import java.util.List; -import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; - public enum GraphEdgePropertiesDictionary { // field name class type @@ -27,7 +27,6 @@ import java.util.Properties; import org.apache.commons.io.IOUtils; import org.apache.http.HttpEntity; -import org.apache.http.HttpStatus; import org.apache.http.client.config.RequestConfig; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpGet; @@ -29,15 +29,12 @@ import java.util.Map.Entry; import java.util.stream.Collectors; import java.util.stream.StreamSupport; -import javax.annotation.Resource; - import org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.commons.lang3.tuple.ImmutableTriple; import org.apache.tinkerpop.gremlin.structure.Direction; import org.apache.tinkerpop.gremlin.structure.Edge; import org.apache.tinkerpop.gremlin.structure.Element; import org.apache.tinkerpop.gremlin.structure.Property; -import org.apache.tinkerpop.gremlin.structure.T; import org.apache.tinkerpop.gremlin.structure.Vertex; import org.apache.tinkerpop.gremlin.structure.util.ElementHelper; import org.openecomp.sdc.be.config.ConfigurationManager; @@ -47,7 +44,6 @@ import org.openecomp.sdc.be.dao.graph.datatype.GraphElementTypeEnum; import org.openecomp.sdc.be.dao.graph.datatype.GraphNode; import org.openecomp.sdc.be.dao.graph.datatype.GraphRelation; import org.openecomp.sdc.be.dao.graph.datatype.RelationEndPoint; -import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum; import org.openecomp.sdc.be.dao.neo4j.GraphEdgeLabels; import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; @@ -21,11 +21,7 @@ package org.openecomp.sdc.be.dao.titan; import java.util.ArrayList; -import java.util.Arrays; import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; import java.util.concurrent.Callable; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; @@ -37,23 +33,13 @@ import java.util.concurrent.TimeUnit; import javax.annotation.PostConstruct; import org.apache.commons.configuration.BaseConfiguration; -import org.apache.tinkerpop.gremlin.structure.Edge; import org.apache.tinkerpop.gremlin.structure.T; import org.apache.tinkerpop.gremlin.structure.Vertex; import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.dao.DAOTitanStrategy; import org.openecomp.sdc.be.dao.TitanClientStrategy; -import org.openecomp.sdc.be.dao.graph.datatype.ActionEnum; -import org.openecomp.sdc.be.dao.graph.datatype.GraphElementTypeEnum; -import org.openecomp.sdc.be.dao.neo4j.GraphEdgePropertiesDictionary; import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; -import org.openecomp.sdc.be.dao.utils.UserStatusEnum; -import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; -import org.openecomp.sdc.be.resources.data.CategoryData; -import org.openecomp.sdc.be.resources.data.ResourceCategoryData; -import org.openecomp.sdc.be.resources.data.ServiceCategoryData; -import org.openecomp.sdc.be.resources.data.UserData; import org.openecomp.sdc.common.config.EcompErrorName; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -67,7 +53,6 @@ import com.thinkaurelius.titan.core.SchemaViolationException; import com.thinkaurelius.titan.core.TitanConfigurationException; import com.thinkaurelius.titan.core.TitanFactory; import com.thinkaurelius.titan.core.TitanGraph; -import com.thinkaurelius.titan.core.TitanGraphQuery; import com.thinkaurelius.titan.core.TitanVertex; import com.thinkaurelius.titan.core.TitanVertexProperty; import com.thinkaurelius.titan.core.schema.ConsistencyModifier; @@ -20,8 +20,14 @@ package org.openecomp.sdc.be.dao.utils; +import java.util.ArrayList; +import java.util.Collection; import java.util.HashMap; +import java.util.List; import java.util.Map; +import java.util.Optional; +import java.util.function.Function; +import java.util.stream.Collectors; /** * Utility class to ease map manipulation. @@ -63,6 +69,38 @@ public final class MapUtil { } /** + * + * @param valuesToMap the list of values to group + * @param groupingFunction the function to group the list values by + * @return a map of list of values grouped by a key, as specified in the {@code groupingFunction} + */ + public static <K,V> Map<K,List<V>> groupListBy(Collection<V> valuesToMap, Function<V,K> groupingFunction) { + return valuesToMap.stream().collect(Collectors.groupingBy(groupingFunction)); + } + + /** + * + * @param valuesToMap list of values to map + * @param mappingFunction a function which specifies how to map each element on the list + * @return a map created by mapping each element from the {@code valuesToMap} as specified in the {@code mappingFunction} + */ + public static <K,V> Map<K,V> toMap(Collection<V> valuesToMap, Function<V,K> mappingFunction) { + return Optional.ofNullable(valuesToMap).orElse(new ArrayList<>()).stream().collect(Collectors.toMap(mappingFunction, Function.identity())); + } + + /** + * + * @param map the map of which it keys to convert + * @param keyMappingFunction a function which converts the key object + * @return a map with converted keys. + */ + public static <K,U, V> Map<U, List<V>> convertMapKeys(Map<K, List<V>> map, Function<K,U> keyMappingFunction) { + return map.entrySet().stream() + .collect(Collectors.toMap(entry -> keyMappingFunction.apply(entry.getKey()), + Map.Entry::getValue)); + } + + /** * Create a new hash map and fills it from the given keys and values * (keys[index] -> values[index]. * @@ -20,13 +20,8 @@ package org.openecomp.sdc.be.resources.api; -import java.util.List; -import java.util.Map; - import org.openecomp.sdc.be.dao.api.ResourceUploadStatus; import org.openecomp.sdc.be.resources.data.ESArtifactData; -import org.openecomp.sdc.be.resources.data.ServiceArtifactsDataCollection; -import org.openecomp.sdc.be.resources.exception.ResourceDAOException; import fj.data.Either; @@ -21,7 +21,6 @@ package org.openecomp.sdc.be.resources.data; import java.lang.reflect.Type; -import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -28,8 +28,6 @@ import java.util.Map; import org.openecomp.sdc.be.dao.graph.datatype.GraphNode; import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; import org.openecomp.sdc.be.datatypes.components.ComponentMetadataDataDefinition; -import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; -import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; import com.google.gson.reflect.TypeToken; @@ -25,10 +25,8 @@ import java.util.Map; import org.openecomp.sdc.be.dao.graph.datatype.GraphNode; import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; -import org.openecomp.sdc.be.datatypes.elements.ComponentInstanceDataDefinition; import org.openecomp.sdc.be.datatypes.elements.GroupInstanceDataDefinition; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; -import org.openecomp.sdc.be.datatypes.enums.OriginTypeEnum; public class GroupInstanceData extends GraphNode { @@ -1,13 +1,12 @@ package org.openecomp.sdc.be.resources.data; +import java.util.Date; + import com.datastax.driver.mapping.annotations.ClusteringColumn; import com.datastax.driver.mapping.annotations.Column; import com.datastax.driver.mapping.annotations.PartitionKey; import com.datastax.driver.mapping.annotations.Table; -import java.math.BigInteger; -import java.util.Date; - @Table(keyspace = "sdcrepository", name = "migrationTasks") public class MigrationTaskEntry { @@ -2,9 +2,6 @@ package org.openecomp.sdc.be.dao.cassandra; import java.util.List; -import javax.annotation.Generated; - -import org.apache.tinkerpop.gremlin.structure.T; import org.junit.Test; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.resources.data.auditing.AuditingGenericEvent; @@ -1,13 +1,7 @@ package org.openecomp.sdc.be.dao.cassandra; import java.util.List; -import java.util.Map; -import java.util.Set; -import javax.annotation.Generated; - -import org.apache.commons.lang3.tuple.ImmutablePair; -import org.junit.Assert; import org.junit.Test; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.resources.data.ComponentCacheData; @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.dao.cassandra; import java.util.List; -import javax.annotation.Generated; - import org.junit.Test; import org.openecomp.sdc.be.resources.data.SdcSchemaFilesData; @@ -1,11 +1,7 @@ package org.openecomp.sdc.be.dao.cassandra.schema; -import javax.annotation.Generated; - import org.junit.Test; -import com.datastax.driver.core.Cluster; - public class SdcSchemaUtilsTest { @@ -1,7 +1,5 @@ package org.openecomp.sdc.be.dao.cassandra.schema; -import javax.annotation.Generated; - import org.junit.Test; @@ -3,8 +3,6 @@ package org.openecomp.sdc.be.dao.cassandra.schema.tables; import java.util.List; import java.util.Map; -import javax.annotation.Generated; - import org.apache.commons.lang3.tuple.ImmutablePair; import org.junit.Test; @@ -3,8 +3,6 @@ package org.openecomp.sdc.be.dao.cassandra.schema.tables; import java.util.List; import java.util.Map; -import javax.annotation.Generated; - import org.apache.commons.lang3.tuple.ImmutablePair; import org.junit.Test; @@ -1,9 +1,6 @@ package org.openecomp.sdc.be.dao.cassandra.schema.tables; import java.util.List; -import java.util.Map; - -import javax.annotation.Generated; import org.apache.commons.lang3.tuple.ImmutablePair; import org.junit.Test; @@ -3,8 +3,6 @@ package org.openecomp.sdc.be.dao.cassandra.schema.tables; import java.util.List; import java.util.Map; -import javax.annotation.Generated; - import org.apache.commons.lang3.tuple.ImmutablePair; import org.junit.Test; @@ -3,8 +3,6 @@ package org.openecomp.sdc.be.dao.cassandra.schema.tables; import java.util.List; import java.util.Map; -import javax.annotation.Generated; - import org.apache.commons.lang3.tuple.ImmutablePair; import org.junit.Test; @@ -3,8 +3,6 @@ package org.openecomp.sdc.be.dao.cassandra.schema.tables; import java.util.List; import java.util.Map; -import javax.annotation.Generated; - import org.apache.commons.lang3.tuple.ImmutablePair; import org.junit.Test; @@ -3,8 +3,6 @@ package org.openecomp.sdc.be.dao.cassandra.schema.tables; import java.util.List; import java.util.Map; -import javax.annotation.Generated; - import org.apache.commons.lang3.tuple.ImmutablePair; import org.junit.Test; @@ -3,8 +3,6 @@ package org.openecomp.sdc.be.dao.cassandra.schema.tables; import java.util.List; import java.util.Map; -import javax.annotation.Generated; - import org.apache.commons.lang3.tuple.ImmutablePair; import org.junit.Test; @@ -3,8 +3,6 @@ package org.openecomp.sdc.be.dao.cassandra.schema.tables; import java.util.List; import java.util.Map; -import javax.annotation.Generated; - import org.apache.commons.lang3.tuple.ImmutablePair; import org.junit.Test; @@ -1,9 +1,6 @@ package org.openecomp.sdc.be.dao.cassandra.schema.tables; import java.util.List; -import java.util.Map; - -import javax.annotation.Generated; import org.apache.commons.lang3.tuple.ImmutablePair; import org.junit.Test; @@ -3,8 +3,6 @@ package org.openecomp.sdc.be.dao.cassandra.schema.tables; import java.util.List; import java.util.Map; -import javax.annotation.Generated; - import org.apache.commons.lang3.tuple.ImmutablePair; import org.junit.Test; @@ -3,8 +3,6 @@ package org.openecomp.sdc.be.dao.cassandra.schema.tables; import java.util.List; import java.util.Map; -import javax.annotation.Generated; - import org.apache.commons.lang3.tuple.ImmutablePair; import org.junit.Test; @@ -3,8 +3,6 @@ package org.openecomp.sdc.be.dao.cassandra.schema.tables; import java.util.List; import java.util.Map; -import javax.annotation.Generated; - import org.apache.commons.lang3.tuple.ImmutablePair; import org.junit.Test; @@ -3,8 +3,6 @@ package org.openecomp.sdc.be.dao.cassandra.schema.tables; import java.util.List; import java.util.Map; -import javax.annotation.Generated; - import org.apache.commons.lang3.tuple.ImmutablePair; import org.junit.Test; @@ -3,8 +3,6 @@ package org.openecomp.sdc.be.dao.cassandra.schema.tables; import java.util.List; import java.util.Map; -import javax.annotation.Generated; - import org.apache.commons.lang3.tuple.ImmutablePair; import org.junit.Test; @@ -3,8 +3,6 @@ package org.openecomp.sdc.be.dao.cassandra.schema.tables; import java.util.List; import java.util.Map; -import javax.annotation.Generated; - import org.apache.commons.lang3.tuple.ImmutablePair; import org.junit.Test; @@ -1,9 +1,6 @@ package org.openecomp.sdc.be.dao.cassandra.schema.tables; import java.util.List; -import java.util.Map; - -import javax.annotation.Generated; import org.apache.commons.lang3.tuple.ImmutablePair; import org.junit.Test; @@ -3,8 +3,6 @@ package org.openecomp.sdc.be.dao.cassandra.schema.tables; import java.util.List; import java.util.Map; -import javax.annotation.Generated; - import org.apache.commons.lang3.tuple.ImmutablePair; import org.junit.Test; @@ -3,8 +3,6 @@ package org.openecomp.sdc.be.dao.cassandra.schema.tables; import java.util.List; import java.util.Map; -import javax.annotation.Generated; - import org.apache.commons.lang3.tuple.ImmutablePair; import org.junit.Test; @@ -1,9 +1,6 @@ package org.openecomp.sdc.be.dao.cassandra.schema.tables; import java.util.List; -import java.util.Map; - -import javax.annotation.Generated; import org.apache.commons.lang3.tuple.ImmutablePair; import org.junit.Test; @@ -2,11 +2,8 @@ package org.openecomp.sdc.be.dao.jsongraph; import java.util.Map; -import javax.annotation.Generated; - import org.junit.Test; import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum; -import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum; import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; @@ -3,13 +3,8 @@ package org.openecomp.sdc.be.dao.jsongraph; import java.util.List; import java.util.Map; -import javax.annotation.Generated; -import javax.lang.model.element.Element; - -import org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.tinkerpop.gremlin.structure.Edge; import org.apache.tinkerpop.gremlin.structure.Vertex; -import org.junit.Assert; import org.junit.Test; import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum; import org.openecomp.sdc.be.dao.jsongraph.types.EdgePropertyEnum; @@ -19,11 +14,7 @@ import org.openecomp.sdc.be.dao.titan.TitanGraphClient; import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum; -import com.datastax.driver.core.schemabuilder.SchemaBuilder.Direction; -import com.google.common.collect.Multiset.Entry; import com.thinkaurelius.titan.core.TitanGraph; -import com.thinkaurelius.titan.core.TitanGraphQuery; -import com.thinkaurelius.titan.core.TitanVertex; import fj.data.Either; @@ -1,7 +1,5 @@ package org.openecomp.sdc.be.dao.jsongraph.types; -import javax.annotation.Generated; - import org.junit.Test; @@ -1,7 +1,5 @@ package org.openecomp.sdc.be.dao.jsongraph.types; -import javax.annotation.Generated; - import org.junit.Test; @@ -1,7 +1,5 @@ package org.openecomp.sdc.be.dao.jsongraph.types; -import javax.annotation.Generated; - import org.junit.Test; @@ -1,7 +1,5 @@ package org.openecomp.sdc.be.dao.model; -import javax.annotation.Generated; - import org.junit.Test; @@ -1,7 +1,5 @@ package org.openecomp.sdc.be.dao.rest; -import javax.annotation.Generated; - import org.junit.Test; @@ -1,7 +1,5 @@ package org.openecomp.sdc.be.dao.utils; -import javax.annotation.Generated; - import org.apache.tinkerpop.gremlin.structure.T; import org.elasticsearch.common.recycler.Recycler.V; import org.junit.Test; @@ -20,7 +20,18 @@ package org.openecomp.sdc.be.resources; -import fj.data.Either; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import javax.annotation.Resource; + import org.elasticsearch.action.admin.indices.delete.DeleteIndexResponse; import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.index.query.MatchAllQueryBuilder; @@ -32,12 +43,17 @@ import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; import org.openecomp.sdc.be.config.Configuration; -import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.config.Configuration.ElasticSearchConfig.IndicesTimeFrequencyEntry; +import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.dao.es.ElasticSearchClient; import org.openecomp.sdc.be.dao.impl.AuditingDao; -import org.openecomp.sdc.be.resources.data.auditing.*; +import org.openecomp.sdc.be.resources.data.auditing.AuditingGenericEvent; +import org.openecomp.sdc.be.resources.data.auditing.DistributionNotificationEvent; +import org.openecomp.sdc.be.resources.data.auditing.DistributionStatusEvent; +import org.openecomp.sdc.be.resources.data.auditing.ResourceAdminEvent; +import org.openecomp.sdc.be.resources.data.auditing.UserAccessEvent; +import org.openecomp.sdc.be.resources.data.auditing.UserAdminEvent; import org.openecomp.sdc.common.api.ConfigurationSource; import org.openecomp.sdc.common.api.Constants; import org.openecomp.sdc.common.datastructure.AuditingFieldsKeysEnum; @@ -53,14 +69,7 @@ import org.springframework.test.context.support.DependencyInjectionTestExecution import org.springframework.test.context.support.DirtiesContextTestExecutionListener; import org.springframework.test.context.transaction.TransactionalTestExecutionListener; -import javax.annotation.Resource; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - -import static org.junit.Assert.*; +import fj.data.Either; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration("classpath:application-context-test.xml") @@ -20,15 +20,15 @@ package org.openecomp.sdc.be.resources; +import org.openecomp.sdc.be.dao.Account; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import com.datastax.driver.core.Cluster; import com.datastax.driver.core.Session; import com.datastax.driver.mapping.Mapper; import com.datastax.driver.mapping.MappingManager; -import org.openecomp.sdc.be.dao.Account; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - public class CassandraTest { private static Logger log = LoggerFactory.getLogger(CassandraTest.class.getName()); private Cluster cluster; @@ -26,10 +26,7 @@ import java.util.Map; import org.codehaus.jackson.JsonGenerationException; import org.codehaus.jackson.map.JsonMappingException; -import org.codehaus.jackson.map.ObjectMapper; -import org.codehaus.jackson.type.TypeReference; import org.junit.Test; -import org.openecomp.sdc.be.dao.jsongraph.utils.JsonParserUtils; import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; import org.openecomp.sdc.be.datatypes.elements.SchemaDefinition; @@ -23,7 +23,6 @@ package org.openecomp.sdc.be.resources; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; -import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; @@ -73,8 +72,6 @@ import com.thinkaurelius.titan.core.TitanFactory; import com.thinkaurelius.titan.core.TitanGraph; import com.thinkaurelius.titan.core.TitanVertex; import com.thinkaurelius.titan.core.attribute.Text; -import com.thinkaurelius.titan.core.schema.ConsistencyModifier; -import com.thinkaurelius.titan.core.schema.TitanGraphIndex; import com.thinkaurelius.titan.core.schema.TitanManagement; import fj.data.Either; @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.resources.data; import java.util.Map; -import javax.annotation.Generated; - import org.junit.Test; import org.openecomp.sdc.be.datatypes.elements.AdditionalInfoParameterDataDefinition; @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.resources.data; import java.util.Map; -import javax.annotation.Generated; - import org.junit.Test; import org.openecomp.sdc.be.datatypes.elements.ArtifactDataDefinition; @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.resources.data; import java.util.Map; -import javax.annotation.Generated; - import org.junit.Test; import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.resources.data; import java.util.Map; -import javax.annotation.Generated; - import org.junit.Test; @@ -3,8 +3,6 @@ package org.openecomp.sdc.be.resources.data; import java.util.List; import java.util.Map; -import javax.annotation.Generated; - import org.junit.Test; @@ -3,8 +3,6 @@ package org.openecomp.sdc.be.resources.data; import java.util.List; import java.util.Map; -import javax.annotation.Generated; - import org.junit.Test; @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.resources.data; import java.util.Map; -import javax.annotation.Generated; - import org.junit.Test; import org.openecomp.sdc.be.datatypes.elements.CapabilityTypeDataDefinition; @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.resources.data; import java.util.Date; -import javax.annotation.Generated; - import org.junit.Test; @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.resources.data; import java.util.Map; -import javax.annotation.Generated; - import org.junit.Test; import org.openecomp.sdc.be.datatypes.elements.ComponentInstanceDataDefinition; @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.resources.data; import java.util.Map; -import javax.annotation.Generated; - import org.junit.Test; import org.openecomp.sdc.be.datatypes.elements.ConsumerDataDefinition; @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.resources.data; import java.util.Map; -import javax.annotation.Generated; - import org.junit.Test; import org.openecomp.sdc.be.datatypes.elements.DataTypeDataDefinition; @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.resources.data; import java.util.Map; -import javax.annotation.Generated; - import org.junit.Test; import org.openecomp.sdc.be.datatypes.elements.GroupDataDefinition; @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.resources.data; import java.util.Map; -import javax.annotation.Generated; - import org.junit.Test; import org.openecomp.sdc.be.datatypes.elements.GroupInstanceDataDefinition; @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.resources.data; import java.util.Map; -import javax.annotation.Generated; - import org.junit.Test; import org.openecomp.sdc.be.datatypes.elements.GroupTypeDataDefinition; @@ -2,9 +2,6 @@ package org.openecomp.sdc.be.resources.data; import java.util.Map; -import javax.annotation.Generated; - -import org.junit.Assert; import org.junit.Test; import org.openecomp.sdc.be.datatypes.elements.HeatParameterDataDefinition; @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.resources.data; import java.util.Map; -import javax.annotation.Generated; - import org.junit.Test; @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.resources.data; import java.util.Map; -import javax.annotation.Generated; - import org.junit.Test; @@ -3,8 +3,6 @@ package org.openecomp.sdc.be.resources.data; import java.util.List; import java.util.Map; -import javax.annotation.Generated; - import org.junit.Test; import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.resources.data; import java.util.Map; -import javax.annotation.Generated; - import org.junit.Test; import org.openecomp.sdc.be.datatypes.elements.InterfaceDataDefinition; @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.resources.data; import java.util.Date; -import javax.annotation.Generated; - import org.junit.Test; @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.resources.data; import java.util.Map; -import javax.annotation.Generated; - import org.junit.Test; import org.openecomp.sdc.be.datatypes.elements.OperationDataDefinition; @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.resources.data; import java.util.Map; -import javax.annotation.Generated; - import org.junit.Test; import org.openecomp.sdc.be.datatypes.elements.PolicyTypeDataDefinition; @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.resources.data; import java.util.Map; -import javax.annotation.Generated; - import org.junit.Test; @@ -3,8 +3,6 @@ package org.openecomp.sdc.be.resources.data; import java.util.List; import java.util.Map; -import javax.annotation.Generated; - import org.junit.Test; import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; @@ -3,8 +3,6 @@ package org.openecomp.sdc.be.resources.data; import java.util.List; import java.util.Map; -import javax.annotation.Generated; - import org.junit.Test; import org.openecomp.sdc.be.datatypes.elements.PropertyRule; @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.resources.data; import java.util.Map; -import javax.annotation.Generated; - import org.junit.Test; @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.resources.data; import java.util.Map; -import javax.annotation.Generated; - import org.junit.Test; import org.openecomp.sdc.be.datatypes.elements.RelationshipInstDataDefinition; @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.resources.data; import java.util.Map; -import javax.annotation.Generated; - import org.junit.Test; @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.resources.data; import java.util.Map; -import javax.annotation.Generated; - import org.junit.Test; @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.resources.data; import java.util.Map; -import javax.annotation.Generated; - import org.junit.Test; @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.resources.data; import java.util.Date; -import javax.annotation.Generated; - import org.junit.Test; @@ -3,8 +3,6 @@ package org.openecomp.sdc.be.resources.data; import java.util.List; import java.util.Map; -import javax.annotation.Generated; - import org.junit.Test; public class ServiceArtifactsDataCollectionTest { @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.resources.data; import java.util.Map; -import javax.annotation.Generated; - import org.junit.Test; @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.resources.data; import java.util.Map; -import javax.annotation.Generated; - import org.junit.Assert; import org.junit.Test; @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.resources.data; import java.util.Map; -import javax.annotation.Generated; - import org.junit.Test; @@ -3,8 +3,6 @@ package org.openecomp.sdc.be.resources.data.auditing; import java.util.Date; import java.util.UUID; -import javax.annotation.Generated; - import org.junit.Test; @@ -3,8 +3,6 @@ package org.openecomp.sdc.be.resources.data.auditing; import java.util.Date; import java.util.UUID; -import javax.annotation.Generated; - import org.junit.Test; @@ -3,8 +3,6 @@ package org.openecomp.sdc.be.resources.data.auditing; import java.util.Date; import java.util.UUID; -import javax.annotation.Generated; - import org.junit.Test; @@ -3,8 +3,6 @@ package org.openecomp.sdc.be.resources.data.auditing; import java.util.Date; import java.util.UUID; -import javax.annotation.Generated; - import org.junit.Test; @@ -3,8 +3,6 @@ package org.openecomp.sdc.be.resources.data.auditing; import java.util.Date; import java.util.UUID; -import javax.annotation.Generated; - import org.junit.Test; public class DistributionNotificationEventTest { @@ -3,8 +3,6 @@ package org.openecomp.sdc.be.resources.data.auditing; import java.util.Date; import java.util.UUID; -import javax.annotation.Generated; - import org.junit.Test; @@ -3,8 +3,6 @@ package org.openecomp.sdc.be.resources.data.auditing; import java.util.Date; import java.util.UUID; -import javax.annotation.Generated; - import org.junit.Test; @@ -3,8 +3,6 @@ package org.openecomp.sdc.be.resources.data.auditing; import java.util.Date; import java.util.UUID; -import javax.annotation.Generated; - import org.junit.Test; @@ -3,8 +3,6 @@ package org.openecomp.sdc.be.resources.data.auditing; import java.util.Date; import java.util.UUID; -import javax.annotation.Generated; - import org.junit.Test; @@ -3,8 +3,6 @@ package org.openecomp.sdc.be.resources.data.auditing; import java.util.Date; import java.util.UUID; -import javax.annotation.Generated; - import org.junit.Test; @@ -3,8 +3,6 @@ package org.openecomp.sdc.be.resources.data.auditing; import java.util.Date; import java.util.UUID; -import javax.annotation.Generated; - import org.junit.Test; @@ -3,8 +3,6 @@ package org.openecomp.sdc.be.resources.data.auditing; import java.util.Date; import java.util.UUID; -import javax.annotation.Generated; - import org.junit.Test; @@ -1,7 +1,5 @@ package org.openecomp.sdc.be.resources.exception; -import javax.annotation.Generated; - import org.junit.Test; import org.openecomp.sdc.be.dao.api.ResourceUploadStatus; @@ -293,8 +293,7 @@ <dependency> <groupId>org.mockito</groupId> - <artifactId>mockito-all</artifactId> - <version>${mockito.version}</version> + <artifactId>mockito-core</artifactId> <scope>test</scope> </dependency> @@ -21,10 +21,7 @@ package org.openecomp.sdc.fe.impl; import java.io.ByteArrayInputStream; -import java.io.IOException; import java.io.InputStream; -import java.util.Enumeration; -import java.util.HashMap; import java.util.Map; import javax.servlet.http.HttpServletRequest; @@ -25,6 +25,7 @@ import java.lang.reflect.Type; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.Map; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ThreadFactory; @@ -42,19 +43,22 @@ import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.util.EntityUtils; import org.openecomp.sdc.common.api.Constants; import org.openecomp.sdc.common.api.HealthCheckInfo; -import org.openecomp.sdc.common.api.HealthCheckWrapper; -import org.openecomp.sdc.common.api.HealthCheckInfo.HealthCheckComponent; import org.openecomp.sdc.common.api.HealthCheckInfo.HealthCheckStatus; +import org.openecomp.sdc.common.api.HealthCheckWrapper; import org.openecomp.sdc.common.config.EcompErrorName; import org.openecomp.sdc.common.impl.ExternalConfiguration; +import org.openecomp.sdc.common.util.HealthCheckUtil; import org.openecomp.sdc.fe.config.Configuration; import org.openecomp.sdc.fe.config.ConfigurationManager; import org.openecomp.sdc.fe.config.FeEcompErrorManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; import com.google.gson.Gson; import com.google.gson.GsonBuilder; +import com.google.gson.JsonSyntaxException; import com.google.gson.reflect.TypeToken; public class HealthCheckService { @@ -74,7 +78,7 @@ public class HealthCheckService { private static Logger log = LoggerFactory.getLogger(HealthCheckService.class.getName()); private HealthStatus lastHealthStatus = new HealthStatus(500, "{}"); - private final List<HealthCheckComponent> healthCheckFeComponents = Arrays.asList(HealthCheckComponent.ON_BOARDING); + private final List<String> healthCheckFeComponents = Arrays.asList(Constants.HC_COMPONENT_ON_BOARDING, Constants.HC_COMPONENT_DCAE); private class HealthCheckScheduledTask implements Runnable { @Override @@ -134,34 +138,42 @@ public class HealthCheckService { httpClient = getHttpClient(config); HttpGet httpGet = new HttpGet(redirectedUrl); CloseableHttpResponse beResponse; - int beStatus; - String feAggHealthCheck; + HealthCheckWrapper feAggHealthCheck; try { beResponse = httpClient.execute(httpGet); - beStatus = beResponse.getStatusLine().getStatusCode(); + log.debug("HC call to BE - status code is {}", beResponse.getStatusLine().getStatusCode()); String beJsonResponse = EntityUtils.toString(beResponse.getEntity()); feAggHealthCheck = getFeHealthCheckInfos(gson, beJsonResponse); } catch (Exception e) { - log.error("Health Check error when trying to connect to BE", e); + log.debug("Health Check error when trying to connect to BE or external FE. Error: {}", e.getMessage()); + log.error("Health Check error when trying to connect to BE or external FE.", e); String beDowneResponse = gson.toJson(getBeDownCheckInfos()); - return new HealthStatus(500, beDowneResponse); + return new HealthStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR, beDowneResponse); } - return new HealthStatus(beStatus, feAggHealthCheck); + + //Getting aggregate FE status + boolean aggregateFeStatus = HealthCheckUtil.getAggregateStatus(feAggHealthCheck.getComponentsInfo()); + return new HealthStatus(aggregateFeStatus ? HttpStatus.SC_OK : HttpStatus.SC_INTERNAL_SERVER_ERROR, gson.toJson(feAggHealthCheck)); } catch (Exception e) { FeEcompErrorManager.getInstance().processEcompError(EcompErrorName.FeHealthCheckGeneralError, "Unexpected FE Health check error"); FeEcompErrorManager.getInstance().logFeHealthCheckGeneralError("Unexpected FE Health check error"); log.error("Unexpected FE health check error {}", e.getMessage()); - return new HealthStatus(500, e.getMessage()); + return new HealthStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR, e.getMessage()); } finally { if (httpClient != null) { try { httpClient.close(); } catch (IOException e) { + log.error("Couldn't close HC HTTP Client: ", e); } } } } + + + + private Response buildResponse(int status, String jsonResponse) { healthLogger.trace("FE and BE health check status: {}", jsonResponse); return Response.status(status).entity(jsonResponse).build(); @@ -186,44 +198,56 @@ public class HealthCheckService { } - private String getFeHealthCheckInfos(Gson gson, String responseString) { + private HealthCheckWrapper getFeHealthCheckInfos(Gson gson, String responseString) { Type wrapperType = new TypeToken<HealthCheckWrapper>() { }.getType(); HealthCheckWrapper healthCheckWrapper = gson.fromJson(responseString, wrapperType); String appVersion = ExternalConfiguration.getAppVersion(); String description = "OK"; healthCheckWrapper.getComponentsInfo() - .add(new HealthCheckInfo(HealthCheckComponent.FE, HealthCheckStatus.UP, appVersion, description)); + .add(new HealthCheckInfo(Constants.HC_COMPONENT_FE, HealthCheckStatus.UP, appVersion, description)); //add hosted components fe component - for (HealthCheckComponent component: healthCheckFeComponents) { + for (String component: healthCheckFeComponents) { List<HealthCheckInfo> feComponentsInfo = addHostedComponentsFeHealthCheck(component); - HealthCheckInfo baseComponentHCInfo = healthCheckWrapper.getComponentsInfo().stream().filter(c -> c.getHealthCheckComponent() == component).findFirst().orElse(null); + HealthCheckInfo baseComponentHCInfo = healthCheckWrapper.getComponentsInfo().stream().filter(c -> c.getHealthCheckComponent().equals(component)).findFirst().orElse(null); if (baseComponentHCInfo != null) { if (baseComponentHCInfo.getComponentsInfo() == null) { baseComponentHCInfo.setComponentsInfo(new ArrayList<>()); } baseComponentHCInfo.getComponentsInfo().addAll(feComponentsInfo); + boolean status = HealthCheckUtil.getAggregateStatus(baseComponentHCInfo.getComponentsInfo()); + baseComponentHCInfo.setHealthCheckStatus(status ? HealthCheckStatus.UP : HealthCheckStatus.DOWN); + + String componentsDesc = HealthCheckUtil.getAggregateDescription(baseComponentHCInfo.getComponentsInfo(), baseComponentHCInfo.getDescription()); + if (componentsDesc.length() > 0) { //aggregated description contains all the internal components desc + baseComponentHCInfo.setDescription(componentsDesc); + } + } else { + log.error("{} not exists in HealthCheck info", component); } } - return gson.toJson(healthCheckWrapper); + return healthCheckWrapper; } - private List<HealthCheckInfo> addHostedComponentsFeHealthCheck(HealthCheckComponent baseComponent) { + private List<HealthCheckInfo> addHostedComponentsFeHealthCheck(String baseComponent) { Configuration config = ((ConfigurationManager) context.getAttribute(Constants.CONFIGURATION_MANAGER_ATTR)) .getConfiguration(); String healthCheckUrl = null; switch(baseComponent) { - case ON_BOARDING: + case Constants.HC_COMPONENT_ON_BOARDING: healthCheckUrl = buildOnboardingHealthCheckUrl(config); break; + case Constants.HC_COMPONENT_DCAE: + healthCheckUrl = buildDcaeHealthCheckUrl(config); + break; } String description; if (healthCheckUrl != null) { - Gson gson = new Gson(); + ObjectMapper mapper = new ObjectMapper(); CloseableHttpClient httpClient = getHttpClient(config); HttpGet httpGet = new HttpGet(healthCheckUrl); CloseableHttpResponse beResponse; @@ -232,32 +256,45 @@ public class HealthCheckService { beResponse = httpClient.execute(httpGet); int beStatus = beResponse.getStatusLine().getStatusCode(); if (beStatus == HttpStatus.SC_OK || beStatus == HttpStatus.SC_INTERNAL_SERVER_ERROR) { - String beJsonResponse = EntityUtils.toString(beResponse.getEntity()); - HealthCheckWrapper healthCheckWrapper = gson.fromJson(beJsonResponse, HealthCheckWrapper.class); - return healthCheckWrapper.getComponentsInfo(); + try { + String beJsonResponse = EntityUtils.toString(beResponse.getEntity()); + + Map<String, Object> healthCheckMap = mapper.readValue(beJsonResponse, new TypeReference<Map<String, Object>>(){}); + if (healthCheckMap.containsKey("componentsInfo")) { + List<HealthCheckInfo> componentsInfo = mapper.convertValue(healthCheckMap.get("componentsInfo"), new TypeReference<List<HealthCheckInfo>>() {}); + return componentsInfo; + } else { + description = "Internal components are missing"; + } + } catch (JsonSyntaxException e) { + log.error("{} Unexpected response body ", baseComponent, e); + description = baseComponent + " Unexpected response body. Response code: " + beStatus; + } } else { description = "Response code: " + beStatus; + log.trace("{} Health Check Response code: {}", baseComponent, beStatus); } } catch (Exception e) { - log.error("Health Check error when trying to connect to " + baseComponent, e); - description = e.getMessage(); + log.error("{} Unexpected response ", baseComponent, e); + description = baseComponent + " Unexpected response: " + e.getMessage(); } } else { - description = "Incorrect Health Check Url"; + description = baseComponent + " health check Configuration is missing"; } - return Arrays.asList(new HealthCheckInfo(HealthCheckComponent.FE, HealthCheckStatus.DOWN, null, description)); + return Arrays.asList(new HealthCheckInfo(Constants.HC_COMPONENT_FE, HealthCheckStatus.DOWN, null, description)); } private HealthCheckWrapper getBeDownCheckInfos() { List<HealthCheckInfo> healthCheckInfos = new ArrayList<HealthCheckInfo>(); - healthCheckInfos.add(new HealthCheckInfo(HealthCheckComponent.FE, HealthCheckStatus.UP, + healthCheckInfos.add(new HealthCheckInfo(Constants.HC_COMPONENT_FE, HealthCheckStatus.UP, ExternalConfiguration.getAppVersion(), "OK")); - healthCheckInfos.add(new HealthCheckInfo(HealthCheckComponent.BE, HealthCheckStatus.DOWN, null, null)); - healthCheckInfos.add(new HealthCheckInfo(HealthCheckComponent.TITAN, HealthCheckStatus.UNKNOWN, null, null)); - healthCheckInfos.add(new HealthCheckInfo(HealthCheckComponent.CASSANDRA, HealthCheckStatus.UNKNOWN, null, null)); - healthCheckInfos.add(new HealthCheckInfo(HealthCheckComponent.DE, HealthCheckStatus.UNKNOWN, null, null)); - healthCheckInfos.add(new HealthCheckInfo(HealthCheckComponent.ON_BOARDING, HealthCheckStatus.UNKNOWN, null, null)); + healthCheckInfos.add(new HealthCheckInfo(Constants.HC_COMPONENT_BE, HealthCheckStatus.DOWN, null, null)); + healthCheckInfos.add(new HealthCheckInfo(Constants.HC_COMPONENT_TITAN, HealthCheckStatus.UNKNOWN, null, null)); + healthCheckInfos.add(new HealthCheckInfo(Constants.HC_COMPONENT_CASSANDRA, HealthCheckStatus.UNKNOWN, null, null)); + healthCheckInfos.add(new HealthCheckInfo(Constants.HC_COMPONENT_DISTRIBUTION_ENGINE, HealthCheckStatus.UNKNOWN, null, null)); + healthCheckInfos.add(new HealthCheckInfo(Constants.HC_COMPONENT_ON_BOARDING, HealthCheckStatus.UNKNOWN, null, null)); + healthCheckInfos.add(new HealthCheckInfo(Constants.HC_COMPONENT_DCAE, HealthCheckStatus.UNKNOWN, null, null)); HealthCheckWrapper hcWrapper = new HealthCheckWrapper(healthCheckInfos, "UNKNOWN", "UNKNOWN"); return hcWrapper; } @@ -277,11 +314,33 @@ public class HealthCheckService { Configuration.OnboardingConfig onboardingConfig = config.getOnboarding(); - String protocol = onboardingConfig.getProtocol(); - String host = onboardingConfig.getHost(); - Integer port = onboardingConfig.getPort(); - String uri = onboardingConfig.getHealthCheckUri(); + if (onboardingConfig != null) { + String protocol = onboardingConfig.getProtocol(); + String host = onboardingConfig.getHost(); + Integer port = onboardingConfig.getPort(); + String uri = onboardingConfig.getHealthCheckUri(); + + return protocol + "://" + host + ":" + port + uri; + } + + log.error("onboarding health check configuration is missing."); + return null; + } + + private String buildDcaeHealthCheckUrl(Configuration config) { + + Configuration.DcaeConfig dcaeConfig = config.getDcae(); + + if (dcaeConfig != null) { + String protocol = dcaeConfig.getProtocol(); + String host = dcaeConfig.getHost(); + Integer port = dcaeConfig.getPort(); + String uri = dcaeConfig.getHealthCheckUri(); + + return protocol + "://" + host + ":" + port + uri; + } - return protocol + "://" + host + ":" + port + uri; + log.error("dcae health check configuration is missing."); + return null; } } @@ -32,6 +32,12 @@ onboarding: port: 8181 healthCheckUri: "/onboarding/v1.0/healthcheck" +dcae: + protocol: http + host: localhost + port: 8181 + healthCheckUri: "/dcae/healthCheck" + identificationHeaderFields: - - &HTTP_IV_USER HTTP_IV_USER @@ -1,10 +1,6 @@ package org.openecomp.sdc.fe; -import javax.annotation.Generated; -import javax.servlet.FilterChain; import javax.servlet.FilterConfig; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; import org.junit.Test; @@ -1,16 +1,8 @@ package org.openecomp.sdc.fe.client; -import java.util.List; - -import javax.annotation.Generated; import javax.net.ssl.HostnameVerifier; -import javax.ws.rs.container.AsyncResponse; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.impl.client.CloseableHttpClient; -import org.eclipse.jetty.http.HttpGenerator.ResponseInfo; import org.junit.Test; -import org.openecomp.sdc.fe.impl.HttpRequestInfo; public class BackendClientTest { @@ -1,7 +1,5 @@ package org.openecomp.sdc.fe.listen; -import javax.annotation.Generated; - import org.junit.Test; import com.fasterxml.jackson.databind.ObjectMapper; @@ -1,15 +1,9 @@ package org.openecomp.sdc.fe.servlets; -import java.util.List; - -import javax.annotation.Generated; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.junit.Test; -import org.openecomp.sdc.common.impl.MutableHttpServletRequest; - -import io.netty.handler.codec.http2.Http2FrameReader.Configuration; public class PortalServletTest { diff --git a/catalog-model/.gitignore b/catalog-model/.gitignore deleted file mode 100644 index d9d66d8144..0000000000 --- a/ catalog-model/.gitignore+++ /dev/null @@ -1,2 +0,0 @@ -/target -/bin/ @@ -12,8 +12,11 @@ <version>1.2.0-SNAPSHOT</version> </parent> - <dependencies> + <properties> + <sonar.skip>true</sonar.skip> + </properties> + <dependencies> <!-- Common of SDC --> <dependency> <groupId>org.openecomp.sdc</groupId> @@ -178,8 +181,7 @@ <dependency> <groupId>org.mockito</groupId> - <artifactId>mockito-all</artifactId> - <version>${mockito.version}</version> + <artifactId>mockito-core</artifactId> <scope>test</scope> </dependency> @@ -23,9 +23,9 @@ package org.openecomp.sdc.be.model; import java.io.Serializable; import java.util.ArrayList; import java.util.List; +import java.util.stream.Collectors; import org.openecomp.sdc.be.datatypes.elements.CapabilityDataDefinition; -import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; /** * Specifies the capabilities that the Node Type exposes. @@ -59,7 +59,7 @@ public class CapabilityDefinition extends CapabilityDataDefinition implements Se super((CapabilityDefinition)other); if (other.properties != null) { - this.properties = new ArrayList<>(other.properties); + this.properties = new ArrayList<>(other.properties.stream().map(p -> new ComponentInstanceProperty(p)).collect(Collectors.toList())); } } @@ -0,0 +1,39 @@ +package org.openecomp.sdc.be.model; + +import java.io.Serializable; + +import org.openecomp.sdc.be.datatypes.elements.CapabilityDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.RequirementDataDefinition; +/** + * Contains the Capability, Requirement and Relationship info + */ +public class CapabilityRequirementRelationship implements Serializable { + + private static final long serialVersionUID = 1L; + + private RelationshipInfo relation; + private CapabilityDataDefinition capability; + private RequirementDataDefinition requirement; + + public RelationshipInfo getRelation() { + return relation; + } + public void setRelation(RelationshipInfo relation) { + this.relation = relation; + } + public CapabilityDataDefinition getCapability() { + return capability; + } + public void setCapability(CapabilityDataDefinition capability) { + this.capability = capability; + } + public RequirementDataDefinition getRequirement() { + return requirement; + } + public void setRequirement(RequirementDataDefinition requirement) { + this.requirement = requirement; + } + public static long getSerialversionuid() { + return serialVersionUID; + } +} @@ -28,12 +28,14 @@ import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Optional; +import java.util.stream.Collectors; import org.codehaus.jackson.annotate.JsonIgnore; import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.model.category.CategoryDefinition; import org.openecomp.sdc.be.model.category.SubCategoryDefinition; +import org.openecomp.sdc.common.api.ArtifactTypeEnum; public abstract class Component implements Serializable { @@ -342,6 +344,27 @@ public abstract class Component implements Serializable { return componentInstances; } + public Map<String, ArtifactDefinition> safeGetComponentInstanceDeploymentArtifacts(String componentInstanceId) { + Optional<ComponentInstance> componentInstanceById = getComponentInstanceById(componentInstanceId); + Map<String, ArtifactDefinition> instanceDeploymentArtifacts = componentInstanceById.get().safeGetDeploymentArtifacts(); + return instanceDeploymentArtifacts != null ? instanceDeploymentArtifacts : Collections.EMPTY_MAP; + } + + public Map<String, ArtifactDefinition> safeGetComponentInstanceInformationalArtifacts(String componentInstanceId) { + Optional<ComponentInstance> componentInstanceById = getComponentInstanceById(componentInstanceId); + Map<String, ArtifactDefinition> instanceInformationalArtifacts = componentInstanceById.get().safeGetInformationalArtifacts(); + return instanceInformationalArtifacts != null ? instanceInformationalArtifacts : Collections.EMPTY_MAP; + } + + public List<ArtifactDefinition> safeGetComponentInstanceHeatArtifacts(String componentInstanceId) { + Optional<ComponentInstance> componentInstanceById = getComponentInstanceById(componentInstanceId); + List<ArtifactDefinition> instanceHeatEnvArtifacts = Optional.ofNullable(componentInstanceById.get().safeGetDeploymentArtifacts().values()).orElse(new ArrayList<ArtifactDefinition>()) + .stream() + .filter(artifact -> artifact.getArtifactType() != null && artifact.getArtifactType().equals(ArtifactTypeEnum.HEAT_ENV.name())) + .collect(Collectors.toList()); + return instanceHeatEnvArtifacts == null ? Collections.EMPTY_LIST : instanceHeatEnvArtifacts; + } + public void setComponentInstances(List<ComponentInstance> resourceInstances) { this.componentInstances = resourceInstances; } @@ -358,6 +381,14 @@ public abstract class Component implements Serializable { return componentInstancesProperties; } + public List<ComponentInstanceProperty> safeGetComponentInstanceProperties(String cmptInstacneId) { + return this.safeGetComponentInstanceEntity(cmptInstacneId, this.componentInstancesProperties); + } + + public List<ComponentInstanceInput> safeGetComponentInstanceInput(String comptInstanceId) { + return this.safeGetComponentInstanceEntity(comptInstanceId, this.componentInstancesInputs); + } + public void setComponentInstancesProperties( Map<String, List<ComponentInstanceProperty>> resourceInstancesProperties) { this.componentInstancesProperties = resourceInstancesProperties; @@ -411,6 +442,10 @@ public abstract class Component implements Serializable { componentMetadataDefinition.getMetadataDataDefinition().setInvariantUUID(invariantUUID); } + public Optional<ComponentInstance> getComponentInstanceById(String id) { + return componentInstances.stream().filter(instance -> id.equals(instance.getUniqueId())).findFirst(); + } + public List<GroupDefinition> getGroups() { return groups; } @@ -632,6 +667,30 @@ public abstract class Component implements Serializable { return componentInstancesInputs; } + public List<ComponentInstanceInput> safeGetComponentInstanceInputsByName(String cmptInstanceName) { + List<ComponentInstanceInput> emptyPropsList = Collections.emptyList(); + if (this.componentInstancesInputs == null) { + return emptyPropsList; + } + Optional<List<ComponentInstanceInput>> instanceInputsByName = this.componentInstances.stream() + .filter(ci -> ci.getName().equals(cmptInstanceName)) + .map(ComponentInstance::getUniqueId) + .map(instanceId -> safeGetComponentInstanceEntity(instanceId, this.componentInstancesInputs)) + .findAny(); + return instanceInputsByName.orElse(emptyPropsList); + } + + private <T> List<T> safeGetComponentInstanceEntity(String cmptInstanceId, Map<String, List<T>> instanceEntities) { + List<T> emptyPropsList = Collections.emptyList(); + if (instanceEntities == null) { + return emptyPropsList; + } + List<T> cmptInstanceProps = instanceEntities.get(cmptInstanceId); + return cmptInstanceProps == null ? emptyPropsList : cmptInstanceProps; + } + + + public void setComponentInstancesInputs(Map<String, List<ComponentInstanceInput>> componentInstancesInputs) { this.componentInstancesInputs = componentInstancesInputs; } @@ -21,6 +21,7 @@ package org.openecomp.sdc.be.model; import java.io.Serializable; +import java.util.Collections; import java.util.List; import java.util.Map; @@ -67,6 +68,14 @@ public class ComponentInstance extends ComponentInstanceDataDefinition implement return deploymentArtifacts; } + public Map<String, ArtifactDefinition> safeGetDeploymentArtifacts() { + return deploymentArtifacts == null ? Collections.EMPTY_MAP : deploymentArtifacts; + } + + public Map<String, ArtifactDefinition> safeGetInformationalArtifacts() { + return artifacts == null ? Collections.EMPTY_MAP : deploymentArtifacts; + } + public void setDeploymentArtifacts(Map<String, ArtifactDefinition> deploymentArtifacts) { this.deploymentArtifacts = deploymentArtifacts; } @@ -75,6 +84,10 @@ public class ComponentInstance extends ComponentInstanceDataDefinition implement return artifacts; } + public Map<String, ArtifactDefinition> safeGetArtifacts() { + return artifacts == null ? Collections.EMPTY_MAP : artifacts; + } + public void setArtifacts(Map<String, ArtifactDefinition> artifacts) { this.artifacts = artifacts; } @@ -86,5 +99,9 @@ public class ComponentInstance extends ComponentInstanceDataDefinition implement public void setGroupInstances(List<GroupInstance> groupInstances) { this.groupInstances = groupInstances; } + + public String getActualComponentUid() { + return getIsProxy() ? getSourceModelUid() : getComponentUid(); + } } @@ -21,7 +21,6 @@ package org.openecomp.sdc.be.model; import java.io.Serializable; -import java.util.Map; public class ComponentInstancePropInput extends ComponentInstanceProperty implements Serializable{ /** @@ -24,8 +24,6 @@ import java.util.List; import org.openecomp.sdc.be.datatypes.elements.DataTypeDataDefinition; -import com.fasterxml.jackson.annotation.JsonIgnore; - public class DataTypeDefinition extends DataTypeDataDefinition { // @JsonIgnore @@ -20,13 +20,12 @@ package org.openecomp.sdc.be.model; -import fj.data.Either; +import java.util.List; + import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; -import org.openecomp.sdc.be.model.jsontitan.datamodel.NodeType; -import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; -import java.util.List; +import fj.data.Either; public interface DerivedNodeTypeResolver { @@ -23,6 +23,7 @@ package org.openecomp.sdc.be.model; import java.io.Serializable; import java.util.List; import java.util.stream.Collectors; + import org.openecomp.sdc.be.datatypes.elements.GroupInstanceDataDefinition; import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; @@ -20,7 +20,6 @@ package org.openecomp.sdc.be.model; -import org.apache.commons.lang.StringUtils; import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; public class GroupProperty extends PropertyDefinition { @@ -20,6 +20,8 @@ package org.openecomp.sdc.be.model; +import org.openecomp.sdc.be.model.jsontitan.datamodel.NodeType; + /** * Specifies an implementation artifact for interfaces or operations of a * {@link NodeType node type} or {@link RelationshipType relation type}. @@ -21,12 +21,10 @@ package org.openecomp.sdc.be.model; import java.io.Serializable; -import java.util.HashMap; import java.util.Map; import java.util.stream.Collectors; import org.codehaus.jackson.annotate.JsonIgnore; -import org.openecomp.sdc.be.datatypes.elements.AdditionalInfoParameterDataDefinition; import org.openecomp.sdc.be.datatypes.elements.InterfaceDataDefinition; import org.openecomp.sdc.be.datatypes.elements.OperationDataDefinition; @@ -22,6 +22,7 @@ package org.openecomp.sdc.be.model; import java.io.Serializable; import java.util.List; + import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; @@ -21,7 +21,6 @@ package org.openecomp.sdc.be.model; import org.openecomp.sdc.be.datatypes.elements.InputsValueDataDefinition; -import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; public class PropertyValueDefinition extends InputsValueDataDefinition implements IOperationParameter { @@ -24,11 +24,8 @@ import java.io.Serializable; import org.openecomp.sdc.be.datatypes.elements.RelationshipInstDataDefinition; -public class RequirementAndRelationshipPair implements Serializable { +public class RelationshipInfo implements Serializable { - /** - * - */ private static final long serialVersionUID = -5763126570618602135L; private String requirement; @@ -43,17 +40,17 @@ public class RequirementAndRelationshipPair implements Serializable { private String capabilityUid; private String requirementUid; - public RequirementAndRelationshipPair() { + public RelationshipInfo() { super(); } - public RequirementAndRelationshipPair(String requirement, RelationshipImpl relationship) { + public RelationshipInfo(String requirement, RelationshipImpl relationship) { super(); this.requirement = requirement; this.relationship = relationship; } - public RequirementAndRelationshipPair(String requirement, RelationshipImpl relationship, String capability) { + public RelationshipInfo(String requirement, RelationshipImpl relationship, String capability) { super(); this.requirement = requirement; this.relationship = relationship; @@ -134,9 +131,16 @@ public class RequirementAndRelationshipPair implements Serializable { if ( savedRelation == null ){ return false; } - if ( !savedRelation.getType().equals(this.getRelationship().getType()) ){ - return false; - } + if(getRelationship().getType() == null ){ + if(savedRelation.getType() != null){ + return false; + } + } + else { + if ( !savedRelation.getType().equals(this.getRelationship().getType()) ){ + return false; + } + } if ( !savedRelation.getCapabilityOwnerId().equals(this.getCapabilityOwnerId()) ){ return false; } @@ -25,6 +25,7 @@ import java.util.List; import java.util.Map; import org.openecomp.sdc.be.config.ConfigurationManager; +import org.openecomp.sdc.be.dao.utils.MapUtil; import org.openecomp.sdc.be.datatypes.components.ResourceMetadataDataDefinition; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; @@ -299,5 +300,15 @@ public class Resource extends Component implements Serializable { public boolean deriveFromGeneric(){ return this.shouldGenerateInputs() || (derivedFrom != null && derivedFrom.contains(fetchGenericTypeToscaNameFromConfig())); } - + + public Map<String, List<RequirementCapabilityRelDef>> groupRelationsByInstanceName(Resource resource) { + Map<String, List<RequirementCapabilityRelDef>> relationsByInstanceId = MapUtil.groupListBy(resource.getComponentInstancesRelations(), RequirementCapabilityRelDef::getFromNode); + return MapUtil.convertMapKeys(relationsByInstanceId, (instId) -> getInstanceNameFromInstanceId(resource, instId)); + } + + private String getInstanceNameFromInstanceId(Resource resource, String instId) { + return resource.getComponentInstanceById(instId).get().getName(); + } + + } @@ -21,6 +21,7 @@ package org.openecomp.sdc.be.model; import java.util.Map; + import org.openecomp.sdc.be.datatypes.components.ServiceMetadataDataDefinition; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElementTypeEnum; @@ -89,7 +90,13 @@ public class Service extends Component { public String getNamingPolicy() { return getServiceMetadataDefinition().getNamingPolicy(); } - + + public String getEnvironmentContext() { return getServiceMetadataDefinition().getEnvironmentContext(); } + + public void setEnvironmentContext(String environmentContext) { + getServiceMetadataDefinition().setEnvironmentContext(environmentContext); + } + public void setServiceType(String serviceType){ getServiceMetadataDefinition().setServiceType(serviceType); } @@ -33,15 +33,13 @@ public class TargetCapabilityRelDef implements Serializable { private String uid; private String toNode; - // private List<ImmutablePair<String, RelationshipImpl>> relationships; - - private List<RequirementAndRelationshipPair> relationships; + private List<CapabilityRequirementRelationship> relationships; public TargetCapabilityRelDef() { super(); } - public TargetCapabilityRelDef(String toNode, List<RequirementAndRelationshipPair> relationships) { + public TargetCapabilityRelDef(String toNode, List<CapabilityRequirementRelationship> relationships) { super(); this.toNode = toNode; this.relationships = relationships; @@ -63,10 +61,15 @@ public class TargetCapabilityRelDef implements Serializable { // this.capabilityOwnerId = capabilityOwnerId; // } - public List<RequirementAndRelationshipPair> getRelationships() { + public List<CapabilityRequirementRelationship> getRelationships() { return relationships; } + + public CapabilityRequirementRelationship getSingleRelationship() {//currently only single relationship is supported + return relationships == null || relationships.isEmpty() ? null : relationships.get(0); + } + public String getUid() { return uid; } @@ -75,7 +78,7 @@ public class TargetCapabilityRelDef implements Serializable { this.uid = uid; } - public void setRelationships(List<RequirementAndRelationshipPair> relationships) { + public void setRelationships(List<CapabilityRequirementRelationship> relationships) { this.relationships = relationships; } @@ -21,7 +21,6 @@ package org.openecomp.sdc.be.model; import java.util.List; -import java.util.Map; import org.openecomp.sdc.be.datatypes.elements.GetInputValueDataDefinition; @@ -20,8 +20,6 @@ package org.openecomp.sdc.be.model; -import java.util.Map; - public class UploadReqInfo extends UploadInfo { /** * specify the node type(Optional by tosca) @@ -39,11 +39,11 @@ import javax.annotation.PostConstruct; import org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.commons.lang3.tuple.ImmutableTriple; import org.openecomp.sdc.be.config.BeEcompErrorManager; -import org.openecomp.sdc.be.config.Configuration; -import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.config.BeEcompErrorManager.ErrorSeverity; +import org.openecomp.sdc.be.config.Configuration; import org.openecomp.sdc.be.config.Configuration.ApplicationL1CacheCatalogInfo; import org.openecomp.sdc.be.config.Configuration.ApplicationL2CacheConfig; +import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.dao.cassandra.CassandraOperationStatus; import org.openecomp.sdc.be.dao.cassandra.ComponentCassandraDao; @@ -58,7 +58,6 @@ import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; -import org.openecomp.sdc.be.model.operations.impl.*; import org.openecomp.sdc.be.resources.data.ComponentCacheData; import org.openecomp.sdc.common.util.SerializationUtils; import org.openecomp.sdc.common.util.ZipUtil; @@ -20,7 +20,8 @@ package org.openecomp.sdc.be.model.cache.jobs; -import fj.data.Either; +import java.util.function.Function; + import org.apache.commons.lang3.tuple.ImmutablePair; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; @@ -31,7 +32,7 @@ import org.openecomp.sdc.be.resources.data.ComponentMetadataData; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.function.Function; +import fj.data.Either; /** * Created by mlando on 9/7/2016. @@ -20,13 +20,9 @@ package org.openecomp.sdc.be.model.cache.jobs; -import fj.data.Either; - import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; -import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.cache.DaoInfo; -import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -20,8 +20,6 @@ package org.openecomp.sdc.be.model.cache.jobs; -import fj.data.Either; - import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; import org.openecomp.sdc.be.model.Component; @@ -31,6 +29,8 @@ import org.openecomp.sdc.be.resources.data.ComponentMetadataData; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import fj.data.Either; + public abstract class Job<E> { private static Logger log = LoggerFactory.getLogger(Job.class.getName()); protected DaoInfo daoInfo; @@ -20,8 +20,6 @@ package org.openecomp.sdc.be.model.cache.jobs; -import fj.data.Either; - import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.cache.DaoInfo; @@ -29,6 +27,8 @@ import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import fj.data.Either; + /** * Created by mlando on 9/20/2016. */ @@ -20,15 +20,14 @@ package org.openecomp.sdc.be.model.cache.workers; +import java.util.concurrent.LinkedBlockingQueue; +import java.util.concurrent.TimeUnit; + import org.openecomp.sdc.be.model.cache.jobs.Job; -import org.openecomp.sdc.be.model.cache.workers.IWorker; import org.openecomp.sdc.be.workers.Worker; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.concurrent.LinkedBlockingQueue; -import java.util.concurrent.TimeUnit; - /** * Created by mlando on 9/6/2016. the class represents a worker the pull job * from a queue and evacuates them. @@ -20,7 +20,11 @@ package org.openecomp.sdc.be.model.cache.workers; -import fj.data.Either; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; @@ -33,8 +37,7 @@ import org.openecomp.sdc.be.resources.data.ComponentMetadataData; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.*; -import java.util.stream.Collectors; +import fj.data.Either; /** * the class creates a worker that is used to update cache date, in case of @@ -20,14 +20,12 @@ package org.openecomp.sdc.be.model.heat; -import org.openecomp.sdc.be.model.tosca.converters.DefaultConverter; import org.openecomp.sdc.be.model.tosca.converters.HeatBooleanConverter; import org.openecomp.sdc.be.model.tosca.converters.HeatCommaDelimitedListConverter; import org.openecomp.sdc.be.model.tosca.converters.HeatJsonConverter; import org.openecomp.sdc.be.model.tosca.converters.HeatNumberConverter; import org.openecomp.sdc.be.model.tosca.converters.HeatStringConverter; import org.openecomp.sdc.be.model.tosca.converters.PropertyValueConverter; -import org.openecomp.sdc.be.model.tosca.converters.StringConvertor; import org.openecomp.sdc.be.model.tosca.validators.HeatBooleanValidator; import org.openecomp.sdc.be.model.tosca.validators.HeatCommaDelimitedListValidator; import org.openecomp.sdc.be.model.tosca.validators.HeatNumberValidator; @@ -67,7 +67,11 @@ public class ArtifactsOperations extends BaseOperation { public Either<ArtifactDefinition, StorageOperationStatus> addArifactToComponent(ArtifactDefinition artifactInfo, String parentId, NodeTypeEnum type, boolean failIfExist, String instanceId) { - Either<ArtifactDataDefinition, StorageOperationStatus> status = updateArtifactOnGraph(parentId, artifactInfo, type, artifactInfo.getUniqueId(), instanceId, false); + String artifactId = artifactInfo.getUniqueId(); + if (artifactId == null && artifactInfo.getEsId()!=null) { + artifactId = artifactInfo.getEsId(); + } + Either<ArtifactDataDefinition, StorageOperationStatus> status = updateArtifactOnGraph(parentId, artifactInfo, type, artifactId, instanceId, false, false); if (status.isRight()) { log.debug("Failed to update artifact {} of {} {}. status is {}", artifactInfo.getArtifactName(), type.getName(), parentId, status.right().value()); @@ -86,7 +90,7 @@ public class ArtifactsOperations extends BaseOperation { public Either<ArtifactDefinition, StorageOperationStatus> updateArifactOnResource(ArtifactDefinition artifactInfo, String id, String artifactId, NodeTypeEnum type, String instanceId) { - Either<ArtifactDataDefinition, StorageOperationStatus> status = updateArtifactOnGraph(id, artifactInfo, type, artifactId, instanceId, true); + Either<ArtifactDataDefinition, StorageOperationStatus> status = updateArtifactOnGraph(id, artifactInfo, type, artifactId, instanceId, true, false); if (status.isRight()) { log.debug("Failed to update artifact {} of {} {}. status is {}", artifactInfo.getArtifactName(), type.getName(), id, status.right().value()); @@ -269,8 +273,6 @@ public class ArtifactsOperations extends BaseOperation { } else { updateVersionAndDate(artifactData, oldVesrion); } - long time = System.currentTimeMillis(); - artifactData.setHeatParamsUpdateDate(time); break; case HEAT: case HEAT_NET: @@ -481,7 +483,7 @@ public class ArtifactsOperations extends BaseOperation { } - public Either<ArtifactDataDefinition, StorageOperationStatus> updateArtifactOnGraph(String componentId, ArtifactDefinition artifactInfo, NodeTypeEnum type, String artifactId, String instanceId, boolean isUpdate) { + public Either<ArtifactDataDefinition, StorageOperationStatus> updateArtifactOnGraph(String componentId, ArtifactDefinition artifactInfo, NodeTypeEnum type, String artifactId, String instanceId, boolean isUpdate, boolean isDeletePlaceholder) { Either<ArtifactDataDefinition, StorageOperationStatus> res = null; ArtifactDataDefinition artifactToUpdate = new ArtifactDataDefinition(artifactInfo); ArtifactGroupTypeEnum groupType = artifactInfo.getArtifactGroupType(); @@ -506,7 +508,8 @@ public class ArtifactsOperations extends BaseOperation { uniqueId = UniqueIdBuilder.buildPropertyUniqueId(instanceId, artifactToUpdate.getArtifactLabel()); } artifactToUpdate.setUniqueId(uniqueId); - artifactToUpdate.setEsId(uniqueId); + if(!isDeletePlaceholder) + artifactToUpdate.setEsId(uniqueId); } else artifactToUpdate.setUniqueId(artifactId); @@ -552,7 +555,8 @@ public class ArtifactsOperations extends BaseOperation { String id = type != NodeTypeEnum.ResourceInstance ? componentId : instanceId; String uniqueId = UniqueIdBuilder.buildPropertyUniqueId(id, artifactToUpdate.getArtifactLabel()); artifactToUpdate.setUniqueId(uniqueId); - artifactToUpdate.setEsId(uniqueId); + if(!isDeletePlaceholder) + artifactToUpdate.setEsId(uniqueId); artifactToUpdate.setDuplicated(Boolean.FALSE); } } @@ -25,7 +25,6 @@ import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; -import java.util.Optional; import java.util.UUID; import java.util.stream.Collectors; @@ -90,6 +89,9 @@ public abstract class BaseOperation { @Autowired protected TopologyTemplateOperation topologyTemplateOperation; + public void setTitanDao(TitanDao titanDao) { + this.titanDao = titanDao; + } /** * Returns reference to appropriate toscaTemplateOperation * @@ -20,7 +20,10 @@ package org.openecomp.sdc.be.model.jsontitan.operations; -import fj.data.Either; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; import org.openecomp.sdc.be.dao.jsongraph.TitanDao; import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum; @@ -32,9 +35,7 @@ import org.openecomp.sdc.be.model.LifecycleStateEnum; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import fj.data.Either; @Component("derived-resource-resolver") public class ByToscaNameDerivedNodeTypeResolver implements DerivedNodeTypeResolver { @@ -20,7 +20,12 @@ package org.openecomp.sdc.be.model.jsontitan.operations; -import fj.data.Either; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.stream.Collectors; + import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum; import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum; @@ -46,11 +51,7 @@ import org.openecomp.sdc.common.jsongraph.util.CommonUtility.LogLevelEnum; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import java.util.stream.Collectors; +import fj.data.Either; @org.springframework.stereotype.Component("groups-operation") public class GroupsOperation extends BaseOperation { @@ -21,6 +21,7 @@ package org.openecomp.sdc.be.model.jsontitan.operations; import java.util.ArrayList; +import java.util.EnumMap; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; @@ -30,6 +31,8 @@ import java.util.Map.Entry; import java.util.Optional; import java.util.Set; import java.util.UUID; +import java.util.function.BiConsumer; +import java.util.function.BiPredicate; import java.util.stream.Collectors; import org.apache.commons.collections.CollectionUtils; @@ -59,21 +62,27 @@ import org.openecomp.sdc.be.datatypes.elements.MapGroupsDataDefinition; import org.openecomp.sdc.be.datatypes.elements.MapListCapabiltyDataDefinition; import org.openecomp.sdc.be.datatypes.elements.MapListRequirementDataDefinition; import org.openecomp.sdc.be.datatypes.elements.MapPropertiesDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; import org.openecomp.sdc.be.datatypes.elements.RelationshipInstDataDefinition; import org.openecomp.sdc.be.datatypes.elements.RequirementDataDefinition; import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; import org.openecomp.sdc.be.datatypes.enums.OriginTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; +import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; import org.openecomp.sdc.be.model.ArtifactDefinition; +import org.openecomp.sdc.be.model.CapabilityDefinition; +import org.openecomp.sdc.be.model.CapabilityRequirementRelationship; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.ComponentInstanceInput; import org.openecomp.sdc.be.model.ComponentInstanceProperty; +import org.openecomp.sdc.be.model.ComponentParametersView; import org.openecomp.sdc.be.model.GroupDefinition; import org.openecomp.sdc.be.model.GroupInstance; import org.openecomp.sdc.be.model.RelationshipImpl; -import org.openecomp.sdc.be.model.RequirementAndRelationshipPair; +import org.openecomp.sdc.be.model.RelationshipInfo; import org.openecomp.sdc.be.model.RequirementCapabilityRelDef; +import org.openecomp.sdc.be.model.RequirementDefinition; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.model.jsontitan.datamodel.NodeType; @@ -138,6 +147,7 @@ public class NodeTemplateOperation extends BaseOperation { } if (result == null) { + newInstanceNameRes = buildValidateInstanceName(container, originToscaElement, componentInstance, instanceNumberSuffix); if (newInstanceNameRes.isRight()) { result = Either.right(newInstanceNameRes.right().value()); @@ -155,6 +165,14 @@ public class NodeTemplateOperation extends BaseOperation { } result = Either.right(status); } + if(componentInstance.getOriginType() == OriginTypeEnum.ServiceProxy){ + TopologyTemplate updatedContainer = addComponentInstanceRes.left().value(); + result = addServerCapAndReqToProxyServerInstance( + updatedContainer, componentInstance, componentInstanceData); + + + + } } if (result == null) { result = Either.left(new ImmutablePair<>(addComponentInstanceRes.left().value(), componentInstanceData.getUniqueId())); @@ -162,11 +180,130 @@ public class NodeTemplateOperation extends BaseOperation { return result; } + private Either<ImmutablePair<TopologyTemplate, String>, StorageOperationStatus> addServerCapAndReqToProxyServerInstance(TopologyTemplate updatedContainer, ComponentInstance componentInstance, + + ComponentInstanceDataDefinition componentInstanceData) { + + Either<ImmutablePair<TopologyTemplate, String>, StorageOperationStatus> result; + + + Map<String, MapListCapabiltyDataDefinition> calcCap = updatedContainer.getCalculatedCapabilities(); + Map<String, MapListRequirementDataDefinition> calcReg = updatedContainer.getCalculatedRequirements(); + Map<String, MapCapabiltyProperty> calcCapProp = updatedContainer.getCalculatedCapabilitiesProperties(); + + + Map<String, List<CapabilityDefinition>> additionalCap = componentInstance.getCapabilities(); + Map<String, List<RequirementDefinition>> additionalReq = componentInstance.getRequirements(); + + MapListCapabiltyDataDefinition allCalculatedCap = calcCap==null ||!calcCap.containsKey(componentInstanceData.getUniqueId())?new MapListCapabiltyDataDefinition() :calcCap.get(componentInstanceData.getUniqueId()); + /********capability****************************/ + StorageOperationStatus status = deleteToscaDataDeepElementsBlockToToscaElement(updatedContainer.getUniqueId(), EdgeLabelEnum.CALCULATED_CAPABILITIES, VertexTypeEnum.CALCULATED_CAPABILITIES, componentInstanceData.getUniqueId()); + if (status != StorageOperationStatus.OK && status != StorageOperationStatus.NOT_FOUND) { + CommonUtility.addRecordToLog(logger, LogLevelEnum.DEBUG, "Failed to remove calculated capabilty for instance {} in container {}. error {] ", componentInstanceData.getUniqueId(), updatedContainer.getUniqueId(), status); + return Either.right(status); + } + + if(additionalCap != null && !additionalCap.isEmpty()){ + + Map<String, ListCapabilityDataDefinition> serverCap = additionalCap.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, en -> new ListCapabilityDataDefinition(en.getValue().stream().map(iCap -> new CapabilityDataDefinition(iCap)).collect(Collectors.toList())))); + + serverCap.entrySet().forEach(entryPerType -> { + entryPerType.getValue().getListToscaDataDefinition().forEach(cap -> { + cap.addToPath(componentInstance.getUniqueId()); + allCalculatedCap.add(entryPerType.getKey(), cap); + }); + }); + + status = addToscaDataDeepElementsBlockToToscaElement(updatedContainer.getUniqueId(), EdgeLabelEnum.CALCULATED_CAPABILITIES, VertexTypeEnum.CALCULATED_CAPABILITIES, allCalculatedCap, + componentInstance.getUniqueId()); + + /********capability property****************************/ + status = deleteToscaDataDeepElementsBlockToToscaElement(updatedContainer.getUniqueId(), EdgeLabelEnum.CALCULATED_CAP_PROPERTIES, VertexTypeEnum.CALCULATED_CAP_PROPERTIES, componentInstanceData.getUniqueId()); + if (status != StorageOperationStatus.OK && status != StorageOperationStatus.NOT_FOUND) { + CommonUtility.addRecordToLog(logger, LogLevelEnum.DEBUG, "Failed to remove calculated capabilty properties for instance {} in container {}. error {] ", componentInstanceData.getUniqueId(), updatedContainer.getUniqueId(), status); + return Either.right(status); + } + + + MapCapabiltyProperty allCalculatedCapProp = calcCapProp==null ||!calcCapProp.containsKey(componentInstanceData.getUniqueId())?new MapCapabiltyProperty() :calcCapProp.get(componentInstanceData.getUniqueId()); + + + additionalCap.forEach(new BiConsumer<String, List<CapabilityDefinition>>() { + @Override + public void accept(String s, List<CapabilityDefinition> caps) { + + if (caps != null && !caps.isEmpty()) { + + MapPropertiesDataDefinition dataToCreate = new MapPropertiesDataDefinition(); + + for (CapabilityDefinition cap : caps) { + List<ComponentInstanceProperty> capPrps = cap.getProperties(); + if (capPrps != null) { + + for (ComponentInstanceProperty cip : capPrps) { + dataToCreate.put(cip.getName(), new PropertyDataDefinition(cip)); + } + + + StringBuffer sb = new StringBuffer(componentInstance.getUniqueId()); + sb.append(ModelConverter.CAP_PROP_DELIM); + + sb.append(cap.getOwnerId()); + + sb.append(ModelConverter.CAP_PROP_DELIM).append(s).append(ModelConverter.CAP_PROP_DELIM).append(cap.getName()); + allCalculatedCapProp.put(sb.toString(), dataToCreate); + } + } + + } + + } + }); + + status = addToscaDataDeepElementsBlockToToscaElement(updatedContainer.getUniqueId(), EdgeLabelEnum.CALCULATED_CAP_PROPERTIES, VertexTypeEnum.CALCULATED_CAP_PROPERTIES, allCalculatedCapProp, + componentInstance.getUniqueId()); + } + + /********Requirements property****************************/ + if(additionalReq != null && !additionalReq.isEmpty()){ + + MapListRequirementDataDefinition allCalculatedReq = calcReg==null ||!calcReg.containsKey(componentInstanceData.getUniqueId())?new MapListRequirementDataDefinition() :calcReg.get(componentInstanceData.getUniqueId()); + status = deleteToscaDataDeepElementsBlockToToscaElement(updatedContainer.getUniqueId(), EdgeLabelEnum.CALCULATED_REQUIREMENTS, VertexTypeEnum.CALCULATED_REQUIREMENTS, componentInstanceData.getUniqueId()); + if (status != StorageOperationStatus.OK && status != StorageOperationStatus.NOT_FOUND) { + CommonUtility.addRecordToLog(logger, LogLevelEnum.DEBUG, "Failed to remove calculated Requirements for instance {} in container {}. error {] ", componentInstanceData.getUniqueId(), updatedContainer.getUniqueId(), status); + return Either.right(status); + } + + Map<String, ListRequirementDataDefinition> serverReq = additionalReq.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, en -> new ListRequirementDataDefinition(en.getValue().stream().map(iCap -> new RequirementDataDefinition(iCap)).collect(Collectors.toList())))); + + serverReq.entrySet().forEach(entryPerType -> { + entryPerType.getValue().getListToscaDataDefinition().forEach(cap -> { + cap.addToPath(componentInstance.getUniqueId()); + allCalculatedReq.add(entryPerType.getKey(), cap); + }); + }); + + status = addToscaDataDeepElementsBlockToToscaElement(updatedContainer.getUniqueId(), EdgeLabelEnum.CALCULATED_REQUIREMENTS, VertexTypeEnum.CALCULATED_REQUIREMENTS, allCalculatedReq, + componentInstance.getUniqueId()); + + } + + + Either<ToscaElement, StorageOperationStatus> updatedComponentInstanceRes = topologyTemplateOperation.getToscaElement(updatedContainer.getUniqueId()); + if (updatedComponentInstanceRes.isRight()) { + CommonUtility.addRecordToLog(logger, LogLevelEnum.DEBUG, "Failed to fetch updated topology template {} with new component instance {}. ", updatedContainer.getName(), componentInstance.getName()); + result = Either.right(updatedComponentInstanceRes.right().value()); + } + result = Either.left(new ImmutablePair<>((TopologyTemplate)updatedComponentInstanceRes.left().value(), componentInstanceData.getUniqueId())); + return result; + } + + private Either<String, StorageOperationStatus> buildValidateInstanceName(TopologyTemplate container, ToscaElement originToscaElement, ComponentInstance componentInstance, String instanceNumberSuffix) { Either<String, StorageOperationStatus> result = null; String instanceName = componentInstance.getName(); - if (StringUtils.isEmpty(instanceName) || instanceName.equalsIgnoreCase(originToscaElement.getName())) { + if (StringUtils.isEmpty(instanceName) || instanceName.equalsIgnoreCase(originToscaElement.getName()) || componentInstance.getOriginType() == OriginTypeEnum.ServiceProxy) { instanceName = buildComponentInstanceName(instanceNumberSuffix, instanceName); } else if (!isUniqueInstanceName(container, componentInstance.getName())) { CommonUtility.addRecordToLog(logger, LogLevelEnum.DEBUG, "Failed to create component instance with name {} on component container {}. The instance with the same name already exists. ", componentInstance.getName(), container.getName()); @@ -265,7 +402,7 @@ public class NodeTemplateOperation extends BaseOperation { return result; } - public Either<TopologyTemplate, StorageOperationStatus> updateComponentInstanceMetadataOfTopologyTemplate(TopologyTemplate container) { + public Either<TopologyTemplate, StorageOperationStatus> updateComponentInstanceMetadataOfTopologyTemplate(TopologyTemplate container, ComponentParametersView filter) { Either<TopologyTemplate, StorageOperationStatus> result = null; Either<ToscaElement, StorageOperationStatus> updateContainerComponentRes = null; @@ -291,7 +428,7 @@ public class NodeTemplateOperation extends BaseOperation { } } if (result == null) { - updateContainerComponentRes = topologyTemplateOperation.getToscaElement(containerComponentId); + updateContainerComponentRes = topologyTemplateOperation.getToscaElement(containerComponentId, filter); if (updateContainerComponentRes.isRight()) { CommonUtility.addRecordToLog(logger, LogLevelEnum.DEBUG, "Failed to fetch updated topology template {}. ", container.getName()); result = Either.right(updateContainerComponentRes.right().value()); @@ -368,8 +505,8 @@ public class NodeTemplateOperation extends BaseOperation { Map<String, MapListCapabiltyDataDefinition> calculatedCapabilty = capResult.left().value().getRight(); Either<Pair<GraphVertex, Map<String, MapListCapabiltyDataDefinition>>, StorageOperationStatus> capFullResult = fetchContainerCalculatedCapability(containerV, EdgeLabelEnum.FULLFILLED_CAPABILITIES); - if (capResult.isRight()) { - return capResult.right().value(); + if (capFullResult.isRight()) { + return capFullResult.right().value(); } Map<String, MapListCapabiltyDataDefinition> fullFilledCapabilty = capFullResult.left().value().getRight(); @@ -393,12 +530,12 @@ public class NodeTemplateOperation extends BaseOperation { if (relationToDelete.getFromId().equals(ciToRemove) || relationToDelete.getToId().equals(ciToRemove)) { iterator.remove(); if (relationToDelete.getFromId().equals(ciToRemove)) { - updateCalculatedRequirementsAfterDeleteRelation(calculatedRequirement, fullfilledRequirement, ciToRemove, relationToDelete); - updateCalculatedCapabiltyAfterDeleteRelation(calculatedCapabilty, fullFilledCapabilty, relationToDelete.getToId(), relationToDelete); + updateCalculatedRequirementsAfterDeleteRelation(calculatedRequirement, fullfilledRequirement, ciToRemove, relationToDelete, null); + updateCalculatedCapabiltyAfterDeleteRelation(calculatedCapabilty, fullFilledCapabilty, relationToDelete.getToId(), relationToDelete, null); } if (relationToDelete.getToId().equals(ciToRemove)) { - updateCalculatedRequirementsAfterDeleteRelation(calculatedRequirement, fullfilledRequirement, relationToDelete.getFromId(), relationToDelete); - updateCalculatedCapabiltyAfterDeleteRelation(calculatedCapabilty, fullFilledCapabilty, ciToRemove, relationToDelete); + updateCalculatedRequirementsAfterDeleteRelation(calculatedRequirement, fullfilledRequirement, relationToDelete.getFromId(), relationToDelete, null); + updateCalculatedCapabiltyAfterDeleteRelation(calculatedCapabilty, fullFilledCapabilty, ciToRemove, relationToDelete, null); } } } @@ -594,14 +731,14 @@ public class NodeTemplateOperation extends BaseOperation { if (status != StorageOperationStatus.OK) { return status; } - + return addCalculatedCapReqFromNodeType(originNodeType, componentInstance, updatedContainerVertex); } public MapArtifactDataDefinition prepareInstDeploymentArtifactPerInstance(Map<String, ArtifactDataDefinition> deploymentArtifacts, String componentInstanceId, User user, String envType) { if (deploymentArtifacts != null && envType.equals(HEAT_VF_ENV_NAME)) { Map<String, ArtifactDataDefinition> instDeploymentArtifacts = new HashMap<>(); - + deploymentArtifacts.entrySet().forEach(e -> { ArtifactDataDefinition artifact = e.getValue(); String type = artifact.getArtifactType(); @@ -610,10 +747,10 @@ public class NodeTemplateOperation extends BaseOperation { instDeploymentArtifacts.put(artifactEnv.getArtifactLabel(), artifactEnv); } }); - + deploymentArtifacts.putAll(instDeploymentArtifacts); MapArtifactDataDefinition instArtifacts = new MapArtifactDataDefinition(deploymentArtifacts); - + return instArtifacts; } return null; @@ -744,13 +881,21 @@ public class NodeTemplateOperation extends BaseOperation { sb.append(ModelConverter.CAP_PROP_DELIM).append(instanceId).append(ModelConverter.CAP_PROP_DELIM).append(key); return sb.toString(); } - + + /** + * Prepares a map of capabilities lists + * Produces a deep copy of the received map of capabilities + * Sets values to the specific fields according to received component instance + * @param capabilities + * @param componentInstance + * @return + */ public MapListCapabiltyDataDefinition prepareCalculatedCapabiltyForNodeType(Map<String, ListCapabilityDataDefinition> capabilities, ComponentInstanceDataDefinition componentInstance) { if (capabilities != null) { MapListCapabiltyDataDefinition allCalculatedCap = new MapListCapabiltyDataDefinition(); capabilities.entrySet().forEach(e -> { - List<CapabilityDataDefinition> listCapabilities = e.getValue().getListToscaDataDefinition(); + List<CapabilityDataDefinition> listCapabilities = e.getValue().getListToscaDataDefinition().stream().map(c -> new CapabilityDataDefinition(c)).collect(Collectors.toList()); listCapabilities.forEach(cap -> { cap.setSource(componentInstance.getComponentUid()); cap.addToPath(componentInstance.getUniqueId()); @@ -765,13 +910,21 @@ public class NodeTemplateOperation extends BaseOperation { return null; } + /** + * Prepares a map of requirements lists + * Produces a deep copy of the received map of requirements + * Sets values to the specific fields according to received component instance + * @param requirements + * @param componentInstance + * @return + */ public MapListRequirementDataDefinition prepareCalculatedRequirementForNodeType(Map<String, ListRequirementDataDefinition> requirements, ComponentInstanceDataDefinition componentInstance) { if (requirements != null) { MapListRequirementDataDefinition allCalculatedReq = new MapListRequirementDataDefinition(); requirements.entrySet().forEach(e -> { - List<RequirementDataDefinition> listCapabilities = e.getValue().getListToscaDataDefinition(); - listCapabilities.forEach(req -> { + List<RequirementDataDefinition> listRequirements = e.getValue().getListToscaDataDefinition().stream().map(r -> new RequirementDataDefinition(r)).collect(Collectors.toList()); + listRequirements.forEach(req -> { req.setSource(componentInstance.getComponentUid()); req.addToPath(componentInstance.getUniqueId()); req.setOwnerId(componentInstance.getUniqueId()); @@ -809,8 +962,6 @@ public class NodeTemplateOperation extends BaseOperation { return result; } - - private ComponentInstanceDataDefinition buildComponentInstanceDataDefinition(ComponentInstance resourceInstance, String containerComponentId, String instanceNewName, boolean generateUid, ToscaElement originToscaElement) { String ciOriginComponentUid = resourceInstance.getComponentUid(); @@ -845,7 +996,7 @@ public class NodeTemplateOperation extends BaseOperation { dataDefinition.setComponentVersion((String) originToscaElement.getMetadataValue(JsonPresentationFields.VERSION)); if (StringUtils.isEmpty(dataDefinition.getComponentName()) && originToscaElement != null) dataDefinition.setComponentName((String) originToscaElement.getMetadataValue(JsonPresentationFields.NAME)); - if (originToscaElement != null) + if (originToscaElement != null && dataDefinition.getToscaComponentName() == null) dataDefinition.setToscaComponentName((String) originToscaElement.getMetadataValue(JsonPresentationFields.TOSCA_RESOURCE_NAME)); if (dataDefinition.getOriginType() == null && originToscaElement != null) { ResourceTypeEnum resourceType = originToscaElement.getResourceType(); @@ -869,11 +1020,20 @@ public class NodeTemplateOperation extends BaseOperation { case PNF: originType = OriginTypeEnum.PNF; break; + case ServiceProxy: + originType = OriginTypeEnum.ServiceProxy; + break; + case Configuration: + originType = OriginTypeEnum.Configuration; + break; default: break; } dataDefinition.setOriginType(originType); } + if(dataDefinition.getOriginType() == OriginTypeEnum.ServiceProxy) + dataDefinition.setIsProxy(true); + return dataDefinition; } @@ -888,10 +1048,6 @@ public class NodeTemplateOperation extends BaseOperation { return isUniqueName; } - - - - private String buildComponentInstanceName(String instanceSuffixNumber, String instanceName) { return instanceName + " " + (instanceSuffixNumber == null ? 0 : instanceSuffixNumber); } @@ -907,7 +1063,7 @@ public class NodeTemplateOperation extends BaseOperation { } @SuppressWarnings({ "unchecked" }) - public Either<List<RequirementCapabilityRelDef>, StorageOperationStatus> associateResourceInstances(String componentId, List<RequirementCapabilityRelDef> relations) { + public <T extends ToscaDataDefinition> Either<List<RequirementCapabilityRelDef>, StorageOperationStatus> associateResourceInstances(String componentId, List<RequirementCapabilityRelDef> relations) { Either<GraphVertex, TitanOperationStatus> containerVEither = titanDao.getVertexById(componentId, JsonParseFlagEnum.ParseAll); if (containerVEither.isRight()) { @@ -916,7 +1072,7 @@ public class NodeTemplateOperation extends BaseOperation { return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(error)); } GraphVertex containerV = containerVEither.left().value(); - List<RequirementAndRelationshipPair> relationshipsResult = new ArrayList<RequirementAndRelationshipPair>(); + List<CapabilityRequirementRelationship> relationshipsResult = new ArrayList<>(); Either<Pair<GraphVertex, Map<String, MapListCapabiltyDataDefinition>>, StorageOperationStatus> capResult = fetchContainerCalculatedCapability(containerV, EdgeLabelEnum.CALCULATED_CAPABILITIES); if (capResult.isRight()) { return Either.right(capResult.right().value()); @@ -952,17 +1108,17 @@ public class NodeTemplateOperation extends BaseOperation { String fromNode = relation.getFromNode(); String toNode = relation.getToNode(); - List<RequirementAndRelationshipPair> relationships = relation.getRelationships(); + List<CapabilityRequirementRelationship> relationships = relation.getRelationships(); if (relationships == null || relationships.isEmpty()) { BeEcompErrorManager.getInstance().logBeFailedAddingResourceInstanceError("AssociateResourceInstances - missing relationship", fromNode, componentId); CommonUtility.addRecordToLog(logger, LogLevelEnum.DEBUG, "No requirement definition sent in order to set the relation between {} to {}", fromNode, toNode); return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(TitanOperationStatus.ILLEGAL_ARGUMENT)); } - for (RequirementAndRelationshipPair immutablePair : relationships) { - String requirement = immutablePair.getRequirement(); + for (CapabilityRequirementRelationship immutablePair : relationships) { + String requirement = immutablePair.getRelation().getRequirement(); - Either<RelationshipInstDataDefinition, StorageOperationStatus> associateRes = connectInstancesInContainer(fromNode, toNode, immutablePair, calculatedCapabilty, calculatedRequirement, fullFilledCapabilty, fullfilledRequirement, + Either<Map<JsonPresentationFields, T>, StorageOperationStatus> associateRes = connectInstancesInContainer(fromNode, toNode, immutablePair.getRelation(), calculatedCapabilty, calculatedRequirement, fullFilledCapabilty, fullfilledRequirement, compositionDataDefinition, containerV.getUniqueId()); if (associateRes.isRight()) { @@ -972,16 +1128,22 @@ public class NodeTemplateOperation extends BaseOperation { return Either.right(status); } - RelationshipInstDataDefinition relationshipInstData = associateRes.left().value(); + RelationshipInstDataDefinition relationshipInstData = (RelationshipInstDataDefinition) associateRes.left().value().get(JsonPresentationFields.RELATIONSHIP); RelationshipImpl relationshipImplResult = new RelationshipImpl(); relationshipImplResult.setType(relationshipInstData.getType()); - RequirementAndRelationshipPair requirementAndRelationshipPair = new RequirementAndRelationshipPair(requirement, relationshipImplResult); - requirementAndRelationshipPair.setCapability(immutablePair.getCapability()); + RelationshipInfo requirementAndRelationshipPair = new RelationshipInfo(requirement, relationshipImplResult); + requirementAndRelationshipPair.setCapability(immutablePair.getRelation().getCapability()); + requirementAndRelationshipPair.setRequirement(immutablePair.getRelation().getRequirement()); requirementAndRelationshipPair.setCapabilityOwnerId(relationshipInstData.getCapabilityOwnerId()); requirementAndRelationshipPair.setRequirementOwnerId(relationshipInstData.getRequirementOwnerId()); - requirementAndRelationshipPair.setCapabilityUid(immutablePair.getCapabilityUid()); - requirementAndRelationshipPair.setRequirementUid(immutablePair.getRequirementUid()); - relationshipsResult.add(requirementAndRelationshipPair); + requirementAndRelationshipPair.setCapabilityUid(immutablePair.getRelation().getCapabilityUid()); + requirementAndRelationshipPair.setRequirementUid(immutablePair.getRelation().getRequirementUid()); + requirementAndRelationshipPair.setId(relationshipInstData.getUniqueId()); + CapabilityRequirementRelationship capReqRel = new CapabilityRequirementRelationship(); + capReqRel.setRelation(requirementAndRelationshipPair); + capReqRel.setCapability((CapabilityDataDefinition) associateRes.left().value().get(JsonPresentationFields.CAPAPILITY)); + capReqRel.setRequirement((RequirementDataDefinition) associateRes.left().value().get(JsonPresentationFields.REQUIREMENT)); + relationshipsResult.add(capReqRel); CommonUtility.addRecordToLog(logger, LogLevelEnum.DEBUG, "update customization UUID for from CI {} and to CI {}", relation.getFromNode(), relation.getToNode()); status = updateCustomizationUUID(relation.getFromNode(), compositionDataDefinition); if (status != StorageOperationStatus.OK) { @@ -1088,7 +1250,7 @@ public class NodeTemplateOperation extends BaseOperation { } Map<String, RelationshipInstDataDefinition> relations = compositionDataDefinition.getRelations(); - List<RequirementAndRelationshipPair> relationPairList = requirementDef.getRelationships(); + List<CapabilityRequirementRelationship> relationPairList = requirementDef.getRelationships(); Either<Pair<GraphVertex, Map<String, MapListCapabiltyDataDefinition>>, StorageOperationStatus> capResult = fetchContainerCalculatedCapability(containerV, EdgeLabelEnum.CALCULATED_CAPABILITIES); if (capResult.isRight()) { return Either.right(capResult.right().value()); @@ -1114,24 +1276,24 @@ public class NodeTemplateOperation extends BaseOperation { } Map<String, MapListRequirementDataDefinition> fulfilledRequirement = reqFullResult.left().value().getRight(); - for (RequirementAndRelationshipPair relationPair : relationPairList) { + for (CapabilityRequirementRelationship relationPair : relationPairList) { Iterator<Entry<String, RelationshipInstDataDefinition>> iterator = relations.entrySet().iterator(); boolean isDeleted = false; while (iterator.hasNext()) { Entry<String, RelationshipInstDataDefinition> entryInJson = iterator.next(); RelationshipInstDataDefinition relationInJson = entryInJson.getValue(); - if (relationInJson.getFromId().equals(fromResInstanceUid) && relationInJson.getToId().equals(toResInstanceUid)) { - if (relationPair.equalsTo(relationInJson)) { + if (relationInJson.getFromId().equals(fromResInstanceUid) && relationInJson.getToId().equals(toResInstanceUid) && relationInJson.getUniqueId().equals(relationPair.getRelation().getId())) { + if (relationPair.getRelation().equalsTo(relationInJson)) { CommonUtility.addRecordToLog(logger, LogLevelEnum.DEBUG, "Remove relation from {} to {} capability {} capOwnerId {} reqOwnerId {} ", toResInstanceUid, componentId, relationInJson.getType(), relationInJson.getCapabilityOwnerId(), relationInJson.getRequirementOwnerId()); iterator.remove(); // update calculated cap/req - StorageOperationStatus status = updateCalculatedCapabiltyAfterDeleteRelation(calculatedCapability, fulfilledCapability, toResInstanceUid, relationInJson); + StorageOperationStatus status = updateCalculatedCapabiltyAfterDeleteRelation(calculatedCapability, fulfilledCapability, toResInstanceUid, relationInJson, relationPair); if (status != StorageOperationStatus.OK) { return Either.right(status); } - status = updateCalculatedRequirementsAfterDeleteRelation(calculatedRequirement, fulfilledRequirement, fromResInstanceUid, relationInJson); + status = updateCalculatedRequirementsAfterDeleteRelation(calculatedRequirement, fulfilledRequirement, fromResInstanceUid, relationInJson, relationPair); if (status != StorageOperationStatus.OK) { return Either.right(status); } @@ -1139,9 +1301,9 @@ public class NodeTemplateOperation extends BaseOperation { } } } - if (isDeleted == false) { + if (!isDeleted) { CommonUtility.addRecordToLog(logger, LogLevelEnum.DEBUG, "No relation to delete from {} to {} capabilty {} capOwnerId {} reqOwnerId {} ", toResInstanceUid, componentId, relationPair.getCapability(), - relationPair.getCapabilityOwnerId(), relationPair.getRequirementOwnerId()); + relationPair.getRelation().getCapabilityOwnerId(), relationPair.getRelation().getRequirementOwnerId()); return Either.right(StorageOperationStatus.NOT_FOUND); } } @@ -1163,15 +1325,108 @@ public class NodeTemplateOperation extends BaseOperation { return Either.left(requirementDef); } + + /** + * Retrieves fulfilled requirement according to relation and received predicate + * @param componentId + * @param instanceId + * @param foundRelation + * @param predicate + * @return + */ + public Either<RequirementDataDefinition, StorageOperationStatus> getFulfilledRequirementByRelation(String componentId, String instanceId, RequirementCapabilityRelDef foundRelation, BiPredicate<RelationshipInfo, RequirementDataDefinition> predicate) { + + Either<RequirementDataDefinition, StorageOperationStatus> result = null; + Either<Pair<GraphVertex, Map<String, MapListRequirementDataDefinition>>, StorageOperationStatus> reqFullResult = null; + MapListRequirementDataDefinition reqMapOfLists = null; + Optional<RequirementDataDefinition> foundRequirement; + RelationshipInfo relationshipInfo = foundRelation.getSingleRelationship().getRelation(); + Either<GraphVertex, TitanOperationStatus> containerVEither = titanDao.getVertexById(componentId, JsonParseFlagEnum.ParseAll); + if (containerVEither.isRight()) { + TitanOperationStatus error = containerVEither.right().value(); + CommonUtility.addRecordToLog(logger, LogLevelEnum.DEBUG, "Failed to fetch container vertex {} error {}", componentId, error); + result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(error)); + } + if(result == null){ + GraphVertex containerV = containerVEither.left().value(); + reqFullResult = fetchContainerCalculatedRequirement(containerV, EdgeLabelEnum.FULLFILLED_REQUIREMENTS); + if (reqFullResult.isRight()) { + result = Either.right(reqFullResult.right().value()); + } + } + if(result == null){ + Map<String, MapListRequirementDataDefinition> fulfilledRequirement = reqFullResult.left().value().getRight(); + reqMapOfLists = fulfilledRequirement.get(instanceId); + if(reqMapOfLists == null){ + result = Either.right(StorageOperationStatus.NOT_FOUND); + } + } + if(result == null && reqMapOfLists != null){ + for(ListRequirementDataDefinition requirements : reqMapOfLists.getMapToscaDataDefinition().values()){ + foundRequirement = requirements.getListToscaDataDefinition().stream().filter(req -> predicate.test(relationshipInfo, req)).findFirst(); + if(foundRequirement.isPresent()){ + result = Either.left(foundRequirement.get()); + } + } + } + return result; + } + + /** + * Retrieves fulfilled capability according to relation and received predicate + * @param componentId + * @param instanceId + * @param foundRelation + * @param predicate + * @return + */ + public Either<CapabilityDataDefinition, StorageOperationStatus> getFulfilledCapabilityByRelation(String componentId, String instanceId, RequirementCapabilityRelDef foundRelation, BiPredicate<RelationshipInfo, CapabilityDataDefinition> predicate) { + + Either<CapabilityDataDefinition, StorageOperationStatus> result = null; + Either<Pair<GraphVertex, Map<String, MapListCapabiltyDataDefinition>>, StorageOperationStatus> capFullResult = null; + MapListCapabiltyDataDefinition capMapOfLists = null; + Optional<CapabilityDataDefinition> foundRequirement; + + RelationshipInfo relationshipInfo = foundRelation.getSingleRelationship().getRelation(); + Either<GraphVertex, TitanOperationStatus> containerVEither = titanDao.getVertexById(componentId, JsonParseFlagEnum.ParseAll); + if (containerVEither.isRight()) { + TitanOperationStatus error = containerVEither.right().value(); + CommonUtility.addRecordToLog(logger, LogLevelEnum.DEBUG, "Failed to fetch container vertex {} error {}", componentId, error); + result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(error)); + } + if(result == null){ + GraphVertex containerV = containerVEither.left().value(); + capFullResult = fetchContainerCalculatedCapability(containerV, EdgeLabelEnum.FULLFILLED_CAPABILITIES); + if (capFullResult.isRight()) { + result = Either.right(capFullResult.right().value()); + } + } + if(result == null){ + Map<String, MapListCapabiltyDataDefinition> fulfilledCapability = capFullResult.left().value().getRight(); + capMapOfLists = fulfilledCapability.get(instanceId); + if(capMapOfLists == null){ + result = Either.right(StorageOperationStatus.NOT_FOUND); + } + } + if(result == null && capMapOfLists != null){ + for(ListCapabilityDataDefinition capabilities : capMapOfLists.getMapToscaDataDefinition().values()){ + foundRequirement = capabilities.getListToscaDataDefinition().stream().filter(cap -> predicate.test(relationshipInfo, cap)).findFirst(); + if(foundRequirement.isPresent()){ + result = Either.left(foundRequirement.get()); + } + } + } + return result; + } private StorageOperationStatus updateCalculatedRequirementsAfterDeleteRelation(Map<String, MapListRequirementDataDefinition> calculatedRequirement, Map<String, MapListRequirementDataDefinition> fullFilledRequirement, String fromResInstanceUid, - RelationshipInstDataDefinition relation) { + RelationshipInstDataDefinition relation, CapabilityRequirementRelationship relationship) { StorageOperationStatus status; String hereIsTheKey = null; MapListRequirementDataDefinition reqByInstance = calculatedRequirement.get(fromResInstanceUid); if (reqByInstance == null || reqByInstance.findKeyByItemUidMatch(relation.getRequirementId()) == null) { // move from fulfilled - status = moveFromFullFilledRequirement(calculatedRequirement, fullFilledRequirement, fromResInstanceUid, relation, hereIsTheKey); + status = moveFromFullFilledRequirement(calculatedRequirement, fullFilledRequirement, fromResInstanceUid, relation, hereIsTheKey, relationship); } else { hereIsTheKey = reqByInstance.findKeyByItemUidMatch(relation.getRequirementId()); ListRequirementDataDefinition reqByType = reqByInstance.findByKey(hereIsTheKey); @@ -1187,29 +1442,31 @@ public class NodeTemplateOperation extends BaseOperation { ++leftIntValue; requirement.setLeftOccurrences(String.valueOf(leftIntValue)); } + if(relationship != null){ + relationship.setRequirement(requirement); + } status = StorageOperationStatus.OK; } else { // move from fulfilled - status = moveFromFullFilledRequirement(calculatedRequirement, fullFilledRequirement, fromResInstanceUid, relation, hereIsTheKey); + status = moveFromFullFilledRequirement(calculatedRequirement, fullFilledRequirement, fromResInstanceUid, relation, hereIsTheKey, relationship); } } return status; } - private StorageOperationStatus updateCalculatedCapabiltyAfterDeleteRelation(Map<String, MapListCapabiltyDataDefinition> calculatedCapability, Map<String, MapListCapabiltyDataDefinition> fullFilledCapability, String toResInstanceUid, - RelationshipInstDataDefinition relation) { + RelationshipInstDataDefinition relation, CapabilityRequirementRelationship relationship) { StorageOperationStatus status; String hereIsTheKey = null; MapListCapabiltyDataDefinition capByInstance = calculatedCapability.get(toResInstanceUid); if (capByInstance == null || capByInstance.findKeyByItemUidMatch(relation.getCapabilityId()) == null) { // move from fulfilled - status = moveFromFullFilledCapabilty(calculatedCapability, fullFilledCapability, toResInstanceUid, relation, hereIsTheKey); + status = moveFromFullFilledCapabilty(calculatedCapability, fullFilledCapability, toResInstanceUid, relation, hereIsTheKey, relationship); } else { hereIsTheKey = capByInstance.findKeyByItemUidMatch(relation.getCapabilityId()); ListCapabilityDataDefinition capByType = capByInstance.findByKey(hereIsTheKey); - Optional<CapabilityDataDefinition> capabilityOptional = capByType.getListToscaDataDefinition().stream() - .filter(cap -> cap.getOwnerId().equals(relation.getCapabilityOwnerId()) && cap.getUniqueId().equals(relation.getCapabilityId())).findFirst(); + Optional<CapabilityDataDefinition> capabilityOptional = capByType.getListToscaDataDefinition().stream().filter(cap -> cap.getOwnerId().equals(relation.getCapabilityOwnerId()) && cap.getUniqueId().equals(relation.getCapabilityId())) + .findFirst(); if (capabilityOptional.isPresent()) { @@ -1220,17 +1477,20 @@ public class NodeTemplateOperation extends BaseOperation { ++leftIntValue; capability.setLeftOccurrences(String.valueOf(leftIntValue)); } + if(relationship != null){ + relationship.setCapability(capability); + } status = StorageOperationStatus.OK; } else { // move from fulfilled - status = moveFromFullFilledCapabilty(calculatedCapability, fullFilledCapability, toResInstanceUid, relation, hereIsTheKey); + status = moveFromFullFilledCapabilty(calculatedCapability, fullFilledCapability, toResInstanceUid, relation, hereIsTheKey, relationship); } } return status; } private StorageOperationStatus moveFromFullFilledCapabilty(Map<String, MapListCapabiltyDataDefinition> calculatedCapability, Map<String, MapListCapabiltyDataDefinition> fullFilledCapability, String toResInstanceUid, - RelationshipInstDataDefinition relation, String hereIsTheKey) { + RelationshipInstDataDefinition relation, String hereIsTheKey, CapabilityRequirementRelationship relationship) { MapListCapabiltyDataDefinition capByInstance = fullFilledCapability.get(toResInstanceUid); if (capByInstance == null) { CommonUtility.addRecordToLog(logger, LogLevelEnum.DEBUG, "No capability in fulfilled list for instance {} ", toResInstanceUid); @@ -1266,6 +1526,7 @@ public class NodeTemplateOperation extends BaseOperation { mapListCapaDataDef.put(hereIsTheKey, findByKey); } findByKey.add(cap); + relationship.setCapability(cap); break; } } @@ -1277,13 +1538,13 @@ public class NodeTemplateOperation extends BaseOperation { } private StorageOperationStatus moveFromFullFilledRequirement(Map<String, MapListRequirementDataDefinition> calculatedRequirement, Map<String, MapListRequirementDataDefinition> fullFilledRequirement, String fromResInstanceUid, - RelationshipInstDataDefinition relation, String hereIsTheKey) { + RelationshipInstDataDefinition relation, String hereIsTheKey, CapabilityRequirementRelationship relationship) { MapListRequirementDataDefinition reqByInstance = fullFilledRequirement.get(fromResInstanceUid); if (reqByInstance == null) { CommonUtility.addRecordToLog(logger, LogLevelEnum.DEBUG, "No requirement in fullfilled list for instance {} ", fromResInstanceUid); return StorageOperationStatus.GENERAL_ERROR; } - if(null == hereIsTheKey) + if (null == hereIsTheKey) hereIsTheKey = reqByInstance.findKeyByItemUidMatch(relation.getRequirementId()); if (null == hereIsTheKey) { CommonUtility.addRecordToLog(logger, LogLevelEnum.DEBUG, "No requirement with id {} in fulfilled list for instance {} ", relation.getRequirementId(), fromResInstanceUid); @@ -1313,6 +1574,7 @@ public class NodeTemplateOperation extends BaseOperation { mapListReqDataDef.put(hereIsTheKey, findByKey); } findByKey.add(req); + relationship.setRequirement(req); break; } } @@ -1337,7 +1599,7 @@ public class NodeTemplateOperation extends BaseOperation { return StorageOperationStatus.OK; } - public Either<RelationshipInstDataDefinition, StorageOperationStatus> connectInstancesInContainer(String fromResInstanceUid, String toResInstanceUid, RequirementAndRelationshipPair relationPair, + public <T extends ToscaDataDefinition> Either<Map<JsonPresentationFields, T>, StorageOperationStatus> connectInstancesInContainer(String fromResInstanceUid, String toResInstanceUid, RelationshipInfo relationPair, Map<String, MapListCapabiltyDataDefinition> calculatedCapabilty, Map<String, MapListRequirementDataDefinition> calculatedRequirement, Map<String, MapListCapabiltyDataDefinition> fullfilledCapabilty, Map<String, MapListRequirementDataDefinition> fullfilledRequirement, CompositionDataDefinition compositionDataDefinition, String containerId) { String requirement = relationPair.getRequirement(); @@ -1356,19 +1618,19 @@ public class NodeTemplateOperation extends BaseOperation { return Either.right(StorageOperationStatus.NOT_FOUND); } - Either<RelationshipInstDataDefinition, StorageOperationStatus> reqVsCap = connectRequirementVsCapability(fromResourceInstData, toResourceInstData, relationPair, calculatedCapabilty, calculatedRequirement, fullfilledCapabilty, + Either<Map<JsonPresentationFields, T>, StorageOperationStatus> reqVsCap = connectRequirementVsCapability(fromResourceInstData, toResourceInstData, relationPair, calculatedCapabilty, calculatedRequirement, fullfilledCapabilty, fullfilledRequirement, containerId); if (reqVsCap.isRight()) { StorageOperationStatus status = reqVsCap.right().value(); CommonUtility.addRecordToLog(logger, LogLevelEnum.DEBUG, "Failed to connect requirement {} between resource instance {} to resource instance {}. status is {}", requirement, fromResInstanceUid, toResInstanceUid, status); return Either.right(status); } - RelationshipInstDataDefinition relation = reqVsCap.left().value(); + Map<JsonPresentationFields, T> relationship = reqVsCap.left().value(); // add to json new relations - compositionDataDefinition.addRelation(relation.getUniqueId(), relation); + compositionDataDefinition.addRelation(((RelationshipInstDataDefinition)relationship.get(JsonPresentationFields.RELATIONSHIP)).getUniqueId(), (RelationshipInstDataDefinition)relationship.get(JsonPresentationFields.RELATIONSHIP)); - return Either.left(relation); + return Either.left(relationship); } private Either<Pair<GraphVertex, Map<String, MapListCapabiltyDataDefinition>>, StorageOperationStatus> fetchContainerCalculatedCapability(GraphVertex containerV, EdgeLabelEnum capLabel) { @@ -1394,7 +1656,8 @@ public class NodeTemplateOperation extends BaseOperation { return Either.left(calculatedRequirement); } - private Either<RelationshipInstDataDefinition, StorageOperationStatus> connectRequirementVsCapability(ComponentInstanceDataDefinition fromResInstance, ComponentInstanceDataDefinition toResInstance, RequirementAndRelationshipPair relationPair, + @SuppressWarnings("unchecked") + private <T extends ToscaDataDefinition> Either<Map<JsonPresentationFields, T>, StorageOperationStatus> connectRequirementVsCapability(ComponentInstanceDataDefinition fromResInstance, ComponentInstanceDataDefinition toResInstance, RelationshipInfo relationPair, Map<String, MapListCapabiltyDataDefinition> calculatedCapabilty, Map<String, MapListRequirementDataDefinition> calculatedRequirement, Map<String, MapListCapabiltyDataDefinition> fullfilledCapabilty, Map<String, MapListRequirementDataDefinition> fullfilledRequirement, String containerId) { String type = relationPair.getRelationship().getType(); @@ -1402,6 +1665,7 @@ public class NodeTemplateOperation extends BaseOperation { String toInstId = toResInstance.getUniqueId(); MapListCapabiltyDataDefinition mapListCapabiltyDataDefinition = calculatedCapabilty.get(toInstId); + Map<JsonPresentationFields, T> capReqRelationship = new EnumMap<>(JsonPresentationFields.class); if (mapListCapabiltyDataDefinition == null) { CommonUtility.addRecordToLog(logger, LogLevelEnum.DEBUG, "Failed to fetch calculated capabilities for instance {} in container {}.", toInstId, containerId); @@ -1418,6 +1682,7 @@ public class NodeTemplateOperation extends BaseOperation { CapabilityDataDefinition cap = iteratorCap.next(); if (cap.getUniqueId().equals(relationPair.getCapabilityUid()) && cap.getOwnerId().equals(relationPair.getCapabilityOwnerId())) { capabilityForRelation = cap; + capReqRelationship.put(JsonPresentationFields.CAPAPILITY, (T)capabilityForRelation); String leftOccurrences = cap.getLeftOccurrences(); if (leftOccurrences != null && !leftOccurrences.equals(CapabilityDataDefinition.MAX_OCCURRENCES)) { Integer leftIntValue = Integer.parseInt(leftOccurrences); @@ -1473,7 +1738,7 @@ public class NodeTemplateOperation extends BaseOperation { RequirementDataDefinition req = iteratorReq.next(); if (req.getUniqueId().equals(relationPair.getRequirementUid()) && req.getOwnerId().equals(relationPair.getRequirementOwnerId())) { requirementForRelation = req; - + capReqRelationship.put(JsonPresentationFields.REQUIREMENT, (T)requirementForRelation); String leftOccurrences = req.getLeftOccurrences(); if (leftOccurrences != null && !leftOccurrences.equals(RequirementDataDefinition.MAX_OCCURRENCES)) { Integer leftIntValue = Integer.parseInt(leftOccurrences); @@ -1506,17 +1771,19 @@ public class NodeTemplateOperation extends BaseOperation { } } if (!capabilityForRelation.getType().equals(requirementForRelation.getCapability())) { - CommonUtility.addRecordToLog(logger, LogLevelEnum.DEBUG, "No math for capability from type {} and requirement {} from {} to {} in container {}.", capabilityForRelation.getType(), requirementForRelation.getCapability(), fromInstId, toInstId, - containerId); + CommonUtility.addRecordToLog(logger, LogLevelEnum.DEBUG, "No math for capability from type {} and requirement {} from {} to {} in container {}.", capabilityForRelation.getType(), requirementForRelation.getCapability(), fromInstId, + toInstId, containerId); return Either.right(StorageOperationStatus.MATCH_NOT_FOUND); } RelationshipInstDataDefinition relationshipTypeData = buildRelationshipInstData(fromInstId, toInstId, relationPair); - relationshipTypeData.setType(requirementForRelation.getRelationship()); - return Either.left(relationshipTypeData); + if(requirementForRelation.getRelationship() != null) + relationshipTypeData.setType(requirementForRelation.getRelationship()); + capReqRelationship.put(JsonPresentationFields.RELATIONSHIP, (T)relationshipTypeData); + return Either.left(capReqRelationship); } - private RelationshipInstDataDefinition buildRelationshipInstData(String fromResInstanceUid, String toInstId, RequirementAndRelationshipPair relationPair) { + private RelationshipInstDataDefinition buildRelationshipInstData(String fromResInstanceUid, String toInstId, RelationshipInfo relationPair) { RelationshipInstDataDefinition relationshipInstData = new RelationshipInstDataDefinition(); relationshipInstData.setUniqueId(UniqueIdBuilder.buildRelationsipInstInstanceUid(fromResInstanceUid, toInstId)); @@ -1620,13 +1887,13 @@ public class NodeTemplateOperation extends BaseOperation { } public StorageOperationStatus addDeploymentArtifactsToInstance(String toscaElementId, String instanceId, Map<String, ArtifactDataDefinition> instDeplArtifacts) { - return addArtifactsToInstance(toscaElementId, instanceId, instDeplArtifacts, EdgeLabelEnum.INST_DEPLOYMENT_ARTIFACTS, VertexTypeEnum.INST_DEPLOYMENT_ARTIFACTS); + return addArtifactsToInstance(toscaElementId, instanceId, instDeplArtifacts, EdgeLabelEnum.INST_DEPLOYMENT_ARTIFACTS, VertexTypeEnum.INST_DEPLOYMENT_ARTIFACTS); } - + public StorageOperationStatus addInformationalArtifactsToInstance(String toscaElementId, String instanceId, Map<String, ArtifactDataDefinition> instDeplArtifacts) { - return addArtifactsToInstance(toscaElementId, instanceId, instDeplArtifacts, EdgeLabelEnum.INSTANCE_ARTIFACTS, VertexTypeEnum.INSTANCE_ARTIFACTS); + return addArtifactsToInstance(toscaElementId, instanceId, instDeplArtifacts, EdgeLabelEnum.INSTANCE_ARTIFACTS, VertexTypeEnum.INSTANCE_ARTIFACTS); } - + public StorageOperationStatus addArtifactsToInstance(String toscaElementId, String instanceId, Map<String, ArtifactDataDefinition> instDeplArtifacts, EdgeLabelEnum edgeLabel, VertexTypeEnum vertexType) { Either<GraphVertex, TitanOperationStatus> metadataVertex = titanDao.getVertexById(toscaElementId, JsonParseFlagEnum.NoParse); if (metadataVertex.isRight()) { @@ -1637,7 +1904,7 @@ public class NodeTemplateOperation extends BaseOperation { return DaoStatusConverter.convertTitanStatusToStorageStatus(status); } MapArtifactDataDefinition instArtifacts = new MapArtifactDataDefinition(instDeplArtifacts); - return addToscaDataDeepElementsBlockToToscaElement(metadataVertex.left().value(),edgeLabel, vertexType, instArtifacts, instanceId); + return addToscaDataDeepElementsBlockToToscaElement(metadataVertex.left().value(), edgeLabel, vertexType, instArtifacts, instanceId); } @@ -1710,14 +1977,26 @@ public class NodeTemplateOperation extends BaseOperation { pathKeys.add(componentInstanceId); return updateToscaDataDeepElementOfToscaElement(containerComponent.getUniqueId(), EdgeLabelEnum.INST_PROPERTIES, VertexTypeEnum.INST_PROPERTIES, property, pathKeys, JsonPresentationFields.NAME); } - - + + public StorageOperationStatus updateComponentInstanceCapabilityProperty(Component containerComponent, String componentInstanceId, String capabilityUniqueId, ComponentInstanceProperty property) { + List<String> pathKeys = new ArrayList<>(); + pathKeys.add(componentInstanceId); + pathKeys.add(capabilityUniqueId); + return updateToscaDataDeepElementOfToscaElement(containerComponent.getUniqueId(), EdgeLabelEnum.CALCULATED_CAP_PROPERTIES, VertexTypeEnum.CALCULATED_CAP_PROPERTIES, property, pathKeys, JsonPresentationFields.NAME); + } + public StorageOperationStatus addComponentInstanceProperty(Component containerComponent, String componentInstanceId, ComponentInstanceProperty property) { List<String> pathKeys = new ArrayList<>(); pathKeys.add(componentInstanceId); return addToscaDataDeepElementToToscaElement(containerComponent.getUniqueId(), EdgeLabelEnum.INST_PROPERTIES, VertexTypeEnum.INST_PROPERTIES, property, pathKeys, JsonPresentationFields.NAME); } + public StorageOperationStatus updateComponentInstanceProperties(Component containerComponent, String componentInstanceId, List<ComponentInstanceProperty> properties) { + List<String> pathKeys = new ArrayList<>(); + pathKeys.add(componentInstanceId); + return updateToscaDataDeepElementsOfToscaElement(containerComponent.getUniqueId(), EdgeLabelEnum.INST_PROPERTIES, VertexTypeEnum.INST_PROPERTIES, properties, pathKeys, JsonPresentationFields.NAME); + } + public StorageOperationStatus updateComponentInstanceInput(Component containerComponent, String componentInstanceId, ComponentInstanceInput property) { List<String> pathKeys = new ArrayList<>(); @@ -1725,11 +2004,16 @@ public class NodeTemplateOperation extends BaseOperation { return updateToscaDataDeepElementOfToscaElement(containerComponent.getUniqueId(), EdgeLabelEnum.INST_INPUTS, VertexTypeEnum.INST_INPUTS, property, pathKeys, JsonPresentationFields.NAME); } + public StorageOperationStatus updateComponentInstanceInputs(Component containerComponent, String componentInstanceId, List<ComponentInstanceInput> properties) { + List<String> pathKeys = new ArrayList<>(); + pathKeys.add(componentInstanceId); + return updateToscaDataDeepElementsOfToscaElement(containerComponent.getUniqueId(), EdgeLabelEnum.INST_INPUTS, VertexTypeEnum.INST_INPUTS, properties, pathKeys, JsonPresentationFields.NAME); + } + public StorageOperationStatus addComponentInstanceInput(Component containerComponent, String componentInstanceId, ComponentInstanceInput property) { List<String> pathKeys = new ArrayList<>(); pathKeys.add(componentInstanceId); return addToscaDataDeepElementToToscaElement(containerComponent.getUniqueId(), EdgeLabelEnum.INST_INPUTS, VertexTypeEnum.INST_INPUTS, property, pathKeys, JsonPresentationFields.NAME); } - } @@ -20,7 +20,15 @@ package org.openecomp.sdc.be.model.jsontitan.operations; -import fj.data.Either; +import java.util.ArrayList; +import java.util.Collection; +import java.util.EnumSet; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.regex.Pattern; import java.util.stream.Collectors; import org.apache.tinkerpop.gremlin.structure.Direction; @@ -54,16 +62,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Qualifier; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.EnumSet; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.regex.Pattern; +import fj.data.Either; @org.springframework.stereotype.Component("node-type-operation") public class NodeTypeOperation extends ToscaElementOperation { @@ -472,20 +471,27 @@ public class NodeTypeOperation extends ToscaElementOperation { }); ToscaDataDefinition.mergeDataMaps(capabiltiesAll, capabilties); + capabiltiesAll.values().forEach(l -> { + l.getListToscaDataDefinition().forEach(c -> { + List<String> capabilitySources = c.getCapabilitySources(); + if (capabilitySources == null) { + capabilitySources = new ArrayList<>(); + } + capabilitySources.add((String) nodeType.getMetadataValue(JsonPresentationFields.TOSCA_RESOURCE_NAME)); + c.setCapabilitySources(capabilitySources); + }); + }); } - capabiltiesAll.values().forEach(l -> { - l.getListToscaDataDefinition().forEach(c -> { - List<String> capabilitySources = c.getCapabilitySources(); - if ( capabilitySources == null ){ - capabilitySources = new ArrayList<>(); - } - capabilitySources.add((String) nodeType.getMetadataValue(JsonPresentationFields.TOSCA_RESOURCE_NAME)); - c.setCapabilitySources(capabilitySources); - }); - }); - - + l.getListToscaDataDefinition().forEach(c -> { + List<String> capabilitySources = c.getCapabilitySources(); + if (capabilitySources == null) { + capabilitySources = new ArrayList<>(); + } + capabilitySources.add((String) nodeType.getMetadataValue(JsonPresentationFields.TOSCA_RESOURCE_NAME)); + c.setCapabilitySources(capabilitySources); + }); + }); if (!capabiltiesAll.isEmpty()) { Either<GraphVertex, StorageOperationStatus> assosiateElementToData = assosiateElementToData(nodeTypeVertex, VertexTypeEnum.CAPABILTIES, EdgeLabelEnum.CAPABILITIES, capabiltiesAll); if (assosiateElementToData.isRight()) { @@ -514,7 +520,7 @@ public class NodeTypeOperation extends ToscaElementOperation { p.setUniqueId(uid); }); }); - + ToscaDataDefinition.mergeDataMaps(requirementsAll, requirements); } @@ -615,27 +621,25 @@ public class NodeTypeOperation extends ToscaElementOperation { } return Either.left(derivedResources); } - - Either<List<GraphVertex>, StorageOperationStatus> handleMultipleParent(String parentResource, List<GraphVertex> derivedResource, List<GraphVertex> fetchedDerivedResources){ - + + Either<List<GraphVertex>, StorageOperationStatus> handleMultipleParent(String parentResource, List<GraphVertex> derivedResource, List<GraphVertex> fetchedDerivedResources) { + Either<List<GraphVertex>, StorageOperationStatus> result = Either.left(derivedResource); - try{ - fetchedDerivedResources.sort((d1,d2)->{ - return new Double(Double.parseDouble((String)d1.getMetadataProperty(GraphPropertyEnum.VERSION))) - .compareTo(Double.parseDouble((String)d2.getMetadataProperty(GraphPropertyEnum.VERSION))); + try { + fetchedDerivedResources.sort((d1, d2) -> { + return new Double(Double.parseDouble((String) d1.getMetadataProperty(GraphPropertyEnum.VERSION))).compareTo(Double.parseDouble((String) d2.getMetadataProperty(GraphPropertyEnum.VERSION))); }); - + int actualHighestIndex = fetchedDerivedResources.size() - 1; derivedResource.add(fetchedDerivedResources.get(actualHighestIndex)); fetchedDerivedResources.remove(actualHighestIndex); - + StorageOperationStatus status = fixMultipleParent(fetchedDerivedResources); - if(status != StorageOperationStatus.OK){ + if (status != StorageOperationStatus.OK) { result = Either.right(status); } - } catch (Exception e){ - CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Exception occured during handle multiple parent {}. Exception is {}", - parentResource, e.getMessage()); + } catch (Exception e) { + CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Exception occured during handle multiple parent {}. Exception is {}", parentResource, e.getMessage()); result = Either.right(StorageOperationStatus.GENERAL_ERROR); } return result; @@ -643,13 +647,12 @@ public class NodeTypeOperation extends ToscaElementOperation { private StorageOperationStatus fixMultipleParent(List<GraphVertex> fetchedDerivedResources) { StorageOperationStatus result = StorageOperationStatus.OK; - for(GraphVertex fetchedDerivedResource : fetchedDerivedResources){ + for (GraphVertex fetchedDerivedResource : fetchedDerivedResources) { fetchedDerivedResource.addMetadataProperty(GraphPropertyEnum.IS_HIGHEST_VERSION, false); Either<GraphVertex, TitanOperationStatus> updateVertexRes = titanDao.updateVertex(fetchedDerivedResource); if (updateVertexRes.isRight()) { TitanOperationStatus titatStatus = updateVertexRes.right().value(); - CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to set highest version of node type {} to false. Status is {}", - fetchedDerivedResource.getMetadataProperty(GraphPropertyEnum.TOSCA_RESOURCE_NAME), titatStatus); + CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to set highest version of node type {} to false. Status is {}", fetchedDerivedResource.getMetadataProperty(GraphPropertyEnum.TOSCA_RESOURCE_NAME), titatStatus); result = DaoStatusConverter.convertTitanStatusToStorageStatus(titatStatus); break; } @@ -805,9 +808,9 @@ public class NodeTypeOperation extends ToscaElementOperation { return StorageOperationStatus.OK; } - + private StorageOperationStatus associateDerivedDataByType(EdgeLabelEnum edgeLabel, GraphVertex nodeTypeV, NodeType nodeToUpdate, List<GraphVertex> newDerived) { - + switch (edgeLabel) { case CAPABILITIES: return associateCapabilitiesToResource(nodeTypeV, nodeToUpdate, newDerived); @@ -873,12 +876,24 @@ public class NodeTypeOperation extends ToscaElementOperation { return dataFromDerived.right().value(); } Map<String, T> dataFromDerivedAll = dataFromDerived.left().value(); - + Either<Map<String, T>, String> merged = ToscaDataDefinition.mergeDataMaps(dataFromDerivedAll, mapFromGraph); - if(merged.isRight()){ + if (merged.isRight()) { log.debug("property {} cannot be overriden", merged.right().value()); return StorageOperationStatus.INVALID_PROPERTY; } + if (mergeValues && valuesFrmPrev != null) { + valuesFrmPrev.entrySet().forEach(e -> { + T newData = merged.left().value().get(e.getKey()); + if (newData != null) { + if (isSimpleHierarchy(label)) { + e.getValue().mergeFunction(newData, true); + }else{ + e.getValue().updateIfExist(newData, true); + } + } + }); + } dataV.setJson(dataFromDerivedAll); Either<GraphVertex, TitanOperationStatus> updateDataV = updateOrCopyOnUpdate(dataV, nodeTypeV, label); if (updateDataV.isRight()) { @@ -886,8 +901,8 @@ public class NodeTypeOperation extends ToscaElementOperation { } return StorageOperationStatus.OK; } - - private boolean isSimpleHierarchy(EdgeLabelEnum label) { + + private boolean isSimpleHierarchy(EdgeLabelEnum label) { switch (label) { case PROPERTIES: case ATTRIBUTES: @@ -901,7 +916,6 @@ public class NodeTypeOperation extends ToscaElementOperation { } } - @Override public <T extends ToscaElement> void fillToscaElementVertexData(GraphVertex elementV, T toscaElementToUpdate, JsonParseFlagEnum flag) { fillMetadata(elementV, (NodeType) toscaElementToUpdate); @@ -26,9 +26,10 @@ import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; -import java.util.Optional; import java.util.Map.Entry; +import java.util.stream.Collectors; +import org.apache.commons.collections.MapUtils; import org.apache.tinkerpop.gremlin.structure.Direction; import org.apache.tinkerpop.gremlin.structure.Edge; import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; @@ -51,7 +52,6 @@ import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum; import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; -import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; import org.openecomp.sdc.be.model.ComponentInstanceProperty; import org.openecomp.sdc.be.model.ComponentParametersView; import org.openecomp.sdc.be.model.DistributionStatusEnum; @@ -61,6 +61,7 @@ import org.openecomp.sdc.be.model.jsontitan.datamodel.TopologyTemplate; import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElement; import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElementTypeEnum; import org.openecomp.sdc.be.model.jsontitan.enums.JsonConstantKeysEnum; +import org.openecomp.sdc.be.model.jsontitan.utils.ModelConverter; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.DaoStatusConverter; import org.openecomp.sdc.be.model.operations.impl.UniqueIdBuilder; @@ -1072,5 +1073,69 @@ public class TopologyTemplateOperation extends ToscaElementOperation { } return result; } + /** + * Returns list of ComponentInstanceProperty belonging to component instance capability specified by name and type + * @param componentId + * @param instanceId + * @param capabilityName + * @param capabilityType + * @return + */ + public Either<List<ComponentInstanceProperty>, StorageOperationStatus> getComponentInstanceCapabilityProperties(String componentId, String instanceId, String capabilityName, String capabilityType) { + + Either<List<ComponentInstanceProperty>, StorageOperationStatus> result = null; + Map<String, MapCapabiltyProperty> mapPropertiesDataDefinition = null; + Either<GraphVertex, StorageOperationStatus> componentByLabelAndId = getComponentByLabelAndId(componentId, ToscaElementTypeEnum.TopologyTemplate, JsonParseFlagEnum.NoParse); + if (componentByLabelAndId.isRight()) { + result = Either.right(componentByLabelAndId.right().value()); + } + if(componentByLabelAndId.isLeft()){ + Either<Map<String, MapCapabiltyProperty>, TitanOperationStatus> getDataRes = getDataFromGraph(componentByLabelAndId.left().value(), EdgeLabelEnum.CALCULATED_CAP_PROPERTIES); + if (getDataRes.isRight()) { + result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getDataRes.right().value())); + } else { + mapPropertiesDataDefinition = getDataRes.left().value(); + } + } + if(isNotEmptyMapOfProperties(instanceId, mapPropertiesDataDefinition)){ + result = Either.left(findComponentInstanceCapabilityProperties(instanceId, capabilityName, capabilityType, mapPropertiesDataDefinition.get(instanceId).getMapToscaDataDefinition())); + } + return result; + } + + private boolean isNotEmptyMapOfProperties(String instanceId, Map<String, MapCapabiltyProperty> mapPropertiesDataDefinition) { + return MapUtils.isNotEmpty(mapPropertiesDataDefinition) && + mapPropertiesDataDefinition.get(instanceId) != null && + MapUtils.isNotEmpty(mapPropertiesDataDefinition.get(instanceId).getMapToscaDataDefinition()); + } + + private List<ComponentInstanceProperty> findComponentInstanceCapabilityProperties(String instanceId, String capabilityName, String capabilityType, Map<String, MapPropertiesDataDefinition> propertiesMap) { + List<ComponentInstanceProperty> capPropsList = null; + for(Entry<String, MapPropertiesDataDefinition> capProp : propertiesMap.entrySet()){ + if (isBelongingPropertyMap(instanceId, capabilityName, capabilityType, capProp)) { + Map<String, PropertyDataDefinition> capMap = capProp.getValue().getMapToscaDataDefinition(); + if (capMap != null && !capMap.isEmpty()) { + capPropsList = capMap.values().stream().map(o -> new ComponentInstanceProperty(o)).collect(Collectors.toList()); + break; + } + } + } + if(capPropsList == null){ + capPropsList = new ArrayList<>(); + } + return capPropsList; + } + + private boolean isBelongingPropertyMap(String instanceId, String capabilityName, String capabilityType, Entry<String, MapPropertiesDataDefinition> capProp) { + if (capProp != null) { + String[] path = capProp.getKey().split(ModelConverter.CAP_PROP_DELIM ); + if (path.length < 4) { + log.debug("wrong key format for capabilty, key {}", capProp); + return false; + } + return path[path.length - 2].equals(capabilityType) && path[path.length - 1].equals(capabilityName) && path[0].equals(instanceId); + } + return false; + } } @@ -20,9 +20,16 @@ package org.openecomp.sdc.be.model.jsontitan.operations; -import com.google.gson.Gson; -import com.google.gson.reflect.TypeToken; -import fj.data.Either; +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + import org.apache.tinkerpop.gremlin.structure.Direction; import org.apache.tinkerpop.gremlin.structure.Edge; import org.apache.tinkerpop.gremlin.structure.Vertex; @@ -59,9 +66,10 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import java.lang.reflect.Type; -import java.util.*; -import java.util.Map.Entry; +import com.google.gson.Gson; +import com.google.gson.reflect.TypeToken; + +import fj.data.Either; public abstract class ToscaElementOperation extends BaseOperation { private static Logger log = LoggerFactory.getLogger(ToscaElementOperation.class.getName()); @@ -20,26 +20,68 @@ package org.openecomp.sdc.be.model.jsontitan.operations; -import java.util.*; -import fj.data.Either; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.EnumMap; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; import java.util.Map.Entry; +import java.util.Optional; +import java.util.Set; +import java.util.function.BiPredicate; import java.util.stream.Collectors; + import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.MapUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.tuple.ImmutablePair; -import org.apache.commons.lang3.tuple.Pair; import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; import org.openecomp.sdc.be.dao.jsongraph.TitanDao; import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum; import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum; import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum; import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; -import org.openecomp.sdc.be.datatypes.components.ComponentMetadataDataDefinition; -import org.openecomp.sdc.be.datatypes.components.ResourceMetadataDataDefinition; -import org.openecomp.sdc.be.datatypes.elements.*; -import org.openecomp.sdc.be.datatypes.enums.*; -import org.openecomp.sdc.be.model.*; +import org.openecomp.sdc.be.datatypes.elements.ArtifactDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.CapabilityDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.ComponentInstanceDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.GroupDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.ListCapabilityDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.ListRequirementDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.MapArtifactDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.MapCapabiltyProperty; +import org.openecomp.sdc.be.datatypes.elements.MapListCapabiltyDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.MapListRequirementDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.MapPropertiesDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.RequirementDataDefinition; +import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; +import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum; +import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; +import org.openecomp.sdc.be.datatypes.enums.OriginTypeEnum; +import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; +import org.openecomp.sdc.be.model.ArtifactDefinition; +import org.openecomp.sdc.be.model.CapabilityDefinition; +import org.openecomp.sdc.be.model.Component; +import org.openecomp.sdc.be.model.ComponentInstance; +import org.openecomp.sdc.be.model.ComponentInstanceInput; +import org.openecomp.sdc.be.model.ComponentInstanceProperty; +import org.openecomp.sdc.be.model.ComponentParametersView; +import org.openecomp.sdc.be.model.DistributionStatusEnum; +import org.openecomp.sdc.be.model.GroupDefinition; +import org.openecomp.sdc.be.model.GroupInstance; +import org.openecomp.sdc.be.model.InputDefinition; +import org.openecomp.sdc.be.model.LifecycleStateEnum; +import org.openecomp.sdc.be.model.PropertyDefinition; +import org.openecomp.sdc.be.model.RelationshipInfo; +import org.openecomp.sdc.be.model.RequirementCapabilityRelDef; +import org.openecomp.sdc.be.model.RequirementDefinition; +import org.openecomp.sdc.be.model.Resource; +import org.openecomp.sdc.be.model.Service; +import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.model.jsontitan.datamodel.TopologyTemplate; import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElement; import org.openecomp.sdc.be.model.jsontitan.utils.ModelConverter; @@ -47,7 +89,6 @@ import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.DaoStatusConverter; import org.openecomp.sdc.be.model.operations.impl.UniqueIdBuilder; import org.openecomp.sdc.be.resources.data.ComponentMetadataData; -import org.openecomp.sdc.be.utils.CommonBeUtils; import org.openecomp.sdc.common.jsongraph.util.CommonUtility; import org.openecomp.sdc.common.jsongraph.util.CommonUtility.LogLevelEnum; import org.openecomp.sdc.common.util.ValidationUtils; @@ -55,489 +96,492 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import java.util.*; -import java.util.Map.Entry; -import java.util.stream.Collectors; +import fj.data.Either; @org.springframework.stereotype.Component("tosca-operation-facade") public class ToscaOperationFacade { - @Autowired - private NodeTypeOperation nodeTypeOperation; - @Autowired - private TopologyTemplateOperation topologyTemplateOperation; - @Autowired - private NodeTemplateOperation nodeTemplateOperation; - @Autowired - private GroupsOperation groupsOperation; - @Autowired - private TitanDao titanDao; - - private static Logger log = LoggerFactory.getLogger(ToscaOperationFacade.class.getName()); - - public <T extends Component> Either<T, StorageOperationStatus> getToscaElement(String componentId) { - - return getToscaElement(componentId, JsonParseFlagEnum.ParseAll); - - } - - public <T extends Component> Either<T, StorageOperationStatus> getToscaFullElement(String componentId) { - ComponentParametersView filters = new ComponentParametersView(); - filters.setIgnoreCapabiltyProperties(false); - - return getToscaElement(componentId, filters); - } - - public <T extends Component> Either<T, StorageOperationStatus> getToscaElement(String componentId, ComponentParametersView filters) { - - Either<GraphVertex, TitanOperationStatus> getVertexEither = titanDao.getVertexById(componentId, filters.detectParseFlag()); - if (getVertexEither.isRight()) { - log.debug("Couldn't fetch component with and unique id {}, error: {}", componentId, getVertexEither.right().value()); - return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getVertexEither.right().value())); - - } - return getToscaElementByOperation(getVertexEither.left().value(), filters); - } - - public <T extends Component> Either<T, StorageOperationStatus> getToscaElement(String componentId, JsonParseFlagEnum parseFlag) { - - Either<GraphVertex, TitanOperationStatus> getVertexEither = titanDao.getVertexById(componentId, parseFlag); - if (getVertexEither.isRight()) { - log.debug("Couldn't fetch component with and unique id {}, error: {}", componentId, getVertexEither.right().value()); - return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getVertexEither.right().value())); - - } - return getToscaElementByOperation(getVertexEither.left().value()); - } - - public <T extends Component> Either<T, StorageOperationStatus> getToscaElement(GraphVertex componentVertex) { - return getToscaElementByOperation(componentVertex); - } - - public Either<Boolean, StorageOperationStatus> validateComponentExists(String componentId) { - - Either<GraphVertex, TitanOperationStatus> getVertexEither = titanDao.getVertexById(componentId, JsonParseFlagEnum.NoParse); - if (getVertexEither.isRight()) { - TitanOperationStatus status = getVertexEither.right().value(); - if (status == TitanOperationStatus.NOT_FOUND) { - return Either.left(false); - } else { - log.debug("Couldn't fetch component with and unique id {}, error: {}", componentId, getVertexEither.right().value()); - return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getVertexEither.right().value())); - } - } - return Either.left(true); - } - - public <T extends Component> Either<T, StorageOperationStatus> findLastCertifiedToscaElementByUUID(T component) { - Map<GraphPropertyEnum, Object> props = new HashMap<>(); - props.put(GraphPropertyEnum.UUID, component.getUUID()); - props.put(GraphPropertyEnum.STATE, LifecycleStateEnum.CERTIFIED.name()); - props.put(GraphPropertyEnum.IS_HIGHEST_VERSION, true); - - Either<List<GraphVertex>, TitanOperationStatus> getVertexEither = titanDao.getByCriteria(ModelConverter.getVertexType(component), props); - if (getVertexEither.isRight()) { - log.debug("Couldn't fetch component with and unique id {}, error: {}", component.getUniqueId(), getVertexEither.right().value()); - return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getVertexEither.right().value())); - - } - return getToscaElementByOperation(getVertexEither.left().value().get(0)); - } - - private <T extends Component> Either<T, StorageOperationStatus> getToscaElementByOperation(GraphVertex componentV) { - return getToscaElementByOperation(componentV, new ComponentParametersView()); - } - - private <T extends Component> Either<T, StorageOperationStatus> getToscaElementByOperation(GraphVertex componentV, ComponentParametersView filters) { - VertexTypeEnum label = componentV.getLabel(); - - ToscaElementOperation toscaOperation = getToscaElementOperation(componentV); - Either<ToscaElement, StorageOperationStatus> toscaElement; - String componentId = componentV.getUniqueId(); - if (toscaOperation != null) { - log.debug("Need to fetch tosca element for id {}", componentId); - toscaElement = toscaOperation.getToscaElement(componentV, filters); - } else { - log.debug("not supported tosca type {} for id {}", label, componentId); - toscaElement = Either.right(StorageOperationStatus.BAD_REQUEST); - } - if (toscaElement.isRight()) { - return Either.right(toscaElement.right().value()); - } - return Either.left(ModelConverter.convertFromToscaElement(toscaElement.left().value())); - } - - private ToscaElementOperation getToscaElementOperation(GraphVertex componentV) { - VertexTypeEnum label = componentV.getLabel(); - switch (label) { - case NODE_TYPE: - return nodeTypeOperation; - case TOPOLOGY_TEMPLATE: - return topologyTemplateOperation; - default: - return null; - } - } - - /** - * - * @param resource - * @return - */ - public <T extends Component> Either<T, StorageOperationStatus> createToscaComponent(T resource) { - ToscaElement toscaElement = ModelConverter.convertToToscaElement(resource); - - ToscaElementOperation toscaElementOperation = getToscaElementOperation(resource); - Either<ToscaElement, StorageOperationStatus> createToscaElement = toscaElementOperation.createToscaElement(toscaElement); - if (createToscaElement.isLeft()) { - log.debug("Component created successfully!!!"); - T dataModel = ModelConverter.convertFromToscaElement(createToscaElement.left().value()); - return Either.left(dataModel); - } - return Either.right(createToscaElement.right().value()); - } - - /** - * - * @param componentToDelete - * @return - */ - public StorageOperationStatus markComponentToDelete(Component componentToDelete) { - - if ((componentToDelete.getIsDeleted() != null) && componentToDelete.getIsDeleted() && !componentToDelete.isHighestVersion()) { - // component already marked for delete - return StorageOperationStatus.OK; - } else { - - Either<GraphVertex, TitanOperationStatus> getResponse = titanDao.getVertexById(componentToDelete.getUniqueId(), JsonParseFlagEnum.ParseAll); - if (getResponse.isRight()) { - log.debug("Couldn't fetch component with and unique id {}, error: {}", componentToDelete.getUniqueId(), getResponse.right().value()); - return DaoStatusConverter.convertTitanStatusToStorageStatus(getResponse.right().value()); - - } - GraphVertex componentV = getResponse.left().value(); - - // same operation for node type and topology template operations - Either<GraphVertex, StorageOperationStatus> result = nodeTypeOperation.markComponentToDelete(componentV); - if (result.isRight()) { - return result.right().value(); - } - return StorageOperationStatus.OK; - } - } - - /** - * - * @param componentId - * @return - */ - public <T extends Component> Either<T, StorageOperationStatus> deleteToscaComponent(String componentId) { - - Either<GraphVertex, TitanOperationStatus> getVertexEither = titanDao.getVertexById(componentId, JsonParseFlagEnum.ParseAll); - if (getVertexEither.isRight()) { - log.debug("Couldn't fetch component vertex with and unique id {}, error: {}", componentId, getVertexEither.right().value()); - return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getVertexEither.right().value())); - - } - Either<ToscaElement, StorageOperationStatus> deleteElement = deleteToscaElement(getVertexEither.left().value()); - if (deleteElement.isRight()) { - log.debug("Failed to delete component with and unique id {}, error: {}", componentId, deleteElement.right().value()); - return Either.right(deleteElement.right().value()); - } - T dataModel = ModelConverter.convertFromToscaElement(deleteElement.left().value()); - - return Either.left(dataModel); - } - - private Either<ToscaElement, StorageOperationStatus> deleteToscaElement(GraphVertex componentV) { - VertexTypeEnum label = componentV.getLabel(); - Either<ToscaElement, StorageOperationStatus> toscaElement; - Object componentId = componentV.getUniqueId(); - switch (label) { - case NODE_TYPE: - log.debug("Need to fetch node type for id {}", componentId); - toscaElement = nodeTypeOperation.deleteToscaElement(componentV); - break; - case TOPOLOGY_TEMPLATE: - log.debug("Need to fetch topology template for id {}", componentId); - toscaElement = topologyTemplateOperation.deleteToscaElement(componentV); - break; - default: - log.debug("not supported tosca type {} for id {}", label, componentId); - toscaElement = Either.right(StorageOperationStatus.BAD_REQUEST); - break; - } - return toscaElement; - } - - private ToscaElementOperation getToscaElementOperation(Component component) { - return ModelConverter.isAtomicComponent(component) ? nodeTypeOperation : topologyTemplateOperation; - } - - public <T extends Component> Either<T, StorageOperationStatus> getLatestByToscaResourceName(String toscaResourceName) { - return getLatestByName(GraphPropertyEnum.TOSCA_RESOURCE_NAME, toscaResourceName); - } - + + // region - Fields + + @Autowired + private NodeTypeOperation nodeTypeOperation; + @Autowired + private TopologyTemplateOperation topologyTemplateOperation; + @Autowired + private NodeTemplateOperation nodeTemplateOperation; + @Autowired + private GroupsOperation groupsOperation; + @Autowired + private TitanDao titanDao; + private static Logger log = LoggerFactory.getLogger(ToscaOperationFacade.class.getName()); + // endregion + + // region - ToscaElement - GetById + public static final String PROXY_SUFFIX = "_proxy"; + + public <T extends Component> Either<T, StorageOperationStatus> getToscaElement(String componentId) { + + return getToscaElement(componentId, JsonParseFlagEnum.ParseAll); + + } + + public <T extends Component> Either<T, StorageOperationStatus> getToscaFullElement(String componentId) { + ComponentParametersView filters = new ComponentParametersView(); + filters.setIgnoreCapabiltyProperties(false); + + return getToscaElement(componentId, filters); + } + + public <T extends Component> Either<T, StorageOperationStatus> getToscaElement(String componentId, ComponentParametersView filters) { + + Either<GraphVertex, TitanOperationStatus> getVertexEither = titanDao.getVertexById(componentId, filters.detectParseFlag()); + if (getVertexEither.isRight()) { + log.debug("Couldn't fetch component with and unique id {}, error: {}", componentId, getVertexEither.right().value()); + return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getVertexEither.right().value())); + + } + return getToscaElementByOperation(getVertexEither.left().value(), filters); + } + + public <T extends Component> Either<T, StorageOperationStatus> getToscaElement(String componentId, JsonParseFlagEnum parseFlag) { + + Either<GraphVertex, TitanOperationStatus> getVertexEither = titanDao.getVertexById(componentId, parseFlag); + if (getVertexEither.isRight()) { + log.debug("Couldn't fetch component with and unique id {}, error: {}", componentId, getVertexEither.right().value()); + return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getVertexEither.right().value())); + + } + return getToscaElementByOperation(getVertexEither.left().value()); + } + + public <T extends Component> Either<T, StorageOperationStatus> getToscaElement(GraphVertex componentVertex) { + return getToscaElementByOperation(componentVertex); + } + + public Either<Boolean, StorageOperationStatus> validateComponentExists(String componentId) { + + Either<GraphVertex, TitanOperationStatus> getVertexEither = titanDao.getVertexById(componentId, JsonParseFlagEnum.NoParse); + if (getVertexEither.isRight()) { + TitanOperationStatus status = getVertexEither.right().value(); + if (status == TitanOperationStatus.NOT_FOUND) { + return Either.left(false); + } else { + log.debug("Couldn't fetch component with and unique id {}, error: {}", componentId, getVertexEither.right().value()); + return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getVertexEither.right().value())); + } + } + return Either.left(true); + } + + public <T extends Component> Either<T, StorageOperationStatus> findLastCertifiedToscaElementByUUID(T component) { + Map<GraphPropertyEnum, Object> props = new HashMap<>(); + props.put(GraphPropertyEnum.UUID, component.getUUID()); + props.put(GraphPropertyEnum.STATE, LifecycleStateEnum.CERTIFIED.name()); + props.put(GraphPropertyEnum.IS_HIGHEST_VERSION, true); + + Either<List<GraphVertex>, TitanOperationStatus> getVertexEither = titanDao.getByCriteria(ModelConverter.getVertexType(component), props); + if (getVertexEither.isRight()) { + log.debug("Couldn't fetch component with and unique id {}, error: {}", component.getUniqueId(), getVertexEither.right().value()); + return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getVertexEither.right().value())); + + } + return getToscaElementByOperation(getVertexEither.left().value().get(0)); + } + + // endregion + // region - ToscaElement - GetByOperation + private <T extends Component> Either<T, StorageOperationStatus> getToscaElementByOperation(GraphVertex componentV) { + return getToscaElementByOperation(componentV, new ComponentParametersView()); + } + + private <T extends Component> Either<T, StorageOperationStatus> getToscaElementByOperation(GraphVertex componentV, ComponentParametersView filters) { + VertexTypeEnum label = componentV.getLabel(); + + ToscaElementOperation toscaOperation = getToscaElementOperation(componentV); + Either<ToscaElement, StorageOperationStatus> toscaElement; + String componentId = componentV.getUniqueId(); + if (toscaOperation != null) { + log.debug("Need to fetch tosca element for id {}", componentId); + toscaElement = toscaOperation.getToscaElement(componentV, filters); + } else { + log.debug("not supported tosca type {} for id {}", label, componentId); + toscaElement = Either.right(StorageOperationStatus.BAD_REQUEST); + } + if (toscaElement.isRight()) { + return Either.right(toscaElement.right().value()); + } + return Either.left(ModelConverter.convertFromToscaElement(toscaElement.left().value())); + } + + // endregion + private ToscaElementOperation getToscaElementOperation(GraphVertex componentV) { + VertexTypeEnum label = componentV.getLabel(); + switch (label) { + case NODE_TYPE: + return nodeTypeOperation; + case TOPOLOGY_TEMPLATE: + return topologyTemplateOperation; + default: + return null; + } + } + + /** + * + * @param resource + * @return + */ + public <T extends Component> Either<T, StorageOperationStatus> createToscaComponent(T resource) { + ToscaElement toscaElement = ModelConverter.convertToToscaElement(resource); + + ToscaElementOperation toscaElementOperation = getToscaElementOperation(resource); + Either<ToscaElement, StorageOperationStatus> createToscaElement = toscaElementOperation.createToscaElement(toscaElement); + if (createToscaElement.isLeft()) { + log.debug("Component created successfully!!!"); + T dataModel = ModelConverter.convertFromToscaElement(createToscaElement.left().value()); + return Either.left(dataModel); + } + return Either.right(createToscaElement.right().value()); + } + + // region - ToscaElement Delete + /** + * + * @param componentToDelete + * @return + */ + public StorageOperationStatus markComponentToDelete(Component componentToDelete) { + + if ((componentToDelete.getIsDeleted() != null) && componentToDelete.getIsDeleted() && !componentToDelete.isHighestVersion()) { + // component already marked for delete + return StorageOperationStatus.OK; + } else { + + Either<GraphVertex, TitanOperationStatus> getResponse = titanDao.getVertexById(componentToDelete.getUniqueId(), JsonParseFlagEnum.ParseAll); + if (getResponse.isRight()) { + log.debug("Couldn't fetch component with and unique id {}, error: {}", componentToDelete.getUniqueId(), getResponse.right().value()); + return DaoStatusConverter.convertTitanStatusToStorageStatus(getResponse.right().value()); + + } + GraphVertex componentV = getResponse.left().value(); + + // same operation for node type and topology template operations + Either<GraphVertex, StorageOperationStatus> result = nodeTypeOperation.markComponentToDelete(componentV); + if (result.isRight()) { + return result.right().value(); + } + return StorageOperationStatus.OK; + } + } + + /** + * + * @param componentId + * @return + */ + public <T extends Component> Either<T, StorageOperationStatus> deleteToscaComponent(String componentId) { + + Either<GraphVertex, TitanOperationStatus> getVertexEither = titanDao.getVertexById(componentId, JsonParseFlagEnum.ParseAll); + if (getVertexEither.isRight()) { + log.debug("Couldn't fetch component vertex with and unique id {}, error: {}", componentId, getVertexEither.right().value()); + return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getVertexEither.right().value())); + + } + Either<ToscaElement, StorageOperationStatus> deleteElement = deleteToscaElement(getVertexEither.left().value()); + if (deleteElement.isRight()) { + log.debug("Failed to delete component with and unique id {}, error: {}", componentId, deleteElement.right().value()); + return Either.right(deleteElement.right().value()); + } + T dataModel = ModelConverter.convertFromToscaElement(deleteElement.left().value()); + + return Either.left(dataModel); + } + + private Either<ToscaElement, StorageOperationStatus> deleteToscaElement(GraphVertex componentV) { + VertexTypeEnum label = componentV.getLabel(); + Either<ToscaElement, StorageOperationStatus> toscaElement; + Object componentId = componentV.getUniqueId(); + switch (label) { + case NODE_TYPE: + log.debug("Need to fetch node type for id {}", componentId); + toscaElement = nodeTypeOperation.deleteToscaElement(componentV); + break; + case TOPOLOGY_TEMPLATE: + log.debug("Need to fetch topology template for id {}", componentId); + toscaElement = topologyTemplateOperation.deleteToscaElement(componentV); + break; + default: + log.debug("not supported tosca type {} for id {}", label, componentId); + toscaElement = Either.right(StorageOperationStatus.BAD_REQUEST); + break; + } + return toscaElement; + } + // endregion + + private ToscaElementOperation getToscaElementOperation(Component component) { + return ModelConverter.isAtomicComponent(component) ? nodeTypeOperation : topologyTemplateOperation; + } + + public <T extends Component> Either<T, StorageOperationStatus> getLatestByToscaResourceName(String toscaResourceName) { + return getLatestByName(GraphPropertyEnum.TOSCA_RESOURCE_NAME, toscaResourceName); + } + public <T extends Component> Either<T, StorageOperationStatus> getFullLatestComponentByToscaResourceName(String toscaResourceName) { return getLatestByName(GraphPropertyEnum.TOSCA_RESOURCE_NAME, toscaResourceName, JsonParseFlagEnum.ParseAll); } - public <T extends Component> Either<T, StorageOperationStatus> getLatestByName(String resourceName) { - return getLatestByName(GraphPropertyEnum.NAME, resourceName); + public <T extends Component> Either<T, StorageOperationStatus> getLatestByName(String resourceName) { + return getLatestByName(GraphPropertyEnum.NAME, resourceName); - } + } - public Either<Integer, StorageOperationStatus> validateCsarUuidUniqueness(String csarUUID) { - Either<List<ToscaElement>, StorageOperationStatus> byCsar = null; + public Either<Integer, StorageOperationStatus> validateCsarUuidUniqueness(String csarUUID) { - Map<GraphPropertyEnum, Object> properties = new HashMap<GraphPropertyEnum, Object>(); - properties.put(GraphPropertyEnum.CSAR_UUID, csarUUID); + Map<GraphPropertyEnum, Object> properties = new HashMap<GraphPropertyEnum, Object>(); + properties.put(GraphPropertyEnum.CSAR_UUID, csarUUID); - Either<List<GraphVertex>, TitanOperationStatus> resources = titanDao.getByCriteria(null, properties, JsonParseFlagEnum.ParseMetadata); + Either<List<GraphVertex>, TitanOperationStatus> resources = titanDao.getByCriteria(null, properties, JsonParseFlagEnum.ParseMetadata); - if (resources.isRight()) { - if (resources.right().value() == TitanOperationStatus.NOT_FOUND) { - return Either.left(new Integer(0)); - } else { - log.debug("failed to get resources from graph with property name: {}", csarUUID); - return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(resources.right().value())); - } - } + if (resources.isRight()) { + if (resources.right().value() == TitanOperationStatus.NOT_FOUND) { + return Either.left(new Integer(0)); + } else { + log.debug("failed to get resources from graph with property name: {}", csarUUID); + return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(resources.right().value())); + } + } - List<GraphVertex> resourceList = (resources.isLeft() ? resources.left().value() : null); + List<GraphVertex> resourceList = (resources.isLeft() ? resources.left().value() : null); - return Either.left(new Integer(resourceList.size())); + return Either.left(new Integer(resourceList.size())); - } + } public <T extends Component> Either<Set<T>, StorageOperationStatus> getFollowed(String userId, Set<LifecycleStateEnum> lifecycleStates, Set<LifecycleStateEnum> lastStateStates, ComponentTypeEnum componentType) { - Either<List<ToscaElement>, StorageOperationStatus> followedResources; - if (componentType == ComponentTypeEnum.RESOURCE) { - followedResources = nodeTypeOperation.getFollowedComponent(userId, lifecycleStates, lastStateStates, componentType); - } else { - followedResources = topologyTemplateOperation.getFollowedComponent(userId, lifecycleStates, lastStateStates, componentType); - } + Either<List<ToscaElement>, StorageOperationStatus> followedResources; + if (componentType == ComponentTypeEnum.RESOURCE) { + followedResources = nodeTypeOperation.getFollowedComponent(userId, lifecycleStates, lastStateStates, componentType); + } else { + followedResources = topologyTemplateOperation.getFollowedComponent(userId, lifecycleStates, lastStateStates, componentType); + } Set<T> components = new HashSet<>(); - if (followedResources.isRight() && followedResources.right().value() != StorageOperationStatus.NOT_FOUND) { - return Either.right(followedResources.right().value()); - } - if (followedResources.isLeft()) { - List<ToscaElement> toscaElements = followedResources.left().value(); - toscaElements.forEach(te -> { - T component = ModelConverter.convertFromToscaElement(te); - components.add(component); - }); - } - return Either.left(components); - } - - public Either<Resource, StorageOperationStatus> getLatestCertifiedNodeTypeByToscaResourceName(String toscaResourceName) { - - return getLatestCertifiedByToscaResourceName(toscaResourceName, VertexTypeEnum.NODE_TYPE, JsonParseFlagEnum.ParseMetadata); - } - - public Either<Resource, StorageOperationStatus> getLatestCertifiedByToscaResourceName(String toscaResourceName, VertexTypeEnum vertexType, JsonParseFlagEnum parseFlag) { - - Either<Resource, StorageOperationStatus> result = null; - Map<GraphPropertyEnum, Object> props = new HashMap<GraphPropertyEnum, Object>(); - props.put(GraphPropertyEnum.TOSCA_RESOURCE_NAME, toscaResourceName); - props.put(GraphPropertyEnum.IS_HIGHEST_VERSION, true); - props.put(GraphPropertyEnum.STATE, LifecycleStateEnum.CERTIFIED.name()); - Either<List<GraphVertex>, TitanOperationStatus> getLatestRes = titanDao.getByCriteria(vertexType, props, parseFlag); - - if (getLatestRes.isRight()) { - TitanOperationStatus status = getLatestRes.right().value(); - CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to fetch {} with name {}. status={} ", vertexType, toscaResourceName, status); - result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status)); - } - if (result == null) { - List<GraphVertex> resources = getLatestRes.left().value(); - double version = 0.0; - GraphVertex highestResource = null; - for (GraphVertex resource : resources) { - double resourceVersion = Double.parseDouble((String) resource.getJsonMetadataField(JsonPresentationFields.VERSION)); - if (resourceVersion > version) { - version = resourceVersion; - highestResource = resource; - } - } - result = getToscaElement(highestResource.getUniqueId()); - } - return result; - } - - public Either<Boolean, StorageOperationStatus> validateToscaResourceNameExists(String templateName) { - Either<Boolean, StorageOperationStatus> validateUniquenessRes = validateToscaResourceNameUniqueness(templateName); - if (validateUniquenessRes.isLeft()) { - return Either.left(!validateUniquenessRes.left().value()); - } - return validateUniquenessRes; - } - - public Either<RequirementCapabilityRelDef, StorageOperationStatus> dissociateResourceInstances(String componentId, RequirementCapabilityRelDef requirementDef) { - return nodeTemplateOperation.dissociateResourceInstances(componentId, requirementDef); - - } - - public StorageOperationStatus associateResourceInstances(String componentId, List<RequirementCapabilityRelDef> relations) { - Either<List<RequirementCapabilityRelDef>, StorageOperationStatus> status = nodeTemplateOperation.associateResourceInstances(componentId, relations); - if (status.isRight()) { - return status.right().value(); - } - return StorageOperationStatus.OK; - } - - protected Either<Boolean, StorageOperationStatus> validateToscaResourceNameUniqueness(String name) { - - Map<GraphPropertyEnum, Object> properties = new HashMap<GraphPropertyEnum, Object>(); - properties.put(GraphPropertyEnum.TOSCA_RESOURCE_NAME, name); - - Either<List<GraphVertex>, TitanOperationStatus> resources = titanDao.getByCriteria(null, properties, JsonParseFlagEnum.ParseMetadata); - - if (resources.isRight() && resources.right().value() != TitanOperationStatus.NOT_FOUND) { - log.debug("failed to get resources from graph with property name: {}", name); - return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(resources.right().value())); - } - List<GraphVertex> resourceList = (resources.isLeft() ? resources.left().value() : null); - if (resourceList != null && resourceList.size() > 0) { - if (log.isDebugEnabled()) { - StringBuilder builder = new StringBuilder(); - for (GraphVertex resourceData : resourceList) { - builder.append(resourceData.getUniqueId() + "|"); - } - log.debug("resources with property name:{} exists in graph. found {}", name, builder.toString()); - } - return Either.left(false); - } else { - log.debug("resources with property name:{} does not exists in graph", name); - return Either.left(true); - } - - } - - /** - * - * @param newComponent - * @param oldComponent - * @return - */ - public <T extends Component> Either<T, StorageOperationStatus> overrideComponent(T newComponent, T oldComponent) { - - // TODO - // newComponent.setInterfaces(oldComponent.getInterfaces); - newComponent.setArtifacts(oldComponent.getArtifacts()); - newComponent.setDeploymentArtifacts(oldComponent.getDeploymentArtifacts()); - newComponent.setGroups(oldComponent.getGroups()); - newComponent.setInputs(null); - newComponent.setLastUpdateDate(null); - newComponent.setHighestVersion(true); - - Either<GraphVertex, TitanOperationStatus> componentVEither = titanDao.getVertexById(oldComponent.getUniqueId(), JsonParseFlagEnum.NoParse); - if (componentVEither.isRight()) { - log.debug("Falied to fetch component {} error {}", oldComponent.getUniqueId(), componentVEither.right().value()); - return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(componentVEither.right().value())); - } - GraphVertex componentv = componentVEither.left().value(); - Either<GraphVertex, TitanOperationStatus> parentVertexEither = titanDao.getParentVertex(componentv, EdgeLabelEnum.VERSION, JsonParseFlagEnum.NoParse); - if (parentVertexEither.isRight() && parentVertexEither.right().value() != TitanOperationStatus.NOT_FOUND) { - log.debug("Falied to fetch parent version for component {} error {}", oldComponent.getUniqueId(), parentVertexEither.right().value()); - return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(parentVertexEither.right().value())); - } - - Either<ToscaElement, StorageOperationStatus> deleteToscaComponent = deleteToscaElement(componentv); - if (deleteToscaComponent.isRight()) { - log.debug("Falied to remove old component {} error {}", oldComponent.getUniqueId(), deleteToscaComponent.right().value()); - return Either.right(deleteToscaComponent.right().value()); - } - Either<T, StorageOperationStatus> createToscaComponent = createToscaComponent(newComponent); - if (createToscaComponent.isRight()) { - log.debug("Falied to create tosca element component {} error {}", newComponent.getUniqueId(), createToscaComponent.right().value()); - return Either.right(createToscaComponent.right().value()); - } - T newElement = createToscaComponent.left().value(); - Either<GraphVertex, TitanOperationStatus> newVersionEither = titanDao.getVertexById(newElement.getUniqueId(), JsonParseFlagEnum.NoParse); - if (newVersionEither.isRight()) { - log.debug("Falied to fetch new tosca element component {} error {}", newComponent.getUniqueId(), newVersionEither.right().value()); - return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(newVersionEither.right().value())); - } - if (parentVertexEither.isLeft()) { - GraphVertex previousVersionV = parentVertexEither.left().value(); - TitanOperationStatus createEdge = titanDao.createEdge(previousVersionV, newVersionEither.left().value(), EdgeLabelEnum.VERSION, null); - if (createEdge != TitanOperationStatus.OK) { - log.debug("Falied to associate to previous version {} new version {} error {}", previousVersionV.getUniqueId(), newVersionEither.right().value(), createEdge); - return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(createEdge)); - } - } - return Either.left(newElement); - } - - /** - * - * @param componentToUpdate - * @return - */ - public <T extends Component> Either<T, StorageOperationStatus> updateToscaElement(T componentToUpdate) { - return updateToscaElement(componentToUpdate, new ComponentParametersView()); - } - - /** - * - * @param componentToUpdate - * @param type - * @param filterResult - * @return - */ - public <T extends Component> Either<T, StorageOperationStatus> updateToscaElement(T componentToUpdate, ComponentParametersView filterResult) { - String componentId = componentToUpdate.getUniqueId(); - Either<GraphVertex, TitanOperationStatus> getVertexEither = titanDao.getVertexById(componentId, JsonParseFlagEnum.ParseAll); - if (getVertexEither.isRight()) { - log.debug("Couldn't fetch component with and unique id {}, error: {}", componentId, getVertexEither.right().value()); - return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getVertexEither.right().value())); - } - GraphVertex elementV = getVertexEither.left().value(); - ToscaElementOperation toscaElementOperation = getToscaElementOperation(elementV); - - ToscaElement toscaElementToUpdate = ModelConverter.convertToToscaElement(componentToUpdate); - Either<ToscaElement, StorageOperationStatus> updateToscaElement = toscaElementOperation.updateToscaElement(toscaElementToUpdate, elementV, filterResult); - if (updateToscaElement.isRight()) { - log.debug("Failed to update tosca element {} error {}", componentId, updateToscaElement.right().value()); - return Either.right(updateToscaElement.right().value()); - } - return Either.left(ModelConverter.convertFromToscaElement(updateToscaElement.left().value())); - } - - private <T extends Component> Either<T, StorageOperationStatus> getLatestByName(GraphPropertyEnum property, String nodeName) { - Either<T, StorageOperationStatus> result; - - Map<GraphPropertyEnum, Object> propertiesToMatch = new EnumMap<>(GraphPropertyEnum.class); - Map<GraphPropertyEnum, Object> propertiesNotToMatch = new EnumMap<>(GraphPropertyEnum.class); - - propertiesToMatch.put(property, nodeName); - propertiesToMatch.put(GraphPropertyEnum.IS_HIGHEST_VERSION, true); - - propertiesNotToMatch.put(GraphPropertyEnum.IS_DELETED, true); - - Either<List<GraphVertex>, TitanOperationStatus> highestResources = titanDao.getByCriteria(null, propertiesToMatch, propertiesNotToMatch, JsonParseFlagEnum.ParseMetadata); - if (highestResources.isRight()) { - TitanOperationStatus status = highestResources.right().value(); - log.debug("failed to find resource with name {}. status={} ", nodeName, status); - result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status)); - return result; - } - - List<GraphVertex> resources = highestResources.left().value(); - double version = 0.0; - GraphVertex highestResource = null; - for (GraphVertex vertex : resources) { - Object versionObj = vertex.getMetadataProperty(GraphPropertyEnum.VERSION); - double resourceVersion = Double.valueOf((String) versionObj); - if (resourceVersion > version) { - version = resourceVersion; - highestResource = vertex; - } - } - return getToscaElementByOperation(highestResource); - } + if (followedResources.isRight() && followedResources.right().value() != StorageOperationStatus.NOT_FOUND) { + return Either.right(followedResources.right().value()); + } + if (followedResources.isLeft()) { + List<ToscaElement> toscaElements = followedResources.left().value(); + toscaElements.forEach(te -> { + T component = ModelConverter.convertFromToscaElement(te); + components.add(component); + }); + } + return Either.left(components); + } + + public Either<Resource, StorageOperationStatus> getLatestCertifiedNodeTypeByToscaResourceName(String toscaResourceName) { + + return getLatestCertifiedByToscaResourceName(toscaResourceName, VertexTypeEnum.NODE_TYPE, JsonParseFlagEnum.ParseMetadata); + } + + public Either<Resource, StorageOperationStatus> getLatestCertifiedByToscaResourceName(String toscaResourceName, VertexTypeEnum vertexType, JsonParseFlagEnum parseFlag) { + + Either<Resource, StorageOperationStatus> result = null; + Map<GraphPropertyEnum, Object> props = new HashMap<GraphPropertyEnum, Object>(); + props.put(GraphPropertyEnum.TOSCA_RESOURCE_NAME, toscaResourceName); + props.put(GraphPropertyEnum.IS_HIGHEST_VERSION, true); + props.put(GraphPropertyEnum.STATE, LifecycleStateEnum.CERTIFIED.name()); + Either<List<GraphVertex>, TitanOperationStatus> getLatestRes = titanDao.getByCriteria(vertexType, props, parseFlag); + + if (getLatestRes.isRight()) { + TitanOperationStatus status = getLatestRes.right().value(); + CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to fetch {} with name {}. status={} ", vertexType, toscaResourceName, status); + result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status)); + } + if (result == null) { + List<GraphVertex> resources = getLatestRes.left().value(); + double version = 0.0; + GraphVertex highestResource = null; + for (GraphVertex resource : resources) { + double resourceVersion = Double.parseDouble((String) resource.getJsonMetadataField(JsonPresentationFields.VERSION)); + if (resourceVersion > version) { + version = resourceVersion; + highestResource = resource; + } + } + result = getToscaFullElement(highestResource.getUniqueId()); + } + return result; + } + + public Either<Boolean, StorageOperationStatus> validateToscaResourceNameExists(String templateName) { + Either<Boolean, StorageOperationStatus> validateUniquenessRes = validateToscaResourceNameUniqueness(templateName); + if (validateUniquenessRes.isLeft()) { + return Either.left(!validateUniquenessRes.left().value()); + } + return validateUniquenessRes; + } + + public Either<RequirementCapabilityRelDef, StorageOperationStatus> dissociateResourceInstances(String componentId, RequirementCapabilityRelDef requirementDef) { + return nodeTemplateOperation.dissociateResourceInstances(componentId, requirementDef); + } + /** + * Allows to get fulfilled requirement by relation and received predicate + * @param componentId + * @param instanceId + * @param relation + * @param predicate + * @return + */ + public Either<RequirementDataDefinition, StorageOperationStatus> getFulfilledRequirementByRelation(String componentId, String instanceId, RequirementCapabilityRelDef relation, BiPredicate<RelationshipInfo, RequirementDataDefinition> predicate) { + return nodeTemplateOperation.getFulfilledRequirementByRelation(componentId, instanceId, relation, predicate); + } + /** + * Allows to get fulfilled capability by relation and received predicate + * @param componentId + * @param instanceId + * @param relation + * @param predicate + * @return + */ + public Either<CapabilityDataDefinition, StorageOperationStatus> getFulfilledCapabilityByRelation(String componentId, String instanceId, RequirementCapabilityRelDef relation, BiPredicate<RelationshipInfo, CapabilityDataDefinition> predicate) { + return nodeTemplateOperation.getFulfilledCapabilityByRelation(componentId, instanceId, relation, predicate); + } + + public StorageOperationStatus associateResourceInstances(String componentId, List<RequirementCapabilityRelDef> relations) { + Either<List<RequirementCapabilityRelDef>, StorageOperationStatus> status = nodeTemplateOperation.associateResourceInstances(componentId, relations); + if (status.isRight()) { + return status.right().value(); + } + return StorageOperationStatus.OK; + } + + protected Either<Boolean, StorageOperationStatus> validateToscaResourceNameUniqueness(String name) { + + Map<GraphPropertyEnum, Object> properties = new HashMap<GraphPropertyEnum, Object>(); + properties.put(GraphPropertyEnum.TOSCA_RESOURCE_NAME, name); + + Either<List<GraphVertex>, TitanOperationStatus> resources = titanDao.getByCriteria(null, properties, JsonParseFlagEnum.ParseMetadata); + + if (resources.isRight() && resources.right().value() != TitanOperationStatus.NOT_FOUND) { + log.debug("failed to get resources from graph with property name: {}", name); + return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(resources.right().value())); + } + List<GraphVertex> resourceList = (resources.isLeft() ? resources.left().value() : null); + if (resourceList != null && resourceList.size() > 0) { + if (log.isDebugEnabled()) { + StringBuilder builder = new StringBuilder(); + for (GraphVertex resourceData : resourceList) { + builder.append(resourceData.getUniqueId() + "|"); + } + log.debug("resources with property name:{} exists in graph. found {}", name, builder.toString()); + } + return Either.left(false); + } else { + log.debug("resources with property name:{} does not exists in graph", name); + return Either.left(true); + } + + } + + private List<InputDefinition> getNewInputsByResourceType(Resource component) { + return component.getResourceType().equals(ResourceTypeEnum.CVFC) ? + component.getInputs() : null; + } + + // region - Component Update + /** + * + * @param newComponent + * @param oldComponent + * @return + */ + public Either<Resource, StorageOperationStatus> overrideComponent(Resource newComponent, Resource oldComponent) { + + // TODO + // newComponent.setInterfaces(oldComponent.getInterfaces); + newComponent.setArtifacts(oldComponent.getArtifacts()); + newComponent.setDeploymentArtifacts(oldComponent.getDeploymentArtifacts()); + newComponent.setGroups(oldComponent.getGroups()); + List<InputDefinition> newInputs = getNewInputsByResourceType(oldComponent); + newComponent.setInputs(newInputs); + newComponent.setLastUpdateDate(null); + newComponent.setHighestVersion(true); + + Either<GraphVertex, TitanOperationStatus> componentVEither = titanDao.getVertexById(oldComponent.getUniqueId(), JsonParseFlagEnum.NoParse); + if (componentVEither.isRight()) { + log.debug("Falied to fetch component {} error {}", oldComponent.getUniqueId(), componentVEither.right().value()); + return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(componentVEither.right().value())); + } + GraphVertex componentv = componentVEither.left().value(); + Either<GraphVertex, TitanOperationStatus> parentVertexEither = titanDao.getParentVertex(componentv, EdgeLabelEnum.VERSION, JsonParseFlagEnum.NoParse); + if (parentVertexEither.isRight() && parentVertexEither.right().value() != TitanOperationStatus.NOT_FOUND) { + log.debug("Falied to fetch parent version for component {} error {}", oldComponent.getUniqueId(), parentVertexEither.right().value()); + return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(parentVertexEither.right().value())); + } + + Either<ToscaElement, StorageOperationStatus> deleteToscaComponent = deleteToscaElement(componentv); + if (deleteToscaComponent.isRight()) { + log.debug("Falied to remove old component {} error {}", oldComponent.getUniqueId(), deleteToscaComponent.right().value()); + return Either.right(deleteToscaComponent.right().value()); + } + Either<Resource, StorageOperationStatus> createToscaComponent = createToscaComponent(newComponent); + if (createToscaComponent.isRight()) { + log.debug("Falied to create tosca element component {} error {}", newComponent.getUniqueId(), createToscaComponent.right().value()); + return Either.right(createToscaComponent.right().value()); + } + Resource newElement = createToscaComponent.left().value(); + Either<GraphVertex, TitanOperationStatus> newVersionEither = titanDao.getVertexById(newElement.getUniqueId(), JsonParseFlagEnum.NoParse); + if (newVersionEither.isRight()) { + log.debug("Falied to fetch new tosca element component {} error {}", newComponent.getUniqueId(), newVersionEither.right().value()); + return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(newVersionEither.right().value())); + } + if (parentVertexEither.isLeft()) { + GraphVertex previousVersionV = parentVertexEither.left().value(); + TitanOperationStatus createEdge = titanDao.createEdge(previousVersionV, newVersionEither.left().value(), EdgeLabelEnum.VERSION, null); + if (createEdge != TitanOperationStatus.OK) { + log.debug("Falied to associate to previous version {} new version {} error {}", previousVersionV.getUniqueId(), newVersionEither.right().value(), createEdge); + return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(createEdge)); + } + } + return Either.left(newElement); + } + + /** + * + * @param componentToUpdate + * @return + */ + public <T extends Component> Either<T, StorageOperationStatus> updateToscaElement(T componentToUpdate) { + return updateToscaElement(componentToUpdate, new ComponentParametersView()); + } + + /** + * + * @param componentToUpdate + * @param type + * @param filterResult + * @return + */ + public <T extends Component> Either<T, StorageOperationStatus> updateToscaElement(T componentToUpdate, ComponentParametersView filterResult) { + String componentId = componentToUpdate.getUniqueId(); + Either<GraphVertex, TitanOperationStatus> getVertexEither = titanDao.getVertexById(componentId, JsonParseFlagEnum.ParseAll); + if (getVertexEither.isRight()) { + log.debug("Couldn't fetch component with and unique id {}, error: {}", componentId, getVertexEither.right().value()); + return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getVertexEither.right().value())); + } + GraphVertex elementV = getVertexEither.left().value(); + ToscaElementOperation toscaElementOperation = getToscaElementOperation(elementV); + + ToscaElement toscaElementToUpdate = ModelConverter.convertToToscaElement(componentToUpdate); + Either<ToscaElement, StorageOperationStatus> updateToscaElement = toscaElementOperation.updateToscaElement(toscaElementToUpdate, elementV, filterResult); + if (updateToscaElement.isRight()) { + log.debug("Failed to update tosca element {} error {}", componentId, updateToscaElement.right().value()); + return Either.right(updateToscaElement.right().value()); + } + return Either.left(ModelConverter.convertFromToscaElement(updateToscaElement.left().value())); + } private <T extends Component> Either<T, StorageOperationStatus> getLatestByName(GraphPropertyEnum property, String nodeName, JsonParseFlagEnum parseFlag) { Either<T, StorageOperationStatus> result; @@ -572,453 +616,545 @@ public class ToscaOperationFacade { return getToscaElementByOperation(highestResource); } - public <T extends Component> Either<List<T>, StorageOperationStatus> getBySystemName(ComponentTypeEnum componentType, String systemName) { - - Either<List<T>, StorageOperationStatus> result = null; - Either<T, StorageOperationStatus> getComponentRes; - List<T> components = new ArrayList<>(); - List<GraphVertex> componentVertices; - Map<GraphPropertyEnum, Object> propertiesToMatch = new EnumMap<>(GraphPropertyEnum.class); - Map<GraphPropertyEnum, Object> propertiesNotToMatch = new EnumMap<>(GraphPropertyEnum.class); - - propertiesToMatch.put(GraphPropertyEnum.SYSTEM_NAME, systemName); - if (componentType != null) - propertiesToMatch.put(GraphPropertyEnum.COMPONENT_TYPE, componentType.name()); - - propertiesNotToMatch.put(GraphPropertyEnum.IS_DELETED, true); - - Either<List<GraphVertex>, TitanOperationStatus> getComponentsRes = titanDao.getByCriteria(null, propertiesToMatch, propertiesNotToMatch, JsonParseFlagEnum.ParseAll); - if (getComponentsRes.isRight()) { - TitanOperationStatus status = getComponentsRes.right().value(); - log.debug("Failed to fetch the component with system name {}. Status is {} ", systemName, status); - result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status)); - } - if (result == null) { - componentVertices = getComponentsRes.left().value(); - for (GraphVertex componentVertex : componentVertices) { - getComponentRes = getToscaElementByOperation(componentVertex); - if (getComponentRes.isRight()) { - log.debug("Failed to get the component {}. Status is {} ", componentVertex.getJsonMetadataField(JsonPresentationFields.NAME), getComponentRes.right().value()); - result = Either.right(getComponentRes.right().value()); - break; - } - T componentBySystemName = getComponentRes.left().value(); - log.debug("Found component, id: {}", componentBySystemName.getUniqueId()); - components.add(componentBySystemName); - } - } - if (result == null) { - result = Either.left(components); - } - return result; - } - - public <T extends Component> Either<T, StorageOperationStatus> getComponentByNameAndVersion(ComponentTypeEnum componentType, String name, String version) { - return getComponentByNameAndVersion(componentType, name, version, JsonParseFlagEnum.ParseAll); - } - - public <T extends Component> Either<T, StorageOperationStatus> getComponentByNameAndVersion(ComponentTypeEnum componentType, String name, String version, JsonParseFlagEnum parseFlag) { - Either<T, StorageOperationStatus> result; - - Map<GraphPropertyEnum, Object> hasProperties = new EnumMap<>(GraphPropertyEnum.class); - Map<GraphPropertyEnum, Object> hasNotProperties = new EnumMap<>(GraphPropertyEnum.class); - - hasProperties.put(GraphPropertyEnum.NAME, name); - hasProperties.put(GraphPropertyEnum.VERSION, version); - hasNotProperties.put(GraphPropertyEnum.IS_DELETED, true); - if (componentType != null) { - hasProperties.put(GraphPropertyEnum.COMPONENT_TYPE, componentType.name()); - } - Either<List<GraphVertex>, TitanOperationStatus> getResourceRes = titanDao.getByCriteria(null, hasProperties, hasNotProperties, parseFlag); - if (getResourceRes.isRight()) { - TitanOperationStatus status = getResourceRes.right().value(); - log.debug("failed to find resource with name {}, version {}. Status is {} ", name, version, status); - result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status)); - return result; - } - return getToscaElementByOperation(getResourceRes.left().value().get(0)); - } - - public <T extends Component> Either<List<T>, StorageOperationStatus> getCatalogComponents(ComponentTypeEnum componentType, List<OriginTypeEnum> excludeTypes, boolean isHighestVersions) { - List<T> components = new ArrayList<>(); - Either<List<ToscaElement>, StorageOperationStatus> catalogDataResult; - List<ToscaElement> toscaElements = new ArrayList<>(); - List<ResourceTypeEnum> excludedResourceTypes = - Optional.ofNullable(excludeTypes).orElse(Collections.emptyList()) - .stream() - .filter(type -> !type.equals(OriginTypeEnum.SERVICE)) - .map(type -> ResourceTypeEnum.getTypeByName(type.name())).collect(Collectors.toList()); - - switch (componentType) { - case RESOURCE: - catalogDataResult = nodeTypeOperation.getElementCatalogData(ComponentTypeEnum.RESOURCE,excludedResourceTypes , isHighestVersions); - if (catalogDataResult.isRight()) { - return Either.right(catalogDataResult.right().value()); - } - toscaElements = catalogDataResult.left().value(); - break; - case SERVICE: - if (excludeTypes!= null && excludeTypes.contains(OriginTypeEnum.SERVICE)) { - break; - } - catalogDataResult = topologyTemplateOperation.getElementCatalogData(ComponentTypeEnum.SERVICE, null, isHighestVersions); - if (catalogDataResult.isRight()) { - return Either.right(catalogDataResult.right().value()); - } - toscaElements = catalogDataResult.left().value(); - break; - default: - log.debug("Not supported component type {}", componentType); - return Either.right(StorageOperationStatus.BAD_REQUEST); - } - toscaElements.forEach(te -> { - T component = ModelConverter.convertFromToscaElement(te); - components.add(component); - }); - return Either.left(components); - } - - public Either<List<String>, StorageOperationStatus> deleteMarkedElements(ComponentTypeEnum componentType) { - Either<List<GraphVertex>, StorageOperationStatus> allComponentsMarkedForDeletion; - List<String> deleted = new ArrayList<>(); - switch (componentType) { - case RESOURCE: - allComponentsMarkedForDeletion = nodeTypeOperation.getAllComponentsMarkedForDeletion(componentType); - break; - case SERVICE: - case PRODUCT: - allComponentsMarkedForDeletion = topologyTemplateOperation.getAllComponentsMarkedForDeletion(componentType); - break; - default: - log.debug("Not supported component type {}", componentType); - return Either.right(StorageOperationStatus.BAD_REQUEST); - } - if (allComponentsMarkedForDeletion.isRight()) { - return Either.right(allComponentsMarkedForDeletion.right().value()); - } - List<GraphVertex> allMarked = allComponentsMarkedForDeletion.left().value(); - - Either<List<GraphVertex>, TitanOperationStatus> allNotDeletedElements = topologyTemplateOperation.getAllNotDeletedElements(); - if (allNotDeletedElements.isRight()) { - return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(allNotDeletedElements.right().value())); - } - List<GraphVertex> allNonMarked = allNotDeletedElements.left().value(); - for (GraphVertex elementV : allMarked) { - if (topologyTemplateOperation.isInUse(elementV, allNonMarked) == false) { - Either<ToscaElement, StorageOperationStatus> deleteToscaElement = deleteToscaElement(elementV); - if (deleteToscaElement.isRight()) { - log.debug("Failed to delete marked element {} error {}", elementV.getUniqueId(), deleteToscaElement.right().value()); - } - } else { - deleted.add(elementV.getUniqueId()); - log.debug("Marked element {} in use. don't delete it", elementV.getUniqueId()); - } - } - return Either.left(deleted); - } - - public Either<List<String>, StorageOperationStatus> getAllComponentsMarkedForDeletion(ComponentTypeEnum componentType) { - Either<List<GraphVertex>, StorageOperationStatus> allComponentsMarkedForDeletion; - switch (componentType) { - case RESOURCE: - allComponentsMarkedForDeletion = nodeTypeOperation.getAllComponentsMarkedForDeletion(componentType); - break; - case SERVICE: - case PRODUCT: - allComponentsMarkedForDeletion = topologyTemplateOperation.getAllComponentsMarkedForDeletion(componentType); - break; - default: - log.debug("Not supported component type {}", componentType); - return Either.right(StorageOperationStatus.BAD_REQUEST); - } - if (allComponentsMarkedForDeletion.isRight()) { - return Either.right(allComponentsMarkedForDeletion.right().value()); - } - return Either.left(allComponentsMarkedForDeletion.left().value().stream().map(v -> v.getUniqueId()).collect(Collectors.toList())); - } - - public Either<Boolean, StorageOperationStatus> isComponentInUse(String componentId) { - Either<Boolean, StorageOperationStatus> result; - Either<List<GraphVertex>, TitanOperationStatus> allNotDeletedElements = topologyTemplateOperation.getAllNotDeletedElements(); - if (allNotDeletedElements.isRight()) { - result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(allNotDeletedElements.right().value())); - } else { - result = Either.left(topologyTemplateOperation.isInUse(componentId, allNotDeletedElements.left().value())); - } - return result; - } - - public Either<ImmutablePair<Component, String>, StorageOperationStatus> addComponentInstanceToTopologyTemplate(Component containerComponent, Component origComponent, ComponentInstance componentInstance, boolean allowDeleted, User user) { - - Either<ImmutablePair<Component, String>, StorageOperationStatus> result = null; - Either<ToscaElement, StorageOperationStatus> updateContainerComponentRes = null; - componentInstance.setIcon(origComponent.getIcon()); - Either<ImmutablePair<TopologyTemplate, String>, StorageOperationStatus> addResult = nodeTemplateOperation.addComponentInstanceToTopologyTemplate(ModelConverter.convertToToscaElement(containerComponent), - ModelConverter.convertToToscaElement(origComponent), getNextComponentInstanceCounter(containerComponent, origComponent.getName()), componentInstance, allowDeleted, user); - - if (addResult.isRight()) { - CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to add the component instance {} to container component {}. ", componentInstance.getName(), containerComponent.getName()); - result = Either.right(addResult.right().value()); - } - if (result == null) { - updateContainerComponentRes = topologyTemplateOperation.getToscaElement(containerComponent.getUniqueId()); - if (updateContainerComponentRes.isRight()) { - CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to fetch updated topology template {} with updated component instance {}. ", containerComponent.getName(), componentInstance.getName()); - result = Either.right(updateContainerComponentRes.right().value()); - } - } - if (result == null) { - Component updatedComponent = ModelConverter.convertFromToscaElement(updateContainerComponentRes.left().value()); - String createdInstanceId = addResult.left().value().getRight(); - CommonUtility.addRecordToLog(log, LogLevelEnum.TRACE, "The component instance {} has been added to container component {}. ", createdInstanceId, updatedComponent.getName()); - result = Either.left(new ImmutablePair<>(updatedComponent, createdInstanceId)); - } - return result; - } - - public StorageOperationStatus associateComponentInstancesToComponent(Component containerComponent, Map<ComponentInstance, Resource> resourcesInstancesMap, boolean allowDeleted) { - - StorageOperationStatus result = null; - CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Going to add component instances to component {}", containerComponent.getUniqueId()); - - Either<GraphVertex, TitanOperationStatus> metadataVertex = titanDao.getVertexById(containerComponent.getUniqueId(), JsonParseFlagEnum.ParseAll); - if (metadataVertex.isRight()) { - TitanOperationStatus status = metadataVertex.right().value(); - if (status == TitanOperationStatus.NOT_FOUND) { - status = TitanOperationStatus.INVALID_ID; - } - result = DaoStatusConverter.convertTitanStatusToStorageStatus(status); - } - if (result == null) { - result = nodeTemplateOperation.associateComponentInstancesToComponent(containerComponent, resourcesInstancesMap, metadataVertex.left().value(), allowDeleted); - } - return result; - } - - public Either<ImmutablePair<Component, String>, StorageOperationStatus> updateComponentInstanceMetadataOfTopologyTemplate(Component containerComponent, Component origComponent, ComponentInstance componentInstance) { - - Either<ImmutablePair<Component, String>, StorageOperationStatus> result = null; - - CommonUtility.addRecordToLog(log, LogLevelEnum.TRACE, "Going to update the metadata of the component instance {} belonging to container component {}. ", componentInstance.getName(), containerComponent.getName()); - componentInstance.setIcon(origComponent.getIcon()); - Either<ImmutablePair<TopologyTemplate, String>, StorageOperationStatus> updateResult = nodeTemplateOperation.updateComponentInstanceMetadataOfTopologyTemplate(ModelConverter.convertToToscaElement(containerComponent), - ModelConverter.convertToToscaElement(origComponent), componentInstance); - if (updateResult.isRight()) { - CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to update the metadata of the component instance {} belonging to container component {}. ", componentInstance.getName(), containerComponent.getName()); - result = Either.right(updateResult.right().value()); - } - if (result == null) { - Component updatedComponent = ModelConverter.convertFromToscaElement(updateResult.left().value().getLeft()); - String createdInstanceId = updateResult.left().value().getRight(); - CommonUtility.addRecordToLog(log, LogLevelEnum.TRACE, "The metadata of the component instance {} has been updated to container component {}. ", createdInstanceId, updatedComponent.getName()); - result = Either.left(new ImmutablePair<>(updatedComponent, createdInstanceId)); - } - return result; - } - - public Either<Component, StorageOperationStatus> updateComponentInstanceMetadataOfTopologyTemplate(Component containerComponent) { - - Either<Component, StorageOperationStatus> result = null; - - CommonUtility.addRecordToLog(log, LogLevelEnum.TRACE, "Going to update the metadata belonging to container component {}. ", containerComponent.getName()); - - Either<TopologyTemplate, StorageOperationStatus> updateResult = nodeTemplateOperation.updateComponentInstanceMetadataOfTopologyTemplate(ModelConverter.convertToToscaElement(containerComponent)); - if (updateResult.isRight()) { - CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to update the metadata belonging to container component {}. ", containerComponent.getName()); - result = Either.right(updateResult.right().value()); - } - if (result == null) { - Component updatedComponent = ModelConverter.convertFromToscaElement(updateResult.left().value()); - CommonUtility.addRecordToLog(log, LogLevelEnum.TRACE, "The metadata has been updated to container component {}. ", updatedComponent.getName()); - result = Either.left(updatedComponent); - } - return result; - } - - public Either<ImmutablePair<Component, String>, StorageOperationStatus> deleteComponentInstanceFromTopologyTemplate(Component containerComponent, String resourceInstanceId) { - - Either<ImmutablePair<Component, String>, StorageOperationStatus> result = null; - - CommonUtility.addRecordToLog(log, LogLevelEnum.TRACE, "Going to delete the component instance {} belonging to container component {}. ", resourceInstanceId, containerComponent.getName()); - - Either<ImmutablePair<TopologyTemplate, String>, StorageOperationStatus> updateResult = nodeTemplateOperation.deleteComponentInstanceFromTopologyTemplate(ModelConverter.convertToToscaElement(containerComponent), resourceInstanceId); - if (updateResult.isRight()) { - CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to delete the component instance {} belonging to container component {}. ", resourceInstanceId, containerComponent.getName()); - result = Either.right(updateResult.right().value()); - } - if (result == null) { - Component updatedComponent = ModelConverter.convertFromToscaElement(updateResult.left().value().getLeft()); - String deletedInstanceId = updateResult.left().value().getRight(); - CommonUtility.addRecordToLog(log, LogLevelEnum.TRACE, "The component instance {} has been deleted from container component {}. ", deletedInstanceId, updatedComponent.getName()); - result = Either.left(new ImmutablePair<>(updatedComponent, deletedInstanceId)); - } - return result; - } - - private String getNextComponentInstanceCounter(Component containerComponent, String originResourceName) { - - Integer nextCounter = 0; - - if (CollectionUtils.isNotEmpty(containerComponent.getComponentInstances())) { - - String normalizedName = ValidationUtils.normalizeComponentInstanceName(originResourceName); - Integer maxCounterFromNames = getMaxCounterFromNames(containerComponent, normalizedName); - Integer maxCounterFromIds = getMaxCounterFromIds(containerComponent, normalizedName); - - if (maxCounterFromNames == null && maxCounterFromIds != null) { - nextCounter = maxCounterFromIds + 1; - } else if (maxCounterFromIds == null && maxCounterFromNames != null) { - nextCounter = maxCounterFromNames + 1; - } else if (maxCounterFromIds != null && maxCounterFromNames != null) { - nextCounter = maxCounterFromNames > maxCounterFromIds ? maxCounterFromNames + 1 : maxCounterFromIds + 1; - } - } - return nextCounter.toString(); - } - - private Integer getMaxCounterFromNames(Component containerComponent, String normalizedName) { - - Integer maxCounter = 0; - List<String> countersStr = containerComponent.getComponentInstances().stream().filter(ci -> ci.getNormalizedName() != null && ci.getNormalizedName().startsWith(normalizedName)).map(ci -> ci.getNormalizedName().split(normalizedName)[1]) - .collect(Collectors.toList()); - - if (CollectionUtils.isEmpty(countersStr)) { - return null; - } - Integer currCounter = null; - for (String counter : countersStr) { - if (StringUtils.isEmpty(counter)) { - continue; - } - try { - currCounter = Integer.parseInt(counter); - } catch (Exception e) { - continue; - } - maxCounter = maxCounter < currCounter ? currCounter : maxCounter; - } - if (currCounter == null) { - return null; - } - return maxCounter; - } - - private Integer getMaxCounterFromIds(Component containerComponent, String normalizedName) { - - Integer maxCounter = 0; - List<String> countersStr = containerComponent.getComponentInstances().stream().filter(ci -> ci.getUniqueId() != null && ci.getUniqueId().contains(normalizedName)).map(ci -> ci.getUniqueId().split(normalizedName)[1]) - .collect(Collectors.toList()); - - if (CollectionUtils.isEmpty(countersStr)) { - return null; - } - Integer currCounter = null; - for (String counter : countersStr) { - if (StringUtils.isEmpty(counter)) { - continue; - } - try { - currCounter = Integer.parseInt(counter); - } catch (Exception e) { - continue; - } - maxCounter = maxCounter < currCounter ? currCounter : maxCounter; - } - if (currCounter == null) { - return null; - } - return maxCounter; - } - - public Either<RequirementCapabilityRelDef, StorageOperationStatus> associateResourceInstances(String componentId, RequirementCapabilityRelDef requirementDef) { - return nodeTemplateOperation.associateResourceInstances(componentId, requirementDef); - - } - - public Either<List<InputDefinition>, StorageOperationStatus> createAndAssociateInputs(Map<String, InputDefinition> inputs, String componentId) { - - Either<GraphVertex, TitanOperationStatus> getVertexEither = titanDao.getVertexById(componentId, JsonParseFlagEnum.NoParse); - if (getVertexEither.isRight()) { - log.debug("Couldn't fetch component with and unique id {}, error: {}", componentId, getVertexEither.right().value()); - return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getVertexEither.right().value())); - - } - - GraphVertex vertex = getVertexEither.left().value(); - Map<String, PropertyDataDefinition> inputsMap = inputs.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, e -> new PropertyDataDefinition(e.getValue()))); - - StorageOperationStatus status = topologyTemplateOperation.associateInputsToComponent(vertex, inputsMap, componentId); - - if (StorageOperationStatus.OK == status) { - log.debug("Component created successfully!!!"); - List<InputDefinition> inputsResList = null; - if (inputsMap != null && !inputsMap.isEmpty()) { - inputsResList = inputsMap.values().stream().map(i -> new InputDefinition(i)).collect(Collectors.toList()); - } - return Either.left(inputsResList); - } - return Either.right(status); - - } - - public Either<List<InputDefinition>, StorageOperationStatus> addInputsToComponent(Map<String, InputDefinition> inputs, String componentId) { - - Either<GraphVertex, TitanOperationStatus> getVertexEither = titanDao.getVertexById(componentId, JsonParseFlagEnum.NoParse); - if (getVertexEither.isRight()) { - log.debug("Couldn't fetch component with and unique id {}, error: {}", componentId, getVertexEither.right().value()); - return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getVertexEither.right().value())); - - } - - GraphVertex vertex = getVertexEither.left().value(); - Map<String, PropertyDataDefinition> inputsMap = inputs.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, e -> new PropertyDataDefinition(e.getValue()))); - - StorageOperationStatus status = topologyTemplateOperation.addToscaDataToToscaElement(vertex, EdgeLabelEnum.INPUTS, VertexTypeEnum.INPUTS, inputsMap, JsonPresentationFields.NAME); - - if (StorageOperationStatus.OK == status) { - log.debug("Component created successfully!!!"); - List<InputDefinition> inputsResList = null; - if (inputsMap != null && !inputsMap.isEmpty()) { - inputsResList = inputsMap.values().stream().map(i -> new InputDefinition(i)).collect(Collectors.toList()); - } - return Either.left(inputsResList); - } - return Either.right(status); - - } - - public Either<Map<String, List<ComponentInstanceProperty>>, StorageOperationStatus> associateComponentInstancePropertiesToComponent(Map<String, List<ComponentInstanceProperty>> instProperties, String componentId) { - - Either<GraphVertex, TitanOperationStatus> getVertexEither = titanDao.getVertexById(componentId, JsonParseFlagEnum.NoParse); - if (getVertexEither.isRight()) { - log.debug("Couldn't fetch component with and unique id {}, error: {}", componentId, getVertexEither.right().value()); - return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getVertexEither.right().value())); - - } - - GraphVertex vertex = getVertexEither.left().value(); - Map<String, MapPropertiesDataDefinition> instPropsMap = new HashMap<>(); - if (instProperties != null) { - - MapPropertiesDataDefinition propertiesMap; - for (Entry<String, List<ComponentInstanceProperty>> entry : instProperties.entrySet()) { - propertiesMap = new MapPropertiesDataDefinition(); - - propertiesMap.setMapToscaDataDefinition(entry.getValue().stream().map(e -> new PropertyDataDefinition(e)).collect(Collectors.toMap(e -> e.getName(), e -> e))); - - instPropsMap.put(entry.getKey(), propertiesMap); - } - } - - StorageOperationStatus status = topologyTemplateOperation.associateInstPropertiesToComponent(vertex, instPropsMap); - - if (StorageOperationStatus.OK == status) { - log.debug("Component created successfully!!!"); - return Either.left(instProperties); - } - return Either.right(status); + // endregion + // region - Component Get By .. + private <T extends Component> Either<T, StorageOperationStatus> getLatestByName(GraphPropertyEnum property, String nodeName) { + return getLatestByName(property, nodeName, JsonParseFlagEnum.ParseMetadata); + } + + public <T extends Component> Either<List<T>, StorageOperationStatus> getBySystemName(ComponentTypeEnum componentType, String systemName) { + + Either<List<T>, StorageOperationStatus> result = null; + Either<T, StorageOperationStatus> getComponentRes; + List<T> components = new ArrayList<>(); + List<GraphVertex> componentVertices; + Map<GraphPropertyEnum, Object> propertiesToMatch = new EnumMap<>(GraphPropertyEnum.class); + Map<GraphPropertyEnum, Object> propertiesNotToMatch = new EnumMap<>(GraphPropertyEnum.class); + + propertiesToMatch.put(GraphPropertyEnum.SYSTEM_NAME, systemName); + if (componentType != null) + propertiesToMatch.put(GraphPropertyEnum.COMPONENT_TYPE, componentType.name()); + + propertiesNotToMatch.put(GraphPropertyEnum.IS_DELETED, true); + + Either<List<GraphVertex>, TitanOperationStatus> getComponentsRes = titanDao.getByCriteria(null, propertiesToMatch, propertiesNotToMatch, JsonParseFlagEnum.ParseAll); + if (getComponentsRes.isRight()) { + TitanOperationStatus status = getComponentsRes.right().value(); + log.debug("Failed to fetch the component with system name {}. Status is {} ", systemName, status); + result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status)); + } + if (result == null) { + componentVertices = getComponentsRes.left().value(); + for (GraphVertex componentVertex : componentVertices) { + getComponentRes = getToscaElementByOperation(componentVertex); + if (getComponentRes.isRight()) { + log.debug("Failed to get the component {}. Status is {} ", componentVertex.getJsonMetadataField(JsonPresentationFields.NAME), getComponentRes.right().value()); + result = Either.right(getComponentRes.right().value()); + break; + } + T componentBySystemName = getComponentRes.left().value(); + log.debug("Found component, id: {}", componentBySystemName.getUniqueId()); + components.add(componentBySystemName); + } + } + if (result == null) { + result = Either.left(components); + } + return result; + } + + public <T extends Component> Either<T, StorageOperationStatus> getComponentByNameAndVersion(ComponentTypeEnum componentType, String name, String version) { + return getComponentByNameAndVersion(componentType, name, version, JsonParseFlagEnum.ParseAll); + } + + public <T extends Component> Either<T, StorageOperationStatus> getComponentByNameAndVersion(ComponentTypeEnum componentType, String name, String version, JsonParseFlagEnum parseFlag) { + Either<T, StorageOperationStatus> result; + + Map<GraphPropertyEnum, Object> hasProperties = new EnumMap<>(GraphPropertyEnum.class); + Map<GraphPropertyEnum, Object> hasNotProperties = new EnumMap<>(GraphPropertyEnum.class); + + hasProperties.put(GraphPropertyEnum.NAME, name); + hasProperties.put(GraphPropertyEnum.VERSION, version); + hasNotProperties.put(GraphPropertyEnum.IS_DELETED, true); + if (componentType != null) { + hasProperties.put(GraphPropertyEnum.COMPONENT_TYPE, componentType.name()); + } + Either<List<GraphVertex>, TitanOperationStatus> getResourceRes = titanDao.getByCriteria(null, hasProperties, hasNotProperties, parseFlag); + if (getResourceRes.isRight()) { + TitanOperationStatus status = getResourceRes.right().value(); + log.debug("failed to find resource with name {}, version {}. Status is {} ", name, version, status); + result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status)); + return result; + } + return getToscaElementByOperation(getResourceRes.left().value().get(0)); + } + + // endregion + public <T extends Component> Either<List<T>, StorageOperationStatus> getCatalogComponents(ComponentTypeEnum componentType, List<OriginTypeEnum> excludeTypes, boolean isHighestVersions) { + List<T> components = new ArrayList<>(); + Either<List<ToscaElement>, StorageOperationStatus> catalogDataResult; + List<ToscaElement> toscaElements = new ArrayList<>(); + List<ResourceTypeEnum> excludedResourceTypes = Optional.ofNullable(excludeTypes).orElse(Collections.emptyList()).stream().filter(type -> !type.equals(OriginTypeEnum.SERVICE)).map(type -> ResourceTypeEnum.getTypeByName(type.name())) + .collect(Collectors.toList()); + + switch (componentType) { + case RESOURCE: + catalogDataResult = nodeTypeOperation.getElementCatalogData(ComponentTypeEnum.RESOURCE, excludedResourceTypes, isHighestVersions); + if (catalogDataResult.isRight()) { + return Either.right(catalogDataResult.right().value()); + } + toscaElements = catalogDataResult.left().value(); + break; + case SERVICE: + if (excludeTypes != null && excludeTypes.contains(OriginTypeEnum.SERVICE)) { + break; + } + catalogDataResult = topologyTemplateOperation.getElementCatalogData(ComponentTypeEnum.SERVICE, null, isHighestVersions); + if (catalogDataResult.isRight()) { + return Either.right(catalogDataResult.right().value()); + } + toscaElements = catalogDataResult.left().value(); + break; + default: + log.debug("Not supported component type {}", componentType); + return Either.right(StorageOperationStatus.BAD_REQUEST); + } + toscaElements.forEach(te -> { + T component = ModelConverter.convertFromToscaElement(te); + components.add(component); + }); + return Either.left(components); + } + + public Either<List<String>, StorageOperationStatus> deleteMarkedElements(ComponentTypeEnum componentType) { + Either<List<GraphVertex>, StorageOperationStatus> allComponentsMarkedForDeletion; + List<String> deleted = new ArrayList<>(); + switch (componentType) { + case RESOURCE: + allComponentsMarkedForDeletion = nodeTypeOperation.getAllComponentsMarkedForDeletion(componentType); + break; + case SERVICE: + case PRODUCT: + allComponentsMarkedForDeletion = topologyTemplateOperation.getAllComponentsMarkedForDeletion(componentType); + break; + default: + log.debug("Not supported component type {}", componentType); + return Either.right(StorageOperationStatus.BAD_REQUEST); + } + if (allComponentsMarkedForDeletion.isRight()) { + return Either.right(allComponentsMarkedForDeletion.right().value()); + } + List<GraphVertex> allMarked = allComponentsMarkedForDeletion.left().value(); + + Either<List<GraphVertex>, TitanOperationStatus> allNotDeletedElements = topologyTemplateOperation.getAllNotDeletedElements(); + if (allNotDeletedElements.isRight()) { + return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(allNotDeletedElements.right().value())); + } + List<GraphVertex> allNonMarked = allNotDeletedElements.left().value(); + for (GraphVertex elementV : allMarked) { + if (topologyTemplateOperation.isInUse(elementV, allNonMarked) == false) { + Either<ToscaElement, StorageOperationStatus> deleteToscaElement = deleteToscaElement(elementV); + if (deleteToscaElement.isRight()) { + log.debug("Failed to delete marked element {} error {}", elementV.getUniqueId(), deleteToscaElement.right().value()); + } + } else { + deleted.add(elementV.getUniqueId()); + log.debug("Marked element {} in use. don't delete it", elementV.getUniqueId()); + } + } + return Either.left(deleted); + } + + public Either<List<String>, StorageOperationStatus> getAllComponentsMarkedForDeletion(ComponentTypeEnum componentType) { + Either<List<GraphVertex>, StorageOperationStatus> allComponentsMarkedForDeletion; + switch (componentType) { + case RESOURCE: + allComponentsMarkedForDeletion = nodeTypeOperation.getAllComponentsMarkedForDeletion(componentType); + break; + case SERVICE: + case PRODUCT: + allComponentsMarkedForDeletion = topologyTemplateOperation.getAllComponentsMarkedForDeletion(componentType); + break; + default: + log.debug("Not supported component type {}", componentType); + return Either.right(StorageOperationStatus.BAD_REQUEST); + } + if (allComponentsMarkedForDeletion.isRight()) { + return Either.right(allComponentsMarkedForDeletion.right().value()); + } + return Either.left(allComponentsMarkedForDeletion.left().value().stream().map(v -> v.getUniqueId()).collect(Collectors.toList())); + } + + public Either<Boolean, StorageOperationStatus> isComponentInUse(String componentId) { + Either<Boolean, StorageOperationStatus> result; + Either<List<GraphVertex>, TitanOperationStatus> allNotDeletedElements = topologyTemplateOperation.getAllNotDeletedElements(); + if (allNotDeletedElements.isRight()) { + result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(allNotDeletedElements.right().value())); + } else { + result = Either.left(topologyTemplateOperation.isInUse(componentId, allNotDeletedElements.left().value())); + } + return result; + } + + // region - Component Update + public Either<ImmutablePair<Component, String>, StorageOperationStatus> addComponentInstanceToTopologyTemplate(Component containerComponent, Component origComponent, ComponentInstance componentInstance, boolean allowDeleted, User user) { + + Either<ImmutablePair<Component, String>, StorageOperationStatus> result = null; + Either<ToscaElement, StorageOperationStatus> updateContainerComponentRes = null; + if (StringUtils.isEmpty(componentInstance.getIcon())) { + componentInstance.setIcon(origComponent.getIcon()); + } + String nameToFindForCounter = componentInstance.getOriginType() == OriginTypeEnum.ServiceProxy ? PROXY_SUFFIX : origComponent.getName(); + String nextComponentInstanceCounter = getNextComponentInstanceCounter(containerComponent, nameToFindForCounter); + Either<ImmutablePair<TopologyTemplate, String>, StorageOperationStatus> addResult = nodeTemplateOperation.addComponentInstanceToTopologyTemplate(ModelConverter.convertToToscaElement(containerComponent), + ModelConverter.convertToToscaElement(origComponent), nextComponentInstanceCounter, componentInstance, allowDeleted, user); + + if (addResult.isRight()) { + CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to add the component instance {} to container component {}. ", componentInstance.getName(), containerComponent.getName()); + result = Either.right(addResult.right().value()); + } + if (result == null) { + updateContainerComponentRes = topologyTemplateOperation.getToscaElement(containerComponent.getUniqueId()); + if (updateContainerComponentRes.isRight()) { + CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to fetch updated topology template {} with updated component instance {}. ", containerComponent.getName(), componentInstance.getName()); + result = Either.right(updateContainerComponentRes.right().value()); + } + } + if (result == null) { + Component updatedComponent = ModelConverter.convertFromToscaElement(updateContainerComponentRes.left().value()); + String createdInstanceId = addResult.left().value().getRight(); + CommonUtility.addRecordToLog(log, LogLevelEnum.TRACE, "The component instance {} has been added to container component {}. ", createdInstanceId, updatedComponent.getName()); + result = Either.left(new ImmutablePair<>(updatedComponent, createdInstanceId)); + } + return result; + } + + public StorageOperationStatus associateComponentInstancesToComponent(Component containerComponent, Map<ComponentInstance, Resource> resourcesInstancesMap, boolean allowDeleted) { + + StorageOperationStatus result = null; + CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Going to add component instances to component {}", containerComponent.getUniqueId()); + + Either<GraphVertex, TitanOperationStatus> metadataVertex = titanDao.getVertexById(containerComponent.getUniqueId(), JsonParseFlagEnum.ParseAll); + if (metadataVertex.isRight()) { + TitanOperationStatus status = metadataVertex.right().value(); + if (status == TitanOperationStatus.NOT_FOUND) { + status = TitanOperationStatus.INVALID_ID; + } + result = DaoStatusConverter.convertTitanStatusToStorageStatus(status); + } + if (result == null) { + result = nodeTemplateOperation.associateComponentInstancesToComponent(containerComponent, resourcesInstancesMap, metadataVertex.left().value(), allowDeleted); + } + return result; + } + + public Either<ImmutablePair<Component, String>, StorageOperationStatus> updateComponentInstanceMetadataOfTopologyTemplate(Component containerComponent, Component origComponent, ComponentInstance componentInstance) { + + Either<ImmutablePair<Component, String>, StorageOperationStatus> result = null; + + CommonUtility.addRecordToLog(log, LogLevelEnum.TRACE, "Going to update the metadata of the component instance {} belonging to container component {}. ", componentInstance.getName(), containerComponent.getName()); + componentInstance.setIcon(origComponent.getIcon()); + Either<ImmutablePair<TopologyTemplate, String>, StorageOperationStatus> updateResult = nodeTemplateOperation.updateComponentInstanceMetadataOfTopologyTemplate(ModelConverter.convertToToscaElement(containerComponent), + ModelConverter.convertToToscaElement(origComponent), componentInstance); + if (updateResult.isRight()) { + CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to update the metadata of the component instance {} belonging to container component {}. ", componentInstance.getName(), containerComponent.getName()); + result = Either.right(updateResult.right().value()); + } + if (result == null) { + Component updatedComponent = ModelConverter.convertFromToscaElement(updateResult.left().value().getLeft()); + String createdInstanceId = updateResult.left().value().getRight(); + CommonUtility.addRecordToLog(log, LogLevelEnum.TRACE, "The metadata of the component instance {} has been updated to container component {}. ", createdInstanceId, updatedComponent.getName()); + result = Either.left(new ImmutablePair<>(updatedComponent, createdInstanceId)); + } + return result; + } + + public Either<Component, StorageOperationStatus> updateComponentInstanceMetadataOfTopologyTemplate(Component containerComponent) { + return updateComponentInstanceMetadataOfTopologyTemplate(containerComponent, new ComponentParametersView()); + } + + public Either<Component, StorageOperationStatus> updateComponentInstanceMetadataOfTopologyTemplate(Component containerComponent, ComponentParametersView filter) { + + Either<Component, StorageOperationStatus> result = null; + + CommonUtility.addRecordToLog(log, LogLevelEnum.TRACE, "Going to update the metadata belonging to container component {}. ", containerComponent.getName()); + + Either<TopologyTemplate, StorageOperationStatus> updateResult = nodeTemplateOperation.updateComponentInstanceMetadataOfTopologyTemplate(ModelConverter.convertToToscaElement(containerComponent), filter); + if (updateResult.isRight()) { + CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to update the metadata belonging to container component {}. ", containerComponent.getName()); + result = Either.right(updateResult.right().value()); + } + if (result == null) { + Component updatedComponent = ModelConverter.convertFromToscaElement(updateResult.left().value()); + CommonUtility.addRecordToLog(log, LogLevelEnum.TRACE, "The metadata has been updated to container component {}. ", updatedComponent.getName()); + result = Either.left(updatedComponent); + } + return result; + } + // endregion + + public Either<ImmutablePair<Component, String>, StorageOperationStatus> deleteComponentInstanceFromTopologyTemplate(Component containerComponent, String resourceInstanceId) { + + Either<ImmutablePair<Component, String>, StorageOperationStatus> result = null; + + CommonUtility.addRecordToLog(log, LogLevelEnum.TRACE, "Going to delete the component instance {} belonging to container component {}. ", resourceInstanceId, containerComponent.getName()); + + Either<ImmutablePair<TopologyTemplate, String>, StorageOperationStatus> updateResult = nodeTemplateOperation.deleteComponentInstanceFromTopologyTemplate(ModelConverter.convertToToscaElement(containerComponent), resourceInstanceId); + if (updateResult.isRight()) { + CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to delete the component instance {} belonging to container component {}. ", resourceInstanceId, containerComponent.getName()); + result = Either.right(updateResult.right().value()); + } + if (result == null) { + Component updatedComponent = ModelConverter.convertFromToscaElement(updateResult.left().value().getLeft()); + String deletedInstanceId = updateResult.left().value().getRight(); + CommonUtility.addRecordToLog(log, LogLevelEnum.TRACE, "The component instance {} has been deleted from container component {}. ", deletedInstanceId, updatedComponent.getName()); + result = Either.left(new ImmutablePair<>(updatedComponent, deletedInstanceId)); + } + return result; + } + + private String getNextComponentInstanceCounter(Component containerComponent, String originResourceName) { + + Integer nextCounter = 0; + + if (CollectionUtils.isNotEmpty(containerComponent.getComponentInstances())) { + + String normalizedName = ValidationUtils.normalizeComponentInstanceName(originResourceName); + Integer maxCounterFromNames = getMaxCounterFromNames(containerComponent, normalizedName); + Integer maxCounterFromIds = getMaxCounterFromIds(containerComponent, normalizedName); + + if (maxCounterFromNames == null && maxCounterFromIds != null) { + nextCounter = maxCounterFromIds + 1; + } else if (maxCounterFromIds == null && maxCounterFromNames != null) { + nextCounter = maxCounterFromNames + 1; + } else if (maxCounterFromIds != null && maxCounterFromNames != null) { + nextCounter = maxCounterFromNames > maxCounterFromIds ? maxCounterFromNames + 1 : maxCounterFromIds + 1; + } + } + return nextCounter.toString(); + } + + private Integer getMaxCounterFromNames(Component containerComponent, String normalizedName) { + + Integer maxCounter = 0; + List<String> countersStr = containerComponent.getComponentInstances().stream().filter(ci -> ci.getNormalizedName() != null && ci.getNormalizedName().startsWith(normalizedName)).map(ci -> ci.getNormalizedName().split(normalizedName)[1]) + .collect(Collectors.toList()); + + if (CollectionUtils.isEmpty(countersStr)) { + return null; + } + Integer currCounter = null; + for (String counter : countersStr) { + if (StringUtils.isEmpty(counter)) { + continue; + } + try { + currCounter = Integer.parseInt(counter); + } catch (Exception e) { + continue; + } + maxCounter = maxCounter < currCounter ? currCounter : maxCounter; + } + if (currCounter == null) { + return null; + } + return maxCounter; + } + + private Integer getMaxCounterFromIds(Component containerComponent, String normalizedName) { + + Integer maxCounter = 0; + List<String> countersStr = containerComponent.getComponentInstances().stream().filter(ci -> ci.getUniqueId() != null && ci.getUniqueId().contains(normalizedName)).map(ci -> ci.getUniqueId().split(normalizedName)[1]) + .collect(Collectors.toList()); + + if (CollectionUtils.isEmpty(countersStr)) { + return null; + } + Integer currCounter = null; + for (String counter : countersStr) { + if (StringUtils.isEmpty(counter)) { + continue; + } + try { + currCounter = Integer.parseInt(counter); + } catch (Exception e) { + continue; + } + maxCounter = maxCounter < currCounter ? currCounter : maxCounter; + } + if (currCounter == null) { + return null; + } + return maxCounter; + } + + public Either<RequirementCapabilityRelDef, StorageOperationStatus> associateResourceInstances(String componentId, RequirementCapabilityRelDef requirementDef) { + return nodeTemplateOperation.associateResourceInstances(componentId, requirementDef); + + } + + public Either<List<InputDefinition>, StorageOperationStatus> createAndAssociateInputs(Map<String, InputDefinition> inputs, String componentId) { + + Either<GraphVertex, TitanOperationStatus> getVertexEither = titanDao.getVertexById(componentId, JsonParseFlagEnum.NoParse); + if (getVertexEither.isRight()) { + log.debug("Couldn't fetch component with and unique id {}, error: {}", componentId, getVertexEither.right().value()); + return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getVertexEither.right().value())); + + } + + GraphVertex vertex = getVertexEither.left().value(); + Map<String, PropertyDataDefinition> inputsMap = inputs.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, e -> new PropertyDataDefinition(e.getValue()))); + + StorageOperationStatus status = topologyTemplateOperation.associateInputsToComponent(vertex, inputsMap, componentId); + + if (StorageOperationStatus.OK == status) { + log.debug("Component created successfully!!!"); + List<InputDefinition> inputsResList = null; + if (inputsMap != null && !inputsMap.isEmpty()) { + inputsResList = inputsMap.values().stream().map(i -> new InputDefinition(i)).collect(Collectors.toList()); + } + return Either.left(inputsResList); + } + return Either.right(status); + + } + + public Either<List<InputDefinition>, StorageOperationStatus> addInputsToComponent(Map<String, InputDefinition> inputs, String componentId) { + + Either<GraphVertex, TitanOperationStatus> getVertexEither = titanDao.getVertexById(componentId, JsonParseFlagEnum.NoParse); + if (getVertexEither.isRight()) { + log.debug("Couldn't fetch component with and unique id {}, error: {}", componentId, getVertexEither.right().value()); + return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getVertexEither.right().value())); + + } + + GraphVertex vertex = getVertexEither.left().value(); + Map<String, PropertyDataDefinition> inputsMap = inputs.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, e -> new PropertyDataDefinition(e.getValue()))); + + StorageOperationStatus status = topologyTemplateOperation.addToscaDataToToscaElement(vertex, EdgeLabelEnum.INPUTS, VertexTypeEnum.INPUTS, inputsMap, JsonPresentationFields.NAME); + + if (StorageOperationStatus.OK == status) { + log.debug("Component created successfully!!!"); + List<InputDefinition> inputsResList = null; + if (inputsMap != null && !inputsMap.isEmpty()) { + inputsResList = inputsMap.values().stream().map(i -> new InputDefinition(i)).collect(Collectors.toList()); + } + return Either.left(inputsResList); + } + return Either.right(status); + + } + + public Either<List<InputDefinition>, StorageOperationStatus> updateInputsToComponent(List<InputDefinition> inputs, String componentId) { + + Either<GraphVertex, TitanOperationStatus> getVertexEither = titanDao.getVertexById(componentId, JsonParseFlagEnum.NoParse); + if (getVertexEither.isRight()) { + log.debug("Couldn't fetch component with and unique id {}, error: {}", componentId, getVertexEither.right().value()); + return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getVertexEither.right().value())); + + } + + GraphVertex vertex = getVertexEither.left().value(); + List<PropertyDataDefinition> inputsAsDataDef = inputs.stream().map(PropertyDataDefinition::new).collect(Collectors.toList()); + + StorageOperationStatus status = topologyTemplateOperation.updateToscaDataOfToscaElement(vertex, EdgeLabelEnum.INPUTS, VertexTypeEnum.INPUTS, inputsAsDataDef, JsonPresentationFields.NAME); + + if (StorageOperationStatus.OK == status) { + log.debug("Component created successfully!!!"); + List<InputDefinition> inputsResList = null; + if (inputsAsDataDef != null && !inputsAsDataDef.isEmpty()) { + inputsResList = inputsAsDataDef.stream().map(InputDefinition::new).collect(Collectors.toList()); + } + return Either.left(inputsResList); + } + return Either.right(status); + + } + + // region - ComponentInstance + public Either<Map<String, List<ComponentInstanceProperty>>, StorageOperationStatus> associateComponentInstancePropertiesToComponent(Map<String, List<ComponentInstanceProperty>> instProperties, String componentId) { + + Either<GraphVertex, TitanOperationStatus> getVertexEither = titanDao.getVertexById(componentId, JsonParseFlagEnum.NoParse); + if (getVertexEither.isRight()) { + log.debug("Couldn't fetch component with and unique id {}, error: {}", componentId, getVertexEither.right().value()); + return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getVertexEither.right().value())); + + } + + GraphVertex vertex = getVertexEither.left().value(); + Map<String, MapPropertiesDataDefinition> instPropsMap = new HashMap<>(); + if (instProperties != null) { + + MapPropertiesDataDefinition propertiesMap; + for (Entry<String, List<ComponentInstanceProperty>> entry : instProperties.entrySet()) { + propertiesMap = new MapPropertiesDataDefinition(); + + propertiesMap.setMapToscaDataDefinition(entry.getValue().stream().map(e -> new PropertyDataDefinition(e)).collect(Collectors.toMap(e -> e.getName(), e -> e))); + + instPropsMap.put(entry.getKey(), propertiesMap); + } + } + + StorageOperationStatus status = topologyTemplateOperation.associateInstPropertiesToComponent(vertex, instPropsMap); + + if (StorageOperationStatus.OK == status) { + log.debug("Component created successfully!!!"); + return Either.left(instProperties); + } + return Either.right(status); + + } + + /** + * saves the instInputs as the updated instance inputs of the component container in DB + * @param instInputs + * @param componentId + * @return + */ + public Either<Map<String, List<ComponentInstanceInput>>, StorageOperationStatus> updateComponentInstanceInputsToComponent(Map<String, List<ComponentInstanceInput>> instInputs, String componentId) { + if (instInputs == null || instInputs.isEmpty()) { + return Either.left(instInputs); + } + StorageOperationStatus status; + for ( Entry<String, List<ComponentInstanceInput>> inputsPerIntance : instInputs.entrySet() ) { + List<ComponentInstanceInput> toscaDataListPerInst = inputsPerIntance.getValue(); + List<String> pathKeysPerInst = new ArrayList<>(); + pathKeysPerInst.add(inputsPerIntance.getKey()); + status = topologyTemplateOperation.updateToscaDataDeepElementsOfToscaElement(componentId, EdgeLabelEnum.INST_INPUTS, VertexTypeEnum.INST_INPUTS, toscaDataListPerInst, pathKeysPerInst, JsonPresentationFields.NAME); + if ( status != StorageOperationStatus.OK) { + log.debug("Failed to update component instance inputs for instance {} in component {} edge type {} error {}", inputsPerIntance.getKey(), componentId, EdgeLabelEnum.INST_INPUTS, status); + return Either.right(status); + } + } + + return Either.left(instInputs); + } + + /** + * saves the instProps as the updated instance properties of the component container in DB + * @param instProps + * @param componentId + * @return + */ + public Either<Map<String, List<ComponentInstanceProperty>>, StorageOperationStatus> updateComponentInstancePropsToComponent(Map<String, List<ComponentInstanceProperty>> instProps, String componentId) { + if (instProps == null || instProps.isEmpty()) { + return Either.left(instProps); + } + StorageOperationStatus status; + for ( Entry<String, List<ComponentInstanceProperty>> propsPerIntance : instProps.entrySet() ) { + List<ComponentInstanceProperty> toscaDataListPerInst = propsPerIntance.getValue(); + List<String> pathKeysPerInst = new ArrayList<>(); + pathKeysPerInst.add(propsPerIntance.getKey()); + status = topologyTemplateOperation.updateToscaDataDeepElementsOfToscaElement(componentId, EdgeLabelEnum.INST_PROPERTIES, VertexTypeEnum.INST_PROPERTIES, toscaDataListPerInst, pathKeysPerInst, JsonPresentationFields.NAME); + if ( status != StorageOperationStatus.OK) { + log.debug("Failed to update component instance inputs for instance {} in component {} edge type {} error {}", propsPerIntance.getKey(), componentId, EdgeLabelEnum.INST_PROPERTIES, status); + return Either.right(status); + } + } + + return Either.left(instProps); + } - } public Either<Map<String, List<ComponentInstanceInput>>, StorageOperationStatus> associateComponentInstanceInputsToComponent(Map<String, List<ComponentInstanceInput>> instInputs, String componentId) { Either<GraphVertex, TitanOperationStatus> getVertexEither = titanDao.getVertexById(componentId, JsonParseFlagEnum.NoParse); @@ -1050,1205 +1186,1196 @@ public class ToscaOperationFacade { return Either.right(status); } - public Either<Map<String, List<ComponentInstanceInput>>, StorageOperationStatus> addComponentInstanceInputsToComponent(Component containerComponent, Map<String, List<ComponentInstanceInput>> instProperties) { - - StorageOperationStatus status = StorageOperationStatus.OK; - if (instProperties != null) { - - for (Entry<String, List<ComponentInstanceInput>> entry : instProperties.entrySet()) { - List<ComponentInstanceInput> props = entry.getValue(); - String componentInstanseId = entry.getKey(); - if (props != null && !props.isEmpty()) { - for (ComponentInstanceInput property : props) { - List<ComponentInstanceInput> componentInstancesInputs = containerComponent.getComponentInstancesInputs().get(componentInstanseId); - Optional<ComponentInstanceInput> instanceProperty = componentInstancesInputs.stream().filter(p -> p.getName().equals(property.getName())).findAny(); - if (instanceProperty.isPresent()) { - status = updateComponentInstanceInput(containerComponent, componentInstanseId, property); - } else { - status = addComponentInstanceInput(containerComponent, componentInstanseId, property); - } - if (status != StorageOperationStatus.OK) { - log.debug("Failed to update instance input {} for instance {} error {} ", property, componentInstanseId, status); - return Either.right(status); - } else { - log.trace("instance input {} for instance {} updated", property, componentInstanseId); - } - } - } - } - } - return Either.left(instProperties); - } - - public StorageOperationStatus deleteComponentInstanceInputsToComponent(Map<String, List<ComponentInstanceInput>> instProperties, String componentId) { - - Either<GraphVertex, TitanOperationStatus> getVertexEither = titanDao.getVertexById(componentId, JsonParseFlagEnum.NoParse); - if (getVertexEither.isRight()) { - log.debug("Couldn't fetch component with and unique id {}, error: {}", componentId, getVertexEither.right().value()); - return DaoStatusConverter.convertTitanStatusToStorageStatus(getVertexEither.right().value()); - } + public Either<Map<String, List<ComponentInstanceInput>>, StorageOperationStatus> addComponentInstanceInputsToComponent(Component containerComponent, Map<String, List<ComponentInstanceInput>> instProperties) { + + StorageOperationStatus status = StorageOperationStatus.OK; + if (instProperties != null) { + + for (Entry<String, List<ComponentInstanceInput>> entry : instProperties.entrySet()) { + List<ComponentInstanceInput> props = entry.getValue(); + String componentInstanseId = entry.getKey(); + if (props != null && !props.isEmpty()) { + for (ComponentInstanceInput property : props) { + List<ComponentInstanceInput> componentInstancesInputs = containerComponent.getComponentInstancesInputs().get(componentInstanseId); + Optional<ComponentInstanceInput> instanceProperty = componentInstancesInputs.stream().filter(p -> p.getName().equals(property.getName())).findAny(); + if (instanceProperty.isPresent()) { + status = updateComponentInstanceInput(containerComponent, componentInstanseId, property); + } else { + status = addComponentInstanceInput(containerComponent, componentInstanseId, property); + } + if (status != StorageOperationStatus.OK) { + log.debug("Failed to update instance input {} for instance {} error {} ", property, componentInstanseId, status); + return Either.right(status); + } else { + log.trace("instance input {} for instance {} updated", property, componentInstanseId); + } + } + } + } + } + return Either.left(instProperties); + } - GraphVertex vertex = getVertexEither.left().value(); - Map<String, MapPropertiesDataDefinition> instPropsMap = new HashMap<>(); - if (instProperties != null) { + public StorageOperationStatus deleteComponentInstanceInputsToComponent(Map<String, List<ComponentInstanceInput>> instProperties, String componentId) { - MapPropertiesDataDefinition propertiesMap; - for (Entry<String, List<ComponentInstanceInput>> entry : instProperties.entrySet()) { - propertiesMap = new MapPropertiesDataDefinition(); + Either<GraphVertex, TitanOperationStatus> getVertexEither = titanDao.getVertexById(componentId, JsonParseFlagEnum.NoParse); + if (getVertexEither.isRight()) { + log.debug("Couldn't fetch component with and unique id {}, error: {}", componentId, getVertexEither.right().value()); + return DaoStatusConverter.convertTitanStatusToStorageStatus(getVertexEither.right().value()); - propertiesMap.setMapToscaDataDefinition(entry.getValue().stream().map(e -> new PropertyDataDefinition(e)).collect(Collectors.toMap(e -> e.getName(), e -> e))); + } - instPropsMap.put(entry.getKey(), propertiesMap); - } - } + GraphVertex vertex = getVertexEither.left().value(); + Map<String, MapPropertiesDataDefinition> instPropsMap = new HashMap<>(); + if (instProperties != null) { - return topologyTemplateOperation.deleteInstInputsToComponent(vertex, instPropsMap); + MapPropertiesDataDefinition propertiesMap; + for (Entry<String, List<ComponentInstanceInput>> entry : instProperties.entrySet()) { + propertiesMap = new MapPropertiesDataDefinition(); - } + propertiesMap.setMapToscaDataDefinition(entry.getValue().stream().map(e -> new PropertyDataDefinition(e)).collect(Collectors.toMap(e -> e.getName(), e -> e))); - public Either<Map<String, List<ComponentInstanceProperty>>, StorageOperationStatus> addComponentInstancePropertiesToComponent(Component containerComponent, Map<String, List<ComponentInstanceProperty>> instProperties, String componentId) { + instPropsMap.put(entry.getKey(), propertiesMap); + } + } - StorageOperationStatus status = StorageOperationStatus.OK; - if (instProperties != null) { + return topologyTemplateOperation.deleteInstInputsToComponent(vertex, instPropsMap); - for (Entry<String, List<ComponentInstanceProperty>> entry : instProperties.entrySet()) { - List<ComponentInstanceProperty> props = entry.getValue(); - String componentInstanseId = entry.getKey(); - List<ComponentInstanceProperty> instanceProperties = containerComponent.getComponentInstancesProperties().get(componentInstanseId); - if (props != null && !props.isEmpty()) { - for (ComponentInstanceProperty property : props) { - Optional<ComponentInstanceProperty> instanceProperty = instanceProperties.stream().filter(p -> p.getUniqueId().equals(property.getUniqueId())).findAny(); - if (instanceProperty.isPresent()) { - status = updateComponentInstanceProperty(containerComponent, componentInstanseId, property); - } else { - status = addComponentInstanceProperty(containerComponent, componentInstanseId, property); - } + } - } - } - } - } + public Either<Map<String, List<ComponentInstanceProperty>>, StorageOperationStatus> addComponentInstancePropertiesToComponent(Component containerComponent, Map<String, List<ComponentInstanceProperty>> instProperties, String componentId) { - return Either.left(instProperties); + if (instProperties != null) { - } + for (Entry<String, List<ComponentInstanceProperty>> entry : instProperties.entrySet()) { + List<ComponentInstanceProperty> props = entry.getValue(); + String componentInstanseId = entry.getKey(); + List<ComponentInstanceProperty> instanceProperties = containerComponent.getComponentInstancesProperties().get(componentInstanseId); + if (props != null && !props.isEmpty()) { + for (ComponentInstanceProperty property : props) { + Optional<ComponentInstanceProperty> instanceProperty = instanceProperties.stream().filter(p -> p.getUniqueId().equals(property.getUniqueId())).findAny(); + if (instanceProperty.isPresent()) { + updateComponentInstanceProperty(containerComponent, componentInstanseId, property); + } else { + addComponentInstanceProperty(containerComponent, componentInstanseId, property); + } - public StorageOperationStatus associateDeploymentArtifactsToInstances(Map<String, Map<String, ArtifactDefinition>> instDeploymentArtifacts, String componentId, User user) { + } + } + } + } - Either<GraphVertex, TitanOperationStatus> getVertexEither = titanDao.getVertexById(componentId, JsonParseFlagEnum.NoParse); - if (getVertexEither.isRight()) { - log.debug("Couldn't fetch component with and unique id {}, error: {}", componentId, getVertexEither.right().value()); - return DaoStatusConverter.convertTitanStatusToStorageStatus(getVertexEither.right().value()); + return Either.left(instProperties); - } + } - GraphVertex vertex = getVertexEither.left().value(); - Map<String, MapArtifactDataDefinition> instArtMap = new HashMap<>(); - if (instDeploymentArtifacts != null) { + public StorageOperationStatus associateDeploymentArtifactsToInstances(Map<String, Map<String, ArtifactDefinition>> instDeploymentArtifacts, String componentId, User user) { - MapArtifactDataDefinition artifactsMap; - for (Entry<String, Map<String, ArtifactDefinition>> entry : instDeploymentArtifacts.entrySet()) { - Map<String, ArtifactDefinition> artList = entry.getValue(); - Map<String, ArtifactDataDefinition> artifacts = artList.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, e -> new ArtifactDataDefinition(e.getValue()))); - artifactsMap = nodeTemplateOperation.prepareInstDeploymentArtifactPerInstance(artifacts, entry.getKey(), user, NodeTemplateOperation.HEAT_VF_ENV_NAME); - - instArtMap.put(entry.getKey(), artifactsMap); - } - } - - return topologyTemplateOperation.associateInstDeploymentArtifactsToComponent(vertex, instArtMap); + Either<GraphVertex, TitanOperationStatus> getVertexEither = titanDao.getVertexById(componentId, JsonParseFlagEnum.NoParse); + if (getVertexEither.isRight()) { + log.debug("Couldn't fetch component with and unique id {}, error: {}", componentId, getVertexEither.right().value()); + return DaoStatusConverter.convertTitanStatusToStorageStatus(getVertexEither.right().value()); - } - - public StorageOperationStatus associateArtifactsToInstances(Map<String, Map<String, ArtifactDefinition>> instArtifacts, String componentId, User user) { + } + + GraphVertex vertex = getVertexEither.left().value(); + Map<String, MapArtifactDataDefinition> instArtMap = new HashMap<>(); + if (instDeploymentArtifacts != null) { - Either<GraphVertex, TitanOperationStatus> getVertexEither = titanDao.getVertexById(componentId, JsonParseFlagEnum.NoParse); - if (getVertexEither.isRight()) { - log.debug("Couldn't fetch component with and unique id {}, error: {}", componentId, getVertexEither.right().value()); - return DaoStatusConverter.convertTitanStatusToStorageStatus(getVertexEither.right().value()); + MapArtifactDataDefinition artifactsMap; + for (Entry<String, Map<String, ArtifactDefinition>> entry : instDeploymentArtifacts.entrySet()) { + Map<String, ArtifactDefinition> artList = entry.getValue(); + Map<String, ArtifactDataDefinition> artifacts = artList.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, e -> new ArtifactDataDefinition(e.getValue()))); + artifactsMap = nodeTemplateOperation.prepareInstDeploymentArtifactPerInstance(artifacts, entry.getKey(), user, NodeTemplateOperation.HEAT_VF_ENV_NAME); - } + instArtMap.put(entry.getKey(), artifactsMap); + } + } - GraphVertex vertex = getVertexEither.left().value(); - Map<String, MapArtifactDataDefinition> instArtMap = new HashMap<>(); - if (instArtifacts != null) { + return topologyTemplateOperation.associateInstDeploymentArtifactsToComponent(vertex, instArtMap); - MapArtifactDataDefinition artifactsMap; - for (Entry<String, Map<String, ArtifactDefinition>> entry : instArtifacts.entrySet()) { - Map<String, ArtifactDefinition> artList = entry.getValue(); - Map<String, ArtifactDataDefinition> artifacts = artList.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, e -> new ArtifactDataDefinition(e.getValue()))); - artifactsMap = new MapArtifactDataDefinition(artifacts); + } - instArtMap.put(entry.getKey(), artifactsMap); - } - } + public StorageOperationStatus associateArtifactsToInstances(Map<String, Map<String, ArtifactDefinition>> instArtifacts, String componentId, User user) { - return topologyTemplateOperation.associateInstArtifactsToComponent(vertex, instArtMap); + Either<GraphVertex, TitanOperationStatus> getVertexEither = titanDao.getVertexById(componentId, JsonParseFlagEnum.NoParse); + if (getVertexEither.isRight()) { + log.debug("Couldn't fetch component with and unique id {}, error: {}", componentId, getVertexEither.right().value()); + return DaoStatusConverter.convertTitanStatusToStorageStatus(getVertexEither.right().value()); - } + } - public StorageOperationStatus associateInstAttributeToComponentToInstances(Map<String, List<PropertyDefinition>> instArttributes, String componentId) { + GraphVertex vertex = getVertexEither.left().value(); + Map<String, MapArtifactDataDefinition> instArtMap = new HashMap<>(); + if (instArtifacts != null) { - Either<GraphVertex, TitanOperationStatus> getVertexEither = titanDao.getVertexById(componentId, JsonParseFlagEnum.NoParse); - if (getVertexEither.isRight()) { - log.debug("Couldn't fetch component with and unique id {}, error: {}", componentId, getVertexEither.right().value()); - return DaoStatusConverter.convertTitanStatusToStorageStatus(getVertexEither.right().value()); + MapArtifactDataDefinition artifactsMap; + for (Entry<String, Map<String, ArtifactDefinition>> entry : instArtifacts.entrySet()) { + Map<String, ArtifactDefinition> artList = entry.getValue(); + Map<String, ArtifactDataDefinition> artifacts = artList.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, e -> new ArtifactDataDefinition(e.getValue()))); + artifactsMap = new MapArtifactDataDefinition(artifacts); - } + instArtMap.put(entry.getKey(), artifactsMap); + } + } - GraphVertex vertex = getVertexEither.left().value(); - Map<String, MapPropertiesDataDefinition> instAttr = new HashMap<>(); - if (instArttributes != null) { + return topologyTemplateOperation.associateInstArtifactsToComponent(vertex, instArtMap); - MapPropertiesDataDefinition attributesMap; - for (Entry<String, List<PropertyDefinition>> entry : instArttributes.entrySet()) { - attributesMap = new MapPropertiesDataDefinition(); - attributesMap.setMapToscaDataDefinition(entry.getValue().stream().map(e -> new PropertyDataDefinition(e)).collect(Collectors.toMap(e -> e.getName(), e -> e))); - instAttr.put(entry.getKey(), attributesMap); - } - } + } - return topologyTemplateOperation.associateInstAttributeToComponent(vertex, instAttr); + public StorageOperationStatus associateInstAttributeToComponentToInstances(Map<String, List<PropertyDefinition>> instArttributes, String componentId) { - } + Either<GraphVertex, TitanOperationStatus> getVertexEither = titanDao.getVertexById(componentId, JsonParseFlagEnum.NoParse); + if (getVertexEither.isRight()) { + log.debug("Couldn't fetch component with and unique id {}, error: {}", componentId, getVertexEither.right().value()); + return DaoStatusConverter.convertTitanStatusToStorageStatus(getVertexEither.right().value()); - public StorageOperationStatus associateCalculatedCapReq(Map<ComponentInstance, Map<String, List<CapabilityDefinition>>> instCapabilties, Map<ComponentInstance, Map<String, List<RequirementDefinition>>> instReg, String componentId) { - Either<GraphVertex, TitanOperationStatus> getVertexEither = titanDao.getVertexById(componentId, JsonParseFlagEnum.NoParse); - if (getVertexEither.isRight()) { - log.debug("Couldn't fetch component with and unique id {}, error: {}", componentId, getVertexEither.right().value()); - return DaoStatusConverter.convertTitanStatusToStorageStatus(getVertexEither.right().value()); + } - } + GraphVertex vertex = getVertexEither.left().value(); + Map<String, MapPropertiesDataDefinition> instAttr = new HashMap<>(); + if (instArttributes != null) { + + MapPropertiesDataDefinition attributesMap; + for (Entry<String, List<PropertyDefinition>> entry : instArttributes.entrySet()) { + attributesMap = new MapPropertiesDataDefinition(); + attributesMap.setMapToscaDataDefinition(entry.getValue().stream().map(e -> new PropertyDataDefinition(e)).collect(Collectors.toMap(e -> e.getName(), e -> e))); + instAttr.put(entry.getKey(), attributesMap); + } + } - GraphVertex vertex = getVertexEither.left().value(); + return topologyTemplateOperation.associateInstAttributeToComponent(vertex, instAttr); - Map<String, MapListRequirementDataDefinition> calcRequirements = new HashMap<>(); + } + // endregion - Map<String, MapListCapabiltyDataDefinition> calcCapabilty = new HashMap<>(); - Map<String, MapCapabiltyProperty> calculatedCapabilitiesProperties = new HashMap<>(); - ; - if (instCapabilties != null) { - for (Entry<ComponentInstance, Map<String, List<CapabilityDefinition>>> entry : instCapabilties.entrySet()) { + public StorageOperationStatus associateCalculatedCapReq(Map<ComponentInstance, Map<String, List<CapabilityDefinition>>> instCapabilties, Map<ComponentInstance, Map<String, List<RequirementDefinition>>> instReg, String componentId) { + Either<GraphVertex, TitanOperationStatus> getVertexEither = titanDao.getVertexById(componentId, JsonParseFlagEnum.NoParse); + if (getVertexEither.isRight()) { + log.debug("Couldn't fetch component with and unique id {}, error: {}", componentId, getVertexEither.right().value()); + return DaoStatusConverter.convertTitanStatusToStorageStatus(getVertexEither.right().value()); - Map<String, List<CapabilityDefinition>> caps = entry.getValue(); - Map<String, ListCapabilityDataDefinition> mapToscaDataDefinition = new HashMap<>(); - for (Entry<String, List<CapabilityDefinition>> instCapability : caps.entrySet()) { - mapToscaDataDefinition.put(instCapability.getKey(), new ListCapabilityDataDefinition(instCapability.getValue().stream().map(iCap -> new CapabilityDataDefinition(iCap)).collect(Collectors.toList()))); - } - - ComponentInstanceDataDefinition componentInstance = new ComponentInstanceDataDefinition(entry.getKey()); - MapListCapabiltyDataDefinition capMap = nodeTemplateOperation.prepareCalculatedCapabiltyForNodeType(mapToscaDataDefinition, componentInstance); + } - MapCapabiltyProperty mapCapabiltyProperty = ModelConverter.convertToMapOfMapCapabiltyProperties(caps, componentInstance.getUniqueId(), true); - - calcCapabilty.put(entry.getKey().getUniqueId(), capMap); - calculatedCapabilitiesProperties.put(entry.getKey().getUniqueId(), mapCapabiltyProperty); - } - } - - if (instReg != null) { - for (Entry<ComponentInstance, Map<String, List<RequirementDefinition>>> entry : instReg.entrySet()) { - - Map<String, List<RequirementDefinition>> req = entry.getValue(); - Map<String, ListRequirementDataDefinition> mapToscaDataDefinition = new HashMap<>(); - for (Entry<String, List<RequirementDefinition>> instReq : req.entrySet()) { - mapToscaDataDefinition.put(instReq.getKey(), new ListRequirementDataDefinition(instReq.getValue().stream().map(iCap -> new RequirementDataDefinition(iCap)).collect(Collectors.toList()))); - } - - MapListRequirementDataDefinition capMap = nodeTemplateOperation.prepareCalculatedRequirementForNodeType(mapToscaDataDefinition, new ComponentInstanceDataDefinition(entry.getKey())); - - calcRequirements.put(entry.getKey().getUniqueId(), capMap); - } - } - - StorageOperationStatus status = topologyTemplateOperation.associateCalcCapReqToComponent(vertex, calcRequirements, calcCapabilty, calculatedCapabilitiesProperties); - - return status; - } - - private Either<List<Component>, StorageOperationStatus> getLatestVersionNotAbstractToscaElementsMetadataOnly(boolean isAbstract, Boolean isHighest, ComponentTypeEnum componentTypeEnum, String internalComponentType, VertexTypeEnum vertexType) { - - Map<GraphPropertyEnum, Object> hasProps = new EnumMap<>(GraphPropertyEnum.class); - Map<GraphPropertyEnum, Object> hasNotProps = new EnumMap<>(GraphPropertyEnum.class); - - fillPropsMap(hasProps, hasNotProps, internalComponentType, componentTypeEnum, isAbstract, vertexType); - - Either<List<GraphVertex>, TitanOperationStatus> getRes = titanDao.getByCriteria(vertexType, hasProps, hasNotProps, JsonParseFlagEnum.ParseMetadata); - if (getRes.isRight()) { - if (getRes.right().value().equals(TitanOperationStatus.NOT_FOUND)) { - return Either.left(new ArrayList<>()); - } else { - return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getRes.right().value())); - } - } else { - List<Component> nonAbstractLatestComponents = new ArrayList<>(); - ComponentParametersView params = new ComponentParametersView(true); - params.setIgnoreAllVersions(false); - for (GraphVertex vertexComponent : getRes.left().value()) { - Either<ToscaElement, StorageOperationStatus> componentRes = topologyTemplateOperation.getLightComponent(vertexComponent, componentTypeEnum, params); - if (componentRes.isRight()) { - log.debug("Failed to fetch ligth element for {} error {}", vertexComponent.getUniqueId(), componentRes.right().value()); - return Either.right(componentRes.right().value()); - } else { - Component component = ModelConverter.convertFromToscaElement(componentRes.left().value()); - - nonAbstractLatestComponents.add(component); - } - } - - return Either.left(nonAbstractLatestComponents); - } - } - - public Either<ComponentMetadataData, StorageOperationStatus> getLatestComponentMetadataByUuid(String componentUuid, JsonParseFlagEnum parseFlag, Boolean isHighest) { - - Either<ComponentMetadataData, StorageOperationStatus> result; - - Map<GraphPropertyEnum, Object> hasProperties = new EnumMap<>(GraphPropertyEnum.class); - - hasProperties.put(GraphPropertyEnum.UUID, componentUuid); - if (isHighest != null) { - hasProperties.put(GraphPropertyEnum.IS_HIGHEST_VERSION, isHighest.booleanValue()); - } - - Map<GraphPropertyEnum, Object> propertiesNotToMatch = new EnumMap<>(GraphPropertyEnum.class); - propertiesNotToMatch.put(GraphPropertyEnum.IS_DELETED, true); - - Either<List<GraphVertex>, TitanOperationStatus> getRes = titanDao.getByCriteria(null, hasProperties, propertiesNotToMatch, parseFlag); - if (getRes.isRight()) { - result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getRes.right().value())); - } else { - List<ComponentMetadataData> latestVersionList = getRes.left().value().stream().map(ModelConverter::convertToComponentMetadata).collect(Collectors.toList()); - ComponentMetadataData latestVersion = latestVersionList.size() == 1 ? latestVersionList.get(0) - : latestVersionList.stream().max((c1, c2) -> Double.compare(Double.parseDouble(c1.getMetadataDataDefinition().getVersion()), Double.parseDouble(c2.getMetadataDataDefinition().getVersion()))).get(); - result = Either.left(latestVersion); - } - return result; - } - - public Either<ComponentMetadataData, StorageOperationStatus> getComponentMetadata(String componentId) { - - Either<ComponentMetadataData, StorageOperationStatus> result; - Either<GraphVertex, TitanOperationStatus> getRes = titanDao.getVertexById(componentId, JsonParseFlagEnum.ParseMetadata); - if (getRes.isRight()) { - result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getRes.right().value())); - } else { - ComponentMetadataData componentMetadata = ModelConverter.convertToComponentMetadata(getRes.left().value()); - result = Either.left(componentMetadata); - } - return result; - } - - private Map<String, ComponentMetadataData> findLatestVersion(List<ComponentMetadataData> resourceDataList) { - Map<Pair<String, String>, ComponentMetadataData> latestVersionMap = new HashMap<Pair<String, String>, ComponentMetadataData>(); - for (ComponentMetadataData resourceData : resourceDataList) { - ComponentMetadataData latestVersionData = resourceData; - - ComponentMetadataDataDefinition metadataDataDefinition = resourceData.getMetadataDataDefinition(); - Pair<String, String> pair = createKeyPair(latestVersionData); - if (latestVersionMap.containsKey(pair)) { - latestVersionData = latestVersionMap.get(pair); - String currentVersion = latestVersionData.getMetadataDataDefinition().getVersion(); - String newVersion = metadataDataDefinition.getVersion(); - if (CommonBeUtils.compareAsdcComponentVersions(newVersion, currentVersion)) { - latestVersionData = resourceData; - } - } - if (log.isDebugEnabled()) - log.debug("last certified version of resource = {} version is {}", latestVersionData.getMetadataDataDefinition().getName(), latestVersionData.getMetadataDataDefinition().getVersion()); - - latestVersionMap.put(pair, latestVersionData); - } - - Map<String, ComponentMetadataData> resVersionMap = new HashMap<String, ComponentMetadataData>(); - for (ComponentMetadataData resourceData : latestVersionMap.values()) { - ComponentMetadataData latestVersionData = resourceData; - ComponentMetadataDataDefinition metadataDataDefinition = resourceData.getMetadataDataDefinition(); - if (resVersionMap.containsKey(metadataDataDefinition.getUUID())) { - latestVersionData = resVersionMap.get(metadataDataDefinition.getUUID()); - String currentVersion = latestVersionData.getMetadataDataDefinition().getVersion(); - String newVersion = metadataDataDefinition.getVersion(); - if (CommonBeUtils.compareAsdcComponentVersions(newVersion, currentVersion)) { - latestVersionData = resourceData; - } - } - if (log.isDebugEnabled()) - log.debug("last uuid version of resource = {} version is {}", latestVersionData.getMetadataDataDefinition().getName(), latestVersionData.getMetadataDataDefinition().getVersion()); - resVersionMap.put(latestVersionData.getMetadataDataDefinition().getUUID(), latestVersionData); - } - - return resVersionMap; - } - - private Pair<String, String> createKeyPair(ComponentMetadataData metadataData) { - Pair<String, String> pair; - NodeTypeEnum label = NodeTypeEnum.getByName(metadataData.getLabel()); - switch (label) { - case Resource: - pair = new ImmutablePair<>(metadataData.getMetadataDataDefinition().getName(), ((ResourceMetadataDataDefinition) metadataData.getMetadataDataDefinition()).getResourceType().name()); - break; - default: - pair = new ImmutablePair<>(metadataData.getMetadataDataDefinition().getName(), metadataData.getLabel()); - break; - } - - return pair; - } - - public Either<List<Component>, StorageOperationStatus> getLatestVersionNotAbstractComponents(boolean isAbstract, Boolean isHighest, ComponentTypeEnum componentTypeEnum, String internalComponentType, List<String> componentUids) { - - Either<List<Component>, StorageOperationStatus> result = null; - List<Component> components = new ArrayList<>(); - if (componentUids == null) { - Either<List<String>, StorageOperationStatus> componentUidsRes = getComponentUids(isAbstract, isHighest, componentTypeEnum, internalComponentType, componentUids); - if (componentUidsRes.isRight()) { - result = Either.right(componentUidsRes.right().value()); - } else { - componentUids = componentUidsRes.left().value(); - } - } - if (!componentUids.isEmpty()) { - for (String componentUid : componentUids) { - ComponentParametersView componentParametersView = buildComponentViewForNotAbstract(); - if (internalComponentType != null && "vl".equalsIgnoreCase(internalComponentType)) { - componentParametersView.setIgnoreCapabilities(false); - componentParametersView.setIgnoreRequirements(false); - } - Either<ToscaElement, StorageOperationStatus> getToscaElementRes = nodeTemplateOperation.getToscaElementOperation(componentTypeEnum).getLightComponent(componentUid, componentTypeEnum, componentParametersView); - if (getToscaElementRes.isRight()) { - if (log.isDebugEnabled()) - log.debug("Failed to fetch resource for error is {}", getToscaElementRes.right().value()); - result = Either.right(getToscaElementRes.right().value()); - break; - } - Component component = ModelConverter.convertFromToscaElement(getToscaElementRes.left().value()); - component.setContactId(null); - component.setCreationDate(null); - component.setCreatorUserId(null); - component.setCreatorFullName(null); - component.setLastUpdateDate(null); - component.setLastUpdaterUserId(null); - component.setLastUpdaterFullName(null); - component.setNormalizedName(null); - components.add(component); - } - } - if (result == null) { - result = Either.left(components); - } - return result; - } - - private Either<List<String>, StorageOperationStatus> getComponentUids(boolean isAbstract, Boolean isHighest, ComponentTypeEnum componentTypeEnum, String internalComponentType, List<String> componentUids) { - - Either<List<String>, StorageOperationStatus> result = null; - Either<List<Component>, StorageOperationStatus> getToscaElementsRes = getLatestVersionNotAbstractMetadataOnly(isAbstract, isHighest, componentTypeEnum, internalComponentType); - if (getToscaElementsRes.isRight()) { - result = Either.right(getToscaElementsRes.right().value()); - } else { - List<Component> collection = getToscaElementsRes.left().value(); - if (collection == null) { - componentUids = new ArrayList<>(); - } else { - componentUids = collection.stream().map(p -> p.getUniqueId()).collect(Collectors.toList()); - } - } - if (result == null) { - result = Either.left(componentUids); - } - return result; - } - - private ComponentParametersView buildComponentViewForNotAbstract() { - ComponentParametersView componentParametersView = new ComponentParametersView(); - componentParametersView.disableAll(); - componentParametersView.setIgnoreCategories(false); - componentParametersView.setIgnoreAllVersions(false); - return componentParametersView; - } - - public Either<Boolean, StorageOperationStatus> validateComponentNameExists(String name, ResourceTypeEnum resourceType, ComponentTypeEnum componentType) { - Either<Boolean, StorageOperationStatus> result = validateComponentNameUniqueness(name, resourceType, componentType); - if (result.isLeft()) { - result = Either.left(!result.left().value()); - } - return result; - } - - public Either<Boolean, StorageOperationStatus> validateComponentNameUniqueness(String name, ResourceTypeEnum resourceType, ComponentTypeEnum componentType) { - VertexTypeEnum vertexType = ModelConverter.isAtomicComponent(resourceType) ? VertexTypeEnum.NODE_TYPE : VertexTypeEnum.TOPOLOGY_TEMPLATE; - String normalizedName = ValidationUtils.normaliseComponentName(name); - Map<GraphPropertyEnum, Object> properties = new EnumMap<>(GraphPropertyEnum.class); - properties.put(GraphPropertyEnum.NORMALIZED_NAME, normalizedName); - properties.put(GraphPropertyEnum.COMPONENT_TYPE, componentType.name()); - - Either<List<GraphVertex>, TitanOperationStatus> vertexEither = titanDao.getByCriteria(vertexType, properties, JsonParseFlagEnum.NoParse); - if (vertexEither.isRight() && vertexEither.right().value() != TitanOperationStatus.NOT_FOUND) { - log.debug("failed to get vertex from graph with property normalizedName: {}", normalizedName); - return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(vertexEither.right().value())); - } - List<GraphVertex> vertexList = vertexEither.isLeft() ? vertexEither.left().value() : null; - if (vertexList != null && !vertexList.isEmpty()) { - return Either.left(false); - } else { - return Either.left(true); - } - } - - - private void fillNodeTypePropsMap(Map<GraphPropertyEnum, Object> hasProps, Map<GraphPropertyEnum, Object> hasNotProps, String internalComponentType) { - switch (internalComponentType.toLowerCase()) { - case "vf": - case "cvfc": - hasNotProps.put(GraphPropertyEnum.RESOURCE_TYPE, ResourceTypeEnum.VFCMT.name()); - break; - case "service": - case "pnf" : - hasNotProps.put(GraphPropertyEnum.RESOURCE_TYPE, Arrays.asList(ResourceTypeEnum.VFC.name(), ResourceTypeEnum.VFCMT.name())); - break; - case "vl": - hasProps.put(GraphPropertyEnum.RESOURCE_TYPE, ResourceTypeEnum.VL.name()); - break; - default: - break; - } - } - + GraphVertex vertex = getVertexEither.left().value(); + + Map<String, MapListRequirementDataDefinition> calcRequirements = new HashMap<>(); + + Map<String, MapListCapabiltyDataDefinition> calcCapabilty = new HashMap<>(); + Map<String, MapCapabiltyProperty> calculatedCapabilitiesProperties = new HashMap<>(); + ; + if (instCapabilties != null) { + for (Entry<ComponentInstance, Map<String, List<CapabilityDefinition>>> entry : instCapabilties.entrySet()) { + + Map<String, List<CapabilityDefinition>> caps = entry.getValue(); + Map<String, ListCapabilityDataDefinition> mapToscaDataDefinition = new HashMap<>(); + for (Entry<String, List<CapabilityDefinition>> instCapability : caps.entrySet()) { + mapToscaDataDefinition.put(instCapability.getKey(), new ListCapabilityDataDefinition(instCapability.getValue().stream().map(iCap -> new CapabilityDataDefinition(iCap)).collect(Collectors.toList()))); + } + + ComponentInstanceDataDefinition componentInstance = new ComponentInstanceDataDefinition(entry.getKey()); + MapListCapabiltyDataDefinition capMap = nodeTemplateOperation.prepareCalculatedCapabiltyForNodeType(mapToscaDataDefinition, componentInstance); + + MapCapabiltyProperty mapCapabiltyProperty = ModelConverter.convertToMapOfMapCapabiltyProperties(caps, componentInstance.getUniqueId(), true); + + calcCapabilty.put(entry.getKey().getUniqueId(), capMap); + calculatedCapabilitiesProperties.put(entry.getKey().getUniqueId(), mapCapabiltyProperty); + } + } + + if (instReg != null) { + for (Entry<ComponentInstance, Map<String, List<RequirementDefinition>>> entry : instReg.entrySet()) { + + Map<String, List<RequirementDefinition>> req = entry.getValue(); + Map<String, ListRequirementDataDefinition> mapToscaDataDefinition = new HashMap<>(); + for (Entry<String, List<RequirementDefinition>> instReq : req.entrySet()) { + mapToscaDataDefinition.put(instReq.getKey(), new ListRequirementDataDefinition(instReq.getValue().stream().map(iCap -> new RequirementDataDefinition(iCap)).collect(Collectors.toList()))); + } + + MapListRequirementDataDefinition capMap = nodeTemplateOperation.prepareCalculatedRequirementForNodeType(mapToscaDataDefinition, new ComponentInstanceDataDefinition(entry.getKey())); + + calcRequirements.put(entry.getKey().getUniqueId(), capMap); + } + } + + StorageOperationStatus status = topologyTemplateOperation.associateCalcCapReqToComponent(vertex, calcRequirements, calcCapabilty, calculatedCapabilitiesProperties); + + return status; + } + + private Either<List<Service>, StorageOperationStatus> getLatestVersionNonCheckoutServicesMetadataOnly(Map<GraphPropertyEnum, Object> hasProps, Map<GraphPropertyEnum, Object> hasNotProps) { + List<Service> services = new ArrayList<>(); + List<LifecycleStateEnum> states = new ArrayList<>(); + // include props + hasProps.put(GraphPropertyEnum.COMPONENT_TYPE, ComponentTypeEnum.SERVICE.name()); + hasProps.put(GraphPropertyEnum.IS_HIGHEST_VERSION, true); + + // exclude props + states.add(LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT); + states.add(LifecycleStateEnum.READY_FOR_CERTIFICATION); + states.add(LifecycleStateEnum.CERTIFICATION_IN_PROGRESS); + hasNotProps.put(GraphPropertyEnum.STATE, states); + hasNotProps.put(GraphPropertyEnum.IS_DELETED, true); + return fetchServicesByCriteria(services, hasProps, hasNotProps); + } + + private Either<List<Component>, StorageOperationStatus> getLatestVersionNotAbstractToscaElementsMetadataOnly(boolean isAbstract, Boolean isHighest, ComponentTypeEnum componentTypeEnum, String internalComponentType, VertexTypeEnum vertexType) { + List<Service> services = null; + Map<GraphPropertyEnum, Object> hasProps = new EnumMap<>(GraphPropertyEnum.class); + Map<GraphPropertyEnum, Object> hasNotProps = new EnumMap<>(GraphPropertyEnum.class); + fillPropsMap(hasProps, hasNotProps, internalComponentType, componentTypeEnum, isAbstract, vertexType); + Either<List<GraphVertex>, TitanOperationStatus> getRes = titanDao.getByCriteria(vertexType, hasProps, hasNotProps, JsonParseFlagEnum.ParseMetadata); + if (getRes.isRight()) { + if (getRes.right().value().equals(TitanOperationStatus.NOT_FOUND)) { + return Either.left(new ArrayList<>()); + } else { + return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getRes.right().value())); + } + } else { + // region -> Fetch non checked-out services + if (internalComponentType != null && internalComponentType.toLowerCase().trim().equals("service") && VertexTypeEnum.NODE_TYPE == vertexType) { // and NODE_TYPE==vertextype + Either<List<Service>, StorageOperationStatus> result = getLatestVersionNonCheckoutServicesMetadataOnly(new EnumMap<>(GraphPropertyEnum.class), new EnumMap<>(GraphPropertyEnum.class)); + if (result.isRight()) { + log.debug("Failed to fetch services for"); + return Either.right(result.right().value()); + } + services = result.left().value(); + if (CollectionUtils.isEmpty(services) && log.isTraceEnabled()) + log.trace("No relevant services available"); + } + // endregion + List<Component> nonAbstractLatestComponents = new ArrayList<>(); + ComponentParametersView params = new ComponentParametersView(true); + params.setIgnoreAllVersions(false); + for (GraphVertex vertexComponent : getRes.left().value()) { + Either<ToscaElement, StorageOperationStatus> componentRes = topologyTemplateOperation.getLightComponent(vertexComponent, componentTypeEnum, params); + if (componentRes.isRight()) { + log.debug("Failed to fetch ligth element for {} error {}", vertexComponent.getUniqueId(), componentRes.right().value()); + return Either.right(componentRes.right().value()); + } else { + Component component = ModelConverter.convertFromToscaElement(componentRes.left().value()); + nonAbstractLatestComponents.add(component); + } + } + if (CollectionUtils.isNotEmpty(services)) + nonAbstractLatestComponents.addAll(services); + return Either.left(nonAbstractLatestComponents); + } + } + + public Either<ComponentMetadataData, StorageOperationStatus> getLatestComponentMetadataByUuid(String componentUuid, JsonParseFlagEnum parseFlag, Boolean isHighest) { + + Either<ComponentMetadataData, StorageOperationStatus> result; + + Map<GraphPropertyEnum, Object> hasProperties = new EnumMap<>(GraphPropertyEnum.class); + + hasProperties.put(GraphPropertyEnum.UUID, componentUuid); + if (isHighest != null) { + hasProperties.put(GraphPropertyEnum.IS_HIGHEST_VERSION, isHighest.booleanValue()); + } + + Map<GraphPropertyEnum, Object> propertiesNotToMatch = new EnumMap<>(GraphPropertyEnum.class); + propertiesNotToMatch.put(GraphPropertyEnum.IS_DELETED, true); + + Either<List<GraphVertex>, TitanOperationStatus> getRes = titanDao.getByCriteria(null, hasProperties, propertiesNotToMatch, parseFlag); + if (getRes.isRight()) { + result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getRes.right().value())); + } else { + List<ComponentMetadataData> latestVersionList = getRes.left().value().stream().map(ModelConverter::convertToComponentMetadata).collect(Collectors.toList()); + ComponentMetadataData latestVersion = latestVersionList.size() == 1 ? latestVersionList.get(0) + : latestVersionList.stream().max((c1, c2) -> Double.compare(Double.parseDouble(c1.getMetadataDataDefinition().getVersion()), Double.parseDouble(c2.getMetadataDataDefinition().getVersion()))).get(); + result = Either.left(latestVersion); + } + return result; + } + + public Either<ComponentMetadataData, StorageOperationStatus> getComponentMetadata(String componentId) { + + Either<ComponentMetadataData, StorageOperationStatus> result; + Either<GraphVertex, TitanOperationStatus> getRes = titanDao.getVertexById(componentId, JsonParseFlagEnum.ParseMetadata); + if (getRes.isRight()) { + result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getRes.right().value())); + } else { + ComponentMetadataData componentMetadata = ModelConverter.convertToComponentMetadata(getRes.left().value()); + result = Either.left(componentMetadata); + } + return result; + } + + public Either<List<Component>, StorageOperationStatus> getLatestVersionNotAbstractComponents(boolean isAbstract, Boolean isHighest, ComponentTypeEnum componentTypeEnum, String internalComponentType, List<String> componentUids) { - private void fillTopologyTemplatePropsMap(Map<GraphPropertyEnum, Object> hasProps, Map<GraphPropertyEnum, Object> hasNotProps, ComponentTypeEnum componentTypeEnum, String internalComponentType) { - switch (componentTypeEnum) { - case RESOURCE: - hasProps.put(GraphPropertyEnum.COMPONENT_TYPE, ComponentTypeEnum.RESOURCE.name()); - break; - case SERVICE: - hasProps.put(GraphPropertyEnum.COMPONENT_TYPE, ComponentTypeEnum.SERVICE.name()); - break; - default: - break; - } - switch (internalComponentType.toLowerCase()) { - case "vf": - case "cvfc": - hasProps.put(GraphPropertyEnum.RESOURCE_TYPE, ResourceTypeEnum.CVFC.name()); - break; - case "service": - hasNotProps.put(GraphPropertyEnum.RESOURCE_TYPE, ResourceTypeEnum.CVFC.name()); - break; - default: - break; - } - } - - private void fillPropsMap(Map<GraphPropertyEnum, Object> hasProps, Map<GraphPropertyEnum, Object> hasNotProps, String internalComponentType, ComponentTypeEnum componentTypeEnum, boolean isAbstract, VertexTypeEnum internalVertexType) { - hasNotProps.put(GraphPropertyEnum.STATE, LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT.name()); - - hasNotProps.put(GraphPropertyEnum.IS_DELETED, true); - hasProps.put(GraphPropertyEnum.IS_HIGHEST_VERSION, true); - if (VertexTypeEnum.NODE_TYPE == internalVertexType) { - hasProps.put(GraphPropertyEnum.IS_ABSTRACT, isAbstract); - if (internalComponentType != null) { - fillNodeTypePropsMap(hasProps, hasNotProps, internalComponentType); - } - } else { - fillTopologyTemplatePropsMap(hasProps, hasNotProps, componentTypeEnum, internalComponentType); - } - } - - private List<VertexTypeEnum> getInternalVertexTypes(ComponentTypeEnum componentTypeEnum, String internalComponentType) { - List<VertexTypeEnum> internalVertexTypes = new ArrayList<>(); - if (ComponentTypeEnum.RESOURCE == componentTypeEnum) { - internalVertexTypes.add(VertexTypeEnum.NODE_TYPE); - } - if (ComponentTypeEnum.SERVICE == componentTypeEnum || "service".equalsIgnoreCase(internalComponentType) || "vf".equalsIgnoreCase(internalComponentType)) { - internalVertexTypes.add(VertexTypeEnum.TOPOLOGY_TEMPLATE); - } - return internalVertexTypes; - } - - public Either<List<Component>, StorageOperationStatus> getLatestVersionNotAbstractMetadataOnly(boolean isAbstract, Boolean isHighest, ComponentTypeEnum componentTypeEnum, String internalComponentType) { - List<VertexTypeEnum> internalVertexTypes = getInternalVertexTypes(componentTypeEnum, internalComponentType); - List<Component> result = new ArrayList<>(); - for (VertexTypeEnum vertexType : internalVertexTypes) { - Either<List<Component>, StorageOperationStatus> listByVertexType = getLatestVersionNotAbstractToscaElementsMetadataOnly(isAbstract, isHighest, componentTypeEnum, internalComponentType, vertexType); - if (listByVertexType.isRight()) { - return listByVertexType; - } - result.addAll(listByVertexType.left().value()); - } - return Either.left(result); - - } - - public Either<List<Component>, StorageOperationStatus> getLatestComponentListByUuid(String componentUuid) { - Map<GraphPropertyEnum, Object> propertiesToMatch = new EnumMap<>(GraphPropertyEnum.class); - propertiesToMatch.put(GraphPropertyEnum.IS_HIGHEST_VERSION, true); + Either<List<Component>, StorageOperationStatus> result = null; + List<Component> components = new ArrayList<>(); + if (componentUids == null) { + Either<List<String>, StorageOperationStatus> componentUidsRes = getComponentUids(isAbstract, isHighest, componentTypeEnum, internalComponentType, componentUids); + if (componentUidsRes.isRight()) { + result = Either.right(componentUidsRes.right().value()); + } else { + componentUids = componentUidsRes.left().value(); + } + } + if (!componentUids.isEmpty()) { + for (String componentUid : componentUids) { + ComponentParametersView componentParametersView = buildComponentViewForNotAbstract(); + if (internalComponentType != null && "vl".equalsIgnoreCase(internalComponentType)) { + componentParametersView.setIgnoreCapabilities(false); + componentParametersView.setIgnoreRequirements(false); + } + Either<ToscaElement, StorageOperationStatus> getToscaElementRes = nodeTemplateOperation.getToscaElementOperation(componentTypeEnum).getLightComponent(componentUid, componentTypeEnum, componentParametersView); + if (getToscaElementRes.isRight()) { + if (log.isDebugEnabled()) + log.debug("Failed to fetch resource for error is {}", getToscaElementRes.right().value()); + result = Either.right(getToscaElementRes.right().value()); + break; + } + Component component = ModelConverter.convertFromToscaElement(getToscaElementRes.left().value()); + component.setContactId(null); + component.setCreationDate(null); + component.setCreatorUserId(null); + component.setCreatorFullName(null); + component.setLastUpdateDate(null); + component.setLastUpdaterUserId(null); + component.setLastUpdaterFullName(null); + component.setNormalizedName(null); + components.add(component); + } + } + if (result == null) { + result = Either.left(components); + } + return result; + } + + private Either<List<String>, StorageOperationStatus> getComponentUids(boolean isAbstract, Boolean isHighest, ComponentTypeEnum componentTypeEnum, String internalComponentType, List<String> componentUids) { + + Either<List<String>, StorageOperationStatus> result = null; + Either<List<Component>, StorageOperationStatus> getToscaElementsRes = getLatestVersionNotAbstractMetadataOnly(isAbstract, isHighest, componentTypeEnum, internalComponentType); + if (getToscaElementsRes.isRight()) { + result = Either.right(getToscaElementsRes.right().value()); + } else { + List<Component> collection = getToscaElementsRes.left().value(); + if (collection == null) { + componentUids = new ArrayList<>(); + } else { + componentUids = collection.stream().map(p -> p.getUniqueId()).collect(Collectors.toList()); + } + } + if (result == null) { + result = Either.left(componentUids); + } + return result; + } + + private ComponentParametersView buildComponentViewForNotAbstract() { + ComponentParametersView componentParametersView = new ComponentParametersView(); + componentParametersView.disableAll(); + componentParametersView.setIgnoreCategories(false); + componentParametersView.setIgnoreAllVersions(false); + return componentParametersView; + } + + public Either<Boolean, StorageOperationStatus> validateComponentNameExists(String name, ResourceTypeEnum resourceType, ComponentTypeEnum componentType) { + Either<Boolean, StorageOperationStatus> result = validateComponentNameUniqueness(name, resourceType, componentType); + if (result.isLeft()) { + result = Either.left(!result.left().value()); + } + return result; + } + + public Either<Boolean, StorageOperationStatus> validateComponentNameUniqueness(String name, ResourceTypeEnum resourceType, ComponentTypeEnum componentType) { + VertexTypeEnum vertexType = ModelConverter.isAtomicComponent(resourceType) ? VertexTypeEnum.NODE_TYPE : VertexTypeEnum.TOPOLOGY_TEMPLATE; + String normalizedName = ValidationUtils.normaliseComponentName(name); + Map<GraphPropertyEnum, Object> properties = new EnumMap<>(GraphPropertyEnum.class); + properties.put(GraphPropertyEnum.NORMALIZED_NAME, normalizedName); + properties.put(GraphPropertyEnum.COMPONENT_TYPE, componentType.name()); + + Either<List<GraphVertex>, TitanOperationStatus> vertexEither = titanDao.getByCriteria(vertexType, properties, JsonParseFlagEnum.NoParse); + if (vertexEither.isRight() && vertexEither.right().value() != TitanOperationStatus.NOT_FOUND) { + log.debug("failed to get vertex from graph with property normalizedName: {}", normalizedName); + return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(vertexEither.right().value())); + } + List<GraphVertex> vertexList = vertexEither.isLeft() ? vertexEither.left().value() : null; + if (vertexList != null && !vertexList.isEmpty()) { + return Either.left(false); + } else { + return Either.left(true); + } + } + + private void fillNodeTypePropsMap(Map<GraphPropertyEnum, Object> hasProps, Map<GraphPropertyEnum, Object> hasNotProps, String internalComponentType) { + switch (internalComponentType.toLowerCase()) { + case "vf": + case "cvfc": + hasNotProps.put(GraphPropertyEnum.RESOURCE_TYPE, Arrays.asList(ResourceTypeEnum.VFCMT.name(), ResourceTypeEnum.Configuration.name())); + break; + case "service": + case "pnf": + hasNotProps.put(GraphPropertyEnum.RESOURCE_TYPE, Arrays.asList(ResourceTypeEnum.VFC.name(), ResourceTypeEnum.VFCMT.name())); + break; + case "vl": + hasProps.put(GraphPropertyEnum.RESOURCE_TYPE, ResourceTypeEnum.VL.name()); + break; + default: + break; + } + } + + private void fillTopologyTemplatePropsMap(Map<GraphPropertyEnum, Object> hasProps, Map<GraphPropertyEnum, Object> hasNotProps, ComponentTypeEnum componentTypeEnum, String internalComponentType) { + switch (componentTypeEnum) { + case RESOURCE: + hasProps.put(GraphPropertyEnum.COMPONENT_TYPE, ComponentTypeEnum.RESOURCE.name()); + break; + case SERVICE: + hasProps.put(GraphPropertyEnum.COMPONENT_TYPE, ComponentTypeEnum.SERVICE.name()); + break; + default: + break; + } + switch (internalComponentType.toLowerCase()) { + case "vf": + case "cvfc": + hasProps.put(GraphPropertyEnum.RESOURCE_TYPE, ResourceTypeEnum.CVFC.name()); + break; + case "service": + hasNotProps.put(GraphPropertyEnum.RESOURCE_TYPE, ResourceTypeEnum.CVFC.name()); + break; + default: + break; + } + } + + private void fillPropsMap(Map<GraphPropertyEnum, Object> hasProps, Map<GraphPropertyEnum, Object> hasNotProps, String internalComponentType, ComponentTypeEnum componentTypeEnum, boolean isAbstract, VertexTypeEnum internalVertexType) { + hasNotProps.put(GraphPropertyEnum.STATE, LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT.name()); + + hasNotProps.put(GraphPropertyEnum.IS_DELETED, true); + hasProps.put(GraphPropertyEnum.IS_HIGHEST_VERSION, true); + if (VertexTypeEnum.NODE_TYPE == internalVertexType) { + hasProps.put(GraphPropertyEnum.IS_ABSTRACT, isAbstract); + if (internalComponentType != null) { + fillNodeTypePropsMap(hasProps, hasNotProps, internalComponentType); + } + } else { + fillTopologyTemplatePropsMap(hasProps, hasNotProps, componentTypeEnum, internalComponentType); + } + } + + private List<VertexTypeEnum> getInternalVertexTypes(ComponentTypeEnum componentTypeEnum, String internalComponentType) { + List<VertexTypeEnum> internalVertexTypes = new ArrayList<>(); + if (ComponentTypeEnum.RESOURCE == componentTypeEnum) { + internalVertexTypes.add(VertexTypeEnum.NODE_TYPE); + } + if (ComponentTypeEnum.SERVICE == componentTypeEnum || "service".equalsIgnoreCase(internalComponentType) || "vf".equalsIgnoreCase(internalComponentType)) { + internalVertexTypes.add(VertexTypeEnum.TOPOLOGY_TEMPLATE); + } + return internalVertexTypes; + } + + public Either<List<Component>, StorageOperationStatus> getLatestVersionNotAbstractMetadataOnly(boolean isAbstract, Boolean isHighest, ComponentTypeEnum componentTypeEnum, String internalComponentType) { + List<VertexTypeEnum> internalVertexTypes = getInternalVertexTypes(componentTypeEnum, internalComponentType); + List<Component> result = new ArrayList<>(); + for (VertexTypeEnum vertexType : internalVertexTypes) { + Either<List<Component>, StorageOperationStatus> listByVertexType = getLatestVersionNotAbstractToscaElementsMetadataOnly(isAbstract, isHighest, componentTypeEnum, internalComponentType, vertexType); + if (listByVertexType.isRight()) { + return listByVertexType; + } + result.addAll(listByVertexType.left().value()); + } + return Either.left(result); + + } + + public Either<List<Component>, StorageOperationStatus> getLatestComponentListByUuid(String componentUuid) { + Map<GraphPropertyEnum, Object> propertiesToMatch = new EnumMap<>(GraphPropertyEnum.class); + propertiesToMatch.put(GraphPropertyEnum.IS_HIGHEST_VERSION, true); Either<List<Component>, StorageOperationStatus> componentListByUuid = getComponentListByUuid(componentUuid, propertiesToMatch); return componentListByUuid; - } + } - public Either<List<Component>, StorageOperationStatus> getComponentListByUuid(String componentUuid, Map<GraphPropertyEnum, Object> additionalPropertiesToMatch) { + public Either<List<Component>, StorageOperationStatus> getComponentListByUuid(String componentUuid, Map<GraphPropertyEnum, Object> additionalPropertiesToMatch) { - Map<GraphPropertyEnum, Object> propertiesToMatch = new EnumMap<>(GraphPropertyEnum.class); + Map<GraphPropertyEnum, Object> propertiesToMatch = new EnumMap<>(GraphPropertyEnum.class); - if (additionalPropertiesToMatch != null) { - propertiesToMatch.putAll(additionalPropertiesToMatch); - } + if (additionalPropertiesToMatch != null) { + propertiesToMatch.putAll(additionalPropertiesToMatch); + } - propertiesToMatch.put(GraphPropertyEnum.UUID, componentUuid); + propertiesToMatch.put(GraphPropertyEnum.UUID, componentUuid); - Map<GraphPropertyEnum, Object> propertiesNotToMatch = new EnumMap<>(GraphPropertyEnum.class); - propertiesNotToMatch.put(GraphPropertyEnum.IS_DELETED, true); + Map<GraphPropertyEnum, Object> propertiesNotToMatch = new EnumMap<>(GraphPropertyEnum.class); + propertiesNotToMatch.put(GraphPropertyEnum.IS_DELETED, true); - Either<List<GraphVertex>, TitanOperationStatus> vertexEither = titanDao.getByCriteria(null, propertiesToMatch, propertiesNotToMatch, JsonParseFlagEnum.ParseAll); + Either<List<GraphVertex>, TitanOperationStatus> vertexEither = titanDao.getByCriteria(null, propertiesToMatch, propertiesNotToMatch, JsonParseFlagEnum.ParseAll); - if (vertexEither.isRight()) { - log.debug("Couldn't fetch metadata for component with type {} and uuid {}, error: {}", componentUuid, vertexEither.right().value()); - return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(vertexEither.right().value())); - } - List<GraphVertex> vertexList = vertexEither.isLeft() ? vertexEither.left().value() : null; + if (vertexEither.isRight()) { + log.debug("Couldn't fetch metadata for component with type {} and uuid {}, error: {}", componentUuid, vertexEither.right().value()); + return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(vertexEither.right().value())); + } + List<GraphVertex> vertexList = vertexEither.isLeft() ? vertexEither.left().value() : null; - if (vertexList == null || vertexList.isEmpty()) { - log.debug("Component with uuid {} was not found", componentUuid); - return Either.right(StorageOperationStatus.NOT_FOUND); - } + if (vertexList == null || vertexList.isEmpty()) { + log.debug("Component with uuid {} was not found", componentUuid); + return Either.right(StorageOperationStatus.NOT_FOUND); + } ArrayList<Component> latestComponents = new ArrayList<>(); - for (GraphVertex vertex : vertexList) { + for (GraphVertex vertex : vertexList) { Either<Component, StorageOperationStatus> toscaElementByOperation = getToscaElementByOperation(vertex); - - if(toscaElementByOperation.isRight()){ + + if (toscaElementByOperation.isRight()) { log.debug("Could not fetch the following Component by UUID {}", vertex.getUniqueId()); return Either.right(toscaElementByOperation.right().value()); } - + latestComponents.add(toscaElementByOperation.left().value()); } - - if(latestComponents.size() > 1) { + + if (latestComponents.size() > 1) { for (Component component : latestComponents) { - if(component.isHighestVersion()){ + if (component.isHighestVersion()) { LinkedList<Component> highestComponent = new LinkedList<>(); highestComponent.add(component); return Either.left(highestComponent); } } - } - - return Either.left(latestComponents); - } - - public Either<Component, StorageOperationStatus> getLatestComponentByUuid(String componentUuid) { - - Either<List<Component>, StorageOperationStatus> latestVersionListEither = getLatestComponentListByUuid(componentUuid); - - if (latestVersionListEither.isRight()) { - return Either.right(latestVersionListEither.right().value()); - } - - List<Component> latestVersionList = latestVersionListEither.left().value(); - - if (latestVersionList.isEmpty()) { - return Either.right(StorageOperationStatus.NOT_FOUND); - } - Component component = latestVersionList.size() == 1 ? latestVersionList.get(0) : latestVersionList.stream().max((c1, c2) -> Double.compare(Double.parseDouble(c1.getVersion()), Double.parseDouble(c2.getVersion()))).get(); - - return Either.left(component); - } - - public Either<List<Resource>, StorageOperationStatus> getAllCertifiedResources(boolean isAbstract, Boolean isHighest) { - - List<Resource> resources = new ArrayList<>(); - Map<GraphPropertyEnum, Object> propertiesToMatch = new EnumMap<>(GraphPropertyEnum.class); - Map<GraphPropertyEnum, Object> propertiesNotToMatch = new EnumMap<>(GraphPropertyEnum.class); - - propertiesToMatch.put(GraphPropertyEnum.IS_ABSTRACT, isAbstract); - if (isHighest != null) { - propertiesToMatch.put(GraphPropertyEnum.IS_HIGHEST_VERSION, isHighest.booleanValue()); - } - propertiesToMatch.put(GraphPropertyEnum.STATE, LifecycleStateEnum.CERTIFIED.name()); - propertiesToMatch.put(GraphPropertyEnum.COMPONENT_TYPE, ComponentTypeEnum.RESOURCE.name()); - propertiesNotToMatch.put(GraphPropertyEnum.IS_DELETED, true); - - Either<List<GraphVertex>, TitanOperationStatus> getResourcesRes = titanDao.getByCriteria(null, propertiesToMatch, propertiesNotToMatch, JsonParseFlagEnum.ParseAll); - - if (getResourcesRes.isRight()) { - log.debug("Failed to fetch all certified resources. Status is {}", getResourcesRes.right().value()); - return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getResourcesRes.right().value())); - } - List<GraphVertex> resourceVerticies = getResourcesRes.left().value(); - for (GraphVertex resourceV : resourceVerticies) { - Either<Resource, StorageOperationStatus> getResourceRes = getToscaElement(resourceV); - if (getResourceRes.isRight()) { - return Either.right(getResourceRes.right().value()); - } - resources.add(getResourceRes.left().value()); - } - return Either.left(resources); - } - - public <T extends Component> Either<T, StorageOperationStatus> getLatestByNameAndVersion(String name, String version, JsonParseFlagEnum parseFlag) { - Either<T, StorageOperationStatus> result; - - Map<GraphPropertyEnum, Object> hasProperties = new EnumMap<>(GraphPropertyEnum.class); - Map<GraphPropertyEnum, Object> hasNotProperties = new EnumMap<>(GraphPropertyEnum.class); - - hasProperties.put(GraphPropertyEnum.NAME, name); - hasProperties.put(GraphPropertyEnum.VERSION, version); - hasProperties.put(GraphPropertyEnum.IS_HIGHEST_VERSION, true); - - hasNotProperties.put(GraphPropertyEnum.IS_DELETED, true); - - Either<List<GraphVertex>, TitanOperationStatus> getResourceRes = titanDao.getByCriteria(null, hasProperties, hasNotProperties, parseFlag); - if (getResourceRes.isRight()) { - TitanOperationStatus status = getResourceRes.right().value(); - log.debug("failed to find resource with name {}, version {}. Status is {} ", name, version, status); - result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status)); - return result; - } - return getToscaElementByOperation(getResourceRes.left().value().get(0)); - } - - public Either<Resource, StorageOperationStatus> getLatestComponentByCsarOrName(ComponentTypeEnum componentType, String csarUUID, String systemName) { - return getLatestComponentByCsarOrName(componentType, csarUUID, systemName, false, JsonParseFlagEnum.ParseAll); - } - - public Either<Resource, StorageOperationStatus> getLatestComponentByCsarOrName(ComponentTypeEnum componentType, String csarUUID, String systemName, boolean allowDeleted, JsonParseFlagEnum parseFlag) { - Map<GraphPropertyEnum, Object> props = new EnumMap<>(GraphPropertyEnum.class); - props.put(GraphPropertyEnum.CSAR_UUID, csarUUID); - props.put(GraphPropertyEnum.IS_HIGHEST_VERSION, true); - if (componentType != null) { - props.put(GraphPropertyEnum.COMPONENT_TYPE, componentType.name()); - } - Map<GraphPropertyEnum, Object> propsHasNot = new EnumMap<>(GraphPropertyEnum.class); - propsHasNot.put(GraphPropertyEnum.IS_DELETED, true); - - GraphVertex resourceMetadataData = null; - List<GraphVertex> resourceMetadataDataList = null; - Either<List<GraphVertex>, TitanOperationStatus> byCsar = titanDao.getByCriteria(null, props, propsHasNot, JsonParseFlagEnum.ParseMetadata); - if (byCsar.isRight()) { - if (TitanOperationStatus.NOT_FOUND == byCsar.right().value()) { - // Fix Defect DE256036 - if (StringUtils.isEmpty(systemName)) { - return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(TitanOperationStatus.NOT_FOUND)); - } - - props.clear(); - props.put(GraphPropertyEnum.IS_HIGHEST_VERSION, true); - props.put(GraphPropertyEnum.SYSTEM_NAME, systemName); - Either<List<GraphVertex>, TitanOperationStatus> bySystemname = titanDao.getByCriteria(null, props, JsonParseFlagEnum.ParseMetadata); - if (bySystemname.isRight()) { - log.debug("getLatestResourceByCsarOrName - Failed to find by system name {} error {} ", systemName, bySystemname.right().value()); - return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(bySystemname.right().value())); - } - if (bySystemname.left().value().size() > 2) { - log.debug("getLatestResourceByCsarOrName - getByCriteria(by system name) must return only 2 latest version, but was returned - {}", bySystemname.left().value().size()); - return Either.right(StorageOperationStatus.GENERAL_ERROR); - } - resourceMetadataDataList = bySystemname.left().value(); - if (resourceMetadataDataList.size() == 1) { - resourceMetadataData = resourceMetadataDataList.get(0); - } else { - for (GraphVertex curResource : resourceMetadataDataList) { - if (!((String) curResource.getJsonMetadataField(JsonPresentationFields.LIFECYCLE_STATE)).equals("CERTIFIED")) { - resourceMetadataData = curResource; - break; - } - } - } - if (resourceMetadataData == null) { - log.debug("getLatestResourceByCsarOrName - getByCriteria(by system name) returned 2 latest CERTIFIED versions"); - return Either.right(StorageOperationStatus.GENERAL_ERROR); - } - if (resourceMetadataData.getJsonMetadataField(JsonPresentationFields.CSAR_UUID) != null && !((String) resourceMetadataData.getJsonMetadataField(JsonPresentationFields.CSAR_UUID)).equals(csarUUID)) { - log.debug("getLatestResourceByCsarOrName - same system name {} but different csarUUID. exist {} and new {} ", systemName, resourceMetadataData.getJsonMetadataField(JsonPresentationFields.CSAR_UUID), csarUUID); - // correct error will be returned from create flow. with all - // correct audit records!!!!! - return Either.right(StorageOperationStatus.NOT_FOUND); - } - Either<Resource, StorageOperationStatus> resource = getToscaElement((String) resourceMetadataData.getUniqueId()); - return resource; - } - } else { - resourceMetadataDataList = byCsar.left().value(); - if (resourceMetadataDataList.size() > 2) { - log.debug("getLatestResourceByCsarOrName - getByCriteria(by csar) must return only 2 latest version, but was returned - {}", byCsar.left().value().size()); - return Either.right(StorageOperationStatus.GENERAL_ERROR); - } - if (resourceMetadataDataList.size() == 1) { - resourceMetadataData = resourceMetadataDataList.get(0); - } else { - for (GraphVertex curResource : resourceMetadataDataList) { - if (!((String) curResource.getJsonMetadataField(JsonPresentationFields.LIFECYCLE_STATE)).equals("CERTIFIED")) { - resourceMetadataData = curResource; - break; - } - } - } - if (resourceMetadataData == null) { - log.debug("getLatestResourceByCsarOrName - getByCriteria(by csar) returned 2 latest CERTIFIED versions"); - return Either.right(StorageOperationStatus.GENERAL_ERROR); - } - Either<Resource, StorageOperationStatus> resource = getToscaElement((String) resourceMetadataData.getJsonMetadataField(JsonPresentationFields.UNIQUE_ID), parseFlag); - return resource; - } - return null; - } - - public Either<Boolean, StorageOperationStatus> validateToscaResourceNameExtends(String templateNameCurrent, String templateNameExtends) { - - String currentTemplateNameChecked = templateNameExtends; - - while (currentTemplateNameChecked != null && !currentTemplateNameChecked.equalsIgnoreCase(templateNameCurrent)) { - Either<Resource, StorageOperationStatus> latestByToscaResourceName = getLatestByToscaResourceName(currentTemplateNameChecked); - - if (latestByToscaResourceName.isRight()) { - return latestByToscaResourceName.right().value() == StorageOperationStatus.NOT_FOUND ? Either.left(false) : Either.right(latestByToscaResourceName.right().value()); - } - - Resource value = latestByToscaResourceName.left().value(); - - if (value.getDerivedFrom() != null) { - currentTemplateNameChecked = value.getDerivedFrom().get(0); - } else { - currentTemplateNameChecked = null; - } - } - - return (currentTemplateNameChecked != null && currentTemplateNameChecked.equalsIgnoreCase(templateNameCurrent)) ? Either.left(true) : Either.left(false); - } - - public Either<List<Component>, StorageOperationStatus> fetchMetaDataByResourceType(String resourceType, ComponentParametersView filterBy) { - Map<GraphPropertyEnum, Object> props = new EnumMap<>(GraphPropertyEnum.class); - props.put(GraphPropertyEnum.RESOURCE_TYPE, resourceType); - props.put(GraphPropertyEnum.IS_HIGHEST_VERSION, true); - Either<List<GraphVertex>, TitanOperationStatus> resourcesByTypeEither = titanDao.getByCriteria(null, props, JsonParseFlagEnum.ParseMetadata); - - if (resourcesByTypeEither.isRight()) { - return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(resourcesByTypeEither.right().value())); - } - - List<GraphVertex> vertexList = resourcesByTypeEither.left().value(); - List<Component> components = new ArrayList<>(); - - for (GraphVertex vertex : vertexList) { - components.add(getToscaElementByOperation(vertex, filterBy).left().value()); - } - - return Either.left(components); - } - - public void commit() { - titanDao.commit(); - } - - public Either<Service, StorageOperationStatus> updateDistributionStatus(Service service, User user, DistributionStatusEnum distributionStatus) { - Either<GraphVertex, StorageOperationStatus> updateDistributionStatus = topologyTemplateOperation.updateDistributionStatus(service.getUniqueId(), user, distributionStatus); - if (updateDistributionStatus.isRight()) { - return Either.right(updateDistributionStatus.right().value()); - } - GraphVertex serviceV = updateDistributionStatus.left().value(); - service.setDistributionStatus(distributionStatus); - service.setLastUpdateDate((Long) serviceV.getJsonMetadataField(JsonPresentationFields.LAST_UPDATE_DATE)); - return Either.left(service); - } - - public Either<ComponentMetadataData, StorageOperationStatus> updateComponentLastUpdateDateOnGraph(Component component, Long modificationTime) { - - Either<ComponentMetadataData, StorageOperationStatus> result = null; - GraphVertex serviceVertex; - Either<GraphVertex, TitanOperationStatus> updateRes = null; - Either<GraphVertex, TitanOperationStatus> getRes = titanDao.getVertexById(component.getUniqueId(), JsonParseFlagEnum.ParseMetadata); - if (getRes.isRight()) { - TitanOperationStatus status = getRes.right().value(); - log.error("Failed to fetch component {}. status is {}", component.getUniqueId(), status); - result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status)); - } - if (result == null) { - serviceVertex = getRes.left().value(); - long lastUpdateDate = System.currentTimeMillis(); - serviceVertex.setJsonMetadataField(JsonPresentationFields.LAST_UPDATE_DATE, lastUpdateDate); - component.setLastUpdateDate(lastUpdateDate); - updateRes = titanDao.updateVertex(serviceVertex); - if (updateRes.isRight()) { - result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(updateRes.right().value())); - } - } - if (result == null) { - result = Either.left(ModelConverter.convertToComponentMetadata(updateRes.left().value())); - } - return result; - } - - public TitanDao getTitanDao() { - return titanDao; - } - - public Either<List<Service>, StorageOperationStatus> getCertifiedServicesWithDistStatus(Set<DistributionStatusEnum> distStatus) { - Map<GraphPropertyEnum, Object> propertiesToMatch = new EnumMap<>(GraphPropertyEnum.class); - propertiesToMatch.put(GraphPropertyEnum.STATE, LifecycleStateEnum.CERTIFIED.name()); - - return getServicesWithDistStatus(distStatus, propertiesToMatch); - } - - public Either<List<Service>, StorageOperationStatus> getServicesWithDistStatus(Set<DistributionStatusEnum> distStatus, Map<GraphPropertyEnum, Object> additionalPropertiesToMatch) { - - List<Service> servicesAll = new ArrayList<>(); - - Map<GraphPropertyEnum, Object> propertiesToMatch = new EnumMap<>(GraphPropertyEnum.class); - Map<GraphPropertyEnum, Object> propertiesNotToMatch = new EnumMap<>(GraphPropertyEnum.class); - - if (additionalPropertiesToMatch != null && !additionalPropertiesToMatch.isEmpty()) { - propertiesToMatch.putAll(additionalPropertiesToMatch); - } - - propertiesToMatch.put(GraphPropertyEnum.COMPONENT_TYPE, ComponentTypeEnum.SERVICE.name()); - - propertiesNotToMatch.put(GraphPropertyEnum.IS_DELETED, true); - - if (distStatus != null && !distStatus.isEmpty()) { - for (DistributionStatusEnum state : distStatus) { - propertiesToMatch.put(GraphPropertyEnum.DISTRIBUTION_STATUS, state.name()); - Either<List<Service>, StorageOperationStatus> fetchServicesByCriteria = fetchServicesByCriteria(servicesAll, propertiesToMatch, propertiesNotToMatch); - if (fetchServicesByCriteria.isRight()) { - return fetchServicesByCriteria; - } else { - servicesAll = fetchServicesByCriteria.left().value(); - } - } - return Either.left(servicesAll); - } else { - return fetchServicesByCriteria(servicesAll, propertiesToMatch, propertiesNotToMatch); - } - } - - // private Either<List<Service>, StorageOperationStatus> fetchServicesByCriteria(List<Service> servicesAll, Map<GraphPropertyEnum, Object> propertiesToMatch, Map<GraphPropertyEnum, Object> propertiesNotToMatch) { - // Either<List<GraphVertex>, TitanOperationStatus> getRes = titanDao.getByCriteria(VertexTypeEnum.TOPOLOGY_TEMPLATE, propertiesToMatch, propertiesNotToMatch, JsonParseFlagEnum.ParseAll); - // if (getRes.isRight()) { - // if (getRes.right().value() != TitanOperationStatus.NOT_FOUND) { - // CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to fetch certified services by match properties {} not match properties {} . Status is {}. ", propertiesToMatch, propertiesNotToMatch, getRes.right().value()); - // return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getRes.right().value())); - // } - // } else { - // for (GraphVertex vertex : getRes.left().value()) { - // Either<Component, StorageOperationStatus> getServiceRes = getToscaElementByOperation(vertex); - // if (getServiceRes.isRight()) { - // CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to fetch certified service {}. Status is {}. ", vertex.getJsonMetadataField(JsonPresentationFields.NAME), getServiceRes.right().value()); - // return Either.right(getServiceRes.right().value()); - // } else { - // servicesAll.add((Service) getToscaElementByOperation(vertex).left().value()); - // } - // } - // } - // return Either.left(servicesAll); - // } - - private Either<List<Service>, StorageOperationStatus> fetchServicesByCriteria(List<Service> servicesAll, Map<GraphPropertyEnum, Object> propertiesToMatch, Map<GraphPropertyEnum, Object> propertiesNotToMatch) { - Either<List<GraphVertex>, TitanOperationStatus> getRes = titanDao.getByCriteria(VertexTypeEnum.TOPOLOGY_TEMPLATE, propertiesToMatch, propertiesNotToMatch, JsonParseFlagEnum.ParseAll); - if (getRes.isRight()) { - if (getRes.right().value() != TitanOperationStatus.NOT_FOUND) { - CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to fetch certified services by match properties {} not match properties {} . Status is {}. ", propertiesToMatch, propertiesNotToMatch, getRes.right().value()); - return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getRes.right().value())); - } - } else { - for (GraphVertex vertex : getRes.left().value()) { - // Either<Component, StorageOperationStatus> getServiceRes = getToscaElementByOperation(vertex); - Either<ToscaElement, StorageOperationStatus> getServiceRes = topologyTemplateOperation.getLightComponent(vertex, ComponentTypeEnum.SERVICE, new ComponentParametersView(true)); - - if (getServiceRes.isRight()) { - CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to fetch certified service {}. Status is {}. ", vertex.getJsonMetadataField(JsonPresentationFields.NAME), getServiceRes.right().value()); - return Either.right(getServiceRes.right().value()); - } else { - servicesAll.add(ModelConverter.convertFromToscaElement(getServiceRes.left().value())); - } - } - } - return Either.left(servicesAll); - } - - public void rollback() { - titanDao.rollback(); - } - - public StorageOperationStatus addDeploymentArtifactsToInstance(String componentId, ComponentInstance componentInstance, Map<String, ArtifactDefinition> finalDeploymentArtifacts) { - Map<String, ArtifactDataDefinition> instDeplArtifacts = finalDeploymentArtifacts.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, e -> new ArtifactDataDefinition(e.getValue()))); - - return nodeTemplateOperation.addDeploymentArtifactsToInstance(componentId, componentInstance.getUniqueId(), instDeplArtifacts); - } - - public StorageOperationStatus addInformationalArtifactsToInstance(String componentId, ComponentInstance componentInstance, Map<String, ArtifactDefinition> artifacts) { - StorageOperationStatus status = StorageOperationStatus.OK; - if(MapUtils.isNotEmpty(artifacts)){ - Map<String, ArtifactDataDefinition> instDeplArtifacts = artifacts.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, e -> new ArtifactDataDefinition(e.getValue()))); - status= nodeTemplateOperation.addInformationalArtifactsToInstance(componentId, componentInstance.getUniqueId(), instDeplArtifacts); - } - return status; - } - - public StorageOperationStatus generateCustomizationUUIDOnInstance(String componentId, String instanceId) { - return nodeTemplateOperation.generateCustomizationUUIDOnInstance(componentId, instanceId); - } - - public StorageOperationStatus generateCustomizationUUIDOnInstanceGroup(String componentId, String instanceId, List<String> groupInstances) { - return nodeTemplateOperation.generateCustomizationUUIDOnInstanceGroup(componentId, instanceId, groupInstances); - } - - public Either<PropertyDefinition, StorageOperationStatus> addPropertyToResource(String propertyName, PropertyDefinition newPropertyDefinition, Resource resource) { - - Either<PropertyDefinition, StorageOperationStatus> result = null; - Either<Component, StorageOperationStatus> getUpdatedComponentRes = null; - newPropertyDefinition.setName(propertyName); - newPropertyDefinition.setParentUniqueId(resource.getUniqueId()); - StorageOperationStatus status = getToscaElementOperation(resource).addToscaDataToToscaElement(resource.getUniqueId(), EdgeLabelEnum.PROPERTIES, VertexTypeEnum.PROPERTIES, newPropertyDefinition, JsonPresentationFields.NAME); - if (status != StorageOperationStatus.OK) { - CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to add the property {} to the resource {}. Status is {}. ", propertyName, resource.getName(), status); - result = Either.right(status); - } - if (result == null) { - ComponentParametersView filter = new ComponentParametersView(true); - filter.setIgnoreProperties(false); - getUpdatedComponentRes = getToscaElement(resource.getUniqueId(), filter); - if (getUpdatedComponentRes.isRight()) { - CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to get updated resource {}. Status is {}. ", resource.getUniqueId(), getUpdatedComponentRes.right().value()); - result = Either.right(status); - } - } - if (result == null) { - PropertyDefinition newProperty = null; - List<PropertyDefinition> properties = ((Resource) getUpdatedComponentRes.left().value()).getProperties(); - if (CollectionUtils.isNotEmpty(properties)) { - Optional<PropertyDefinition> newPropertyOptional = properties.stream().filter(p -> p.getName().equals(propertyName)).findAny(); - if (newPropertyOptional.isPresent()) { - newProperty = newPropertyOptional.get(); - } - } - if (newProperty == null) { - CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to find recently added property {} on the resource {}. Status is {}. ", propertyName, resource.getUniqueId(), StorageOperationStatus.NOT_FOUND); - result = Either.right(StorageOperationStatus.NOT_FOUND); - } else { - result = Either.left(newProperty); - } - } - return result; - } - - public StorageOperationStatus deletePropertyOfResource(Resource resource, String propertyName) { - return getToscaElementOperation(resource).deleteToscaDataElement(resource.getUniqueId(), EdgeLabelEnum.PROPERTIES, VertexTypeEnum.PROPERTIES, propertyName, JsonPresentationFields.NAME); - } - - public StorageOperationStatus deleteAttributeOfResource(Component component, String attributeName) { - return getToscaElementOperation(component).deleteToscaDataElement(component.getUniqueId(), EdgeLabelEnum.ATTRIBUTES, VertexTypeEnum.ATTRIBUTES, attributeName, JsonPresentationFields.NAME); - } - - public StorageOperationStatus deleteInputOfResource(Component resource, String inputName) { - return getToscaElementOperation(resource).deleteToscaDataElement(resource.getUniqueId(), EdgeLabelEnum.INPUTS, VertexTypeEnum.INPUTS, inputName, JsonPresentationFields.NAME); - } - - public Either<PropertyDefinition, StorageOperationStatus> updatePropertyOfResource(Resource resource, PropertyDefinition newPropertyDefinition) { - - Either<Component, StorageOperationStatus> getUpdatedComponentRes = null; - Either<PropertyDefinition, StorageOperationStatus> result = null; - StorageOperationStatus status = getToscaElementOperation(resource).updateToscaDataOfToscaElement(resource.getUniqueId(), EdgeLabelEnum.PROPERTIES, VertexTypeEnum.PROPERTIES, newPropertyDefinition, JsonPresentationFields.NAME); - if (status != StorageOperationStatus.OK) { - CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to add the property {} to the resource {}. Status is {}. ", newPropertyDefinition.getName(), resource.getName(), status); - result = Either.right(status); - } - if (result == null) { - ComponentParametersView filter = new ComponentParametersView(true); - filter.setIgnoreProperties(false); - getUpdatedComponentRes = getToscaElement(resource.getUniqueId(), filter); - if (getUpdatedComponentRes.isRight()) { - CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to get updated resource {}. Status is {}. ", resource.getUniqueId(), getUpdatedComponentRes.right().value()); - result = Either.right(status); - } - } - if (result == null) { - Optional<PropertyDefinition> newProperty = ((Resource) getUpdatedComponentRes.left().value()).getProperties().stream().filter(p -> p.getName().equals(newPropertyDefinition.getName())).findAny(); - if (newProperty.isPresent()) { - result = Either.left(newProperty.get()); - } else { - CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to find recently added property {} on the resource {}. Status is {}. ", newPropertyDefinition.getName(), resource.getUniqueId(), StorageOperationStatus.NOT_FOUND); - result = Either.right(StorageOperationStatus.NOT_FOUND); - } - } - return result; - } - - public Either<PropertyDefinition, StorageOperationStatus> addAttributeOfResource(Component component, PropertyDefinition newAttributeDef) { - - Either<Component, StorageOperationStatus> getUpdatedComponentRes = null; - Either<PropertyDefinition, StorageOperationStatus> result = null; - if (newAttributeDef.getUniqueId() == null || newAttributeDef.getUniqueId().isEmpty()) { - String attUniqueId = UniqueIdBuilder.buildAttributeUid(component.getUniqueId(), newAttributeDef.getName()); - newAttributeDef.setUniqueId(attUniqueId); - } - - StorageOperationStatus status = getToscaElementOperation(component).addToscaDataToToscaElement(component.getUniqueId(), EdgeLabelEnum.ATTRIBUTES, VertexTypeEnum.ATTRIBUTES, newAttributeDef, JsonPresentationFields.NAME); - if (status != StorageOperationStatus.OK) { - CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to add the property {} to the resource {}. Status is {}. ", newAttributeDef.getName(), component.getName(), status); - result = Either.right(status); - } - if (result == null) { - ComponentParametersView filter = new ComponentParametersView(true); - filter.setIgnoreAttributesFrom(false); - getUpdatedComponentRes = getToscaElement(component.getUniqueId(), filter); - if (getUpdatedComponentRes.isRight()) { - CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to get updated resource {}. Status is {}. ", component.getUniqueId(), getUpdatedComponentRes.right().value()); - result = Either.right(status); - } - } - if (result == null) { - Optional<PropertyDefinition> newAttribute = ((Resource) getUpdatedComponentRes.left().value()).getAttributes().stream().filter(p -> p.getName().equals(newAttributeDef.getName())).findAny(); - if (newAttribute.isPresent()) { - result = Either.left(newAttribute.get()); - } else { - CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to find recently added property {} on the resource {}. Status is {}. ", newAttributeDef.getName(), component.getUniqueId(), StorageOperationStatus.NOT_FOUND); - result = Either.right(StorageOperationStatus.NOT_FOUND); - } - } - return result; - } - - public Either<PropertyDefinition, StorageOperationStatus> updateAttributeOfResource(Component component, PropertyDefinition newAttributeDef) { - - Either<Component, StorageOperationStatus> getUpdatedComponentRes = null; - Either<PropertyDefinition, StorageOperationStatus> result = null; - StorageOperationStatus status = getToscaElementOperation(component).updateToscaDataOfToscaElement(component.getUniqueId(), EdgeLabelEnum.ATTRIBUTES, VertexTypeEnum.ATTRIBUTES, newAttributeDef, JsonPresentationFields.NAME); - if (status != StorageOperationStatus.OK) { - CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to add the property {} to the resource {}. Status is {}. ", newAttributeDef.getName(), component.getName(), status); - result = Either.right(status); - } - if (result == null) { - ComponentParametersView filter = new ComponentParametersView(true); - filter.setIgnoreAttributesFrom(false); - getUpdatedComponentRes = getToscaElement(component.getUniqueId(), filter); - if (getUpdatedComponentRes.isRight()) { - CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to get updated resource {}. Status is {}. ", component.getUniqueId(), getUpdatedComponentRes.right().value()); - result = Either.right(status); - } - } - if (result == null) { - Optional<PropertyDefinition> newProperty = ((Resource) getUpdatedComponentRes.left().value()).getAttributes().stream().filter(p -> p.getName().equals(newAttributeDef.getName())).findAny(); - if (newProperty.isPresent()) { - result = Either.left(newProperty.get()); - } else { - CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to find recently added property {} on the resource {}. Status is {}. ", newAttributeDef.getName(), component.getUniqueId(), StorageOperationStatus.NOT_FOUND); - result = Either.right(StorageOperationStatus.NOT_FOUND); - } - } - return result; - } - - public Either<InputDefinition, StorageOperationStatus> updateInputOfComponent(Component component, InputDefinition newInputDefinition) { - - Either<Component, StorageOperationStatus> getUpdatedComponentRes = null; - Either<InputDefinition, StorageOperationStatus> result = null; - StorageOperationStatus status = getToscaElementOperation(component).updateToscaDataOfToscaElement(component.getUniqueId(), EdgeLabelEnum.INPUTS, VertexTypeEnum.INPUTS, newInputDefinition, JsonPresentationFields.NAME); - if (status != StorageOperationStatus.OK) { - CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to update the input {} to the component {}. Status is {}. ", newInputDefinition.getName(), component.getName(), status); - result = Either.right(status); - } - if (result == null) { - ComponentParametersView filter = new ComponentParametersView(true); - filter.setIgnoreInputs(false); - getUpdatedComponentRes = getToscaElement(component.getUniqueId(), filter); - if (getUpdatedComponentRes.isRight()) { - CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to get updated resource {}. Status is {}. ", component.getUniqueId(), getUpdatedComponentRes.right().value()); - result = Either.right(status); - } - } - if (result == null) { - Optional<InputDefinition> updatedInput = getUpdatedComponentRes.left().value().getInputs().stream().filter(p -> p.getName().equals(newInputDefinition.getName())).findAny(); - if (updatedInput.isPresent()) { - result = Either.left(updatedInput.get()); - } else { - CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to find recently updated inputs {} on the resource {}. Status is {}. ", newInputDefinition.getName(), component.getUniqueId(), StorageOperationStatus.NOT_FOUND); - result = Either.right(StorageOperationStatus.NOT_FOUND); - } - } - return result; - } - - /** - * method - ename the group instances after referenced container name renamed - * flow - VF rename -(triggers)-> Group rename - * - * @param containerComponent - container such as service - * @param componentInstance - context component - * @param componentInstanceId - id - * - * @return - successfull/failed status - * **/ - public Either<StorageOperationStatus,StorageOperationStatus> cleanAndAddGroupInstancesToComponentInstance(Component containerComponent, ComponentInstance componentInstance, String componentInstanceId){ - String uniqueId = componentInstance.getUniqueId(); - StorageOperationStatus status = nodeTemplateOperation.deleteToscaDataDeepElementsBlockToToscaElement( containerComponent.getUniqueId(), EdgeLabelEnum.INST_GROUPS, VertexTypeEnum.INST_GROUPS, uniqueId ); - if (status != StorageOperationStatus.OK && status != StorageOperationStatus.NOT_FOUND) { - CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to delete group instances for container {}. error {] ", componentInstanceId, status); - return Either.right(status); - } - if(componentInstance.getGroupInstances() != null){ - status = addGroupInstancesToComponentInstance( containerComponent , componentInstance, componentInstance.getGroupInstances() ); - if (status != StorageOperationStatus.OK && status != StorageOperationStatus.NOT_FOUND) { - CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to add group instances for container {}. error {] ", componentInstanceId, status); - return Either.right(status); - } - } - return Either.left(status); - } - - public StorageOperationStatus addGroupInstancesToComponentInstance(Component containerComponent, ComponentInstance componentInstance, List<GroupDefinition> groups, Map<String, List<ArtifactDefinition>> groupInstancesArtifacts) { - return nodeTemplateOperation.addGroupInstancesToComponentInstance(containerComponent, componentInstance, groups, groupInstancesArtifacts); - } - - public Either<List<GroupDefinition>, StorageOperationStatus> updateGroupsOnComponent(Component component, ComponentTypeEnum componentType, List<GroupDataDefinition> updatedGroups) { - return groupsOperation.updateGroups(component, componentType, updatedGroups); - } - - public Either<List<GroupInstance>, StorageOperationStatus> updateGroupInstancesOnComponent(Component component, ComponentTypeEnum componentType, String instanceId, List<GroupInstance> updatedGroupInstances) { - return groupsOperation.updateGroupInstances(component, componentType, instanceId, updatedGroupInstances); - } - - public StorageOperationStatus addGroupInstancesToComponentInstance(Component containerComponent, ComponentInstance componentInstance, List<GroupInstance> groupInstances) { - return nodeTemplateOperation.addGroupInstancesToComponentInstance(containerComponent, componentInstance, groupInstances); - } - - public StorageOperationStatus addDeploymentArtifactsToComponentInstance(Component containerComponent, ComponentInstance componentInstance, Map<String, ArtifactDefinition> deploymentArtifacts) { - return nodeTemplateOperation.addDeploymentArtifactsToComponentInstance(containerComponent, componentInstance, deploymentArtifacts); - } - - public StorageOperationStatus updateComponentInstanceProperty(Component containerComponent, String componentInstanceId, ComponentInstanceProperty property) { - return nodeTemplateOperation.updateComponentInstanceProperty(containerComponent, componentInstanceId, property); - } - - public StorageOperationStatus addComponentInstanceProperty(Component containerComponent, String componentInstanceId, ComponentInstanceProperty property) { - return nodeTemplateOperation.addComponentInstanceProperty(containerComponent, componentInstanceId, property); - } - - public StorageOperationStatus updateComponentInstanceInput(Component containerComponent, String componentInstanceId, ComponentInstanceInput property) { - return nodeTemplateOperation.updateComponentInstanceInput(containerComponent, componentInstanceId, property); - } - - public StorageOperationStatus addComponentInstanceInput(Component containerComponent, String componentInstanceId, ComponentInstanceInput property) { - return nodeTemplateOperation.addComponentInstanceInput(containerComponent, componentInstanceId, property); - } - - public void setNodeTypeOperation(NodeTypeOperation nodeTypeOperation) { - this.nodeTypeOperation = nodeTypeOperation; - } - - public void setTopologyTemplateOperation(TopologyTemplateOperation topologyTemplateOperation) { - this.topologyTemplateOperation = topologyTemplateOperation; - } + } + + return Either.left(latestComponents); + } + + public Either<Component, StorageOperationStatus> getLatestComponentByUuid(String componentUuid) { + + Either<List<Component>, StorageOperationStatus> latestVersionListEither = getLatestComponentListByUuid(componentUuid); + + if (latestVersionListEither.isRight()) { + return Either.right(latestVersionListEither.right().value()); + } + + List<Component> latestVersionList = latestVersionListEither.left().value(); + + if (latestVersionList.isEmpty()) { + return Either.right(StorageOperationStatus.NOT_FOUND); + } + Component component = latestVersionList.size() == 1 ? latestVersionList.get(0) : latestVersionList.stream().max((c1, c2) -> Double.compare(Double.parseDouble(c1.getVersion()), Double.parseDouble(c2.getVersion()))).get(); + + return Either.left(component); + } + + public Either<List<Resource>, StorageOperationStatus> getAllCertifiedResources(boolean isAbstract, Boolean isHighest) { + + List<Resource> resources = new ArrayList<>(); + Map<GraphPropertyEnum, Object> propertiesToMatch = new EnumMap<>(GraphPropertyEnum.class); + Map<GraphPropertyEnum, Object> propertiesNotToMatch = new EnumMap<>(GraphPropertyEnum.class); + + propertiesToMatch.put(GraphPropertyEnum.IS_ABSTRACT, isAbstract); + if (isHighest != null) { + propertiesToMatch.put(GraphPropertyEnum.IS_HIGHEST_VERSION, isHighest.booleanValue()); + } + propertiesToMatch.put(GraphPropertyEnum.STATE, LifecycleStateEnum.CERTIFIED.name()); + propertiesToMatch.put(GraphPropertyEnum.COMPONENT_TYPE, ComponentTypeEnum.RESOURCE.name()); + propertiesNotToMatch.put(GraphPropertyEnum.IS_DELETED, true); + + Either<List<GraphVertex>, TitanOperationStatus> getResourcesRes = titanDao.getByCriteria(null, propertiesToMatch, propertiesNotToMatch, JsonParseFlagEnum.ParseAll); + + if (getResourcesRes.isRight()) { + log.debug("Failed to fetch all certified resources. Status is {}", getResourcesRes.right().value()); + return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getResourcesRes.right().value())); + } + List<GraphVertex> resourceVerticies = getResourcesRes.left().value(); + for (GraphVertex resourceV : resourceVerticies) { + Either<Resource, StorageOperationStatus> getResourceRes = getToscaElement(resourceV); + if (getResourceRes.isRight()) { + return Either.right(getResourceRes.right().value()); + } + resources.add(getResourceRes.left().value()); + } + return Either.left(resources); + } + + public <T extends Component> Either<T, StorageOperationStatus> getLatestByNameAndVersion(String name, String version, JsonParseFlagEnum parseFlag) { + Either<T, StorageOperationStatus> result; + + Map<GraphPropertyEnum, Object> hasProperties = new EnumMap<>(GraphPropertyEnum.class); + Map<GraphPropertyEnum, Object> hasNotProperties = new EnumMap<>(GraphPropertyEnum.class); + + hasProperties.put(GraphPropertyEnum.NAME, name); + hasProperties.put(GraphPropertyEnum.VERSION, version); + hasProperties.put(GraphPropertyEnum.IS_HIGHEST_VERSION, true); + + hasNotProperties.put(GraphPropertyEnum.IS_DELETED, true); + + Either<List<GraphVertex>, TitanOperationStatus> getResourceRes = titanDao.getByCriteria(null, hasProperties, hasNotProperties, parseFlag); + if (getResourceRes.isRight()) { + TitanOperationStatus status = getResourceRes.right().value(); + log.debug("failed to find resource with name {}, version {}. Status is {} ", name, version, status); + result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status)); + return result; + } + return getToscaElementByOperation(getResourceRes.left().value().get(0)); + } + + public Either<Resource, StorageOperationStatus> getLatestComponentByCsarOrName(ComponentTypeEnum componentType, String csarUUID, String systemName) { + return getLatestComponentByCsarOrName(componentType, csarUUID, systemName, false, JsonParseFlagEnum.ParseAll); + } + + public Either<Resource, StorageOperationStatus> getLatestComponentByCsarOrName(ComponentTypeEnum componentType, String csarUUID, String systemName, boolean allowDeleted, JsonParseFlagEnum parseFlag) { + Map<GraphPropertyEnum, Object> props = new EnumMap<>(GraphPropertyEnum.class); + props.put(GraphPropertyEnum.CSAR_UUID, csarUUID); + props.put(GraphPropertyEnum.IS_HIGHEST_VERSION, true); + if (componentType != null) { + props.put(GraphPropertyEnum.COMPONENT_TYPE, componentType.name()); + } + Map<GraphPropertyEnum, Object> propsHasNot = new EnumMap<>(GraphPropertyEnum.class); + propsHasNot.put(GraphPropertyEnum.IS_DELETED, true); + + GraphVertex resourceMetadataData = null; + List<GraphVertex> resourceMetadataDataList = null; + Either<List<GraphVertex>, TitanOperationStatus> byCsar = titanDao.getByCriteria(null, props, propsHasNot, JsonParseFlagEnum.ParseMetadata); + if (byCsar.isRight()) { + if (TitanOperationStatus.NOT_FOUND == byCsar.right().value()) { + // Fix Defect DE256036 + if (StringUtils.isEmpty(systemName)) { + return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(TitanOperationStatus.NOT_FOUND)); + } + + props.clear(); + props.put(GraphPropertyEnum.IS_HIGHEST_VERSION, true); + props.put(GraphPropertyEnum.SYSTEM_NAME, systemName); + Either<List<GraphVertex>, TitanOperationStatus> bySystemname = titanDao.getByCriteria(null, props, JsonParseFlagEnum.ParseMetadata); + if (bySystemname.isRight()) { + log.debug("getLatestResourceByCsarOrName - Failed to find by system name {} error {} ", systemName, bySystemname.right().value()); + return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(bySystemname.right().value())); + } + if (bySystemname.left().value().size() > 2) { + log.debug("getLatestResourceByCsarOrName - getByCriteria(by system name) must return only 2 latest version, but was returned - {}", bySystemname.left().value().size()); + return Either.right(StorageOperationStatus.GENERAL_ERROR); + } + resourceMetadataDataList = bySystemname.left().value(); + if (resourceMetadataDataList.size() == 1) { + resourceMetadataData = resourceMetadataDataList.get(0); + } else { + for (GraphVertex curResource : resourceMetadataDataList) { + if (!((String) curResource.getJsonMetadataField(JsonPresentationFields.LIFECYCLE_STATE)).equals("CERTIFIED")) { + resourceMetadataData = curResource; + break; + } + } + } + if (resourceMetadataData == null) { + log.debug("getLatestResourceByCsarOrName - getByCriteria(by system name) returned 2 latest CERTIFIED versions"); + return Either.right(StorageOperationStatus.GENERAL_ERROR); + } + if (resourceMetadataData.getJsonMetadataField(JsonPresentationFields.CSAR_UUID) != null && !((String) resourceMetadataData.getJsonMetadataField(JsonPresentationFields.CSAR_UUID)).equals(csarUUID)) { + log.debug("getLatestResourceByCsarOrName - same system name {} but different csarUUID. exist {} and new {} ", systemName, resourceMetadataData.getJsonMetadataField(JsonPresentationFields.CSAR_UUID), csarUUID); + // correct error will be returned from create flow. with all + // correct audit records!!!!! + return Either.right(StorageOperationStatus.NOT_FOUND); + } + Either<Resource, StorageOperationStatus> resource = getToscaElement((String) resourceMetadataData.getUniqueId()); + return resource; + } + } else { + resourceMetadataDataList = byCsar.left().value(); + if (resourceMetadataDataList.size() > 2) { + log.debug("getLatestResourceByCsarOrName - getByCriteria(by csar) must return only 2 latest version, but was returned - {}", byCsar.left().value().size()); + return Either.right(StorageOperationStatus.GENERAL_ERROR); + } + if (resourceMetadataDataList.size() == 1) { + resourceMetadataData = resourceMetadataDataList.get(0); + } else { + for (GraphVertex curResource : resourceMetadataDataList) { + if (!((String) curResource.getJsonMetadataField(JsonPresentationFields.LIFECYCLE_STATE)).equals("CERTIFIED")) { + resourceMetadataData = curResource; + break; + } + } + } + if (resourceMetadataData == null) { + log.debug("getLatestResourceByCsarOrName - getByCriteria(by csar) returned 2 latest CERTIFIED versions"); + return Either.right(StorageOperationStatus.GENERAL_ERROR); + } + Either<Resource, StorageOperationStatus> resource = getToscaElement((String) resourceMetadataData.getJsonMetadataField(JsonPresentationFields.UNIQUE_ID), parseFlag); + return resource; + } + return null; + } + + public Either<Boolean, StorageOperationStatus> validateToscaResourceNameExtends(String templateNameCurrent, String templateNameExtends) { + + String currentTemplateNameChecked = templateNameExtends; + + while (currentTemplateNameChecked != null && !currentTemplateNameChecked.equalsIgnoreCase(templateNameCurrent)) { + Either<Resource, StorageOperationStatus> latestByToscaResourceName = getLatestByToscaResourceName(currentTemplateNameChecked); + + if (latestByToscaResourceName.isRight()) { + return latestByToscaResourceName.right().value() == StorageOperationStatus.NOT_FOUND ? Either.left(false) : Either.right(latestByToscaResourceName.right().value()); + } + + Resource value = latestByToscaResourceName.left().value(); + + if (value.getDerivedFrom() != null) { + currentTemplateNameChecked = value.getDerivedFrom().get(0); + } else { + currentTemplateNameChecked = null; + } + } + + return (currentTemplateNameChecked != null && currentTemplateNameChecked.equalsIgnoreCase(templateNameCurrent)) ? Either.left(true) : Either.left(false); + } + + public Either<List<Component>, StorageOperationStatus> fetchMetaDataByResourceType(String resourceType, ComponentParametersView filterBy) { + Map<GraphPropertyEnum, Object> props = new EnumMap<>(GraphPropertyEnum.class); + props.put(GraphPropertyEnum.RESOURCE_TYPE, resourceType); + props.put(GraphPropertyEnum.IS_HIGHEST_VERSION, true); + Either<List<GraphVertex>, TitanOperationStatus> resourcesByTypeEither = titanDao.getByCriteria(null, props, JsonParseFlagEnum.ParseMetadata); + + if (resourcesByTypeEither.isRight()) { + return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(resourcesByTypeEither.right().value())); + } + + List<GraphVertex> vertexList = resourcesByTypeEither.left().value(); + List<Component> components = new ArrayList<>(); + + for (GraphVertex vertex : vertexList) { + components.add(getToscaElementByOperation(vertex, filterBy).left().value()); + } + + return Either.left(components); + } + + public void commit() { + titanDao.commit(); + } + + public Either<Service, StorageOperationStatus> updateDistributionStatus(Service service, User user, DistributionStatusEnum distributionStatus) { + Either<GraphVertex, StorageOperationStatus> updateDistributionStatus = topologyTemplateOperation.updateDistributionStatus(service.getUniqueId(), user, distributionStatus); + if (updateDistributionStatus.isRight()) { + return Either.right(updateDistributionStatus.right().value()); + } + GraphVertex serviceV = updateDistributionStatus.left().value(); + service.setDistributionStatus(distributionStatus); + service.setLastUpdateDate((Long) serviceV.getJsonMetadataField(JsonPresentationFields.LAST_UPDATE_DATE)); + return Either.left(service); + } + + public Either<ComponentMetadataData, StorageOperationStatus> updateComponentLastUpdateDateOnGraph(Component component, Long modificationTime) { + + Either<ComponentMetadataData, StorageOperationStatus> result = null; + GraphVertex serviceVertex; + Either<GraphVertex, TitanOperationStatus> updateRes = null; + Either<GraphVertex, TitanOperationStatus> getRes = titanDao.getVertexById(component.getUniqueId(), JsonParseFlagEnum.ParseMetadata); + if (getRes.isRight()) { + TitanOperationStatus status = getRes.right().value(); + log.error("Failed to fetch component {}. status is {}", component.getUniqueId(), status); + result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status)); + } + if (result == null) { + serviceVertex = getRes.left().value(); + long lastUpdateDate = System.currentTimeMillis(); + serviceVertex.setJsonMetadataField(JsonPresentationFields.LAST_UPDATE_DATE, lastUpdateDate); + component.setLastUpdateDate(lastUpdateDate); + updateRes = titanDao.updateVertex(serviceVertex); + if (updateRes.isRight()) { + result = Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(updateRes.right().value())); + } + } + if (result == null) { + result = Either.left(ModelConverter.convertToComponentMetadata(updateRes.left().value())); + } + return result; + } + + public TitanDao getTitanDao() { + return titanDao; + } + + public Either<List<Service>, StorageOperationStatus> getCertifiedServicesWithDistStatus(Set<DistributionStatusEnum> distStatus) { + Map<GraphPropertyEnum, Object> propertiesToMatch = new EnumMap<>(GraphPropertyEnum.class); + propertiesToMatch.put(GraphPropertyEnum.STATE, LifecycleStateEnum.CERTIFIED.name()); + + return getServicesWithDistStatus(distStatus, propertiesToMatch); + } + + public Either<List<Service>, StorageOperationStatus> getServicesWithDistStatus(Set<DistributionStatusEnum> distStatus, Map<GraphPropertyEnum, Object> additionalPropertiesToMatch) { + + List<Service> servicesAll = new ArrayList<>(); + + Map<GraphPropertyEnum, Object> propertiesToMatch = new EnumMap<>(GraphPropertyEnum.class); + Map<GraphPropertyEnum, Object> propertiesNotToMatch = new EnumMap<>(GraphPropertyEnum.class); + + if (additionalPropertiesToMatch != null && !additionalPropertiesToMatch.isEmpty()) { + propertiesToMatch.putAll(additionalPropertiesToMatch); + } + + propertiesToMatch.put(GraphPropertyEnum.COMPONENT_TYPE, ComponentTypeEnum.SERVICE.name()); + + propertiesNotToMatch.put(GraphPropertyEnum.IS_DELETED, true); + + if (distStatus != null && !distStatus.isEmpty()) { + for (DistributionStatusEnum state : distStatus) { + propertiesToMatch.put(GraphPropertyEnum.DISTRIBUTION_STATUS, state.name()); + Either<List<Service>, StorageOperationStatus> fetchServicesByCriteria = fetchServicesByCriteria(servicesAll, propertiesToMatch, propertiesNotToMatch); + if (fetchServicesByCriteria.isRight()) { + return fetchServicesByCriteria; + } else { + servicesAll = fetchServicesByCriteria.left().value(); + } + } + return Either.left(servicesAll); + } else { + return fetchServicesByCriteria(servicesAll, propertiesToMatch, propertiesNotToMatch); + } + } + + // private Either<List<Service>, StorageOperationStatus> fetchServicesByCriteria(List<Service> servicesAll, Map<GraphPropertyEnum, Object> propertiesToMatch, Map<GraphPropertyEnum, Object> propertiesNotToMatch) { + // Either<List<GraphVertex>, TitanOperationStatus> getRes = titanDao.getByCriteria(VertexTypeEnum.TOPOLOGY_TEMPLATE, propertiesToMatch, propertiesNotToMatch, JsonParseFlagEnum.ParseAll); + // if (getRes.isRight()) { + // if (getRes.right().value() != TitanOperationStatus.NOT_FOUND) { + // CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to fetch certified services by match properties {} not match properties {} . Status is {}. ", propertiesToMatch, propertiesNotToMatch, getRes.right().value()); + // return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getRes.right().value())); + // } + // } else { + // for (GraphVertex vertex : getRes.left().value()) { + // Either<Component, StorageOperationStatus> getServiceRes = getToscaElementByOperation(vertex); + // if (getServiceRes.isRight()) { + // CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to fetch certified service {}. Status is {}. ", vertex.getJsonMetadataField(JsonPresentationFields.NAME), getServiceRes.right().value()); + // return Either.right(getServiceRes.right().value()); + // } else { + // servicesAll.add((Service) getToscaElementByOperation(vertex).left().value()); + // } + // } + // } + // return Either.left(servicesAll); + // } + + private Either<List<Service>, StorageOperationStatus> fetchServicesByCriteria(List<Service> servicesAll, Map<GraphPropertyEnum, Object> propertiesToMatch, Map<GraphPropertyEnum, Object> propertiesNotToMatch) { + Either<List<GraphVertex>, TitanOperationStatus> getRes = titanDao.getByCriteria(VertexTypeEnum.TOPOLOGY_TEMPLATE, propertiesToMatch, propertiesNotToMatch, JsonParseFlagEnum.ParseAll); + if (getRes.isRight()) { + if (getRes.right().value() != TitanOperationStatus.NOT_FOUND) { + CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to fetch certified services by match properties {} not match properties {} . Status is {}. ", propertiesToMatch, propertiesNotToMatch, getRes.right().value()); + return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(getRes.right().value())); + } + } else { + for (GraphVertex vertex : getRes.left().value()) { + // Either<Component, StorageOperationStatus> getServiceRes = getToscaElementByOperation(vertex); + Either<ToscaElement, StorageOperationStatus> getServiceRes = topologyTemplateOperation.getLightComponent(vertex, ComponentTypeEnum.SERVICE, new ComponentParametersView(true)); + + if (getServiceRes.isRight()) { + CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to fetch certified service {}. Status is {}. ", vertex.getJsonMetadataField(JsonPresentationFields.NAME), getServiceRes.right().value()); + return Either.right(getServiceRes.right().value()); + } else { + servicesAll.add(ModelConverter.convertFromToscaElement(getServiceRes.left().value())); + } + } + } + return Either.left(servicesAll); + } + + public void rollback() { + titanDao.rollback(); + } + + public StorageOperationStatus addDeploymentArtifactsToInstance(String componentId, ComponentInstance componentInstance, Map<String, ArtifactDefinition> finalDeploymentArtifacts) { + Map<String, ArtifactDataDefinition> instDeplArtifacts = finalDeploymentArtifacts.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, e -> new ArtifactDataDefinition(e.getValue()))); + + return nodeTemplateOperation.addDeploymentArtifactsToInstance(componentId, componentInstance.getUniqueId(), instDeplArtifacts); + } + + public StorageOperationStatus addInformationalArtifactsToInstance(String componentId, ComponentInstance componentInstance, Map<String, ArtifactDefinition> artifacts) { + StorageOperationStatus status = StorageOperationStatus.OK; + if (MapUtils.isNotEmpty(artifacts)) { + Map<String, ArtifactDataDefinition> instDeplArtifacts = artifacts.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, e -> new ArtifactDataDefinition(e.getValue()))); + status = nodeTemplateOperation.addInformationalArtifactsToInstance(componentId, componentInstance.getUniqueId(), instDeplArtifacts); + } + return status; + } + + public StorageOperationStatus generateCustomizationUUIDOnInstance(String componentId, String instanceId) { + return nodeTemplateOperation.generateCustomizationUUIDOnInstance(componentId, instanceId); + } + + public StorageOperationStatus generateCustomizationUUIDOnInstanceGroup(String componentId, String instanceId, List<String> groupInstances) { + return nodeTemplateOperation.generateCustomizationUUIDOnInstanceGroup(componentId, instanceId, groupInstances); + } + + /* + * adds property to a resource + * @warn this method has SIDE EFFECT on ownerId ,use it with caution + * */ + public Either<PropertyDefinition, StorageOperationStatus> addPropertyToResource(String propertyName, PropertyDefinition newPropertyDefinition, Resource resource) { + + Either<PropertyDefinition, StorageOperationStatus> result = null; + Either<Component, StorageOperationStatus> getUpdatedComponentRes = null; + newPropertyDefinition.setName(propertyName); + // newPropertyDefinition.setParentUniqueId(resource.getUniqueId()); //todo- DELETE me after 10.18, ownerId==null => current resource is the owner. ownerId should be null since coming for the servlet => changing self resource property, assigning a null value actually means that the property has no assigned owner ,therfor current resource is the owner + StorageOperationStatus status = getToscaElementOperation(resource).addToscaDataToToscaElement(resource.getUniqueId(), EdgeLabelEnum.PROPERTIES, VertexTypeEnum.PROPERTIES, newPropertyDefinition, JsonPresentationFields.NAME); + if (status != StorageOperationStatus.OK) { + CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to add the property {} to the resource {}. Status is {}. ", propertyName, resource.getName(), status); + result = Either.right(status); + } + if (result == null) { + ComponentParametersView filter = new ComponentParametersView(true); + filter.setIgnoreProperties(false); + getUpdatedComponentRes = getToscaElement(resource.getUniqueId(), filter); + if (getUpdatedComponentRes.isRight()) { + CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to get updated resource {}. Status is {}. ", resource.getUniqueId(), getUpdatedComponentRes.right().value()); + result = Either.right(status); + } + } + if (result == null) { + PropertyDefinition newProperty = null; + List<PropertyDefinition> properties = ((Resource) getUpdatedComponentRes.left().value()).getProperties(); + if (CollectionUtils.isNotEmpty(properties)) { + Optional<PropertyDefinition> newPropertyOptional = properties.stream().filter(p -> p.getName().equals(propertyName)).findAny(); + if (newPropertyOptional.isPresent()) { + newProperty = newPropertyOptional.get(); + } + } + if (newProperty == null) { + CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to find recently added property {} on the resource {}. Status is {}. ", propertyName, resource.getUniqueId(), StorageOperationStatus.NOT_FOUND); + result = Either.right(StorageOperationStatus.NOT_FOUND); + } else { + result = Either.left(newProperty); + } + } + return result; + } + + public StorageOperationStatus deletePropertyOfResource(Resource resource, String propertyName) { + return getToscaElementOperation(resource).deleteToscaDataElement(resource.getUniqueId(), EdgeLabelEnum.PROPERTIES, VertexTypeEnum.PROPERTIES, propertyName, JsonPresentationFields.NAME); + } + + public StorageOperationStatus deleteAttributeOfResource(Component component, String attributeName) { + return getToscaElementOperation(component).deleteToscaDataElement(component.getUniqueId(), EdgeLabelEnum.ATTRIBUTES, VertexTypeEnum.ATTRIBUTES, attributeName, JsonPresentationFields.NAME); + } + + public StorageOperationStatus deleteInputOfResource(Component resource, String inputName) { + return getToscaElementOperation(resource).deleteToscaDataElement(resource.getUniqueId(), EdgeLabelEnum.INPUTS, VertexTypeEnum.INPUTS, inputName, JsonPresentationFields.NAME); + } + + public Either<PropertyDefinition, StorageOperationStatus> updatePropertyOfResource(Resource resource, PropertyDefinition newPropertyDefinition) { + + Either<Component, StorageOperationStatus> getUpdatedComponentRes = null; + Either<PropertyDefinition, StorageOperationStatus> result = null; + StorageOperationStatus status = getToscaElementOperation(resource).updateToscaDataOfToscaElement(resource.getUniqueId(), EdgeLabelEnum.PROPERTIES, VertexTypeEnum.PROPERTIES, newPropertyDefinition, JsonPresentationFields.NAME); + if (status != StorageOperationStatus.OK) { + CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to add the property {} to the resource {}. Status is {}. ", newPropertyDefinition.getName(), resource.getName(), status); + result = Either.right(status); + } + if (result == null) { + ComponentParametersView filter = new ComponentParametersView(true); + filter.setIgnoreProperties(false); + getUpdatedComponentRes = getToscaElement(resource.getUniqueId(), filter); + if (getUpdatedComponentRes.isRight()) { + CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to get updated resource {}. Status is {}. ", resource.getUniqueId(), getUpdatedComponentRes.right().value()); + result = Either.right(status); + } + } + if (result == null) { + Optional<PropertyDefinition> newProperty = ((Resource) getUpdatedComponentRes.left().value()).getProperties().stream().filter(p -> p.getName().equals(newPropertyDefinition.getName())).findAny(); + if (newProperty.isPresent()) { + result = Either.left(newProperty.get()); + } else { + CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to find recently added property {} on the resource {}. Status is {}. ", newPropertyDefinition.getName(), resource.getUniqueId(), StorageOperationStatus.NOT_FOUND); + result = Either.right(StorageOperationStatus.NOT_FOUND); + } + } + return result; + } + + public Either<PropertyDefinition, StorageOperationStatus> addAttributeOfResource(Component component, PropertyDefinition newAttributeDef) { + + Either<Component, StorageOperationStatus> getUpdatedComponentRes = null; + Either<PropertyDefinition, StorageOperationStatus> result = null; + if (newAttributeDef.getUniqueId() == null || newAttributeDef.getUniqueId().isEmpty()) { + String attUniqueId = UniqueIdBuilder.buildAttributeUid(component.getUniqueId(), newAttributeDef.getName()); + newAttributeDef.setUniqueId(attUniqueId); + } + + StorageOperationStatus status = getToscaElementOperation(component).addToscaDataToToscaElement(component.getUniqueId(), EdgeLabelEnum.ATTRIBUTES, VertexTypeEnum.ATTRIBUTES, newAttributeDef, JsonPresentationFields.NAME); + if (status != StorageOperationStatus.OK) { + CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to add the property {} to the resource {}. Status is {}. ", newAttributeDef.getName(), component.getName(), status); + result = Either.right(status); + } + if (result == null) { + ComponentParametersView filter = new ComponentParametersView(true); + filter.setIgnoreAttributesFrom(false); + getUpdatedComponentRes = getToscaElement(component.getUniqueId(), filter); + if (getUpdatedComponentRes.isRight()) { + CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to get updated resource {}. Status is {}. ", component.getUniqueId(), getUpdatedComponentRes.right().value()); + result = Either.right(status); + } + } + if (result == null) { + Optional<PropertyDefinition> newAttribute = ((Resource) getUpdatedComponentRes.left().value()).getAttributes().stream().filter(p -> p.getName().equals(newAttributeDef.getName())).findAny(); + if (newAttribute.isPresent()) { + result = Either.left(newAttribute.get()); + } else { + CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to find recently added property {} on the resource {}. Status is {}. ", newAttributeDef.getName(), component.getUniqueId(), StorageOperationStatus.NOT_FOUND); + result = Either.right(StorageOperationStatus.NOT_FOUND); + } + } + return result; + } + + public Either<PropertyDefinition, StorageOperationStatus> updateAttributeOfResource(Component component, PropertyDefinition newAttributeDef) { + + Either<Component, StorageOperationStatus> getUpdatedComponentRes = null; + Either<PropertyDefinition, StorageOperationStatus> result = null; + StorageOperationStatus status = getToscaElementOperation(component).updateToscaDataOfToscaElement(component.getUniqueId(), EdgeLabelEnum.ATTRIBUTES, VertexTypeEnum.ATTRIBUTES, newAttributeDef, JsonPresentationFields.NAME); + if (status != StorageOperationStatus.OK) { + CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to add the property {} to the resource {}. Status is {}. ", newAttributeDef.getName(), component.getName(), status); + result = Either.right(status); + } + if (result == null) { + ComponentParametersView filter = new ComponentParametersView(true); + filter.setIgnoreAttributesFrom(false); + getUpdatedComponentRes = getToscaElement(component.getUniqueId(), filter); + if (getUpdatedComponentRes.isRight()) { + CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to get updated resource {}. Status is {}. ", component.getUniqueId(), getUpdatedComponentRes.right().value()); + result = Either.right(status); + } + } + if (result == null) { + Optional<PropertyDefinition> newProperty = ((Resource) getUpdatedComponentRes.left().value()).getAttributes().stream().filter(p -> p.getName().equals(newAttributeDef.getName())).findAny(); + if (newProperty.isPresent()) { + result = Either.left(newProperty.get()); + } else { + CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to find recently added property {} on the resource {}. Status is {}. ", newAttributeDef.getName(), component.getUniqueId(), StorageOperationStatus.NOT_FOUND); + result = Either.right(StorageOperationStatus.NOT_FOUND); + } + } + return result; + } + + public Either<InputDefinition, StorageOperationStatus> updateInputOfComponent(Component component, InputDefinition newInputDefinition) { + + Either<Component, StorageOperationStatus> getUpdatedComponentRes = null; + Either<InputDefinition, StorageOperationStatus> result = null; + StorageOperationStatus status = getToscaElementOperation(component).updateToscaDataOfToscaElement(component.getUniqueId(), EdgeLabelEnum.INPUTS, VertexTypeEnum.INPUTS, newInputDefinition, JsonPresentationFields.NAME); + if (status != StorageOperationStatus.OK) { + CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to update the input {} to the component {}. Status is {}. ", newInputDefinition.getName(), component.getName(), status); + result = Either.right(status); + } + if (result == null) { + ComponentParametersView filter = new ComponentParametersView(true); + filter.setIgnoreInputs(false); + getUpdatedComponentRes = getToscaElement(component.getUniqueId(), filter); + if (getUpdatedComponentRes.isRight()) { + CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to get updated resource {}. Status is {}. ", component.getUniqueId(), getUpdatedComponentRes.right().value()); + result = Either.right(status); + } + } + if (result == null) { + Optional<InputDefinition> updatedInput = getUpdatedComponentRes.left().value().getInputs().stream().filter(p -> p.getName().equals(newInputDefinition.getName())).findAny(); + if (updatedInput.isPresent()) { + result = Either.left(updatedInput.get()); + } else { + CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to find recently updated inputs {} on the resource {}. Status is {}. ", newInputDefinition.getName(), component.getUniqueId(), StorageOperationStatus.NOT_FOUND); + result = Either.right(StorageOperationStatus.NOT_FOUND); + } + } + return result; + } + + /** + * method - ename the group instances after referenced container name renamed flow - VF rename -(triggers)-> Group rename + * + * @param containerComponent + * - container such as service + * @param componentInstance + * - context component + * @param componentInstanceId + * - id + * + * @return - successfull/failed status + **/ + public Either<StorageOperationStatus, StorageOperationStatus> cleanAndAddGroupInstancesToComponentInstance(Component containerComponent, ComponentInstance componentInstance, String componentInstanceId) { + String uniqueId = componentInstance.getUniqueId(); + StorageOperationStatus status = nodeTemplateOperation.deleteToscaDataDeepElementsBlockToToscaElement(containerComponent.getUniqueId(), EdgeLabelEnum.INST_GROUPS, VertexTypeEnum.INST_GROUPS, uniqueId); + if (status != StorageOperationStatus.OK && status != StorageOperationStatus.NOT_FOUND) { + CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to delete group instances for container {}. error {] ", componentInstanceId, status); + return Either.right(status); + } + if (componentInstance.getGroupInstances() != null) { + status = addGroupInstancesToComponentInstance(containerComponent, componentInstance, componentInstance.getGroupInstances()); + if (status != StorageOperationStatus.OK && status != StorageOperationStatus.NOT_FOUND) { + CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to add group instances for container {}. error {] ", componentInstanceId, status); + return Either.right(status); + } + } + return Either.left(status); + } + + public StorageOperationStatus addGroupInstancesToComponentInstance(Component containerComponent, ComponentInstance componentInstance, List<GroupDefinition> groups, Map<String, List<ArtifactDefinition>> groupInstancesArtifacts) { + return nodeTemplateOperation.addGroupInstancesToComponentInstance(containerComponent, componentInstance, groups, groupInstancesArtifacts); + } + + public Either<List<GroupDefinition>, StorageOperationStatus> updateGroupsOnComponent(Component component, ComponentTypeEnum componentType, List<GroupDataDefinition> updatedGroups) { + return groupsOperation.updateGroups(component, componentType, updatedGroups); + } + + public Either<List<GroupInstance>, StorageOperationStatus> updateGroupInstancesOnComponent(Component component, ComponentTypeEnum componentType, String instanceId, List<GroupInstance> updatedGroupInstances) { + return groupsOperation.updateGroupInstances(component, componentType, instanceId, updatedGroupInstances); + } + + public StorageOperationStatus addGroupInstancesToComponentInstance(Component containerComponent, ComponentInstance componentInstance, List<GroupInstance> groupInstances) { + return nodeTemplateOperation.addGroupInstancesToComponentInstance(containerComponent, componentInstance, groupInstances); + } + + public StorageOperationStatus addDeploymentArtifactsToComponentInstance(Component containerComponent, ComponentInstance componentInstance, Map<String, ArtifactDefinition> deploymentArtifacts) { + return nodeTemplateOperation.addDeploymentArtifactsToComponentInstance(containerComponent, componentInstance, deploymentArtifacts); + } + + public StorageOperationStatus updateComponentInstanceProperty(Component containerComponent, String componentInstanceId, ComponentInstanceProperty property) { + return nodeTemplateOperation.updateComponentInstanceProperty(containerComponent, componentInstanceId, property); + } + + public StorageOperationStatus updateComponentInstanceProperties(Component containerComponent, String componentInstanceId, List<ComponentInstanceProperty> properties) { + return nodeTemplateOperation.updateComponentInstanceProperties(containerComponent, componentInstanceId, properties); + } + + + public StorageOperationStatus addComponentInstanceProperty(Component containerComponent, String componentInstanceId, ComponentInstanceProperty property) { + return nodeTemplateOperation.addComponentInstanceProperty(containerComponent, componentInstanceId, property); + } + + public StorageOperationStatus updateComponentInstanceInput(Component containerComponent, String componentInstanceId, ComponentInstanceInput property) { + return nodeTemplateOperation.updateComponentInstanceInput(containerComponent, componentInstanceId, property); + } + + public StorageOperationStatus updateComponentInstanceInputs(Component containerComponent, String componentInstanceId, List<ComponentInstanceInput> instanceInputs) { + return nodeTemplateOperation.updateComponentInstanceInputs(containerComponent, componentInstanceId, instanceInputs); + } + + public StorageOperationStatus addComponentInstanceInput(Component containerComponent, String componentInstanceId, ComponentInstanceInput property) { + return nodeTemplateOperation.addComponentInstanceInput(containerComponent, componentInstanceId, property); + } + + public void setNodeTypeOperation(NodeTypeOperation nodeTypeOperation) { + this.nodeTypeOperation = nodeTypeOperation; + } + + public void setTopologyTemplateOperation(TopologyTemplateOperation topologyTemplateOperation) { + this.topologyTemplateOperation = topologyTemplateOperation; + } public StorageOperationStatus deleteComponentInstanceInputsFromTopologyTemplate(Component containerComponent, ComponentTypeEnum componentType, List<InputDefinition> inputsToDelete) { return topologyTemplateOperation.deleteToscaDataElements(containerComponent.getUniqueId(), EdgeLabelEnum.INPUTS, inputsToDelete.stream().map(i -> i.getName()).collect(Collectors.toList())); } - + + public StorageOperationStatus updateComponentInstanceCapabiltyProperty(Component containerComponent, String componentInstanceUniqueId, String capabilityUniqueId, ComponentInstanceProperty property) { + return nodeTemplateOperation.updateComponentInstanceCapabilityProperty(containerComponent, componentInstanceUniqueId, capabilityUniqueId, property); + } + public StorageOperationStatus deleteAllCalculatedCapabilitiesRequirements(String topologyTemplateId) { StorageOperationStatus status = topologyTemplateOperation.removeToscaData(topologyTemplateId, EdgeLabelEnum.CALCULATED_CAPABILITIES, VertexTypeEnum.CALCULATED_CAPABILITIES); - if(status == StorageOperationStatus.OK){ + if (status == StorageOperationStatus.OK) { status = topologyTemplateOperation.removeToscaData(topologyTemplateId, EdgeLabelEnum.CALCULATED_REQUIREMENTS, VertexTypeEnum.CALCULATED_REQUIREMENTS); } + if(status == StorageOperationStatus.OK){ + status = topologyTemplateOperation.removeToscaData(topologyTemplateId, EdgeLabelEnum.CALCULATED_CAP_PROPERTIES, VertexTypeEnum.CALCULATED_CAP_PROPERTIES); + } return status; } @@ -2274,6 +2401,16 @@ public class ToscaOperationFacade { } return Either.left(clonedResource); } - + /** + * Returns list of ComponentInstanceProperty belonging to component instance capability specified by name and type + * @param componentId + * @param instanceId + * @param capabilityName + * @param capabilityType + * @return + */ + public Either<List<ComponentInstanceProperty>, StorageOperationStatus> getComponentInstanceCapabilityProperties(String componentId, String instanceId, String capabilityName, String capabilityType) { + return topologyTemplateOperation.getComponentInstanceCapabilityProperties(componentId, instanceId, capabilityName, capabilityType); + } } @@ -35,13 +35,32 @@ import org.apache.commons.collections.MapUtils; import org.apache.commons.lang3.StringUtils; import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum; -import org.openecomp.sdc.be.datatypes.elements.*; +import org.openecomp.sdc.be.datatypes.elements.AdditionalInfoParameterDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.ArtifactDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.CapabilityDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.ComponentInstanceDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.CompositionDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.GroupDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.GroupInstanceDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.InterfaceDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.ListCapabilityDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.ListRequirementDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.MapArtifactDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.MapCapabiltyProperty; +import org.openecomp.sdc.be.datatypes.elements.MapGroupsDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.MapListCapabiltyDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.MapListRequirementDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.MapPropertiesDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.RelationshipInstDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.RequirementDataDefinition; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.model.AdditionalInformationDefinition; import org.openecomp.sdc.be.model.ArtifactDefinition; import org.openecomp.sdc.be.model.CapabilityDefinition; +import org.openecomp.sdc.be.model.CapabilityRequirementRelationship; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.ComponentInstanceInput; @@ -53,7 +72,7 @@ import org.openecomp.sdc.be.model.InputDefinition; import org.openecomp.sdc.be.model.InterfaceDefinition; import org.openecomp.sdc.be.model.PropertyDefinition; import org.openecomp.sdc.be.model.RelationshipImpl; -import org.openecomp.sdc.be.model.RequirementAndRelationshipPair; +import org.openecomp.sdc.be.model.RelationshipInfo; import org.openecomp.sdc.be.model.RequirementCapabilityRelDef; import org.openecomp.sdc.be.model.RequirementDefinition; import org.openecomp.sdc.be.model.Resource; @@ -161,6 +180,7 @@ public class ModelConverter { service.setDistributionStatus(DistributionStatusEnum.findState((String) toscaElement.getMetadataValue(JsonPresentationFields.DISTRIBUTION_STATUS))); service.setEcompGeneratedNaming((Boolean) toscaElement.getMetadataValueOrDefault(JsonPresentationFields.ECOMP_GENERATED_NAMING, true)); service.setNamingPolicy((String) toscaElement.getMetadataValueOrDefault(JsonPresentationFields.NAMING_POLICY, StringUtils.EMPTY)); + service.setEnvironmentContext((String) toscaElement.getMetadataValue(JsonPresentationFields.ENVIRONMENT_CONTEXT)); } private static Resource convertToResource(ToscaElement toscaElement) { @@ -309,10 +329,8 @@ public class ModelConverter { RequirementCapabilityRelDef requirementCapabilityRelDef = new RequirementCapabilityRelDef(); requirementCapabilityRelDef.setFromNode(relation.getFromId()); requirementCapabilityRelDef.setToNode(relation.getToId()); - List<RequirementAndRelationshipPair> relationships = new ArrayList<>(); - RequirementAndRelationshipPair relationshipPair = new RequirementAndRelationshipPair(); + RelationshipInfo relationshipPair = new RelationshipInfo(); relationshipPair.setId(relation.getUniqueId()); - relationshipPair.setCapabilityOwnerId(relation.getCapabilityOwnerId()); relationshipPair.setCapabilityUid(relation.getCapabilityId()); relationshipPair.setCapability(relation.getCapability()); @@ -322,8 +340,10 @@ public class ModelConverter { RelationshipImpl relationship = new RelationshipImpl(); relationship.setType(relation.getType()); relationshipPair.setRelationships(relationship); - - relationships.add(relationshipPair); + CapabilityRequirementRelationship rel = new CapabilityRequirementRelationship(); + rel.setRelation(relationshipPair); + List<CapabilityRequirementRelationship> relationships = new ArrayList<>(); + relationships.add(rel); requirementCapabilityRelDef.setRelationships(relationships); return requirementCapabilityRelDef; } @@ -332,19 +352,19 @@ public class ModelConverter { List<RelationshipInstDataDefinition> relationsList = new ArrayList<>(); - List<RequirementAndRelationshipPair> relationship = relation.getRelationships(); + List<CapabilityRequirementRelationship> relationship = relation.getRelationships(); relationship.forEach(p -> { RelationshipInstDataDefinition requirementCapabilityRelDef = new RelationshipInstDataDefinition(); requirementCapabilityRelDef.setFromId(relation.getFromNode()); requirementCapabilityRelDef.setToId(relation.getToNode()); - requirementCapabilityRelDef.setUniqueId(p.getId()); - requirementCapabilityRelDef.setCapabilityOwnerId(p.getCapabilityOwnerId()); - requirementCapabilityRelDef.setCapabilityId(p.getCapabilityUid()); - requirementCapabilityRelDef.setRequirementOwnerId(p.getRequirementOwnerId()); - requirementCapabilityRelDef.setRequirementId(p.getRequirementUid()); - requirementCapabilityRelDef.setRequirement(p.getRequirement()); - requirementCapabilityRelDef.setType(p.getRelationship().getType()); - requirementCapabilityRelDef.setCapability(p.getCapability()); + requirementCapabilityRelDef.setUniqueId(p.getRelation().getId()); + requirementCapabilityRelDef.setCapabilityOwnerId(p.getRelation().getCapabilityOwnerId()); + requirementCapabilityRelDef.setCapabilityId(p.getRelation().getCapabilityUid()); + requirementCapabilityRelDef.setRequirementOwnerId(p.getRelation().getRequirementOwnerId()); + requirementCapabilityRelDef.setRequirementId(p.getRelation().getRequirementUid()); + requirementCapabilityRelDef.setRequirement(p.getRelation().getRequirement()); + requirementCapabilityRelDef.setType(p.getRelation().getRelationship().getType()); + requirementCapabilityRelDef.setCapability(p.getRelation().getCapability()); relationsList.add(requirementCapabilityRelDef); }); @@ -408,7 +428,7 @@ public class ModelConverter { sb.append(cap.getOwnerId()); } sb.append(CAP_PROP_DELIM).append(s).append(CAP_PROP_DELIM).append(cap.getName()); - toscaCapPropMap.put(sb.toString(), dataToCreate); + toscaCapPropMap.put(sb.toString(), new MapPropertiesDataDefinition(dataToCreate)); } } @@ -455,54 +475,6 @@ public class ModelConverter { return new MapListRequirementDataDefinition(mapToscaDataDefinition); } - private static void convertRequirements(TopologyTemplate toscaElement, Component component) { - - if (CollectionUtils.isNotEmpty(component.getComponentInstances())) { - for (ComponentInstance instance : component.getComponentInstances()) { - Map<String, List<RequirementDefinition>> instanceRequirements = instance.getRequirements(); - if (MapUtils.isNotEmpty(instanceRequirements)) { - addRequirementsByInstanceId(instance.getUniqueId(), instanceRequirements, component); - } - } - } - } - - private static void addRequirementsByInstanceId(String instanceId, Map<String, List<RequirementDefinition>> instanceRequirementsMap, Component component) { - - if (component.getCapabilities() == null) { - component.setCapabilities(new HashMap<>()); - } - List<RequirementDefinition> instanceRequirements = new ArrayList<>(); - for (List<RequirementDefinition> instRequirements : instanceRequirementsMap.values()) { - instanceRequirements.addAll(instRequirements); - } - component.getRequirements().put(instanceId, instanceRequirements); - } - - private static void convertCapabilities(TopologyTemplate toscaElement, Component component) { - - if (CollectionUtils.isNotEmpty(component.getComponentInstances())) { - for (ComponentInstance instance : component.getComponentInstances()) { - Map<String, List<CapabilityDefinition>> instanceCapabilities = instance.getCapabilities(); - if (MapUtils.isNotEmpty(instanceCapabilities)) { - addCapabilitiesByInstanceId(instance.getUniqueId(), instanceCapabilities, component); - } - } - } - } - - private static void addCapabilitiesByInstanceId(String instanceId, Map<String, List<CapabilityDefinition>> instanceCapabilitiesMap, Component component) { - - if (component.getCapabilities() == null) { - component.setCapabilities(new HashMap<>()); - } - List<CapabilityDefinition> instanceCapabilities = new ArrayList<>(); - for (List<CapabilityDefinition> instCapabilitis : instanceCapabilitiesMap.values()) { - instanceCapabilities.addAll(instCapabilitis); - } - component.getCapabilities().put(instanceId, instanceCapabilities); - } - @SuppressWarnings("unchecked") private static void convertComponentFields(Component component, ToscaElement toscaElement) { component.setName(toscaElement.getName()); @@ -909,6 +881,7 @@ public class ModelConverter { topologyTemplate.setMetadataValue(JsonPresentationFields.PROJECT_CODE, service.getProjectCode()); topologyTemplate.setMetadataValue(JsonPresentationFields.ECOMP_GENERATED_NAMING, service.isEcompGeneratedNaming()); topologyTemplate.setMetadataValue(JsonPresentationFields.NAMING_POLICY, service.getNamingPolicy()); + topologyTemplate.setMetadataValue(JsonPresentationFields.ENVIRONMENT_CONTEXT, service.getEnvironmentContext()); } @@ -1125,10 +1098,15 @@ public class ModelConverter { } else { instancesCapabilities.put(capabilityType, caps); } - if (MapUtils.isEmpty(instancesMap.get(instanceId).getCapabilities())) { - instancesMap.get(instanceId).setCapabilities(new HashMap<>()); + ComponentInstance instance = instancesMap.get(instanceId); + if (instance == null) { + log.error("instance is null for id {} entry {}", instanceId, entry.getValue().getToscaPresentationValue(JsonPresentationFields.NAME)); + } else { + if (MapUtils.isEmpty(instance.getCapabilities())) { + instance.setCapabilities(new HashMap<>()); + } + instance.getCapabilities().put(capabilityType, new ArrayList<>(caps)); } - instancesMap.get(instanceId).getCapabilities().put(capabilityType, new ArrayList<>(caps)); } } component.setCapabilities(instancesCapabilities); @@ -1303,11 +1281,6 @@ public class ModelConverter { if (MapUtils.isNotEmpty(groups)) { groupDefinitions = groups.values().stream().map(g -> new GroupDefinition(g)).collect(Collectors.toList()); } - /* - * if (CollectionUtils.isNotEmpty(groupDefinitions) && MapUtils.isNotEmpty(groupsProperties)) { for (GroupDefinition groupDefinition : groupDefinitions) { if (groupsProperties.containsKey(groupDefinition.getName())) { Map<String, - * PropertyDataDefinition> properties = groupsProperties.get(groupDefinition.getName()).getMapToscaDataDefinition(); if (MapUtils.isNotEmpty(properties)) { groupDefinition.setProperties(properties.values().stream().map(p -> new - * GroupProperty(p)).collect(Collectors.toList())); } } } } - */ return groupDefinitions; } @@ -28,7 +28,6 @@ import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; import org.openecomp.sdc.be.model.AdditionalInformationDefinition; import org.openecomp.sdc.be.resources.data.AdditionalInfoParameterData; -import com.thinkaurelius.titan.core.TitanTransaction; import com.thinkaurelius.titan.core.TitanVertex; import fj.data.Either; @@ -22,12 +22,8 @@ package org.openecomp.sdc.be.model.operations.api; import java.util.Map; -import org.openecomp.sdc.be.dao.titan.TitanGenericDao; -import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; -import org.openecomp.sdc.be.datatypes.elements.ArtifactDataDefinition; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; import org.openecomp.sdc.be.model.ArtifactDefinition; -import org.openecomp.sdc.be.resources.data.ArtifactData; import com.thinkaurelius.titan.core.TitanVertex; @@ -21,9 +21,6 @@ package org.openecomp.sdc.be.model.operations.api; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; -import org.openecomp.sdc.be.model.Component; -import org.openecomp.sdc.be.model.cache.jobs.CheckAndUpdateJob; -import org.openecomp.sdc.be.model.cache.jobs.StoreJob; /** * Created by mlando on 9/5/2016. @@ -23,16 +23,8 @@ package org.openecomp.sdc.be.model.operations.api; import java.util.List; import java.util.Map; -import org.apache.commons.lang3.tuple.ImmutablePair; -import org.openecomp.sdc.be.dao.graph.datatype.GraphEdge; import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; -import org.openecomp.sdc.be.model.CapabilityDefinition; import org.openecomp.sdc.be.model.PropertyDefinition; -import org.openecomp.sdc.be.resources.data.CapabilityData; -import org.openecomp.sdc.be.resources.data.CapabilityTypeData; -import org.openecomp.sdc.be.resources.data.PropertyData; - -import com.thinkaurelius.titan.core.TitanVertex; import fj.data.Either; @@ -20,26 +20,12 @@ package org.openecomp.sdc.be.model.operations.api; -import java.util.List; -import java.util.Map; - -import org.apache.commons.lang3.tuple.ImmutablePair; -import org.openecomp.sdc.be.dao.graph.datatype.GraphEdge; import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; -import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; -import org.openecomp.sdc.be.model.ArtifactDefinition; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.ComponentInstanceInput; import org.openecomp.sdc.be.model.ComponentInstanceProperty; -import org.openecomp.sdc.be.model.RequirementAndRelationshipPair; -import org.openecomp.sdc.be.model.RequirementCapabilityRelDef; -import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.be.resources.data.AttributeValueData; -import org.openecomp.sdc.be.resources.data.CapabilityData; import org.openecomp.sdc.be.resources.data.ComponentInstanceData; -import org.openecomp.sdc.be.resources.data.RequirementData; -import org.openecomp.sdc.exception.ResponseFormat; import fj.data.Either; @@ -20,12 +20,12 @@ package org.openecomp.sdc.be.model.operations.api; +import java.util.List; + import org.openecomp.sdc.be.resources.data.ConsumerData; import fj.data.Either; -import java.util.List; - public interface IConsumerOperation { /** @@ -21,25 +21,12 @@ package org.openecomp.sdc.be.model.operations.api; -import java.util.ArrayList; import java.util.List; -import java.util.Map; -import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; -import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; -import org.openecomp.sdc.be.model.ArtifactDefinition; - -import org.openecomp.sdc.be.model.ComponentInstance; - import org.openecomp.sdc.be.model.ComponentInstanceProperty; -import org.openecomp.sdc.be.model.GroupDefinition; import org.openecomp.sdc.be.model.GroupInstance; -import org.openecomp.sdc.be.model.GroupInstanceProperty; import org.openecomp.sdc.be.resources.data.ArtifactData; -import org.openecomp.sdc.exception.ResponseFormat; - -import com.thinkaurelius.titan.core.TitanVertex; import fj.data.Either; @@ -25,10 +25,8 @@ import java.util.List; import org.openecomp.sdc.be.dao.graph.datatype.GraphRelation; import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; -import org.openecomp.sdc.be.model.GroupDefinition; import org.openecomp.sdc.be.model.GroupProperty; import org.openecomp.sdc.be.resources.data.ArtifactData; -import org.openecomp.sdc.be.resources.data.GroupData; import fj.data.Either; @@ -20,16 +20,10 @@ package org.openecomp.sdc.be.model.operations.api; -import fj.data.Either; import org.apache.commons.lang3.tuple.ImmutablePair; import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; -import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; import org.openecomp.sdc.be.model.ComponentInstanceInput; -import org.openecomp.sdc.be.model.InputDefinition; import org.openecomp.sdc.be.resources.data.InputValueData; -import org.openecomp.sdc.be.resources.data.InputsData; - -import java.util.List; public interface IInputsOperation { @@ -22,13 +22,10 @@ package org.openecomp.sdc.be.model.operations.api; import java.util.Map; -import org.openecomp.sdc.be.dao.graph.datatype.GraphNode; import org.openecomp.sdc.be.datatypes.elements.InterfaceDataDefinition; import org.openecomp.sdc.be.model.InterfaceDefinition; import org.openecomp.sdc.be.model.Operation; -import com.thinkaurelius.titan.core.TitanVertex; - import fj.data.Either; public interface IInterfaceLifecycleOperation { @@ -23,11 +23,8 @@ package org.openecomp.sdc.be.model.operations.api; import java.util.List; import java.util.Map; -import org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.tinkerpop.gremlin.structure.Edge; import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; -import org.openecomp.sdc.be.model.FunctionalMenuInfo; import org.openecomp.sdc.be.model.User; import fj.data.Either; @@ -20,7 +20,6 @@ package org.openecomp.sdc.be.model.operations.impl; -import java.math.BigDecimal; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; @@ -20,14 +20,28 @@ package org.openecomp.sdc.be.model.operations.impl; -import com.google.common.util.concurrent.ThreadFactoryBuilder; +import java.util.LinkedList; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.LinkedBlockingQueue; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.ThreadFactory; +import java.util.concurrent.TimeUnit; + +import javax.annotation.PostConstruct; +import javax.annotation.PreDestroy; import org.openecomp.sdc.be.config.Configuration; import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.dao.titan.TitanGenericDao; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; -import org.openecomp.sdc.be.model.cache.*; -import org.openecomp.sdc.be.model.cache.jobs.*; +import org.openecomp.sdc.be.model.cache.ComponentCache; +import org.openecomp.sdc.be.model.cache.DaoInfo; +import org.openecomp.sdc.be.model.cache.jobs.CheckAndUpdateJob; +import org.openecomp.sdc.be.model.cache.jobs.DeleteJob; +import org.openecomp.sdc.be.model.cache.jobs.Job; +import org.openecomp.sdc.be.model.cache.jobs.OverrideJob; +import org.openecomp.sdc.be.model.cache.jobs.StoreJob; import org.openecomp.sdc.be.model.cache.workers.CacheWorker; import org.openecomp.sdc.be.model.cache.workers.IWorker; import org.openecomp.sdc.be.model.cache.workers.SyncWorker; @@ -39,10 +53,7 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import javax.annotation.PostConstruct; -import javax.annotation.PreDestroy; -import java.util.LinkedList; -import java.util.concurrent.*; +import com.google.common.util.concurrent.ThreadFactoryBuilder; /** * Created by mlando on 9/5/2016. the class is responsible for handling all cache update operations asynchronously including sync between the graph and cache and on demand update requests @@ -20,49 +20,26 @@ package org.openecomp.sdc.be.model.operations.impl; -import java.util.ArrayList; import java.util.HashMap; -import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Map.Entry; -import java.util.Set; import java.util.stream.Collectors; -import org.antlr.misc.Graph; import org.apache.commons.lang3.tuple.ImmutablePair; -import org.openecomp.sdc.be.config.BeEcompErrorManager; -import org.openecomp.sdc.be.config.BeEcompErrorManager.ErrorSeverity; -import org.openecomp.sdc.be.dao.graph.GraphElementFactory; import org.openecomp.sdc.be.dao.graph.datatype.GraphEdge; -import org.openecomp.sdc.be.dao.graph.datatype.GraphElementTypeEnum; -import org.openecomp.sdc.be.dao.graph.datatype.GraphRelation; import org.openecomp.sdc.be.dao.neo4j.GraphEdgeLabels; -import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; import org.openecomp.sdc.be.dao.titan.TitanGenericDao; import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; -import org.openecomp.sdc.be.datatypes.components.ComponentMetadataDataDefinition; -import org.openecomp.sdc.be.datatypes.components.ResourceMetadataDataDefinition; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; -import org.openecomp.sdc.be.model.CapabilityDefinition; -import org.openecomp.sdc.be.model.ComponentInstanceProperty; -import org.openecomp.sdc.be.model.DataTypeDefinition; import org.openecomp.sdc.be.model.PropertyDefinition; import org.openecomp.sdc.be.model.operations.api.ICapabilityOperation; -import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; -import org.openecomp.sdc.be.resources.data.CapabilityData; import org.openecomp.sdc.be.resources.data.CapabilityTypeData; -import org.openecomp.sdc.be.resources.data.PropertyData; -import org.openecomp.sdc.be.resources.data.ResourceMetadataData; -import org.openecomp.sdc.be.resources.data.UniqueIdData; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import com.fasterxml.jackson.databind.annotation.JsonAppend.Prop; -import com.thinkaurelius.titan.core.TitanVertex; - import fj.data.Either; @Component("capability-operation") @@ -20,9 +20,11 @@ package org.openecomp.sdc.be.model.operations.impl; -import com.thinkaurelius.titan.core.TitanGraph; -import com.thinkaurelius.titan.core.TitanVertex; -import fj.data.Either; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; +import java.util.function.Supplier; + import org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.tinkerpop.gremlin.structure.Vertex; import org.apache.tinkerpop.gremlin.structure.VertexProperty; @@ -59,10 +61,10 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; -import java.util.function.Supplier; +import com.thinkaurelius.titan.core.TitanGraph; +import com.thinkaurelius.titan.core.TitanVertex; + +import fj.data.Either; @org.springframework.stereotype.Component("component-instance-operation") public class ComponentInstanceOperation extends AbstractOperation implements IComponentInstanceOperation { @@ -20,6 +20,9 @@ package org.openecomp.sdc.be.model.operations.impl; +import java.util.Collections; +import java.util.List; + import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; import org.openecomp.sdc.be.dao.titan.TitanGenericDao; import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; @@ -34,9 +37,6 @@ import org.springframework.stereotype.Component; import fj.data.Either; -import java.util.Collections; -import java.util.List; - @Component("consumer-operation") public class ConsumerOperation implements IConsumerOperation { @@ -35,6 +35,11 @@ import org.openecomp.sdc.common.util.ZipUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonParser; + import fj.data.Either; @org.springframework.stereotype.Component("csar-operation") @@ -105,6 +110,41 @@ public class CsarOperation { return result; } + + @SuppressWarnings("unchecked") + public Either<String, StorageOperationStatus> getCsarLatestVersion(String csarUuid, User user) { + + Either<String, StorageOperationStatus> result = onboardingClient.getPackages(user.getUserId()); + + if (result.isRight()) { + log.debug("Cannot find version for package with Id {}. Status returned is {}", csarUuid, result.right().value()); + } else { + String latestVersion = null; + JsonElement root = new JsonParser().parse(result.left().value()); + JsonArray csarsInfo = root.getAsJsonObject().get("results").getAsJsonArray(); + for (JsonElement csarInfo : csarsInfo) { + Map<String, String> csarInfoMap = new Gson().fromJson(csarInfo, Map.class); + if(csarInfoMap.get("packageId").equals(csarUuid)){ + String curVersion = csarInfoMap.get("version"); + if(latestVersion == null || isGreater(latestVersion, curVersion)){ + latestVersion = curVersion; + } + } + } + if (latestVersion != null) { + result = Either.left(latestVersion); + } else { + log.debug("The returned packages are {}. Failed to find latest version for package with Id {}. ", result.left().value(), csarUuid); + result = Either.right(StorageOperationStatus.NOT_FOUND); + } + } + + return result; + } + + private boolean isGreater(String latestVersion, String currentVersion) { + return Double.parseDouble(latestVersion) < Double.parseDouble(currentVersion); + } public OnboardingClient getOnboardingClient() { return onboardingClient; @@ -28,8 +28,8 @@ import java.util.Map; import org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.tinkerpop.gremlin.structure.Vertex; -import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.config.Configuration.ArtifactTypeConfig; +import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.dao.graph.datatype.GraphEdge; import org.openecomp.sdc.be.dao.graph.datatype.GraphNode; @@ -20,14 +20,17 @@ package org.openecomp.sdc.be.model.operations.impl; -import com.thinkaurelius.titan.core.TitanGraph; -import com.thinkaurelius.titan.core.TitanVertex; -import fj.data.Either; -import org.apache.commons.collections.CollectionUtils; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import java.util.function.Supplier; +import java.util.stream.Collectors; + import org.apache.commons.collections.MapUtils; import org.apache.commons.lang3.tuple.ImmutablePair; -import org.apache.tinkerpop.gremlin.structure.Direction; -import org.apache.tinkerpop.gremlin.structure.Edge; import org.apache.tinkerpop.gremlin.structure.Vertex; import org.apache.tinkerpop.gremlin.structure.VertexProperty; import org.openecomp.sdc.be.config.BeEcompErrorManager; @@ -65,14 +68,10 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.UUID; -import java.util.function.Supplier; -import java.util.stream.Collectors; +import com.thinkaurelius.titan.core.TitanGraph; +import com.thinkaurelius.titan.core.TitanVertex; + +import fj.data.Either; @org.springframework.stereotype.Component("group-instance-operation") public class GroupInstanceOperation extends AbstractOperation implements IGroupInstanceOperation { @@ -24,44 +24,31 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Map.Entry; -import java.util.Optional; import java.util.stream.Collectors; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.lang3.math.NumberUtils; import org.apache.commons.lang3.tuple.ImmutablePair; import org.openecomp.sdc.be.config.BeEcompErrorManager; -import org.openecomp.sdc.be.config.BeEcompErrorManager.ErrorSeverity; import org.openecomp.sdc.be.dao.graph.datatype.GraphEdge; -import org.openecomp.sdc.be.dao.graph.datatype.GraphNode; import org.openecomp.sdc.be.dao.graph.datatype.GraphRelation; import org.openecomp.sdc.be.dao.neo4j.GraphEdgeLabels; import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; -import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; -import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.DataTypeDefinition; import org.openecomp.sdc.be.model.GroupDefinition; import org.openecomp.sdc.be.model.GroupProperty; import org.openecomp.sdc.be.model.GroupTypeDefinition; import org.openecomp.sdc.be.model.PropertyDefinition; -import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.cache.ApplicationDataTypeCache; import org.openecomp.sdc.be.model.operations.api.IGroupOperation; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.resources.data.ArtifactData; import org.openecomp.sdc.be.resources.data.ComponentInstanceData; -import org.openecomp.sdc.be.resources.data.ComponentMetadataData; import org.openecomp.sdc.be.resources.data.GroupData; import org.openecomp.sdc.be.resources.data.GroupTypeData; import org.openecomp.sdc.be.resources.data.PropertyData; import org.openecomp.sdc.be.resources.data.PropertyValueData; -import org.openecomp.sdc.be.resources.data.ResourceMetadataData; -import org.openecomp.sdc.be.resources.data.ServiceMetadataData; import org.openecomp.sdc.be.resources.data.UniqueIdData; -import org.openecomp.sdc.common.datastructure.Wrapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; @@ -25,7 +25,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import com.thinkaurelius.titan.core.TitanTransaction; import org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.tinkerpop.gremlin.structure.Edge; import org.openecomp.sdc.be.dao.graph.datatype.GraphEdge; @@ -36,7 +35,6 @@ import org.openecomp.sdc.be.dao.titan.TitanGenericDao; import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; import org.openecomp.sdc.be.model.HeatParameterDefinition; -import org.openecomp.sdc.be.model.cache.ApplicationDataTypeCache; import org.openecomp.sdc.be.model.heat.HeatParameterType; import org.openecomp.sdc.be.model.operations.api.IHeatParametersOperation; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; @@ -21,69 +21,31 @@ package org.openecomp.sdc.be.model.operations.impl; import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.stream.Collectors; - -import javax.json.Json; import org.apache.commons.lang3.tuple.ImmutablePair; -import org.apache.tinkerpop.gremlin.process.traversal.Order; -import org.apache.tinkerpop.gremlin.structure.Direction; import org.apache.tinkerpop.gremlin.structure.Edge; -import org.apache.tinkerpop.gremlin.structure.Vertex; -import org.json.simple.JSONObject; -import org.json.simple.parser.ParseException; import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.config.BeEcompErrorManager.ErrorSeverity; -import org.openecomp.sdc.be.dao.graph.GraphElementFactory; import org.openecomp.sdc.be.dao.graph.datatype.GraphEdge; -import org.openecomp.sdc.be.dao.graph.datatype.GraphElementTypeEnum; -import org.openecomp.sdc.be.dao.graph.datatype.GraphNode; -import org.openecomp.sdc.be.dao.graph.datatype.GraphRelation; import org.openecomp.sdc.be.dao.neo4j.GraphEdgeLabels; import org.openecomp.sdc.be.dao.neo4j.GraphEdgePropertiesDictionary; import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; -import org.openecomp.sdc.be.datatypes.elements.GetInputValueDataDefinition; - import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; -import org.openecomp.sdc.be.model.ComponentInstInputsMap; -import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.ComponentInstanceInput; -import org.openecomp.sdc.be.model.ComponentInstancePropInput; -import org.openecomp.sdc.be.model.ComponentInstanceProperty; -import org.openecomp.sdc.be.model.DataTypeDefinition; -import org.openecomp.sdc.be.model.InputDefinition; -import org.openecomp.sdc.be.model.PropertyConstraint; -import org.openecomp.sdc.be.model.PropertyDefinition; import org.openecomp.sdc.be.model.operations.api.IInputsOperation; -import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; -import org.openecomp.sdc.be.resources.data.AttributeData; import org.openecomp.sdc.be.resources.data.ComponentInstanceData; -import org.openecomp.sdc.be.resources.data.ComponentMetadataData; import org.openecomp.sdc.be.resources.data.InputValueData; import org.openecomp.sdc.be.resources.data.InputsData; import org.openecomp.sdc.be.resources.data.PropertyData; -import org.openecomp.sdc.be.resources.data.PropertyValueData; import org.openecomp.sdc.be.resources.data.ResourceMetadataData; -import org.openecomp.sdc.be.resources.data.UniqueIdData; -import org.openecomp.sdc.common.datastructure.Wrapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import org.yaml.snakeyaml.Yaml; import com.google.gson.Gson; -import com.thinkaurelius.titan.core.TitanEdge; -import com.thinkaurelius.titan.core.TitanGraph; -import com.thinkaurelius.titan.core.TitanVertex; -import com.thinkaurelius.titan.core.TitanVertexQuery; -import com.thinkaurelius.titan.core.attribute.Cmp; import fj.data.Either; @@ -29,7 +29,6 @@ import java.util.Set; import org.apache.commons.lang3.tuple.ImmutablePair; import org.openecomp.sdc.be.dao.graph.datatype.GraphEdge; -import org.openecomp.sdc.be.dao.graph.datatype.GraphNode; import org.openecomp.sdc.be.dao.graph.datatype.GraphRelation; import org.openecomp.sdc.be.dao.neo4j.GraphEdgeLabels; import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; @@ -32,13 +32,14 @@ import javax.annotation.PostConstruct; import org.apache.commons.io.filefilter.WildcardFileFilter; import org.apache.http.HttpStatus; import org.openecomp.sdc.be.config.BeEcompErrorManager; -import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.config.BeEcompErrorManager.ErrorSeverity; import org.openecomp.sdc.be.config.Configuration.OnboardingConfig; +import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.dao.rest.HttpRestClient; import org.openecomp.sdc.be.dao.rest.RestConfigurationInfo; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.common.api.Constants; +import org.openecomp.sdc.common.rest.api.RestResponse; import org.openecomp.sdc.common.rest.api.RestResponseAsByteArray; import org.openecomp.sdc.common.util.ZipUtil; import org.slf4j.Logger; @@ -156,6 +157,41 @@ public class OnboardingClient { } } + + public Either<String, StorageOperationStatus> getPackages(String userId) { + + if (httpRestClient == null) { + BeEcompErrorManager.getInstance().logInternalFlowError("RestClient", "Rest Client could not be initialized", ErrorSeverity.ERROR); + return Either.right(StorageOperationStatus.GENERAL_ERROR); + } + + String url = buildDownloadCsarUrl(); + + Properties headers = new Properties(); + headers.put("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8"); + + if (userId != null) { + headers.put(Constants.USER_ID_HEADER, userId); + } + + log.debug("Url for downloading packages is {}. Headers are {}", url, headers); + + RestResponse restResponse = httpRestClient.doGET(url, headers); + log.debug("After fetching packages. Http return code is {}", restResponse.getHttpStatusCode()); + + switch (restResponse.getHttpStatusCode()) { + case HttpStatus.SC_OK: + String data = restResponse.getResponse(); + return Either.left(data); + + case HttpStatus.SC_NOT_FOUND: + return Either.right(StorageOperationStatus.CSAR_NOT_FOUND); + + default: + return Either.right(StorageOperationStatus.GENERAL_ERROR); + } + + } public HttpRestClient getHttpRestClient() { return httpRestClient; @@ -20,9 +20,12 @@ package org.openecomp.sdc.be.model.operations.impl; -import com.thinkaurelius.titan.core.TitanVertex; -import fj.data.Either; -import org.apache.commons.lang3.tuple.ImmutablePair; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + import org.apache.tinkerpop.gremlin.structure.Direction; import org.apache.tinkerpop.gremlin.structure.Edge; import org.apache.tinkerpop.gremlin.structure.Vertex; @@ -35,12 +38,10 @@ import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; import org.openecomp.sdc.be.dao.utils.UserStatusEnum; import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; -import org.openecomp.sdc.be.model.FunctionalMenuInfo; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.model.operations.api.IUserAdminOperation; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.resources.data.UserData; -import org.openecomp.sdc.be.resources.data.UserFunctionalMenuData; import org.openecomp.sdc.common.datastructure.Wrapper; import org.openecomp.sdc.common.util.MethodActivationStatusEnum; import org.slf4j.Logger; @@ -48,11 +49,9 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Component; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import com.thinkaurelius.titan.core.TitanVertex; + +import fj.data.Either; @Component("user-operation") public class UserAdminOperation implements IUserAdminOperation { @@ -98,7 +97,7 @@ public class UserAdminOperation implements IUserAdminOperation { return resultWrapper.getInnerElement(); } finally { - if (false == inTransaction) { + if (!inTransaction) { titanGenericDao.commit(); } log.debug("getUserData - end"); @@ -20,7 +20,6 @@ package org.openecomp.sdc.be.model.operations.utils; -import fj.data.Either; import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.LifecycleStateEnum; @@ -30,6 +29,8 @@ import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import fj.data.Either; + public class ComponentValidationUtils { private static Logger log = LoggerFactory.getLogger(ComponentValidationUtils.class.getName()); @@ -20,7 +20,6 @@ package org.openecomp.sdc.be.model.tosca.constraints.exception; -import org.openecomp.sdc.be.model.tosca.constraints.ConstraintUtil; import org.openecomp.sdc.be.model.tosca.constraints.ConstraintUtil.ConstraintInformation; /** @@ -20,7 +20,6 @@ package org.openecomp.sdc.be.model.tosca.constraints.exception; -import org.openecomp.sdc.be.model.tosca.constraints.ConstraintUtil; import org.openecomp.sdc.be.model.tosca.constraints.ConstraintUtil.ConstraintInformation; /** @@ -20,7 +20,6 @@ package org.openecomp.sdc.be.model.tosca.constraints.exception; -import org.openecomp.sdc.be.model.tosca.constraints.ConstraintUtil; import org.openecomp.sdc.be.model.tosca.constraints.ConstraintUtil.ConstraintInformation; /** @@ -20,7 +20,6 @@ package org.openecomp.sdc.be.model.tosca.constraints.exception; -import org.openecomp.sdc.be.model.tosca.constraints.ConstraintUtil; import org.openecomp.sdc.be.model.tosca.constraints.ConstraintUtil.ConstraintInformation; /** @@ -1,18 +1,19 @@ package org.openecomp.sdc.be.model.tosca.converters; +import java.io.StringReader; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.openecomp.sdc.be.model.DataTypeDefinition; +import org.openecomp.sdc.be.model.PropertyDefinition; +import org.openecomp.sdc.common.util.JsonUtils; + import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonParser; import com.google.gson.stream.JsonReader; -import org.openecomp.sdc.be.model.DataTypeDefinition; -import org.openecomp.sdc.be.model.PropertyDefinition; -import org.openecomp.sdc.common.util.JsonUtils; - -import java.io.StringReader; -import java.util.HashMap; -import java.util.List; -import java.util.Map; public class DataTypePropertyConverter { @@ -28,7 +28,6 @@ import org.openecomp.sdc.common.util.GsonFactory; import com.google.gson.Gson; import com.google.gson.JsonElement; -import com.google.gson.JsonObject; import com.google.gson.JsonParser; import com.google.gson.stream.JsonReader; @@ -1,9 +1,9 @@ package org.openecomp.sdc.be.model.tosca.converters; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; import org.openecomp.sdc.be.model.tosca.ToscaFunctions; +import com.google.gson.JsonObject; + public class ToscaConverterUtils { public static boolean isGetInputValue(JsonObject value) { @@ -29,7 +29,6 @@ import java.util.Set; import org.apache.commons.lang3.tuple.ImmutablePair; import org.openecomp.sdc.be.model.DataTypeDefinition; import org.openecomp.sdc.be.model.PropertyDefinition; -import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.PropertyOperation; import org.openecomp.sdc.be.model.tosca.ToscaPropertyType; import org.openecomp.sdc.be.model.tosca.converters.PropertyValueConverter; @@ -23,17 +23,10 @@ package org.openecomp.sdc.be.model.tosca.validators; import java.io.StringReader; import java.util.Map; -import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.model.DataTypeDefinition; -import org.openecomp.sdc.be.model.tosca.ToscaPropertyType; -import org.openecomp.sdc.common.util.GsonFactory; -import org.openecomp.sdc.common.util.JsonUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.google.gson.Gson; -import com.google.gson.JsonArray; -import com.google.gson.JsonElement; import com.google.gson.JsonParser; import com.google.gson.JsonSyntaxException; import com.google.gson.stream.JsonReader; @@ -22,8 +22,8 @@ package org.openecomp.sdc.be.model.tosca.validators; import java.util.Map; -import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.config.Configuration.ToscaValidatorsConfig; +import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.model.DataTypeDefinition; import org.openecomp.sdc.common.util.ValidationUtils; import org.slf4j.Logger; @@ -23,7 +23,6 @@ package org.openecomp.sdc.be.ui.model; import java.util.List; import java.util.Map; -import org.openecomp.sdc.be.datatypes.components.ComponentMetadataDataDefinition; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.model.AdditionalInformationDefinition; import org.openecomp.sdc.be.model.ArtifactDefinition; @@ -33,8 +32,6 @@ import org.openecomp.sdc.be.model.ComponentInstanceInput; import org.openecomp.sdc.be.model.ComponentInstanceProperty; import org.openecomp.sdc.be.model.GroupDefinition; import org.openecomp.sdc.be.model.InputDefinition; -import org.openecomp.sdc.be.model.InterfaceDefinition; -import org.openecomp.sdc.be.model.PropertyDefinition; import org.openecomp.sdc.be.model.RequirementCapabilityRelDef; import org.openecomp.sdc.be.model.RequirementDefinition; import org.openecomp.sdc.be.model.category.CategoryDefinition; @@ -25,7 +25,6 @@ import java.util.Map; import org.openecomp.sdc.be.datatypes.components.ComponentMetadataDataDefinition; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; -import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.model.category.CategoryDefinition; public abstract class UiComponentMetadata { @@ -21,6 +21,7 @@ package org.openecomp.sdc.be.ui.model; import java.util.List; + import org.openecomp.sdc.be.datatypes.components.ResourceMetadataDataDefinition; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.model.category.CategoryDefinition; @@ -32,6 +32,7 @@ public class UiServiceMetadata extends UiComponentMetadata { private String namingPolicy; private String serviceType; private String serviceRole; + private String environmentContext; public UiServiceMetadata(List<CategoryDefinition> categories, ServiceMetadataDataDefinition metadata) { super(categories, metadata); @@ -40,6 +41,7 @@ public class UiServiceMetadata extends UiComponentMetadata { this.namingPolicy = metadata.getNamingPolicy(); this.serviceType = metadata.getServiceType(); this.serviceRole = metadata.getServiceRole(); + this.environmentContext = metadata.getEnvironmentContext(); } public String getDistributionStatus() { @@ -82,4 +84,7 @@ public class UiServiceMetadata extends UiComponentMetadata { this.serviceRole = serviceRole; } + public String getEnvironmentContext() { return environmentContext; } + + public void setEnvironmentContext(String environmentContext) { this.environmentContext = environmentContext; } } @@ -1,10 +1,6 @@ package org.openecomp.sdc.be.model; -import javax.annotation.Generated; - import org.junit.Test; -import java.util.*; -import org.junit.Assert; public class AdditionalInformationDefinitionTest { @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.model; import java.util.List; -import javax.annotation.Generated; - import org.junit.Test; @@ -1,7 +1,5 @@ package org.openecomp.sdc.be.model; -import javax.annotation.Generated; - import org.junit.Test; public class ArtifactUiDownloadDataTest { @@ -3,8 +3,6 @@ package org.openecomp.sdc.be.model; import java.util.List; import java.util.Map; -import javax.annotation.Generated; - import org.junit.Test; @@ -2,11 +2,7 @@ package org.openecomp.sdc.be.model; import java.util.List; -import javax.annotation.Generated; - import org.junit.Test; -import java.util.*; -import org.junit.Assert; public class CapabilityDefinitionTest { @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.model; import java.util.Map; -import javax.annotation.Generated; - import org.junit.Test; @@ -3,8 +3,6 @@ package org.openecomp.sdc.be.model; import java.util.List; import java.util.Map; -import javax.annotation.Generated; - import org.junit.Test; public class ComponentInstInputsMapTest { @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.model; import java.util.List; -import javax.annotation.Generated; - import org.junit.Test; import org.openecomp.sdc.be.datatypes.elements.PropertyRule; @@ -1,7 +1,5 @@ package org.openecomp.sdc.be.model; -import javax.annotation.Generated; - import org.junit.Test; @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.model; import java.util.List; -import javax.annotation.Generated; - import org.junit.Test; import org.openecomp.sdc.be.datatypes.elements.PropertyRule; @@ -1,7 +1,5 @@ package org.openecomp.sdc.be.model; -import javax.annotation.Generated; - import org.junit.Assert; import org.junit.Test; import org.openecomp.sdc.be.datatypes.components.ComponentMetadataDataDefinition; @@ -3,8 +3,6 @@ package org.openecomp.sdc.be.model; import java.util.Map; import java.util.Queue; -import javax.annotation.Generated; - import org.junit.Test; @@ -2,11 +2,7 @@ package org.openecomp.sdc.be.model; import java.util.List; -import javax.annotation.Generated; - import org.junit.Test; -import java.util.*; -import org.junit.Assert; public class DataTypeDefinitionTest { @@ -1,7 +1,5 @@ package org.openecomp.sdc.be.model; -import javax.annotation.Generated; - import org.junit.Test; @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.model; import java.util.List; -import javax.annotation.Generated; - import org.junit.Test; @@ -1,7 +1,5 @@ package org.openecomp.sdc.be.model; -import javax.annotation.Generated; - import org.junit.Test; @@ -2,11 +2,7 @@ package org.openecomp.sdc.be.model; import java.util.List; -import javax.annotation.Generated; - import org.junit.Test; -import java.util.*; -import org.junit.Assert; public class GroupTypeDefinitionTest { @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.model; import java.util.List; -import javax.annotation.Generated; - import org.junit.Test; @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.model; import java.util.Map; -import javax.annotation.Generated; - import org.junit.Test; @@ -3,8 +3,6 @@ package org.openecomp.sdc.be.model; import java.util.List; import java.util.Map; -import javax.annotation.Generated; - import org.junit.Test; @@ -1,7 +1,5 @@ package org.openecomp.sdc.be.model; -import javax.annotation.Generated; - import org.junit.Test; @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.model; import java.util.List; -import javax.annotation.Generated; - import org.junit.Test; @@ -2,10 +2,7 @@ package org.openecomp.sdc.be.model; import java.util.List; -import javax.annotation.Generated; - import org.junit.Test; -import org.openecomp.sdc.be.datatypes.elements.ProductMetadataDataDefinition; public class ProductTest { @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.model; import java.util.List; -import javax.annotation.Generated; - import org.junit.Test; @@ -1,216 +0,0 @@ -package org.openecomp.sdc.be.model; - -import javax.annotation.Generated; - -import org.junit.Assert; -import org.junit.Test; -import org.openecomp.sdc.be.datatypes.elements.RelationshipInstDataDefinition; - - -public class RequirementAndRelationshipPairTest { - - private RequirementAndRelationshipPair createTestSubject() { - return new RequirementAndRelationshipPair(); - } - - - @Test - public void testGetRequirement() throws Exception { - RequirementAndRelationshipPair testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getRequirement(); - } - - - @Test - public void testSetRequirement() throws Exception { - RequirementAndRelationshipPair testSubject; - String requirement = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setRequirement(requirement); - } - - - @Test - public void testGetCapabilityOwnerId() throws Exception { - RequirementAndRelationshipPair testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getCapabilityOwnerId(); - } - - - @Test - public void testSetCapabilityOwnerId() throws Exception { - RequirementAndRelationshipPair testSubject; - String capabilityOwnerId = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setCapabilityOwnerId(capabilityOwnerId); - } - - - @Test - public void testGetRequirementOwnerId() throws Exception { - RequirementAndRelationshipPair testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getRequirementOwnerId(); - } - - - @Test - public void testSetRequirementOwnerId() throws Exception { - RequirementAndRelationshipPair testSubject; - String requirementOwnerId = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setRequirementOwnerId(requirementOwnerId); - } - - - @Test - public void testGetRelationship() throws Exception { - RequirementAndRelationshipPair testSubject; - RelationshipImpl result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getRelationship(); - } - - - @Test - public void testSetRelationships() throws Exception { - RequirementAndRelationshipPair testSubject; - RelationshipImpl relationship = null; - - // default test - testSubject = createTestSubject(); - testSubject.setRelationships(relationship); - } - - - @Test - public void testGetCapability() throws Exception { - RequirementAndRelationshipPair testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getCapability(); - } - - - @Test - public void testSetCapability() throws Exception { - RequirementAndRelationshipPair testSubject; - String capability = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setCapability(capability); - } - - - @Test - public void testGetCapabilityUid() throws Exception { - RequirementAndRelationshipPair testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getCapabilityUid(); - } - - - @Test - public void testSetCapabilityUid() throws Exception { - RequirementAndRelationshipPair testSubject; - String capabilityUid = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setCapabilityUid(capabilityUid); - } - - - @Test - public void testGetRequirementUid() throws Exception { - RequirementAndRelationshipPair testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getRequirementUid(); - } - - - @Test - public void testSetRequirementUid() throws Exception { - RequirementAndRelationshipPair testSubject; - String requirementUid = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setRequirementUid(requirementUid); - } - - - @Test - public void testGetId() throws Exception { - RequirementAndRelationshipPair testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getId(); - } - - - @Test - public void testSetId() throws Exception { - RequirementAndRelationshipPair testSubject; - String id = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setId(id); - } - - - @Test - public void testToString() throws Exception { - RequirementAndRelationshipPair testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.toString(); - } - - - @Test - public void testEqualsTo() throws Exception { - RequirementAndRelationshipPair testSubject; - RelationshipInstDataDefinition savedRelation = null; - boolean result; - - // test 1 - testSubject = createTestSubject(); - savedRelation = null; - result = testSubject.equalsTo(savedRelation); - Assert.assertEquals(false, result); - } -}
\ No newline at end of file @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.model; import java.util.Map; -import javax.annotation.Generated; - import org.junit.Test; @@ -1,7 +1,5 @@ package org.openecomp.sdc.be.model; -import javax.annotation.Generated; - import org.junit.Test; @@ -1,7 +1,5 @@ package org.openecomp.sdc.be.model; -import javax.annotation.Generated; - import org.junit.Test; @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.model; import java.util.List; -import javax.annotation.Generated; - import org.junit.Test; @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.model; import java.util.List; -import javax.annotation.Generated; - import org.junit.Test; import org.openecomp.sdc.be.datatypes.elements.GetInputValueDataDefinition; @@ -1,7 +1,5 @@ package org.openecomp.sdc.be.model; -import javax.annotation.Generated; - import org.junit.Test; @@ -1,7 +1,5 @@ package org.openecomp.sdc.be.model.cache; -import javax.annotation.Generated; - import org.junit.Test; import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade; @@ -2,11 +2,7 @@ package org.openecomp.sdc.be.model.category; import java.util.List; -import javax.annotation.Generated; - import org.junit.Test; -import java.util.*; -import org.junit.Assert; public class CategoryDefinitionTest { @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.model.category; import java.util.List; -import javax.annotation.Generated; - import org.junit.Test; @@ -3,8 +3,6 @@ package org.openecomp.sdc.be.model.jsontitan.datamodel; import java.util.List; import java.util.Map; -import javax.annotation.Generated; - import org.junit.Test; import org.openecomp.sdc.be.datatypes.elements.InterfaceDataDefinition; import org.openecomp.sdc.be.datatypes.elements.ListCapabilityDataDefinition; @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.model.jsontitan.datamodel; import java.util.Map; -import javax.annotation.Generated; - import org.junit.Test; import org.openecomp.sdc.be.datatypes.elements.ArtifactDataDefinition; import org.openecomp.sdc.be.datatypes.elements.ComponentInstanceDataDefinition; @@ -1,9 +1,6 @@ package org.openecomp.sdc.be.model.jsontitan.datamodel; -import javax.annotation.Generated; - import org.junit.Test; -import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum; public class ToscaElementTypeEnumTest { @@ -1,7 +1,5 @@ package org.openecomp.sdc.be.model.jsontitan.enums; -import javax.annotation.Generated; - import org.junit.Test; @@ -1,6 +1,18 @@ package org.openecomp.sdc.be.model.jsontitan.operations; -import fj.data.Either; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.CALLS_REAL_METHODS; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; + import org.junit.Test; import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum; import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; @@ -10,14 +22,7 @@ import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; import org.openecomp.sdc.be.model.ArtifactDefinition; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.*; +import fj.data.Either; public class ArtifactsOperationsTest { @@ -0,0 +1,194 @@ +package org.openecomp.sdc.be.model.jsontitan.operations; + +import static org.junit.Assert.assertTrue; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.when; + +import java.util.HashMap; +import java.util.Map; + +import org.junit.BeforeClass; +import org.junit.Test; +import org.mockito.Mockito; +import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; +import org.openecomp.sdc.be.dao.jsongraph.TitanDao; +import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum; +import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum; +import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; +import org.openecomp.sdc.be.datatypes.elements.CapabilityDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.MapListCapabiltyDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.MapListRequirementDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.RequirementDataDefinition; +import org.openecomp.sdc.be.model.CapabilityRequirementRelationship; +import org.openecomp.sdc.be.model.ModelTestBase; +import org.openecomp.sdc.be.model.RelationshipImpl; +import org.openecomp.sdc.be.model.RelationshipInfo; +import org.openecomp.sdc.be.model.RequirementCapabilityRelDef; +import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; + +import com.google.common.collect.Lists; + +import fj.data.Either; + +public class NodeTemplateOperationTest extends ModelTestBase{ + + private final static String COMPONENT_ID = "componentId"; + private final static String TO_INSTANCE_ID = "toInstanceId"; + private final static String FROM_INSTANCE_ID = "fromInstanceId"; + private final static String RELATION_ID = "relationId"; + private final static String CAPABILITY_OWNER_ID = "capabilityOwnerId"; + private final static String CAPABILITY_UID = "capabilityUid"; + private final static String CAPABILITY_NAME = "capabilityName"; + private final static String REQUIREMENT_OWNER_ID = "requirementOwnerId"; + private final static String REQUIREMENT_UID = "requirementUid"; + private final static String REQUIREMENT_NAME = "requirementName"; + private final static String RELATIONSHIP_TYPE = "relationshipType"; + + private static Map<String, MapListCapabiltyDataDefinition> fulfilledCapability; + private static Map<String, MapListRequirementDataDefinition> fulfilledRequirement; + private static CapabilityDataDefinition capability; + private static RequirementDataDefinition requirement; + private static RequirementCapabilityRelDef relation; + + private static TitanDao titanDao; + private static NodeTemplateOperation operation; + + @BeforeClass + public static void setup() { + init(); + titanDao = Mockito.mock(TitanDao.class); + operation = new NodeTemplateOperation(); + operation.setTitanDao(titanDao); + buildDataDefinition(); + } + + private static void buildDataDefinition() { + buildCapabiltyDataDefinition(); + buildRequirementDataDefinition(); + buildRelation(); + } + + @Test + public void testGetFulfilledCapabilityByRelationSuccess(){ + GraphVertex vertex = Mockito.mock(GraphVertex.class); + Either<GraphVertex, TitanOperationStatus> vertexRes = Either.left(vertex); + when(titanDao.getVertexById(eq(COMPONENT_ID), eq(JsonParseFlagEnum.ParseAll))).thenReturn(vertexRes); + + GraphVertex dataVertex = new GraphVertex(); + dataVertex.setJson(fulfilledCapability); + Either<GraphVertex, TitanOperationStatus> childVertexRes = Either.left(dataVertex); + when(titanDao.getChildVertex(eq(vertex), eq(EdgeLabelEnum.FULLFILLED_CAPABILITIES), eq(JsonParseFlagEnum.ParseJson))).thenReturn(childVertexRes); + Either<CapabilityDataDefinition, StorageOperationStatus> result = operation.getFulfilledCapabilityByRelation(COMPONENT_ID, TO_INSTANCE_ID, relation, (rel, cap)->isBelongingCapability(rel, cap)); + assertTrue(result.isLeft()); + assertTrue(result.left().value().equals(capability)); + } + + @Test + public void testGetFulfilledRequirementByRelationSuccess(){ + GraphVertex vertex = Mockito.mock(GraphVertex.class); + Either<GraphVertex, TitanOperationStatus> vertexRes = Either.left(vertex); + when(titanDao.getVertexById(eq(COMPONENT_ID), eq(JsonParseFlagEnum.ParseAll))).thenReturn(vertexRes); + + GraphVertex dataVertex = new GraphVertex(); + dataVertex.setJson(fulfilledRequirement); + Either<GraphVertex, TitanOperationStatus> childVertexRes = Either.left(dataVertex); + when(titanDao.getChildVertex(eq(vertex), eq(EdgeLabelEnum.FULLFILLED_REQUIREMENTS), eq(JsonParseFlagEnum.ParseJson))).thenReturn(childVertexRes); + Either<RequirementDataDefinition, StorageOperationStatus> result = operation.getFulfilledRequirementByRelation(COMPONENT_ID, FROM_INSTANCE_ID, relation, (rel, req)->isBelongingRequirement(rel, req)); + assertTrue(result.isLeft()); + assertTrue(result.left().value().equals(requirement)); + } + + @Test + public void testGetFulfilledCapabilityByRelationNotFoundFailure(){ + GraphVertex vertex = Mockito.mock(GraphVertex.class); + Either<GraphVertex, TitanOperationStatus> vertexRes = Either.left(vertex); + when(titanDao.getVertexById(eq(COMPONENT_ID), eq(JsonParseFlagEnum.ParseAll))).thenReturn(vertexRes); + + Either<GraphVertex, TitanOperationStatus> childVertexRes = Either.right(TitanOperationStatus.NOT_FOUND); + when(titanDao.getChildVertex(eq(vertex), eq(EdgeLabelEnum.FULLFILLED_CAPABILITIES), eq(JsonParseFlagEnum.ParseJson))).thenReturn(childVertexRes); + Either<CapabilityDataDefinition, StorageOperationStatus> result = operation.getFulfilledCapabilityByRelation(COMPONENT_ID, TO_INSTANCE_ID, relation, (rel, cap)->isBelongingCapability(rel, cap)); + assertTrue(result.isRight()); + assertTrue(result.right().value() == StorageOperationStatus.NOT_FOUND); + } + + @Test + public void testGetFulfilledRequirementByRelationNotFoundFailure(){ + GraphVertex vertex = Mockito.mock(GraphVertex.class); + Either<GraphVertex, TitanOperationStatus> vertexRes = Either.left(vertex); + when(titanDao.getVertexById(eq(COMPONENT_ID), eq(JsonParseFlagEnum.ParseAll))).thenReturn(vertexRes); + + Either<GraphVertex, TitanOperationStatus> childVertexRes = Either.right(TitanOperationStatus.NOT_FOUND); + when(titanDao.getChildVertex(eq(vertex), eq(EdgeLabelEnum.FULLFILLED_REQUIREMENTS), eq(JsonParseFlagEnum.ParseJson))).thenReturn(childVertexRes); + Either<RequirementDataDefinition, StorageOperationStatus> result = operation.getFulfilledRequirementByRelation(COMPONENT_ID, FROM_INSTANCE_ID, relation,(rel, req)->isBelongingRequirement(rel, req)); + assertTrue(result.isRight()); + assertTrue(result.right().value() == StorageOperationStatus.NOT_FOUND); + } + + private static void buildRequirementDataDefinition() { + buildRequirement(); + fulfilledRequirement = new HashMap<>(); + MapListRequirementDataDefinition mapListRequirementDataDefinition = new MapListRequirementDataDefinition(); + mapListRequirementDataDefinition.add(requirement.getCapability(), requirement); + fulfilledRequirement.put(FROM_INSTANCE_ID, mapListRequirementDataDefinition); + + } + + private static void buildRequirement() { + requirement = new RequirementDataDefinition(); + requirement.setOwnerId(REQUIREMENT_OWNER_ID); + requirement.setUniqueId(REQUIREMENT_UID); + requirement.setName(REQUIREMENT_NAME); + requirement.setRelationship(RELATIONSHIP_TYPE); + } + + private static void buildCapabiltyDataDefinition() { + buildCapability(); + fulfilledCapability = new HashMap<>(); + MapListCapabiltyDataDefinition mapListCapabiltyDataDefinition = new MapListCapabiltyDataDefinition(); + mapListCapabiltyDataDefinition.add(capability.getType(), capability); + fulfilledCapability.put(TO_INSTANCE_ID, mapListCapabiltyDataDefinition); + } + + private static void buildCapability() { + capability = new CapabilityDataDefinition(); + capability.setOwnerId(CAPABILITY_OWNER_ID); + capability.setUniqueId(CAPABILITY_UID); + capability.setName(CAPABILITY_NAME); + } + + private static void buildRelation() { + + relation = new RequirementCapabilityRelDef(); + CapabilityRequirementRelationship relationship = new CapabilityRequirementRelationship(); + RelationshipInfo relationInfo = new RelationshipInfo(); + relationInfo.setId(RELATION_ID); + relationship.setRelation(relationInfo); + + relation.setRelationships(Lists.newArrayList(relationship)); + relation.setToNode(TO_INSTANCE_ID); + relation.setFromNode(FROM_INSTANCE_ID); + + relationInfo.setCapabilityOwnerId(CAPABILITY_OWNER_ID); + relationInfo.setCapabilityUid(CAPABILITY_UID); + relationInfo.setCapability(CAPABILITY_NAME); + relationInfo.setRequirementOwnerId(REQUIREMENT_OWNER_ID); + relationInfo.setRequirementUid(REQUIREMENT_UID); + relationInfo.setRequirement(REQUIREMENT_NAME); + RelationshipImpl relationshipImpl = new RelationshipImpl(); + relationshipImpl.setType(RELATIONSHIP_TYPE); + relationInfo.setRelationships(relationshipImpl); + } + + private boolean isBelongingRequirement(RelationshipInfo relationshipInfo, RequirementDataDefinition req) { + return req.getRelationship().equals(relationshipInfo.getRelationship().getType()) && + req.getName().equals(relationshipInfo.getRequirement()) && + req.getUniqueId().equals(relationshipInfo.getRequirementUid()) && + req.getOwnerId().equals(relationshipInfo.getRequirementOwnerId()); + } + + private boolean isBelongingCapability(RelationshipInfo relationshipInfo, CapabilityDataDefinition cap) { + return cap.getName().equals(relationshipInfo.getCapability()) && + cap.getUniqueId().equals(relationshipInfo.getCapabilityUid()) && + cap.getOwnerId().equals(relationshipInfo.getCapabilityOwnerId()); + } +} @@ -1,6 +1,5 @@ package org.openecomp.sdc.be.model.jsontitan.operations; -import fj.data.Either; import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum; import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; @@ -9,6 +8,8 @@ import org.openecomp.sdc.be.model.ComponentParametersView; import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElement; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; +import fj.data.Either; + /** * Created by cb478c on 6/13/2017. */ @@ -1,6 +1,15 @@ package org.openecomp.sdc.be.model.jsontitan.operations; -import fj.data.Either; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.when; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import java.util.stream.IntStream; + import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -24,15 +33,7 @@ import org.openecomp.sdc.be.model.jsontitan.datamodel.TopologyTemplate; import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElement; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; -import java.util.stream.IntStream; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.when; +import fj.data.Either; @RunWith(MockitoJUnitRunner.class) public class ToscaOperationFacadeTest { @@ -20,9 +20,14 @@ package org.openecomp.sdc.be.model.jsontitan.utils; -import com.thinkaurelius.titan.core.TitanGraph; -import com.thinkaurelius.titan.core.TitanVertex; -import fj.data.Either; +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.OutputStream; +import java.util.Iterator; +import java.util.Map; +import java.util.UUID; + import org.apache.tinkerpop.gremlin.structure.io.IoCore; import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; import org.openecomp.sdc.be.dao.jsongraph.TitanDao; @@ -32,13 +37,10 @@ import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; -import java.io.BufferedOutputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.OutputStream; -import java.util.Iterator; -import java.util.Map; -import java.util.UUID; +import com.thinkaurelius.titan.core.TitanGraph; +import com.thinkaurelius.titan.core.TitanVertex; + +import fj.data.Either; public final class GraphTestUtils { @@ -20,6 +20,8 @@ package org.openecomp.sdc.be.model.operations.impl; +import static org.junit.Assert.assertTrue; + import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; @@ -33,8 +35,6 @@ import org.openecomp.sdc.be.resources.data.UserData; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import static org.junit.Assert.assertTrue; - @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration("classpath:application-context-test.xml") public class AdditionalInformationOperationTest extends ModelTestBase { @@ -20,7 +20,16 @@ package org.openecomp.sdc.be.model.operations.impl; -import fj.data.Either; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + import org.junit.Before; import org.junit.BeforeClass; import org.junit.Ignore; @@ -52,12 +61,7 @@ import org.slf4j.LoggerFactory; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static org.junit.Assert.*; +import fj.data.Either; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration("classpath:application-context-test.xml") @@ -35,8 +35,6 @@ import javax.annotation.Resource; import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; -import org.openecomp.sdc.be.config.Configuration; -import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.dao.titan.TitanGenericDao; import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; import org.openecomp.sdc.be.model.CapabilityTypeDefinition; @@ -44,13 +42,10 @@ import org.openecomp.sdc.be.model.ModelTestBase; import org.openecomp.sdc.be.model.PropertyConstraint; import org.openecomp.sdc.be.model.PropertyDefinition; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; -import org.openecomp.sdc.be.model.operations.impl.CapabilityTypeOperation; import org.openecomp.sdc.be.model.tosca.ToscaType; import org.openecomp.sdc.be.model.tosca.constraints.GreaterThanConstraint; import org.openecomp.sdc.be.model.tosca.constraints.InRangeConstraint; import org.openecomp.sdc.be.model.tosca.constraints.LessOrEqualConstraint; -import org.openecomp.sdc.common.api.ConfigurationListener; -import org.openecomp.sdc.common.api.ConfigurationSource; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @@ -35,7 +35,6 @@ import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; import org.openecomp.sdc.be.model.ArtifactType; import org.openecomp.sdc.be.model.ModelTestBase; import org.openecomp.sdc.be.model.category.CategoryDefinition; -import org.openecomp.sdc.be.model.operations.impl.ElementOperation; import org.openecomp.sdc.be.model.operations.impl.util.OperationTestsUtil; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @@ -20,10 +20,13 @@ package org.openecomp.sdc.be.model.operations.impl; -import static org.junit.Assert.*; -import static org.mockito.Matchers.anyMap; -import static org.mockito.Matchers.anyObject; -import static org.mockito.Matchers.eq; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyMap; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.ArgumentMatchers.isNull; import static org.mockito.Mockito.when; import java.util.ArrayList; @@ -42,7 +45,6 @@ import org.openecomp.sdc.be.model.HeatParameterDefinition; import org.openecomp.sdc.be.model.ModelTestBase; import org.openecomp.sdc.be.model.heat.HeatParameterType; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; -import org.openecomp.sdc.be.model.operations.impl.HeatParametersOperation; import org.openecomp.sdc.be.resources.data.HeatParameterData; import org.openecomp.sdc.be.resources.data.HeatParameterValueData; @@ -73,8 +75,8 @@ public class HeatParametersOperationTest extends ModelTestBase { GraphRelation graphRelation = new GraphRelation(); Either<GraphRelation, TitanOperationStatus> relationResult = Either.left(graphRelation); - when(titanGenericDao.createNode((HeatParameterData) anyObject(), eq(HeatParameterData.class))).thenReturn(either); - when(titanGenericDao.createRelation((GraphNode) anyObject(), (GraphNode) anyObject(), eq(GraphEdgeLabels.HEAT_PARAMETER), anyMap())).thenReturn(relationResult); + when(titanGenericDao.createNode(any(HeatParameterData.class), eq(HeatParameterData.class))).thenReturn(either); + when(titanGenericDao.createRelation(any(GraphNode.class), (GraphNode) any(GraphNode.class), eq(GraphEdgeLabels.HEAT_PARAMETER), anyMap())).thenReturn(relationResult); Either<HeatParameterData, TitanOperationStatus> result = heatParametersOperation.addPropertyToGraph(propName, property, "resourceId.artifactId", NodeTypeEnum.ArtifactRef); @@ -100,8 +102,8 @@ public class HeatParametersOperationTest extends ModelTestBase { GraphRelation graphRelation = new GraphRelation(); Either<GraphRelation, TitanOperationStatus> relationResult = Either.left(graphRelation); - when(titanGenericDao.createNode((HeatParameterData) anyObject(), eq(HeatParameterData.class))).thenReturn(either); - when(titanGenericDao.createRelation((GraphNode) anyObject(), (GraphNode) anyObject(), eq(GraphEdgeLabels.HEAT_PARAMETER), anyMap())).thenReturn(relationResult); + when(titanGenericDao.createNode(any(HeatParameterData.class), eq(HeatParameterData.class))).thenReturn(either); + when(titanGenericDao.createRelation(any(GraphNode.class), any(GraphNode.class), eq(GraphEdgeLabels.HEAT_PARAMETER), anyMap())).thenReturn(relationResult); StorageOperationStatus result = heatParametersOperation.addPropertiesToGraph(parameters, "resourceId.artifactId", NodeTypeEnum.ArtifactRef); @@ -190,31 +192,6 @@ public class HeatParametersOperationTest extends ModelTestBase { assertEquals("false", propertyDefinition.getDefaultValue()); } - // assertTrue(heatParametersOperation.isValidValue(HeatParameterType.BOOLEAN, - // "true")); - // assertTrue(heatParametersOperation.isValidValue(HeatParameterType.BOOLEAN, - // "t")); - // assertTrue(heatParametersOperation.isValidValue(HeatParameterType.BOOLEAN, - // "1")); - // assertTrue(heatParametersOperation.isValidValue(HeatParameterType.BOOLEAN, - // "on")); - // assertTrue(heatParametersOperation.isValidValue(HeatParameterType.BOOLEAN, - // "y")); - // assertTrue(heatParametersOperation.isValidValue(HeatParameterType.BOOLEAN, - // "yes")); - // assertTrue(heatParametersOperation.isValidValue(HeatParameterType.BOOLEAN, - // "false")); - // assertTrue(heatParametersOperation.isValidValue(HeatParameterType.BOOLEAN, - // "f")); - // assertTrue(heatParametersOperation.isValidValue(HeatParameterType.BOOLEAN, - // "0")); - // assertTrue(heatParametersOperation.isValidValue(HeatParameterType.BOOLEAN, - // "off")); - // assertTrue(heatParametersOperation.isValidValue(HeatParameterType.BOOLEAN, - // "n")); - // assertTrue(heatParametersOperation.isValidValue(HeatParameterType.BOOLEAN, - // "no")); - assertFalse(heatParametersOperation.isValidValue(HeatParameterType.BOOLEAN, "blabla")); assertFalse(heatParametersOperation.isValidValue(HeatParameterType.BOOLEAN, "2")); } @@ -256,9 +233,9 @@ public class HeatParametersOperationTest extends ModelTestBase { GraphRelation graphRelation = new GraphRelation(); Either<GraphRelation, TitanOperationStatus> relationResult = Either.left(graphRelation); - when(titanGenericDao.createNode((HeatParameterValueData) anyObject(), eq(HeatParameterValueData.class))).thenReturn(either); - when(titanGenericDao.createRelation((GraphNode) anyObject(), (GraphNode) anyObject(), eq(GraphEdgeLabels.PARAMETER_VALUE), anyMap())).thenReturn(relationResult); - when(titanGenericDao.createRelation((GraphNode) anyObject(), (GraphNode) anyObject(), eq(GraphEdgeLabels.PARAMETER_IMPL), anyMap())).thenReturn(relationResult); + when(titanGenericDao.createNode(any(HeatParameterValueData.class), eq(HeatParameterValueData.class))).thenReturn(either); + when(titanGenericDao.createRelation(any(GraphNode.class), any(GraphNode.class), eq(GraphEdgeLabels.PARAMETER_VALUE), anyMap())).thenReturn(relationResult); + when(titanGenericDao.createRelation(any(GraphNode.class), any(GraphNode.class), eq(GraphEdgeLabels.PARAMETER_IMPL), isNull())).thenReturn(relationResult); Either<HeatParameterValueData, TitanOperationStatus> result = heatParametersOperation.addHeatValueToGraph(property, "artifactLabel", "resourceInstanceId.artifactId", "resourceInstanceId"); @@ -20,8 +20,8 @@ package org.openecomp.sdc.be.model.operations.impl; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; +import static org.junit.Assert.assertTrue; + import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; @@ -40,7 +40,8 @@ import org.slf4j.LoggerFactory; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import static org.junit.Assert.assertTrue; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration("classpath:application-context-test.xml") @@ -38,7 +38,6 @@ import org.openecomp.sdc.be.datatypes.elements.PolicyTypeDataDefinition; import org.openecomp.sdc.be.model.ModelTestBase; import org.openecomp.sdc.be.model.PolicyTypeDefinition; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; -import org.openecomp.sdc.be.model.operations.impl.PolicyTypeOperation; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @@ -20,11 +20,10 @@ package org.openecomp.sdc.be.model.operations.impl; -import static org.junit.Assert.*; -import static org.mockito.Matchers.anyMap; -import static org.mockito.Matchers.anyObject; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.when; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; import java.util.ArrayList; import java.util.Arrays; @@ -37,27 +36,17 @@ import java.util.Set; import org.junit.Before; import org.junit.Test; import org.mockito.Mockito; -import org.openecomp.sdc.be.dao.graph.datatype.GraphNode; -import org.openecomp.sdc.be.dao.graph.datatype.GraphRelation; -import org.openecomp.sdc.be.dao.neo4j.GraphEdgeLabels; import org.openecomp.sdc.be.dao.titan.TitanGenericDao; -import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; import org.openecomp.sdc.be.datatypes.elements.PropertyRule; -import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; import org.openecomp.sdc.be.model.ComponentInstanceProperty; import org.openecomp.sdc.be.model.ModelTestBase; import org.openecomp.sdc.be.model.PropertyConstraint; import org.openecomp.sdc.be.model.PropertyDefinition; -import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; -import org.openecomp.sdc.be.model.operations.impl.PropertyOperation; import org.openecomp.sdc.be.model.tosca.ToscaPropertyType; import org.openecomp.sdc.be.model.tosca.ToscaType; import org.openecomp.sdc.be.model.tosca.constraints.GreaterThanConstraint; import org.openecomp.sdc.be.model.tosca.constraints.InRangeConstraint; import org.openecomp.sdc.be.model.tosca.constraints.LessOrEqualConstraint; -import org.openecomp.sdc.be.resources.data.PropertyData; - -import fj.data.Either; public class PropertyOperationTest extends ModelTestBase { @@ -22,6 +22,7 @@ package org.openecomp.sdc.be.model.operations.impl; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; + import java.io.BufferedOutputStream; import java.io.File; import java.io.FileOutputStream; @@ -42,13 +43,12 @@ import org.junit.rules.TestName; import org.junit.runner.RunWith; import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; import org.openecomp.sdc.be.dao.jsongraph.TitanDao; - import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum; import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum; import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; -import org.openecomp.sdc.be.datatypes.elements.MapPropertiesDataDefinition; import org.openecomp.sdc.be.datatypes.elements.CapabilityDataDefinition; import org.openecomp.sdc.be.datatypes.elements.MapDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.MapPropertiesDataDefinition; import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum; @@ -59,7 +59,6 @@ import org.openecomp.sdc.be.model.LifecycleStateEnum; import org.openecomp.sdc.be.model.ModelTestBase; import org.openecomp.sdc.be.model.category.CategoryDefinition; import org.openecomp.sdc.be.model.category.SubCategoryDefinition; - import org.openecomp.sdc.be.model.jsontitan.datamodel.NodeType; import org.openecomp.sdc.be.model.jsontitan.datamodel.TopologyTemplate; import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElement; @@ -20,7 +20,19 @@ package org.openecomp.sdc.be.model.operations.impl; -import fj.data.Either; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.doAnswer; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import java.time.Instant; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + import org.apache.tinkerpop.gremlin.structure.Direction; import org.apache.tinkerpop.gremlin.structure.Edge; import org.apache.tinkerpop.gremlin.structure.Graph; @@ -45,14 +57,7 @@ import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.resources.data.UserData; import org.openecomp.sdc.common.api.UserRoleEnum; -import java.time.Instant; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.*; +import fj.data.Either; public class UserAdminOperationTest extends ModelTestBase { private static final TitanGenericDao titanGenericDao = mock(TitanGenericDao.class); @@ -20,11 +20,11 @@ package org.openecomp.sdc.be.model.operations.impl.util; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; import java.lang.reflect.Type; import java.util.ArrayList; @@ -32,8 +32,6 @@ import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Set; -import java.util.Map.Entry; import org.apache.commons.lang3.tuple.ImmutablePair; import org.junit.Test; @@ -47,17 +45,14 @@ import org.openecomp.sdc.be.model.tosca.converters.MapConverter; import org.openecomp.sdc.be.model.tosca.validators.DataTypeValidatorConverter; import org.openecomp.sdc.be.model.tosca.validators.ListValidator; import org.openecomp.sdc.be.model.tosca.validators.MapValidator; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import com.google.gson.Gson; -import com.google.gson.GsonBuilder; import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; import com.google.gson.reflect.TypeToken; import fj.data.Either; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; public class DataTypeValidatorTest { private static Logger log = LoggerFactory.getLogger(DataTypeValidatorTest.class.getName()); @@ -27,7 +27,6 @@ import java.util.Map; import java.util.Map.Entry; import java.util.Set; -import org.apache.tinkerpop.gremlin.structure.Direction; import org.apache.tinkerpop.gremlin.structure.Edge; import org.apache.tinkerpop.gremlin.structure.Element; import org.apache.tinkerpop.gremlin.structure.Property; @@ -34,10 +34,8 @@ import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; -import java.util.StringJoiner; import java.util.stream.Collectors; -import org.junit.Test; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.common.util.SerializationUtils; @@ -1,7 +1,5 @@ package org.openecomp.sdc.be.model.tosca; -import javax.annotation.Generated; - import org.junit.Assert; import org.junit.Test; @@ -1,9 +1,6 @@ package org.openecomp.sdc.be.model.tosca.constraints; -import javax.annotation.Generated; - import org.junit.Test; -import org.openecomp.sdc.be.model.tosca.ToscaType; public class EqualConstraintTest { @@ -1,9 +1,6 @@ package org.openecomp.sdc.be.model.tosca.constraints; -import javax.annotation.Generated; - import org.junit.Test; -import org.openecomp.sdc.be.model.tosca.ToscaType; public class GreaterThanConstraintTest { @@ -1,9 +1,6 @@ package org.openecomp.sdc.be.model.tosca.constraints; -import javax.annotation.Generated; - import org.junit.Test; -import org.openecomp.sdc.be.model.tosca.ToscaType; public class InRangeConstraintTest { @@ -1,7 +1,5 @@ package org.openecomp.sdc.be.model.tosca.constraints; -import javax.annotation.Generated; - import org.junit.Test; @@ -1,9 +1,6 @@ package org.openecomp.sdc.be.model.tosca.constraints; -import javax.annotation.Generated; - import org.junit.Test; -import org.openecomp.sdc.be.model.tosca.ToscaType; public class LessOrEqualConstraintTest { @@ -1,7 +1,5 @@ package org.openecomp.sdc.be.model.tosca.constraints; -import javax.annotation.Generated; - import org.junit.Test; @@ -1,7 +1,5 @@ package org.openecomp.sdc.be.model.tosca.constraints; -import javax.annotation.Generated; - import org.junit.Test; @@ -1,7 +1,5 @@ package org.openecomp.sdc.be.model.tosca.constraints; -import javax.annotation.Generated; - import org.junit.Test; @@ -2,10 +2,7 @@ package org.openecomp.sdc.be.model.tosca.constraints; import java.util.List; -import javax.annotation.Generated; - import org.junit.Test; -import org.openecomp.sdc.be.model.tosca.ToscaType; public class ValidValuesConstraintTest { @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.model.tosca.converters; import java.util.Map; -import javax.annotation.Generated; - import org.junit.Test; import org.openecomp.sdc.be.model.DataTypeDefinition; @@ -1,19 +1,19 @@ package org.openecomp.sdc.be.model.tosca.converters; -import com.google.gson.JsonObject; -import org.junit.Before; -import org.junit.Test; -import org.openecomp.sdc.be.model.DataTypeDefinition; -import org.openecomp.sdc.be.model.PropertyDefinition; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; -import javax.json.Json; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.Map; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; +import org.junit.Before; +import org.junit.Test; +import org.openecomp.sdc.be.model.DataTypeDefinition; +import org.openecomp.sdc.be.model.PropertyDefinition; + +import com.google.gson.JsonObject; public class DataTypePropertyConverterTest { @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.model.tosca.converters; import java.util.Map; -import javax.annotation.Generated; - import org.junit.Test; import org.openecomp.sdc.be.model.DataTypeDefinition; @@ -1,11 +1,6 @@ package org.openecomp.sdc.be.model.tosca.converters; -import java.util.Map; - -import javax.annotation.Generated; - import org.junit.Test; -import org.openecomp.sdc.be.model.DataTypeDefinition; public class FloatConverterTest { @@ -1,12 +1,6 @@ package org.openecomp.sdc.be.model.tosca.converters; -import java.util.Map; - -import javax.annotation.Generated; - -import org.junit.Assert; import org.junit.Test; -import org.openecomp.sdc.be.model.DataTypeDefinition; public class HeatBooleanConverterTest { @@ -1,12 +1,6 @@ package org.openecomp.sdc.be.model.tosca.converters; -import java.util.Map; - -import javax.annotation.Generated; - -import org.junit.Assert; import org.junit.Test; -import org.openecomp.sdc.be.model.DataTypeDefinition; public class HeatCommaDelimitedListConverterTest { @@ -1,12 +1,6 @@ package org.openecomp.sdc.be.model.tosca.converters; -import java.util.Map; - -import javax.annotation.Generated; - -import org.junit.Assert; import org.junit.Test; -import org.openecomp.sdc.be.model.DataTypeDefinition; public class HeatJsonConverterTest { @@ -1,12 +1,6 @@ package org.openecomp.sdc.be.model.tosca.converters; -import java.util.Map; - -import javax.annotation.Generated; - -import org.junit.Assert; import org.junit.Test; -import org.openecomp.sdc.be.model.DataTypeDefinition; public class HeatNumberConverterTest { @@ -2,11 +2,7 @@ package org.openecomp.sdc.be.model.tosca.converters; import static org.junit.Assert.assertEquals; -import java.util.Map; - -import org.junit.Assert; import org.junit.Test; -import org.openecomp.sdc.be.model.DataTypeDefinition; public class HeatStringConverterTest { @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.model.tosca.converters; import java.util.Map; -import javax.annotation.Generated; - import org.junit.Assert; import org.junit.Test; import org.openecomp.sdc.be.model.DataTypeDefinition; @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.model.tosca.converters; import java.util.Map; -import javax.annotation.Generated; - import org.junit.Test; import org.openecomp.sdc.be.model.DataTypeDefinition; @@ -1,14 +1,6 @@ package org.openecomp.sdc.be.model.tosca.converters; -import java.util.Map; - -import javax.annotation.Generated; - -import org.junit.Assert; import org.junit.Test; -import org.openecomp.sdc.be.model.DataTypeDefinition; - -import fj.data.Either; public class ListConverterTest { @@ -2,14 +2,9 @@ package org.openecomp.sdc.be.model.tosca.converters; import java.util.Map; -import javax.annotation.Generated; - -import org.junit.Assert; import org.junit.Test; import org.openecomp.sdc.be.model.DataTypeDefinition; -import fj.data.Either; - public class MapConverterTest { @@ -1,12 +1,6 @@ package org.openecomp.sdc.be.model.tosca.converters; -import java.util.Map; - -import javax.annotation.Generated; - -import org.junit.Assert; import org.junit.Test; -import org.openecomp.sdc.be.model.DataTypeDefinition; public class StringConvertorTest { @@ -1,12 +1,6 @@ package org.openecomp.sdc.be.model.tosca.converters; -import java.util.Map; - -import javax.annotation.Generated; - -import org.junit.Assert; import org.junit.Test; -import org.openecomp.sdc.be.model.DataTypeDefinition; public class ToscaBooleanConverterTest { @@ -1,12 +1,6 @@ package org.openecomp.sdc.be.model.tosca.converters; -import java.util.Map; - -import javax.annotation.Generated; - -import org.junit.Assert; import org.junit.Test; -import org.openecomp.sdc.be.model.DataTypeDefinition; public class ToscaFloatConverterTest { @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.model.tosca.converters; import java.util.Map; -import javax.annotation.Generated; - import org.junit.Test; import org.openecomp.sdc.be.model.DataTypeDefinition; @@ -1,12 +1,6 @@ package org.openecomp.sdc.be.model.tosca.converters; -import java.util.Map; - -import javax.annotation.Generated; - -import org.junit.Assert; import org.junit.Test; -import org.openecomp.sdc.be.model.DataTypeDefinition; public class ToscaListValueConverterTest { @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.model.tosca.converters; import java.util.Map; -import javax.annotation.Generated; - import org.junit.Test; import org.openecomp.sdc.be.model.DataTypeDefinition; @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.model.tosca.converters; import java.util.Map; -import javax.annotation.Generated; - import org.junit.Test; import org.openecomp.sdc.be.model.DataTypeDefinition; @@ -20,15 +20,10 @@ package org.openecomp.sdc.be.model.tosca.validators; -import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertNotNull; -import javax.validation.constraints.AssertTrue; +import static org.junit.Assert.assertTrue; import org.junit.Test; -import org.openecomp.sdc.be.model.tosca.validators.IntegerValidator; public class IntegerValidatorTest { private static IntegerValidator validator = IntegerValidator.getInstance(); @@ -1,7 +1,5 @@ package org.openecomp.sdc.be.model.tosca.version; -import javax.annotation.Generated; - import org.junit.Test; @@ -1,9 +1,5 @@ package org.openecomp.sdc.be.model.tosca.version; -import java.util.StringTokenizer; - -import javax.annotation.Generated; - import org.junit.Test; public class VersionTest { @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.ui.model; import java.util.List; -import javax.annotation.Generated; - import org.junit.Test; import org.openecomp.sdc.be.model.category.CategoryDefinition; @@ -3,8 +3,6 @@ package org.openecomp.sdc.be.ui.model; import java.util.List; import java.util.Map; -import javax.annotation.Generated; - import org.junit.Test; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.model.AdditionalInformationDefinition; @@ -3,8 +3,6 @@ package org.openecomp.sdc.be.ui.model; import java.util.List; import java.util.Map; -import javax.annotation.Generated; - import org.junit.Test; import org.openecomp.sdc.be.model.AdditionalInformationDefinition; import org.openecomp.sdc.be.model.InterfaceDefinition; @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.ui.model; import java.util.List; -import javax.annotation.Generated; - import org.junit.Test; import org.openecomp.sdc.be.datatypes.components.ResourceMetadataDataDefinition; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.ui.model; import java.util.Map; -import javax.annotation.Generated; - import org.junit.Test; import org.openecomp.sdc.be.model.ArtifactDefinition; @@ -1,7 +1,5 @@ package org.openecomp.sdc.be.ui.model; -import javax.annotation.Generated; - import org.junit.Test; import org.openecomp.sdc.be.datatypes.components.ServiceMetadataDataDefinition; @@ -61,7 +61,7 @@ const SDC_CONFIG = { }, "resourceTypesFilter":{ "resource":["CP","VFC","VL"], - "service":["CP","VF","VL", "PNF","CVFC"] + "service":["CP","VF","VL", "PNF","CVFC","SERVICE", "Configuration"] }, "logConfig": { "minLogLevel": "debug", @@ -61,7 +61,7 @@ const SDC_CONFIG = { }, "resourceTypesFilter":{ "resource":["CP","VFC","VL"], - "service":["CP","VF","VL", "PNF","CVFC"] + "service":["CP","VF","VL", "PNF","CVFC","SERVICE","Configuration"] }, "logConfig": { "minLogLevel": "debug", @@ -45,7 +45,7 @@ "raw-loader": "^0.5.1", "sass-loader": "^4.1.1", "script-loader": "^0.7.0", - "sdc-ui": "1.6.2", + "sdc-ui": "1.6.9", "source-map-loader": "^0.1.5", "style-loader": "^0.13.1", "url-loader": "^0.5.7", @@ -31,18 +31,17 @@ import './modules/service-module'; import './modules/view-model-module.ts'; import { - IUserResourceClass, DataTypesService, LeftPaletteLoaderService, EcompHeaderService, CookieService, ConfigurationUiService, CacheService, - IUserResource, SdcVersionService, ICategoryResourceClass, EntityService } from "./services"; +import { UserService } from "./ng2/services/user.service"; import {forwardRef} from '@angular/core'; import {UpgradeAdapter} from '@angular/upgrade'; import {CHANGE_COMPONENT_CSAR_VERSION_FLAG, States} from "./utils"; @@ -53,11 +52,12 @@ import {downgradeComponent} from "@angular/upgrade/static"; import {AppModule} from './ng2/app.module'; import {PropertiesAssignmentComponent} from "./ng2/pages/properties-assignment/properties-assignment.page.component"; -import { SearchWithAutoCompleteComponent } from "./ng2/shared/search-with-autocomplete/search-with-autocomplete.component"; import {Component} from "./models/components/component"; import {ComponentServiceNg2} from "./ng2/services/component-services/component.service"; import {ComponentMetadata} from "./models/component-metadata"; import {Categories} from "./models/categories"; +import {IUserProperties} from "./models/user"; +import {SearchWithAutoCompleteComponent} from "./ng2/components/ui/search-with-autocomplete/search-with-autocomplete.component"; let moduleName:string = 'sdcApp'; @@ -225,7 +225,13 @@ ng1appModule.config([ resolve: { injectComponent: ['$stateParams', 'ComponentFactory', 'ComponentServiceNg2', function ($stateParams, ComponentFactory:ComponentFactory, ComponentServiceNg2:ComponentServiceNg2) { if ($stateParams.id) { - return ComponentFactory.getComponentWithMetadataFromServer($stateParams.type.toUpperCase(), $stateParams.id); + return ComponentFactory.getComponentWithMetadataFromServer($stateParams.type.toUpperCase(), $stateParams.id).then( + (component:Component)=> { + if ($stateParams.componentCsar){ + component = ComponentFactory.updateComponentFromCsar($stateParams.componentCsar, <Resource>component); + } + return component; + }); } else if ($stateParams.componentCsar && $stateParams.componentCsar.csarUUID) { return $stateParams.componentCsar; } else { @@ -546,8 +552,8 @@ ng1appModule.config([ templateUrl: './view-models/catalog/catalog-view.html', controller: viewModelsModuleName + '.CatalogViewModel', resolve: { - auth: ["$q", "Sdc.Services.UserResourceService", ($q:any, userResourceService:IUserResourceClass) => { - let userInfo:IUserResource = userResourceService.getLoggedinUser(); + auth: ["$q", "UserServiceNg2", ($q:any, userService:UserService) => { + let userInfo:IUserProperties = userService.getLoggedinUser(); if (userInfo) { return $q.when(userInfo); } else { @@ -592,6 +598,7 @@ ng1appModule.value('TagValidationPattern', /^[\s\w_.-]{1,50}$/); ng1appModule.value('VendorReleaseValidationPattern', /^[\x20-\x21\x23-\x29\x2B-\x2E\x30-\x39\x3B\x3D\x40-\x5B\x5D-\x7B\x7D-\xFF]{1,25}$/); ng1appModule.value('VendorNameValidationPattern', /^[\x20-\x21\x23-\x29\x2B-\x2E\x30-\x39\x3B\x3D\x40-\x5B\x5D-\x7B\x7D-\xFF]{1,60}$/); ng1appModule.value('VendorModelNumberValidationPattern', /^[\x20-\x21\x23-\x29\x2B-\x2E\x30-\x39\x3B\x3D\x40-\x5B\x5D-\x7B\x7D-\xFF]{1,65}$/); +ng1appModule.value('ServiceTypeAndRoleValidationPattern', /^[\x20-\x21\x23-\x29\x2B-\x2E\x30-\x39\x3B\x3D\x40-\x5B\x5D-\x7B\x7D-\xFF]{1,256}$/); ng1appModule.value('ContactIdValidationPattern', /^[\s\w-]{1,50}$/); ng1appModule.value('UserIdValidationPattern', /^[\s\w-]{1,50}$/); ng1appModule.value('ProjectCodeValidationPattern', /^[\s\w-]{5,50}$/); @@ -614,7 +621,7 @@ ng1appModule.run([ 'Sdc.Services.CacheService', 'Sdc.Services.CookieService', 'Sdc.Services.ConfigurationUiService', - 'Sdc.Services.UserResourceService', + 'UserServiceNg2', 'Sdc.Services.CategoryResourceService', 'Sdc.Services.SdcVersionService', '$state', @@ -631,7 +638,7 @@ ng1appModule.run([ cacheService:CacheService, cookieService:CookieService, ConfigurationUi:ConfigurationUiService, - UserResourceClass:IUserResourceClass, + userService:UserService, categoryResourceService:ICategoryResourceClass, sdcVersionService:SdcVersionService, $state:ng.ui.IStateService, @@ -645,6 +652,7 @@ ng1appModule.run([ AngularJSBridge, $templateCache:ng.ITemplateCacheService):void => { $templateCache.put('notification-custom-template.html', require('./view-models/shared/notification-custom-template.html')); + $templateCache.put('notification-custom-template.html', require('./view-models/shared/notification-custom-template.html')); //handle cache data - version let initAsdcVersion:Function = ():void => { @@ -756,27 +764,27 @@ ng1appModule.run([ toParams.previousState = fromParams.previousState; } - if (toState.name !== 'error-403' && !UserResourceClass.getLoggedinUser()) { + if (toState.name !== 'error-403' && !userService.getLoggedinUser()) { internalDeregisterStateChangeStartWatcher(); event.preventDefault(); - UserResourceClass.authorize().$promise.then((user:IUserResource) => { - if (!doesUserHasAccess(toState, user)) { + userService.authorize().subscribe((userInfo:IUserProperties) => { + if (!doesUserHasAccess(toState, userInfo)) { $state.go('error-403'); console.info('User has no permissions'); registerStateChangeStartWatcher(); return; } - UserResourceClass.setLoggedinUser(user); - cacheService.set('user', user); + userService.setLoggedinUser(userInfo); + cacheService.set('user', userInfo); initCategories(); - // initEcompMenu(user); + // initEcompMenu(userInfo); setTimeout(function () { removeLoader(); // initCategories(); - if (UserResourceClass.getLoggedinUser().role === 'ADMIN') { + if (userService.getLoggedinUser().role === 'ADMIN') { // toState.name = "adminDashboard"; $state.go("adminDashboard", toParams); registerStateChangeStartWatcher(); @@ -804,9 +812,9 @@ ng1appModule.run([ registerStateChangeStartWatcher(); }); } - else if (UserResourceClass.getLoggedinUser()) { + else if (userService.getLoggedinUser()) { internalDeregisterStateChangeStartWatcher(); - if (!doesUserHasAccess(toState, UserResourceClass.getLoggedinUser())) { + if (!doesUserHasAccess(toState, userService.getLoggedinUser())) { event.preventDefault(); $state.go('error-403'); console.info('User has no permissions'); @@ -28,7 +28,7 @@ * Created by obarda on 1/8/2017. */ 'use strict'; -import {RequirementsGroup, Component} from "app/models"; +import {RequirementsGroup, Component, Relationship, RelationshipModel} from "app/models"; export interface IRequirementsListScope extends ng.IScope { @@ -62,12 +62,11 @@ export class RequirementsListDirective implements ng.IDirective { scope.getRelation = (requirement:any):any => { if (scope.isInstanceSelected() && scope.component.componentInstancesRelations) { - let relationItem = _.filter(scope.component.componentInstancesRelations, (relation:any) => { + let relationItem:Array<RelationshipModel> = _.filter((<Component>scope.component).componentInstancesRelations, (relation:RelationshipModel) => { return relation.fromNode === scope.component.selectedInstance.uniqueId && - _.some(relation.relationships, { - 'requirement': requirement.name, - 'requirementOwnerId': requirement.ownerId - }); + _.filter(relation.relationships, (relationship:Relationship) => { + return relationship.relation.requirement == requirement.name && relationship.relation.requirementOwnerId == requirement.ownerId; + }).length; }); if (relationItem && relationItem.length) { @@ -1,8 +0,0 @@ -<div class="footer-wrapper"> - <div class="divider-footer-bottom"> - <div class="footer-copyright-text"> - <p> - </p> - </div> - </div> -</div> @@ -1,47 +0,0 @@ - -.footer-wrapper { - position: fixed; - bottom: 0px; - left: 0px; - width: 100%; - background-color: #222222; - color: #ffffff; - font-family: "Arial"; - font-size: 11px; - height: @footer_height; -} - -.footer-wrapper a { - color: #ffffff; - margin: 0; - padding: 0; - text-decoration: underline; -} - -.divider-footer-bottom { - margin: 0 auto; - width: 1020px; -} - -.footer-copyright-text { - display: inline-block; - width:612px; - margin-top: 18px; - margin-left: 50px; - text-align: left; - vertical-align: top; -} - -.footer-logo1 { - display: inline-block; - margin-top: 20px; - margin-left: 124px; -} - -.footer-logo2 { - margin-top: 22px; - margin-left: 9px; - display: inline-block; - font-size: 24px; - vertical-align: top; -} @@ -20,7 +20,8 @@ 'use strict'; import {IAppConfigurtaion, User, IUser} from "app/models"; -import {IUserResourceClass, IUserResource} from "app/services"; +import {IUserProperties} from "../../models/user"; +import {UserService} from "../../ng2/services/user.service"; export class MenuItem { menuId:number; @@ -55,7 +56,7 @@ export class EcompHeaderDirective implements ng.IDirective { constructor(private $http:ng.IHttpService, private sdcConfig:IAppConfigurtaion, - private UserResourceClass:IUserResourceClass) { + private userService:UserService) { } @@ -90,14 +91,14 @@ export class EcompHeaderDirective implements ng.IDirective { let initUser = ():void => { let defaultUserId:string; - let user:IUserResource = this.UserResourceClass.getLoggedinUser(); - if (!user) { + let userInfo:IUserProperties = this.userService.getLoggedinUser(); + if (!userInfo) { defaultUserId = this.$http.defaults.headers.common[this.sdcConfig.cookie.userIdSuffix]; - user = this.UserResourceClass.get({id: defaultUserId}, ():void => { - $scope.user = new User(user); + this.userService.getUser(defaultUserId).subscribe((defaultUserInfo):void => { + $scope.user = new User(defaultUserInfo); }); } else { - $scope.user = new User(user); + $scope.user = new User(userInfo); } }; @@ -135,8 +136,8 @@ export class EcompHeaderDirective implements ng.IDirective { public static factory = ($http:ng.IHttpService, sdcConfig:IAppConfigurtaion, - UserResourceClass:IUserResourceClass)=> { - return new EcompHeaderDirective($http, sdcConfig, UserResourceClass); + userService:UserService)=> { + return new EcompHeaderDirective($http, sdcConfig, userService); }; } @@ -229,7 +230,7 @@ export class EcompHeaderController { }; } -EcompHeaderDirective.factory.$inject = ['$http', 'sdcConfig', 'Sdc.Services.UserResourceService']; +EcompHeaderDirective.factory.$inject = ['$http', 'sdcConfig', 'UserServiceNg2']; @@ -164,12 +164,54 @@ export class CommonGraphUtils { if (!this.isRelationCertified(cy.nodes(), link.source, link.target)) { link.classes = 'not-certified-link'; } - cy.add({ + let linkElement = cy.add({ group: 'edges', data: link, classes: link.classes }); + this.initLinkTooltip(linkElement, link); + }; + + /** + * This function will init qtip tooltip on the link + * @params linkElement - the link we want the tooltip to apply on, + * link - the link obj + */ + public initLinkTooltip(linkElement:Cy.CollectionElements, link:CompositionCiLinkBase) { + + let opts = { + content: function () { + return '<div class="line">' + + '<span class="req-cap-label">R: </span>' + + '<span>'+ link.relation.relationships[0].relation.requirement + '</span>' + + '</div>' + + '<div class="line">' + + '<div class="sprite-new link-tooltip-arrow"></div>' + + '<span class="req-cap-label">C: </span>' + + '<span>' + link.relation.relationships[0].relation.capability + '</span>' + + '</div>'; + }, + position: { + my: 'top center', + at: 'bottom center', + adjust: {x:0, y:0} + }, + style: { + classes: 'qtip-dark qtip-rounded qtip-custom link-qtip', + tip: { + width: 16, + height: 8 + } + }, + show: { + event: 'mouseover', + delay: 1000 + }, + hide: {event: 'mouseout mousedown'}, + includeLabels: true + }; + linkElement.qtip(opts); }; /** @@ -225,6 +225,23 @@ export class ComponentInstanceNodesStyle { css: { 'overlay-opacity': 0 } + }, { + selector: '.configuration-node', + css: { + 'background-color': 'rgb(255,255,255)', + 'shape': 'rectangle', + 'label': 'data(displayName)', + 'background-image': 'data(img)', + 'background-width': GraphUIObjects.SMALL_RESOURCE_WIDTH, + 'background-height': GraphUIObjects.SMALL_RESOURCE_WIDTH, + 'width': GraphUIObjects.SMALL_RESOURCE_WIDTH, + 'height': GraphUIObjects.SMALL_RESOURCE_WIDTH, + 'text-valign': 'bottom', + 'text-halign': 'center', + 'background-opacity': 0, + 'overlay-color': GraphColors.NODE_BACKGROUND_COLOR, + 'overlay-opacity': 0 + } } ] } @@ -19,14 +19,20 @@ */ import { - MatchBase, + Match, LinkMenu, ComponentInstance, LeftPaletteComponent, + Capability, + Requirement, + Relationship, + PropertyModel, Component, - RelationMenuDirectiveObj, + ConnectRelationModel, CompositionCiNodeBase, CompositionCiNodeVl, + ModalModel, + ButtonModel, NodesFactory/*, AssetPopoverObj*/ } from "app/models"; @@ -42,6 +48,18 @@ import {ComponentInstanceNodesStyle} from "../common/style/component-instances-n import {CytoscapeEdgeEditation} from 'third-party/cytoscape.js-edge-editation/CytoscapeEdgeEditation.js'; import {ComponentServiceNg2} from "../../../ng2/services/component-services/component.service"; import {ComponentGenericResponse} from "../../../ng2/services/responses/component-generic-response"; +import {ModalService} from "../../../ng2/services/modal.service"; + +import {ConnectionWizardService} from "../../../ng2/pages/connection-wizard/connection-wizard.service"; +import {StepModel} from "../../../models/wizard-step"; +import {FromNodeStepComponent} from "app/ng2/pages/connection-wizard/from-node-step/from-node-step.component"; +import {PropertiesStepComponent} from "app/ng2/pages/connection-wizard/properties-step/properties-step.component"; +import {ToNodeStepComponent} from "app/ng2/pages/connection-wizard/to-node-step/to-node-step.component"; +import {ConnectionWizardHeaderComponent} from "app/ng2/pages/connection-wizard/connection-wizard-header/connection-wizard-header.component"; +import {ConnectionPropertiesViewComponent} from "../../../ng2/pages/connection-wizard/connection-properties-view/connection-properties-view.component"; +import {ComponentInstanceServiceNg2} from "../../../ng2/services/component-instance-services/component-instance.service"; +import {EVENTS} from "../../../utils/constants"; +import {PropertyBEModel} from "../../../models/properties-inputs/property-be-model"; interface ICompositionGraphScope extends ng.IScope { @@ -50,9 +68,10 @@ interface ICompositionGraphScope extends ng.IScope { isViewOnly: boolean; withSidebar: boolean; // Link menu - create link menu - relationMenuDirectiveObj:RelationMenuDirectiveObj; + relationMenuDirectiveObj:ConnectRelationModel; isLinkMenuOpen:boolean; - createLinkFromMenu:(chosenMatch:MatchBase, vl:Component)=>void; + createLinkFromMenu:(chosenMatch:Match, vl:Component)=>void; + saveChangedCapabilityProperties:()=>Promise<PropertyBEModel[]>; //modify link menu - for now only delete menu relationMenuTimeout:ng.IPromise<any>; @@ -64,6 +83,7 @@ interface ICompositionGraphScope extends ng.IScope { verifyDrop(event:JQueryEventObject, ui:any):void; //Links menus + viewRelation(link:Cy.CollectionEdges):void; deleteRelation(link:Cy.CollectionEdges):void; hideRelationMenu(); @@ -73,6 +93,8 @@ interface ICompositionGraphScope extends ng.IScope { zoomAll(nodes?:Cy.CollectionNodes): void; getAutoCompleteValues(searchTerm: string):void; highlightSearchMatches(searchTerm: string): void; + + canvasMenuProps:any; /*//asset popover menu assetPopoverObj:AssetPopoverObj; @@ -102,7 +124,10 @@ export class CompositionGraph implements ng.IDirective { private commonGraphUtils:CommonGraphUtils, private matchCapabilitiesRequirementsUtils:MatchCapabilitiesRequirementsUtils, private CompositionGraphPaletteUtils:CompositionGraphPaletteUtils, - private ComponentServiceNg2: ComponentServiceNg2) { + private ComponentServiceNg2: ComponentServiceNg2, + private ModalServiceNg2: ModalService, + private ConnectionWizardServiceNg2: ConnectionWizardService, + private ComponentInstanceServiceNg2: ComponentInstanceServiceNg2) { } @@ -131,6 +156,8 @@ export class CompositionGraph implements ng.IDirective { _.forEach(GRAPH_EVENTS, (event) => { this.eventListenerService.unRegisterObserver(event); }); + this.eventListenerService.unRegisterObserver(EVENTS.SHOW_LOADER_EVENT + 'composition-graph'); + this.eventListenerService.unRegisterObserver(EVENTS.HIDE_LOADER_EVENT + 'composition-graph'); }); }; @@ -190,7 +217,7 @@ export class CompositionGraph implements ng.IDirective { if (this.GeneralGraphUtils.componentRequirementsAndCapabilitiesCaching.containsKey(leftPaletteComponent.uniqueId)) { let cacheComponent = this.GeneralGraphUtils.componentRequirementsAndCapabilitiesCaching.getValue(leftPaletteComponent.uniqueId); - let filteredNodesData = this.matchCapabilitiesRequirementsUtils.findByMatchingCapabilitiesToRequirements(cacheComponent, nodesData, nodesLinks); + let filteredNodesData = this.matchCapabilitiesRequirementsUtils.findMatchingNodes(cacheComponent, nodesData, nodesLinks); this.matchCapabilitiesRequirementsUtils.highlightMatchingComponents(filteredNodesData, this._cy); this.matchCapabilitiesRequirementsUtils.fadeNonMachingComponents(filteredNodesData, nodesData, this._cy); @@ -207,7 +234,7 @@ export class CompositionGraph implements ng.IDirective { component.capabilities = response.capabilities; component.requirements = response.requirements; this.GeneralGraphUtils.componentRequirementsAndCapabilitiesCaching.setValue(leftPaletteComponent.uniqueId, component); - let filteredNodesData = this.matchCapabilitiesRequirementsUtils.findByMatchingCapabilitiesToRequirements(component, nodesData, nodesLinks); + let filteredNodesData = this.matchCapabilitiesRequirementsUtils.findMatchingNodes(component, nodesData, nodesLinks); this.matchCapabilitiesRequirementsUtils.fadeNonMachingComponents(filteredNodesData, nodesData, this._cy); this.matchCapabilitiesRequirementsUtils.highlightMatchingComponents(filteredNodesData, this._cy) }); @@ -321,18 +348,124 @@ export class CompositionGraph implements ng.IDirective { scope.zoomAll(matchingNodes); }; - scope.createLinkFromMenu = (chosenMatch:MatchBase):void => { + scope.saveChangedCapabilityProperties = ():Promise<PropertyBEModel[]> => { + return new Promise<PropertyBEModel[]>((resolve) => { + const capabilityPropertiesBE: PropertyBEModel[] = this.ConnectionWizardServiceNg2.changedCapabilityProperties.map((prop) => { + prop.value = prop.getJSONValue(); + const propBE = new PropertyBEModel(prop); + propBE.parentUniqueId = this.ConnectionWizardServiceNg2.selectedMatch.relationship.relation.capabilityOwnerId; + return propBE; + }); + if (capabilityPropertiesBE.length > 0) { + // if there are capability properties to update, then first update capability properties and then resolve promise + this.ComponentInstanceServiceNg2 + .updateInstanceCapabilityProperties( + scope.component, + this.ConnectionWizardServiceNg2.selectedMatch.toNode, + this.ConnectionWizardServiceNg2.selectedMatch.capability.type, + this.ConnectionWizardServiceNg2.selectedMatch.capability.name, + capabilityPropertiesBE + ) + .subscribe((response) => { + console.log("Update resource instance capability properties response: ", response); + response.forEach((resProperty) => { + this.ConnectionWizardServiceNg2.selectedMatch.capabilityProperties.find((property) => { + return property.uniqueId == resProperty.uniqueId; + }).value = resProperty.value; + }); + this.ConnectionWizardServiceNg2.changedCapabilityProperties = []; + resolve(capabilityPropertiesBE); + }); + } else { + // no capability properties to update, immediately resolve promise + resolve(capabilityPropertiesBE); + } + }); + }; + + scope.createLinkFromMenu = ():void => { scope.isLinkMenuOpen = false; - this.CompositionGraphLinkUtils.createLinkFromMenu(this._cy, chosenMatch, scope.component); + + scope.saveChangedCapabilityProperties().then(() => { + //create link: + this.CompositionGraphLinkUtils + .createLinkFromMenu(this._cy, this.ConnectionWizardServiceNg2.selectedMatch, scope.component); + }); }; scope.hideRelationMenu = () => { this.commonGraphUtils.safeApply(scope, () => { - scope.linkMenuObject = null; + delete scope.canvasMenuProps; this.$timeout.cancel(scope.relationMenuTimeout); }); }; + scope.viewRelation = (link:Cy.CollectionEdges) => { + scope.hideRelationMenu(); + + const linkData = link.data(); + const sourceNode:CompositionCiNodeBase = link.source().data(); + const targetNode:CompositionCiNodeBase = link.target().data(); + const relationship:Relationship = linkData.relation.relationships[0]; + + let capability:Capability; + _.some(_.values(targetNode.componentInstance.capabilities), (capGroup) => { + //item.uniqueId + item.ownerId + item.name === (selectedReqOrCapModel.uniqueId + selectedReqOrCapModel.ownerId + selectedReqOrCapModel.name) + capability = _.find<Capability>(_.values<Capability>(capGroup), (cap:Capability) => ( + cap.uniqueId === relationship.relation.capabilityUid && + cap.ownerId === relationship.relation.capabilityOwnerId && + cap.name === relationship.relation.capability + )); + return capability; + }); + let requirement:Requirement; + _.some(_.values(sourceNode.componentInstance.requirements), (reqGroup) => { + requirement = _.find<Requirement>(_.values<Requirement>(reqGroup), (req:Requirement) => ( + req.uniqueId === relationship.relation.requirementUid && + req.ownerId === relationship.relation.requirementOwnerId && + req.name === relationship.relation.requirement + )); + return requirement; + }); + + new Promise<{capability:Capability, requirement:Requirement}>((resolve, reject) => { + if (capability && requirement) { + resolve({capability, requirement}); + } + else { + scope.component.fetchRelation(relationship.relation.id).then((fetchedRelation) => { + resolve({ + capability: fetchedRelation.relationships[0].capability, + requirement: fetchedRelation.relationships[0].requirement + }); + }, reject); + } + }).then((objReqCap) => { + capability = objReqCap.capability; + requirement = objReqCap.requirement; + + this.ConnectionWizardServiceNg2.currentComponent = scope.component; + this.ConnectionWizardServiceNg2.connectRelationModel = new ConnectRelationModel(sourceNode, targetNode, []); + this.ConnectionWizardServiceNg2.selectedMatch = new Match(requirement, capability, true, linkData.source, linkData.target); + this.ConnectionWizardServiceNg2.selectedMatch.relationship = relationship; + + const title = `Connection Properties`; + const saveButton: ButtonModel = new ButtonModel('Save', 'blue', () => { + scope.saveChangedCapabilityProperties().then(() => { this.ModalServiceNg2.closeCurrentModal(); }) + }); + const cancelButton: ButtonModel = new ButtonModel('Cancel', 'white', () => { this.ModalServiceNg2.closeCurrentModal(); }); + const modal = new ModalModel('xl', title, '', [saveButton, cancelButton]); + const modalInstance = this.ModalServiceNg2.createCustomModal(modal); + this.ModalServiceNg2.addDynamicContentToModal(modalInstance, ConnectionPropertiesViewComponent); + modalInstance.instance.open(); + + this.ComponentInstanceServiceNg2.getInstanceCapabilityProperties(scope.component, linkData.target, capability.type, capability.name) + .subscribe((response: Array<PropertyModel>) => { + this.ConnectionWizardServiceNg2.selectedMatch.capabilityProperties = response; + this.ModalServiceNg2.addDynamicContentToModal(modalInstance, ConnectionPropertiesViewComponent); + }, (error) => {}); + }, (error) => {}); + }; scope.deleteRelation = (link:Cy.CollectionEdges) => { scope.hideRelationMenu(); @@ -367,9 +500,26 @@ export class CompositionGraph implements ng.IDirective { this._cy.on('addedgemouseup', (event, data) => { scope.relationMenuDirectiveObj = this.CompositionGraphLinkUtils.onLinkDrawn(this._cy, data.source, data.target); if (scope.relationMenuDirectiveObj != null) { - scope.$apply(() => { - scope.isLinkMenuOpen = true; - }); + this.ConnectionWizardServiceNg2.setRelationMenuDirectiveObj(scope.relationMenuDirectiveObj); + this.ConnectionWizardServiceNg2.currentComponent = scope.component; + //TODO: init with the selected values + this.ConnectionWizardServiceNg2.selectedMatch = null; + + let steps:Array<StepModel> = []; + let fromNodeName:string = scope.relationMenuDirectiveObj.fromNode.componentInstance.name; + let toNodeName:string = scope.relationMenuDirectiveObj.toNode.componentInstance.name; + steps.push(new StepModel(fromNodeName, FromNodeStepComponent)); + steps.push(new StepModel(toNodeName, ToNodeStepComponent)); + steps.push(new StepModel('Properties', PropertiesStepComponent)); + let wizardTitle = 'Connect: ' + fromNodeName + ' to ' + toNodeName; + let modalInstance = this.ModalServiceNg2.createMultiStepsWizard(wizardTitle, steps, scope.createLinkFromMenu, ConnectionWizardHeaderComponent); + modalInstance.instance.open(); + + // + // this.ModalServiceNg2.createMultiStepsWizard('Connect', )Connect + // scope.$apply(() => { + // scope.isLinkMenuOpen = true; + // }); } }); this._cy.on('tapstart', 'node', (event:Cy.EventObject) => { @@ -424,7 +574,7 @@ export class CompositionGraph implements ng.IDirective { let nodesLinks = this.GeneralGraphUtils.getAllCompositionCiLinks(this._cy); let linkableNodes = this.commonGraphUtils.getLinkableNodes(this._cy, payload.node); - let filteredNodesData = this.matchCapabilitiesRequirementsUtils.findByMatchingCapabilitiesToRequirements(payload.node.data().componentInstance, linkableNodes, nodesLinks); + let filteredNodesData = this.matchCapabilitiesRequirementsUtils.findMatchingNodes(payload.node.data().componentInstance, linkableNodes, nodesLinks); this.matchCapabilitiesRequirementsUtils.highlightMatchingComponents(filteredNodesData, this._cy); this.matchCapabilitiesRequirementsUtils.fadeNonMachingComponents(filteredNodesData, nodesData, this._cy, payload.node.data()); @@ -498,14 +648,39 @@ export class CompositionGraph implements ng.IDirective { };*/ private openModifyLinkMenu = (scope:ICompositionGraphScope, linkMenuObject:LinkMenu, timeOutInMilliseconds?:number) => { + scope.hideRelationMenu(); + this.$timeout(() => { + scope.canvasMenuProps = { + open: true, + styleClass: 'w-sdc-canvas-menu-list', + items: [], + position: { + x: `${linkMenuObject.position.x}px`, + y: `${linkMenuObject.position.y}px` + } + }; + + if (this._cy.$('edge:selected').length === 1) { + scope.canvasMenuProps.items.push({ + contents: 'View', + styleClass: 'w-sdc-canvas-menu-item-view', + action: () => { + scope.viewRelation(<Cy.CollectionEdges>linkMenuObject.link); + } + }); + } + scope.canvasMenuProps.items.push({ + contents: 'Delete', + styleClass: 'w-sdc-canvas-menu-item-delete', + action: () => { + scope.deleteRelation(<Cy.CollectionEdges>linkMenuObject.link); + } + }); - this.commonGraphUtils.safeApply(scope, () => { - scope.linkMenuObject = linkMenuObject; + scope.relationMenuTimeout = this.$timeout(() => { + scope.hideRelationMenu(); + }, timeOutInMilliseconds ? timeOutInMilliseconds : 6000); }); - - scope.relationMenuTimeout = this.$timeout(() => { - scope.hideRelationMenu(); - }, timeOutInMilliseconds ? timeOutInMilliseconds : 6000); }; private initGraphNodes(componentInstances:ComponentInstance[], isViewOnly:boolean) { @@ -571,7 +746,10 @@ export class CompositionGraph implements ng.IDirective { CommonGraphUtils, MatchCapabilitiesRequirementsUtils, CompositionGraphPaletteUtils, - ComponentServiceNg2) => { + ComponentServiceNg2, + ModalService, + ConnectionWizardService, + ComponentInstanceServiceNg2) => { return new CompositionGraph( $q, $log, @@ -587,7 +765,10 @@ export class CompositionGraph implements ng.IDirective { CommonGraphUtils, MatchCapabilitiesRequirementsUtils, CompositionGraphPaletteUtils, - ComponentServiceNg2); + ComponentServiceNg2, + ModalService, + ConnectionWizardService, + ComponentInstanceServiceNg2); } } @@ -606,5 +787,8 @@ CompositionGraph.factory.$inject = [ 'CommonGraphUtils', 'MatchCapabilitiesRequirementsUtils', 'CompositionGraphPaletteUtils', - 'ComponentServiceNg2' + 'ComponentServiceNg2', + 'ModalServiceNg2', + 'ConnectionWizardServiceNg2', + 'ComponentInstanceServiceNg2' ]; @@ -8,17 +8,7 @@ <relation-menu relation-menu-directive-obj="relationMenuDirectiveObj" is-link-menu-open="isLinkMenuOpen" create-relation="createLinkFromMenu" cancel="cancelRelationMenu()"></relation-menu> - -<div class="w-sdc-canvas-menu" - data-ng-show="linkMenuObject" ng-style="{left: linkMenuObject.position.x, top: linkMenuObject.position.y}" - id="relationMenu"> - - <div class="w-sdc-canvas-menu-content hand" data-ng-click="deleteRelation(linkMenuObject.link)"> - <div class="w-sdc-canvas-menu-content-delete-button"></div> - Delete - </div> - -</div> +<menu-list-ng2 [props]="canvasMenuProps"></menu-list-ng2> <div class="w-sdc-search-menu" data-ng-class="{'with-sidebar': withSidebar}"> <ng2-search-with-autocomplete [search-placeholder]="'Type to search'" [auto-complete-values]="componentInstanceNames" (search-changed)="getAutoCompleteValues($event)" (search-button-clicked)="highlightSearchMatches($event)" @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -import {ComponentInstance, Component, MatchReqToCapability, MatchBase, CompositionCiLinkBase, CompositionCiNodeUcpeCp} from "app/models"; +import {ComponentInstance, Component, Match, CompositionCiLinkBase, CompositionCiNodeUcpeCp} from "app/models"; import {QueueUtils, Dictionary, GraphUIObjects} from "app/utils"; import {LoaderService} from "app/services"; import {MatchCapabilitiesRequirementsUtils} from "./match-capability-requierment-utils"; @@ -106,16 +106,16 @@ export class CompositionGraphGeneralUtils { * @param cy - Cytoscape instance * @param fromUcpeInstance * @param toComponentInstance - * @returns {MatchReqToCapability} + * @returns {Match} */ - public canBeHostedOn(cy:Cy.Instance, fromUcpeInstance:ComponentInstance, toComponentInstance:ComponentInstance):MatchReqToCapability { + public canBeHostedOn(cy:Cy.Instance, fromUcpeInstance:ComponentInstance, toComponentInstance:ComponentInstance):Match { - let matches:Array<MatchBase> = this.matchCapabilitiesRequirementsUtils.getMatchedRequirementsCapabilities(fromUcpeInstance, toComponentInstance, this.getAllCompositionCiLinks(cy)); - let hostedOnMatch:MatchBase = _.find(matches, (match:MatchReqToCapability) => { + let matches:Array<Match> = this.matchCapabilitiesRequirementsUtils.getMatchedRequirementsCapabilities(fromUcpeInstance, toComponentInstance, this.getAllCompositionCiLinks(cy)); + let hostedOnMatch:Match = _.find(matches, (match:Match) => { return match.requirement.capability.toLowerCase() === 'tosca.capabilities.container'; }); - return <MatchReqToCapability>hostedOnMatch; + return hostedOnMatch; }; @@ -128,7 +128,7 @@ export class CompositionGraphGeneralUtils { */ private isValidDropInsideUCPE(cy:Cy.Instance, nodeToInsert:ComponentInstance, ucpeNode:ComponentInstance):boolean { - let hostedOnMatch:MatchReqToCapability = this.canBeHostedOn(cy, ucpeNode, nodeToInsert); + let hostedOnMatch:Match = this.canBeHostedOn(cy, ucpeNode, nodeToInsert); let result:boolean = !angular.isUndefined(hostedOnMatch) || nodeToInsert.isVl(); //group validation return result; @@ -21,25 +21,17 @@ /** * Created by obarda on 6/28/2016. */ -import {GraphUIObjects, ComponentInstanceFactory, ResourceType} from "app/utils"; -import {LeftPaletteLoaderService, LoaderService} from "app/services"; +import {GraphUIObjects} from "app/utils"; +import {LoaderService} from "app/services"; import { NodeUcpe, CompositionCiNodeVf, - MatchReqToCapability, - MatchBase, - MatchReqToReq, - ComponentInstance, + Match, CompositionCiNodeBase, RelationshipModel, - RelationMenuDirectiveObj, - CapabilitiesGroup, + ConnectRelationModel, LinksFactory, - NodesFactory, - RequirementsGroup, Component, - Relationship, - Capability, LinkMenu, Point, CompositionCiLinkBase @@ -105,16 +97,16 @@ export class CompositionGraphLinkUtils { ); }; - private createSimpleLink = (match:MatchReqToCapability, cy:Cy.Instance, component:Component):void => { + private createSimpleLink = (match:Match, cy:Cy.Instance, component:Component):void => { let newRelation:RelationshipModel = match.matchToRelationModel(); let linkObg:CompositionCiLinkBase = this.linksFactory.createGraphLink(cy, newRelation, newRelation.relationships[0]); this.createLink(linkObg, cy, component); }; - public createLinkFromMenu = (cy:Cy.Instance, chosenMatch:MatchBase, component:Component):void => { + public createLinkFromMenu = (cy:Cy.Instance, chosenMatch:Match, component:Component):void => { if (chosenMatch) { - if (chosenMatch && chosenMatch instanceof MatchReqToCapability) { + if (chosenMatch && chosenMatch instanceof Match) { this.createSimpleLink(chosenMatch, cy, component); } } @@ -128,18 +120,18 @@ export class CompositionGraphLinkUtils { * @param matchesArray * @returns {Array<MatchBase>} */ - public filterUcpeLinks(fromNode:CompositionCiNodeBase, toNode:CompositionCiNodeBase, matchesArray:Array<MatchBase>):any { + public filterUcpeLinks(fromNode:CompositionCiNodeBase, toNode:CompositionCiNodeBase, matchesArray:Array<Match>):any { - let matchLink:Array<MatchBase>; + let matchLink:Array<Match>; if (fromNode.isUcpePart) { - matchLink = _.filter(matchesArray, (match:MatchBase) => { + matchLink = _.filter(matchesArray, (match:Match) => { return match.isOwner(fromNode.id); }); } if (toNode.isUcpePart) { - matchLink = _.filter(matchesArray, (match:MatchBase) => { + matchLink = _.filter(matchesArray, (match:Match) => { return match.isOwner(toNode.id); }); } @@ -154,14 +146,14 @@ export class CompositionGraphLinkUtils { * @param toNode * @returns {any} */ - public onLinkDrawn(cy:Cy.Instance, fromNode:Cy.CollectionFirstNode, toNode:Cy.CollectionFirstNode):RelationMenuDirectiveObj { + public onLinkDrawn(cy:Cy.Instance, fromNode:Cy.CollectionFirstNode, toNode:Cy.CollectionFirstNode):ConnectRelationModel { if (!this.commonGraphUtils.nodeLocationsCompatible(cy, fromNode, toNode)) { return null; } let linkModel:Array<CompositionCiLinkBase> = this.generalGraphUtils.getAllCompositionCiLinks(cy); - let possibleRelations:Array<MatchBase> = this.matchCapabilitiesRequirementsUtils.getMatchedRequirementsCapabilities(fromNode.data().componentInstance, + let possibleRelations:Array<Match> = this.matchCapabilitiesRequirementsUtils.getMatchedRequirementsCapabilities(fromNode.data().componentInstance, toNode.data().componentInstance, linkModel); //filter relations found to limit to specific ucpe-cp @@ -169,8 +161,8 @@ export class CompositionGraphLinkUtils { //if found possibleRelations between the nodes we create relation menu directive and open the link menu if (possibleRelations.length) { - let menuPosition = this.generalGraphUtils.getLinkMenuPosition(cy, toNode.renderedPoint()); - return new RelationMenuDirectiveObj(fromNode.data(), toNode.data(), menuPosition, possibleRelations); + // let menuPosition = this.generalGraphUtils.getLinkMenuPosition(cy, toNode.renderedPoint()); + return new ConnectRelationModel(fromNode.data(), toNode.data(), possibleRelations); } return null; }; @@ -209,7 +201,7 @@ export class CompositionGraphLinkUtils { * @param vfNode */ public createVfToUcpeLink = (component:Component, cy:Cy.Instance, ucpeNode:NodeUcpe, vfNode:CompositionCiNodeVf):void => { - let hostedOnMatch:MatchReqToCapability = this.generalGraphUtils.canBeHostedOn(cy, ucpeNode.componentInstance, vfNode.componentInstance); + let hostedOnMatch:Match = this.generalGraphUtils.canBeHostedOn(cy, ucpeNode.componentInstance, vfNode.componentInstance); /* create relation */ let newRelation = new RelationshipModel(); newRelation.fromNode = ucpeNode.id; @@ -224,13 +216,12 @@ export class CompositionGraphLinkUtils { /** * Handles click event on links. * If one edge selected: do nothing. - /*Two edges selected - always select all - /* Three or more edges: first click - select all, secondary click - select single. + * Two or more edges: first click - select all, secondary click - select single. * @param cy * @param event */ public handleLinkClick(cy:Cy.Instance, event:Cy.EventObject) { - if (cy.$('edge:selected').length > 2 && event.cyTarget[0].selected()) { + if (cy.$('edge:selected').length > 1 && event.cyTarget[0].selected()) { cy.$(':selected').unselect(); } else { @@ -256,7 +247,7 @@ export class CompositionGraphLinkUtils { * @returns {Point} */ public calculateLinkMenuPosition(event, elementWidth, elementHeight):Point { - let point:Point = new Point(event.originalEvent.x, event.originalEvent.y); + let point:Point = new Point(event.originalEvent.clientX, event.originalEvent.clientY); if (event.originalEvent.view.screen.height - elementHeight < point.y) { point.y = event.originalEvent.view.screen.height - elementHeight; } @@ -18,22 +18,17 @@ * ============LICENSE_END========================================================= */ -import {Requirement, CompositionCiLinkBase, ComponentInstance, CapabilitiesGroup, RequirementsGroup, MatchReqToCapability, MatchBase, - MatchReqToReq,CompositionCiNodeBase, Component, Capability} from "app/models"; +import { + Requirement, CompositionCiLinkBase, CapabilitiesGroup, RequirementsGroup, Match, + CompositionCiNodeBase, Component, Capability +} from "app/models"; +import {ComponentInstance} from "../../../../models/componentsInstances/componentInstance"; /** * Created by obarda on 1/1/2017. */ export class MatchCapabilitiesRequirementsUtils { - constructor() { - } - - public static linkable(requirement1:Requirement, requirement2:Requirement, vlCapability:Capability):boolean { - return MatchCapabilitiesRequirementsUtils.isMatch(requirement1, vlCapability) && MatchCapabilitiesRequirementsUtils.isMatch(requirement2, vlCapability); - }; - - /** * Shows + icon in corner of each node passed in * @param filteredNodesData @@ -77,9 +72,7 @@ export class MatchCapabilitiesRequirementsUtils { }) } - // -------------------------------------------ALL FUNCTIONS NEED REFACTORING---------------------------------------------------------------// - - private static requirementFulfilled(fromNodeId:string, requirement:any, links:Array<CompositionCiLinkBase>):boolean { + private static isRequirementFulfilled(fromNodeId:string, requirement:any, links:Array<CompositionCiLinkBase>):boolean { return _.some(links, { 'relation': { 'fromNode': fromNodeId, @@ -108,172 +101,97 @@ export class MatchCapabilitiesRequirementsUtils { return false; }; - private getFromToMatches(requirements1:RequirementsGroup, - requirements2:RequirementsGroup, - capabilities:CapabilitiesGroup, - links:Array<CompositionCiLinkBase>, - fromId:string, - toId:string, - vlCapability?:Capability):Array<MatchBase> { - let matches:Array<MatchBase> = new Array<MatchBase>(); - _.forEach(requirements1, (requirementValue:Array<Requirement>, key) => { - _.forEach(requirementValue, (requirement:Requirement) => { - if (requirement.name !== "dependency" && !MatchCapabilitiesRequirementsUtils.requirementFulfilled(fromId, requirement, links)) { - _.forEach(capabilities, (capabilityValue:Array<Capability>, key) => { - _.forEach(capabilityValue, (capability:Capability) => { - if (MatchCapabilitiesRequirementsUtils.isMatch(requirement, capability)) { - let match:MatchReqToCapability = new MatchReqToCapability(requirement, capability, true, fromId, toId); - matches.push(match); - } - }); - }); - if (vlCapability) { - _.forEach(requirements2, (requirement2Value:Array<Requirement>, key) => { - _.forEach(requirement2Value, (requirement2:Requirement) => { - if (!MatchCapabilitiesRequirementsUtils.requirementFulfilled(toId, requirement2, links) && MatchCapabilitiesRequirementsUtils.linkable(requirement, requirement2, vlCapability)) { - let match:MatchReqToReq = new MatchReqToReq(requirement, requirement2, true, fromId, toId); - matches.push(match); - } - }); - }); - } - } - }); - }); - return matches; - } - - private getToFromMatches(requirements:RequirementsGroup, capabilities:CapabilitiesGroup, links:Array<CompositionCiLinkBase>, fromId:string, toId:string):Array<MatchReqToCapability> { - let matches:Array<MatchReqToCapability> = []; - _.forEach(requirements, (requirementValue:Array<Requirement>, key) => { - _.forEach(requirementValue, (requirement:Requirement) => { - if (requirement.name !== "dependency" && !MatchCapabilitiesRequirementsUtils.requirementFulfilled(toId, requirement, links)) { - _.forEach(capabilities, (capabilityValue:Array<Capability>, key) => { - _.forEach(capabilityValue, (capability:Capability) => { - if (MatchCapabilitiesRequirementsUtils.isMatch(requirement, capability)) { - let match:MatchReqToCapability = new MatchReqToCapability(requirement, capability, false, toId, fromId); - matches.push(match); - } - }); - }); - } - }); - }); - return matches; - } - public getMatchedRequirementsCapabilities(fromComponentInstance:ComponentInstance, toComponentInstance:ComponentInstance, - links:Array<CompositionCiLinkBase>, - vl?:Component):Array<MatchBase> {//TODO allow for VL array - let linkCapability; - if (vl) { - let linkCapabilities:Array<Capability> = vl.capabilities.findValueByKey('linkable'); - if (linkCapabilities) { - linkCapability = linkCapabilities[0]; - } - } - let fromToMatches:Array<MatchBase> = this.getFromToMatches(fromComponentInstance.requirements, - toComponentInstance.requirements, + links:Array<CompositionCiLinkBase>):Array<Match> { + let fromToMatches:Array<Match> = this.getMatches(fromComponentInstance.requirements, toComponentInstance.capabilities, links, fromComponentInstance.uniqueId, - toComponentInstance.uniqueId, - linkCapability); - let toFromMatches:Array<MatchReqToCapability> = this.getToFromMatches(toComponentInstance.requirements, + toComponentInstance.uniqueId, true); + let toFromMatches:Array<Match> = this.getMatches(toComponentInstance.requirements, fromComponentInstance.capabilities, links, fromComponentInstance.uniqueId, - toComponentInstance.uniqueId); + toComponentInstance.uniqueId, false); return fromToMatches.concat(toFromMatches); } + /***** REFACTORED FUNCTIONS START HERE *****/ + + public getMatches(requirements:RequirementsGroup, capabilities:CapabilitiesGroup, links:Array<CompositionCiLinkBase>, + fromId:string, toId:string, isFromTo: boolean):Array<Match> { + let matches:Array<Match> = []; + let unfulfilledReqs = this.getUnfulfilledRequirements(fromId, requirements, links); + _.forEach(unfulfilledReqs, (req)=> { + _.forEach(_.flatten(_.values(capabilities)), (capability:Capability)=> { + if (MatchCapabilitiesRequirementsUtils.isMatch(req, capability)) { + if(isFromTo) { + matches.push(new Match(req, capability, isFromTo, fromId, toId)); + } else{ + matches.push(new Match(req, capability, isFromTo, toId, fromId)); + } + } + }); + }); + return matches; + } + + public getUnfulfilledRequirements = (fromNodeId:string, requirements:RequirementsGroup, links:Array<CompositionCiLinkBase>):Array<Requirement>=> { + + let requirementArray:Array<Requirement> = []; + _.forEach(_.flatten(_.values(requirements)), (requirement:Requirement)=> { + if (requirement.name !== "dependency" && !MatchCapabilitiesRequirementsUtils.isRequirementFulfilled(fromNodeId, requirement, links)) { + requirementArray.push(requirement); + } + }); + return requirementArray; + }; + /** - * Step I: Check if capabilities of component match requirements of nodeDataArray - * 1. Get component capabilities and loop on each capability - * 2. Inside the loop, perform another loop on all nodeDataArray, and fetch the requirements for each one - * 3. Loop on the requirements, and verify match (see in code the rules) - * - * Step II: Check if requirements of component match capabilities of nodeDataArray - * 1. Get component requirements and loop on each requirement - * 2. - * - * @param component - this is the hovered resource of the left panel of composition screen - * @param nodeDataArray - Array of resource instances that are on the canvas - * @param links -getMatchedRequirementsCapabilities - * @param vl - - * @returns {any[]|T[]} + * Returns true if there is a match between the capabilities and requirements that are passed in + * @param requirements + * @param capabilities + * @returns {boolean} */ - public findByMatchingCapabilitiesToRequirements(component:Component, - nodeDataArray:Array<CompositionCiNodeBase>, - links:Array<CompositionCiLinkBase>, - vl?:Component):Array<any> {//TODO allow for VL array - let res = []; - - // STEP I - { - let capabilities:any = component.capabilities; - _.forEach(capabilities, (capabilityValue:Array<any>, capabilityKey)=> { - _.forEach(capabilityValue, (capability)=> { - _.forEach(nodeDataArray, (node:CompositionCiNodeBase)=> { - if (node && node.componentInstance) { - let requirements:any = node.componentInstance.requirements; - let fromNodeId:string = node.componentInstance.uniqueId; - _.forEach(requirements, (requirementValue:Array<any>, requirementKey)=> { - _.forEach(requirementValue, (requirement)=> { - if (requirement.name !== "dependency" && MatchCapabilitiesRequirementsUtils.isMatch(requirement, capability) - && !MatchCapabilitiesRequirementsUtils.requirementFulfilled(fromNodeId, requirement, links)) { - res.push(node); - } - }); - }); - } - }); - }); + public containsMatch = (requirements:Array<Requirement>, capabilities:CapabilitiesGroup):boolean => { + return _.some(requirements, (req:Requirement)=> { + return _.some(_.flatten(_.values(capabilities)), (capability:Capability) => { + return MatchCapabilitiesRequirementsUtils.isMatch(req, capability); }); - } + }); + }; - // STEP II - { - let requirements:any = component.requirements; - let fromNodeId:string = component.uniqueId; - let linkCapability:Array<Capability> = vl ? vl.capabilities.findValueByKey('linkable') : undefined; + /** + * Returns array of nodes that can connect to the component. + * In order to connect, one of the following conditions must be met: + * 1. component has an unfulfilled requirement that matches a node's capabilities + * 2. node has an unfulfilled requirement that matches the component's capabilities + * 3. vl is passed in which has the capability to fulfill requirement from component and requirement on node. + */ + public findMatchingNodes(component:Component, nodeDataArray:Array<CompositionCiNodeBase>, + links:Array<CompositionCiLinkBase>):Array<any> //TODO allow for VL array and TEST + { + let componentRequirements:Array<Requirement> = this.getUnfulfilledRequirements(component.uniqueId, component.requirements, links); + return _.filter(nodeDataArray, (node:any)=> { + if (node && node.componentInstance) { + + //Check if component has an unfulfilled requirement that can be met by one of nodes's capabilities (#1) + if (componentRequirements.length && node.category !== 'groupCp' && this.containsMatch(componentRequirements, node.componentInstance.capabilities)) { + return true; - _.forEach(requirements, (requirementValue:Array<any>, requirementKey)=> { - _.forEach(requirementValue, (requirement)=> { - if (requirement.name !== "dependency" && !MatchCapabilitiesRequirementsUtils.requirementFulfilled(fromNodeId, requirement, links)) { - _.forEach(nodeDataArray, (node:any)=> { - if (node && node.componentInstance && node.category !== 'groupCp') { - let capabilities:any = node.componentInstance.capabilities; - _.forEach(capabilities, (capabilityValue:Array<any>, capabilityKey)=> { - _.forEach(capabilityValue, (capability)=> { - if (MatchCapabilitiesRequirementsUtils.isMatch(requirement, capability)) { - res.push(node); - } - }); - }); - if (linkCapability) { - let linkRequirements = node.componentInstance.requirements; - _.forEach(linkRequirements, (value:Array<any>, key)=> { - _.forEach(value, (linkRequirement)=> { - if (!MatchCapabilitiesRequirementsUtils.requirementFulfilled(node.componentInstance.uniqueId, linkRequirement, links) - && MatchCapabilitiesRequirementsUtils.linkable(requirement, linkRequirement, linkCapability[0])) { - res.push(node); - } - }); - }); - } - } - }); + } else { //Check if node has unfulfilled requirement that can be filled by component (#2) + let nodeRequirements:Array<Requirement> = this.getUnfulfilledRequirements(node.componentInstance.uniqueId, node.componentInstance.requirements, links); + if (!nodeRequirements.length) return false; + if (this.containsMatch(nodeRequirements, component.capabilities)) { + return true; } - }); - }); - } - - return _.uniq(res); - }; + } + } + }); + } } MatchCapabilitiesRequirementsUtils.$inject = []; @@ -27,6 +27,7 @@ import { ModulesNodesStyle } from "../common/style/module-node-style"; import { GRAPH_EVENTS } from "app/utils"; import { EventListenerService } from "app/services"; import '@bardit/cytoscape-expand-collapse'; +import {AngularJSBridge} from "../../../services/angular-js-bridge-service"; interface IDeploymentGraphScope extends ng.IScope { component: Component; @@ -105,6 +106,7 @@ export class DeploymentGraph implements ng.IDirective { private loadGraph = (scope: IDeploymentGraphScope, el: JQuery) => { let graphEl = el.find('.sdc-deployment-graph-wrapper'); + const imagePath = AngularJSBridge.getAngularConfig().imagesPath; this._cy = cytoscape({ container: graphEl, style: ComponentInstanceNodesStyle.getCompositionGraphStyle().concat(ModulesNodesStyle.getModuleGraphStyle()), @@ -124,8 +126,8 @@ export class DeploymentGraph implements ng.IDirective { fisheye: false, undoable: false, expandCollapseCueSize: 18, - expandCueImage: '/assets/styles/images/resource-icons/' + 'closeModule.png', - collapseCueImage: '/assets/styles/images/resource-icons/' + 'openModule.png', + expandCueImage: imagePath + '/assets/styles/images/resource-icons/' + 'closeModule.png', + collapseCueImage: imagePath + '/assets/styles/images/resource-icons/' + 'openModule.png', expandCollapseCueSensitivity: 2, cueOffset: -20 }); @@ -132,7 +132,7 @@ export class Palette implements ng.IDirective { private initLeftPanel(leftPanelComponents:Array<LeftPaletteComponent>, resourceFilterTypes:Array<string>):LeftPanelModel { let leftPanelModel = new LeftPanelModel(); - + if (resourceFilterTypes && resourceFilterTypes.length) { leftPanelComponents = this.leftPanelResourceFilter(leftPanelComponents, resourceFilterTypes); } @@ -171,40 +171,6 @@ export class Palette implements ng.IDirective { this.EventListenerService.notifyObservers(GRAPH_EVENTS.ON_PALETTE_COMPONENT_HOVER_IN, displayComponent); this.$log.debug('palette::onMouseOver:: fired'); - // - // if (this.CompositionGraphGeneralUtils.componentRequirementsAndCapabilitiesCaching.containsKey(displayComponent.uniqueId)) { - // this.$log.debug(`palette::onMouseOver:: component id ${displayComponent.uniqueId} found in cache`); - // let cacheComponent:Component = this.CompositionGraphGeneralUtils.componentRequirementsAndCapabilitiesCaching.getValue(displayComponent.uniqueId); - // - // //TODO: Danny: fire event to highlight matching nodes - // //showMatchingNodes(cacheComponent); - // return; - // } - // - // this.$log.debug(`palette::onMouseOver:: component id ${displayComponent.uniqueId} not found in cache, initiating server get`); - // // This will bring the component from the server including requirements and capabilities - // // Check that we do not fetch many times, because only in the success we add the component to componentRequirementsAndCapabilitiesCaching - // if (this.fetchingComponentFromServer) { - // return; - // } - // - // this.fetchingComponentFromServer = true; - // this.ComponentFactory.getComponentFromServer(displayComponent.componentSubType, displayComponent.uniqueId) - // .then((component:Component) => { - // this.$log.debug(`palette::onMouseOver:: component id ${displayComponent.uniqueId} fetch success`); - // // this.LeftPaletteLoaderService.updateSpecificComponentLeftPalette(component, scope.currentComponent.componentType); - // this.CompositionGraphGeneralUtils.componentRequirementsAndCapabilitiesCaching.setValue(component.uniqueId, component); - // this.fetchingComponentFromServer = false; - // - // //TODO: Danny: fire event to highlight matching nodes - // //showMatchingNodes(component); - // }) - // .catch(() => { - // this.$log.debug('palette::onMouseOver:: component id fetch error'); - // this.fetchingComponentFromServer = false; - // }); - - }; scope.onMouseOut = () => { @@ -226,8 +192,13 @@ export class Palette implements ng.IDirective { private updateLeftPanelDisplay(scope:IPaletteScope) { let entityType:string = scope.currentComponent.componentType.toLowerCase(); let resourceFilterTypes:Array<string> = this.sdcConfig.resourceTypesFilter[entityType]; - scope.components = this.LeftPaletteLoaderService.getLeftPanelComponentsForDisplay(scope.currentComponent); - scope.model = this.initLeftPanel(scope.components, resourceFilterTypes); + scope.components = this.LeftPaletteLoaderService.getLeftPanelComponentsForDisplay(scope.currentComponent); + //remove the container component from the list + let componentTempToDisplay = angular.copy(scope.components); + componentTempToDisplay = _.remove(componentTempToDisplay, function (component) { + return component.component.invariantUUID !== scope.currentComponent.invariantUUID; + }); + scope.model = this.initLeftPanel(componentTempToDisplay, resourceFilterTypes); scope.displaySortedCategories = angular.copy(scope.model.sortedCategories); }; @@ -32,7 +32,7 @@ data-ng-repeat="component in components | orderBy: 'displayName' track by $index" data-tests-id={{component.displayName}}> <div class="i-sdc-designer-leftbar-section-content-item-icon-ph"> - <div class="medium {{component.iconClass}}" + <div class="medium small {{component.iconClass}}" data-tests-id="leftbar-section-content-item-{{component.displayName}}"> <div class="{{component.certifiedIconClass}}" uib-tooltip="Not certified" tooltip-class="uib-custom-tooltip" tooltip-placement="bottom" tooltip-popup-delay="700"> @@ -1,46 +1,46 @@ -<div class="link-menu-open" data-tests-id="link-menu-open" data-ng-show="isLinkMenuOpen" ng-style="{left: relationMenuDirectiveObj.menuPosition.x, top: relationMenuDirectiveObj.menuPosition.y}" clicked-outside="{onClickedOutside: 'hideRelationMatch()', clickedOutsideEnable: 'isLinkMenuOpen'}" > +<div class="link-menu-open" data-tests-id="link-menu-open" data-ng-show="isLinkMenuOpen" ng-style="{left: connectRelationModel.menuPosition.x, top: connectRelationModel.menuPosition.y}" clicked-outside="{onClickedOutside: 'hideRelationMatch()', clickedOutsideEnable: 'isLinkMenuOpen'}" > <h4 sdc-smart-tooltip>{{relationMenuDirectiveObj.leftSideLink.componentInstance.name | resourceName}}</h4> <h4 sdc-smart-tooltip>{{relationMenuDirectiveObj.rightSideLink.componentInstance.name | resourceName}}</h4> <p>Select one of the options below to connect</p> <perfect-scrollbar scroll-y-margin-offset="0" include-padding="true" class="scrollbar-container"> - <div class="inner-title" data-ng-show="hasMatchesToShow(relationMenuDirectiveObj.leftSideLink.requirements, relationMenuDirectiveObj.rightSideLink.selectedMatch)">Requirements</div> - <div class="link-item" data-tests-id="link-item-requirements" data-ng-repeat="(req ,matchArr) in relationMenuDirectiveObj.leftSideLink.requirements" - data-ng-click="relationMenuDirectiveObj.leftSideLink.selectMatchArr(matchArr); updateSelectionText()" - data-ng-show="showMatch(relationMenuDirectiveObj.rightSideLink.selectedMatch, matchArr)" - data-ng-class="{ 'selected': relationMenuDirectiveObj.leftSideLink.selectedMatch === matchArr}"> + <div class="inner-title" data-ng-show="hasMatchesToShow(connectRelationModel.leftSideLink.requirements, connectRelationModel.rightSideLink.selectedMatch)">Requirements</div> + <div class="link-item" data-tests-id="link-item-requirements" data-ng-repeat="(req ,matchArr) in connectRelationModel.leftSideLink.requirements" + data-ng-click="connectRelationModel.leftSideLink.selectMatchArr(matchArr); updateSelectionText()" + data-ng-show="showMatch(connectRelationModel.rightSideLink.selectedMatch, matchArr)" + data-ng-class="{ 'selected': connectRelationModel.leftSideLink.selectedMatch === matchArr}"> <div sdc-smart-tooltip>{{matchArr[0].requirement.getFullTitle()}}</div> </div> - <div class="inner-title" data-ng-show="hasMatchesToShow(relationMenuDirectiveObj.leftSideLink.capabilities, relationMenuDirectiveObj.rightSideLink.selectedMatch)">Capabilities</div> - <div class="link-item" data-tests-id="link-item-capabilities" data-ng-repeat="(cap, matchArr) in relationMenuDirectiveObj.leftSideLink.capabilities" - data-ng-click="relationMenuDirectiveObj.leftSideLink.selectMatchArr(matchArr); updateSelectionText()" - data-ng-show="showMatch(relationMenuDirectiveObj.rightSideLink.selectedMatch, matchArr)" - data-ng-class="{ 'selected': relationMenuDirectiveObj.leftSideLink.selectedMatch === matchArr}"> + <div class="inner-title" data-ng-show="hasMatchesToShow(connectRelationModel.leftSideLink.capabilities, connectRelationModel.rightSideLink.selectedMatch)">Capabilities</div> + <div class="link-item" data-tests-id="link-item-capabilities" data-ng-repeat="(cap, matchArr) in connectRelationModel.leftSideLink.capabilities" + data-ng-click="connectRelationModel.leftSideLink.selectMatchArr(matchArr); updateSelectionText()" + data-ng-show="showMatch(connectRelationModel.rightSideLink.selectedMatch, matchArr)" + data-ng-class="{ 'selected': connectRelationModel.leftSideLink.selectedMatch === matchArr}"> <div sdc-smart-tooltip>{{matchArr[0].capability.getFullTitle()}}</div> </div> </perfect-scrollbar> <perfect-scrollbar scroll-y-margin-offset="0" include-padding="true" class="scrollbar-container"> - <div class="inner-title" data-ng-show="hasMatchesToShow(relationMenuDirectiveObj.rightSideLink.requirements, relationMenuDirectiveObj.leftSideLink.selectedMatch)">Requirements</div> - <div class="link-item" data-tests-id="link-item-requirements" data-ng-repeat="(req, matchArr) in relationMenuDirectiveObj.rightSideLink.requirements" - data-ng-click="relationMenuDirectiveObj.rightSideLink.selectMatchArr(matchArr); updateSelectionText()" - data-ng-show="showMatch(relationMenuDirectiveObj.leftSideLink.selectedMatch, matchArr)" - data-ng-class="{ 'selected': relationMenuDirectiveObj.rightSideLink.selectedMatch === matchArr}"> + <div class="inner-title" data-ng-show="hasMatchesToShow(connectRelationModel.rightSideLink.requirements, connectRelationModel.leftSideLink.selectedMatch)">Requirements</div> + <div class="link-item" data-tests-id="link-item-requirements" data-ng-repeat="(req, matchArr) in connectRelationModel.rightSideLink.requirements" + data-ng-click="connectRelationModel.rightSideLink.selectMatchArr(matchArr); updateSelectionText()" + data-ng-show="showMatch(connectRelationModel.leftSideLink.selectedMatch, matchArr)" + data-ng-class="{ 'selected': connectRelationModel.rightSideLink.selectedMatch === matchArr}"> <div sdc-smart-tooltip>{{matchArr[0].secondRequirement ? matchArr[0].secondRequirement.getFullTitle() : matchArr[0].requirement.getFullTitle()}}</div> </div> - <div class="inner-title" data-ng-show="hasMatchesToShow(relationMenuDirectiveObj.rightSideLink.capabilities, relationMenuDirectiveObj.leftSideLink.selectedMatch)">Capabilities</div> - <div class="link-item" data-tests-id="link-item-capabilities" data-ng-repeat="(cap, matchArr) in relationMenuDirectiveObj.rightSideLink.capabilities" - data-ng-click="relationMenuDirectiveObj.rightSideLink.selectMatchArr(matchArr); updateSelectionText()" - data-ng-show="showMatch(relationMenuDirectiveObj.leftSideLink.selectedMatch, matchArr)" - data-ng-class="{ 'selected': relationMenuDirectiveObj.rightSideLink.selectedMatch === matchArr}"> + <div class="inner-title" data-ng-show="hasMatchesToShow(connectRelationModel.rightSideLink.capabilities, connectRelationModel.leftSideLink.selectedMatch)">Capabilities</div> + <div class="link-item" data-tests-id="link-item-capabilities" data-ng-repeat="(cap, matchArr) in connectRelationModel.rightSideLink.capabilities" + data-ng-click="connectRelationModel.rightSideLink.selectMatchArr(matchArr); updateSelectionText()" + data-ng-show="showMatch(connectRelationModel.leftSideLink.selectedMatch, matchArr)" + data-ng-class="{ 'selected': connectRelationModel.rightSideLink.selectedMatch === matchArr}"> <div sdc-smart-tooltip>{{matchArr[0].capability.getFullTitle()}}</div> </div> </perfect-scrollbar> - <div class="vl-type" data-ng-class="{'disabled': !relationMenuDirectiveObj.leftSideLink.selectedMatch[0].secondRequirement || !relationMenuDirectiveObj.rightSideLink.selectedMatch[0].secondRequirement}"> + <div class="vl-type" data-ng-class="{'disabled': !connectRelationModel.leftSideLink.selectedMatch[0].secondRequirement || !connectRelationModel.rightSideLink.selectedMatch[0].secondRequirement}"> <sdc-radio-button sdc-model="relationMenuDirectiveObj.vlType" value="ptp" disabled="!relationMenuDirectiveObj.leftSideLink.selectedMatch[0].secondRequirement || !relationMenuDirectiveObj.rightSideLink.selectedMatch[0].secondRequirement || !relationMenuDirectiveObj.p2pVL" text="Point to point" elem-id="radioPTP" elem-name="vlType"></sdc-radio-button> @@ -57,7 +57,7 @@ </div> <button class="tlv-btn grey" data-tests-id="link-menu-button-cancel" data-ng-click="hideRelationMatch()">Cancel</button> - <button class="tlv-btn blue" data-tests-id="link-menu-button-connect" data-ng-disabled="!relationMenuDirectiveObj.leftSideLink.selectedMatch || !relationMenuDirectiveObj.rightSideLink.selectedMatch || - (relationMenuDirectiveObj.leftSideLink.selectedMatch[0].secondRequirement && !relationMenuDirectiveObj.vlType)" + <button class="tlv-btn blue" data-tests-id="link-menu-button-connect" data-ng-disabled="!connectRelationModel.leftSideLink.selectedMatch || !connectRelationModel.rightSideLink.selectedMatch || + (connectRelationModel.leftSideLink.selectedMatch[0].secondRequirement && !connectRelationModel.vlType)" data-ng-click="saveRelation()">Connect</button> </div> @@ -18,19 +18,19 @@ * ============LICENSE_END========================================================= */ 'use strict' -import {MatchBase, RelationMenuDirectiveObj} from "app/models"; +import {Match, ConnectRelationModel} from "app/models"; import {Component} from "../../../models/components/component"; export interface IRelationMenuScope extends ng.IScope { - relationMenuDirectiveObj:RelationMenuDirectiveObj; + relationMenuDirectiveObj:ConnectRelationModel; createRelation:Function; isLinkMenuOpen:boolean; hideRelationMatch:Function; cancel:Function; saveRelation(); - showMatch(arr1:Array<MatchBase>, arr2:Array<MatchBase>):boolean; - hasMatchesToShow(matchesObj:MatchBase, selectedMatch:Array<MatchBase>); + showMatch(arr1:Array<Match>, arr2:Array<Match>):boolean; + hasMatchesToShow(matchesObj:Match, selectedMatch:Array<Match>); updateSelectionText():void; } @@ -58,7 +58,7 @@ export class RelationMenuDirective implements ng.IDirective { scope.saveRelation = ():void=> { let chosenMatches:Array<any> = _.intersection(scope.relationMenuDirectiveObj.rightSideLink.selectedMatch, scope.relationMenuDirectiveObj.leftSideLink.selectedMatch); - let chosenMatch:MatchBase = chosenMatches[0]; + let chosenMatch:Match = chosenMatches[0]; scope.createRelation()(chosenMatch); }; @@ -69,14 +69,14 @@ export class RelationMenuDirective implements ng.IDirective { }; //to show options in link menu - scope.showMatch = (arr1:Array<MatchBase>, arr2:Array<MatchBase>):boolean => { + scope.showMatch = (arr1:Array<Match>, arr2:Array<Match>):boolean => { return !arr1 || !arr2 || _.intersection(arr1, arr2).length > 0; }; //to show requirements/capabilities title - scope.hasMatchesToShow = (matchesObj:MatchBase, selectedMatch:Array<MatchBase>):boolean => { + scope.hasMatchesToShow = (matchesObj:Match, selectedMatch:Array<Match>):boolean => { let result:boolean = false; - _.forEach(matchesObj, (matchesArr:Array<MatchBase>) => { + _.forEach(matchesObj, (matchesArr:Array<Match>) => { if (!result) { result = scope.showMatch(matchesArr, selectedMatch); } @@ -1,54 +0,0 @@ -<nav class="top-nav"> - - <div class="asdc-app-title-wrapper"> - <a class="asdc-app-title" translate="PROJECT_TITLE"></a> - <div class="asdc-version"> v.{{version}}</div> - </div> - - <ul class="top-menu" data-ng-show="!menuModel"> - <!-- no hierarchy & dropdowns mode --> - <li data-ng-repeat="item in topLvlMenu.menuItems" - data-ng-class="{'selected': $index == topLvlMenu.selectedIndex}"> - <a data-ng-click="menuItemClick(topLvlMenu, item)" - data-tests-id="main-menu-button-{{item.text | lowercase}}">{{item.text}}</a> - </li> - </ul> - - <ul class="top-menu" data-ng-show="menuModel"> - <!-- with hierarchy & dropdowns mode --> - <li data-ng-repeat-start="groupItem in menuModel" - data-ng-class="{'selected': $last }"> - <a data-ng-click="menuItemClick(groupItem, groupItem.menuItems[groupItem.selectedIndex])" - data-tests-id="breadcrumbs-button-{{$index}}"> - {{groupItem.menuItems[groupItem.selectedIndex].text}} - </a> - </li> - <li data-ng-repeat-end="" class="triangle-dropdown" - data-ng-class="{'item-click': groupItem.itemClick}" data-ng-mouseover="groupItem.itemClick = true"> - <div class="triangle"><span class="sprite-new arrow-right"></span></div> - <perfect-scrollbar scroll-y-margin-offset="15" include-padding="true"> - <ul> - <li data-ng-repeat="ddItem in groupItem.menuItems" - data-ng-click="menuItemClick(groupItem, ddItem)" - data-ng-class="{'selected': $index == groupItem.selectedIndex, 'disabled': ddItem.isDisabled}" - data-tests-id="sub-menu-button-{{ddItem.text | lowercase}}"> - <span sdc-smart-tooltip="">{{ddItem.text}}</span> - </li> - </ul> - </perfect-scrollbar> - </li> - </ul> - - <div class="top-search" data-ng-hide="hideSearch === true"> - <input type="text" - class="search-text" - placeholder="Search" - data-ng-model="searchBind" - data-tests-id="main-menu-input-search" - ng-model-options="{ debounce: 500 }" /> - <span class="w-sdc-search-icon magnification"></span> - </div> - - <div class="notification-icon" data-ng-disabled= "progress > 0" data-ng-class="{'disabled' : progress > 0}" data-ng-if="user.role === 'DESIGNER' && notificationIconCallback" data-ng-click="notificationIconCallback()" tooltips tooltip-side="left" tooltip-content="Vendor Software Product Repository" data-tests-id="repository-icon"></div> - -</nav> @@ -1,218 +0,0 @@ -.top-nav { - position: fixed; - top: @header_height; - background-color: @main_color_p; - .box-shadow(0px 1px 3px 0px rgba(0, 0, 0, 0.33)); - width: 100%; - height: @top_nav_height; - line-height: @top_nav_height; - z-index: 10; - display: flex; - flex-direction: row; - align-items: center; - - .asdc-app-title-wrapper { - flex-grow: 1; - line-height: 16px; - margin: 0 20px; - - a.asdc-app-title { - .m_18_r; - text-decoration: none; - } - - .asdc-version { - .m_12_r; - .opacity(0.8); - line-height: 14px; - flex-grow: 1; - } - - } - - ul.top-menu { - list-style-type: none; - margin: 0 0 0 20px; - padding: 0; - flex-grow: 999; - - & > li { - float: left; - cursor: pointer; - line-height: 50px; - height: 50px; - padding: 0 20px; - - &.selected { - border-bottom: solid 4px @main_color_a; - - a { - color: @func_color_s; - } - } - - /*&:hover { - border-bottom: solid 4px @main_color_a; - }*/ - - a { - font-family: @font-opensans-medium; - color: @main_color_m; - font-size: 16px; - display: block; - text-align: center; - text-decoration: none; - } - - &.triangle-dropdown { - padding: 0; - position: relative; - - div.triangle { - margin-top: 15px; - border-radius: 2px; - width: 17px; - height: 18px; - - //temp use - until new triangle gets in - line-height: 18px; - text-align: center; - font-size: 10px; - - &:hover { - background-color: rgba(156, 156, 156, 0.2); - - span { - .arrow-right-hover; - } - } - } - - + li a { - font-size: 16px; - } - - .ps-container { - .perfect-scrollbar; - position: absolute; - left: 0; - top: 40px; - z-index: 1; - - overflow: hidden; - max-height: 0; - -webkit-transition: max-height 200ms ease-in; - -moz-transition: max-height 200ms ease-in; - -o-transition: max-height 200ms ease-in; - transition: max-height 200ms ease-in; - - div ul { - - padding: 0; - background-color: white; - - li { - - height: 35px; - background-color: white; - font-size: 13px; - width: 150px; - line-height: 35px; - padding: 0 10px; - - &.disabled { - opacity: 1; - } - &.selected { - background-color: @tlv_color_v; - font-weight: bold; - } - &:hover { - color: @main_color_a; - } - span { - height: 35px; - width: 130px; - display: inline-block; - } - } - } - } - &.item-click:hover .ps-container, - &.item-click:active .ps-container { - max-height: 500px; - border: 1px solid @func_color_b; - border-radius: 2px; - box-shadow: 0px 2px 2px 0px rgba(24, 24, 25, 0.1); - - div ul { - - } - } - } - } - - } - - .top-search { - position: relative; - flex-grow: 1; - padding: 0 20px; - - input.search-text { - .border-radius(2px); - width: 245px; - height: 32px; - line-height: 32px; - border: 1px solid @main_color_o; - outline: none; - text-indent: 10px; - - &::-webkit-input-placeholder { font-style: italic; } /* Safari, Chrome and Opera */ - &:-moz-placeholder { font-style: italic; } /* Firefox 18- */ - &::-moz-placeholder { font-style: italic; } /* Firefox 19+ */ - &:-ms-input-placeholder { font-style: italic; } /* IE 10+ */ - &:-ms-input-placeholder { font-style: italic; } /* Edge */ - /* font-style: italic; - }*/ - /* Firefox 18- */ - &::-moz-placeholder { - font-style: italic; - } - /* Firefox 19+ */ - &:-ms-input-placeholder { - font-style: italic; - } - /* IE 10+ */ - &:-ms-input-placeholder { - font-style: italic; - } - /* Edge */ - } - - .magnification { - position: absolute; - top: 19px; - right: 26px; - } - - } - - .notification-icon { - cursor: pointer; - flex-grow: 1; - margin: 0 10px 6px 0; - .sprite-new; - .vsp-list-icon; - - &:hover { - .vsp-list-icon-hover; - } - - &:active { - .vsp-list-icon-active; - } - - } - -} @@ -1,161 +0,0 @@ -/*- - * ============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========================================================= - */ - -'use strict'; -import {IAppConfigurtaion, IHostedApplication, IUserProperties} from "app/models"; -import {IUserResourceClass} from "app/services"; -import {MenuItemGroup, MenuItem} from "app/utils"; - -export interface ITopNavScope extends ng.IScope { - topLvlSelectedIndex:number; - hideSearch:boolean; - searchBind:any; - menuModel:Array<MenuItemGroup>; - - topLvlMenu:MenuItemGroup; - goToState(state:string, params:Array<any>):ng.IPromise<boolean>; - menuItemClick:Function; - user:IUserProperties; - version:string; -} - - -export class TopNavDirective implements ng.IDirective { - - constructor(private $filter:ng.IFilterService, - private $state:ng.ui.IStateService, - private $q:ng.IQService, - private userResourceService:IUserResourceClass, - private sdcConfig:IAppConfigurtaion) { - } - - public replace = true; - public restrict = 'E'; - public transclude = false; - - - scope = { - topLvlSelectedIndex: '@?', - hideSearch: '=', - searchBind: '=', - version: '@', - notificationIconCallback: '=', - menuModel: '=?', - }; - - template = ():string => { - return require('./top-nav.html'); - }; - - public link = (scope:ITopNavScope, $elem:ng.IAugmentedJQuery, $attrs:angular.IAttributes) => { - - let getTopLvlSelectedIndexByState = ():number => { - if (!scope.topLvlMenu.menuItems) { - return 0; - } - - let result = -1; - - //set result to current state - scope.topLvlMenu.menuItems.forEach((item:MenuItem, index:number)=> { - if (item.state === this.$state.current.name) { - result = index; - } - }); - - //if it's a different state , checking previous state param - if (result === -1) { - scope.topLvlMenu.menuItems.forEach((item:MenuItem, index:number)=> { - if (item.state === this.$state.params['previousState']) { - result = index; - } - }); - } - - if (result === -1) { - result = 0; - } - - return result; - }; - - scope.user = this.userResourceService.getLoggedinUser(); - - let tmpArray:Array<MenuItem> = [ - new MenuItem(this.$filter('translate')("TOP_MENU_HOME_BUTTON"), null, "dashboard", "goToState", null, null), - new MenuItem(this.$filter('translate')("TOP_MENU_CATALOG_BUTTON"), null, "catalog", "goToState", null, null) - ]; - - // Only designer can perform onboarding - if (scope.user && scope.user.role === 'DESIGNER') { - tmpArray.push(new MenuItem(this.$filter('translate')("TOP_MENU_ON_BOARD_BUTTON"), null, "onboardVendor", "goToState", null, null)); - _.each(this.sdcConfig.hostedApplications, (hostedApp:IHostedApplication)=> { - if (hostedApp.exists) { - tmpArray.push(new MenuItem(hostedApp.navTitle, null, hostedApp.defaultState, "goToState", null, null)); - } - }); - } - - scope.topLvlMenu = new MenuItemGroup(0, tmpArray, true); - scope.topLvlMenu.selectedIndex = isNaN(scope.topLvlSelectedIndex) ? getTopLvlSelectedIndexByState() : scope.topLvlSelectedIndex; - - let generateMenu = () => { - if (scope.menuModel && scope.menuModel[0] !== scope.topLvlMenu) { - scope.menuModel.unshift(scope.topLvlMenu); - } - }; - scope.$watch('menuModel', generateMenu); - - generateMenu(); - - /////scope functions//// - - scope.goToState = (state:string, params:Array<any>):ng.IPromise<boolean> => { - let deferred = this.$q.defer(); - this.$state.go(state, params && params.length > 0 ? [0] : undefined); - deferred.resolve(true); - return deferred.promise; - }; - - scope.menuItemClick = (itemGroup:MenuItemGroup, item:MenuItem) => { - - itemGroup.itemClick = false; - - let onSuccess = ():void => { - itemGroup.selectedIndex = itemGroup.menuItems.indexOf(item); - }; - let onFailed = ():void => { - }; - - if (item.callback) { - (item.callback.apply(undefined, item.params)).then(onSuccess, onFailed); - } else { - scope[item.action](item.state, item.params).then(onSuccess, onFailed); - } - }; - }; - - public static factory = ($filter:ng.IFilterService, $state:ng.ui.IStateService, $q:ng.IQService, userResourceService:IUserResourceClass, sdcConfig:IAppConfigurtaion)=> { - return new TopNavDirective($filter, $state, $q, userResourceService, sdcConfig); - }; - -} - -TopNavDirective.factory.$inject = ['$filter', '$state', '$q', 'Sdc.Services.UserResourceService', 'sdcConfig']; @@ -56,19 +56,14 @@ export class LoaderDirective implements ng.IDirective { let interval; - this.EventListenerService.registerObserverCallback(EVENTS.SHOW_LOADER_EVENT, (loaderType)=> { - if (scope.loaderType !== loaderType) { - return; - } - scope.display = true; - }); - this.EventListenerService.registerObserverCallback(EVENTS.HIDE_LOADER_EVENT, (loaderType)=> { - if (scope.loaderType !== loaderType) { - return; - } - scope.display = false; - }); - + if(scope.loaderType) { + this.EventListenerService.registerObserverCallback(EVENTS.SHOW_LOADER_EVENT + scope.loaderType, (loaderType)=> { + scope.display = true; + }); + this.EventListenerService.registerObserverCallback(EVENTS.HIDE_LOADER_EVENT + scope.loaderType, (loaderType)=> { + scope.display = false; + }); + } let calculateSizesForFixPosition = (positionStyle:string):void => { // This is problematic, I do not want to change the parent position. // set the loader on all the screen @@ -8,7 +8,7 @@ <div tooltips tooltip-content="{{property.name}}"> <input class="i-sdc-form-input" type="text" - data-ng-disabled="true" + readonly="readonly" value="{{property.name}}"/> </div> </div> @@ -48,7 +48,7 @@ data-tests-id="{{fieldsPrefixName+property.name}}" ng-if="!((property.simpleType||property.type) == 'boolean')" data-ng-maxlength="100" - data-ng-disabled="readOnly" + data-ng-readonly="readOnly" maxlength="{{(property.simpleType||property.type) == 'integer'? 10 : 100}}" data-ng-model="valueObjRef[property.name]" type="text" @@ -29,6 +29,10 @@ .i-sdc-form-input:disabled{ .disabled; } + .i-sdc-form-input:read-only{ + opacity: 0.4; + cursor: auto; + } .property{ display: flex; @@ -12,7 +12,7 @@ data-ng-pattern="MapKeyValidationPattern" data-ng-model-options="{ debounce: 200 }" data-ng-change="changeKeyOfMap(mapKeys[$index], $index,'mapKey'+fieldsPrefixName+$index);$event.stopPropagation();" - data-ng-disabled="readOnly" + data-ng-readonly="readOnly" data-required autofocus/> <div class="input-error" data-ng-show="parentFormObj['mapKey'+fieldsPrefixName+$index].$dirty && parentFormObj['mapKey'+fieldsPrefixName+$index].$invalid"> @@ -26,7 +26,7 @@ <label class="i-sdc-form-label required">Value</label> <input class="i-sdc-form-input" ng-if="!((schemaProperty.simpleType||schemaProperty.type) == 'boolean')" - data-ng-disabled="readOnly" + data-ng-readonly="readOnly" data-ng-model="valueObjRef[mapKeys[$index]]" type="text" name="mapValue{{fieldsPrefixName}}{{$index}}" @@ -79,5 +79,10 @@ &>.data-type-fields-structure{ padding: 0; } + + .i-sdc-form-input:read-only{ + opacity: 0.4; + cursor: auto; + } } } @@ -45,9 +45,13 @@ margin-left: 22px; } - .i-sdc-form-input:disabled{ - .disabled; - &[type="text"]{ + .i-sdc-form-input{ + &:disabled{ + .disabled; + } + } + .property-name{ + .i-sdc-form-input:read-only{ opacity: 1 !important; background-color: @tlv_color_t; color:black; @@ -19,21 +19,17 @@ */ 'use strict'; -import {User, IUser, IAppConfigurtaion} from "app/models"; -import {IUserResourceClass, IUserResource} from "app/services"; +import {User, IUser, IAppConfigurtaion, IUserProperties} from "app/models"; +import { UserService } from "../../ng2/services/user.service"; export interface IUserHeaderDetailsScope extends ng.IScope { - name:string; - role:string; iconUrl:string; - UserResourceClass:IUserResourceClass; user:IUser; - sdcConfig:IAppConfigurtaion; initUser:Function; } export class UserHeaderDetailsDirective implements ng.IDirective { - constructor(private $http:ng.IHttpService, private sdcConfig:IAppConfigurtaion, private UserResourceClass:IUserResourceClass) { + constructor(private $http:ng.IHttpService, private sdcConfig:IAppConfigurtaion, private userService:UserService) { } scope = { @@ -50,23 +46,23 @@ export class UserHeaderDetailsDirective implements ng.IDirective { scope.initUser = ():void => { let defaultUserId:string; - let user:IUserResource = this.UserResourceClass.getLoggedinUser(); - if (!user) { + let userInfo:IUserProperties = this.userService.getLoggedinUser(); + if (!userInfo) { defaultUserId = this.$http.defaults.headers.common[this.sdcConfig.cookie.userIdSuffix]; - user = this.UserResourceClass.get({id: defaultUserId}, ():void => { - scope.user = new User(user); + this.userService.getUser(defaultUserId).subscribe((defaultUserInfo):void => { + scope.user = new User(defaultUserInfo); }); } else { - scope.user = new User(user); + scope.user = new User(userInfo); } }; scope.initUser(); }; - public static factory = ($http:ng.IHttpService, sdcConfig:IAppConfigurtaion, UserResourceClass:IUserResourceClass)=> { - return new UserHeaderDetailsDirective($http, sdcConfig, UserResourceClass); + public static factory = ($http:ng.IHttpService, sdcConfig:IAppConfigurtaion, userService:UserService)=> { + return new UserHeaderDetailsDirective($http, sdcConfig, userService); }; } -UserHeaderDetailsDirective.factory.$inject = ['$http', 'sdcConfig', 'Sdc.Services.UserResourceService']; +UserHeaderDetailsDirective.factory.$inject = ['$http', 'sdcConfig', 'UserServiceNg2']; @@ -40,6 +40,7 @@ export * from './models/components/service'; export * from './models/componentsInstances/componentInstance'; export * from './models/componentsInstances/resourceInstance'; export * from './models/componentsInstances/serviceInstance'; +export * from './models/componentsInstances/serviceProxyInstance'; export * from './models/csar-component'; //export * from './models/data-type-properties'; export * from './models/properties-inputs/property-be-model'; @@ -74,7 +75,9 @@ export * from './models/graph/nodes/base-common-node'; export * from './models/graph/nodes/common-ci-node-base'; export * from './models/graph/nodes/composition-graph-nodes/composition-ci-node-base'; export * from './models/graph/nodes/composition-graph-nodes/composition-ci-node-cp'; +export * from './models/graph/nodes/composition-graph-nodes/composition-ci-node-configuration'; export * from './models/graph/nodes/composition-graph-nodes/composition-ci-node-service'; +export * from './models/graph/nodes/composition-graph-nodes/composition-ci-node-service-proxy'; export * from './models/graph/nodes/composition-graph-nodes/composition-ci-node-ucpe-cp'; export * from './models/graph/nodes/composition-graph-nodes/composition-ci-node-ucpe'; export * from './models/graph/nodes/composition-graph-nodes/composition-ci-node-vf'; @@ -83,7 +86,7 @@ export * from './models/graph/nodes/composition-graph-nodes/composition-ci-node- export * from './models/graph/nodes/modules-graph-nodes/module-node-base'; export * from './models/graph/nodes/nodes-factory'; export * from './models/graph/point'; -export * from './models/graph/relationMenuObjects'; +export * from './models/graph/connectRelationModel'; export * from './models/graph/relationship'; export * from './models/heat-parameters'; export * from './models/input-property-base'; @@ -103,6 +106,8 @@ export * from './models/validate'; export * from './models/component-metadata'; export * from './models/modal'; export * from './models/button'; +export * from './models/wizard-step'; +export * from './models/radio-button'; export * from './models/filter-properties-assignment-data' export * from './models/properties-inputs/input-be-model' @@ -23,7 +23,9 @@ */ 'use strict'; import {PropertyModel} from "./properties"; +import {Requirement} from "./requirement"; +export interface RequirementCapabilityModel{}; //this is an object contains keys, when each key has matching array. // for example: key = tosca.capabilities.network.Linkable and the match array is array of capabilities objects export class CapabilitiesGroup { @@ -44,7 +46,7 @@ export class CapabilitiesGroup { } } -export class Capability { +export class Capability implements RequirementCapabilityModel{ //server data name:string; @@ -53,11 +55,12 @@ export class Capability { type:string; uniqueId:string; capabilitySources:Array<String>; + leftOccurrences:string; minOccurrences:string; maxOccurrences:string; - properties:Array<PropertyModel>; description:string; validSourceTypes:Array<string>; + properties:Array<PropertyModel>; //custom selected:boolean; filterTerm:string; @@ -72,6 +75,7 @@ export class Capability { this.type = capability.type; this.uniqueId = capability.uniqueId; this.capabilitySources = capability.capabilitySources; + this.leftOccurrences = capability.leftOccurrences; this.minOccurrences = capability.minOccurrences; this.maxOccurrences = capability.maxOccurrences; this.properties = capability.properties; @@ -83,9 +87,13 @@ export class Capability { } } + public getTitle():string { + return this.ownerName + ': ' + this.name; + } + public getFullTitle():string { let maxOccurrences:string = this.maxOccurrences === 'UNBOUNDED' ? '∞' : this.maxOccurrences; - return this.ownerName + ': ' + this.name + ': [' + this.minOccurrences + ', ' + maxOccurrences + ']'; + return this.getTitle() + ': [' + this.minOccurrences + ', ' + maxOccurrences + ']'; } public toJSON = ():any => { @@ -110,6 +118,10 @@ export class Capability { }); } } + + public isFulfilled() { + return parseInt(this.leftOccurrences) === 0; + } } @@ -29,6 +29,8 @@ import {CommonUtils} from "../../utils/common-utils"; import {QueueUtils} from "../../utils/functions"; import {ArtifactGroupType} from "../../utils/constants"; import {ComponentMetadata} from "../component-metadata"; +import {Capability} from "../capability"; +import {Requirement} from "../requirement"; // import {} export interface IComponent { @@ -82,6 +84,7 @@ export interface IComponent { createRelation(link:RelationshipModel):ng.IPromise<RelationshipModel>; deleteRelation(link:RelationshipModel):ng.IPromise<RelationshipModel>; + fetchRelation(linkId:string):ng.IPromise<RelationshipModel>; //Modules @@ -356,7 +359,6 @@ export abstract class Component implements IComponent { // find exist instance property in parent component for update the new value ( find bu uniqueId ) let existProperty:PropertyModel = <PropertyModel>_.find(this.properties, {uniqueId: newProperty.uniqueId}); let propertyIndex = this.properties.indexOf(existProperty); - newProperty.readonly = this.uniqueId != newProperty.parentUniqueId; this.properties[propertyIndex] = newProperty; deferred.resolve(newProperty); }; @@ -607,6 +609,58 @@ export abstract class Component implements IComponent { }; + public syncComponentByRelation(relation:RelationshipModel) { + relation.relationships.forEach((rel) => { + if (rel.capability) { + const toComponentInstance:ComponentInstance = this.componentInstances.find((inst) => inst.uniqueId === relation.toNode); + const toComponentInstanceCapability:Capability = toComponentInstance.findCapability( + rel.capability.type, rel.capability.uniqueId, rel.capability.ownerId, rel.capability.name); + const isCapabilityFulfilled:boolean = rel.capability.isFulfilled(); + if (isCapabilityFulfilled && toComponentInstanceCapability) { + // if capability is fulfilled and in component, then remove it + console.log('Capability is fulfilled', rel.capability.getFullTitle(), rel.capability.leftOccurrences); + toComponentInstance.capabilities[rel.capability.type].splice( + toComponentInstance.capabilities[rel.capability.type].findIndex((cap) => cap === toComponentInstanceCapability), 1 + ) + } else if (!isCapabilityFulfilled && !toComponentInstanceCapability) { + // if capability is unfulfilled and not in component, then add it + console.log('Capability is unfulfilled', rel.capability.getFullTitle(), rel.capability.leftOccurrences); + toComponentInstance.capabilities[rel.capability.type].push(rel.capability); + } + } + if (rel.requirement) { + const fromComponentInstance:ComponentInstance = this.componentInstances.find((inst) => inst.uniqueId === relation.fromNode); + const fromComponentInstanceRequirement:Requirement = fromComponentInstance.findRequirement( + rel.requirement.capability, rel.requirement.uniqueId, rel.requirement.ownerId, rel.requirement.name); + const isRequirementFulfilled:boolean = rel.requirement.isFulfilled(); + if (isRequirementFulfilled && fromComponentInstanceRequirement) { + // if requirement is fulfilled and in component, then remove it + console.log('Requirement is fulfilled', rel.requirement.getFullTitle(), rel.requirement.leftOccurrences); + fromComponentInstance.requirements[rel.requirement.capability].splice( + fromComponentInstance.requirements[rel.requirement.capability].findIndex((req) => req === fromComponentInstanceRequirement), 1 + ) + } else if (!isRequirementFulfilled && !fromComponentInstanceRequirement) { + // if requirement is unfulfilled and not in component, then add it + console.log('Requirement is unfulfilled', rel.requirement.getFullTitle(), rel.requirement.leftOccurrences); + fromComponentInstance.requirements[rel.requirement.capability].push(rel.requirement); + } + } + }); + } + + public fetchRelation = (linkId:string):ng.IPromise<RelationshipModel> => { + let deferred = this.$q.defer<RelationshipModel>(); + let onSuccess = (relation:RelationshipModel):void => { + this.syncComponentByRelation(relation); + deferred.resolve(relation); + }; + let onFailed = (error:any):void => { + deferred.reject(error); + }; + this.componentService.fetchRelation(this.uniqueId, linkId).then(onSuccess, onFailed); + return deferred.promise; + }; + public createRelation = (relation:RelationshipModel):ng.IPromise<RelationshipModel> => { let deferred = this.$q.defer(); let onSuccess = (relation:RelationshipModel):void => { @@ -615,6 +669,7 @@ export abstract class Component implements IComponent { this.componentInstancesRelations = []; } this.componentInstancesRelations.push(new RelationshipModel(relation)); + this.syncComponentByRelation(relation); deferred.resolve(relation); }; let onFailed = (error:any):void => { @@ -627,11 +682,11 @@ export abstract class Component implements IComponent { public deleteRelation = (relation:RelationshipModel):ng.IPromise<RelationshipModel> => { let deferred = this.$q.defer(); - let onSuccess = (responseRelation:RelationshipModel):void => { + let onSuccess = (relation:RelationshipModel):void => { console.log("Link Deleted In Server"); let relationToDelete = _.find(this.componentInstancesRelations, (item) => { return item.fromNode === relation.fromNode && item.toNode === relation.toNode && _.some(item.relationships, (relationship)=> { - return angular.equals(relation.relationships[0], relationship); + return angular.equals(relation.relationships[0].relation, relationship.relation); }); }); let index = this.componentInstancesRelations.indexOf(relationToDelete); @@ -640,11 +695,14 @@ export abstract class Component implements IComponent { this.componentInstancesRelations.splice(index, 1); } else { this.componentInstancesRelations[index].relationships = - _.reject(this.componentInstancesRelations[index].relationships, relation.relationships[0]); + _.reject(this.componentInstancesRelations[index].relationships, (relationship) => { + return angular.equals(relation.relationships[0].relation, relationship.relation); + }); } } else { console.error("Error while deleting relation - the return delete relation from server was not found in UI") } + this.syncComponentByRelation(relation); deferred.resolve(relation); }; let onFailed = (error:any):void => { @@ -658,8 +716,8 @@ export abstract class Component implements IComponent { public updateRequirementsCapabilities = ():ng.IPromise<any> => { let deferred = this.$q.defer(); let onSuccess = (response:any):void => { - this.capabilities = response.capabilities; - this.requirements = response.requirements; + this.capabilities = new CapabilitiesGroup(response.capabilities); + this.requirements = new RequirementsGroup(response.requirements); deferred.resolve(response); }; let onFailed = (error:any):void => { @@ -23,7 +23,9 @@ */ 'use strict'; import {ArtifactGroupModel, CapabilitiesGroup,RequirementsGroup, PropertyModel, InputModel, Module} from "../../models"; -import {ResourceType} from "../../utils/constants"; +import {ResourceType,ComponentType} from "../../utils/constants"; +import {Capability} from "../capability"; +import {Requirement} from "../requirement"; export class ComponentInstance { @@ -46,6 +48,10 @@ export class ComponentInstance { public capabilities:CapabilitiesGroup; public requirements:RequirementsGroup; public customizationUUID:string; + public sourceModelInvariant:string; + public sourceModelName:string; + public sourceModelUid:string; + public sourceModelUuid:string; //custom properties public certified:boolean; public iconSprite:string; @@ -79,6 +85,10 @@ export class ComponentInstance { this.updatePosition(componentInstance.posX, componentInstance.posY); this.groupInstances = componentInstance.groupInstances; this.invariantName = componentInstance.invariantName; + this.sourceModelInvariant = componentInstance.sourceModelInvariant; + this.sourceModelName = componentInstance.sourceModelName; + this.sourceModelUid = componentInstance.sourceModelUid; + this.sourceModelUuid = componentInstance.sourceModelUuid; } } @@ -97,6 +107,10 @@ export class ComponentInstance { return this.originType === ResourceType.VF || this.originType === ResourceType.PNF || this.originType === ResourceType.CVFC ; } + public isServiceProxy = () :boolean => { + return this.originType === ComponentType.SERVICE_PROXY; + } + public setInstanceRC = ():void=> { _.forEach(this.requirements, (requirementValue:Array<any>, requirementKey)=> { _.forEach(requirementValue, (requirement)=> { @@ -121,6 +135,30 @@ export class ComponentInstance { this.posY = posY; } + public findRequirement(reqType:string, uniqueId:string, ownerId:string, name:string):Requirement|undefined { + let requirement:Requirement = undefined; + const searchGroup = (reqType) ? [this.requirements[reqType]] : this.requirements; + _.some(_.keys(searchGroup), (searchType) => { + requirement = _.find<Requirement>(searchGroup[searchType], (req:Requirement) => ( + req.uniqueId === uniqueId && req.ownerId === ownerId && req.name === name + )); + return requirement; + }); + return requirement; + } + + public findCapability(capType:string, uniqueId:string, ownerId:string, name:string):Capability|undefined { + let capability:Capability = undefined; + const searchGroup = (capType) ? [this.capabilities[capType]] : this.capabilities; + _.some(_.keys(searchGroup), (searchType) => { + capability = _.find<Capability>(searchGroup[searchType], (cap:Capability) => ( + cap.uniqueId === uniqueId && cap.ownerId === ownerId && cap.name === name + )); + return capability; + }); + return capability; + } + public toJSON = ():any => { let temp = angular.copy(this); temp.certified = undefined; @@ -18,36 +18,18 @@ * ============LICENSE_END========================================================= */ +/** + * Created by obarda on 2/4/2016. + */ 'use strict'; -import {IAppConfigurtaion} from "app/models"; - -export interface IEcompFooterDirectiveScope extends ng.IScope { - -} - -export class EcompFooterDirective implements ng.IDirective { +import {ComponentInstance} from "./componentInstance"; - constructor(private sdcConfig:IAppConfigurtaion) { +export class ServiceProxyInstance extends ComponentInstance { + constructor(componentInstance?:ServiceProxyInstance) { + super(componentInstance); + this.iconSprite = "sprite-proxy-services-icons"; + //this.originType = "ServiceProxy"; } - - public replace = true; - public restrict = 'E'; - - public scope = {}; - - template = ():string => { - return require('./ecomp-footer.html'); - }; - - link = (scope:IEcompFooterDirectiveScope, $elem:JQuery, attr:any) => { - - }; - - public static factory = (sdcConfig:IAppConfigurtaion)=> { - return new EcompFooterDirective(sdcConfig); - }; - } -EcompFooterDirective.factory.$inject = ['sdcConfig']; @@ -18,12 +18,11 @@ * ============LICENSE_END========================================================= */ 'use strict'; -import {MatchReqToReq, MatchBase} from "./match-relation"; +import {Match} from "./match-relation"; import {CompositionCiNodeBase} from "./nodes/composition-graph-nodes/composition-ci-node-base"; -import {Component} from "../components/component"; import {ComponentInstance} from "../componentsInstances/componentInstance"; -export class RelationMenuDirectiveObj { +export class ConnectRelationModel { fromNode:CompositionCiNodeBase; toNode:CompositionCiNodeBase; @@ -31,17 +30,16 @@ export class RelationMenuDirectiveObj { rightSideLink:GraphLinkMenuSide; leftSideLink:GraphLinkMenuSide; selectionText:string; - vlType:string; + possibleRelations:Array<Match>; - constructor(fromNode:CompositionCiNodeBase, toNode:CompositionCiNodeBase, menuPosition:Cy.Position, possibleRelations:Array<MatchBase>) { + constructor(fromNode:CompositionCiNodeBase, toNode:CompositionCiNodeBase, possibleRelations:Array<Match>) { this.fromNode = fromNode; this.toNode = toNode; - // this.modelLinks = modelLinks; - this.menuPosition = menuPosition; + this.leftSideLink = new GraphLinkMenuSide(this.fromNode.componentInstance); this.rightSideLink = new GraphLinkMenuSide(this.toNode.componentInstance); this.selectionText = ''; - this.vlType = null; + this.possibleRelations = possibleRelations; possibleRelations.forEach((match:any) => { @@ -57,20 +55,13 @@ export class RelationMenuDirectiveObj { //push the match to fromNode object (from node is always the requirement) this.leftSideLink.requirements[reqObjKey].push(match); - if (match instanceof MatchReqToReq) { - //init the right side requirements Array - if (!this.rightSideLink.requirements[capObjKey]) { - this.rightSideLink.requirements[capObjKey] = []; - } - this.rightSideLink.requirements[capObjKey].push(match); - } else { - //init the right side capabilities Array - if (!this.rightSideLink.capabilities[capObjKey]) { - this.rightSideLink.capabilities[capObjKey] = []; - } - //add to array - this.rightSideLink.capabilities[capObjKey].push(match); + //init the right side capabilities Array + if (!this.rightSideLink.capabilities[capObjKey]) { + this.rightSideLink.capabilities[capObjKey] = []; } + //add to array + this.rightSideLink.capabilities[capObjKey].push(match); + } else { if (!this.rightSideLink.requirements[reqObjKey]) { @@ -100,7 +91,7 @@ export class GraphLinkMenuSide { this.requirements = {}; } - public selectMatchArr(matchArr:Array<MatchBase>):void { + public selectMatchArr(matchArr:Array<Match>):void { if (this.selectedMatch === matchArr) { this.selectedMatch = undefined; } else { @@ -29,7 +29,7 @@ export class CompositionCiUcpeLink extends CompositionCiLinkBase { super(relation, singleRelation); this.isFromUcpe = from; this.target = relation.toNode; - this.source = singleRelation.requirementOwnerId; + this.source = singleRelation.relation.requirementOwnerId; this.relation.relationships = [singleRelation]; this.color = GraphColors.BASE_LINK; } @@ -46,7 +46,7 @@ export class LinksFactory { // newRelation = new CompositionCiUcpeLink(relation, fromNode.isUcpePart, singleRelation); // } // } else - if (singleRelation.relationship.type && _.includes(singleRelation.relationship.type.toLowerCase(), 'link')) { + if (singleRelation.relation.relationship.type && _.includes(singleRelation.relation.relationship.type.toLowerCase(), 'link')) { newRelation = new CompositionCiVLink(relation, singleRelation); } else { newRelation = new CompositionCiSimpleLink(relation, singleRelation); @@ -68,7 +68,7 @@ export class LinksFactory { let newRelation:ModuleCiLinkBase; - if (_.includes(singleRelation.relationship.type.toLowerCase(), 'link')) { + if (_.includes(singleRelation.relation.relationship.type.toLowerCase(), 'link')) { newRelation = new ModuleCiVlLink(relation, singleRelation); } else { newRelation = new ModuleCiLinkBase(relation, singleRelation); @@ -20,80 +20,49 @@ 'use strict'; import {Requirement} from "../requirement"; import {Capability} from "../capability"; -import {Relationship, RelationshipModel, RelationType} from "./relationship"; +import {Relationship, RelationshipModel} from "./relationship"; +import {PropertyModel} from "../properties"; -export class MatchBase { +export class Match { requirement:Requirement; + capability:Capability; isFromTo:boolean; fromNode:string; toNode:string; + capabilityProperties:Array<PropertyModel>; // use this to store the capability properties, since there are times the capability itself is not available (when fulfilled). + private _relationship:Relationship; - constructor(requirement:Requirement, isFromTo:boolean, fromNode:string, toNode:string) { + constructor(requirement:Requirement, capability:Capability, isFromTo:boolean, fromNode:string, toNode:string) { this.requirement = requirement; + this.capability = capability; this.isFromTo = isFromTo; this.fromNode = fromNode; this.toNode = toNode; } - public getDisplayText = (menuSide:string):string => { - return ''; - }; - - public isOwner = (id:string):boolean => { - return false; - } - -} - -export class MatchReqToReq extends MatchBase { - - secondRequirement:Requirement; - - constructor(requirement:Requirement, secondRequirement:Requirement, isFromTo:boolean, fromNode:string, toNode:string) { - super(requirement, isFromTo, fromNode, toNode); - this.secondRequirement = secondRequirement; - } - - public getDisplayText = (menuSide:string):string => { - if ('left' == menuSide) { - return this.requirement.getFullTitle(); + // NOTE: Hold the relationship instance for cases capability / requirement are not available (when fulfilled). + // In case relationship instance is not manually saved to here, then build the relationship from the given capability and requirement. + public get relationship():Relationship { + if (!this._relationship) { + this._relationship = this.matchToRelation(); } - return this.secondRequirement.getFullTitle(); - }; - - public isOwner = (id:string):boolean => { - return this.secondRequirement.ownerId === id || this.requirement.ownerId === id; + return this._relationship; } -} - -export class MatchReqToCapability extends MatchBase { - - capability:Capability; - - constructor(requirement:Requirement, capability:Capability, isFromTo:boolean, fromNode:string, toNode:string) { - super(requirement, isFromTo, fromNode, toNode); - this.capability = capability; + public set relationship(relationship) { + this._relationship = relationship; } public matchToRelation = ():Relationship => { - let relationship:Relationship = new Relationship(); - relationship.capability = this.capability.name; - relationship.capabilityOwnerId = this.capability.ownerId; - relationship.capabilityUid = this.capability.uniqueId; - relationship.relationship = new RelationType(this.capability.type); - relationship.requirement = this.requirement.name; - relationship.requirementOwnerId = this.requirement.ownerId; - relationship.requirementUid = this.requirement.uniqueId; + const relationship:Relationship = new Relationship(); + relationship.setRelationProperties(this.capability, this.requirement); return relationship; }; - public getDisplayText = (menuSide:string):string => { if (this.isFromTo && 'left' == menuSide || !this.isFromTo && 'right' == menuSide) { return this.requirement.getFullTitle(); } return this.capability.getFullTitle(); - }; public isOwner = (id:string):boolean => { @@ -108,4 +77,3 @@ export class MatchReqToCapability extends MatchBase { }; } - @@ -48,7 +48,6 @@ export abstract class CompositionCiNodeBase extends CommonCINodeBase implements this.isGroup = false; this.isUcpePart = false; this.isInsideGroup = false; - } public initUncertifiedImage(node:Cy.Collection, nodeMinSize:number):string { @@ -61,8 +60,10 @@ export abstract class CompositionCiNodeBase extends CommonCINodeBase implements uncertifiedCanvasWidth = nodeWidth + uncertifiedIconWidth/2; //expand canvas so that only half of the icon overlaps with the node } - this.imageCreator.getImageBase64(this.imagesPath + ImagesUrl.RESOURCE_ICONS + this.componentInstance.icon + '.png', - this.imagesPath + ImagesUrl.RESOURCE_ICONS + 'uncertified.png', nodeWidth, uncertifiedCanvasWidth, uncertifiedIconWidth) + + + this.imageCreator.getImageBase64(this.imagesPath + this.componentInstance.icon + '.png', + this.imagesPath + 'uncertified.png', nodeWidth, uncertifiedCanvasWidth, uncertifiedIconWidth) .then(imageBase64 => { this.img = imageBase64; node.style({ @@ -7,9 +7,9 @@ * 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. @@ -18,37 +18,22 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.sdc.ci.tests.utilities; - -import org.apache.commons.lang3.tuple.ImmutablePair; -import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.LeftPanelCanvasItems; -import org.openqa.selenium.WebElement; - -public final class CanvasElement { - private final String uniqueId; - private ImmutablePair<Integer, Integer> location; - private WebElement elementType; - - CanvasElement(String name, ImmutablePair<Integer, Integer> location, WebElement canvasItem) { - super(); - this.uniqueId = name; - this.location = location; - elementType = canvasItem; - } - - public String getUniqueId() { - return uniqueId; - } - - public ImmutablePair<Integer, Integer> getLocation() { - return location; - } - - public void setLocation(ImmutablePair<Integer, Integer> location) { - this.location = location; - } - - public WebElement getElementType() { - return elementType; - } +import { ImagesUrl, GraphUIObjects} from "../../../../utils/constants"; +import {ComponentInstance, CompositionCiNodeBase} from "../../../../models"; +import {ImageCreatorService} from "../../../../directives/graphs-v2/image-creator/image-creator.service"; +export class CompositionCiNodeConfiguration extends CompositionCiNodeBase { + + constructor(instance:ComponentInstance, + imageCreator:ImageCreatorService) { + super(instance, imageCreator); + this.initConfiguration(); + } + + private initConfiguration():void { + this.imagesPath = this.imagesPath + ImagesUrl.RESOURCE_ICONS; + this.img = this.imagesPath + this.componentInstance.icon + '.png'; + this.imgWidth = GraphUIObjects.SMALL_RESOURCE_WIDTH; + this.type = "basic-small-node"; + this.classes = 'configuration-node'; + } } @@ -34,7 +34,8 @@ export class CompositionCiNodeCp extends CompositionCiNodeBase { private initCp():void { let sdcConfig = AngularJSBridge.getAngularConfig(); - this.img = sdcConfig.imagesPath + ImagesUrl.RESOURCE_ICONS + this.componentInstance.icon + '.png'; + this.imagesPath = this.imagesPath + ImagesUrl.RESOURCE_ICONS; + this.img = this.imagesPath + this.componentInstance.icon + '.png'; this.imgWidth = GraphUIObjects.SMALL_RESOURCE_WIDTH; this.type = "basic-small-node"; //if the cp from type cpEndPointInstances create with another template @@ -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========================================================= + */ + +import { ImagesUrl, GraphUIObjects} from "../../../../utils/constants"; +import {ComponentInstance, CompositionCiNodeBase} from "../../../../models"; +import {ImageCreatorService} from "../../../../directives/graphs-v2/image-creator/image-creator.service"; +export class CompositionCiNodeServiceProxy extends CompositionCiNodeBase { + + constructor(instance:ComponentInstance, + imageCreator:ImageCreatorService) { + super(instance, imageCreator); + this.initService(); + } + + private initService():void { + this.imagesPath = this.imagesPath + ImagesUrl.SERVICE_PROXY_ICONS; + this.img = this.imagesPath + this.componentInstance.icon + '.png'; + this.imgWidth = GraphUIObjects.DEFAULT_RESOURCE_WIDTH; + this.classes = 'service-node' + if (!this.certified) { + this.classes = this.classes + ' not-certified'; + } + + } +} @@ -30,7 +30,7 @@ export class CompositionCiNodeService extends CompositionCiNodeBase { } private initService():void { - + this.imagesPath = this.imagesPath + ImagesUrl.SERVICE_ICONS; this.img = this.imagesPath + ImagesUrl.SERVICE_ICONS + this.componentInstance.icon + '.png'; this.imgWidth = GraphUIObjects.DEFAULT_RESOURCE_WIDTH; this.classes = 'service-node' @@ -20,6 +20,7 @@ import {CompositionCiNodeCp, ComponentInstance} from "./../../../../models"; import {ImageCreatorService} from "../../../../directives/graphs-v2/image-creator/image-creator.service"; +import { ImagesUrl} from "../../../../utils/constants"; export class CompositionCiNodeUcpeCp extends CompositionCiNodeCp { @@ -31,5 +32,6 @@ export class CompositionCiNodeUcpeCp extends CompositionCiNodeCp { this.parent = instance.uniqueId; this.type = 'ucpe-cp-node'; //the type is for the handle (plus icon) extension this.isDraggable = false; + this.imagesPath = this.imagesPath + ImagesUrl.RESOURCE_ICONS; } } @@ -21,6 +21,7 @@ import {ComponentInstance} from "../../../componentsInstances/componentInstance"; import {ImageCreatorService} from "../../../../directives/graphs-v2/image-creator/image-creator.service"; import {CompositionCiNodeBase} from "./composition-ci-node-base"; +import { ImagesUrl} from "../../../../utils/constants"; export class NodeUcpe extends CompositionCiNodeBase { constructor(instance:ComponentInstance, @@ -36,6 +37,7 @@ export class NodeUcpe extends CompositionCiNodeBase { this.classes = 'ucpe-node'; this.type = 'ucpe-node'; this.allowConnection = false; + this.imagesPath = this.imagesPath + ImagesUrl.RESOURCE_ICONS; if (!this.certified) { this.classes = this.classes + ' not-certified-ucpe'; @@ -31,7 +31,8 @@ export class CompositionCiNodeVf extends CompositionCiNodeBase { } private initVf():void { - this.img = this.imagesPath + ImagesUrl.RESOURCE_ICONS + this.componentInstance.icon + '.png'; + this.imagesPath = this.imagesPath + ImagesUrl.RESOURCE_ICONS; + this.img = this.imagesPath + this.componentInstance.icon + '.png'; this.imgWidth = GraphUIObjects.DEFAULT_RESOURCE_WIDTH; this.classes = 'vf-node'; if (!this.certified) { @@ -29,6 +29,7 @@ export class CompositionCiNodeVfc extends CompositionCiNodeBase { } private initVfc():void { - this.img = this.imagesPath + ImagesUrl.RESOURCE_ICONS + this.componentInstance.icon + '.png'; + this.imagesPath = this.imagesPath + ImagesUrl.RESOURCE_ICONS; + this.img = this.imagesPath + this.componentInstance.icon + '.png'; } } @@ -48,6 +48,7 @@ export class CompositionCiNodeVl extends CompositionCiNodeBase { } this.img = this.imagesPath + ImagesUrl.RESOURCE_ICONS + 'vl.png'; this.imgWidth = GraphUIObjects.SMALL_RESOURCE_WIDTH; + this.imagesPath = this.imagesPath + ImagesUrl.RESOURCE_ICONS; this.classes = 'vl-node'; if (!this.certified) { @@ -24,6 +24,7 @@ import {ImagesUrl} from "../../../../utils/constants"; import {Module} from "../../../modules/base-module"; import {CommonNodeBase} from "../base-common-node"; +import {AngularJSBridge} from "../../../../services/angular-js-bridge-service"; export interface IModuleNodeBase { } @@ -44,7 +45,7 @@ export class ModuleNodeBase extends CommonNodeBase implements IModuleNodeBase { this.name = this.module.name; this.displayName = this.module.name; this.isGroup = true; - this.img = ImagesUrl.MODULE_ICON; + this.img = AngularJSBridge.getAngularConfig().imagesPath + ImagesUrl.MODULE_ICON; this.classes = "module-node"; } @@ -19,8 +19,8 @@ */ 'use strict'; -import {CompositionCiNodeUcpeCp, Module, ModuleNodeBase, CompositionCiNodeVf, CompositionCiNodeVl, CompositionCiNodeCp, - NodeUcpe, CompositionCiNodeService, CompositionCiNodeBase, ComponentInstance} from "./../../../models"; +import {CompositionCiNodeUcpeCp, Module, ModuleNodeBase, CompositionCiNodeVf, CompositionCiNodeVl, CompositionCiNodeCp, CompositionCiNodeConfiguration, + NodeUcpe, CompositionCiNodeService,CompositionCiNodeServiceProxy, CompositionCiNodeBase, ComponentInstance} from "./../../../models"; import {ComponentType, ResourceType} from "../../../utils/constants"; import {ImageCreatorService} from "../../../directives/graphs-v2/image-creator/image-creator.service"; @@ -37,12 +37,18 @@ export class NodesFactory { if (instance.originType === ComponentType.SERVICE) { return new CompositionCiNodeService(instance, this.imageCreator); } + if (instance.originType === ComponentType.SERVICE_PROXY) { + return new CompositionCiNodeServiceProxy(instance, this.imageCreator); + } if (instance.originType === ResourceType.CP) { return new CompositionCiNodeCp(instance, this.imageCreator); } if (instance.originType === ResourceType.VL) { return new CompositionCiNodeVl(instance, this.imageCreator); } + if (instance.originType === ResourceType.CONFIGURATION) { + return new CompositionCiNodeConfiguration(instance, this.imageCreator); + } return new CompositionCiNodeVf(instance, this.imageCreator); }; @@ -58,7 +58,8 @@ export class RelationType { } } -export class Relationship { +export class RelationshipType { + id:string; capability:string; capabilityOwnerId:string; capabilityUid:string; @@ -67,8 +68,9 @@ export class Relationship { requirementOwnerId:string; requirementUid:string; - constructor(relationship?:Relationship) { + constructor(relationship?:RelationshipType) { if (relationship) { + this.id = relationship.id; this.capability = relationship.capability; this.capabilityOwnerId = relationship.capabilityOwnerId; this.capabilityUid = relationship.capabilityUid; @@ -79,17 +81,41 @@ export class Relationship { } else { this.relationship = new RelationType(); } - } - public setRelationProperties = (capability:Capability, requirement:Requirement)=> { - this.capability = capability.name; - this.capabilityOwnerId = capability.ownerId; - this.capabilityUid = capability.uniqueId; - this.relationship = new RelationType(capability.type); - this.requirement = requirement.name; - this.requirementOwnerId = requirement.ownerId; - this.requirementUid = requirement.uniqueId; + public setRelationProperties = (capability?:Capability, requirement?:Requirement)=> { + if (capability) { + this.capability = capability.name; + this.capabilityOwnerId = capability.ownerId; + this.capabilityUid = capability.uniqueId; + this.relationship = new RelationType(capability.type); + } + if (requirement) { + this.requirement = requirement.name; + this.requirementOwnerId = requirement.ownerId; + this.requirementUid = requirement.uniqueId; + } }; +} + +export class Relationship { + relation: RelationshipType; + capability?: Capability; + requirement?: Requirement; + + constructor(fullRelationship?:Relationship) { + if (fullRelationship) { + this.relation = new RelationshipType(fullRelationship.relation); + this.capability = fullRelationship.capability && new Capability(fullRelationship.capability); + this.requirement = fullRelationship.requirement && new Requirement(fullRelationship.requirement); + } else { + this.relation = new RelationshipType(); + } + } + public setRelationProperties(capability?:Capability, requirement?:Requirement) { + this.relation.setRelationProperties(capability, requirement); + this.capability = capability; + this.requirement = requirement; + }; } @@ -31,6 +31,7 @@ export class HeatParameterModel { currentValue:string; defaultValue:string; + filterTerm:string; constructor(parameter?:HeatParameterModel) { } @@ -55,7 +55,7 @@ export class PropertyBEModel { this.schema = property.schema; this.type = property.type; this.uniqueId = property.uniqueId; - this.value = property.value ? property.value : property.defaultValue; + this.value = property.value; this.definition = property.definition; this.getInputValues = property.getInputValues; } @@ -38,6 +38,7 @@ export class PropertyFEModel extends PropertyBEModel { constructor(property: PropertyBEModel){ super(property); + this.value = property.value ? property.value : property.defaultValue;//In FE if a property doesn't have value - display the default value this.isSimpleType = PROPERTY_DATA.SIMPLE_TYPES.indexOf(this.type) > -1; this.setNonDeclared(); this.derivedDataType = this.getDerivedPropertyType(); @@ -21,6 +21,7 @@ 'use strict'; import {SchemaPropertyGroupModel, SchemaProperty} from "./aschema-property"; import {InputPropertyBase} from "./input-property-base"; +import {PropertyBEModel} from "./properties-inputs/property-be-model"; export class PropertiesGroup { constructor(propertiesObj?:PropertiesGroup) { @@ -54,8 +55,7 @@ export interface IPropertyModel extends InputPropertyBase { simpleType:string; } -export class PropertyModel implements IPropertyModel { - +export class PropertyModel extends PropertyBEModel implements IPropertyModel { //server data uniqueId:string; name:string; @@ -90,19 +90,10 @@ export class PropertyModel implements IPropertyModel { constructor(property?:PropertyModel) { + super(property); if (property) { - this.uniqueId = property.uniqueId; - this.name = property.name; this.constraints = property.constraints; - this.defaultValue = property.defaultValue; - this.description = property.description; - this.password = property.password; - this.required = property.required; - this.type = property.type; this.source = property.source; - this.parentUniqueId = property.parentUniqueId; - this.schema = property.schema; - this.value = property.value ? property.value : property.defaultValue; this.valueUniqueUid = property.valueUniqueUid; this.path = property.path; this.rules = property.rules; diff --git a/catalog-ui/src/app/models/radio-button.ts b/catalog-ui/src/app/models/radio-button.ts new file mode 100644 index 0000000000..e907b26bce --- /dev/null +++ b/ catalog-ui/src/app/models/radio-button.ts@@ -0,0 +1,11 @@ +/** + * Created by rc2122 on 9/5/2017. + */ +export class RadioButtonModel{ + key: string; + value: any; + constructor(key: string, value: any){ + this.key = key; + this.value = value; + } +} @@ -22,6 +22,7 @@ * Created by obarda on 4/20/2016. */ 'use strict'; +import {RequirementCapabilityModel} from "./capability"; //this is an object contains keys, when each key has matching array. // for example: key = tosca.capabilities.network. and the match array is array of requirements objects export class RequirementsGroup { @@ -36,7 +37,7 @@ export class RequirementsGroup { } } -export class Requirement { +export class Requirement implements RequirementCapabilityModel{ //server data capability:string; @@ -46,6 +47,7 @@ export class Requirement { node:string; uniqueId:string; relationship:string; + leftOccurrences:string; minOccurrences:string; maxOccurrences:string; //custom @@ -61,6 +63,7 @@ export class Requirement { this.node = requirement.node; this.uniqueId = requirement.uniqueId; this.relationship = requirement.relationship; + this.leftOccurrences = requirement.leftOccurrences; this.minOccurrences = requirement.minOccurrences; this.maxOccurrences = requirement.maxOccurrences; this.initFilterTerm(); @@ -68,9 +71,12 @@ export class Requirement { } } + public getTitle():string { + return this.ownerName + ': ' + this.name; + } + public getFullTitle():string { - return this.ownerName + ': ' + this.name + - ': [' + this.minOccurrences + ', ' + this.maxOccurrences + ']'; + return this.getTitle() + ': [' + this.minOccurrences + ', ' + this.maxOccurrences + ']'; } public toJSON = ():any => { @@ -86,6 +92,10 @@ export class Requirement { (this.relationship ? (this.relationship.substring("tosca.relationships.".length) + " ") : "") + this.minOccurrences + "," + this.maxOccurrences; } + + public isFulfilled() { + return parseInt(this.leftOccurrences) === 0; + } } @@ -19,7 +19,6 @@ */ 'use strict'; -import {IUserResource} from "../services/user-resource-service"; export enum UserRole { ADMIN, @@ -46,7 +45,7 @@ export interface IUserProperties extends IUserManager { } export interface IUser { - resource:IUserResource; + userInfo:IUserProperties; getRole():UserRole; getRoleToView():string; getName():string; @@ -56,32 +55,32 @@ export interface IUser { export class User implements IUser { - constructor(public resource:IUserResource) { + constructor(public userInfo:IUserProperties) { } public getLastName = () => { - return this.resource.lastName; - } + return this.userInfo.lastName; + }; public getFirstName = () => { - return this.resource.firstName; - } + return this.userInfo.firstName; + }; public getName = () => { - return this.resource.firstName + ' ' + this.resource.lastName; - } + return this.userInfo.firstName + ' ' + this.userInfo.lastName; + }; public getLastLogin = () => { - if (!this.resource.lastLoginTime || this.resource.lastLoginTime === "0") { + if (!this.userInfo.lastLoginTime || this.userInfo.lastLoginTime === "0") { return ""; } else { - return this.resource.lastLoginTime; + return this.userInfo.lastLoginTime; } - } + }; public getRole = ():UserRole => { let role:UserRole; - switch (UserRole[this.resource.role.toUpperCase()]) { + switch (UserRole[this.userInfo.role.toUpperCase()]) { case UserRole.ADMIN: role = UserRole.ADMIN; break; @@ -99,10 +98,10 @@ export class User implements IUser { break; } return role; - } + }; public getRoleToView = ():string => { - let role:string = this.resource.role.toLowerCase().replace('governor', 'governance_Rep'); + let role:string = this.userInfo.role.toLowerCase().replace('governor', 'governance_Rep'); return role.charAt(0).toUpperCase() + role.slice(1).replace('_', ' '); } } diff --git a/catalog-ui/src/app/models/wizard-step.ts b/catalog-ui/src/app/models/wizard-step.ts new file mode 100644 index 0000000000..b8484b2dd6 --- /dev/null +++ b/ catalog-ui/src/app/models/wizard-step.ts@@ -0,0 +1,19 @@ +/** + * Created by rc2122 on 8/16/2017. + */ + +import {Type} from "@angular/core"; + +export interface IStepComponent { + preventNext():boolean; + preventBack():boolean; +} + +export class StepModel{ + title: string; + component: Type<IStepComponent>; + constructor(title: string, component: Type<IStepComponent>){ + this.title = title; + this.component = component; + } +} @@ -40,7 +40,6 @@ import {ExpandCollapseMenuBoxDirective} from "../directives/utils/expand-collaps import {PunchOutDirective} from "../directives/punch-out/punch-out"; import {CustomValidationDirective} from "../directives/custom-validation/custom-validation"; import {EcompHeaderDirective} from "../directives/ecomp-header/ecomp-header"; -import {EcompFooterDirective} from "../directives/ecomp-footer/ecomp-footer"; import {EditNamePopoverDirective} from "../directives/edit-name-popover/edit-name-popover-directive"; import {DataTypeFieldsStructureDirective} from "../directives/property-types/data-type-fields-structure/data-type-fields-structure"; import {TypeMapDirective} from "../directives/property-types/type-map/type-map-directive"; @@ -54,7 +53,6 @@ import {SdcTabsDirective} from "../directives/sdc-tabs/sdc-tabs-directive"; import {SdcSingleTabDirective, InnerSdcSingleTabDirective} from "../directives/sdc-tabs/sdc-single-tab/sdc-single-tab-directive"; import {ExpandCollapseListHeaderDirective} from "../directives/utils/expand-collapse-list-header/expand-collapse-list-header"; import {JsonExportExcelDirective} from "../directives/export-json-to-excel/export-json-to-excel"; -import {TopNavDirective} from "../directives/layout/top-nav/top-nav"; import {TopProgressDirective} from "../directives/layout/top-progress/top-progress"; import {CheckboxElementDirective} from "../directives/elements/checkbox/checkbox"; import {RadiobuttonElementDirective} from "../directives/elements/radiobutton/radiobutton"; @@ -105,7 +103,6 @@ directiveModule.directive('expandCollapseMenuBox', ExpandCollapseMenuBoxDirectiv directiveModule.directive('punchOut', PunchOutDirective.factory); directiveModule.directive('customValidation', CustomValidationDirective.factory); directiveModule.directive('ecompHeader', EcompHeaderDirective.factory); -directiveModule.directive('ecompFooter', EcompFooterDirective.factory); directiveModule.directive('editNamePopover', EditNamePopoverDirective.factory); directiveModule.directive('fieldsStructure', DataTypeFieldsStructureDirective.factory); directiveModule.directive('typeMap', TypeMapDirective.factory); @@ -122,7 +119,6 @@ directiveModule.directive('jsonExportExcel', JsonExportExcelDirective.factory); directiveModule.directive('expandCollapseListHeader', ExpandCollapseListHeaderDirective.factory); // // // Layouts -directiveModule.directive('topNav', TopNavDirective.factory); directiveModule.directive('topProgress', TopProgressDirective.factory); // // // Elements @@ -170,3 +166,18 @@ directiveModule.service('DeploymentGraphGeneralUtils', DeploymentGraphGeneralUti //Compoisiton right tab directives directiveModule.directive('capabilitiesList', CapabilitiesListDirective.factory); directiveModule.directive('requirementsList', RequirementsListDirective.factory); + + +// *** NG2 Components (downgraded) *** // +import {MenuListNg2Component} from "../ng2/components/downgrade-wrappers/menu-list-ng2/menu-list-ng2.component"; +import {TopNavComponent} from "../ng2/components/layout/top-nav/top-nav.component"; + +directiveModule.directive('menuListNg2', downgradeComponent({ + component: MenuListNg2Component, + inputs: ['props'] +}) as angular.IDirectiveFactory); +directiveModule.directive('topNav', downgradeComponent({ + component: TopNavComponent, + inputs: ['version', 'menuModel', 'topLvlSelectedIndex', 'hideSearch', 'searchTerm', 'notificationIconCallback'], + outputs: ['searchTermChange'] +}) as ng.IDirectiveFactory); @@ -43,8 +43,14 @@ import {FileUtils} from "../utils/file-utils"; import {ValidationUtils} from "../utils/validation-utils"; import {AngularJSBridge} from "../services/angular-js-bridge-service"; import {LoaderService} from "../services/loader-service"; -import {UserResourceService} from "../services/user-resource-service"; import {CategoryResourceService} from "../services/category-resource-service"; +import {downgradeInjectable} from "@angular/upgrade/static"; +import {ModalService} from "../ng2/services/modal.service"; +import {ComponentServiceNg2} from "../ng2/services/component-services/component.service"; +import {ServiceServiceNg2} from "../ng2/services/component-services/service.service"; +import {ConnectionWizardService} from "../ng2/pages/connection-wizard/connection-wizard.service"; +import {ComponentInstanceServiceNg2} from "../ng2/services/component-instance-services/component-instance.service"; +import {UserService as UserServiceNg2} from "../ng2/services/user.service"; let moduleName:string = 'Sdc.Services'; let serviceModule:ng.IModule = angular.module(moduleName, []); @@ -80,5 +86,12 @@ serviceModule.service('ValidationUtils', ValidationUtils); serviceModule.service('AngularJSBridge',AngularJSBridge); serviceModule.service('LoaderService', LoaderService); -serviceModule.factory('Sdc.Services.UserResourceService', UserResourceService.getResource); serviceModule.factory('Sdc.Services.CategoryResourceService', CategoryResourceService.getResource); + +// Angular2 upgraded services - This is in order to use the service in angular1 till we finish remove all angular1 code +serviceModule.factory('ComponentServiceNg2', downgradeInjectable(ComponentServiceNg2)); +serviceModule.factory('ServiceServiceNg2', downgradeInjectable(ServiceServiceNg2)); +serviceModule.factory('ModalServiceNg2', downgradeInjectable(ModalService)); +serviceModule.factory('ConnectionWizardServiceNg2', downgradeInjectable(ConnectionWizardService)); +serviceModule.factory('ComponentInstanceServiceNg2', downgradeInjectable(ComponentInstanceServiceNg2)); +serviceModule.factory('UserServiceNg2', downgradeInjectable(UserServiceNg2));
\ No newline at end of file @@ -27,7 +27,7 @@ import {UpgradeAdapter} from '@angular/upgrade'; import {UpgradeModule} from '@angular/upgrade/static'; import {PropertiesAssignmentModule} from './pages/properties-assignment/properties-assignment.module'; import { - DataTypesServiceProvider, SharingServiceProvider, CookieServiceProvider, + DataTypesServiceProvider, SharingServiceProvider, CookieServiceProvider, StateServiceFactory, StateParamsServiceFactory, CacheServiceProvider, EventListenerServiceProvider } from "./utils/ng1-upgraded-provider"; import {ConfigService} from "./services/config.service"; @@ -38,9 +38,14 @@ import {Cookie2Service} from "./services/cookie.service"; import {ComponentServiceNg2} from "./services/component-services/component.service"; import {ServiceServiceNg2} from "./services/component-services/service.service"; import {ComponentInstanceServiceNg2} from "./services/component-instance-services/component-instance.service"; -import { XHRBackend, RequestOptions } from '@angular/http'; -import { SearchBarComponent } from './shared/search-bar/search-bar.component'; -import { SearchWithAutoCompleteComponent } from './shared/search-with-autocomplete/search-with-autocomplete.component'; +import {ModalService} from "./services/modal.service"; +import {UiElementsModule} from "./components/ui/ui-elements.module"; +import {ConnectionWizardModule} from "./pages/connection-wizard/connection-wizard.module"; +import {LayoutModule} from "./components/layout/layout.module"; +import {UserService} from "./services/user.service"; +import {SdcConfig} from "./config/sdc-config.config"; +import { TranslateModule } from "./shared/translator/translate.module"; +import { TranslationServiceConfig } from "./config/translation.service.config"; export const upgradeAdapter = new UpgradeAdapter(forwardRef(() => AppModule)); @@ -51,23 +56,28 @@ export function configServiceFactory(config:ConfigService) { @NgModule({ declarations: [ - AppComponent, - SearchBarComponent, - SearchWithAutoCompleteComponent + AppComponent ], imports: [ BrowserModule, UpgradeModule, FormsModule, HttpModule, + LayoutModule, + TranslateModule, + UiElementsModule, + + //We need to import them here since we use them in angular1 + ConnectionWizardModule, PropertiesAssignmentModule ], exports: [], - entryComponents: [SearchWithAutoCompleteComponent], + entryComponents: [], providers: [ DataTypesServiceProvider, SharingServiceProvider, CookieServiceProvider, + StateServiceFactory, StateParamsServiceFactory, CacheServiceProvider, EventListenerServiceProvider, @@ -75,9 +85,13 @@ export function configServiceFactory(config:ConfigService) { Cookie2Service, ConfigService, ComponentServiceNg2, + ModalService, ServiceServiceNg2, HttpService, + UserService, + SdcConfig, ComponentInstanceServiceNg2, + TranslationServiceConfig, { provide: APP_INITIALIZER, useFactory: configServiceFactory, @@ -90,9 +104,8 @@ export function configServiceFactory(config:ConfigService) { export class AppModule { - // ngDoBootstrap() {} - constructor(public upgrade:UpgradeModule) { + constructor(public upgrade:UpgradeModule) { } } @@ -0,0 +1,7 @@ +<menu-list [open]="props?.open" [position]="props?.position" [styleClass]="props?.styleClass"> + <menu-item *ngFor="let item of props?.items" + [action]="item?.action" + [styleClass]="item?.styleClass"> + {{ item?.contents }} + </menu-item> +</menu-list> @@ -0,0 +1,36 @@ +/*- + * ============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========================================================= + */ + +import { Component, Input } from '@angular/core'; + +declare var window:any; +@Component({ + selector: 'canvas-menu', + templateUrl: './menu-list-ng2.component.html' +}) +export class MenuListNg2Component { + @Input() props:any = { + items: [] + }; + + constructor() { + window.menu2 = this; + } +} @@ -0,0 +1,23 @@ +import { NgModule } from "@angular/core"; +import { CommonModule } from '@angular/common'; +import { MenuListModule } from "../../ui/menu/menu-list.module"; +import { MenuListNg2Component } from "./menu-list-ng2.component"; + +export { + MenuListNg2Component +}; + +@NgModule({ + declarations: [ + MenuListNg2Component + ], + imports: [CommonModule, MenuListModule], + exports: [ + MenuListNg2Component + ], + entryComponents: [ //need to add anything that will be dynamically created + MenuListNg2Component +] +}) +export class MenuListNg2Module { +} @@ -1 +0,0 @@ -<input #{{name}} [(ngModel)]="value" type="checkbox" (change)="onSave(value)" [ngClass]="{'disabled':readonly}"/> @@ -1,2 +0,0 @@ -/deep/ ui-element-checkbox { -} @@ -1,3 +0,0 @@ -<select name='{{name}}' [(ngModel)]="value" #t (change)="onSave()" [ngClass]="{'disabled':readonly}"> - <option *ngFor="let ddvalue of values" [value]="ddvalue.value">{{ddvalue.label}}</option> -</select> @@ -0,0 +1,24 @@ +import { NgModule } from "@angular/core"; +import { CommonModule } from "@angular/common"; +import { FormsModule } from "@angular/forms"; +import { TranslateModule } from "../../shared/translator/translate.module"; +import { TopNavComponent } from "./top-nav/top-nav.component"; + +@NgModule({ + declarations: [ + TopNavComponent + ], + imports: [ + CommonModule, + FormsModule, + TranslateModule + ], + exports: [], + entryComponents: [ //need to add anything that will be dynamically created + TopNavComponent + ], + providers: [] +}) +export class LayoutModule { + +}
\ No newline at end of file @@ -0,0 +1,53 @@ +<nav class="top-nav"> + + <div class="asdc-app-title-wrapper"> + <a class="asdc-app-title">{{ 'PROJECT_TITLE'|translate }}</a> + <div class="asdc-version"> v.{{version}}</div> + </div> + + <ul class="top-menu" *ngIf="!menuModel && topLvlMenu"> + <!-- no hierarchy & dropdowns mode --> + <li *ngFor="let item of topLvlMenu.menuItems; let i = index" + [ngClass]="{'selected': i == topLvlMenu.selectedIndex}"> + <a (click)="menuItemClick(topLvlMenu, item)" + [attr.data-tests-id]="'main-menu-button-' + item.text.toLowerCase()">{{item.text}}</a> + </li> + </ul> + + <ul class="top-menu" *ngIf="menuModel"> + <!-- with hierarchy & dropdowns mode --> + <ng-container *ngFor="let groupItem of menuModel; let $index = index; let $last = last"> + <li [ngClass]="{'selected': $last }"> + <a (click)="menuItemClick(groupItem, groupItem.menuItems[groupItem.selectedIndex])" + [attr.data-tests-id]="'breadcrumbs-button-' + $index"> + {{groupItem.menuItems[groupItem.selectedIndex].text}} + </a> + </li> + <li class="triangle-dropdown" + [ngClass]="{'item-click': groupItem.itemClick}" (mouseover)="groupItem.itemClick = true"> + <div class="triangle"><span class="sprite-new arrow-right"></span></div> + <ul class="sub-menu"> + <li *ngFor="let ddItem of groupItem.menuItems; let $index2 = index" + (click)="menuItemClick(groupItem, ddItem)" + [ngClass]="{'selected': $index2 == groupItem.selectedIndex, 'disabled': ddItem.isDisabled}" + [attr.data-tests-id]="'sub-menu-button-' + ddItem.text.toLowerCase()"> + <span sdc-smart-tooltip="">{{ddItem.text}}</span> + </li> + </ul> + </li> + </ng-container> + </ul> + + <div class="top-search" [hidden]="hideSearch === true"> + <input type="text" + class="search-text" + placeholder="Search" + [ngModel]="searchTerm" + (ngModelChange)="emitSearchTerm($event)" + data-tests-id="main-menu-input-search" /> + <span class="w-sdc-search-icon magnification"></span> + </div> + + <div class="notification-icon" [ngClass]="{'disabled' : progress > 0}" *ngIf="user.role === 'DESIGNER' && notificationIconCallback" (click)="notificationIconCallback()" tooltip="Vendor Software Product Repository" tooltipPlacement="left" data-tests-id="repository-icon"></div> + +</nav> @@ -0,0 +1,225 @@ +@import "../../../../../assets/styles/variables"; +@import "../../../../../assets/styles/variables-old"; +@import "../../../../../assets/styles/mixins_old"; +@import "../../../../../assets/styles/sprite"; + +.top-nav { + position: fixed; + top: @header_height; + background-color: @main_color_p; + .box-shadow(0px 1px 3px 0px rgba(0, 0, 0, 0.33)); + width: 100%; + height: @top_nav_height; + line-height: @top_nav_height; + z-index: 10; + display: flex; + flex-direction: row; + align-items: center; + + .asdc-app-title-wrapper { + flex-grow: 1; + line-height: 16px; + margin: 0 20px; + + a.asdc-app-title { + //.m_18_r; + text-decoration: none; + } + + .asdc-version { + //.m_12_r; + .opacity(0.8); + line-height: 14px; + flex-grow: 1; + } + + } + + ul.top-menu { + list-style-type: none; + margin: 0 0 0 20px; + padding: 0; + flex-grow: 999; + + & > li { + float: left; + cursor: pointer; + line-height: 50px; + height: 50px; + padding: 0 20px; + + &.selected { + border-bottom: solid 4px @main_color_a; + + a { + color: @func_color_s; + } + } + + /*&:hover { + border-bottom: solid 4px @main_color_a; + }*/ + + a { + font-family: @font-opensans-medium; + color: @main_color_m; + font-size: 16px; + display: block; + text-align: center; + text-decoration: none; + } + + &.triangle-dropdown { + padding: 0; + position: relative; + + div.triangle { + margin-top: 15px; + border-radius: 2px; + width: 17px; + height: 18px; + + //temp use - until new triangle gets in + line-height: 18px; + text-align: center; + font-size: 10px; + + &:hover { + background-color: rgba(156, 156, 156, 0.2); + + span { + .arrow-right-hover; + } + } + } + + + li a { + font-size: 16px; + } + + ul.sub-menu { + .perfect-scrollbar; + position: absolute; + left: 0; + top: 40px; + z-index: 1; + + overflow-x: hidden; + overflow-y: auto; + max-height: 0; + -webkit-transition: max-height 200ms ease-in; + -moz-transition: max-height 200ms ease-in; + -o-transition: max-height 200ms ease-in; + transition: max-height 200ms ease-in; + + padding: 0; + background-color: white; + visibility: hidden; + + li { + + height: 35px; + background-color: white; + font-size: 13px; + width: 150px; + line-height: 35px; + padding: 0 10px; + + &.disabled { + opacity: 1; + } + &.selected { + background-color: @tlv_color_v; + font-weight: bold; + } + &:hover { + color: @main_color_a; + } + span { + height: 35px; + width: 130px; + display: inline; + white-space: nowrap; + overflow: hidden; + } + } + } + &.item-click:hover ul.sub-menu, + &.item-click:active ul.sub-menu { + visibility: visible; + max-height: 500px; + border: 1px solid @func_color_b; + border-radius: 2px; + box-shadow: 0px 2px 2px 0px rgba(24, 24, 25, 0.1); + + div ul { + + } + } + } + } + + } + + .top-search { + position: relative; + flex-grow: 1; + padding: 0 20px; + + input.search-text { + .border-radius(2px); + width: 245px; + height: 32px; + line-height: 32px; + border: 1px solid @main_color_o; + outline: none; + text-indent: 10px; + + &::-webkit-input-placeholder { font-style: italic; } /* Safari, Chrome and Opera */ + &:-moz-placeholder { font-style: italic; } /* Firefox 18- */ + &::-moz-placeholder { font-style: italic; } /* Firefox 19+ */ + &:-ms-input-placeholder { font-style: italic; } /* IE 10+ */ + &:-ms-input-placeholder { font-style: italic; } /* Edge */ + /* font-style: italic; + }*/ + /* Firefox 18- */ + &::-moz-placeholder { + font-style: italic; + } + /* Firefox 19+ */ + &:-ms-input-placeholder { + font-style: italic; + } + /* IE 10+ */ + &:-ms-input-placeholder { + font-style: italic; + } + /* Edge */ + } + + .magnification { + position: absolute; + top: 19px; + right: 26px; + } + + } + + .notification-icon { + cursor: pointer; + flex-grow: 1; + margin: 0 10px 6px 0; + .sprite-new; + .vsp-list-icon; + + &:hover { + .vsp-list-icon-hover; + } + + &:active { + .vsp-list-icon-active; + } + + } + +} @@ -0,0 +1,149 @@ +/*- + * ============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========================================================= + */ + +import {Component, Inject, Input, Output, EventEmitter} from "@angular/core"; +import {IHostedApplication, IUserProperties} from "app/models"; +import {MenuItemGroup, MenuItem} from "app/utils"; +import {UserService} from "../../../services/user.service"; +import {SdcConfigToken, ISdcConfig} from "../../../config/sdc-config.config"; +import {TranslateService} from "../../../shared/translator/translate.service"; + + +declare const window:any; +@Component({ + selector: 'top-nav', + templateUrl: './top-nav.component.html', + styleUrls:['./top-nav.component.less'] +}) +export class TopNavComponent { + @Input() public version:string; + @Input() public menuModel:Array<MenuItemGroup>; + @Input() public topLvlSelectedIndex:number; + @Input() public hideSearch:boolean; + @Input() public searchTerm:string; + @Input() public notificationIconCallback:Function; + @Output() public searchTermChange:EventEmitter<string> = new EventEmitter<string>(); + emitSearchTerm(event:string) { + this.searchTermChange.emit(event); + } + + public topLvlMenu:MenuItemGroup; + public user:IUserProperties; + + constructor(private translateService:TranslateService, + @Inject('$state') private $state:ng.ui.IStateService, + private userService:UserService, + @Inject(SdcConfigToken) private sdcConfig:ISdcConfig) { + window.nav = this; + } + + private _getTopLvlSelectedIndexByState = ():number => { + if (!this.topLvlMenu.menuItems) { + return 0; + } + + let result = -1; + + //set result to current state + this.topLvlMenu.menuItems.forEach((item:MenuItem, index:number)=> { + if (item.state === this.$state.current.name) { + result = index; + } + }); + + //if it's a different state , checking previous state param + if (result === -1) { + this.topLvlMenu.menuItems.forEach((item:MenuItem, index:number)=> { + if (item.state === this.$state.params['previousState']) { + result = index; + } + }); + } + + if (result === -1) { + result = 0; + } + + return result; + }; + + ngOnChanges(changes) { + if (changes['menuModel']) { + console.log('menuModel was changed!'); + this.generateMenu(); + } + } + + ngOnInit() { + console.log('Nav is init!', this.menuModel); + this.user = this.userService.getLoggedinUser(); + + this.translateService.languageChangedObservable.subscribe((lang) => { + let tmpArray: Array<MenuItem> = [ + new MenuItem(this.translateService.translate("TOP_MENU_HOME_BUTTON"), null, "dashboard", "goToState", null, null), + new MenuItem(this.translateService.translate("TOP_MENU_CATALOG_BUTTON"), null, "catalog", "goToState", null, null) + ]; + + // Only designer can perform onboarding + if (this.user && this.user.role === 'DESIGNER') { + tmpArray.push(new MenuItem(this.translateService.translate("TOP_MENU_ON_BOARD_BUTTON"), null, "onboardVendor", "goToState", null, null)); + _.each(this.sdcConfig.hostedApplications, (hostedApp: IHostedApplication) => { + if (hostedApp.exists) { + tmpArray.push(new MenuItem(hostedApp.navTitle, null, hostedApp.defaultState, "goToState", null, null)); + } + }); + } + + this.topLvlMenu = new MenuItemGroup(0, tmpArray, true); + this.topLvlMenu.selectedIndex = isNaN(this.topLvlSelectedIndex) ? this._getTopLvlSelectedIndexByState() : this.topLvlSelectedIndex; + + this.generateMenu(); + }); + } + + generateMenu() { + if (this.menuModel && this.topLvlMenu && this.menuModel[0] !== this.topLvlMenu) { + this.menuModel.unshift(this.topLvlMenu); + } + } + + goToState(state:string, params:Array<any>):Promise<boolean> { + return new Promise((resolve, reject) => { + this.$state.go(state, params && params.length > 0 ? [0] : undefined); + resolve(true); + }); + } + + menuItemClick(itemGroup:MenuItemGroup, item:MenuItem) { + itemGroup.itemClick = false; + + let onSuccess = ():void => { + itemGroup.selectedIndex = itemGroup.menuItems.indexOf(item); + }; + let onFailed = ():void => { + }; + + if (item.callback) { + (item.callback.apply(undefined, item.params)).then(onSuccess, onFailed); + } else { + this[item.action](item.state, item.params).then(onSuccess, onFailed); + } + } +} @@ -4,7 +4,7 @@ <div class="field"> <label>Resource Type</label> <div> - <checkbox [label]="'All'" [(checked)]="allSelected" (checkedChange)="selectAll()"></checkbox> + <checkbox [label]="'All'" [(checked)]="allSelected" (checkedChange)="selectAll()" data-tests-id="filter-checkbox-all"></checkbox> </div> <div *ngFor="let type of typesOptions"> <checkbox [label]="type" [(checked)]="selectedTypes[type]" (checkedChange)="onTypeSelected(type)"></checkbox> @@ -17,10 +17,11 @@ [(ngModel)]="filterData.propertyName" placeholder="Type here" required + data-tests-id="filter-box" /> </div> </form> </popover-content> <div class="open-filter-button" [popover]="filterPopover" [ngClass]="{'open':showPopover}" (onShown)="showPopover = true" (onHidden)="showPopover = false"> - <div class="sprite-new filter-icon"></div> + <div class="sprite-new filter-icon" data-tests-id="filter-button"></div> </div> @@ -1,4 +1,4 @@ -@import '../../../../assets/styles/variables'; +@import '../../../../../assets/styles/variables'; form{ margin: 0 20px; .field{ @@ -23,8 +23,8 @@ */ import {Component, Input, Output, EventEmitter, ViewChild} from '@angular/core'; import {ButtonModel, ButtonsModelMap, FilterPropertiesAssignmentData} from "app/models"; -import {PopoverComponent} from "../popover/popover.component"; -import * as sdcConfig from "../../../../../configurations/dev" +import * as sdcConfig from "../../../../../../configurations/dev" +import {PopoverComponent} from "../../ui/popover/popover.component"; @Component({ selector: 'filter-properties-assignment', @@ -1,7 +1,7 @@ <div class="navigation-wrapper"> <div class="node-item" *ngFor="let item of displayData" (click)="onClick($event, item)"> <div class="node-data-wrapper" [ngClass]="{'selected': selectedItem && selectedItem === item[displayOptions.idProperty]}"> - <span class="node-data" [ngClass]="{'mark':item[displayOptions.valueProperty] === displayOptions.searchText}">{{item[displayOptions.valueProperty]}}</span> + <span class="node-data" [ngClass]="{'mark':item[displayOptions.valueProperty] === displayOptions.searchText}" [attr.data-tests-id]="item[displayOptions.valueProperty]">{{item[displayOptions.valueProperty]}}</span> </div> <div class="children-node" *ngIf="item[displayOptions.childrenProperty]"> <hierarchy-navigation class="children-hierarchy" [displayData]="item[displayOptions.childrenProperty]" @@ -37,7 +37,7 @@ [readonly]="readonly"> </dynamic-element> <div class="delete-button-container"> - <span *ngIf="input.instanceUniqueId && !readonly" class="sprite-new delete-btn" (click)="openDeleteModal(input)"></span> + <span *ngIf="input.instanceUniqueId && !readonly" class="sprite-new delete-btn" (click)="openDeleteModal(input)" data-tests-id="delete-input-button"></span> </div> </div> @@ -1,5 +1,5 @@ -@import './../../../../assets/styles/variables.less'; +@import './../../../../../assets/styles/variables.less'; :host /deep/ input { width:100%;} @@ -21,16 +21,14 @@ /** * Created by rc2122 on 5/4/2017. */ -import {Component, Input, Output, EventEmitter, ViewChild} from "@angular/core"; +import {Component, Input, Output, EventEmitter} from "@angular/core"; import {InputFEModel} from "app/models"; -import { ModalService } from 'app/ng2/services/modal.service'; - - +import {ModalService} from "../../../services/modal.service"; @Component({ selector: 'inputs-table', templateUrl: './inputs-table.component.html', - styleUrls: ['../inputs-table/inputs-table.component.less'] + styleUrls: ['../inputs-table/inputs-table.component.less'], }) export class InputsTableComponent { @@ -1,11 +1,11 @@ <div *ngIf="!property.hidden" class="dynamic-property-row nested-level-{{nestedLevel}}" [@fadeIn] - [ngClass]="{'selected': selectedPropertyId && selectedPropertyId === property.propertiesName }" + [ngClass]="{'selected': selectedPropertyId && selectedPropertyId === property.propertiesName, 'readonly': property.isDisabled ||property.isDeclared}" [class.with-top-border]="property.isChildOfListOrMap" (click)="onClickPropertyRow(property, $event)"> <!-- LEFT CELL --> <ng-container *ngIf="!isPropertyFEModel"> <div class="table-cell" *ngIf="canBeDeclared" [ngClass]="{'filtered':property.name === propertyNameSearchText}" [class.round-checkbox]="property.isDeclared"> <!-- simple children of complex type [@checkEffect]="property.isDeclared"--> - <checkbox [(checked)]="property.isSelected" [disabled]="property.isDisabled ||property.isDeclared || readonly" (checkedChange)="checkProperty.emit(property.propertiesName)" ></checkbox> + <checkbox *ngIf="hasDeclareOption" [(checked)]="property.isSelected" [disabled]="property.isDisabled ||property.isDeclared || readonly" (checkedChange)="checkProperty.emit(property.propertiesName)" ></checkbox> <div class="inner-cell-div" tooltip="{{property.name}}"><span>{{property.name}}</span></div> </div> <div class="table-cell" *ngIf="!canBeDeclared && !property.isChildOfListOrMap">{{property.name}}</div> <!-- simple children of complex type within map or list --> @@ -47,7 +47,8 @@ <ng-container *ngFor="let prop of property.flattenedChildren | filterChildProperties: expandedChildId; trackBy:prop?.propertiesName"> <dynamic-property [selectedPropertyId]="selectedPropertyId" - [canBeDeclared]="prop.canBeDeclared" + [hasDeclareOption]="hasDeclareOption" + [canBeDeclared]="hasDeclareOption && prop.canBeDeclared" [property]="prop" [expandedChildId]="expandedChildId" [propertyNameSearchText]="propertyNameSearchText" @@ -1,4 +1,4 @@ -@import '../../../../../assets/styles/variables.less'; +@import '../../../../../../assets/styles/variables.less'; .flat-children-container { .dynamic-property-row { /*create nested left border classes for up to 10 levels of nesting*/ @@ -25,6 +25,15 @@ flex-direction:row; align-items: stretch; + &.readonly{ + background-color: @tlv_color_t; + cursor: auto; + } + //for the case that the parent is disabled but the child is enabled + &:not(.readonly){ + background-color: @main_color_p; + } + .table-cell { flex: 1; padding:9px; @@ -72,3 +81,4 @@ outline: none; box-sizing: border-box; } + @@ -19,11 +19,11 @@ */ import {Component, Input, Output, EventEmitter} from "@angular/core"; -import { PropertyBEModel, PropertyFEModel, DerivedFEProperty, DerivedPropertyType, SchemaPropertyGroupModel, DataTypeModel } from "app/models"; -import { PROPERTY_DATA, PROPERTY_TYPES } from 'app/utils'; -import { PropertiesUtils } from "app/ng2/pages/properties-assignment/properties.utils"; -import { DataTypeService } from "../../../services/data-type.service"; +import { PropertyFEModel, DerivedFEProperty, DerivedPropertyType } from "app/models"; +import { PROPERTY_TYPES } from 'app/utils'; +import { DataTypeService } from "../../../../services/data-type.service"; import { trigger, state, style, transition, animate } from '@angular/core'; +import {PropertiesUtils} from "../../../../pages/properties-assignment/services/properties.utils"; @Component({ @@ -47,6 +47,7 @@ export class DynamicPropertyComponent { @Input() propertyNameSearchText: string; @Input() readonly: boolean; @Input() hasChildren: boolean; + @Input() hasDeclareOption:boolean; @Output() valueChanged: EventEmitter<any> = new EventEmitter<any>(); @Output() expandChild: EventEmitter<string> = new EventEmitter<string>(); @@ -2,38 +2,38 @@ <loader [display]="isLoading" [size]="'large'" [relative]="true" [loaderDelay]="500"></loader> <div class="table-header"> <div class="table-cell col1">Property Name</div> - <div class="table-cell col2">Type</div> - <div class="table-cell col3">ES</div> + <div class="table-cell col2" *ngIf="!hidePropertyType">Type</div> + <div class="table-cell col3" *ngIf="!hidePropertyType">ES</div> <div class="table-cell valueCol">Value</div> </div> - <div class="table-body"> + <div class="table-body" [ngClass]="{'view-mode': readonly}"> <div class="no-data" *ngIf="!fePropertiesMap || !(fePropertiesMap | keys).length">No data to display</div> <ng-container *ngFor="let instanceId of fePropertiesMap | keys; trackBy:instanceId"> - <div class="table-rows-header white-sub-header">{{feInstanceNamesMap[instanceId]}}</div> + <div class="table-rows-header white-sub-header" *ngIf="feInstanceNamesMap">{{feInstanceNamesMap[instanceId]}}</div> <div class="table-row" *ngFor="let property of fePropertiesMap[instanceId] | searchFilter:'name':searchTerm; trackBy:property?.name" (click)="onClickPropertyRow(property, instanceId, $event)" - [ngClass]="{'selected': selectedPropertyId && selectedPropertyId === property.name }"> + [ngClass]="{'selected': selectedPropertyId && selectedPropertyId === property.name, 'readonly': property.isDisabled || property.isDeclared}"> <div class="table-cell col1" [ngClass]="{'filtered':property.name === propertyNameSearchText}" [class.round-checkbox]="property.isDeclared"> <div class="property-name"> - <checkbox [(checked)]="property.isSelected" + <checkbox *ngIf="hasDeclareOption" [(checked)]="property.isSelected" [disabled]="property.isDisabled || property.isDeclared || readonly" - (checkedChange)="propertyChecked(property)"></checkbox> + (checkedChange)="propertyChecked(property)" [attr.data-tests-id]="property.name"></checkbox> <div class="inner-cell-div" tooltip="{{property.name}}"> <span>{{property.name}}</span> </div> </div> <span *ngIf="property.description" class="property-description-icon sprite-new show-desc" tooltip="{{property.description}}" tooltipDelay="0"></span> </div> - <div class="table-cell col2"> + <div class="table-cell col2" *ngIf="!hidePropertyType"> <div class="inner-cell-div" tooltip="{{property.type | contentAfterLastDot}}"> <span>{{property.type | contentAfterLastDot}}</span> </div> </div> - <div class="table-cell col3"> + <div class="table-cell col3" *ngIf="!hidePropertyType"> <div *ngIf="property.schema && property.schema.property && property.schema.property.type" class="inner-cell-div" tooltip="{{property.schema.property.type | contentAfterLastDot}}"> <span>{{property.schema.property.type | contentAfterLastDot}}</span> </div> @@ -42,7 +42,8 @@ <!-- [ngClass]="{'filtered':property.name === propertyNameSearchText}" (selectProperty)="propertySelected(property, $event, flatProperty.propertiesName)" [propType]="property.type" [propSchema]="property.schema" [propKey]="" [propValue]="property.value"--> <dynamic-property [selectedPropertyId]="selectedPropertyId" - [canBeDeclared]="true" + [hasDeclareOption]="hasDeclareOption" + [canBeDeclared]="hasDeclareOption && true" [property]="property" [expandedChildId]="property.expandedChildPropertyId" [propertyNameSearchText]="propertyNameSearchText" @@ -56,7 +57,6 @@ </div> </div> - </ng-container> </div> @@ -1,5 +1,5 @@ -@import './../../../../assets/styles/variables.less'; -@import '../../../../assets/styles/sprite'; +@import './../../../../../assets/styles/variables.less'; +@import '../../../../../assets/styles/sprite'; @smaller-screen: ~"only screen and (max-width: 1580px)"; :host /deep/ input { width:100%;} @@ -43,6 +43,7 @@ flex-direction: column; overflow-y:auto; flex: 1; + background-color: @main_color_p; .no-data { border: #d2d2d2 solid 1px; @@ -55,13 +56,25 @@ background-color: #e6f6fb; color: #009fdb; } + &.view-mode{ + /deep/ .dynamic-property-row:not(.selected){ + background-color:#f8f8f8; + } + } .table-row { display: flex; flex-direction:row; flex: 0 0 auto; + &.readonly{ + background-color: #f8f8f8; + cursor: auto; + } &:hover:not(.selected){ background-color:#f8f8f8; cursor:pointer; + /deep/ .dynamic-property-row:not(.selected){ + background-color:#f8f8f8; cursor:pointer; + } } .selected-row { @@ -100,7 +113,8 @@ .property-name { flex: 1; display: flex; - max-width: 90%; + overflow: hidden; + //max-width: 90%; fix bug 327139 } .property-description-icon { @@ -18,11 +18,9 @@ * ============LICENSE_END========================================================= */ -import { Component, Input, Output, EventEmitter, SimpleChanges, ViewChild, ElementRef } from "@angular/core"; -import {PropertyFEModel, DerivedFEProperty, DerivedPropertyType, InstanceFePropertiesMap} from "app/models"; -import {PropertiesService} from "../../services/properties.service"; -import { DynamicElementComponent } from 'app/ng2/components/dynamic-element/dynamic-element.component'; -import { KeysPipe } from 'app/ng2/pipes/keys.pipe'; +import { Component, Input, Output, EventEmitter} from "@angular/core"; +import {PropertyFEModel, DerivedFEProperty, InstanceFePropertiesMap} from "app/models"; +import {PropertiesService} from "../../../services/properties.service"; @Component({ selector: 'properties-table', @@ -34,24 +32,25 @@ export class PropertiesTableComponent { @Input() fePropertiesMap: InstanceFePropertiesMap; @Input() feInstanceNamesMap: Map<string, string>; @Input() selectedPropertyId: string; - @Input() displayDeleteButton: boolean; @Input() propertyNameSearchText:string; @Input() searchTerm:string; @Input() readonly:boolean; @Input() isLoading:boolean; + @Input() hasDeclareOption:boolean; + @Input() hidePropertyType:boolean; @Output() valueChanged: EventEmitter<any> = new EventEmitter<any>(); @Output() selectPropertyRow: EventEmitter<PropertyRowSelectedEvent> = new EventEmitter<PropertyRowSelectedEvent>(); - @Output() updateCheckedPropertyCount: EventEmitter<boolean> = new EventEmitter<boolean>(); - //@Output() selectInstanceRow: EventEmitter<string> = new EventEmitter<string>(); + @Output() updateCheckedPropertyCount: EventEmitter<boolean> = new EventEmitter<boolean>();//only for hasDeclareOption - - constructor ( private propertiesService:PropertiesService ){ + constructor (private propertiesService:PropertiesService ){ + } + + ngOnInit() { } - propValueChanged = (property) => { - !property.isDeclared && this.valueChanged.emit(property); + this.valueChanged.emit(property); }; // Click on main row (row of propertyFEModel) @@ -0,0 +1,29 @@ +import {NgModule} from "@angular/core"; +import {PropertiesTableComponent} from "./properties-table.component"; +import {DynamicPropertyComponent} from "./dynamic-property/dynamic-property.component"; +import {FormsModule} from "@angular/forms"; +import {UiElementsModule} from "../../ui/ui-elements.module"; +import {CommonModule} from "@angular/common"; +import {HttpModule} from "@angular/http"; +import {FilterChildPropertiesPipe} from "./pipes/filterChildProperties.pipe"; +import {GlobalPipesModule} from "../../../pipes/global-pipes.module"; +import {PropertiesService} from "../../../services/properties.service"; + +@NgModule({ + imports: [ + FormsModule, + HttpModule, + CommonModule, + GlobalPipesModule, + UiElementsModule + ], + declarations: [ + FilterChildPropertiesPipe, + DynamicPropertyComponent, + PropertiesTableComponent + ], + exports: [PropertiesTableComponent], + providers: [FilterChildPropertiesPipe, PropertiesService] +}) +export class PropertyTableModule { +}
\ No newline at end of file @@ -0,0 +1,77 @@ +@import './../../../../../assets/styles/variables.less'; +@import './../../../../../assets/styles/mixins.less'; +.main-container{ + color: @main_color_m; +} +.select-req-or-cap-span { + float: left; + margin-right: 15px; + font-size: 13px; +} +.select-type-label{ + .m_12_m; + margin-bottom: 2px; +} +.select-type{ + display: flex; + margin-bottom: 10px; + ui-element-dropdown{ + width: 40%; + font-size: 13px; + /deep/ select{ + height: 31px; + } + } +} +.table-and-list-container{ + display: flex; + padding-top: 10px; + .inner-container{ + height: 300px; + overflow-y: auto; + border: @main_color_o solid 1px; + } + .inner-container:not(:last-of-type){ + border-right: none; + } + .requirements-or-capabilities-container { + width: 40%; + &.empty-list{ + background-color: @tlv_color_t; + text-align: center; + &:before{ + content: 'Select "type" above'; + line-height: 298px; + } + } + .req-or-cap-item{ + border-bottom: @main_color_o solid 1px; + padding: 10px; + font-size: 13px; + &:hover:not(.selected){ + background-color:@tlv_color_t; cursor:pointer; + } + } + } + .properties-table-container{ + width: 60%; + display: flex; + &.cap-selected{ + background-color: @tlv_color_t; + border: @main_color_a solid 1px; + -webkit-box-shadow: inset 8px -2px 7px -9px rgba(84,84,84,1); + -moz-box-shadow: inset 8px -2px 7px -9px rgba(84,84,84,1); + box-shadow: inset 8px -2px 7px -9px rgba(84,84,84,1); + } + properties-table{ + margin: 15px; + width: 100%; + } + } +} + +.selected{ + color: @main_color_a; + background-color: @tlv_color_v; + border-left: @main_color_a solid 4px; +}
\ No newline at end of file @@ -0,0 +1,36 @@ +<div class="main-container"> + <span class="select-req-or-cap-span">Select:</span><radio-buttons + [(value)]="selectedReqOrCapOption" + [options]="selectOptions" + [readonly]="disabledSelectReqOrCapOption" + [direction]="'horizontal'" + (valueChange)="onSelectRequirementOrCapability($event)"> + +</radio-buttons> + <label class="select-type-label">Select type:</label> + <div class="select-type"> + <ui-element-dropdown [values]="types" [(value)]="selectedType" (valueChange)="onTypeSelected($event)"></ui-element-dropdown> + </div> + + <div class="table-and-list-container"> + <div class="inner-container requirements-or-capabilities-container" [ngClass]="{'empty-list':!selectedType}"> + <div *ngFor="let item of displayCapReqListFilterByType" + class="req-or-cap-item" + (click)="selectReqOrCapFromList(item)" + [ngClass]="{'selected':selectedReqOrCapModel && (item.uniqueId + item.ownerId + item.name) == (selectedReqOrCapModel.uniqueId + selectedReqOrCapModel.ownerId + selectedReqOrCapModel.name)}"> + {{item.getFullTitle()}} + </div> + </div> + <div class="inner-container properties-table-container" *ngIf="selectedReqOrCapOption == 'Capability'" [ngClass]="{'cap-selected':selectedReqOrCapModel}"> + <properties-table *ngIf="selectedReqOrCapModel" + class="properties-table" + [readonly]="true" + [fePropertiesMap]="capabilityProperties" + [selectedPropertyId]="''" + [hidePropertyType]="true"> + </properties-table> + </div> + + </div> +</div> + @@ -0,0 +1,182 @@ +/** + * Created by rc2122 on 9/4/2017. + */ +import {Component, EventEmitter, Input, OnInit, Output, SimpleChanges} from '@angular/core'; +import {RadioButtonModel, Match, PropertyModel, InstanceFePropertiesMap, Component as ComponentModel} from "app/models"; +import {Dictionary} from "lodash"; +import {DropdownValue} from "../../ui/form-components/dropdown/ui-element-dropdown.component"; +import {ComponentInstanceServiceNg2} from "../../../services/component-instance-services/component-instance.service"; +import {PropertiesUtils} from "app/ng2/pages/properties-assignment/services/properties.utils"; +import {Requirement} from "../../../../models/requirement"; +import {Capability, RequirementCapabilityModel} from "../../../../models/capability"; + +const REQUIREMENT = 'Requirement'; +const CAPABILITY = 'Capability'; + +@Component({ + selector: 'select-requirement-or-capability', + templateUrl: './select-requirement-or-capability.component.html', + styleUrls: ['./select-reqiurement-or-capability.component.less'] +}) + +export class SelectRequirementOrCapabilityComponent implements OnInit { + + + @Input() optionalRequirementsMap:Dictionary<Requirement[]>; //optional requirement map - key is type, value is array of requirements + @Input() optionalCapabilitiesMap:Dictionary<Capability[]>; //optional capabilities map - key is type, value is array of capabilities + + @Input() selectedReqOrCapOption:string; // the selection value chosen by the user (options: requirement / capability ) + + @Input() currentComponent:ComponentModel; + @Input() componentInstanceId:string; + + @Input() selectedReqOrCapModel:RequirementCapabilityModel; + + @Output() updateSelectedReqOrCap:EventEmitter<RequirementCapabilityModel> = new EventEmitter<RequirementCapabilityModel>(); + @Output() updateCapabilityProperties:EventEmitter<Array<PropertyModel>> = new EventEmitter<Array<PropertyModel>>(); + + types:Array<string> = []; + selectedType:string; + + selectOptions:Array<RadioButtonModel>; + + requirementsTypes:Array<string> = []; + capabilitiesTypes:Array<string> = []; + + disabledSelectReqOrCapOption: boolean; // If we need to disable the option to choose requirement or capability + displayCapReqListFilterByType:RequirementCapabilityModel[]; + + capabilityProperties:InstanceFePropertiesMap; + + constructor(private componentInstanceServiceNg2:ComponentInstanceServiceNg2, + private propertiesUtils:PropertiesUtils) { + this.selectOptions = [new RadioButtonModel(REQUIREMENT, REQUIREMENT), new RadioButtonModel(CAPABILITY, CAPABILITY)]; + } + + private initDefaultReqOrCapSelection = (): void => { + if(this.selectedReqOrCapOption){//for second step + this.disabledSelectReqOrCapOption = true; + } + if (this.selectedReqOrCapModel) {//init when there is selected req or cap + if (this.selectedReqOrCapModel instanceof Capability) { + this.selectedReqOrCapOption = this.selectOptions[1].value; + this.selectedType = this.selectedReqOrCapModel.type; + } else { + this.selectedReqOrCapOption = this.selectOptions[0].value; + this.selectedType = (<Requirement>this.selectedReqOrCapModel).capability; + } + } + if(Object.keys(this.optionalCapabilitiesMap).length === 0) { // If instance don't have capabilities + this.disabledSelectReqOrCapOption = true; + this.selectedReqOrCapOption = this.selectOptions[0].value; + } else if(Object.keys(this.optionalRequirementsMap).length === 0) { // If instance don't have requirements + this.disabledSelectReqOrCapOption = true; + this.selectedReqOrCapOption = this.selectOptions[1].value; + } + this.selectedReqOrCapOption = this.selectedReqOrCapOption || this.selectOptions[1].value; + this.types = this.selectedReqOrCapOption == this.selectOptions[0].value ? this.requirementsTypes : this.capabilitiesTypes; + setTimeout(() => { + if (this.selectedType) { + this.initCapReqListFilterByType(); + } else { + this.setDefaultValueType(); + } + }); + } + + initCapabilityPropertiesTable = ():void => { + if(this.selectedReqOrCapModel instanceof Capability ) { + let selectedCapability = <Capability>this.selectedReqOrCapModel; + if(selectedCapability.properties){ + this.capabilityProperties = this.propertiesUtils.convertPropertiesMapToFEAndCreateChildren({ CAPABILITY : selectedCapability.properties}, false); + } + } + } + + ngOnChanges(changes:SimpleChanges) { + if (changes.selectedReqOrCapModel) { + if (this.selectedReqOrCapModel && this.selectedReqOrCapOption === CAPABILITY) { + this.setCapabilityProperties(); + } + } + } + + ngOnInit() { + this.initTypesList(); + this.initDefaultReqOrCapSelection(); + this.initCapabilityPropertiesTable(); + } + + private initTypesList = ():void => { + this.requirementsTypes = _.keys(this.optionalRequirementsMap); + this.requirementsTypes.unshift('All'); + this.capabilitiesTypes = _.keys(this.optionalCapabilitiesMap); + this.capabilitiesTypes.unshift('All'); + } + + private fillInDisplayCapReqListFilterByType = (allOptionalTypesMap:Dictionary<RequirementCapabilityModel[]>):void => { + if(this.selectedType === 'All'){ + this.displayCapReqListFilterByType = []; + _.map(allOptionalTypesMap,(reqOrCapArray:RequirementCapabilityModel[])=>{ + this.displayCapReqListFilterByType = this.displayCapReqListFilterByType.concat(reqOrCapArray); + }) + }else{ + this.displayCapReqListFilterByType = allOptionalTypesMap[this.selectedType]; + } + + // automatically select a *single* requirement or capability: + if (this.displayCapReqListFilterByType.length === 1) { + const selectedReqCap:RequirementCapabilityModel = this.displayCapReqListFilterByType[0]; + this.selectReqOrCapFromList((this.selectedType === CAPABILITY) ? <Capability>selectedReqCap : <Requirement>selectedReqCap); + } + } + + private initCapReqListFilterByType = ():void => { + if (this.selectedReqOrCapOption === CAPABILITY) { + this.fillInDisplayCapReqListFilterByType(this.optionalCapabilitiesMap); + } else { + this.fillInDisplayCapReqListFilterByType(this.optionalRequirementsMap); + } + } + + private onTypeSelected = ():void => { + this.initCapReqListFilterByType(); + if (this.displayCapReqListFilterByType.indexOf(this.selectedReqOrCapModel) === -1) { + this.selectReqOrCapFromList(null); + } + } + + private setDefaultValueType = ():void =>{ + // automatically select a *single* type from the list: + this.selectedType = (this.types.length === 2) ? this.types[1] : this.types[0]; + this.initCapReqListFilterByType(); + } + + private onSelectRequirementOrCapability = ():void => { + this.types = this.selectedReqOrCapOption === REQUIREMENT ? this.requirementsTypes : this.capabilitiesTypes; + this.selectReqOrCapFromList(null); + this.setDefaultValueType(); + } + + private selectReqOrCapFromList = (selected:Requirement|Capability):void => { + if (this.selectedReqOrCapModel !== selected) { + this.selectedReqOrCapModel = selected; + this.updateSelectedReqOrCap.emit(selected); + } + } + + + private setCapabilityProperties = ():void => { + let selectedCapability = <Capability>this.selectedReqOrCapModel; + if (selectedCapability.properties === undefined) { + this.componentInstanceServiceNg2.getInstanceCapabilityProperties(this.currentComponent, this.componentInstanceId, selectedCapability.type, selectedCapability.name) + .subscribe((response:Array<PropertyModel>) => { + this.capabilityProperties = (response && response.length) ? this.propertiesUtils.convertPropertiesMapToFEAndCreateChildren({CAPABILITY : response}, false) : null; + this.updateCapabilityProperties.emit(response); + }, error => {}); + }else{ + this.capabilityProperties = this.propertiesUtils.convertPropertiesMapToFEAndCreateChildren({CAPABILITY : selectedCapability.properties}, false); + this.updateCapabilityProperties.emit(selectedCapability.properties); + } + } +} @@ -0,0 +1,24 @@ +import {NgModule} from "@angular/core"; +import {SelectRequirementOrCapabilityComponent} from "./select-requirement-or-capability.component"; +import {FormsModule} from "@angular/forms"; +import {FormElementsModule} from "../../ui/form-components/form-elements.module"; +import {CommonModule} from "@angular/common"; +import {GlobalPipesModule} from "app/ng2/pipes/global-pipes.module"; +import {PropertyTableModule} from "../properties-table/property-table.module"; + +@NgModule({ + declarations: [ + SelectRequirementOrCapabilityComponent + ], + imports: [ + CommonModule, + FormsModule, + FormElementsModule, + GlobalPipesModule, + PropertyTableModule], + + exports: [SelectRequirementOrCapabilityComponent], + providers: [] +}) +export class SelectRequirementOrCapabilityModule { +}
\ No newline at end of file @@ -1,128 +0,0 @@ -@import '../../../../assets/styles/variables'; -@import '../../../../assets/styles/mixins'; -@import '../../../../assets/styles/sprite-old'; -/deep/ modal { - display: none; - - .custom-modal { - position: fixed; - top: 0; - right: 0; - bottom: 0; - left: 0; - z-index: 1000; - overflow: auto; - margin: auto; - display: flex; - align-items: center; - - .ng2-modal-content { - background: #fff; - width: 100%; - box-shadow: 0 5px 15px rgba(0,0,0,.5); - border-radius: 4px; - .ng2-modal-body{ - padding: 20px; - } - - .ng2-modal-header{ - .m_18_m; - font-weight: bold; - -webkit-box-flex: 1; - -ms-flex-positive: 1; - flex-grow: 1; - height: 50px; - line-height: 50px; - display: -webkit-box; - display: -ms-flexbox; - display: flex; - text-align: left; - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - margin: 0px 20px; - - &.modal-type-standard { - border-bottom: solid 3px @main_color_a; - } - - &.modal-type-error { - border-bottom: solid 3px @func_color_q; - } - - &.modal-type-alert{ - border-bottom: solid 3px @main_color_h; - } - - .title{ - .s_18_m; - -webkit-box-flex: 999; - -ms-flex-positive: 999; - flex-grow: 999; - } - .close-button{ - .sprite; - .sprite.x-btn-black; - cursor: pointer; - } - } - - .ng2-modal-footer{ - background-color: @tlv_color_t; - padding: 17px 30px; - clear: both; - -webkit-box-flex: 1; - -ms-flex-positive: 1; - flex-grow: 1; - display: -webkit-box; - display: -ms-flexbox; - display: flex; - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - -webkit-box-pack: end; - -ms-flex-pack: end; - justify-content: flex-end; - border-radius: 4px; - button{ - margin: 0 12px 0 6px; - } - } - } - } - - .modal-background { - position: fixed; - top: 0; - right: 0; - bottom: 0; - left: 0; - background-color: #000; - opacity: 0.5; - z-index: 900; - } -} - -.xl { - width: 1200px; -} - -.l { - width: 875px; -} - -.md { - width: 650px; -} - -.sm { - width: 552px; -} - -.xsm { - width: 432px; -} - -body.modal-open { - overflow: hidden; -} @@ -18,13 +18,13 @@ * ============LICENSE_END========================================================= */ -import { Component, Compiler, EventEmitter, ViewContainerRef, ViewChild, Input, Output, ElementRef, ComponentRef, ComponentFactory, ComponentFactoryResolver } from '@angular/core' -import { UiElementCheckBoxComponent } from './elements-ui/checkbox/ui-element-checkbox.component'; -import { UiElementDropDownComponent, DropdownValue } from './elements-ui/dropdown/ui-element-dropdown.component'; -import { UiElementInputComponent } from './elements-ui/input/ui-element-input.component'; -import {UiElementPopoverInputComponent} from "./elements-ui/popover-input/ui-element-popover-input.component"; +import { Component, Compiler, EventEmitter, ViewContainerRef, ViewChild, Input, Output, ElementRef, ComponentRef, ComponentFactoryResolver } from '@angular/core' import {ValidationConfiguration} from "app/models"; -import {UiElementIntegerInputComponent} from "./elements-ui/integer-input/ui-element-integer-input.component"; +import {UiElementInputComponent} from "../form-components/input/ui-element-input.component"; +import {UiElementPopoverInputComponent} from "../form-components/popover-input/ui-element-popover-input.component"; +import {UiElementIntegerInputComponent} from "../form-components/integer-input/ui-element-integer-input.component"; +import {UiElementDropDownComponent, DropdownValue} from "../form-components/dropdown/ui-element-dropdown.component"; +import {PROPERTY_DATA} from "../../../../utils/constants"; @Component({ selector: 'dynamic-element', @@ -33,7 +33,6 @@ import {UiElementIntegerInputComponent} from "./elements-ui/integer-input/ui-ele entryComponents: [ UiElementInputComponent, UiElementDropDownComponent, - UiElementCheckBoxComponent, UiElementPopoverInputComponent, UiElementIntegerInputComponent ] @@ -72,33 +71,30 @@ export class DynamicElementComponent { } // Factory to create component based on type or peroperty name. - switch(this.type) { - case 'list': - case 'integer': + switch(true) { + case this.path && this.path.toUpperCase().indexOf("SUBNETPOOLID") !== -1: + if(this.name.toUpperCase().indexOf("SUBNETPOOLID") == -1){//if it's an item of subnetpoolid list get the parent name + let pathArray = this.path.split("#"); + this.name = pathArray[pathArray.length - 2]; + } + this.createComponent(UiElementPopoverInputComponent); + break; + case this.type == 'integer': this.createComponent(UiElementIntegerInputComponent); this.cmpRef.instance.pattern = this.validation.validationPatterns.integer; break; - case 'string': - if (this.path && this.path.toUpperCase().indexOf("SUBNETPOOLID") !== -1) { - if(this.name.toUpperCase().indexOf("SUBNETPOOLID") == -1){//if it's an item of subnetpoolid list get the parent name - let pathArray = this.path.split("#"); - this.name = pathArray[pathArray.length - 2]; - } - this.createComponent(UiElementPopoverInputComponent); - } - else { - this.createComponent(UiElementInputComponent); - } + case PROPERTY_DATA.SCALAR_TYPES.indexOf(this.type) > -1: + case this.type == 'string': + this.createComponent(UiElementInputComponent); break; - case 'boolean': - //this.createComponent(UiElementCheckBoxComponent); + case this.type == 'boolean': this.createComponent(UiElementDropDownComponent); // Build drop down values let tmp = []; - tmp.push(new DropdownValue('true','TRUE')); - tmp.push(new DropdownValue('false','FALSE')); + tmp.push(new DropdownValue(true,'TRUE')); + tmp.push(new DropdownValue(false,'FALSE')); this.cmpRef.instance.values = tmp; break; default: @@ -131,7 +127,6 @@ export class DynamicElementComponent { } ngAfterContentInit() { - //console.log("DynamicElementComponent: ngAfterContentInit: type: " + this.type + " value: " + this.value); this.isViewInitialized = true; this.updateComponent(); } @@ -19,32 +19,19 @@ */ import { NgModule } from "@angular/core"; -import { UiElementCheckBoxComponent } from './elements-ui/checkbox/ui-element-checkbox.component'; -import { UiElementDropDownComponent } from './elements-ui/dropdown/ui-element-dropdown.component'; -import { UiElementInputComponent } from './elements-ui/input/ui-element-input.component'; -import { DynamicElementComponent } from "app/ng2/components/dynamic-element/dynamic-element.component"; -import { BrowserModule } from '@angular/platform-browser' -import { FormsModule, ReactiveFormsModule } from '@angular/forms' -import { UiElementPopoverInputComponent } from "./elements-ui/popover-input/ui-element-popover-input.component"; import {PopoverModule} from "../popover/popover.module"; import {TooltipModule} from "../tooltip/tooltip.module"; -import {UiElementIntegerInputComponent} from "./elements-ui/integer-input/ui-element-integer-input.component"; +import {DynamicElementComponent} from "./dynamic-element.component"; +import {FormElementsModule} from "../form-components/form-elements.module"; @NgModule({ declarations: [ DynamicElementComponent, - UiElementInputComponent, - UiElementCheckBoxComponent, - UiElementDropDownComponent, - UiElementPopoverInputComponent, - UiElementIntegerInputComponent ], imports: [ - BrowserModule, - FormsModule, PopoverModule, - ReactiveFormsModule, - TooltipModule + TooltipModule, + FormElementsModule ], exports: [ DynamicElementComponent @@ -1,5 +1,5 @@ - @import '../../../../assets/styles/tlv-sprite'; -@import '../../../../assets/styles/sprite'; + @import '../../../../../../assets/styles/tlv-sprite'; +@import '../../../../../../assets/styles/sprite'; .checkbox-container { @@ -0,0 +1,3 @@ +<select name='{{name}}' [(ngModel)]="value" (change)="onSave()" [ngClass]="{'disabled':readonly}" data-tests-id="SelectType"> + <option *ngFor="let ddvalue of values" [ngValue]="ddvalue.label != undefined ? ddvalue.value : ddvalue">{{ddvalue.label||ddvalue}}</option> +</select> @@ -18,15 +18,14 @@ * ============LICENSE_END========================================================= */ -import { Component, EventEmitter, Output, Input } from '@angular/core' -import { BrowserModule } from '@angular/platform-browser' +import {Component, EventEmitter, Output, Input} from '@angular/core' import { UiElementBase, UiElementBaseInterface } from './../ui-element-base.component'; export class DropdownValue { - value:string; + value:any; label:string; - constructor(value:string,label:string) { + constructor(value:any,label:string) { this.value = value; this.label = label; } @@ -37,16 +36,16 @@ export class DropdownValue { templateUrl: './ui-element-dropdown.component.html', styleUrls: ['./ui-element-dropdown.component.less'], }) -export class UiElementDropDownComponent extends UiElementBase implements UiElementBaseInterface { +export class UiElementDropDownComponent extends UiElementBase implements UiElementBaseInterface { @Input() - values: DropdownValue[]; + values: DropdownValue[]|string[]; constructor() { super(); } onSave() { - this.baseEmitter.emit(JSON.parse(this.value)); + this.baseEmitter.emit(this.value); } } @@ -0,0 +1,42 @@ +/** + * Created by rc2122 on 9/5/2017. + */ +import {NgModule} from "@angular/core"; +import {BrowserModule} from "@angular/platform-browser"; +import {FormsModule, ReactiveFormsModule} from "@angular/forms"; +import {UiElementPopoverInputComponent} from "./popover-input/ui-element-popover-input.component"; +import {UiElementIntegerInputComponent} from "./integer-input/ui-element-integer-input.component"; +import {UiElementInputComponent} from "./input/ui-element-input.component"; +import {UiElementDropDownComponent} from "./dropdown/ui-element-dropdown.component"; +import {UiElementBase} from "./ui-element-base.component"; +import {CheckboxModule} from "./checkbox/checkbox.module"; +import {RadioButtonComponent} from "./radio-buttons/radio-buttons.component"; +import {PopoverModule} from "../popover/popover.module"; +import {TooltipModule} from "../tooltip/tooltip.module"; + + +@NgModule({ + imports: [ + BrowserModule, + FormsModule, + PopoverModule, + ReactiveFormsModule, + TooltipModule, + CheckboxModule], + + declarations: [UiElementDropDownComponent, + UiElementInputComponent, + UiElementIntegerInputComponent, + UiElementPopoverInputComponent, + UiElementBase, + RadioButtonComponent], + + exports: [UiElementDropDownComponent, + UiElementInputComponent, + UiElementIntegerInputComponent, + UiElementPopoverInputComponent, + RadioButtonComponent, + TooltipModule, + CheckboxModule] +}) +export class FormElementsModule { }
\ No newline at end of file @@ -1,6 +1,6 @@ <input class="value-input" - [ngClass]="{'error': control.invalid}" + [ngClass]="{'error': control.invalid, 'disabled':readonly}" type="text" [name]="name" [(ngModel)]="value" @@ -11,5 +11,4 @@ [formControl]="control" tooltip="{{value}}" [readonly]="readonly" - [ngClass]="{'disabled':readonly}" /> @@ -1,6 +1,6 @@ <input class="value-input" - [ngClass]="{'error': control.invalid}" + [ngClass]="{'error': control.invalid, 'disabled':readonly}" type="text" [name]="name" [(ngModel)]="value" @@ -11,5 +11,4 @@ [formControl]="control" tooltip="{{value}}" [readonly]="readonly" - [ngClass]="{'disabled':readonly}" /> @@ -30,7 +30,7 @@ import { UiElementBase, UiElementBaseInterface } from './../ui-element-base.comp export class UiElementIntegerInputComponent extends UiElementBase implements UiElementBaseInterface { constructor() { super(); - this.pattern = this.validation.validationPatterns.comment; + //this.pattern = this.validation.validationPatterns.comment; } onSave() { @@ -19,10 +19,9 @@ */ import {Component, ViewChild, ElementRef, Input} from '@angular/core'; -import {UiElementBase, UiElementBaseInterface} from "../ui-element-base.component"; import {ButtonsModelMap, ButtonModel} from "app/models"; -import { PopoverContentComponent } from "app/ng2/components/popover/popover-content.component" -import { PopoverComponent } from "app/ng2/components/popover/popover.component" +import {PopoverContentComponent} from "../../popover/popover-content.component"; +import {UiElementBase, UiElementBaseInterface} from "../ui-element-base.component"; @Component({ selector: 'ui-element-popover-input', @@ -0,0 +1,42 @@ +@import './../../../../../../assets/styles/variables.less'; +.radio-buttons-container{ + display: flex; + &.vertical{ + flex-direction: column; + } + &.horizontal{ + flex-direction: row; + } +} +.radio-button { + margin: 0 10px 10px 0; + display: flex; +} + +input[type=radio] { + width:0; + height:0; + display:none; + &[disabled] ~ .radio-button { + + } +} + +.shown-radio-button{ + border: @main_color_n solid 1px; + height: 14px; + width: 14px; + border-radius: 50%; + padding: 1px; + margin: auto 5px; + .selected{ + background-color: @main_color_a; + height: 100%; + width: 100%; + border-radius: 50%; + } +} +span{ + margin: auto 0; + color: @func_color_s; +} @@ -0,0 +1,8 @@ +<div class="radio-buttons-container {{direction}}"> + <div *ngFor="let option of options" class="radio-button" [ngClass]="{'disabled':readonly}"> + <input type="radio" [(ngModel)]="value" name="{{fieldName}}" value="{{option.value}}" [disabled]="readonly"/> + <div class="shown-radio-button" (click)="!readonly && select(option.value)"><div *ngIf="value==option.value" class="selected"></div></div> + <span>{{option.key}}</span> + </div> +</div> + @@ -0,0 +1,29 @@ +/** + * Created by rc2122 on 9/4/2017. + */ +import { Component, Input, Output, EventEmitter, ViewEncapsulation } from '@angular/core'; +import { RadioButtonModel } from 'app/models' +import {UiElementBaseInterface, UiElementBase} from "../ui-element-base.component"; + +@Component({ + selector: 'radio-buttons', + templateUrl: './radio-buttons.component.html', + styleUrls: ['./radio-button.component.less'] +}) +export class RadioButtonComponent extends UiElementBase implements UiElementBaseInterface { + + onSave() { + this.baseEmitter.emit(this.value); + } + + @Input() options:Array<RadioButtonModel>; + @Input() readonly:boolean; + @Input() direction:string = 'vertical'; //get 'horizontal' | 'vertical' + value:any; + + select(value:any) { + this.value = value; + this.baseEmitter.emit(this.value); + } +} + @@ -41,11 +41,11 @@ export class UiElementBase { this.value = value; } - protected name: string; - protected type: string; - protected value: any; - protected pattern: any; - protected readonly:boolean; + @Input() name: string; + @Input() type: string; + @Input() value: any; + @Input() pattern: any; + @Input() readonly:boolean; constructor() { //this.control = new FormControl('', [Validators.required]); @@ -1,4 +1,4 @@ -@import '../../../../assets/styles/variables'; +@import '../../../../../assets/styles/variables'; .tlv-loader-back { background-color: @main_color_p; position: fixed; @@ -0,0 +1,3 @@ +<div class="w-sdc-menu-item" [ngClass]="styleClass" (click)="performAction()"> + <ng-content></ng-content> +</div> @@ -0,0 +1,13 @@ +@import "../../../../../assets/styles/variables"; + +.w-sdc-menu-item { + font-size: 14px; + line-height: 14px; + color: @main_color_m; + padding: 3px 6px; + + &:hover { + cursor: pointer; + background-color: @main_color_c; + } +}
\ No newline at end of file @@ -7,9 +7,9 @@ * 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. @@ -18,30 +18,27 @@ * ============LICENSE_END========================================================= */ -import { Component, ViewChild, ElementRef, ContentChildren, Input } from '@angular/core'; -import { BrowserModule } from '@angular/platform-browser' -import { UiElementBase, UiElementBaseInterface } from './../ui-element-base.component'; +import { Component, Input, Output, EventEmitter } from '@angular/core'; @Component({ - selector: 'ui-element-checkbox', - templateUrl: './ui-element-checkbox.component.html', - styleUrls: ['./ui-element-checkbox.component.less'], + selector: 'menu-item', + templateUrl: './menu-item.component.html', + styleUrls:['./menu-item.component.less'] }) -export class UiElementCheckBoxComponent extends UiElementBase implements UiElementBaseInterface { +export class MenuItemComponent { + @Input() action:Function; + @Input() styleClass:any; - constructor() { - super(); - } + public parentMenu:any; - ngAfterContentInit() { - // Convert the value to boolean (instanceOf does not work, the type is undefined). - if (this.value==='true' || this.value==='false') { - this.value = this.value==='true'?true:false; + constructor() { } - } - onSave() { - this.baseEmitter.emit(this.value); - } + performAction() { + this.action(); + if (this.parentMenu && typeof(this.parentMenu.close) === 'function') { + this.parentMenu.close(); + } + } } @@ -0,0 +1,9 @@ +<div + class="w-sdc-menu-list" + *ngIf="isOpen" + [ngClass]="styleClass" + [ngStyle]="{'left': position?.x || 0, 'top': position?.y || 0}"> + + <ng-content></ng-content> + +</div> @@ -0,0 +1,13 @@ +.w-sdc-menu-list { + position: fixed; + z-index: 100; + + border-style: solid; + border-width: 1px; + border-color: #d8d8d8; + box-sizing: border-box; + background-color: #ffffff; + box-shadow: 0px 2px 2px 0px rgba(24, 24, 25, 0.1); + width: 91px; + padding: 6px 0; +} @@ -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========================================================= + */ + +import { Component, Input, ContentChildren, SimpleChanges, QueryList } from '@angular/core'; +import { MenuItemComponent } from "./menu-item.component"; +import { Point } from "app/models"; + +@Component({ + selector: 'menu-list', + templateUrl: './menu-list.component.html', + styleUrls:['./menu-list.component.less'] +}) +export class MenuListComponent { + @Input('open') inputOpen:boolean = false; + @Input('position') inputPosition:Point = new Point(); + @Input() styleClass:any; + + @ContentChildren(MenuItemComponent) menuItems:QueryList<MenuItemComponent>; + + private position:Point; + private isOpen:boolean = false; + + constructor() { + } + + ngOnChanges(changes:SimpleChanges) { + if (changes.inputOpen) { + (changes.inputOpen.currentValue) ? this.open() : this.close(); + } + if (changes.inputPosition) { + this.changePosition(changes.inputPosition.currentValue); + } + } + + ngAfterContentInit() { + this.menuItems.forEach((c) => c.parentMenu = this); + this.menuItems.changes.subscribe((list) => { + list.forEach((c) => c.parentMenu = this); + }); + } + + open(): void { + this.isOpen = true; + } + + close(): void { + this.isOpen = false; + } + + changePosition(position:Point) { + this.position = position; + } +} @@ -0,0 +1,27 @@ +import { NgModule } from "@angular/core"; +import { CommonModule } from '@angular/common'; +import { MenuListComponent } from "./menu-list.component"; +import { MenuItemComponent } from "./menu-item.component"; + +export { + MenuListComponent, + MenuItemComponent +}; + +@NgModule({ + declarations: [ + MenuListComponent, + MenuItemComponent + ], + imports: [CommonModule], + exports: [ + MenuListComponent, + MenuItemComponent + ], + entryComponents: [ //need to add anything that will be dynamically created + MenuListComponent, + MenuItemComponent + ] +}) +export class MenuListModule { +} @@ -13,6 +13,7 @@ <button *ngFor="let button of input.buttons" class="tlv-btn {{button.cssClass}}" [disabled] = "button.getDisabled && button.getDisabled()" + [attr.data-tests-id] = "button.text" (click) = "button.callback()">{{button.text}}</button> </div> </div> @@ -0,0 +1,129 @@ +@import '../../../../../assets/styles/variables'; +@import '../../../../../assets/styles/mixins'; +@import '../../../../../assets/styles/sprite-old'; +/deep/ modal { + display: none; +} + +.custom-modal { + position: fixed; + top: 0; + right: 0; + bottom: 0; + left: 0; + z-index: 15007; + overflow: auto; + margin: auto; + display: flex; + align-items: center; + + .ng2-modal-content { + background: #fff; + width: 100%; + box-shadow: 0 5px 15px rgba(0,0,0,.5); + border-radius: 4px; + .ng2-modal-body{ + padding: 20px; + } + + .ng2-modal-header{ + .m_18_r; + font-weight: bold; + -webkit-box-flex: 1; + -ms-flex-positive: 1; + flex-grow: 1; + height: 50px; + line-height: 50px; + display: -webkit-box; + display: -ms-flexbox; + display: flex; + text-align: left; + -webkit-box-align: center; + -ms-flex-align: center; + align-items: center; + margin: 0px 20px; + + &.modal-type-standard { + border-bottom: solid 3px @main_color_a; + } + + &.modal-type-error { + border-bottom: solid 3px @func_color_q; + } + + &.modal-type-alert{ + border-bottom: solid 3px @main_color_h; + } + + .title{ + .s_18_r; + -webkit-box-flex: 999; + -ms-flex-positive: 999; + flex-grow: 999; + } + .close-button{ + .sprite; + .sprite.x-btn-black; + cursor: pointer; + } + } + + .ng2-modal-footer{ + background-color: @tlv_color_t; + padding: 17px 30px; + clear: both; + -webkit-box-flex: 1; + -ms-flex-positive: 1; + flex-grow: 1; + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -webkit-box-align: center; + -ms-flex-align: center; + align-items: center; + -webkit-box-pack: end; + -ms-flex-pack: end; + justify-content: flex-end; + border-radius: 4px; + button{ + margin: 0 12px 0 6px; + } + } + } +} + +.modal-background { + position: fixed; + top: 0; + right: 0; + bottom: 0; + left: 0; + background-color: #000; + opacity: 0.5; + z-index: 900; +} + + +.xl { + width: 1200px; +} + +.l { + width: 875px; +} + +.md { + width: 650px; +} + +.sm { + width: 552px; +} + +.xsm { + width: 432px; +} + +body.modal-open { + overflow: hidden; +} @@ -1,8 +1,8 @@ import { NgModule } from "@angular/core"; import { CommonModule } from '@angular/common'; import { ModalService } from 'app/ng2/services/modal.service'; -import { ModalComponent } from "app/ng2/components/modal/modal.component"; import { ErrorMessageComponent } from "./error-message/error-message.component"; +import {ModalComponent} from "./modal.component"; @NgModule({ declarations: [ @@ -10,7 +10,7 @@ import { ErrorMessageComponent } from "./error-message/error-message.component"; ErrorMessageComponent ], imports: [CommonModule], - exports: [], + exports: [ModalComponent, ErrorMessageComponent], entryComponents: [ //need to add anything that will be dynamically created ModalComponent, ErrorMessageComponent @@ -0,0 +1,10 @@ +/** + * Created by rc2122 on 9/27/2017. + */ +import {Component, Input} from "@angular/core"; +@Component({ +}) +export class WizardHeaderBaseComponent { + + @Input() currentStepIndex:number; +} @@ -0,0 +1,57 @@ +<div class="custom-modal {{input.size}}"> + <div class="ng2-modal-content w-sdc-classic-top-line-modal"> + <div class="ng2-modal-header modal-type-{{input.type}}"> + <span class="title">{{ input.title }}</span> + <span class="close-button" (click)="close()"></span> + </div> + <div class="ng2-modal-body" > + <div class="multi-steps-wizard-component"> + <header> + <div class="steps-header"> + <div *ngFor="let step of steps; let i = index" class="step-title" [ngClass]="{'active':i == currentStepIndex}"> + <div class="title-text">{{step.title}}</div> + <div class="line"> + <div class="inner-line" [@displayLineAnimation]="i <= currentStepIndex && i!=0" [hidden]="!i || i > currentStepIndex"></div> + </div> + <div class="circle" [ngClass]="{'full-circle': i < currentStepIndex}"></div> + </div> + </div> + <div class="dynamic-header-container"> + <div #dynamicHeaderContainer></div> + </div> + </header> + <div #dynamicContentContainer></div> + </div> + </div> + + <div class="ng2-modal-footer"> + <button *ngFor="let button of input.buttons" + class="tlv-btn {{button.cssClass}}" + [disabled] = "button.getDisabled && button.getDisabled()" + (click) = "button.callback()">{{button.text}}</button> + <div class="navigation-buttons"> + <button (click)="prevStep()" + class="navigation-button tlv-btn outline blue" + [disabled]="dynamicContent.instance.preventBack()"> + <div class="navigation-icon sprite-new blue-arrow-back"></div> + Back + </button> + <button (click)="nextStep()" + *ngIf="currentStepIndex < (steps.length - 1)" + [disabled]="dynamicContent.instance.preventNext()" + class="navigation-button tlv-btn blue"> + Next + <div class="navigation-icon sprite-new white-arrow-next"></div> + </button> + <button (click)="callback();modalService.closeCurrentModal();" + *ngIf="currentStepIndex == (steps.length - 1)" + [disabled]="dynamicContent.instance.preventNext()" + class="tlv-btn blue"> + Finish + </button> + </div> + + </div> + </div> +</div> +<div class="modal-background"></div>
\ No newline at end of file @@ -0,0 +1,90 @@ +@import './../../../../../assets/styles/variables.less'; + +@circle_size: 13px; + +.custom-modal{ + font-family: @font-opensans-regular; +} + +/deep/ multi-steps-wizard { + display: none; +} + +.ng2-modal-header{ + border: none !important; +} + +.ng2-modal-body{ + padding-top: 0 !important; +} + +header{ + margin-bottom: 10px; + .dynamic-header-container{ + position: relative; + top: -9px; + } + .steps-header{ + display: flex; + .step-title{ + flex: 1; + .title-text{ + width: 100%; + text-align: center; + line-height: 40px; + background-color: @tlv_color_u; + font-size: 13px; + } + .line{ + width: calc(~'100% - @{circle_size}'); + position: relative; + left: calc(~'(100% - @{circle_size})/2 * (-1)'); + float: left; + height: 2px; + .inner-line{ + background-color: @main_color_a; + height: 100%; + } + } + .circle{ + margin:0 auto; + border: @main_color_o solid 1px; + height: @circle_size; + width: @circle_size; + border-radius: 50%; + position: relative; + top: -@circle_size/2; + background-color: @main_color_p; + z-index: 1; + } + .full-circle{ + border-color: @main_color_a; + background-color: @main_color_a; + } + &.active{ + color: @main_color_a; + font-family: @font-opensans-medium; + .circle{ + border-color: @main_color_a; + } + } + } + } +} + +.navigation-buttons{ + padding-left: 6px; + border-left: 1px solid @main_color_a; + .navigation-button{ + padding: 0 8px; + .navigation-icon{ + margin: 3px 0; + &.blue-arrow-back{ + float: left; + } + &.white-arrow-next{ + float: right; + } + } + } +} @@ -0,0 +1,78 @@ +/** + * Created by rc2122 on 8/15/2017. + */ +/*- + * ============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========================================================= + */ +import { + Component, ElementRef, forwardRef, Inject, Input, trigger, state, style, + transition, animate, ViewChild, ViewContainerRef, ComponentRef +} from "@angular/core"; +import {StepModel} from "app/models"; +import {ModalService} from "../../../services/modal.service"; +import {ModalComponent} from "../modal/modal.component"; +import {WizardHeaderBaseComponent} from "./multi-steps-wizard-header-base.component"; + + +@Component({ + selector: 'multi-steps-wizard', + templateUrl: './multi-steps-wizard.component.html', + styleUrls: ['./../modal/modal.component.less','./multi-steps-wizard.component.less'], + animations: [ + trigger('displayLineAnimation', [ + state('true', style({ + width: '100%', + })), + state('false', style({ + width:'0px', + })), + transition('* => *', animate('500ms')), + ]), + ], +}) +export class MultiStepsWizardComponent extends ModalComponent { + + @Input() steps:Array<StepModel>; + @Input() callback: Function; + @Input() data:any; + @Input() dynamicHeader: ComponentRef<WizardHeaderBaseComponent>; + + @ViewChild('dynamicHeaderContainer', { read: ViewContainerRef }) dynamicHeaderContainer: ViewContainerRef; + constructor(@Inject(forwardRef(() => ModalService)) public modalService: ModalService, el: ElementRef ) { + super(el); + } + + private currentStepIndex:number = 0; + + nextStep = ():void => { + if(this.currentStepIndex + 1 < this.steps.length){ + this.currentStepIndex++; + this.modalService.addDynamicContentToModal(this.modalService.currentModal, this.steps[this.currentStepIndex].component); + this.dynamicHeader.instance.currentStepIndex = this.currentStepIndex; + } + } + + prevStep = ():void => { + if(this.currentStepIndex > 0){ + this.currentStepIndex--; + this.modalService.addDynamicContentToModal(this.modalService.currentModal, this.steps[this.currentStepIndex].component); + this.dynamicHeader.instance.currentStepIndex = this.currentStepIndex; + } + } +}
\ No newline at end of file @@ -0,0 +1,22 @@ +/** + * Created by rc2122 on 8/15/2017. + */ +import { NgModule } from "@angular/core"; +import {MultiStepsWizardComponent} from "./multi-steps-wizard.component"; +import {CommonModule} from "@angular/common"; +import {ConnectionWizardModule} from "../../../pages/connection-wizard/connection-wizard.module"; + +@NgModule({ + declarations: [ + MultiStepsWizardComponent + ], + imports: [CommonModule + ], + exports: [], + entryComponents: [ + MultiStepsWizardComponent + ], + providers: [] +}) +export class MultiStepsWizardModule { +}
\ No newline at end of file @@ -1,6 +1,6 @@ -@import '../../../../assets/styles/variables'; -@import '../../../../assets/styles/mixins'; -@import '../../../../assets/styles/sprite-old'; +@import '../../../../../assets/styles/variables'; +@import '../../../../../assets/styles/mixins'; +@import '../../../../../assets/styles/sprite-old'; .popover .virtual-area { height: 11px; width: 100%; @@ -32,8 +32,6 @@ import {PopoverContentComponent} from "./popover-content.component"; PopoverContentComponent ], imports: [ - // PopoverComponent, - // PopoverContentComponent CommonModule ], exports: [ @@ -30,8 +30,7 @@ } .search-bar-button { - //background: url('../../../../assets/styles/svg/source/search-magnify.svg') no-repeat 50%; - background: url('../../../../assets/styles/images/sprites/sprite-global.png') no-repeat -206px -1275px; + background: url('../../../../../assets/styles/images/sprites/sprite-global.png') no-repeat -206px -1275px; background-color: rgba(234, 234, 234, 0.88); width: 30px; height: 30px; @@ -1,5 +1,4 @@ - -.search-with-autocomplete-container{ +.search-with-autocomplete-container{ &.autocomplete-visible { .search-bar-input { @@ -1,5 +1,5 @@ <div class="tabs {{tabStyle}}"> - <div class="tab" *ngFor="let tab of tabs" (click)="selectTab(tab)" [class.active]="tab.active"> + <div class="tab" *ngFor="let tab of tabs" (click)="selectTab(tab)" [class.active]="tab.active" [attr.data-tests-id]="tab.title"> {{tab.title}} <div class="tab-indication" *ngIf="tab.indication" [@indicatorAnimation]="tab.indication">{{tab.indication}}</div> </div> @@ -1,4 +1,4 @@ -@import '../../../../assets/styles/variables'; +@import '../../../../../assets/styles/variables'; tab { height: 100%; @@ -20,6 +20,7 @@ tab { flex: 1; width:100%; overflow-y:hidden; + overflow-x:hidden; } .tab-content { @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -import { Component, NgModule } from '@angular/core' +import { NgModule } from '@angular/core' import { BrowserModule } from '@angular/platform-browser' import { Tabs } from './tabs.component'; @@ -29,7 +29,6 @@ import {CommonModule} from "@angular/common"; TooltipContentComponent, ], imports: [ - CommonModule ], exports: [ TooltipComponent, @@ -0,0 +1,80 @@ +/*- + * ============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========================================================= + */ + +import { NgModule } from '@angular/core'; +import { NavbarModule } from "./navbar/navbar.module"; +import {DynamicElementModule} from "./dynamic-element/dynamic-element.module"; +import {FormElementsModule} from "./form-components/form-elements.module"; +import {LoaderComponent} from "./loader/loader.component"; +import {ModalModule} from "./modal/modal.module"; +import {PopoverModule} from "./popover/popover.module"; +import {SearchBarComponent} from "./search-bar/search-bar.component"; +import {SearchWithAutoCompleteComponent} from "./search-with-autocomplete/search-with-autocomplete.component"; +import {TabModule} from "./tabs/tabs.module"; +import {TooltipModule} from "./tooltip/tooltip.module"; +import {CommonModule} from "@angular/common"; +import {FormsModule} from "@angular/forms"; +import {BrowserModule} from "@angular/platform-browser"; +import {MultiStepsWizardModule} from "./multi-steps-wizard/multi-steps-wizard.module"; +import {MenuListModule} from "./menu/menu-list.module"; +import {MenuListNg2Module} from "../downgrade-wrappers/menu-list-ng2/menu-list-ng2.module"; + +@NgModule({ + declarations: [ + LoaderComponent, + SearchBarComponent, + SearchWithAutoCompleteComponent + ], + + imports: [ + BrowserModule, + FormsModule, + CommonModule, + DynamicElementModule, + NavbarModule, + FormElementsModule, + ModalModule, + PopoverModule, + TabModule, + TooltipModule, + MultiStepsWizardModule, + MenuListModule, + MenuListNg2Module + ], + exports: [ + LoaderComponent, + MultiStepsWizardModule, + SearchBarComponent, + SearchWithAutoCompleteComponent, + DynamicElementModule, + NavbarModule, + FormElementsModule, + ModalModule, + PopoverModule, + TabModule, + TooltipModule, + MenuListModule, + MenuListNg2Module + ], + + entryComponents: [SearchWithAutoCompleteComponent] +}) + +export class UiElementsModule {} @@ -0,0 +1,17 @@ +declare const __ENV__:string; + +export interface ISdcConfig { + [index:string]: any +} + +export function getSdcConfig() : ISdcConfig { + let sdcConfig:ISdcConfig = {}; + + if (__ENV__==='prod') { + sdcConfig = require('./../../../../configurations/prod.js'); + } else { + sdcConfig = require('./../../../../configurations/dev.js'); + } + + return sdcConfig; +} @@ -0,0 +1,11 @@ +import {Provider, OpaqueToken} from "@angular/core"; +import {getSdcConfig, ISdcConfig} from "./sdc-config.config.factory"; + +export { ISdcConfig }; + +export const SdcConfigToken = new OpaqueToken('SdcConfigToken'); + +export const SdcConfig:Provider = { + provide: SdcConfigToken, + useFactory: getSdcConfig +}; @@ -0,0 +1,13 @@ +import { ITranslateServiceConfig } from "../shared/translator/translate.service.config"; + +declare const __ENV__:string; + +export function getTranslationServiceConfig() : ITranslateServiceConfig { + const pathPrefix = (__ENV__ === 'prod') ? 'sdc1/' : ''; + return { + filePrefix: pathPrefix + 'assets/languages/', + fileSuffix: '.json', + allowedLanguages: ['en_US'], + defaultLanguage: 'en_US' + }; +} @@ -0,0 +1,8 @@ +import { Provider } from "@angular/core"; +import { TranslateServiceConfigToken } from "../shared/translator/translate.service.config"; +import { getTranslationServiceConfig } from "./translation.service.config.factory"; + +export const TranslationServiceConfig:Provider = { + provide: TranslateServiceConfigToken, + useFactory: getTranslationServiceConfig +}; @@ -0,0 +1,4 @@ +<div> + <connection-wizard-header currentStepIndex="2"></connection-wizard-header> + <properties-step></properties-step> +</div> @@ -0,0 +1,4 @@ +connection-wizard-header { + display: block; + margin-bottom: 15px; +} @@ -0,0 +1,10 @@ +import {Component} from "@angular/core"; + + +@Component({ + selector: 'connection-properties-view', + templateUrl: './connection-properties-view.component.html', + styleUrls:['./connection-properties-view.component.less'] +}) +export class ConnectionPropertiesViewComponent { +} @@ -0,0 +1,36 @@ +<div class="header-main-container"> + <div class="inner-container"> + <div class="node from-node" [ngClass]="{'selected':currentStepIndex == 0}"> + <div class="text"> + <div class="node-name"> + {{connectWizardService.connectRelationModel.fromNode.componentInstance.name}} + </div> + <div class="selected-req-or-cap" [ngClass]="{'selected': currentStepIndex == 2 && !connectWizardService.selectedMatch.isFromTo}"> + {{getSelectedReqOrCapName(true)}} + </div> + </div> + <div class="icon"> + <div class="small medium {{connectWizardService.connectRelationModel.fromNode.componentInstance.iconSprite}} {{connectWizardService.connectRelationModel.fromNode.componentInstance.icon}}"> + </div> + </div> + </div> + <div class="connection"> + + </div> + <div class="node to-node" [ngClass]="{'selected':currentStepIndex == 1}"> + <div class="icon"> + <div class="small medium {{connectWizardService.connectRelationModel.toNode.componentInstance.iconSprite}} {{connectWizardService.connectRelationModel.toNode.componentInstance.icon}}"> + </div> + </div> + + <div class="text"> + <div class="node-name"> + {{connectWizardService.connectRelationModel.toNode.componentInstance.name}} + </div> + <div class="selected-req-or-cap" [ngClass]="{'selected': currentStepIndex == 2 && connectWizardService.selectedMatch.isFromTo}"> + {{getSelectedReqOrCapName(false)}} + </div> + </div> + </div> + </div> +</div>
\ No newline at end of file @@ -0,0 +1,53 @@ +@import '../../../../../assets/styles/sprite-proxy-services-icons'; +@import '../../../../../assets/styles/variables'; +.header-main-container{ + background-color: #f8f8f8; + width: 100%; + height: 100px; + display: flex; + .inner-container{ + margin: 0 auto; + display: flex; + } +} +.selected { + color: @main_color_a; +} +.node{ + display: flex; + &.from-node{ + text-align: right; + } + &.to-node{ + text-align: left; + } + &.selected{ + .icon{ + border: solid 3px @main_color_a; + padding: 4px; + border-radius: 50%; + background-color: @main_color_p; + } + } + .icon{ + margin: auto 0; + display: flex; + } + .text{ + font-family: @font-opensans-medium; + margin: auto 10px; + min-width: 450px; + .node-name{ + font-size: 11px; + } + .selected-req-or-cap{ + font-size: 14px; + } + } +} +.connection{ + width: 67px; + height: 0px; + border-bottom: dashed 2px #979797; + margin: auto 0; +} @@ -0,0 +1,37 @@ +/** + * Created by rc2122 on 9/27/2017. + */ +import {Component, Inject, forwardRef} from "@angular/core"; +import {ConnectionWizardService} from "../connection-wizard.service"; +import {WizardHeaderBaseComponent} from "app/ng2/components/ui/multi-steps-wizard/multi-steps-wizard-header-base.component"; + +@Component({ + selector: 'connection-wizard-header', + templateUrl: './connection-wizard-header.component.html', + styleUrls:['./connection-wizard-header.component.less'] +}) + +export class ConnectionWizardHeaderComponent extends WizardHeaderBaseComponent{ + + constructor(@Inject(forwardRef(() => ConnectionWizardService)) public connectWizardService: ConnectionWizardService) { + super(); + } + + private _getReqOrCapName(isFromNode:boolean) { + const attributeReqOrCap:string = isFromNode ? 'requirement' : 'capability'; + if (this.connectWizardService.selectedMatch[attributeReqOrCap]) { + return this.connectWizardService.selectedMatch[attributeReqOrCap].getTitle(); + } else if (this.connectWizardService.selectedMatch.relationship) { + return this.connectWizardService.selectedMatch.relationship.relation[attributeReqOrCap]; + } + return ''; + } + + private getSelectedReqOrCapName = (isFromNode:boolean):string => { + if(!this.connectWizardService.selectedMatch){ + return ''; + } + return this._getReqOrCapName(this.connectWizardService.selectedMatch.isFromTo ? isFromNode : !isFromNode); + } +} + @@ -0,0 +1,43 @@ +import {ToNodeStepComponent} from "./to-node-step/to-node-step.component"; +import {NgModule} from "@angular/core"; +import {FromNodeStepComponent} from "./from-node-step/from-node-step.component"; +import {PropertiesStepComponent} from "./properties-step/properties-step.component"; +import {ConnectionWizardService} from "./connection-wizard.service"; +import {SelectRequirementOrCapabilityModule} from "../../components/logic/select-requirement-or-capability/select-requirement-or-capability.module"; +import {PropertyTableModule} from "../../components/logic/properties-table/property-table.module"; +import {FormElementsModule} from "../../components/ui/form-components/form-elements.module"; +import {ConnectionWizardHeaderComponent} from "./connection-wizard-header/connection-wizard-header.component"; +import {ConnectionPropertiesViewComponent} from "./connection-properties-view/connection-properties-view.component"; +import {BrowserModule} from "@angular/platform-browser"; + +@NgModule({ + declarations: [ + FromNodeStepComponent, + ToNodeStepComponent, + PropertiesStepComponent, + ConnectionWizardHeaderComponent, + ConnectionPropertiesViewComponent + ], + imports: [ + FormElementsModule, + PropertyTableModule, + SelectRequirementOrCapabilityModule, + BrowserModule + ], + exports: [ + FromNodeStepComponent, + ToNodeStepComponent, + PropertiesStepComponent, + ConnectionWizardHeaderComponent, + ConnectionPropertiesViewComponent + ], + entryComponents: [FromNodeStepComponent, + ToNodeStepComponent, + PropertiesStepComponent, + ConnectionWizardHeaderComponent, + ConnectionPropertiesViewComponent + ], + providers: [ConnectionWizardService] +}) +export class ConnectionWizardModule { +}
\ No newline at end of file @@ -0,0 +1,67 @@ +import {ConnectRelationModel} from "../../../models/graph/connectRelationModel"; +import {Injectable} from "@angular/core"; +import { Requirement, Capability} from "app/models"; +import {Dictionary} from "lodash"; +import {Match, Component, PropertyFEModel} from "app/models"; + +@Injectable() +export class ConnectionWizardService { + + connectRelationModel:ConnectRelationModel; + currentComponent:Component; + selectedMatch:Match; + changedCapabilityProperties:PropertyFEModel[]; + + constructor() { + this.changedCapabilityProperties = []; + } + + public setRelationMenuDirectiveObj = (connectRelationModel:ConnectRelationModel) => { + this.connectRelationModel = connectRelationModel; + // this.selectedCapability = rel + } + + + // getComponentInstanceIdOfSelectedCapability = (): string => { + // if(this.selectedMatch.capability){ + // if(this.selectedMatch.isFromTo) { + // return this.selectedMatch.toNode; + // } else { + // return this.selectedMatch.fromNode; + // } + // } + // return ''; + // + // } + + getOptionalRequirementsByInstanceUniqueId = (isFromTo: boolean, matchWith?:Capability): Dictionary<Requirement[]> => { + let requirements: Array<Requirement> = []; + _.forEach(this.connectRelationModel.possibleRelations, (match: Match) => { + if(!matchWith || match.capability.uniqueId == matchWith.uniqueId){ + if(match.isFromTo == isFromTo){ + requirements.push(match.requirement); + } + } + }); + requirements = _.uniqBy(requirements, (req:Requirement)=>{ + return req.ownerId + req.uniqueId + req.name; + }); + return _.groupBy(requirements, 'capability'); + } + + getOptionalCapabilitiesByInstanceUniqueId = (isFromTo: boolean, matchWith?:Requirement): Dictionary<Capability[]> => { + let capabilities: Array<Capability> = []; + _.forEach(this.connectRelationModel.possibleRelations, (match: Match) => { + if(!matchWith || match.requirement.uniqueId == matchWith.uniqueId){ + if(match.isFromTo == isFromTo){ + capabilities.push(match.capability); + } + } + }); + capabilities = _.uniqBy(capabilities, (cap:Capability)=>{ + return cap.ownerId + cap.uniqueId + cap.name; + }); + return _.groupBy(capabilities, 'type'); + } +} + @@ -0,0 +1,8 @@ +<select-requirement-or-capability [optionalRequirementsMap]="optionalRequirementsMap" + [optionalCapabilitiesMap]="optionalCapabilitiesMap" + [selectedReqOrCapModel]="connectWizardService.selectedMatch && (connectWizardService.selectedMatch.isFromTo ? connectWizardService.selectedMatch.requirement : connectWizardService.selectedMatch.capability)" + [currentComponent]="connectWizardService.currentComponent" + [componentInstanceId]="connectWizardService.connectRelationModel.fromNode.componentInstance.uniqueId" + (updateSelectedReqOrCap)="updateSelectedReqOrCap($event)" + (updateCapabilityProperties)="onCapabilityPropertiesUpdate($event)"> +</select-requirement-or-capability>
\ No newline at end of file @@ -0,0 +1,49 @@ +import {Component, OnInit, Inject, forwardRef} from "@angular/core"; +import {IStepComponent} from "../../../../models/wizard-step"; +import {Dictionary} from "lodash"; +import { Match} from "app/models"; +import {ConnectionWizardService} from "../connection-wizard.service"; +import {Requirement} from "../../../../models/requirement"; +import {Capability} from "../../../../models/capability"; +import {PropertyModel} from "../../../../models/properties"; + +@Component({ + selector: 'from-node-step', + templateUrl: './from-node-step.component.html' +}) + +export class FromNodeStepComponent implements IStepComponent, OnInit{ + + constructor(@Inject(forwardRef(() => ConnectionWizardService)) public connectWizardService: ConnectionWizardService) {} + + optionalRequirementsMap: Dictionary<Requirement[]>; + optionalCapabilitiesMap: Dictionary<Capability[]>; + + ngOnInit(){ + this.optionalRequirementsMap = this.connectWizardService.getOptionalRequirementsByInstanceUniqueId(true); + this.optionalCapabilitiesMap = this.connectWizardService.getOptionalCapabilitiesByInstanceUniqueId(false); + } + + preventNext = ():boolean => { + return !this.connectWizardService.selectedMatch || (!this.connectWizardService.selectedMatch.capability && !this.connectWizardService.selectedMatch.requirement); + } + + preventBack = ():boolean => { + return true; + } + + onCapabilityPropertiesUpdate(capabilityProperties:Array<PropertyModel>) { + this.connectWizardService.selectedMatch.capabilityProperties = capabilityProperties; + } + + private updateSelectedReqOrCap = (selected:Requirement|Capability):void => { + if(!selected){ + this.connectWizardService.selectedMatch = null; + } else if(selected instanceof Requirement){ + this.connectWizardService.selectedMatch = new Match(<Requirement>selected, null, true, this.connectWizardService.connectRelationModel.fromNode.componentInstance.uniqueId, null); + } else{ + this.connectWizardService.selectedMatch = new Match(null,<Capability>selected , false, null, this.connectWizardService.connectRelationModel.fromNode.componentInstance.uniqueId); + } + } + +} @@ -0,0 +1,13 @@ +<div class="title"> + <span class="capability-name"> + {{(connectWizardService.selectedMatch.capability && connectWizardService.selectedMatch.capability.getTitle()) || connectWizardService.selectedMatch.relationship.relation.capability}} + </span> +</div> +<div class="properties-table-container"> + <properties-table class="properties-table" + (valueChanged)="propertyValueChanged($event)" + [fePropertiesMap]="capabilityPropertiesMap" + [selectedPropertyId]="''" + [hidePropertyType]="true"> + </properties-table> +</div>
\ No newline at end of file @@ -0,0 +1,15 @@ +@import '../../../../../assets/styles/variables'; +.title{ + margin-bottom: 20px; + .capability-name-label{ + font-size: 13px; + } + .capability-name{ + font-family: @font-opensans-medium; + color: @main_color_a; + } +} +.properties-table-container{ + height: 362px; + overflow-y: auto; +}
\ No newline at end of file @@ -0,0 +1,67 @@ +/** + * Created by ob0695 on 9/4/2017. + */ +/** + * Created by rc2122 on 9/4/2017. + */ +import {Component, Inject, forwardRef} from '@angular/core'; +import {IStepComponent} from "app/models" +import {ConnectionWizardService} from "../connection-wizard.service"; +import {PropertyFEModel} from "../../../../models/properties-inputs/property-fe-model"; +import {InstanceFePropertiesMap} from "../../../../models/properties-inputs/property-fe-map"; +import {PropertiesUtils} from "../../properties-assignment/services/properties.utils"; +import {ComponentInstanceServiceNg2} from "../../../services/component-instance-services/component-instance.service"; + +@Component({ + selector: 'properties-step', + templateUrl: './properties-step.component.html', + styleUrls: ['./properties-step.component.less'] +}) + +export class PropertiesStepComponent implements IStepComponent{ + + capabilityPropertiesMap: InstanceFePropertiesMap; + savingProperty:boolean = false; + + constructor(@Inject(forwardRef(() => ConnectionWizardService)) public connectWizardService: ConnectionWizardService, private componentInstanceServiceNg2:ComponentInstanceServiceNg2, private propertiesUtils:PropertiesUtils) { + + this.capabilityPropertiesMap = this.propertiesUtils.convertPropertiesMapToFEAndCreateChildren({'capability' : connectWizardService.selectedMatch.capabilityProperties}, false); + } + + ngOnInit() { + this.connectWizardService.changedCapabilityProperties = []; + } + + onPropertySelectedUpdate = ($event) => { + console.log("==>" + 'PROPERTY VALUE SELECTED'); + // this.selectedFlatProperty = $event; + // let parentProperty:PropertyFEModel = this.propertiesService.getParentPropertyFEModelFromPath(this.instanceFePropertiesMap[this.selectedFlatProperty.instanceName], this.selectedFlatProperty.path); + // parentProperty.expandedChildPropertyId = this.selectedFlatProperty.path; + }; + + propertyValueChanged = (property: PropertyFEModel) => { + if (!property.isDeclared) { + const propChangedIdx = this.connectWizardService.changedCapabilityProperties.indexOf(property); + if (this.componentInstanceServiceNg2.hasPropertyChanged(property)) { + console.log("==>" + this.constructor.name + ": propertyValueChanged " + property); + if (propChangedIdx === -1) { + this.connectWizardService.changedCapabilityProperties.push(property); + } + } + else { + if (propChangedIdx !== -1) { + console.log("==>" + this.constructor.name + ": propertyValueChanged (reset to original) " + property); + this.connectWizardService.changedCapabilityProperties.splice(propChangedIdx, 1); + } + } + } + }; + + preventNext = ():boolean => { + return false; + } + + preventBack = ():boolean => { + return this.savingProperty; + } +} @@ -0,0 +1,9 @@ +<select-requirement-or-capability [optionalRequirementsMap]="optionalRequirementsMap" + [optionalCapabilitiesMap]="optionalCapabilitiesMap" + [selectedReqOrCapModel]="connectWizardService.selectedMatch.isFromTo ? connectWizardService.selectedMatch.capability : connectWizardService.selectedMatch.requirement" + [selectedReqOrCapOption]="displayRequirementsOrCapabilities" + [currentComponent]="connectWizardService.currentComponent" + [componentInstanceId]="connectWizardService.connectRelationModel.toNode.componentInstance.uniqueId" + (updateSelectedReqOrCap)="updateSelectedReqOrCap($event)" + (updateCapabilityProperties)="onCapabilityPropertiesUpdate($event)"> +</select-requirement-or-capability>
\ No newline at end of file @@ -0,0 +1,69 @@ +import {Component, forwardRef, Inject} from '@angular/core'; +import {IStepComponent} from "app/models" +import {Dictionary} from "lodash"; +import {ConnectionWizardService} from "../connection-wizard.service"; +import {Match} from "../../../../models/graph/match-relation"; +import {Requirement} from "../../../../models/requirement"; +import {Capability} from "../../../../models/capability"; +import {PropertyModel} from "../../../../models/properties"; + +@Component({ + selector: 'to-node-step', + templateUrl: './to-node-step.component.html' +}) + +export class ToNodeStepComponent implements IStepComponent{ + + displayRequirementsOrCapabilities:string; //get 'Requirement' or 'Capability' + optionalRequirementsMap: Dictionary<Requirement[]> = {}; + optionalCapabilitiesMap: Dictionary<Capability[]> ={}; + + constructor(@Inject(forwardRef(() => ConnectionWizardService)) public connectWizardService: ConnectionWizardService) { + } + + ngOnInit(){ + if(this.connectWizardService.selectedMatch.isFromTo){ + this.displayRequirementsOrCapabilities = 'Capability'; + this.optionalRequirementsMap = {}; + this.optionalCapabilitiesMap = this.connectWizardService.getOptionalCapabilitiesByInstanceUniqueId(true, this.connectWizardService.selectedMatch.requirement); + }else{ + this.displayRequirementsOrCapabilities = 'Requirement'; + this.optionalRequirementsMap = this.connectWizardService.getOptionalRequirementsByInstanceUniqueId(false, this.connectWizardService.selectedMatch.capability); + this.optionalCapabilitiesMap = {} + } + + + } + + preventNext = ():boolean => { + return !this.connectWizardService.selectedMatch.capability || !this.connectWizardService.selectedMatch.requirement; + } + + preventBack = ():boolean => { + return false; + } + + onCapabilityPropertiesUpdate(capabilityProperties:Array<PropertyModel>) { + this.connectWizardService.selectedMatch.capabilityProperties = capabilityProperties; + } + + private updateSelectedReqOrCap = (selected:Requirement|Capability):void => { + if (!selected) { + if (this.connectWizardService.selectedMatch.isFromTo) { + this.connectWizardService.selectedMatch.capability = undefined; + this.connectWizardService.selectedMatch.toNode = undefined; + } else { + this.connectWizardService.selectedMatch.requirement = undefined; + this.connectWizardService.selectedMatch.fromNode = undefined; + } + } else if (selected instanceof Requirement) { + this.connectWizardService.selectedMatch.requirement = <Requirement>selected; + this.connectWizardService.selectedMatch.fromNode = this.connectWizardService.connectRelationModel.toNode.componentInstance.uniqueId; + } else { + this.connectWizardService.selectedMatch.capability = <Capability>selected; + this.connectWizardService.selectedMatch.toNode = this.connectWizardService.connectRelationModel.toNode.componentInstance.uniqueId; + } + this.connectWizardService.selectedMatch.relationship = undefined; + } + +} @@ -17,70 +17,43 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - import { NgModule } from "@angular/core"; -import { PropertiesAssignmentComponent } from "./properties-assignment.page.component"; -import { HierarchyNavigationComponent } from "./../../components/hierarchy-navigtion/hierarchy-navigation.component"; -import { BrowserModule } from "@angular/platform-browser"; -import { FormsModule } from "@angular/forms"; -import { HttpModule } from "@angular/http"; -import { TabModule } from '../../shared/tabs/tabs.module'; -import { CheckboxModule} from '../../shared/checkbox/checkbox.module'; -import { PropertiesTableComponent } from '../../components/properties-table/properties-table.component'; -import { InputsTableComponent } from '../../components/inputs-table/inputs-table.component'; -import { ContentAfterLastDotPipe } from "../../pipes/contentAfterLastDot.pipe"; -import { SearchFilterPipe } from "../../pipes/searchFilter.pipe"; -import { FilterChildPropertiesPipe } from "../../pipes/filterChildProperties.pipe"; -import { DataTypeService } from './../../services/data-type.service'; -import { PropertiesService } from './../../services/properties.service'; -import { HierarchyNavService } from './../../services/hierarchy-nav.service'; -import { PropertiesUtils } from './properties.utils'; -import { DynamicElementModule } from 'app/ng2/components/dynamic-element/dynamic-element.module'; -import { DynamicPropertyComponent } from './../../components/properties-table/dynamic-property/dynamic-property.component'; -import { PopoverModule } from "../../components/popover/popover.module"; -import { ModalModule } from "../../components/modal/modal.module"; -import { FilterPropertiesAssignmentComponent } from "./../../components/filter-properties-assignment/filter-properties-assignment.component"; -import { GroupByPipe } from 'app/ng2/pipes/groupBy.pipe'; -import { KeysPipe } from 'app/ng2/pipes/keys.pipe'; -import {TooltipModule} from "../../components/tooltip/tooltip.module"; -import { ComponentModeService } from "app/ng2/services/component-mode.service" -import {LoaderComponent} from "app/ng2/components/loader/loader.component" +import {HierarchyNavigationComponent} from "../../components/logic/hierarchy-navigtion/hierarchy-navigation.component"; +import {HttpModule} from "@angular/http"; +import {FormsModule} from "@angular/forms"; +import {PropertyTableModule} from "../../components/logic/properties-table/property-table.module"; +import {UiElementsModule} from "../../components/ui/ui-elements.module"; +import {GlobalPipesModule} from "../../pipes/global-pipes.module"; +import {BrowserModule} from "@angular/platform-browser"; +import {FilterPropertiesAssignmentComponent} from "../../components/logic/filter-properties-assignment/filter-properties-assignment.component"; +import {InputsTableComponent} from "../../components/logic/inputs-table/inputs-table.component"; +import {PropertiesService} from "../../services/properties.service"; +import {DataTypeService} from "../../services/data-type.service"; +import {PropertiesAssignmentComponent} from "./properties-assignment.page.component"; +import {HierarchyNavService} from "./services/hierarchy-nav.service"; +import {PropertiesUtils} from "./services/properties.utils"; +import {ComponentModeService} from "../../services/component-services/component-mode.service"; @NgModule({ declarations: [ PropertiesAssignmentComponent, - PropertiesTableComponent, InputsTableComponent, - ContentAfterLastDotPipe, - GroupByPipe, - KeysPipe, - SearchFilterPipe, - FilterChildPropertiesPipe, HierarchyNavigationComponent, - DynamicPropertyComponent, - // PopoverContentComponent, - // PopoverComponent, - FilterPropertiesAssignmentComponent, - LoaderComponent + FilterPropertiesAssignmentComponent ], imports: [ BrowserModule, FormsModule, HttpModule, - TabModule, - CheckboxModule, - DynamicElementModule, - PopoverModule, - TooltipModule, - ModalModule - ], + GlobalPipesModule, + PropertyTableModule, + UiElementsModule], + entryComponents: [PropertiesAssignmentComponent], exports: [ PropertiesAssignmentComponent - // PopoverContentComponent, - // PopoverComponent ], - providers: [PropertiesService, HierarchyNavService, PropertiesUtils, DataTypeService, ContentAfterLastDotPipe, GroupByPipe, KeysPipe, ComponentModeService] + providers: [PropertiesService, HierarchyNavService, PropertiesUtils, DataTypeService, ComponentModeService] }) export class PropertiesAssignmentModule { @@ -11,6 +11,7 @@ [propertyNameSearchText]="searchPropertyName" [readonly]="isReadonly" [isLoading]="loadingProperties" + [hasDeclareOption]="true" (valueChanged)="propertyValueChanged($event)" (propertySelected)="propertySelected($event)" (selectPropertyRow)="selectPropertyRow($event)" @@ -31,12 +32,12 @@ </tabs> <div class="header"> <div class="search-filter-container" [class.without-filter]="isInpusTabSelected"> - <span *ngIf="displayClearSearch && !isInpusTabSelected" (click)="clickOnClearSearch()" class="clear-filter">Clear All</span> - <input type="text" class="search-box" placeholder="Search" [(ngModel)]="searchQuery" /> - <span class="sprite search-icon"></span> + <span *ngIf="displayClearSearch && !isInpusTabSelected" (click)="clickOnClearSearch()" class="clear-filter" data-tests-id="clear-filter-button">Clear All</span> + <input type="text" class="search-box" placeholder="Search" [(ngModel)]="searchQuery" data-tests-id="search-box"/> + <span class="sprite search-icon" data-tests-id="search-button"></span> <filter-properties-assignment *ngIf="!isInpusTabSelected" #advanceSearch class="advance-search" [componentType]="component.componentType" (searchProperties)="searchPropertiesInstances($event)"></filter-properties-assignment> </div> - <button class="tlv-btn blue declare-button" [disabled]="!checkedPropertiesCount || isReadonly" (click)="declareProperties()">Declare</button> + <button class="tlv-btn blue declare-button" [disabled]="!checkedPropertiesCount || isReadonly" (click)="declareProperties()" data-tests-id="declare-button">Declare</button> </div> </div> <div class="right-column gray-border"> @@ -20,21 +20,22 @@ import {Component, ViewChild, ElementRef, Renderer, Inject} from "@angular/core"; import { PropertiesService } from "../../services/properties.service"; -import { HierarchyNavService } from "../../services/hierarchy-nav.service"; -import { PropertiesUtils } from './properties.utils'; import { PropertyFEModel, InstanceFePropertiesMap, InstanceBePropertiesMap, InstancePropertiesAPIMap, Component as ComponentData, FilterPropertiesAssignmentData } from "app/models"; -import { PROPERTY_TYPES, ResourceType } from "app/utils"; +import { ResourceType } from "app/utils"; import property = require("lodash/property"); import {ComponentServiceNg2} from "../../services/component-services/component.service"; import {ComponentInstanceServiceNg2} from "../../services/component-instance-services/component-instance.service" -import { InputBEModel, InputFEModel, ComponentInstance, PropertyBEModel, DerivedPropertyType, DerivedFEProperty, ResourceInstance, SimpleFlatProperty } from "app/models"; -import {HierarchyDisplayOptions} from "../../components/hierarchy-navigtion/hierarchy-display-options" -import {PropertyRowSelectedEvent} from "./../../components/properties-table/properties-table.component"; +import { InputBEModel, InputFEModel, ComponentInstance, PropertyBEModel, DerivedFEProperty, ResourceInstance, SimpleFlatProperty } from "app/models"; import { KeysPipe } from 'app/ng2/pipes/keys.pipe'; -import {FilterPropertiesAssignmentComponent} from "../../components/filter-properties-assignment/filter-properties-assignment.component"; -import { ComponentModeService } from "app/ng2/services/component-mode.service" import {WorkspaceMode, EVENTS} from "../../../utils/constants"; import {EventListenerService} from "app/services/event-listener-service" +import {HierarchyDisplayOptions} from "../../components/logic/hierarchy-navigtion/hierarchy-display-options"; +import {FilterPropertiesAssignmentComponent} from "../../components/logic/filter-properties-assignment/filter-properties-assignment.component"; +import {PropertyRowSelectedEvent} from "../../components/logic/properties-table/properties-table.component"; +import {HierarchyNavService} from "./services/hierarchy-nav.service"; +import {PropertiesUtils} from "./services/properties.utils"; +import {ComponentModeService} from "../../services/component-services/component-mode.service"; + @Component({ templateUrl: './properties-assignment.page.component.html', styleUrls: ['./properties-assignment.page.component.less'] @@ -19,11 +19,10 @@ */ import { Injectable } from '@angular/core'; -import { DataTypeModel, PropertyFEModel, PropertyBEModel, InstanceBePropertiesMap, InstanceFePropertiesMap, SchemaProperty, DerivedFEProperty, DerivedFEPropertyMap, DerivedPropertyType, InputFEModel} from "app/models"; +import { DataTypeModel, PropertyFEModel, PropertyBEModel, InstanceBePropertiesMap, InstanceFePropertiesMap, DerivedFEProperty, DerivedPropertyType, InputFEModel} from "app/models"; import { DataTypeService } from "app/ng2/services/data-type.service"; import { PropertiesService } from "app/ng2/services/properties.service"; -import { PROPERTY_TYPES } from "app/utils"; -import { UUID } from "angular2-uuid"; +import { PROPERTY_TYPES, PROPERTY_DATA } from "app/utils"; @Injectable() export class PropertiesUtils { @@ -106,8 +105,16 @@ export class PropertiesUtils { public initValueObjectRef = (property: PropertyFEModel): void => { if (property.derivedDataType == DerivedPropertyType.SIMPLE || property.isDeclared) { //if property is declared, it gets a simple input instead. List and map values and pseudo-children will be handled in property component property.valueObj = property.value || property.defaultValue; - - if (property.isDeclared && typeof property.valueObj == 'object') property.valueObj = JSON.stringify(property.valueObj); + if (property.isDeclared) { + if(typeof property.valueObj == 'object'){ + property.valueObj = JSON.stringify(property.valueObj); + } + }else if(property.valueObj && + property.type !== PROPERTY_TYPES.STRING && + property.type !== PROPERTY_TYPES.JSON && + PROPERTY_DATA.SCALAR_TYPES.indexOf(property.type) == -1){ + property.valueObj = JSON.parse(property.valueObj);//The valueObj contains the real value ans not the value as string + } } else { if (property.derivedDataType == DerivedPropertyType.LIST) { property.valueObj = _.merge([], JSON.parse(property.defaultValue || '[]'), JSON.parse(property.value || '[]')); //value object should be merged value and default value. Value takes higher precendence. Set valueObj to empty obj if undefined. @@ -0,0 +1,24 @@ +import {ContentAfterLastDotPipe} from "./contentAfterLastDot.pipe"; +import {SearchFilterPipe} from "./searchFilter.pipe"; +import {KeysPipe} from "./keys.pipe"; +import {GroupByPipe} from "./groupBy.pipe"; +import {NgModule} from "@angular/core"; + +@NgModule({ + declarations: [ + ContentAfterLastDotPipe, + GroupByPipe, + KeysPipe, + SearchFilterPipe + + ], + + exports: [ + ContentAfterLastDotPipe, + GroupByPipe, + KeysPipe, + SearchFilterPipe + ] +}) + +export class GlobalPipesModule {} @@ -18,26 +18,23 @@ * ============LICENSE_END========================================================= */ -import { Injectable } from '@angular/core'; -import { sdc2Config } from './../../../main'; +import {Injectable, Inject} from '@angular/core'; import {IAppConfigurtaion, ICookie} from "../../models/app-config"; import {Response, Headers, RequestOptions, Http} from '@angular/http'; import {Cookie2Service} from "./cookie.service"; import { Observable } from 'rxjs/Observable'; +import {SdcConfigToken, ISdcConfig} from "../config/sdc-config.config"; @Injectable() export class AuthenticationService { - private cookieService:Cookie2Service; - private http:Http; - - constructor(cookieService:Cookie2Service, http: Http) { + constructor(private cookieService:Cookie2Service, private http: Http, @Inject(SdcConfigToken) private sdcConfig:ISdcConfig) { this.cookieService = cookieService; this.http = http; } private getAuthHeaders():any { - let cookie:ICookie = sdc2Config.cookie; + let cookie:ICookie = this.sdcConfig.cookie; let authHeaders:any = {}; authHeaders[cookie.userFirstName] = this.cookieService.getFirstName(); authHeaders[cookie.userLastName] = this.cookieService.getLastName(); @@ -51,7 +48,7 @@ export class AuthenticationService { headers: new Headers(this.getAuthHeaders()) }); - let authUrl = sdc2Config.api.root + sdc2Config.api.GET_user_authorize; + let authUrl = this.sdcConfig.api.root + this.sdcConfig.api.GET_user_authorize; return this.http .get(authUrl, options) .map((res: Response) => res.json()); @@ -18,22 +18,23 @@ * ============LICENSE_END========================================================= */ -import {Injectable} from '@angular/core'; +import {Injectable, Inject} from '@angular/core'; import {Response, RequestOptions, Headers} from '@angular/http'; import { Observable } from 'rxjs/Observable'; -import {sdc2Config} from "../../../../main"; -import {PropertyBEModel} from "app/models"; +import {PropertyFEModel, PropertyBEModel} from "app/models"; import {CommonUtils} from "app/utils"; import {Component, ComponentInstance, InputModel} from "app/models"; import { HttpService } from '../http.service'; +import {SdcConfigToken, ISdcConfig} from "../../config/sdc-config.config"; +import {isEqual} from "lodash"; @Injectable() export class ComponentInstanceServiceNg2 { protected baseUrl; - constructor(private http: HttpService) { - this.baseUrl = sdc2Config.api.root + sdc2Config.api.component_api_root; + constructor(private http: HttpService, @Inject(SdcConfigToken) sdcConfig:ISdcConfig) { + this.baseUrl = sdcConfig.api.root + sdcConfig.api.component_api_root; } getComponentInstanceProperties(component: Component, componentInstanceId: string): Observable<Array<PropertyBEModel>> { @@ -59,6 +60,24 @@ export class ComponentInstanceServiceNg2 { }) } + getInstanceCapabilityProperties(component: Component, componentInstanceId: string, capabilityType: string, capabilityName: string): Observable<Array<PropertyBEModel>> { + + return this.http.get(this.baseUrl + component.getTypeUrl() + component.uniqueId + '/componentInstances/' + componentInstanceId + '/capability/' + capabilityType + + '/capabilityName/' + capabilityName + '/properties') + .map((res: Response) => { + return CommonUtils.initBeProperties(res.json()); + }) + } + + updateInstanceCapabilityProperties(component: Component, componentInstanceId: string, capabilityType: string, capabilityName: string, properties: PropertyBEModel[]): Observable<PropertyBEModel[]> { + + return this.http.put(this.baseUrl + component.getTypeUrl() + component.uniqueId + '/componentInstances/' + componentInstanceId + '/capability/' + capabilityType + + '/capabilityName/' + capabilityName +'/properties', properties) + .map((res: Response) => { + return res.json().map((resProperty) => new PropertyBEModel(resProperty)); + }) + } + updateInstanceInput(component: Component, componentInstanceId: string, input: PropertyBEModel): Observable<PropertyBEModel> { return this.http.post(this.baseUrl + component.getTypeUrl() + component.uniqueId + '/resourceInstance/' + componentInstanceId + '/input', input) @@ -67,5 +86,9 @@ export class ComponentInstanceServiceNg2 { }) } - + hasPropertyChanged(property: PropertyFEModel) { + let oldValue: any = property.value; + const newValue = property.getJSONValue(); + return ((oldValue || newValue) && !isEqual(oldValue, newValue)); + } } @@ -22,7 +22,7 @@ * Created by rc2122 on 5/23/2017. */ import { Injectable } from '@angular/core'; -import {WorkspaceMode, ComponentState, Role} from "../../utils/constants"; +import {WorkspaceMode, ComponentState, Role} from "../../../utils/constants"; import { Component as ComponentData } from "app/models"; import { CacheService } from "app/services/cache-service" @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -import {Injectable} from '@angular/core'; +import {Injectable, Inject} from '@angular/core'; import {Observable} from 'rxjs/Observable'; import 'rxjs/add/operator/map'; import 'rxjs/add/operator/toPromise'; @@ -27,11 +27,11 @@ import { Component, PropertyBEModel, InstancePropertiesAPIMap, FilterPropertiesA import {downgradeInjectable} from '@angular/upgrade/static'; import {COMPONENT_FIELDS} from "app/utils"; import {ComponentGenericResponse} from "../responses/component-generic-response"; -import {sdc2Config} from "../../../../main"; import {InstanceBePropertiesMap} from "../../../models/properties-inputs/property-fe-map"; import {API_QUERY_PARAMS} from "app/utils"; import { ComponentType, ServerTypeUrl } from "../../../utils/constants"; import { HttpService } from '../http.service'; +import {SdcConfigToken, ISdcConfig} from "../../config/sdc-config.config"; declare var angular:angular.IAngularStatic; @@ -40,8 +40,8 @@ export class ComponentServiceNg2 { protected baseUrl; - constructor(private http:HttpService) { - this.baseUrl = sdc2Config.api.root + sdc2Config.api.component_api_root; + constructor(private http:HttpService, @Inject(SdcConfigToken) sdcConfig:ISdcConfig) { + this.baseUrl = sdcConfig.api.root + sdcConfig.api.component_api_root; } private getComponentDataByFieldsName(componentType:string, componentId: string, fields:Array<string>):Observable<ComponentGenericResponse> { @@ -151,17 +151,6 @@ export class ComponentServiceNg2 { .map((res: Response) => { return res.json(); }); - - // return {'ExtVL 0':[{definition: false,name:"network_assignments",password:false,required:true,type:"org.openecomp.datatypes.network.NetworkAssignments",uniqueId:"623cca1c-d605-4c9c-9f2b-935ec85ebcf8.network_assignments"}, - // {definition: false,name: "exVL_naming",password: false,required: true,type: "org.openecomp.datatypes.Naming",uniqueId: "623cca1c-d605-4c9c-9f2b-935ec85ebcf8.exVL_naming"}, - // {definition: false,name: "network_flows",password: false,required: false,type: "org.openecomp.datatypes.network.NetworkFlows",uniqueId: "623cca1c-d605-4c9c-9f2b-935ec85ebcf8.network_flows"}, - // {definition: false,name: "provider_network",password: false,required: true,type: "org.openecomp.datatypes.network.ProviderNetwork",uniqueId: "623cca1c-d605-4c9c-9f2b-935ec85ebcf8.provider_network"}, - // {definition: false,name: "network_homing",password: false,required: true,type: "org.openecomp.datatypes.EcompHoming",uniqueId: "623cca1c-d605-4c9c-9f2b-935ec85ebcf8.network_homing"}], - // 'NetworkCP 0':[{definition: false,description: "identifies MAC address assignments to the CP",name: "mac_requirements",password: false,required: false,type: "org.openecomp.datatypes.network.MacRequirements",uniqueId: "26ec2bfd-b904-46c7-87ed-b32775120f2c.mac_requirements"}], - // 'NetworkCP 1':[{definition: false,description: "identifies MAC address assignments to the CP",name: "mac_requirements",password: false,required: false,type: "org.openecomp.datatypes.network.MacRequirements",uniqueId: "26ec2bfd-b904-46c7-87ed-b32775120f2c.mac_requirements"}]}; - - } } -angular.module('Sdc.Services').factory('ComponentServiceNg2', downgradeInjectable(ComponentServiceNg2)); // This is in order to use the service in angular1 till we finish remove all angular1 code @@ -18,15 +18,15 @@ * ============LICENSE_END========================================================= */ -import { Injectable } from '@angular/core'; +import { Injectable, Inject } from '@angular/core'; import { Observable } from 'rxjs/Observable'; import 'rxjs/add/operator/map'; import 'rxjs/add/operator/toPromise'; import { Response } from '@angular/http'; import {Service} from "app/models"; import { downgradeInjectable } from '@angular/upgrade/static'; -import {sdc2Config} from "../../../../main"; import { HttpService } from '../http.service'; +import {SdcConfigToken, ISdcConfig} from "../../config/sdc-config.config"; @Injectable() @@ -34,8 +34,8 @@ export class ServiceServiceNg2 { protected baseUrl = ""; - constructor(private http: HttpService) { - this.baseUrl = sdc2Config.api.root + sdc2Config.api.component_api_root; + constructor(private http: HttpService, @Inject(SdcConfigToken) sdcConfig:ISdcConfig) { + this.baseUrl = sdcConfig.api.root + sdcConfig.api.component_api_root; } validateConformanceLevel(service: Service): Observable<boolean> { @@ -47,5 +47,3 @@ export class ServiceServiceNg2 { } } - -angular.module('Sdc.Services').factory('ServiceServiceNg2', downgradeInjectable(ServiceServiceNg2)); // This is in order to use the service in angular1 till we finish remove all angular1 code @@ -22,13 +22,11 @@ * Created by ob0695 on 4/9/2017. */ -import { Injectable } from '@angular/core'; +import { Injectable, Inject } from '@angular/core'; import { Http, Response } from '@angular/http'; import 'rxjs/add/operator/toPromise'; import {IAppConfigurtaion, ValidationConfiguration, Validations} from "app/models"; -import {sdc2Config} from './../../../main'; - -declare var __ENV__: string; +import {SdcConfigToken, ISdcConfig} from "../config/sdc-config.config"; @Injectable() export class ConfigService { @@ -36,12 +34,12 @@ export class ConfigService { private baseUrl; public configuration: IAppConfigurtaion; - constructor(private http: Http) { - this.baseUrl = sdc2Config.api.root + sdc2Config.api.component_api_root; + constructor(private http: Http, @Inject(SdcConfigToken) private sdcConfig:ISdcConfig) { + this.baseUrl = this.sdcConfig.api.root + this.sdcConfig.api.component_api_root; } loadValidationConfiguration(): Promise<ValidationConfiguration> { - let url: string = sdc2Config.validationConfigPath; + let url: string = this.sdcConfig.validationConfigPath; let promise: Promise<ValidationConfiguration> = this.http.get(url).map((res: Response) => res.json()).toPromise(); promise.then((validationData: Validations) => { ValidationConfiguration.validation = validationData; @@ -18,9 +18,9 @@ * ============LICENSE_END========================================================= */ -import { Injectable } from '@angular/core'; +import {Injectable, Inject} from '@angular/core'; import {IAppConfigurtaion, ICookie} from "../../models/app-config"; -import {sdc2Config} from './../../../main'; +import {SdcConfigToken, ISdcConfig} from "../config/sdc-config.config"; @Injectable() export class Cookie2Service { @@ -28,8 +28,8 @@ export class Cookie2Service { private cookie:ICookie; private cookiePrefix:string; - constructor() { - this.cookie = sdc2Config.cookie; + constructor(@Inject(SdcConfigToken) sdcConfig:ISdcConfig) { + this.cookie = sdcConfig.cookie; this.cookiePrefix = ''; let junctionName:string = this.getCookieByName(this.cookie.junctionName); @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -import {Injectable} from '@angular/core'; +import {Injectable, Inject} from '@angular/core'; import {Http, XHRBackend, RequestOptions, Request, RequestOptionsArgs, Response, Headers} from '@angular/http'; import {Observable} from 'rxjs/Observable'; import {UUID} from 'angular2-uuid'; @@ -27,15 +27,15 @@ import 'rxjs/add/operator/catch'; import 'rxjs/add/observable/throw'; import {Dictionary} from "../../utils/dictionary/dictionary"; import {SharingService, CookieService} from "app/services"; -import {sdc2Config} from './../../../main'; import { ModalService } from "app/ng2/services/modal.service"; import { ServerErrorResponse } from "app/models"; -import { ErrorMessageComponent } from 'app/ng2/components/modal/error-message/error-message.component'; +import {ErrorMessageComponent} from "../components/ui/modal/error-message/error-message.component"; +import {SdcConfigToken, ISdcConfig} from "../config/sdc-config.config"; @Injectable() export class HttpService extends Http { - constructor(backend: XHRBackend, options: RequestOptions, private sharingService: SharingService, private cookieService: CookieService, private modalService: ModalService) { + constructor(backend: XHRBackend, options: RequestOptions, private sharingService: SharingService, private cookieService: CookieService, private modalService: ModalService, @Inject(SdcConfigToken) private sdcConfig:ISdcConfig) { super(backend, options); this._defaultOptions.withCredentials = true; this._defaultOptions.headers.append(cookieService.getUserIdSuffix(), cookieService.getUserId()); @@ -73,7 +73,7 @@ export class HttpService extends Http { private getUuidValue = (url: string) :string => { let map:Dictionary<string, string> = this.sharingService.getUuidMap(); - if (map && url.indexOf(sdc2Config.api.root) > 0) { + if (map && url.indexOf(this.sdcConfig.api.root) > 0) { map.forEach((key:string) => { if (url.indexOf(key) !== -1) { return this.sharingService.getUuidValue(key); @@ -93,4 +93,8 @@ export class HttpService extends Http { return Observable.throw(response); }; + public static replaceUrlParams(url:string, urlParams:{[index:string]:any}):string { + return url.replace(/:(\w+)/g, (m, p1):string => urlParams[p1] || ''); + } + } @@ -1,6 +1,11 @@ -import { Injectable, Type, ViewContainerRef, ApplicationRef, ComponentFactory, ComponentFactoryResolver, ComponentRef } from '@angular/core'; -import { ModalModel, ButtonModel } from 'app/models'; -import { ModalComponent } from 'app/ng2/components/modal/modal.component'; +import { + Injectable, Type, ViewContainerRef, ApplicationRef, ComponentFactory, ComponentFactoryResolver, ComponentRef, + +} from '@angular/core'; +import { ModalModel, ButtonModel, StepModel } from 'app/models'; +import {MultiStepsWizardComponent} from "../components/ui/multi-steps-wizard/multi-steps-wizard.component"; +import {ModalComponent} from "../components/ui/modal/modal.component"; +import {WizardHeaderBaseComponent} from "app/ng2/components/ui/multi-steps-wizard/multi-steps-wizard-header-base.component"; @Injectable() @@ -54,6 +59,23 @@ export class ModalService { return customModal; } + public createMultiStepsWizard = (title: string, steps:Array<StepModel>, callback: Function, dynamicHeaderType?: Type<WizardHeaderBaseComponent>): ComponentRef<MultiStepsWizardComponent> => { + let cancelButton: ButtonModel = new ButtonModel('Cancel', 'outline blue', this.closeCurrentModal); + let modalModel: ModalModel = new ModalModel('xl', title, '', [cancelButton]); + let wizardInstance: ComponentRef<MultiStepsWizardComponent> = this.createDynamicComponent(MultiStepsWizardComponent); + wizardInstance.instance.input = modalModel; + wizardInstance.instance.steps = steps; + wizardInstance.instance.callback = callback; + if(dynamicHeaderType){ + let dynamicHeader = this.createDynamicComponent(dynamicHeaderType, wizardInstance.instance.dynamicHeaderContainer); + wizardInstance.instance.dynamicHeader = dynamicHeader; + wizardInstance.instance.dynamicHeader.instance.currentStepIndex = 0; + } + this.addDynamicContentToModal(wizardInstance, steps[0].component); + this.currentModal = wizardInstance; + return wizardInstance; + } + public closeCurrentModal = () => { if (!this.currentModal) return; @@ -62,7 +84,7 @@ export class ModalService { } - public addDynamicContentToModal = (modalInstance: ComponentRef<ModalComponent>, dynamicComponentType: Type<any>, dynamicComponentInput: any) => { + public addDynamicContentToModal = (modalInstance: ComponentRef<ModalComponent>, dynamicComponentType: Type<any>, dynamicComponentInput?: any) => { let dynamicContent = this.createDynamicComponent(dynamicComponentType, modalInstance.instance.dynamicContentContainer); dynamicContent.instance.input = dynamicComponentInput; @@ -72,14 +94,13 @@ export class ModalService { //Creates a component dynamically (aka during runtime). If a view container is not specified, it will append the new component to the app root. //To subscribe to an event from invoking component: componentRef.instance.clicked.subscribe((m) => console.log(m.name)); - private createDynamicComponent<T>(componentType: Type<T>, viewContainerRef?:ViewContainerRef): ComponentRef<any> { + private createDynamicComponent<T>(componentType: Type<T>, viewContainerRef?:ViewContainerRef): ComponentRef<T> { viewContainerRef = viewContainerRef || this.getRootViewContainerRef(); viewContainerRef.clear(); - let factory: ComponentFactory<any> = this.componentFactoryResolver.resolveComponentFactory(componentType); //Ref: https://angular.io/guide/dynamic-component-loader - let componentRef = viewContainerRef.createComponent(factory); - + let factory: ComponentFactory<T> = this.componentFactoryResolver.resolveComponentFactory(componentType); //Ref: https://angular.io/guide/dynamic-component-loader + let componentRef: ComponentRef<T> = viewContainerRef.createComponent(factory); return componentRef; } @@ -87,4 +108,6 @@ export class ModalService { private getRootViewContainerRef(): ViewContainerRef { return this.applicationRef.components[0].instance.viewContainerRef; } -}
\ No newline at end of file +} + + @@ -19,16 +19,12 @@ */ import { Injectable } from '@angular/core'; -import { DataTypeModel, PropertyFEModel, PropertyBEModel, SchemaProperty, PropertyDeclareAPIModel, DerivedFEProperty, DerivedFEPropertyMap, DerivedPropertyType, InputFEModel} from "app/models"; -import { DataTypeService } from "./data-type.service"; -import { PROPERTY_TYPES } from "app/utils"; -import { ContentAfterLastDotPipe } from "../pipes/contentAfterLastDot.pipe"; -import { UUID } from "angular2-uuid"; +import { PropertyFEModel, PropertyBEModel, PropertyDeclareAPIModel, DerivedFEProperty} from "app/models"; @Injectable() export class PropertiesService { - constructor(private dataTypeService: DataTypeService, private contentAfterLastDotPipe: ContentAfterLastDotPipe) { + constructor() { } public getParentPropertyFEModelFromPath = (properties: Array<PropertyFEModel>, path: string) => { @@ -0,0 +1,98 @@ +/*- + * ============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========================================================= + */ + +import { Injectable, Inject } from "@angular/core"; +import { Headers } from "@angular/http"; +import { Observable } from "rxjs/Observable"; +import { HttpService } from "./http.service"; +import { Cookie2Service } from "./cookie.service"; +import { IUserProperties } from "../../models/user"; + +import {ICookie} from "../../models/app-config"; +import {SdcConfigToken, ISdcConfig} from "../config/sdc-config.config"; + +@Injectable() +export class UserService { + private url:string; + private authorizeUrl:string; + + private _loggedinUser:IUserProperties; + + constructor(private httpService:HttpService, + private cookieService:Cookie2Service, + @Inject(SdcConfigToken) private sdcConfig:ISdcConfig) { + this.url = this.sdcConfig.api.root + this.sdcConfig.api.GET_user; + this.authorizeUrl = this.sdcConfig.api.root + this.sdcConfig.api.GET_user_authorize; + } + + public authorize() :Observable<IUserProperties> { + let cookie:ICookie = this.sdcConfig.cookie; + let authorizeHeaders:Headers = new Headers(); + authorizeHeaders.set(cookie.userFirstName, this.cookieService.getFirstName()); + authorizeHeaders.set(cookie.userLastName, this.cookieService.getLastName()); + authorizeHeaders.set(cookie.userEmail, this.cookieService.getEmail()); + authorizeHeaders.set(cookie.userIdSuffix, this.cookieService.getUserId()); + + return this.httpService.get( + this.authorizeUrl, + { headers: authorizeHeaders } + ).map(resp => resp.json()); + } + + public getAllUsers() :Observable<IUserProperties[]> { + return this.httpService.get( + this.sdcConfig.api.root + this.sdcConfig.api.GET_all_users + ).map(resp => resp.json()); + } + + public getUser(userId:string) :Observable<IUserProperties> { + return this.httpService.get( + HttpService.replaceUrlParams(this.url, { id: userId }) + ).map(resp => resp.json()); + } + + public createUser(userData:{[index:string]: any}) :Observable<IUserProperties> { + return this.httpService.post( + this.sdcConfig.api.root + this.sdcConfig.api.POST_create_user, + userData + ).map(resp => resp.json()); + } + + public deleteUser(userId:string) :Observable<IUserProperties> { + return this.httpService.delete( + HttpService.replaceUrlParams(this.sdcConfig.api.root + this.sdcConfig.api.DELETE_delete_user, { id: userId }) + ).map(resp => resp.json()); + } + + public editUserRole(userId:string, role:string) :Observable<IUserProperties> { + return this.httpService.post( + HttpService.replaceUrlParams(this.sdcConfig.api.root + this.sdcConfig.api.POST_edit_user_role, { id: userId }), + { role: role } + ).map(resp => resp.json()); + } + + public getLoggedinUser():IUserProperties { + return this._loggedinUser; + } + + public setLoggedinUser(loggedinUser:IUserProperties) { + this._loggedinUser = loggedinUser; + }; +} @@ -7,9 +7,9 @@ * 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. @@ -18,23 +18,15 @@ * ============LICENSE_END========================================================= */ -import { NgModule } from '@angular/core'; +import { NgModule } from '@angular/core' -import { CommonModule } from '@angular/common'; -import { RouterModule } from '@angular/router'; -import { NavbarModule } from "./navbar/navbar.module"; +import { TranslateService } from "./translate.service"; +import { TranslatePipe } from "./translate.pipe"; -@NgModule({ - declarations: [ - ], - imports: [ - CommonModule, - RouterModule, - NavbarModule - ], - exports: [ - ] +@NgModule({ + providers: [TranslateService], + declarations: [TranslatePipe], + exports: [TranslatePipe] }) - -export class SharedModule {} +export class TranslateModule { } @@ -0,0 +1,62 @@ +/*- + * ============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========================================================= + */ + +import { Pipe, PipeTransform } from '@angular/core'; +import { TranslateService, ITranslateArgs } from "./translate.service"; + + +@Pipe({ + name: 'translate', + pure: false +}) +export class TranslatePipe implements PipeTransform { + private translated:string; + private lastParams: { + phrase: string; + args: {[index: string]: any}; + language: string; + } = { + phrase: undefined, + args: undefined, + language: undefined + }; + + constructor(private translateService:TranslateService) { + } + + private shouldUpdate(curParams:{[index:string]: any}) : boolean { + return ( + curParams.language !== this.lastParams.language || + curParams.args !== this.lastParams.args || + curParams.phrase !== this.lastParams.phrase + ); + } + + public transform(phrase:string, args:ITranslateArgs, language:string=this.translateService.activeLanguage) : string { + const curParams = { phrase, args, language }; + if (this.shouldUpdate(curParams)) { + this.lastParams = curParams; + this.translated = this.translateService.translate(phrase, args, language); + console.log('*updated:', this.translated); + } + + return this.translated; + } +} @@ -0,0 +1,30 @@ +/*- + * ============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========================================================= + */ + +import { OpaqueToken } from "@angular/core"; + +export const TranslateServiceConfigToken = new OpaqueToken('TranslateServiceConfigToken'); + +export interface ITranslateServiceConfig { + filePrefix:string; + fileSuffix:string; + allowedLanguages:string[]; + defaultLanguage:string; +} @@ -0,0 +1,235 @@ +/*- + * ============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========================================================= + */ + +import { Injectable, Inject } from "@angular/core"; +import { Response, Http } from "@angular/http"; +import { Observable, Observer, ConnectableObservable, Subscription } from "rxjs"; +import { ITranslateServiceConfig, TranslateServiceConfigToken } from "./translate.service.config"; + +export { ITranslateServiceConfig, TranslateServiceConfigToken }; + +export interface ITranslateLanguageJson { + [index:string]: string; +} + +export interface ITranslateArgs { + [index:string]: any; +} + +export class PhraseTranslator { + private _observable:ConnectableObservable<string>; + private _observer:Observer<string>; + private _languageChangeSubscription:Subscription; + + private _phraseKey:string; + private _args:ITranslateArgs; + private _language:string; + + private _markForCheck:boolean = false; + private _lastParams: { + phraseKey: string; + args: {[index: string]: any}; + language: string; + } = { + phraseKey: undefined, + args: undefined, + language: undefined + }; + + constructor(private translateService:TranslateService) { + this._observable = Observable.create(observer => { + this._observer = observer; + this._languageChangeSubscription = this.translateService.languageChangedObservable.subscribe(language => { + // using the active language, then force update + if (!this._language) { + this.update(true); + } + }); + }).publishReplay(1).refCount(); + } + + public get observable() { + return this._observable; + } + + public destroy() { + this._observer.complete(); + this._languageChangeSubscription.unsubscribe(); + + delete this._observable; + delete this._observer; + delete this._languageChangeSubscription; + } + + public shouldUpdate() : boolean { + if (!this._markForCheck) { + return false; + } + this._markForCheck = false; + return ( + this._language !== this._lastParams.language || + this._args !== this._lastParams.args || + this._phraseKey !== this._lastParams.phraseKey + ); + } + + public update(forceUpdate:boolean=false) : void { + // only update translation when having subscriptions connected. + if (this._observer && !this._observer.closed) { + if (forceUpdate || this.shouldUpdate()) { + this._lastParams = { + phraseKey: this._phraseKey, + args: this._args, + language: this._language + }; + this._markForCheck = false; + + const translated = this.translateService.translate(this._phraseKey, this._args, this._language); + this._observer.next(translated); + } + } + } + + private _changeParam(paramKey:string, value:any, update:boolean) : void { + this[`_${paramKey}`] = value; + this._markForCheck = true; + if (update) { + this.update(); + } + } + + public changePhraseKey(phraseKey:string, update:boolean=true) : void { + this._changeParam('phraseKey', phraseKey, update); + } + + public changeArgs(args:ITranslateArgs, update:boolean=true) :void { + this._changeParam('args', args, update); + } + + public changeLangauge(language:string, update:boolean=true) :void { + this._changeParam('language', language, update); + } + + public changeParams(phraseKey:string, args:ITranslateArgs={}, language?:string, forceUpdate:boolean=false) { + this._phraseKey = phraseKey; + this._args = args; + this._language = language; + this._markForCheck = true; + this.update(forceUpdate); + } +} + + +@Injectable() +export class TranslateService { + private _activeLanguage:string; + private _languageChangedObservable:ConnectableObservable<string>; + private _languageChangedObserver:Observer<string>; + private _cacheLanguagesJsons:{[index:string]:ITranslateLanguageJson} = {}; + private _cacheLanguagesLoaders:{[index:string]:Observable<ITranslateLanguageJson>} = {}; + + constructor(@Inject(TranslateServiceConfigToken) private config:ITranslateServiceConfig, private http:Http) { + this.initLanguageObservable(); + this.loadAndActivateLanguage(this.config.defaultLanguage); + } + + public get languageChangedObservable() : Observable<string> { + return this._languageChangedObservable; + } + + public get activeLanguage() { + return this._activeLanguage; + } + + private initLanguageObservable() { + this._languageChangedObservable = ConnectableObservable.create(observer => { + this._languageChangedObserver = observer; + }).publishReplay(1); // replay last emitted change on subscribe + this._languageChangedObservable.connect(); + } + + private loadLanguageJsonFile(language:string, emitOnLoad:boolean=true) : Observable<ITranslateLanguageJson> { + if (this.config.allowedLanguages.indexOf(language) === -1) { + return Observable.throw(`Language "${language}" is not available.`); + } + + if (this._cacheLanguagesJsons[language]) { + return Observable.of(this._cacheLanguagesJsons[language]); + } + + if (!(language in this._cacheLanguagesLoaders)) { + const filePath = `${this.config.filePrefix}${language}${this.config.fileSuffix}`; + this._cacheLanguagesLoaders[language] = this.http.get(filePath) + .map<Response, ITranslateLanguageJson>(resp => resp.json()) + .catch(() => Observable.throw(`Failed to load language file for "${language}"`)) + .publish(); + (<ConnectableObservable<ITranslateLanguageJson>>this._cacheLanguagesLoaders[language]).connect(); + this._cacheLanguagesLoaders[language].subscribe(languageJson => { + this._cacheLanguagesJsons[language] = languageJson; + delete this._cacheLanguagesLoaders[language]; + if (emitOnLoad) { + this._languageChangedObserver.next(language); + } + return languageJson; + }); + } + return this._cacheLanguagesLoaders[language]; + } + + public activateLanguage(language:string) : boolean { + if (this._cacheLanguagesJsons[language]) { + if (language !== this._activeLanguage) { + this._activeLanguage = language; + this._languageChangedObserver.next(this._activeLanguage); + } + return true; + } + return false; + } + + public loadAndActivateLanguage(language:string) : Observable<ITranslateLanguageJson> { + const loadLanguageObservable = this.loadLanguageJsonFile(language, false); + loadLanguageObservable.subscribe(() => { + this.activateLanguage(language); + }, () => {}); + return loadLanguageObservable; + } + + public translate(phraseKey:string, args:ITranslateArgs={}, language:string=this._activeLanguage) : string { + const phrase:string = (this._cacheLanguagesJsons[language] || {})[phraseKey] || ''; + let translated:string; + if (typeof(phrase) === 'string') { + translated = phrase + .replace( + /(^|[^\\]|\\\\)\{\{(\w+)\}\}/g, + (m, p1, p2) => `${p1}${args[p2]||''}` + ) + .replace('\\{{', '{{') + .replace('\\\\', '\\'); + } + return translated; + } + + public createPhraseTranslator(phraseKey?:string, args?:ITranslateArgs, language?:string) : PhraseTranslator { + const phraseTranslator = new PhraseTranslator(this); + phraseTranslator.changeParams(phraseKey, args, language); + return phraseTranslator; + } +} @@ -42,6 +42,10 @@ export function cookieServiceFactory(cacheObj: ICacheObject) { return cacheObj.get('Sdc.Services.CookieService'); } +export function stateServiceFactory(cacheObj: ICacheObject) { + return cacheObj.get('$state'); +} + export function stateParamsServiceFactory(cacheObj: ICacheObject) { return cacheObj.get('$stateParams'); } @@ -74,6 +78,12 @@ export const CookieServiceProvider = { deps: ['$injector'] }; +export const StateServiceFactory = { + provide: '$state', + useFactory: stateServiceFactory, + deps: ['$injector'] +}; + export const StateParamsServiceFactory = { provide: '$stateParams', useFactory: stateParamsServiceFactory, @@ -46,6 +46,5 @@ export * from './services/progress-service'; export * from './services/sdc-version-service'; export * from './services/sharing-service'; export * from './services/url-tobase64-service'; -export * from './services/user-resource-service'; export * from './services/angular-js-bridge-service'; @@ -52,6 +52,7 @@ export interface IComponentService { deleteComponentInstance(componentId:string, componentInstanceId:string):ng.IPromise<ComponentInstance>; createRelation(componentId:string, link:RelationshipModel):ng.IPromise<RelationshipModel>; deleteRelation(componentId:string, link:RelationshipModel):ng.IPromise<RelationshipModel>; + fetchRelation(componentId:string, linkId:string):ng.IPromise<RelationshipModel>; getRequirementsCapabilities(componentId:string):ng.IPromise<any>; updateInstanceProperty(componentId:string, property:PropertyModel):ng.IPromise<PropertyModel>; updateInstanceAttribute(componentId:string, attribute:AttributeModel):ng.IPromise<AttributeModel>; @@ -513,7 +514,12 @@ export class ComponentService implements IComponentService { public createRelation = (componentId:string, link:RelationshipModel):ng.IPromise<RelationshipModel> => { let deferred = this.$q.defer(); - this.restangular.one(componentId).one("resourceInstance").one("associate").customPOST(JSON.stringify(link)).then((response:any) => { + const linkPayload:RelationshipModel = new RelationshipModel(link); + linkPayload.relationships.forEach((rel) => { + delete rel.capability; + delete rel.requirement; + }); + this.restangular.one(componentId).one("resourceInstance").one("associate").customPOST(JSON.stringify(linkPayload)).then((response:any) => { let relation:RelationshipModel = new RelationshipModel(response.plain()); console.log("Link created successfully ", relation); deferred.resolve(relation); @@ -526,7 +532,12 @@ export class ComponentService implements IComponentService { public deleteRelation = (componentId:string, link:RelationshipModel):ng.IPromise<RelationshipModel> => { let deferred = this.$q.defer(); - this.restangular.one(componentId).one("resourceInstance").one("dissociate").customPUT(JSON.stringify(link)).then((response:any) => { + const linkPayload:RelationshipModel = new RelationshipModel(link); + linkPayload.relationships.forEach((rel) => { + delete rel.capability; + delete rel.requirement; + }); + this.restangular.one(componentId).one("resourceInstance").one("dissociate").customPUT(JSON.stringify(linkPayload)).then((response:any) => { let relation:RelationshipModel = new RelationshipModel(response); console.log("Link deleted successfully ", relation); deferred.resolve(relation); @@ -537,6 +548,19 @@ export class ComponentService implements IComponentService { return deferred.promise; }; + public fetchRelation = (componentId:string, linkId:string):ng.IPromise<RelationshipModel> => { + let deferred = this.$q.defer<RelationshipModel>(); + this.restangular.one(componentId).one("relationId").one(linkId).get().then((response:any) => { + let relation:RelationshipModel = new RelationshipModel(response); + console.log("Link fetched successfully ", relation); + deferred.resolve(relation); + }, (err)=> { + console.log("Failed to fetch Link Id: " + linkId); + deferred.reject(err); + }); + return deferred.promise; + }; + public getRequirementsCapabilities = (componentId:string):ng.IPromise<any> => { let deferred = this.$q.defer(); this.restangular.one(componentId).one("requirmentsCapabilities").get().then((response:any) => { @@ -23,6 +23,7 @@ import { Service, IApi, IAppConfigurtaion, Resource, Component} from "../models" import {SharingService} from "./sharing-service"; import {ComponentFactory} from "../utils/component-factory"; import {CacheService} from "./cache-service"; +import {ResourceType} from "app/utils"; interface IEntityService { getAllComponents():ng.IPromise<Array<Component>>; @@ -48,7 +49,7 @@ export class EntityService implements IEntityService { getCatalog = ():ng.IPromise<Array<Component>> => { let defer = this.$q.defer<Array<Component>>(); - this.$http.get(this.api.root + this.api.GET_catalog) + this.$http.get(this.api.root + this.api.GET_catalog, {params: {excludeTypes: [ResourceType.VFCMT, ResourceType.CONFIGURATION]}}) .then((response:any) => { let followedResponse: IComponentsArray = response.data; let componentsList:Array<Component> = new Array(); @@ -32,12 +32,12 @@ export class LoaderService { } - public showLoader(...args) { - this.eventListenerService.notifyObservers(EVENTS.SHOW_LOADER_EVENT, ...args); + public showLoader(loaderType:string, ...args) { + this.eventListenerService.notifyObservers(EVENTS.SHOW_LOADER_EVENT + loaderType, ...args); } - public hideLoader(...args) { - this.eventListenerService.notifyObservers(EVENTS.HIDE_LOADER_EVENT, ...args); + public hideLoader(loaderType:string, ...args) { + this.eventListenerService.notifyObservers(EVENTS.HIDE_LOADER_EVENT + loaderType, ...args); } } @@ -1,123 +0,0 @@ -/*- - * ============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========================================================= - */ - -'use strict'; -import {IUserProperties} from "../models/user"; -import {ICookie, IAppConfigurtaion} from "../models/app-config"; -import {CookieService} from "./cookie-service"; - -// Define an interface of the object you want to use, providing it's properties -export interface IUserResource extends IUserProperties,ng.resource.IResource<IUserResource> { - -} - -// Define your resource, adding the signature of the custom actions -export interface IUserResourceClass extends ng.resource.IResourceClass<IUserResource> { - authorize():IUserResource; - getLoggedinUser():IUserResource; - setLoggedinUser(user:IUserResource):void; - getAllUsers(success?:Function, error?:Function):Array<IUserResource>; - createUser(IResourceResource, success?:Function, error?:Function):void; - editUserRole(IResourceResource, success?:Function, error?:Function):void; - deleteUser(IResourceResource, success?:Function, error?:Function):void; -} - -export class UserResourceService { - - public static getResource = ($resource:ng.resource.IResourceService, - sdcConfig:IAppConfigurtaion, - cookieService:CookieService):IUserResourceClass => { - - let url:string = sdcConfig.api.root + sdcConfig.api.GET_user; - let authorizeUrl:string = sdcConfig.api.root + sdcConfig.api.GET_user_authorize; - let authorizeActionHeaders:any = {}; - let cookie:ICookie = sdcConfig.cookie; - authorizeActionHeaders[cookie.userFirstName] = cookieService.getFirstName(); - authorizeActionHeaders[cookie.userLastName] = cookieService.getLastName(); - authorizeActionHeaders[cookie.userEmail] = cookieService.getEmail(); - authorizeActionHeaders[cookie.userIdSuffix] = cookieService.getUserId(); - - // Define your custom actions here as IActionDescriptor - let authorizeAction:ng.resource.IActionDescriptor = { - method: 'GET', - isArray: false, - url: authorizeUrl, - headers: authorizeActionHeaders - }; - - let getAllUsers:ng.resource.IActionDescriptor = { - method: 'GET', - isArray: true, - url: sdcConfig.api.root + sdcConfig.api.GET_all_users - }; - - let editUserRole:ng.resource.IActionDescriptor = { - method: 'POST', - isArray: false, - url: sdcConfig.api.root + sdcConfig.api.POST_edit_user_role, - transformRequest: (data, headers)=> { - data.payloadData = undefined; - data.payloadName = undefined; - return JSON.stringify(data); - } - }; - - let deleteUser:ng.resource.IActionDescriptor = { - method: 'DELETE', - isArray: false, - url: sdcConfig.api.root + sdcConfig.api.DELETE_delete_user - }; - - let createUser:ng.resource.IActionDescriptor = { - method: 'POST', - isArray: false, - url: sdcConfig.api.root + sdcConfig.api.POST_create_user, - transformRequest: (data, headers)=> { - data.payloadData = undefined; - data.payloadName = undefined; - return JSON.stringify(data); - } - }; - let userResource:IUserResourceClass = <IUserResourceClass>$resource( - url, - {id: '@id'}, - { - authorize: authorizeAction, - getAllUsers: getAllUsers, - createUser: createUser, - editUserRole: editUserRole, - deleteUser: deleteUser - } - ); - - let _loggedinUser:IUserResource; - - userResource.getLoggedinUser = () => { - return _loggedinUser; - }; - - userResource.setLoggedinUser = (loggedinUser:IUserResource) => { - _loggedinUser = loggedinUser; - }; - - return userResource; - } -} -UserResourceService.getResource.$inject = ['$resource', 'sdcConfig', 'Sdc.Services.CookieService']; @@ -70,6 +70,22 @@ export class ComponentFactory { return newResource; }; + public updateComponentFromCsar = (csarComponent:Resource, oldComponent:Resource):Component => { + _.pull(oldComponent.tags, oldComponent.name); + oldComponent.name = csarComponent.name; + oldComponent.selectedCategory = csarComponent.selectedCategory; + oldComponent.categories = csarComponent.categories; + oldComponent.vendorName = csarComponent.vendorName; + oldComponent.vendorRelease = csarComponent.vendorRelease; + oldComponent.csarUUID = csarComponent.csarUUID; + oldComponent.csarPackageType = csarComponent.csarPackageType; + oldComponent.csarVersion = csarComponent.csarVersion; + oldComponent.packageId = csarComponent.packageId; + oldComponent.description = csarComponent.description; + oldComponent.filterTerm = oldComponent.name + ' ' + oldComponent.description + ' ' + oldComponent.vendorName + ' ' + oldComponent.csarVersion + return oldComponent; + }; + public createFromCsarComponent = (csar:ICsarComponent):Component => { let newResource:Resource = <Resource>this.createEmptyComponent(ComponentType.RESOURCE); newResource.name = csar.vspName; @@ -124,7 +140,7 @@ export class ComponentFactory { let newComponent:Component; switch (componentType) { - + case ComponentType.SERVICE_PROXY: case ComponentType.SERVICE: newComponent = new Service(this.ServiceService, this.$q); break; @@ -136,6 +152,7 @@ export class ComponentFactory { case ResourceType.CP: case ResourceType.PNF: case ResourceType.CVFC: + case ResourceType.CONFIGURATION: newComponent = new Resource(this.ResourceService, this.$q); break; } @@ -21,7 +21,8 @@ * Created by obarda on 3/7/2016. */ 'use strict'; -import {ComponentInstance, ServiceInstance, ResourceInstance, Component} from "../models"; +import {ComponentInstance, ServiceInstance, ResourceInstance, Component, ServiceProxyInstance} from "../models"; +import {ComponentType} from "app/utils"; import {LeftPaletteComponent} from "../models/components/displayComponent"; export class ComponentInstanceFactory { @@ -29,10 +30,12 @@ export class ComponentInstanceFactory { static createComponentInstance(componentInstance:ComponentInstance):ComponentInstance { let newComponentInstance:ComponentInstance; switch (componentInstance.originType) { - case 'SERVICE': + case ComponentType.SERVICE: newComponentInstance = new ServiceInstance(componentInstance); break; - + case ComponentType.SERVICE_PROXY: + newComponentInstance = new ServiceProxyInstance(componentInstance); + break; default : newComponentInstance = new ResourceInstance(componentInstance); break; @@ -43,10 +46,12 @@ export class ComponentInstanceFactory { public createEmptyComponentInstance = (componentInstanceType?:string):ComponentInstance => { let newComponentInstance:ComponentInstance; switch (componentInstanceType) { - case 'SERVICE': + case ComponentType.SERVICE: newComponentInstance = new ServiceInstance(); break; - + case ComponentType.SERVICE_PROXY: + newComponentInstance = new ServiceProxyInstance(); + break; default : newComponentInstance = new ResourceInstance(); break; @@ -62,6 +67,9 @@ export class ComponentInstanceFactory { newComponentInstance.name = component.name; newComponentInstance.componentVersion = component.version; newComponentInstance.originType = component.getComponentSubType(); + if(component.getComponentSubType() === ComponentType.SERVICE){ + newComponentInstance.originType = ComponentType.SERVICE_PROXY + } //new component instance -> req. & cap. are added on successful instance creation newComponentInstance.requirements = component.requirements; newComponentInstance.capabilities = component.capabilities; @@ -29,6 +29,7 @@ export let CHANGE_COMPONENT_CSAR_VERSION_FLAG = 'changeComponentCsarVersion'; export class ComponentType { static SERVICE = 'SERVICE'; static RESOURCE = 'RESOURCE'; + static SERVICE_PROXY = 'ServiceProxy' } export class ServerTypeUrl { @@ -44,6 +45,7 @@ export class ResourceType { static VFCMT = 'VFCMT'; static PNF = 'PNF'; static CVFC = 'CVFC'; + static CONFIGURATION = 'Configuration'; } export class ComponentState { @@ -114,6 +116,7 @@ export class SOURCES { export class PROPERTY_DATA { public static TYPES = [PROPERTY_TYPES.STRING, PROPERTY_TYPES.INTEGER, PROPERTY_TYPES.FLOAT, PROPERTY_TYPES.BOOLEAN, PROPERTY_TYPES.JSON, PROPERTY_TYPES.SCALAR, PROPERTY_TYPES.SCALAR_FREQUENCY, PROPERTY_TYPES.SCALAR_SIZE, PROPERTY_TYPES.SCALAR_TIME, PROPERTY_TYPES.LIST, PROPERTY_TYPES.MAP]; public static SIMPLE_TYPES = [PROPERTY_TYPES.STRING, PROPERTY_TYPES.INTEGER, PROPERTY_TYPES.FLOAT, PROPERTY_TYPES.BOOLEAN, PROPERTY_TYPES.JSON, PROPERTY_TYPES.SCALAR, PROPERTY_TYPES.SCALAR_FREQUENCY, PROPERTY_TYPES.SCALAR_SIZE, PROPERTY_TYPES.SCALAR_TIME]; + public static SCALAR_TYPES = [PROPERTY_TYPES.SCALAR, PROPERTY_TYPES.SCALAR_FREQUENCY, PROPERTY_TYPES.SCALAR_SIZE, PROPERTY_TYPES.SCALAR_TIME]; public static ROOT_DATA_TYPE = "tosca.datatypes.Root"; public static OPENECOMP_ROOT = "org.openecomp.datatypes.Root"; public static SUPPLEMENTAL_DATA = "supplemental_data"; @@ -150,6 +153,7 @@ export class WorkspaceMode { export class ImagesUrl { public static RESOURCE_ICONS = '/assets/styles/images/resource-icons/'; public static SERVICE_ICONS = '/assets/styles/images/service-icons/'; + public static SERVICE_PROXY_ICONS = '/assets/styles/images/service-proxy-icons/'; public static SELECTED_UCPE_INSTANCE = '/assets/styles/images/resource-icons/selectedUcpeInstance.png'; public static SELECTED_CP_INSTANCE = '/assets/styles/images/resource-icons/selectedCPInstance.png'; public static SELECTED_VL_INSTANCE = '/assets/styles/images/resource-icons/selectedVLInstance.png'; @@ -249,6 +253,7 @@ export class EVENTS { static ON_WORKSPACE_SAVE_BUTTON_SUCCESS = "onWorkspaceSaveButtonSuccess"; static ON_WORKSPACE_SAVE_BUTTON_ERROR = "onWorkspaceSaveButtonError"; static ON_CHECKOUT = "onCheckout"; + static ON_REVERT = "onRevert"; //Loader events static SHOW_LOADER_EVENT = "showLoaderEvent"; @@ -116,7 +116,11 @@ export class MenuHandler { }); } - result.selectedIndex = components.indexOf(selectedItem); + if(!selectedItem){ + result.selectedIndex = components.length; + }else{ + result.selectedIndex = components.indexOf(selectedItem); + } components[result.selectedIndex] = selected; let clickItemCallback = (component:Component):ng.IPromise<boolean> => { this.$state.go('workspace.general', { @@ -22,5 +22,4 @@ <ng-include src="templateUrl" ng-if="true"></ng-include> </div> - <ecomp-footer></ecomp-footer> </div> @@ -20,8 +20,8 @@ 'use strict'; import {ModalsHandler} from "app/utils"; -import {IUserResource, IUserResourceClass} from "app/services"; import {User, IUserProperties, IUser, IAppConfigurtaion} from "app/models"; +import {UserService} from "../../../ng2/services/user.service"; interface IUserManagementViewModelScope extends ng.IScope { sdcConfig:IAppConfigurtaion; @@ -33,7 +33,7 @@ interface IUserManagementViewModelScope extends ng.IScope { tableHeadersList:any; roles:Array<string>; newUser:IUser; - currentUser:IUserResource; + currentUser:IUserProperties; userIdValidationPattern:RegExp; editForm:ng.IFormController; getAllUsers():void; @@ -53,7 +53,7 @@ export class UserManagementViewModel { static '$inject' = [ '$scope', 'sdcConfig', - 'Sdc.Services.UserResourceService', + 'UserServiceNg2', 'UserIdValidationPattern', '$filter', 'ModalsHandler' @@ -61,7 +61,7 @@ export class UserManagementViewModel { constructor(private $scope:IUserManagementViewModelScope, private sdcConfig:IAppConfigurtaion, - private userResourceService:IUserResourceClass, + private userService:UserService, private UserIdValidationPattern:RegExp, private $filter:ng.IFilterService, private ModalsHandler:ModalsHandler) { @@ -85,7 +85,7 @@ export class UserManagementViewModel { }); this.$scope.isLoading = false; }; - this.userResourceService.getAllUsers(onSuccess, onError); + this.userService.getAllUsers().subscribe(onSuccess, onError); }; private updateUserFilterTerm = (user:IUserProperties):void => { @@ -111,11 +111,11 @@ export class UserManagementViewModel { this.$scope.reverse = false; this.$scope.roles = this.sdcConfig.roles; this.$scope.isNewUser = false; - this.$scope.currentUser = this.userResourceService.getLoggedinUser(); + this.$scope.currentUser = this.userService.getLoggedinUser(); this.getAllUsers(); - let resource:IUserResource = <IUserResource>{}; - this.$scope.newUser = new User(resource); + let userInfo:IUserProperties = <IUserProperties>{}; + this.$scope.newUser = new User(userInfo); this.$scope.sort = (sortBy:string):void => {//default sort by descending last update. default for alphabetical = ascending this.$scope.isNewUser = false; @@ -131,13 +131,12 @@ export class UserManagementViewModel { }; let onSuccess = (response:IUserProperties) => { - this.$scope.newUser.resource['index'] = this.$scope.usersList.length; - this.$scope.newUser.resource.lastLoginTime = "0"; - this.$scope.newUser.resource.status = response.status; - this.updateUserFilterTerm(this.$scope.newUser.resource); - this.$scope.usersList.unshift(this.$scope.newUser.resource); + this.$scope.newUser.userInfo.lastLoginTime = "0"; + this.$scope.newUser.userInfo.status = response.status; + this.updateUserFilterTerm(this.$scope.newUser.userInfo); + this.$scope.usersList.push(this.$scope.newUser.userInfo); this.$scope.isNewUser = true; - this.$scope.sortBy = 'index'; + this.$scope.sortBy = null; this.$scope.reverse = true; this.$scope.isLoading = false; this.$scope.newUser = new User(null); @@ -147,10 +146,10 @@ export class UserManagementViewModel { _self.$scope.isNewUser = false; }, 7000); }; - this.userResourceService.createUser({ - userId: this.$scope.newUser.resource.userId, - role: this.$scope.newUser.resource.role - }, onSuccess, onError); + this.userService.createUser({ + userId: this.$scope.newUser.userInfo.userId, + role: this.$scope.newUser.userInfo.role + }).subscribe(onSuccess, onError); }; @@ -174,7 +173,7 @@ export class UserManagementViewModel { this.updateUserFilterTerm(user); }; - this.userResourceService.editUserRole({id: user.userId, role: user.role}, onSuccess, onError); + this.userService.editUserRole(user.userId, user.role).subscribe(onSuccess, onError); }; this.$scope.saveUserChanges = (user:IUserProperties):void => { @@ -198,7 +197,7 @@ export class UserManagementViewModel { _.remove(this.$scope.usersList, {userId: userId}); this.$scope.isLoading = false; }; - this.userResourceService.deleteUser({id: userId}, onSuccess, onError); + this.userService.deleteUser(userId).subscribe(onSuccess, onError); }; let title:string = this.$filter('translate')("USER_MANAGEMENT_VIEW_DELETE_MODAL_TITLE"); @@ -14,7 +14,7 @@ <div class="sdc-user-management-top-bar-wrapper"> <div class="i-sdc-form-item sdc-user-management-top-bar-form-container" data-ng-class="{error:(editForm.contactId.$dirty && editForm.contactId.$invalid)}"> <input ng-focus="search.filterTerm=''" type="text" - data-ng-model="newUser.resource.userId" + data-ng-model="newUser.userInfo.userId" class="i-sdc-form-input" placeholder="{{ USER_MANAGEMENT_SEARCH_TEXT | translate}}" data-ng-model-options="{ updateOn: 'default blur', debounce: { 'default': 750, 'blur': 0 } }" @@ -36,7 +36,7 @@ data-required name="role" data-tests-id="selectrole" - data-ng-model = "newUser.resource.role" + data-ng-model = "newUser.userInfo.role" data-ng-options="role as (getTitle(role)) for role in roles | orderBy:'role'" ng-focus="search.filterTerm=''"> <option value="">Select Role</option> @@ -20,8 +20,9 @@ 'use strict'; import {Component, IMainCategory, IGroup, IConfigStatuses, IAppMenu, IAppConfigurtaion, IUserProperties, ISubCategory} from "app/models"; -import {EntityService, IUserResourceClass, CacheService} from "app/services"; +import {EntityService, CacheService} from "app/services"; import {ComponentFactory, ResourceType, MenuHandler, ChangeLifecycleStateHandler} from "app/utils"; +import {UserService} from "../../ng2/services/user.service"; interface Checkboxes { @@ -87,7 +88,7 @@ export class CatalogViewModel { 'sdcMenu', '$state', '$q', - 'Sdc.Services.UserResourceService', + 'UserServiceNg2', 'Sdc.Services.CacheService', 'ComponentFactory', 'ChangeLifecycleStateHandler', @@ -101,7 +102,7 @@ export class CatalogViewModel { private sdcMenu:IAppMenu, private $state:ng.ui.IStateService, private $q:ng.IQService, - private userResourceService:IUserResourceClass, + private userService:UserService, private cacheService:CacheService, private ComponentFactory:ComponentFactory, private ChangeLifecycleStateHandler:ChangeLifecycleStateHandler, @@ -138,7 +139,7 @@ export class CatalogViewModel { this.$scope.sdcMenu = this.sdcMenu; this.$scope.confStatus = this.sdcMenu.statuses; this.$scope.expandedSection = ["type", "category", "status"]; - this.$scope.user = this.userResourceService.getLoggedinUser(); + this.$scope.user = this.userService.getLoggedinUser(); this.$scope.catalogMenuItem = this.sdcMenu.catalogMenuItem; this.$scope.version = this.cacheService.get('version'); this.$scope.sortBy = 'lastUpdateDate'; @@ -158,8 +159,6 @@ export class CatalogViewModel { this.$scope.checkboxesFilter.selectedStatuses = []; // this.$scope.isAllItemDisplay = this.$scope.numberOfItemToDisplay >= this.$scope.catalogFilterdItems.length; - - this.$scope.vfcmtType = ResourceType.VFCMT; }; private initScopeMethods = ():void => { @@ -135,7 +135,7 @@ <!-- HEADER --> <div> <div class="w-sdc-dashboard-catalog-header"> - {{getNumOfElements((catalogFilterdItems| filter:{resourceType:('!'+vfcmtType)} | entityFilter:checkboxesFilter | filter:search).length)}} + {{getNumOfElements((catalogFilterdItems| entityFilter:checkboxesFilter | filter:search).length)}} </div> <div class="w-sdc-dashboard-catalog-header-right"> <span class="w-sdc-dashboard-catalog-header-order" translate="SORT_CAPTION"></span> @@ -155,31 +155,32 @@ <!-- Tile new --> <div data-ng-init="component.filterTerm = component.name + ' ' + component.description + ' ' + component.tags.toString() + ' ' + component.version" - class="sdc-tile-catalog sdc-tile-fix-width" - data-ng-repeat="component in catalogFilterdItems| filter:{resourceType:('!'+vfcmtType)} | entityFilter:checkboxesFilter | filter:search | orderBy:sortBy:reverse | limitTo:numberOfItemToDisplay" + class="sdc-tile sdc-tile-fix-width" + data-ng-repeat="component in catalogFilterdItems| entityFilter:checkboxesFilter | filter:search | orderBy:sortBy:reverse | limitTo:numberOfItemToDisplay" > - <div class="sdc-tile-header"> - <div class='sdc-tile-header-type' data-ng-class="{'purple': component.isResource(), 'blue': !component.isResource()}"> - <div data-ng-if="component.isResource()" data-tests-id="asset-type">{{component.getComponentSubType()}}</div> - <div data-ng-if="component.isService()">S</div> - </div> + <div class='sdc-tile-header' data-ng-class="{'purple': component.isResource(), 'blue': !component.isResource()}"> + <div data-ng-if="component.isResource()" data-tests-id="asset-type">{{component.getComponentSubType()}}</div> + <div data-ng-if="component.isService()">S</div> </div> + <div class='sdc-tile-content' data-ng-click="gui.isLoading || goToComponent(component)"> - <div class='sdc-tile-content-icon'> + <div class='sdc-tile-content-icon centered'> <div class="{{component.iconSprite}} {{component.icon}}" data-ng-class="{'sprite-resource-icons': component.isResource(), 'sprite-services-icons': component.isService()}" data-tests-id="{{component.name}}"></div> </div> <div class='sdc-tile-content-info'> - <div class="sdc-tile-content-info-item-name" data-tests-id="{{component.name | resourceName}}" sdc-smart-tooltip>{{component.name | resourceName}}</div> - <div class="sdc-tile-content-info-version-info"> - <div class="sdc-tile-content-info-version-info-text" data-tests-id="{{component.name}}Version">V {{component.version}}</div> + <div class="sdc-tile-info-line title" data-tests-id="{{component.name | resourceName}}" sdc-smart-tooltip>{{component.name | resourceName}}</div> + <div class="sdc-tile-info-line subtitle" data-tests-id="{{component.name}}Version"> + V {{component.version}} </div> </div> </div> <div class='sdc-tile-footer'> - <div class='sdc-tile-footer-text'>{{component.getStatus(sdcMenu)}}</div> + <div class="sdc-tile-footer-content"> + <div class='sdc-tile-footer-text'>{{component.getStatus(sdcMenu)}}</div> + </div> </div> </div> @@ -192,8 +193,7 @@ </div> - <top-nav top-lvl-selected-index="1" search-bind="search.filterTerm" version="{{version}}"></top-nav> + <top-nav [top-lvl-selected-index]="1" [search-term]="search.filterTerm" (search-term-change)="search.filterTerm=$event" [version]="version"></top-nav> - <ecomp-footer></ecomp-footer> </div> @@ -20,9 +20,10 @@ 'use strict'; import {IConfigRoles, IAppConfigurtaion, IAppMenu, IUserProperties, Component} from "app/models"; -import {EntityService, IUserResourceClass, SharingService, CacheService} from "app/services"; +import {EntityService, SharingService, CacheService} from "app/services"; import {ComponentType, ResourceType, MenuHandler, ModalsHandler, ChangeLifecycleStateHandler, SEVERITY, ComponentFactory} from "app/utils"; import {IClientMessageModalModel} from "../modals/message-modal/message-client-modal/client-message-modal-view-model"; +import {UserService} from "../../ng2/services/user.service"; export interface IDashboardViewModelScope extends ng.IScope { @@ -171,7 +172,7 @@ export class DashboardViewModel { 'sdcMenu', '$state', '$stateParams', - 'Sdc.Services.UserResourceService', + 'UserServiceNg2', 'Sdc.Services.SharingService', 'Sdc.Services.CacheService', '$q', @@ -191,7 +192,7 @@ export class DashboardViewModel { private sdcMenu:IAppMenu, private $state:any, private $stateParams:any, - private userResourceService:IUserResourceClass, + private userService:UserService, private sharingService:SharingService, private cacheService:CacheService, private $q:ng.IQService, @@ -239,7 +240,7 @@ export class DashboardViewModel { this.$scope.isLoading = false; this.$scope.sdcConfig = this.sdcConfig; this.$scope.sdcMenu = this.sdcMenu; - this.$scope.user = this.userResourceService.getLoggedinUser(); + this.$scope.user = this.userService.getLoggedinUser(); this.$scope.roles = this.sdcMenu.roles; this.$scope.showTutorial = false; this.$scope.isFirstTime = false; @@ -47,29 +47,30 @@ </div> <!-- Tile new --> - <div class="sdc-tile-catalog sdc-tile-fix-width" data-ng-repeat="component in components | filter:{resourceType:('!'+vfcmtType)} | entityFilter:checkboxesFilter | filter:search"> - - <div class="sdc-tile-header"> - <div class='sdc-tile-header-type' data-ng-class="{'purple': component.isResource(), 'blue': !component.isResource()}"> - <div data-ng-if="component.isResource()" data-tests-id="asset-type">{{component.getComponentSubType()}}</div> - <div data-ng-if="component.isService()">S</div> - </div> + <div class="sdc-tile sdc-tile-fix-width" data-ng-repeat="component in components | filter:{resourceType:('!'+vfcmtType)} | entityFilter:checkboxesFilter | filter:search"> + + <div class='sdc-tile-header' data-ng-class="{'purple': component.isResource(), 'blue': !component.isResource()}"> + <div data-ng-if="component.isResource()" data-tests-id="asset-type">{{component.getComponentSubType()}}</div> + <div data-ng-if="component.isService()">S</div> </div> + <div class='sdc-tile-content' data-tests-id="dashboard-Elements" data-ng-click="goToComponent(component)"> <div class='sdc-tile-content-icon'> <div class="{{component.iconSprite}} {{component.icon}}" data-ng-class="{'sprite-resource-icons': component.isResource(), 'sprite-services-icons': component.isService()}" data-tests-id="{{component.name}}"></div> </div> + <div class='sdc-tile-content-info'> - <div class="sdc-tile-content-info-item-name" data-tests-id="{{component.name | resourceName}}" sdc-smart-tooltip>{{component.name | resourceName}}</div> - <div class="sdc-tile-content-info-version-info"> - <div class="sdc-tile-content-info-version-info-text" data-tests-id="{{component.name}}Version">V {{component.version}}</div> - </div> + <div class="sdc-tile-info-line title" data-tests-id="{{component.name | resourceName}}" sdc-smart-tooltip>{{component.name | resourceName}}</div> + <div class="sdc-tile-info-line subtitle" data-tests-id="{{component.name}}Version">V {{component.version}}</div> </div> </div> + <div class='sdc-tile-footer'> - <div class='sdc-tile-footer-text'>{{component.getStatus(sdcMenu)}}</div> + <div class="sdc-tile-footer-content"> + <div class='sdc-tile-footer-text'>{{component.getStatus(sdcMenu)}}</div> + </div> </div> </div> @@ -103,10 +104,9 @@ </div> - <top-nav top-lvl-selected-index="0" version="{{version}}" search-bind="search.filterTerm" notification-icon-callback="notificationIconCallback" version="{{version}}"></top-nav> + <top-nav [top-lvl-selected-index]="0" [version]="version" [search-term]="search.filterTerm" (search-term-change)="search.filterTerm=$event" [notification-icon-callback]="notificationIconCallback"></top-nav> </div> <div data-ui-view=""></div> -<ecomp-footer></ecomp-footer> @@ -12,6 +12,6 @@ <div id="main" ui-view="main"></div> </div> - <top-nav top-lvl-selected-index="3" search-bind="search.filterTerm" menu-model="topNavMenuModel" version="{{version}}"></top-nav> + <top-nav [top-lvl-selected-index]="3" [search-term]="search.filterTerm" (search-term-change)="search.filterTerm=$event" [menu-model]="topNavMenuModel" [version]="version"></top-nav> </div> @@ -46,7 +46,8 @@ <div class="i-sdc-form-item" data-ng-class="{error:(forms.editForm[parameter.name].$dirty && forms.editForm[parameter.name].$invalid), required: (parameter.defaultValue)}"> <span class="required-symbol">*</span> <div class="input-parameter"> - <input class="i-sdc-form-input" data-ng-class="{error: (forms.editForm[parameter.name].$invalid)}" + <input class="i-sdc-form-input" data-ng-class="{error: (forms.editForm[parameter.name].$invalid), + 'default-value':(parameter.defaultValue && parameter.currentValue === parameter.defaultValue)}" data-ng-model-options="{ debounce: 200 }" data-ng-model="parameter.currentValue" value="{{parameter.currentValue}}" @@ -54,7 +55,7 @@ name="{{parameter.name}}" data-ng-pattern="getValidationPattern(parameter.type, 'heat')" data-ng-required="parameter.defaultValue" - data-ng-change="'json'==parameter.type && forms.editForm[parameter.name].$setValidity('pattern', validateJson(parameter.currentValue))" + data-ng-change="onValueChanged(parameter)" data-ng-blur="(forms.editForm[parameter.name].$error.required && (parameter.currentValue=parameter.defaultValue))" data-tests-id="value-field-of-{{parameter.name}}"/> @@ -1,4 +1,3 @@ - .sdc-env-form-container{ .w-sdc-modal-body{ padding: 20px 10px 2px 10px; @@ -110,6 +109,9 @@ width: 100%; display: inline-flex; padding-right: 33px; + &.default-value{ + border-color: @func_color_h; + } } .action-button{ border-left: solid 1px @main_color_o; @@ -37,6 +37,7 @@ export interface IEnvParametersFormViewModelScope extends ng.IScope { getValidationPattern(type:string):RegExp; isInstance():boolean; validateJson(json:string):boolean; + onValueChanged(parameter: HeatParameterModel):void; close():void; save():void; openDescPopover(selectedParam:HeatParameterModel):void; @@ -86,7 +87,10 @@ export class EnvParametersFormViewModel { this.$scope.envParametersModal = this.$uibModalInstance; this.$scope.artifactResource = this.artifact; this.$scope.heatParameters = angular.copy(this.artifact.heatParameters); - + //if param does not have a value - display the default + this.$scope.heatParameters.forEach((heatParam) => { + heatParam.currentValue = heatParam.currentValue || heatParam.defaultValue; + }); this.$scope.tableHeadersList = [ {title: "Parameter", property: "name"}, {title: "Default Value", property: "defaultValue", info: "DEFAULT_VALUE_INFO"}, @@ -114,13 +118,13 @@ export class EnvParametersFormViewModel { this.$scope.save = ():void => { this.$scope.buttons[0].disabled = true;//prevent double click (DE246266) this.$scope.isLoading = true; - this.artifact.heatParameters = this.$scope.heatParameters; + this.artifact.heatParameters = angular.copy(this.$scope.heatParameters); this.artifact.heatParameters.forEach((parameter:any):void => { if ("" === parameter.currentValue) { //[Bug 154465] - Update and erase current value field in Env parameters form return empty String ("") instead of null. parameter.currentValue = null; - }else if (!parameter.currentValue && parameter.defaultValue) { - parameter.currentValue = parameter.defaultValue; + } else if (parameter.defaultValue && parameter.defaultValue == parameter.currentValue) { + parameter.currentValue = undefined; } }); @@ -143,6 +147,13 @@ export class EnvParametersFormViewModel { this.component.addOrUpdateArtifact(this.$scope.artifactResource).then(success, error); }; + this.$scope.onValueChanged = (parameter: HeatParameterModel):void => { + parameter.filterTerm = parameter.name + ' ' + parameter.currentValue + ' ' + parameter.defaultValue + ' ' +parameter.description + if('json'==parameter.type){ + this.$scope.forms.editForm[parameter.name].$setValidity('pattern', this.$scope.validateJson(parameter.currentValue)); + } + } + this.$scope.close = ():void => { //this.artifact.heatParameters.forEach((parameter:any):void => { // if (!parameter.currentValue && parameter.defaultValue) { @@ -112,6 +112,7 @@ export class PropertyFormViewModel { private initResource = ():void => { this.$scope.editPropertyModel.property = new PropertyModel(this.property); this.$scope.editPropertyModel.property.type = this.property.type ? this.property.type : null; + this.$scope.editPropertyModel.property.value = this.$scope.editPropertyModel.property.value || this.$scope.editPropertyModel.property.defaultValue; this.setMaxLength(); this.initAddOnLabels(); }; @@ -241,7 +242,7 @@ export class PropertyFormViewModel { let onPropertySuccess = (propertyFromBE:PropertyModel):void => { console.info('onPropertyResourceSuccess : ', propertyFromBE); this.$scope.isLoading = false; - + this.filteredProperties[this.$scope.currentPropertyIndex] = propertyFromBE; if (!doNotCloseModal) { this.$uibModalInstance.close(propertyFromBE); } else { @@ -125,6 +125,7 @@ export class OnboardingModalViewModel { this.cacheService.set(CHANGE_COMPONENT_CSAR_VERSION_FLAG, (<Resource>this.$scope.selectedComponent).csarVersion); this.$state.go('workspace.general', { id: this.$scope.componentFromServer.uniqueId, + componentCsar: this.$scope.selectedComponent, type: this.$scope.componentFromServer.componentType.toLowerCase(), disableButtons: true }); @@ -5,8 +5,7 @@ <punch-out name="'onboarding/vendor'" data="vendorData" user="user" on-event="onVendorEvent"></punch-out> </div> - <top-nav top-lvl-selected-index="2" search-bind="search.filterTerm" menu-model="topNavMenuModel" version="{{version}}" hide-search="true"></top-nav> + <top-nav [top-lvl-selected-index]="2" [menu-model]="topNavMenuModel" [version]="version" [hide-search]="true"></top-nav> - <ecomp-footer></ecomp-footer> </div> @@ -25,7 +25,7 @@ import {IWorkspaceViewModelScope} from "../../workspace-view-model"; import {ComponentServiceNg2} from "app/ng2/services/component-services/component.service"; import {ComponentGenericResponse} from "app/ng2/services/responses/component-generic-response"; import {Resource} from "app/models/components/resource"; -import {ResourceType} from "../../../../utils/constants"; +import {ResourceType,ComponentType} from "../../../../utils/constants"; export interface ICompositionViewModelScope extends IWorkspaceViewModelScope { @@ -48,6 +48,7 @@ export interface ICompositionViewModelScope extends IWorkspaceViewModelScope { setSelectedInstance(componentInstance:ComponentInstance):void; printScreen():void; isPNF():boolean; + isConfiguration():boolean; cacheComponentsInstancesFullData:Component; } @@ -167,9 +168,12 @@ export class CompositionViewModel { this.$scope.updateSelectedComponent = ():void => { if (this.$scope.currentComponent.selectedInstance) { - + let parentComponentUid = this.$scope.currentComponent.selectedInstance.componentUid + if(this.$scope.currentComponent.selectedInstance.originType === ComponentType.SERVICE_PROXY){ + parentComponentUid = this.$scope.currentComponent.selectedInstance.sourceModelUid; + } let componentParent = _.find(this.cacheComponentsInstancesFullData, (component) => { - return component.uniqueId === this.$scope.currentComponent.selectedInstance.componentUid; + return component.uniqueId === parentComponentUid; }); if (componentParent) { this.$scope.selectedComponent = componentParent; @@ -185,7 +189,7 @@ export class CompositionViewModel { console.log("Error updating selected component"); this.$scope.isLoadingRightPanel = false; }; - this.ComponentFactory.getComponentFromServer(this.$scope.currentComponent.selectedInstance.originType, this.$scope.currentComponent.selectedInstance.componentUid).then(onSuccess, onError); + this.ComponentFactory.getComponentFromServer(this.$scope.currentComponent.selectedInstance.originType, parentComponentUid).then(onSuccess, onError); } catch (e) { console.log("Error updating selected component", e); this.$scope.isLoadingRightPanel = false; @@ -247,6 +251,10 @@ export class CompositionViewModel { return this.$scope.selectedComponent.isResource() && (<Resource>this.$scope.selectedComponent).resourceType === ResourceType.PNF; }; + this.$scope.isConfiguration = (): boolean => { + return this.$scope.selectedComponent.isResource() && (<Resource>this.$scope.selectedComponent).resourceType === ResourceType.CONFIGURATION; + }; + this.eventListenerService.registerObserverCallback(EVENTS.ON_CHECKOUT, this.$scope.reload); } @@ -58,29 +58,30 @@ data-ui-sref="workspace.composition.deployment" tooltips tooltip-class="tooltip-custom tab-tooltip" tooltip-content="Deployment Artifacts" data-tests-id="deployment-artifact-tab" - data-ng-if="!isPNF()"> + data-ng-if="!isPNF() && !isConfiguration() && !(isComponentInstanceSelected() && currentComponent.selectedInstance.isServiceProxy())"> <div class="i-sdc-designer-sidebar-tab-icon sprite-new deployment-artifacts"></div> </button> <button tooltips tooltip-class="tooltip-custom tab-tooltip" - tooltip-content="{{selectedComponent.isResource() ? 'Properties and Attributes': 'Inputs'}}" + tooltip-content="{{selectedComponent.isResource() || (isComponentInstanceSelected() && currentComponent.selectedInstance.isServiceProxy()) ? 'Properties and Attributes': 'Inputs'}}" class="i-sdc-designer-sidebar-tab" data-ui-sref-active="active" data-ui-sref="workspace.composition.properties" data-tests-id="properties-and-attributes-tab"> <div class="i-sdc-designer-sidebar-tab-icon sprite-new" - ng-class="selectedComponent.isResource() ? 'properties': 'inputs'"></div> + ng-class="selectedComponent.isResource() || (isComponentInstanceSelected() && currentComponent.selectedInstance.isServiceProxy()) ? 'properties': 'inputs'"></div> </button> <button class="i-sdc-designer-sidebar-tab" data-ui-sref-active="active" data-ui-sref="workspace.composition.artifacts" + data-ng-if="!isConfiguration() && !(isComponentInstanceSelected() && currentComponent.selectedInstance.isServiceProxy())" tooltips tooltip-class="tooltip-custom tab-tooltip" tooltip-content="Information Artifacts"> <div class="i-sdc-designer-sidebar-tab-icon sprite-new information-artifacts"></div> </button> - <button data-ng-show="!selectedComponent.isService()" class="i-sdc-designer-sidebar-tab" + <button data-ng-if="!selectedComponent.isService() || (isComponentInstanceSelected() && currentComponent.selectedInstance.isServiceProxy())" class="i-sdc-designer-sidebar-tab" data-ui-sref-active="active" ui-sref="workspace.composition.relations" tooltips tooltip-class="tooltip-custom tab-tooltip tooltip-rightside" tooltip-content="Requirements and Capabilities"> <div class="i-sdc-designer-sidebar-tab-icon sprite-new relations"></div> </button> - <button data-ng-show="selectedComponent.isService()" class="i-sdc-designer-sidebar-tab" + <button data-ng-if="selectedComponent.isService() && !(isComponentInstanceSelected() && currentComponent.selectedInstance.isServiceProxy())" class="i-sdc-designer-sidebar-tab" data-ui-sref-active="active" ui-sref="workspace.composition.api" data-tests-id="tab-api" tooltips tooltip-class="tooltip-custom tab-tooltip tooltip-rightside" tooltip-content="API"> <div class="i-sdc-designer-sidebar-tab-icon sprite-new api"></div> @@ -21,6 +21,11 @@ } } } + + .custom-modal { + /* Hack solution to hide canvas tooltips under modals */ + z-index: 20000 !important; + } } .workspace-composition { @@ -68,7 +73,7 @@ .w-sdc-designer-sidebar { background-color:@main_color_p ; .noselect; - bottom: @footer_height; + bottom: 0; position: fixed; right: -302px; width: 302px; @@ -92,8 +97,8 @@ .w-sdc-designer-sidebar-logo-ph { display: inline-block; vertical-align: middle; - line-height: 48px; - height: 48px; + line-height: 60px; + height: 60px; } .w-sdc-designer-sidebar-logo { @@ -129,7 +134,7 @@ } .w-sdc-designer-sidebar-tabs { - .bg_e; + .bg_c; } .w-sdc-designer-sidebar-tabs::after { @@ -275,7 +280,9 @@ .g_7; .bg_c; border-radius: 4px; - display: inline-block; + //fix long name for firefox: + display: block; + float: left; line-height: 25px; margin: 0 4px 6px 0; min-width: 50px; @@ -620,7 +627,11 @@ display: inline-block; margin: 12px 0 12px 10px; pointer-events: auto; - + height: 45px; + width: 40px; + float: left; + display: flex; + align-items: center; .non-certified { position: relative; left: 27px; @@ -849,82 +860,30 @@ // --------------------------------------------------------------------------------------------------- // Canvas inline menu // --------------------------------------------------------------------------------------------------- - .w-sdc-canvas-menu { - position: fixed; - z-index: 100; - - border-style: solid; - border-width: 1px; - border-color: #d8d8d8; - box-sizing: border-box; - background-color: #ffffff; - box-shadow: 0px 2px 2px 0px rgba(24, 24, 25, 0.1); - width: 91px; - - /* &.vl-type-select{ - width: 173px; - } - */ + .w-sdc-canvas-menu-list { + .w-sdc-canvas-menu-item-view { + &::before { + content: ''; + display: inline-block; - h3 { - color: @func_color_s; - font-size: 14px; - font-weight: bold; - margin: 0; - padding: 7px 11px; - border-bottom: 1px solid #e5e5e5; + .sprite-new; + .view-icon; + vertical-align: top; + margin: 2px 6px 2px 4px; + } } - .w-sdc-canvas-menu-content { - padding: 5px 5px; - - &.vl-select{ - border-bottom: #d8d8d8 solid 1px; - line-height: 15px; - - .tlv-radio { - padding: 3px 0px; - - .tlv-radio-label { - padding: 3px 0px; - - &::before { - margin-right: 10px; - } - } - } - } + .w-sdc-canvas-menu-item-delete { + &::before { + content: ''; + display: inline-block; - .w-sdc-canvas-menu-content-update-button { - .sprite; - .sprite.e-sdc-small-icon-delete; - .hand; - position: absolute; - top: 15px; - right: 10px; + .sprite-new; + .delete-icon; + vertical-align: bottom; + margin: 1px 10px 0 7px; } - .w-sdc-canvas-menu-content-delete-button { - .sprite; - .sprite.e-sdc-small-icon-delete; - .hand; - margin: 0 8px 0 6px; - } - } - - .w-sdc-canvas-menu-arrow { - //TODO: Missing image for small blue triangle. - background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAFCAYAAAB4ka1VAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMDE0IDc5LjE1Njc5NywgMjAxNC8wOC8yMC0wOTo1MzowMiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTQgKFdpbmRvd3MpIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOkE1OTIzNDI1MENFQjExRTU4ODRERTI1MDM2REZCOUYzIiB4bXBNTTpEb2N1bWVudElEPSJ4bXAuZGlkOkE1OTIzNDI2MENFQjExRTU4ODRERTI1MDM2REZCOUYzIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6QTU5MjM0MjMwQ0VCMTFFNTg4NERFMjUwMzZERkI5RjMiIHN0UmVmOmRvY3VtZW50SUQ9InhtcC5kaWQ6QTU5MjM0MjQwQ0VCMTFFNTg4NERFMjUwMzZERkI5RjMiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz4gBXTlAAAAOElEQVR42mK0rp7NgASMgZgFiE/CBJjQJPcA8U4gNkdXAJMUAGJ+ZEVMaJIwAFfEhEUSRRFAgAEAVtgJyiLAPWAAAAAASUVORK5CYII='); - content: ''; - display: block; - height: 21px; - position: absolute; - right: 12px; - top: -24px; - width: 184px; - background-repeat: no-repeat; - background-position: 175px 16px; } - } } /*.right-tab-loader { @@ -40,7 +40,7 @@ export interface IArtifactsViewModelScope extends ICompositionViewModelScope { artifactType:string; downloadFile:IFileDownload; isLoading:boolean; - displayDeleteButtonMap:Dictionary<string, boolean>; + allowDeleteAndUpdateArtifactMap:Dictionary<string, boolean>; getTitle():string; addOrUpdate(artifact:ArtifactModel):void; delete(artifact:ArtifactModel):void; @@ -126,9 +126,9 @@ export class ResourceArtifactsViewModel { } } this.$scope.artifacts = artifacts; - this.$scope.displayDeleteButtonMap = new Dictionary<string, boolean>(); + this.$scope.allowDeleteAndUpdateArtifactMap = new Dictionary<string, boolean>(); _.forEach(this.$scope.artifacts, (artifact:ArtifactModel)=>{ - this.$scope.displayDeleteButtonMap[artifact.artifactLabel] = this.displayDeleteButton(artifact); + this.$scope.allowDeleteAndUpdateArtifactMap[artifact.artifactLabel] = this.allowDeleteAndUpdateArtifact(artifact); }); this.$scope.isLoading = false; }; @@ -234,8 +234,8 @@ export class ResourceArtifactsViewModel { }); }; - private displayDeleteButton = (artifact:ArtifactModel):boolean => { - if(!this.$scope.isViewMode() && artifact.esId){ + private allowDeleteAndUpdateArtifact = (artifact:ArtifactModel):boolean => { + if(!this.$scope.isViewMode()){ if(this.$scope.isComponentInstanceSelected()){//is artifact of instance return !this.$scope.selectedComponent.deploymentArtifacts || !this.$scope.selectedComponent.deploymentArtifacts[artifact.artifactLabel];//if the artifact is not from instance parent }else{//is artifact of main component @@ -1,5 +1,6 @@ <perfect-scrollbar class="w-sdc-designer-sidebar-tab-content artifacts"> <div class="w-sdc-designer-sidebar-section"> + <loader data-display="isLoading"></loader> <expand-collapse expanded-selector=".w-sdc-designer-sidebar-section-content" class="w-sdc-designer-sidebar-section-title"> <span class="w-sdc-designer-sidebar-section-title-text" data-ng-bind="getTitle()" tooltips tooltip-content="{{getTitle()}}"></span> @@ -19,8 +20,8 @@ data-ng-if="artifact.artifactName"></div> <div> <span class="i-sdc-designer-sidebar-section-content-item-artifact-details-name" data-tests-id="artifact_Display_Name-{{artifact.artifactDisplayName}}" - data-ng-class="{'hand enabled': !isViewMode() && !artifact.isHEAT() && !artifact.isThirdParty() && !isLicenseArtifact(artifact)}" - data-ng-bind="artifact.artifactDisplayName" data-ng-click="!isViewMode() && !isLoading && !isComponentInstanceSelected() && !artifact.isHEAT() && !artifact.isThirdParty() && !isLicenseArtifact(artifact) && addOrUpdate(artifact)" + data-ng-class="{'hand enabled': allowDeleteAndUpdateArtifactMap[artifact.artifactLabel]}" + data-ng-bind="artifact.artifactDisplayName" data-ng-click="!isLoading && allowDeleteAndUpdateArtifactMap[artifact.artifactLabel] && addOrUpdate(artifact)" tooltips tooltip-content="{{artifact.artifactDisplayName}}"></span> <div class="i-sdc-designer-sidebar-section-content-item-artifact-heat-env" ng-if="artifact.heatParameters.length"> <span data-ng-bind="getEnvArtifactName(artifact)"data-tests-id="heat_env_{{artifact.artifactDisplayName}}"></span> @@ -36,7 +37,7 @@ <span class="i-sdc-designer-sidebar-section-content-item-artifact-details-desc-label" data-ng-show="artifact.description">Description:</span>{{artifact.description}} </div> </div> - <button ng-if="displayDeleteButtonMap[artifact.artifactLabel]" class="i-sdc-designer-sidebar-section-content-item-button delete sprite e-sdc-small-icon-delete" + <button ng-if="artifact.esId && allowDeleteAndUpdateArtifactMap[artifact.artifactLabel]" class="i-sdc-designer-sidebar-section-content-item-button delete sprite e-sdc-small-icon-delete" data-tests-id="delete_{{artifact.artifactDisplayName}}" data-ng-click="delete(artifact)" type="button"></button> <button ng-if="!isViewMode() && artifact.isHEAT() && isComponentInstanceSelected() && artifact.heatParameters.length" class="i-sdc-designer-sidebar-section-content-item-button attach sprite e-sdc-small-icon-pad" @@ -11,7 +11,7 @@ <div class="w-sdc-designer-sidebar-section-content general"> <div class="i-sdc-designer-sidebar-section-content-item"> <span class="i-sdc-designer-sidebar-section-content-item-label">Type:</span> - <span class="i-sdc-designer-sidebar-section-content-item-value" data-tests-id="rightTab_componentType" data-ng-bind="selectedComponent.componentType"></span> + <span class="i-sdc-designer-sidebar-section-content-item-value" data-tests-id="rightTab_componentType" data-ng-bind="isComponentInstanceSelected() && currentComponent.selectedInstance.isServiceProxy() ? 'Service Proxy' : selectedComponent.componentType"></span> </div> <div class="i-sdc-designer-sidebar-section-content-item" data-ng-if="selectedComponent.isResource()"> <span class="i-sdc-designer-sidebar-section-content-item-label">Resource Type:</span> @@ -103,8 +103,15 @@ <span class="i-sdc-designer-sidebar-section-content-item-value" data-ng-bind="selectedComponent.contactId" data-tests-id="rightTab_contactId"></span> </div> + + <div class="i-sdc-designer-sidebar-section-content-item" data-ng-if="isComponentInstanceSelected() && currentComponent.selectedInstance.isServiceProxy()"> + <span class="i-sdc-designer-sidebar-section-content-item-label" translate="GENERAL_LABEL_SOURCE_SERVICE_NAME"></span> + <span class="i-sdc-designer-sidebar-section-content-item-value" data-ng-bind="currentComponent.selectedInstance.sourceModelName" tooltips tooltip-class="tooltip-custom break-word-tooltip" tooltip-content="​{{currentComponent.selectedInstance.sourceModelName}}" + data-tests-id="rightTab_sourceModelName"></span> + </div> + <div class="i-sdc-designer-sidebar-section-content-item" data-ng-if="isViewMode() && currentComponent.isService() && selectedComponent.isResource()"> - <span class="i-sdc-designer-sidebar-section-content-item-label">Resource Customization UUID:</span><br> + <span class="i-sdc-designer-sidebar-section-content-item-label" translate="GENERAL_LABEL_RESOURCE_CUSTOMIZATION_UUID"></span><br> <span class="customization-uuid selectable" data-ng-bind="currentComponent.selectedInstance.customizationUUID" data-tests-id="rightTab_customizationModuleUUID"></span><br> </div> @@ -33,7 +33,7 @@ overflow: hidden; text-overflow: ellipsis; white-space: nowrap; - display: inline-block; + //display: inline-block; fix long name for firefox max-width: 160px; vertical-align:bottom; font-weight: normal; @@ -41,11 +41,16 @@ export class componentCategories {//categories field bind to this obj in order t selectedCategory:string; } +export interface IEnvironmentContext { + defaultValue:string; + validValues:Array<string>; +} export interface IGeneralScope extends IWorkspaceViewModelScope { validation:Validation; editForm:ng.IFormController; categories:Array<IMainCategory>; + environmentContextObj:IEnvironmentContext; latestCategoryId:string; latestVendorName:string; importedFileExtension:any; @@ -67,6 +72,7 @@ export interface IGeneralScope extends IWorkspaceViewModelScope { onEcompGeneratedNamingChange():void; openOnBoardingModal():void; initCategoreis():void; + initEnvironmentContext():void; updateIcon():void; possibleToUpdateIcon():boolean; } @@ -195,6 +201,9 @@ export class GeneralViewModel { // Init categories this.$scope.initCategoreis(); + // Init Environment Context + this.$scope.initEnvironmentContext(); + // Init the decision if to show file browse. this.$scope.isShowFileBrowse = false; if (this.$scope.component.isResource()) { @@ -239,6 +248,7 @@ export class GeneralViewModel { //TODO remove this after handling contact in UI if (this.$scope.isCreateMode()) { this.$scope.component.contactId = this.cacheService.get("user").userId; + this.$scope.originComponent.contactId = this.$scope.component.contactId; } }; @@ -288,6 +298,19 @@ export class GeneralViewModel { } }; + + this.$scope.initEnvironmentContext = ():void => { + if (this.$scope.componentType === ComponentType.SERVICE) { + this.$scope.environmentContextObj = this.cacheService.get('UIConfiguration').environmentContext; + var environmentContext:string =(<Service>this.$scope.component).environmentContext; + var isCheckout:boolean = ComponentState.NOT_CERTIFIED_CHECKOUT === this.$scope.component.lifecycleState; + // In creation new service OR check outing old service without environmentContext parameter - set default value + if(this.$scope.isCreateMode() || (isCheckout && !environmentContext)){ + (<Service>this.$scope.component).environmentContext = this.$scope.environmentContextObj.defaultValue; + } + } + }; + this.$scope.validateField = (field:any):boolean => { if (field && field.$dirty && field.$invalid) { return true; @@ -416,5 +439,8 @@ export class GeneralViewModel { } }; this.EventListenerService.registerObserverCallback(EVENTS.ON_CHECKOUT, this.$scope.reload); + this.EventListenerService.registerObserverCallback(EVENTS.ON_REVERT, ()=>{ + this.$scope.componentCategories.selectedCategory = this.$scope.originComponent.selectedCategory; + }); }; } @@ -343,9 +343,9 @@ data-ng-model-options="{ debounce: 500 }" name="serviceType" data-tests-id="serviceType" - data-ng-maxlength="25" - data-ng-pattern="validation.VendorReleaseValidationPattern" - maxlength="25" + data-ng-maxlength="256" + data-ng-pattern="validation.ServiceTypeAndRoleValidationPattern" + maxlength="256" /> <div class="input-error" data-ng-show="validateField(editForm.serviceType)"> <span ng-show="editForm.serviceType.$error.maxlength" translate="VALIDATION_ERROR_MAX_LENGTH" translate-values="{'max': '25' }"></span> @@ -365,9 +365,9 @@ data-ng-model-options="{ debounce: 500 }" name="serviceRole" data-tests-id="serviceRole" - data-ng-maxlength="25" - data-ng-pattern="validation.VendorReleaseValidationPattern" - maxlength="25" + data-ng-maxlength="256" + data-ng-pattern="validation.ServiceTypeAndRoleValidationPattern" + maxlength="256" /> <div class="input-error" data-ng-show="validateField(editForm.serviceRole)"> <span ng-show="editForm.serviceRole.$error.maxlength" translate="VALIDATION_ERROR_MAX_LENGTH" translate-values="{'max': '25' }"></span> @@ -376,6 +376,26 @@ </div> <!--------------------- Service Role --------------------> + <!-------------------- ENVIRONMENT CONTEXT -----------------> + + <div ng-if="component.isService()" class="i-sdc-form-item"> + <loader data-display="!environmentContextObj && !initEnvironmentContext()" relative="true"></loader> + <label class="i-sdc-form-label">Environment Context</label> + <select class="i-sdc-form-select" + name="environmentContext" + data-ng-class="{'view-mode': isViewMode()}" + data-ng-model="component.environmentContext" + data-tests-id="environmentContext" + > + <option data-ng-repeat="environmentContextVal in (environmentContextObj.validValues) | orderBy" + value="{{environmentContextVal}}" + data-tests-id="{{environmentContextVal}}">{{environmentContextVal}}</option> + </select> + + </div> + <!--------------------- ENVIRONMENT CONTEXT ------------------> + + <div class="meta-data" data-ng-if="component.creationDate"> <div> <b>Created:</b> @@ -71,7 +71,8 @@ export class PropertiesViewModel { } private openEditPropertyModal = (property:PropertyModel):void => { - this.ModalsHandler.openEditPropertyModal(property, this.$scope.component, this.$scope.filteredProperties, false).then(() => { + this.ModalsHandler.openEditPropertyModal(property, this.$scope.component, this.$scope.filteredProperties, false).then((updatedProperty:PropertyModel) => { + //property = updatedProperty; }); }; @@ -393,7 +393,7 @@ export class WorkspaceViewModel { } else { this.$scope.component = this.ComponentFactory.createComponent(this.$scope.originComponent); } - + this.EventListenerService.notifyObservers(EVENTS.ON_REVERT); }; this.$scope.changeLifecycleState = (state:string):void => { @@ -7,11 +7,11 @@ {{menuComponentTitle}} </div> <div class="i-sdc-designer-sidebar-section-content-item" ng-class="{'selected': menuItem.state == $state.current.name}" ng-repeat="menuItem in leftBarTabs.menuItems track by $index"> - <div class="expand-collapse-menu-box-item-text" ng-click="onMenuItemPressed(menuItem.state)" ng-class="{'disabled': menuItem.isDisabled }" data-tests-id="{{menuItem.text}}">{{menuItem.text}}</div> + <div class="expand-collapse-menu-box-item-text" ng-click="onMenuItemPressed(menuItem.state)" ng-class="{'disabled': menuItem.isDisabled }" data-tests-id="{{menuItem.text}}LeftSideMenu">{{menuItem.text}}</div> </div> </div> - <div include-padding="true" class="w-sdc-main-right-container" data-ng-class="{'composition':isComposition}"> + <div include-padding="true" class="w-sdc-main-right-container" data-ng-class="{'composition':isComposition, 'deployment':isDeployment}"> <loader data-display="isCreateProgress" data-ng-show="isCreateProgress" relative="false"></loader> <div class="sdc-workspace-top-bar"> @@ -63,8 +63,7 @@ <span data-ng-if="isDesigner()" data-ng-class="{'disabled' :isDisableMode() || isViewMode()}" ng-click="revert()" class="sprite-new revert-btn" data-tests-id="revert" data-ng-show="showFullIcons()" sdc-smart-tooltip="">Revert</span> - - <span data-ng-if="isComposition" class="sprite-new print-screen-btn" entity="component" print-graph-screen data-tests-id="printScreen"></span> + <span class="delimiter"></span> <span class="sprite-new x-btn" data-ng-click="goToBreadcrumbHome()" sdc-smart-tooltip="">Close</span> @@ -78,6 +77,5 @@ </div> </div> </div> - <top-nav search-bind="search.filterTerm" hide-search="true" menu-model="breadcrumbsModel" version="{{version}}"></top-nav> - <ecomp-footer></ecomp-footer> + <top-nav [hide-search]="true" [menu-model]="breadcrumbsModel" [version]="version"></top-nav> </div> @@ -170,8 +170,10 @@ line-height: 110px; .f-type ._28; } - &.composition .w-sdc-main-container-body-content { - height: calc(~'100% - @{action_nav_height}'); //composition is the only tab without a tab title. need to exclude from calculation. + &.composition, &.deployment{ + .w-sdc-main-container-body-content { + height: 100%; + } } .w-sdc-main-container-body-content { // height:calc(~'100% - @{action_nav_height} - @{tab_title}'); @@ -28,7 +28,7 @@ "GENERAL_LABEL_SERVICE_TYPE": "Service Type:", "GENERAL_LABEL_SERVICE_ROLE": "Service Role:", "GENERAL_LABEL_STATUS": "Status:", - "GENERAL_LABEL_PROJECT_CODE": "Project code:", + "GENERAL_LABEL_PROJECT_CODE": "Project Code:", "GENERAL_LABEL_DESCRIPTION": "Description:", "GENERAL_LABEL_TAGS": "Tags:", "GENERAL_LABEL_RESOURCE_TYPE": "Resource Type:", @@ -40,6 +40,9 @@ "GENERAL_LABEL_LIFE_CYCLE_STATUS": "Life Cycle Status:", "GENERAL_LABEL_DISTRIBUTION_STATUS": "Distribution Status:", "GENERAL_LABEL_SYSTEM_NAME": "System Name:", + "GENERAL_LABEL_SOURCE_SERVICE_NAME": "Source Service Name:", + "GENERAL_LABEL_RESOURCE_CUSTOMIZATION_UUID": "Resource Customization UUID:", + "=========== GENERAL_TAB ===========": "", "GENERAL_TAB_LABEL_RESOURCE_MODEL_NUMBER":"Vendor Model Number", @@ -37,7 +37,6 @@ @import 'notification-template.less'; // Less insides specific files. -@import '../../app/directives/ecomp-footer/ecomp-footer.less'; @import '../../app/directives/ecomp-header/ecomp-header.less'; @import '../../app/directives/edit-name-popover/edit-name-popover.less'; @import '../../app/directives/elements/checkbox/checkbox.less'; @@ -53,7 +52,6 @@ @import '../../app/directives/info-tooltip/info-tooltip.less'; @import '../../app/directives/inputs-and-properties/inputs/input-row.less'; @import '../../app/directives/inputs-and-properties/properties/property-row-view.less'; -@import '../../app/directives/layout/top-nav/top-nav.less'; @import '../../app/directives/layout/top-progress/top-progress.less'; @import '../../app/directives/loader/loader-directive.less'; @import '../../app/directives/modal/sdc-modal.less'; Binary files differBinary files differBinary files differBinary files differBinary files differBinary files differBinary files differBinary files differBinary files differBinary files differBinary files differBinary files differBinary files differBinary files differBinary files differBinary files differBinary files differBinary files differBinary files differ@@ -8,7 +8,7 @@ top: @header_height + @top_nav_height; left: 0; right: 0; - bottom: @footer_height; + bottom: 0; .w-sdc-main-right-container { .bg_n; @@ -24,8 +24,15 @@ padding-bottom: 80px; } - .sdc-tile-catalog { + .sdc-tile { margin: 10px; + .sdc-tile-content { + .sdc-tile-content-info { + .sdc-tile-info-line { + display: inline-block; + } + } + } } } @@ -192,7 +192,7 @@ .view-mode { opacity: 1; border: solid 1px @main_color_o; - background-color: #f8f8f8; + background-color: #f8f8f8 !important; cursor: auto; & + &:not(.icons-text), &.no-border-top { @@ -185,7 +185,7 @@ NEW DESIGN MODAL .w-sdc-modal-head { flex-grow: 1; - .s_18_m; + .s_18_r; height: 48px; line-height: 48px; display: flex; @@ -194,7 +194,7 @@ NEW DESIGN MODAL align-items: center; .w-sdc-modal-head-text { - .s_18_m; + .s_18_r; flex-grow: 999; } @@ -256,7 +256,7 @@ NEW DESIGN MODAL align-items: center; .w-sdc-modal-head-text { - .s_18_m; + .s_18_r; flex-grow: 999; } @@ -0,0 +1,40 @@ +.sprite-proxy-services-icons { + background-image: url('images/sprites/sprite-services-icons.png'); + display: inline-block; +} + +.sprite-proxy-services-icons.disable { opacity:0.5;} + + +.sprite-proxy-services-icons.compute.large { background-position: -611px -41px; width: 61px; height: 60px;} +.sprite-proxy-services-icons.compute.medium { background-position: -693px -60px; width: 41px; height: 41px;} + +.sprite-proxy-services-icons.platform.large { background-position: -611px -109px; width: 61px; height: 60px;} +.sprite-proxy-services-icons.platform.medium { background-position: -693px -128px; width: 41px; height: 41px;} + +.sprite-proxy-services-icons.storage.large { background-position: -611px -178px; width: 61px; height: 61px;} +.sprite-proxy-services-icons.storage.medium { background-position: -693px -198px; width: 41px; height: 41px;} + +.sprite-proxy-services-icons.call_controll.large { background-position: -611px -248px;; width: 61px; height: 61px;} +.sprite-proxy-services-icons.call_controll.medium { background-position: -693px -268px; width: 41px; height: 41px;} + +.sprite-proxy-services-icons.collaboration.large { background-position: -611px -318px; width: 61px; height: 61px;} +.sprite-proxy-services-icons.collaboration.medium { background-position: -693px -338px; width: 41px; height: 41px;} + +.sprite-proxy-services-icons.messaging.large { background-position: -611px -458px; width: 61px; height: 61px;} +.sprite-proxy-services-icons.messaging.medium { background-position: -693px -478px; width: 41px; height: 41px;} + +.sprite-proxy-services-icons.notification.large { background-position: -611px -529px; width: 60px; height: 60px;} +.sprite-proxy-services-icons.notification.medium { background-position: -693px -548px; width: 41px; height: 41px;} + +.sprite-proxy-services-icons.mobility.large { background-position: -611px -601px; width: 60px; height: 60px;} +.sprite-proxy-services-icons.mobility.medium { background-position: -693px -620px; width: 41px; height: 41px;} + +.sprite-proxy-services-icons.network_l_1-3.large { background-position: -611px -669px; width: 60px; height: 60px;} +.sprite-proxy-services-icons.network_l_1-3.medium { background-position: -693px -688px; width: 41px; height: 41px;} + +.sprite-proxy-services-icons.network_l_4.large { background-position: -611px -739px; width: 61px; height: 61px;} +.sprite-proxy-services-icons.network_l_4.medium { background-position: -693px -758px; width: 41px; height: 41px;} + +.sprite-proxy-services-icons.defaulticon.large { background-position: -611px -810px; width: 60px; height: 60px;} +.sprite-proxy-services-icons.defaulticon.medium { background-position: -695px -829px; width: 41px; height: 41px;} @@ -98,7 +98,7 @@ .sprite-resource-icons.defaulticon { background-position: -282px -2069px; width: 60px; height: 60px;} .sprite-resource-icons.defaulticon.small { background-position: -210px -2101px; width: 28px; height: 28px;} .sprite-resource-icons.defaulticon.medium { background-position: -141px -2089px; width: 40px; height: 40px;} -.sprite-resource-icons.defaulticon.large { background-position: -70px -2069px; width: 60px; height: 60px;} +.sprite-resource-icons.defaulticon.large { background-position: -70px -2069px; width: 61px; height: 60px;} .sprite-resource-icons.fortinet { background-position: -282px -1419px; width: 94px; height: 10px;} .sprite-resource-icons.fortinet.small { background-position: -210px -1401px; width: 28px; height: 28px;} @@ -212,12 +212,12 @@ .sprite-resource-icons.networkrules { background-position: -282px -4731px; width: 49px; height: 58px;} .sprite-resource-icons.networkrules.small { background-position: -210px -4749px; width: 31px; height: 36px;} -.sprite-resource-icons.networkrules.medium { background-position: -141px -4737px; width: 42px; height: 47px;} +.sprite-resource-icons.networkrules.medium { background-position: -141px -4737px; width: 42px; height: 42px;} .sprite-resource-icons.networkrules.large { background-position: -70px -4718px; width: 60px; height: 67px;} .sprite-resource-icons.securityrules { background-position: -282px -4651px; width: 49px; height: 58px;} .sprite-resource-icons.securityrules.small { background-position: -210px -4669px; width: 31px; height: 36px;} -.sprite-resource-icons.securityrules.medium { background-position: -141px -4657px; width: 42px; height: 47px;} +.sprite-resource-icons.securityrules.medium { background-position: -141px -4657px; width: 42px; height: 42px;} .sprite-resource-icons.securityrules.large { background-position: -70px -4638px; width: 60px; height: 67px;} .sprite-resource-icons.dcae_source { background-position: -282px -4563px; width: 60px; height: 60px;} @@ -267,3 +267,12 @@ .sprite-resource-icons.allotted_resource.large { background-position: -70px -4879px; width: 60px; height: 60px;} .sprite-resource-icons.vnfconfiguration.large { background-position: -70px -4959px; width: 60px; height: 60px;} + +.sprite-resource-icons.pmc.small {background-position: -214px -5238px; width: 21px; height: 21px;} +//.sprite-resource-icons.pmc.medium {background-position: -204px -5044px; width: 40px; height: 40px;} +//.sprite-resource-icons.pmc.large {background-position: -214px -5035px; width: 60px; height: 60px;} + +.sprite-resource-icons.dcae_machineLearning { background-position: -284px -5296px; width: 47px; height: 48px;} +.sprite-resource-icons.dcae_machineLearning.small { background-position: -210px -5315px; width: 29px; height: 29px;} +.sprite-resource-icons.dcae_machineLearning.medium { background-position: -141px -5303px; width: 41px; height: 41px;} +.sprite-resource-icons.dcae_machineLearning.large { background-position: -70px -5284px; width: 60px; height: 60px;}
\ No newline at end of file @@ -32,6 +32,10 @@ .delete-icon { background-position: -675px -231px; width: 11px; height: 13px;} .delete-icon-hover { background-position: -702px -231px; width: 11px; height: 13px;} +.view-icon { background-position: -671px -252px; width: 18px; height: 10px; } +.view-icon-hover { background-position: -699px -252px; width: 18px; height: 10px; } +.view-icon:hover:extend(.view-icon-hover) {} + .arrow-up { background-position: -350px -236px; width: 12px; height: 7px;} .arrow-up-hover { background-position: -400px -236px; width: 12px; height: 7px;} @@ -280,3 +284,10 @@ .sprite-new.canvas-fit-all { background-position: -208px -1326px; width: 30px; height: 30px;} .sprite-new.canvas-fit-all:hover { background-position: -128px -1326px; } .sprite-new.canvas-fit-all:active { background-position: -47px -1325px;} + +.blue-arrow-next{ background-position: -734px -878px; width: 23px; height: 23px;} +.blue-arrow-back{ background-position: -767px -878px; width: 23px; height: 23px;} +.white-arrow-next{ background-position: -734px -918px; width: 23px; height: 23px;} +.white-arrow-back{ background-position: -767px -918px; width: 23px; height: 23px;} +.link-tooltip-arrow{background-position:-746px -961px; width: 20px; height: 14px;} + @@ -70,6 +70,19 @@ div.tooltips { border-color:rgb(80, 99, 113); color: white; font-size:13px; + max-width: 350px; +} + +.link-qtip{ + .line{ + margin-bottom: 5px; + } + .req-cap-label{ + font-family: @font-opensans-regular; + } + .link-tooltip-arrow{ + margin-right: 5px; + } } .tooltip-custom { @@ -26,8 +26,8 @@ import {AppModule} from './app/ng2/app.module'; import {UpgradeModule} from '@angular/upgrade/static'; import {IAppConfigurtaion} from "./app/models/app-config"; -declare var __ENV__: string; -export declare var sdc2Config: IAppConfigurtaion; +declare const __ENV__: string; +export declare let sdc2Config: IAppConfigurtaion; if (__ENV__==='prod') { sdc2Config = require('./../configurations/prod.js'); @@ -37,7 +37,6 @@ if (__ENV__==='prod') { } // Ugliy fix because the cookie recieved from webseal change his value after some seconds. -declare var __ENV__: string; let timeout:number = 0; if (__ENV__==='dev'){ timeout=0; @@ -23,7 +23,8 @@ "jquery", "core-js", "node" - ] + ], + "forceConsistentCasingInFileNames": true }, "exclude": [ "test.ts", diff --git a/common-app-api/.gitignore b/common-app-api/.gitignore deleted file mode 100644 index 19f2e002ce..0000000000 --- a/ common-app-api/.gitignore+++ /dev/null @@ -1,2 +0,0 @@ -/target -/target @@ -11,8 +11,11 @@ <version>1.2.0-SNAPSHOT</version> </parent> - <dependencies> + <properties> + <sonar.skip>true</sonar.skip> + </properties> + <dependencies> <dependency> <groupId>org.openecomp.sdc</groupId> <artifactId>security-utils</artifactId> @@ -181,8 +184,7 @@ <dependency> <groupId>org.mockito</groupId> - <artifactId>mockito-all</artifactId> - <version>${mockito.version}</version> + <artifactId>mockito-core</artifactId> <scope>test</scope> </dependency> @@ -20,6 +20,8 @@ package org.openecomp.sdc.be.config; +import static java.lang.String.format; + import java.util.Date; import java.util.LinkedList; import java.util.List; @@ -28,8 +30,6 @@ import java.util.Set; import org.openecomp.sdc.common.api.BasicConfiguration; -import static java.lang.String.format; - public class Configuration extends BasicConfiguration { private List<String> identificationHeaderFields; @@ -117,6 +117,8 @@ public class Configuration extends BasicConfiguration { private OnboardingConfig onboarding; + private DcaeConfig dcae; + private CassandrConfig cassandraConfig; private SwitchoverDetectorConfig switchoverDetector; @@ -132,6 +134,60 @@ public class Configuration extends BasicConfiguration { private Map<String, VfModuleProperty> vfModuleProperties; private Map<String, String> genericAssetNodeTypes; + + private String appVersion; + private String artifactGeneratorConfig; + + public String getAutoHealingOwner() { + return autoHealingOwner; + } + + public void setAutoHealingOwner(String autoHealingOwner) { + this.autoHealingOwner = autoHealingOwner; + } + + private String autoHealingOwner; + + private Map<String, List<String>> resourcesForUpgrade; + private boolean skipUpgradeFailedVfs; + + private boolean skipUpgradeVSPs; + + + + + + public void setSkipUpgradeVSPs(boolean skipUpgradeVSPs) { this.skipUpgradeVSPs = skipUpgradeVSPs; } + + public boolean getSkipUpgradeVSPsFlag() { return skipUpgradeVSPs; } + + public boolean getSkipUpgradeFailedVfs() { + return skipUpgradeFailedVfs; + } + + public void setSkipUpgradeFailedVfs(boolean skipUpgradeFailedVfs) { + this.skipUpgradeFailedVfs = skipUpgradeFailedVfs; + } + + public String getAppVersion() { + return appVersion; + } + + public void setAppVersion(String appVersion) { + this.appVersion = appVersion; + } + + public String getArtifactGeneratorConfig() { + return artifactGeneratorConfig; + } + + public void setArtifactGeneratorConfig(String artifactGeneratorConfig) { + this.artifactGeneratorConfig = artifactGeneratorConfig; + } + + private String workloadContext; + + private EnvironmentContext environmentContext; public Map<String, String> getGenericAssetNodeTypes() { return genericAssetNodeTypes; @@ -485,6 +541,22 @@ public class Configuration extends BasicConfiguration { this.uebHealthCheckReadTimeout = uebHealthCheckReadTimeout; } + public String getWorkloadContext() { + return workloadContext; + } + + public void setWorkloadContext(String workloadContext) { + this.workloadContext = workloadContext; + } + + public EnvironmentContext getEnvironmentContext() { + return environmentContext; + } + + public void setEnvironmentContext(EnvironmentContext environmentContext) { + this.environmentContext = environmentContext; + } + public static class ElasticSearchConfig { List<IndicesTimeFrequencyEntry> indicesTimeFrequency; @@ -902,6 +974,54 @@ public class Configuration extends BasicConfiguration { } + public DcaeConfig getDcae() { + return dcae; + } + + public void setDcae(DcaeConfig dcae) { + this.dcae = dcae; + } + + public static class DcaeConfig { + + String protocol = "http"; + String host; + Integer port; + String healthCheckUri; + + public String getProtocol() { + return protocol; + } + + public void setProtocol(String protocol) { + this.protocol = protocol; + } + + public String getHost() { + return host; + } + + public void setHost(String host) { + this.host = host; + } + + public Integer getPort() { + return port; + } + + public void setPort(Integer port) { + this.port = port; + } + + public String getHealthCheckUri() { + return healthCheckUri; + } + + public void setHealthCheckUri(String healthCheckUri) { + this.healthCheckUri = healthCheckUri; + } + } + public static class EcompPortalConfig { private String defaultFunctionalMenu; @@ -1118,6 +1238,30 @@ public class Configuration extends BasicConfiguration { } } + public static class EnvironmentContext { + + String defaultValue; + List<String> validValues; + + public String getDefaultValue() { + return defaultValue; + } + + public void setDefaultValue(String defaultValue) { + this.defaultValue = defaultValue; + } + + public List<String> getValidValues() { + return validValues; + } + + public void setValidValues(List<String> validValues) { + this.validValues = validValues; + } + } + + + public CleanComponentsConfiguration getCleanComponentsConfiguration() { return cleanComponentsConfiguration; } @@ -1340,4 +1484,13 @@ public class Configuration extends BasicConfiguration { public void setDefaultImports(LinkedList<Map<String, Map<String, String>>> defaultImports) { this.defaultImports = defaultImports; } + + public Map<String, List<String>> getResourcesForUpgrade() { + return resourcesForUpgrade; + } + + public void setResourcesForUpgrade(Map<String, List<String>> resourcesForUpgrade) { + this.resourcesForUpgrade = resourcesForUpgrade; + } + } @@ -82,7 +82,8 @@ public class BeMonitoringService { } public void start(int interval) { - Configuration config = ((ConfigurationManager) context.getAttribute(Constants.CONFIGURATION_MANAGER_ATTR)).getConfiguration(); + Configuration config = ((ConfigurationManager) context.getAttribute(Constants.CONFIGURATION_MANAGER_ATTR)) + .getConfiguration(); if (config.getSystemMonitoring().getEnabled()) { log.info("BE monitoring service is enabled, interval is {} seconds", interval); this.monitoringExecutor.scheduleAtFixedRate(new MonitoringScheduledTask(), 0, interval, TimeUnit.SECONDS); @@ -94,8 +95,10 @@ public class BeMonitoringService { private void processMonitoringEvent(MonitoringEvent monitoringMetrics) { CloseableHttpClient httpClient = null; try { - Configuration config = ((ConfigurationManager) context.getAttribute(Constants.CONFIGURATION_MANAGER_ATTR)).getConfiguration(); - String redirectedUrl = String.format(URL, config.getBeProtocol(), config.getBeFqdn(), config.getBeHttpPort()); + Configuration config = ((ConfigurationManager) context.getAttribute(Constants.CONFIGURATION_MANAGER_ATTR)) + .getConfiguration(); + String redirectedUrl = String.format(URL, config.getBeProtocol(), config.getBeFqdn(), + config.getBeHttpPort()); httpClient = getHttpClient(config); HttpPost httpPost = new HttpPost(redirectedUrl); String monitoringMetricsJson = gson.toJson(monitoringMetrics); @@ -109,6 +109,8 @@ public interface Constants { public static final String ARTIFACT_NAME = "artifactName"; public static final String ARTIFACT_ID = "uniqueId"; public static final String REQUIRED_ARTIFACTS = "requiredArtifacts"; + public static final String ARTIFACT_HEAT_PARAMS = "heatParameters"; + public static final String ARTIFACT_ES_ID = "esId"; public static final String ABSTRACT = "abstract"; public static final String GLOBAL_SUBSTITUTION_TYPES_SERVICE_TEMPLATE = "Definitions/GlobalSubstitutionTypesServiceTemplate.yaml"; @@ -127,4 +129,15 @@ public interface Constants { public static final String SERVICE_TEMPLATE_FILE_POSTFIX = "ServiceTemplate.yaml"; public static final String SERVICE_TEMPLATES_CONTAINING_FOLDER = "Definitions/"; public static final String UNBOUNDED = "unbounded"; + + //SDC HealthCheck components + public static final String HC_COMPONENT_FE = "FE"; + public static final String HC_COMPONENT_BE = "BE"; + public static final String HC_COMPONENT_TITAN = "TITAN"; + public static final String HC_COMPONENT_CASSANDRA = "CASSANDRA"; + public static final String HC_COMPONENT_DISTRIBUTION_ENGINE = "DE"; + + //external HealthCheck components + public static final String HC_COMPONENT_ON_BOARDING = "ON_BOARDING"; + public static final String HC_COMPONENT_DCAE = "DCAE"; } @@ -27,14 +27,14 @@ import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; public class HealthCheckInfo { - - private HealthCheckComponent healthCheckComponent; + + private String healthCheckComponent; private HealthCheckStatus healthCheckStatus; private String version; private String description; private List<HealthCheckInfo> componentsInfo; - public HealthCheckInfo(HealthCheckComponent healthCheckComponent, HealthCheckStatus healthCheckStatus, + public HealthCheckInfo(String healthCheckComponent, HealthCheckStatus healthCheckStatus, String version, String description) { super(); this.healthCheckComponent = healthCheckComponent; @@ -43,7 +43,7 @@ public class HealthCheckInfo { this.description = description; } - public HealthCheckInfo(HealthCheckComponent healthCheckComponent, HealthCheckStatus healthCheckStatus, + public HealthCheckInfo(String healthCheckComponent, HealthCheckStatus healthCheckStatus, String version, String description, List<HealthCheckInfo> componentsInfo) { super(); this.healthCheckComponent = healthCheckComponent; @@ -57,7 +57,7 @@ public class HealthCheckInfo { super(); } - public HealthCheckComponent getHealthCheckComponent() { + public String getHealthCheckComponent() { return healthCheckComponent; } @@ -65,6 +65,10 @@ public class HealthCheckInfo { return healthCheckStatus; } + public void setHealthCheckStatus(HealthCheckStatus healthCheckStatus) { + this.healthCheckStatus = healthCheckStatus; + } + public List<HealthCheckInfo> getComponentsInfo() { return componentsInfo; } @@ -85,11 +89,15 @@ public class HealthCheckInfo { return description; } - public enum HealthCheckComponent { - FE, BE, TITAN, DE, ON_BOARDING, CASSANDRA, - CAS, ZU;//Amdocs components + public void setDescription(String description) { + this.description = description; } + /*public enum HealthCheckComponent { + FE, BE, TITAN, DE, ON_BOARDING, CASSANDRA, DCAE, + CAS, ZU;//Amdocs components + }*/ + public enum HealthCheckStatus { UP, DOWN, UNKNOWN; } @@ -25,9 +25,7 @@ import java.util.IllegalFormatException; import java.util.Locale; import org.apache.commons.lang3.StringUtils; -import org.openecomp.sdc.common.config.EcompErrorConfiguration.EcompAlarmSeverity; import org.openecomp.sdc.common.config.EcompErrorConfiguration.EcompErrorSeverity; -import org.openecomp.sdc.common.config.EcompErrorConfiguration.EcompErrorType; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.slf4j.MDC; @@ -30,9 +30,9 @@ import java.util.Date; import java.util.List; import org.openecomp.sdc.common.config.EcompErrorEnum; -import org.openecomp.sdc.common.config.EcompErrorLogUtil; import org.openecomp.sdc.common.config.EcompErrorEnum.AlarmSeverity; import org.openecomp.sdc.common.config.EcompErrorEnum.ErrorType; +import org.openecomp.sdc.common.config.EcompErrorLogUtil; public class GenerateEcompErrorsCsv { @@ -38,7 +38,6 @@ import org.openecomp.sdc.common.impl.ExternalConfiguration; import org.openecomp.sdc.common.impl.FSConfigurationSource; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.slf4j.MDC; public class AppContextListener implements ServletContextListener { @@ -0,0 +1,42 @@ +package org.openecomp.sdc.common.util; + +import java.util.List; + +import org.openecomp.sdc.common.api.HealthCheckInfo; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class HealthCheckUtil { + + private static Logger log = LoggerFactory.getLogger(HealthCheckUtil.class.getName()); + + public static boolean getAggregateStatus(List<HealthCheckInfo> healthCheckInfos) { + + boolean status = true; + + for (HealthCheckInfo healthCheckInfo : healthCheckInfos) { + if (healthCheckInfo.getHealthCheckStatus().equals(HealthCheckInfo.HealthCheckStatus.DOWN)) { + log.debug("Component {} is reported as DOWN - Aggregated HC will be DOWN", healthCheckInfo.getHealthCheckComponent()); + status = false; + break; + } + } + + return status; + } + + public static String getAggregateDescription(List<HealthCheckInfo> healthCheckInfos, String parentDescription) { + + StringBuilder sb = new StringBuilder(); + healthCheckInfos.forEach(x -> { + if (x.getHealthCheckStatus() == HealthCheckInfo.HealthCheckStatus.DOWN) { + sb.append("Component ").append(x.getHealthCheckComponent()).append(" is Down, "); + } + }); + + return sb.length() > 0 ? sb.substring(0, sb.length() - 1) : ""; + +// return description; + } + +} @@ -20,12 +20,12 @@ package org.openecomp.sdc.common.util; -import org.apache.commons.lang3.tuple.ImmutablePair; -import org.apache.commons.lang3.tuple.Pair; - import java.util.List; import java.util.stream.Collectors; +import org.apache.commons.lang3.tuple.ImmutablePair; +import org.apache.commons.lang3.tuple.Pair; + public class PairUtils { public static <L, R> List<L> leftSequence(List<ImmutablePair<L, R>> pairs) { @@ -267,8 +267,14 @@ public class YamlToObjectConverter { public boolean isValidYaml(byte[] fileContents) { try { - Map<String, Object> mappedToscaTemplate = (Map<String, Object>) defaultYaml - .load(new ByteArrayInputStream(fileContents)); + + Iterable<Object> mappedToscaTemplateIt = defaultYaml.loadAll(new ByteArrayInputStream(fileContents)); + + for (Object o : mappedToscaTemplateIt) { + System.out.println("Loaded object type:" + o.getClass()); + Map<String, Object> map = (Map<String, Object>) o; + } + } catch (Exception e) { log.error("Failed to convert yaml file to object - yaml is invalid", e); return false; @@ -20,8 +20,6 @@ package org.openecomp.sdc.exception; -import javax.ws.rs.core.Response; - /** * Nested POJOs to express required JSON format of the error * @@ -20,13 +20,13 @@ package org.openecomp.sdc.fe.config; +import static java.lang.String.format; + import java.util.Date; import java.util.List; import org.openecomp.sdc.common.api.BasicConfiguration; -import static java.lang.String.format; - public class Configuration extends BasicConfiguration { /** * fe FQDN @@ -61,6 +61,8 @@ public class Configuration extends BasicConfiguration { private OnboardingConfig onboarding; + private DcaeConfig dcae; + public String getKibanaProtocol() { return kibanaProtocol; } @@ -349,6 +351,54 @@ public class Configuration extends BasicConfiguration { } } + public DcaeConfig getDcae() { + return dcae; + } + + public void setDcae(DcaeConfig dcae) { + this.dcae = dcae; + } + + public static class DcaeConfig { + + String protocol = "http"; + String host; + Integer port; + String healthCheckUri; + + public String getProtocol() { + return protocol; + } + + public void setProtocol(String protocol) { + this.protocol = protocol; + } + + public String getHost() { + return host; + } + + public void setHost(String host) { + this.host = host; + } + + public Integer getPort() { + return port; + } + + public void setPort(Integer port) { + this.port = port; + } + + public String getHealthCheckUri() { + return healthCheckUri; + } + + public void setHealthCheckUri(String healthCheckUri) { + this.healthCheckUri = healthCheckUri; + } + } + @Override public String toString() { return new StringBuilder().append(format("backend host: %s%n", beHost)) @@ -23,7 +23,6 @@ package org.openecomp.sdc.fe.config; import org.openecomp.sdc.common.config.AbsEcompErrorManager; import org.openecomp.sdc.common.config.EcompErrorEnum; import org.openecomp.sdc.common.config.IEcompConfigurationManager; -import org.openecomp.sdc.fe.config.ConfigurationManager; public class FeEcompErrorManager extends AbsEcompErrorManager { @@ -1,7 +1,5 @@ package org.openecomp.sdc.be.config; -import javax.annotation.Generated; - import org.junit.Test; import org.openecomp.sdc.be.config.BeEcompErrorManager.ErrorSeverity; import org.openecomp.sdc.common.config.IEcompConfigurationManager; @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.config; import java.util.List; -import javax.annotation.Generated; - import org.junit.Test; @@ -6,8 +6,6 @@ import java.util.List; import java.util.Map; import java.util.Set; -import javax.annotation.Generated; - import org.junit.Test; import org.openecomp.sdc.be.config.Configuration.ApplicationL1CacheConfig; import org.openecomp.sdc.be.config.Configuration.ApplicationL2CacheConfig; @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.config; import java.util.List; -import javax.annotation.Generated; - import org.junit.Test; import org.openecomp.sdc.be.config.DistributionEngineConfiguration.ComponentArtifactTypesConfig; import org.openecomp.sdc.be.config.DistributionEngineConfiguration.CreateTopicConfig; @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.config; import java.util.Map; -import javax.annotation.Generated; - import org.junit.Test; @@ -1,7 +1,5 @@ package org.openecomp.sdc.be.config; -import javax.annotation.Generated; - import org.junit.Test; import org.openecomp.sdc.be.config.ErrorInfo.ErrorInfoType; @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.config; import java.util.Map; -import javax.annotation.Generated; - import org.junit.Test; @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.config.validation; import java.util.Map; -import javax.annotation.Generated; - import org.junit.Test; @@ -2,8 +2,6 @@ package org.openecomp.sdc.common.api; import java.util.List; -import javax.annotation.Generated; - import org.junit.Test; @@ -2,8 +2,6 @@ package org.openecomp.sdc.common.api; import java.util.List; -import javax.annotation.Generated; - import org.junit.Test; @@ -2,10 +2,7 @@ package org.openecomp.sdc.common.api; import java.util.List; -import javax.annotation.Generated; - import org.junit.Test; -import org.openecomp.sdc.common.api.HealthCheckInfo.HealthCheckComponent; import org.openecomp.sdc.common.api.HealthCheckInfo.HealthCheckStatus; @@ -19,7 +16,7 @@ public class HealthCheckInfoTest { @Test public void testGetHealthCheckComponent() throws Exception { HealthCheckInfo testSubject; - HealthCheckComponent result; + String result; // default test testSubject = createTestSubject(); @@ -1,7 +1,5 @@ package org.openecomp.sdc.common.api; -import javax.annotation.Generated; - import org.junit.Test; import org.openecomp.sdc.common.api.ResponseInfo.ResponseStatusEnum; @@ -2,8 +2,6 @@ package org.openecomp.sdc.common.api; import java.util.List; -import javax.annotation.Generated; - import org.junit.Test; @@ -2,8 +2,6 @@ package org.openecomp.sdc.common.api; import java.util.List; -import javax.annotation.Generated; - import org.junit.Test; @@ -2,8 +2,6 @@ package org.openecomp.sdc.common.api; import java.util.List; -import javax.annotation.Generated; - import org.junit.Test; @@ -1,7 +1,5 @@ package org.openecomp.sdc.common.datastructure; -import javax.annotation.Generated; - import org.junit.Test; @@ -2,8 +2,6 @@ package org.openecomp.sdc.common.datastructure; import java.util.Map; -import javax.annotation.Generated; - import org.junit.Test; @@ -1,7 +1,5 @@ package org.openecomp.sdc.common.datastructure; -import javax.annotation.Generated; - import org.junit.Test; @@ -1,7 +1,5 @@ package org.openecomp.sdc.common.datastructure; -import javax.annotation.Generated; - import org.junit.Test; @@ -1,7 +1,5 @@ package org.openecomp.sdc.common.kpi.api; -import javax.annotation.Generated; - import org.junit.Test; @@ -2,7 +2,6 @@ package org.openecomp.sdc.common.listener; import java.util.Map; -import javax.annotation.Generated; import javax.servlet.ServletContext; import javax.servlet.ServletContextEvent; @@ -1,7 +1,5 @@ package org.openecomp.sdc.common.monitoring; -import javax.annotation.Generated; - import org.junit.Test; @@ -1,7 +1,5 @@ package org.openecomp.sdc.common.rest.api; -import javax.annotation.Generated; - import org.junit.Test; @@ -1,10 +1,6 @@ package org.openecomp.sdc.common.rest.api; -import javax.annotation.Generated; - import org.junit.Test; -import java.util.*; -import org.junit.Assert; public class RestResponseAsByteArrayTest { @@ -1,7 +1,5 @@ package org.openecomp.sdc.common.rest.api; -import javax.annotation.Generated; - import org.junit.Test; @@ -29,7 +29,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import org.junit.Ignore; import org.junit.Test; import org.openecomp.sdc.common.api.Constants; import org.openecomp.sdc.common.util.GeneralUtility; @@ -20,6 +20,9 @@ package org.openecomp.sdc.common.test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; @@ -29,24 +32,13 @@ import java.io.IOException; import java.util.ArrayList; import java.util.List; -import static org.mockito.Matchers.anyList; -import static org.mockito.Matchers.anyObject; -import static org.mockito.Matchers.anyString; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.assertEquals; - import org.junit.Before; import org.junit.Test; -import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; import org.openecomp.sdc.be.config.DistributionEngineConfiguration; import org.openecomp.sdc.common.api.BasicConfiguration; import org.openecomp.sdc.common.api.ConfigurationListener; import org.openecomp.sdc.common.api.ConfigurationSource; import org.openecomp.sdc.common.api.FileChangeCallback; -import org.openecomp.sdc.common.impl.ConfigFileChangeListener; import org.openecomp.sdc.common.impl.ExternalConfiguration; import org.openecomp.sdc.common.impl.FSConfigurationSource; import org.openecomp.sdc.common.test.config.TestConfiguration; @@ -20,7 +20,8 @@ package org.openecomp.sdc.common.test; -import static org.junit.Assert.*; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; import org.apache.commons.codec.binary.Base64; import org.junit.BeforeClass; @@ -20,14 +20,14 @@ package org.openecomp.sdc.common.test.config; +import static java.lang.String.format; + import java.util.Date; import java.util.List; import java.util.Map; import org.openecomp.sdc.common.api.BasicConfiguration; -import static java.lang.String.format; - public class TestConfiguration extends BasicConfiguration { /** @@ -1,7 +1,5 @@ package org.openecomp.sdc.common.util; -import javax.annotation.Generated; - import org.junit.Test; @@ -2,8 +2,6 @@ package org.openecomp.sdc.common.util; import java.util.List; -import javax.annotation.Generated; - import org.junit.Assert; import org.junit.Test; @@ -1,7 +1,5 @@ package org.openecomp.sdc.common.util; -import javax.annotation.Generated; - import org.junit.Test; import com.google.gson.Gson; @@ -30,7 +30,6 @@ import java.util.stream.Collectors; import java.util.stream.Stream; import org.junit.Test; -import org.openecomp.sdc.common.util.StreamUtils; import fj.data.Either; @@ -2,8 +2,6 @@ package org.openecomp.sdc.common.util; import java.util.List; -import javax.annotation.Generated; - import org.junit.Assert; import org.junit.Test; @@ -3,10 +3,7 @@ package org.openecomp.sdc.fe.config; import java.util.Date; import java.util.List; -import javax.annotation.Generated; - import org.junit.Test; -import org.openecomp.sdc.be.config.Configuration.OnboardingConfig; import org.openecomp.sdc.fe.config.Configuration.FeMonitoringConfig; diff --git a/common-be/.gitignore b/common-be/.gitignore deleted file mode 100644 index ea8c4bf7f3..0000000000 --- a/ common-be/.gitignore+++ /dev/null @@ -1 +0,0 @@ -/target @@ -11,8 +11,11 @@ <version>1.2.0-SNAPSHOT</version> </parent> + <properties> + <sonar.skip>true</sonar.skip> + </properties> + <dependencies> - <!-- Common of SD&C --> <dependency> <groupId>org.openecomp.sdc</groupId> @@ -23,7 +23,6 @@ package org.openecomp.sdc.be.datatypes.components; import java.io.Serializable; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; -import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; public class ResourceMetadataDataDefinition extends ComponentMetadataDataDefinition implements Serializable { @@ -22,8 +22,6 @@ package org.openecomp.sdc.be.datatypes.components; import java.io.Serializable; -import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; - public class ServiceMetadataDataDefinition extends ComponentMetadataDataDefinition implements Serializable { /** @@ -40,6 +38,8 @@ public class ServiceMetadataDataDefinition extends ComponentMetadataDataDefiniti private String namingPolicy = EMPTY_STR; + private String environmentContext; + public ServiceMetadataDataDefinition() { super(); serviceType = ""; @@ -92,11 +92,20 @@ public class ServiceMetadataDataDefinition extends ComponentMetadataDataDefiniti this.namingPolicy = namingPolicy; } + public String getEnvironmentContext() { return environmentContext; } + + public void setEnvironmentContext(String environmentContext) { this.environmentContext = environmentContext; } + @Override public String toString() { - return "ServiceMetadataDataDefinition [ distributionStatus=" + distributionStatus - + ", serviceType=" + serviceType + ", serviceRole=" + serviceRole + ", ecompGeneratedNaming=" - + ecompGeneratedNaming + ", namingPolicy=" + namingPolicy + ", parent=" + super.toString() + "]"; + return "ServiceMetadataDataDefinition{" + + "distributionStatus='" + distributionStatus + '\'' + + ", serviceType='" + serviceType + '\'' + + ", serviceRole='" + serviceRole + '\'' + + ", ecompGeneratedNaming=" + ecompGeneratedNaming + + ", namingPolicy='" + namingPolicy + '\'' + + ", environmentContext='" + environmentContext + '\'' + + '}'; } @Override @@ -108,6 +117,7 @@ public class ServiceMetadataDataDefinition extends ComponentMetadataDataDefiniti result = prime * result + ((namingPolicy == null) ? 0 : namingPolicy.hashCode()); result = prime * result + ((serviceType == null) ? 0 : serviceType.hashCode()); result = prime * result + ((serviceRole == null) ? 0 : serviceRole.hashCode()); + result = prime * result + ((environmentContext == null) ? 0 : environmentContext.hashCode()); return result; } @@ -151,6 +161,11 @@ public class ServiceMetadataDataDefinition extends ComponentMetadataDataDefiniti return false; } else if (!serviceRole.equals(other.serviceRole)) return false; + if (environmentContext == null){ + if (other.environmentContext != null) + return false; + } else if (!environmentContext.equals(other.environmentContext)) + return false; return super.equals(obj); } @@ -27,50 +27,72 @@ import java.util.List; import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; +import com.google.common.collect.Lists; - +/** + * Represents the capability of the component or component instance + */ public class CapabilityDataDefinition extends ToscaDataDefinition implements Serializable { /** * */ private static final long serialVersionUID = 7544984873506188920L; - public final static String MIN_OCCURRENCES = "1"; // occurrences - public final static String MAX_OCCURRENCES = "UNBOUNDED"; + public static final String MIN_OCCURRENCES = "1"; + public static final String MAX_OCCURRENCES = "UNBOUNDED"; - + /** + * The default constructor initializing limits of the occurrences + */ public CapabilityDataDefinition() { super(); this.setMinOccurrences( MIN_OCCURRENCES ); this.setMaxOccurrences( MAX_OCCURRENCES); this.setLeftOccurrences( MAX_OCCURRENCES); } - - public CapabilityDataDefinition(CapabilityDataDefinition a) { + /** + * Deep copy constructor + * @param other + */ + public CapabilityDataDefinition(CapabilityDataDefinition other) { super(); - this.setUniqueId(a.getUniqueId()); - this.setType(a.getType()); - this.setDescription ( a.getDescription()); - this.setName( a.getName()); - this.setParentName( a.getParentName()); - this.setValidSourceTypes( a.getValidSourceTypes()); - this.setCapabilitySources( a.getCapabilitySources()); - this.setOwnerId( a.getOwnerId()); - this.setOwnerName( a.getOwnerName()); - this.setMinOccurrences( a.getMinOccurrences()); - this.setMaxOccurrences( a.getMaxOccurrences()); - this.setLeftOccurrences(a.getLeftOccurrences()); - this.setPath(a.getPath()); - this.setSource(a.getSource()); + this.setUniqueId(other.getUniqueId()); + this.setType(other.getType()); + this.setDescription ( other.getDescription()); + this.setName( other.getName()); + this.setParentName( other.getParentName()); + + if(other.getValidSourceTypes() == null) + this.setValidSourceTypes(Lists.newArrayList()); + else + this.setValidSourceTypes(Lists.newArrayList(other.getValidSourceTypes())); + + if(other.getCapabilitySources() == null) + this.setCapabilitySources(Lists.newArrayList()); + else + this.setCapabilitySources(Lists.newArrayList(other.getCapabilitySources())); + + this.setOwnerId( other.getOwnerId()); + this.setOwnerName( other.getOwnerName()); + this.setMinOccurrences( other.getMinOccurrences()); + this.setMaxOccurrences( other.getMaxOccurrences()); + this.setLeftOccurrences(other.getLeftOccurrences()); + + if(other.getPath() == null) + this.setPath(Lists.newArrayList()); + else + this.setPath(Lists.newArrayList(other.getPath())); + + this.setSource(other.getSource()); } - - + @Override public String getOwnerId() { return (String) getToscaPresentationValue(JsonPresentationFields.OWNER_ID); } - + + @Override public void setOwnerId(String ownerId) { setToscaPresentationValue(JsonPresentationFields.OWNER_ID, ownerId); } @@ -146,6 +168,7 @@ public class CapabilityDataDefinition extends ToscaDataDefinition implements Ser setToscaPresentationValue(JsonPresentationFields.TYPE, type); } + @SuppressWarnings("unchecked") public List<String> getValidSourceTypes() { return (List<String>) getToscaPresentationValue(JsonPresentationFields.VALID_SOURCE_TYPE); } @@ -154,6 +177,7 @@ public class CapabilityDataDefinition extends ToscaDataDefinition implements Ser setToscaPresentationValue(JsonPresentationFields.VALID_SOURCE_TYPE, validSourceTypes); } + @SuppressWarnings("unchecked") public List<String> getCapabilitySources() { return (List<String>) getToscaPresentationValue(JsonPresentationFields.CAPABILITY_SOURCES); } @@ -165,6 +189,7 @@ public class CapabilityDataDefinition extends ToscaDataDefinition implements Ser public void setPath(List<String> path){ setToscaPresentationValue(JsonPresentationFields.PATH, path); } + @SuppressWarnings("unchecked") public List<String> getPath() { return (List<String>) getToscaPresentationValue(JsonPresentationFields.PATH); } @@ -174,12 +199,19 @@ public class CapabilityDataDefinition extends ToscaDataDefinition implements Ser public String getSource() { return (String) getToscaPresentationValue(JsonPresentationFields.SOURCE); } + + /** + * Adds the element to the path avoiding duplication + * @param elementInPath + */ public void addToPath(String elementInPath){ List<String> path = getPath(); if ( path == null ){ path = new ArrayList<>(); } - path.add(elementInPath); + if(!path.contains(elementInPath)){ + path.add(elementInPath); + } setPath(path); } @@ -25,7 +25,6 @@ import java.io.Serializable; import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; import org.openecomp.sdc.be.datatypes.enums.OriginTypeEnum; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; -import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum; import org.openecomp.sdc.common.util.ValidationUtils; public class ComponentInstanceDataDefinition extends ToscaDataDefinition implements Serializable { @@ -33,16 +32,15 @@ public class ComponentInstanceDataDefinition extends ToscaDataDefinition impleme /** * */ - - private static final long serialVersionUID = 7215033872921497743L; + private static final long serialVersionUID = 7215033872921497743L; - public ComponentInstanceDataDefinition() { super(); setPropertyValueCounter(1); setAttributeValueCounter(1); setInputValueCounter(1); + setIsProxy(false); } public ComponentInstanceDataDefinition(ComponentInstanceDataDefinition dataDefinition) { @@ -59,12 +57,17 @@ public class ComponentInstanceDataDefinition extends ToscaDataDefinition impleme setNormalizedName(dataDefinition.getNormalizedName()); setOriginType(dataDefinition.getOriginType()); setCustomizationUUID(dataDefinition.getCustomizationUUID()); - setComponentName( dataDefinition.getComponentName()); + setComponentName(dataDefinition.getComponentName()); setComponentVersion(dataDefinition.getComponentVersion()); setToscaComponentName(dataDefinition.getToscaComponentName()); - setInvariantName( dataDefinition.getInvariantName()); + setInvariantName(dataDefinition.getInvariantName()); + setSourceModelInvariant(dataDefinition.getSourceModelInvariant()); + setSourceModelName(dataDefinition.getSourceModelName()); + setSourceModelUuid(dataDefinition.getSourceModelUuid()); + setSourceModelUid(dataDefinition.getSourceModelUid()); + setIsProxy(dataDefinition.getIsProxy()); } - + public String getIcon() { return (String) getToscaPresentationValue(JsonPresentationFields.CI_ICON); } @@ -72,6 +75,7 @@ public class ComponentInstanceDataDefinition extends ToscaDataDefinition impleme public void setIcon(String icon) { setToscaPresentationValue(JsonPresentationFields.CI_ICON, icon); } + public String getUniqueId() { return (String) getToscaPresentationValue(JsonPresentationFields.UNIQUE_ID); } @@ -133,12 +137,12 @@ public class ComponentInstanceDataDefinition extends ToscaDataDefinition impleme } public void setName(String name) { - if(this.getInvariantName() == null){ + if (this.getInvariantName() == null) { this.setInvariantName(ValidationUtils.normalizeComponentInstanceName(name)); } setToscaPresentationValue(JsonPresentationFields.NAME, name); } - + public String getInvariantName() { return (String) getToscaPresentationValue(JsonPresentationFields.CI_INVARIANT_NAME); } @@ -165,7 +169,7 @@ public class ComponentInstanceDataDefinition extends ToscaDataDefinition impleme public OriginTypeEnum getOriginType() { OriginTypeEnum originType = null; - String origType = (String) getToscaPresentationValue(JsonPresentationFields.CI_ORIGIN_TYPE); + String origType = (String) getToscaPresentationValue(JsonPresentationFields.CI_ORIGIN_TYPE); if (origType != null && !origType.isEmpty()) { originType = OriginTypeEnum.findByValue(origType); @@ -174,7 +178,7 @@ public class ComponentInstanceDataDefinition extends ToscaDataDefinition impleme } public void setOriginType(OriginTypeEnum originType) { - if(originType != null) + if (originType != null) setToscaPresentationValue(JsonPresentationFields.CI_ORIGIN_TYPE, originType.getValue()); } @@ -226,11 +230,60 @@ public class ComponentInstanceDataDefinition extends ToscaDataDefinition impleme setToscaPresentationValue(JsonPresentationFields.CI_COMPONENT_VERSION, resourceVersion); } + public void setSourceModelUuid(String targetModelUuid) { + setToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_UUID, targetModelUuid); + } + public void setSourceModelUid(String targetModelUid) { + setToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_UID, targetModelUid); + } + + public void setSourceModelName(String targetModelName) { + setToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_NAME, targetModelName); + } + + public void setSourceModelInvariant(String targetModelInvariant) { + setToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_INVARIANT, targetModelInvariant); + } + + public String getSourceModelUuid() { + return (String) getToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_UUID); + } + public String getSourceModelUid() { + return (String) getToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_UID); + } + + public String getSourceModelName() { + return (String) getToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_NAME); + } + + public String getSourceModelInvariant() { + return (String) getToscaPresentationValue(JsonPresentationFields.CI_SOURCE_MODEL_INVARIANT); + } + + public void setIsProxy(Boolean isProxy) { + if (isProxy == null) { + setToscaPresentationValue(JsonPresentationFields.CI_IS_PROXY, false); + } else { + setToscaPresentationValue(JsonPresentationFields.CI_IS_PROXY, isProxy); + } + } + + public Boolean getIsProxy() { + Boolean isProxy = (Boolean) getToscaPresentationValue(JsonPresentationFields.CI_IS_PROXY); + return ( isProxy != null ) ? isProxy : false; + } + @Override public String toString() { - return "ComponentInstanceDataDefinition [icon=" + getIcon() + ", uniqueId=" + getUniqueId() + ", name=" + getName() + ", normalizedName=" + getNormalizedName() + ", componentUid=" + getComponentUid() + ", creationTime=" + getCreationTime() + ", modificationTime=" - + getModificationTime() + ", description=" + getDescription() + ", posX=" + getPosX() + ", posY=" + getPosY() + ", propertyValueCounter=" + getPropertyValueCounter() + ", attributeValueCounter=" + getAttributeValueCounter() + ", inputValueCounter=" - + getInputValueCounter() + ", originType=" + getOriginType() + ", customizationUUID=" + getCustomizationUUID() + ", componentName=" + getComponentName() + ", componentVersion=" + getComponentVersion() + ", toscaComponentName=" + getToscaComponentName() + "]"; + return "ComponentInstanceDataDefinition [icon=" + getIcon() + ", uniqueId=" + getUniqueId() + ", name=" + + getName() + ", normalizedName=" + getNormalizedName() + ", componentUid=" + getComponentUid() + + ", creationTime=" + getCreationTime() + ", modificationTime=" + getModificationTime() + + ", description=" + getDescription() + ", posX=" + getPosX() + ", posY=" + getPosY() + + ", propertyValueCounter=" + getPropertyValueCounter() + ", attributeValueCounter=" + + getAttributeValueCounter() + ", inputValueCounter=" + getInputValueCounter() + ", originType=" + + getOriginType() + ", customizationUUID=" + getCustomizationUUID() + ", componentName=" + + getComponentName() + ", componentVersion=" + getComponentVersion() + ", toscaComponentName=" + + getToscaComponentName() + "]"; } } @@ -21,8 +21,6 @@ package org.openecomp.sdc.be.datatypes.elements; import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; import org.codehaus.jackson.annotate.JsonCreator; import org.codehaus.jackson.annotate.JsonValue; @@ -21,18 +21,16 @@ package org.openecomp.sdc.be.datatypes.elements; import java.util.ArrayList; -import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Map.Entry; -import java.util.function.Predicate; +import java.util.Optional; +import java.util.Set; import java.util.stream.Collectors; import org.codehaus.jackson.annotate.JsonCreator; import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; - public class ListDataDefinition<T extends ToscaDataDefinition> extends ToscaDataDefinition { protected List<T> listToscaDataDefinition; @@ -76,22 +74,49 @@ public class ListDataDefinition<T extends ToscaDataDefinition> extends ToscaData listToscaDataDefinition.forEach(e -> e.setOwnerIdIfEmpty(ownerId)); } } - + @Override - public <S extends ToscaDataDefinition> S mergeFunction(S other, boolean allowDefaultValueOverride){ + public <S extends ToscaDataDefinition> S mergeFunction(S other, boolean allowDefaultValueOverride) { Map<String, T> mapByName = listToMapByName(listToscaDataDefinition); - List<T> otherList = ((ListDataDefinition)other).getListToscaDataDefinition(); - for(T item : otherList){ - mapByName.merge((String)item.getToscaPresentationValue(JsonPresentationFields.NAME), item, (thisItem, otherItem) -> thisItem.mergeFunction(otherItem, allowDefaultValueOverride)); + List<T> otherList = ((ListDataDefinition) other).getListToscaDataDefinition(); + for (T item : otherList) { + mapByName.merge((String) item.getToscaPresentationValue(JsonPresentationFields.NAME), item, (thisItem, otherItem) -> thisItem.mergeFunction(otherItem, allowDefaultValueOverride)); } - ((ListDataDefinition)other).listToscaDataDefinition = mapByName.values().stream().collect(Collectors.toList()); - return other; + ((ListDataDefinition) other).listToscaDataDefinition = mapByName.values().stream().collect(Collectors.toList()); + return other; + } + + @Override + public boolean findUidMatch(String uid) { + return listToscaDataDefinition.stream().anyMatch(p -> p.findUidMatch(uid)); } @Override - public boolean findUidMatch(String uid){ - return listToscaDataDefinition.stream() - .anyMatch(p -> p.findUidMatch(uid)); + public <T extends ToscaDataDefinition> T removeByOwnerId(Set<String> ownerIdList) { + List<T> collect1 = (List<T>) listToscaDataDefinition.stream().filter(e -> ownerIdList.contains(e.getOwnerId())).collect(Collectors.toList()); + ListDataDefinition listDef = new ListDataDefinition(collect1); + + listToscaDataDefinition.removeIf(e -> ownerIdList.contains(e.getOwnerId())); + return (T) listDef; } + @Override + public <T extends ToscaDataDefinition> T updateIfExist(T other, boolean allowDefaultValueOverride) { + + List<T> list = ((ListDataDefinition)other).getListToscaDataDefinition(); + list.forEach(e -> { + String nameFromPrev = (String)e.getToscaPresentationValue(JsonPresentationFields.NAME); + if ( nameFromPrev != null ){ + Optional<T> findAny = (Optional<T>) listToscaDataDefinition.stream().filter(o->nameFromPrev.equals(e.getToscaPresentationValue(JsonPresentationFields.NAME))).findAny(); + if ( findAny.isPresent() ){ + e.mergeFunction(findAny.get(), allowDefaultValueOverride); + } + } + }); + return other; + } + @Override + public boolean isEmpty(){ + return listToscaDataDefinition == null || listToscaDataDefinition.isEmpty(); + } } @@ -21,7 +21,6 @@ package org.openecomp.sdc.be.datatypes.elements; import java.util.List; -import java.util.Map; import org.codehaus.jackson.annotate.JsonCreator; import org.codehaus.jackson.annotate.JsonValue; @@ -21,12 +21,9 @@ package org.openecomp.sdc.be.datatypes.elements; import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; import org.codehaus.jackson.annotate.JsonCreator; import org.codehaus.jackson.annotate.JsonValue; -import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; public class ListRequirementDataDefinition extends ListDataDefinition<RequirementDataDefinition> { @@ -22,6 +22,8 @@ package org.openecomp.sdc.be.datatypes.elements; import java.util.HashMap; import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; import org.codehaus.jackson.annotate.JsonCreator; import org.codehaus.jackson.annotate.JsonValue; @@ -79,7 +81,7 @@ public class MapDataDefinition <T extends ToscaDataDefinition> extends ToscaDa public String findKeyByItemUidMatch(String uid){ - if(null == mapToscaDataDefinition) + if(null == mapToscaDataDefinition || uid == null) return null; Map.Entry<String, T> entry = mapToscaDataDefinition.entrySet().stream().filter(e -> e.getValue().findUidMatch(uid)) @@ -88,5 +90,32 @@ public class MapDataDefinition <T extends ToscaDataDefinition> extends ToscaDa return null; return entry.getKey(); } - + @Override + public <T extends ToscaDataDefinition> T removeByOwnerId(Set<String> ownerIdList) { + Map<String, T > collect = (Map<String, T >)mapToscaDataDefinition.entrySet().stream().filter(e -> ownerIdList.contains(e.getValue().getOwnerId())).collect(Collectors.toMap(Map.Entry::getKey, (Map.Entry::getValue))); + + MapDataDefinition collectMap = new MapDataDefinition<>(collect); + + mapToscaDataDefinition.entrySet().removeIf(e -> ownerIdList.contains(e.getValue().getOwnerId())); + + return (T) collectMap; + } + + @Override + public <T extends ToscaDataDefinition> T updateIfExist(T other, boolean allowDefaultValueOverride) { + + Map<String, T > map = ((MapDataDefinition)other).getMapToscaDataDefinition(); + + map.entrySet().forEach(e ->{ + String key = e.getKey(); + if ( mapToscaDataDefinition.containsKey(key) ){ + e.getValue().mergeFunction(mapToscaDataDefinition.get(key), allowDefaultValueOverride); + } + }); + return other; + } + @Override + public boolean isEmpty(){ + return mapToscaDataDefinition == null || mapToscaDataDefinition.isEmpty(); + } } @@ -20,6 +20,7 @@ package org.openecomp.sdc.be.datatypes.elements; +import java.util.HashMap; import java.util.Map; import org.codehaus.jackson.annotate.JsonCreator; @@ -38,6 +39,15 @@ public class MapPropertiesDataDefinition extends MapDataDefinition<PropertyDataD public MapPropertiesDataDefinition(Map<String, PropertyDataDefinition > mapToscaDataDefinition) { super(mapToscaDataDefinition); } + + /** + * Copy Constructor + */ + public MapPropertiesDataDefinition(MapPropertiesDataDefinition toBeDeepCopiedMapPropertiesDataDefinition){ + this.parentName = toBeDeepCopiedMapPropertiesDataDefinition.parentName; + this.toscaPresentation = toBeDeepCopiedMapPropertiesDataDefinition.toscaPresentation == null ? null : new HashMap(toBeDeepCopiedMapPropertiesDataDefinition.toscaPresentation); + this.mapToscaDataDefinition = toBeDeepCopiedMapPropertiesDataDefinition.mapToscaDataDefinition == null ? null : new HashMap(toBeDeepCopiedMapPropertiesDataDefinition.mapToscaDataDefinition); + } public MapPropertiesDataDefinition() { super(); @@ -25,7 +25,6 @@ import java.util.ArrayList; import java.util.List; import org.openecomp.sdc.be.datatypes.components.ComponentMetadataDataDefinition; -import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; public class ProductMetadataDataDefinition extends ComponentMetadataDataDefinition implements Serializable { @@ -21,17 +21,12 @@ package org.openecomp.sdc.be.datatypes.elements; import java.io.Serializable; -import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.stream.Collectors; import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; -import fj.data.Either; - - public class PropertyDataDefinition extends ToscaDataDefinition implements Serializable { /** @@ -63,20 +58,19 @@ public class PropertyDataDefinition extends ToscaDataDefinition implements Seria private String label; protected Boolean hidden = Boolean.FALSE; private Boolean immutable = Boolean.FALSE; - + private String inputPath; - private String status; - private String inputId; - private String instanceUniqueId; - private String propertyId; + private String status; + private String inputId; + private String instanceUniqueId; + private String propertyId; /** * The resource id which this property belongs to */ private String parentUniqueId; - private List<GetInputValueDataDefinition> getInputValues; - + public PropertyDataDefinition() { super(); } @@ -200,6 +194,13 @@ public class PropertyDataDefinition extends ToscaDataDefinition implements Seria this.schema = entrySchema; } + public String getSchemaType() { + if (schema != null && schema.getProperty() != null) { + return schema.getProperty().getType(); + } + return null; + } + public String getLabel() { return label; } @@ -223,8 +224,7 @@ public class PropertyDataDefinition extends ToscaDataDefinition implements Seria public void setImmutable(Boolean immutable) { this.immutable = immutable; } - - + public String getParentUniqueId() { return getOwnerId(); } @@ -233,7 +233,6 @@ public class PropertyDataDefinition extends ToscaDataDefinition implements Seria setOwnerId(parentUniqueId); } - public List<GetInputValueDataDefinition> getGetInputValues() { return getInputValues; } @@ -241,15 +240,15 @@ public class PropertyDataDefinition extends ToscaDataDefinition implements Seria public void setGetInputValues(List<GetInputValueDataDefinition> getInputValues) { this.getInputValues = getInputValues; } - + public String getStatus() { return status; - } + } public void setStatus(String status) { this.status = status; } - + public String getInputId() { return inputId; } @@ -274,7 +273,6 @@ public class PropertyDataDefinition extends ToscaDataDefinition implements Seria this.propertyId = propertyId; } - @Override public String toString() { return "PropertyDataDefinition [uniqueId=" + uniqueId + ", type=" + type + ", required=" + required + ", definition=" + definition + ", defaultValue=" + defaultValue + ", description=" + description + ", schema=" + schema + ", password=" @@ -299,6 +297,27 @@ public class PropertyDataDefinition extends ToscaDataDefinition implements Seria return result; } + public boolean typeEquals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + PropertyDataDefinition other = (PropertyDataDefinition) obj; + if (this.getType() == null) + return other.getType() == null; + if (!this.type.equals(other.type)) { + return false; + } + String thisSchemaType = this.getSchemaType(); + String otherSchemaType = other.getSchemaType(); + if (thisSchemaType == null) { + return otherSchemaType == null; + } + return thisSchemaType.equals(otherSchemaType); + } + @Override public boolean equals(Object obj) { if (this == obj) @@ -377,28 +396,31 @@ public class PropertyDataDefinition extends ToscaDataDefinition implements Seria } } - private <T extends ToscaDataDefinition> boolean compareSchemaType(T other){ - return !"list".equals(type) && !"map".equals(type) || this.getSchema().getProperty().getType().equals(((PropertyDataDefinition)other).getSchema().getProperty().getType()); + private <T extends ToscaDataDefinition> boolean compareSchemaType(T other) { + return !"list".equals(type) && !"map".equals(type) || this.getSchema().getProperty().getType().equals(((PropertyDataDefinition) other).getSchema().getProperty().getType()); } - - + @Override - public <T extends ToscaDataDefinition> T mergeFunction(T other, boolean allowDefaultValueOverride){ - if(this.getType().equals(other.getToscaPresentationValue(JsonPresentationFields.TYPE)) && compareSchemaType(other)){ + public <T extends ToscaDataDefinition> T mergeFunction(T other, boolean allowDefaultValueOverride) { + if (this.getType().equals(other.getToscaPresentationValue(JsonPresentationFields.TYPE)) && compareSchemaType(other)) { other.setOwnerId(getOwnerId()); - if(allowDefaultValueOverride) - other.setToscaPresentationValue(JsonPresentationFields.DEFAULT_VALUE, getDefaultValue()); + if (allowDefaultValueOverride) { + if (getDefaultValue() != null && !getDefaultValue().isEmpty()) { + other.setToscaPresentationValue(JsonPresentationFields.DEFAULT_VALUE, getDefaultValue()); + } + } return other; } return null; } - - public void convertPropertyDataToInstancePropertyData(){ - if(null != value) + + public void convertPropertyDataToInstancePropertyData() { + if (null != value) defaultValue = value; } - - + public boolean isGetInputProperty() { + return this.getGetInputValues() != null && !this.getGetInputValues().isEmpty(); + } } @@ -22,6 +22,7 @@ package org.openecomp.sdc.be.datatypes.elements; import java.io.Serializable; import java.util.List; + import org.codehaus.jackson.annotate.JsonIgnore; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; @@ -27,23 +27,32 @@ import java.util.List; import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; +import com.google.common.collect.Lists; +/** + * Represents the requirement of the component or component instance + */ public class RequirementDataDefinition extends ToscaDataDefinition implements Serializable { /** * */ - public final static String MIN_OCCURRENCES = "1"; - public final static String MAX_OCCURRENCES = "UNBOUNDED"; - public final static String MAX_DEFAULT_OCCURRENCES = "1"; + public static final String MIN_OCCURRENCES = "1"; + public static final String MAX_OCCURRENCES = "UNBOUNDED"; + public static final String MAX_DEFAULT_OCCURRENCES = "1"; private static final long serialVersionUID = -8840549489409274532L; - + /** + * The default constructor initializing limits of the occurrences + */ public RequirementDataDefinition() { super(); this.setMinOccurrences( MIN_OCCURRENCES ); this.setMaxOccurrences( MAX_OCCURRENCES); this.setLeftOccurrences( MAX_OCCURRENCES); } - + /** + * Deep copy constructor + * @param other + */ public RequirementDataDefinition(RequirementDataDefinition other) { this.setUniqueId(other.getUniqueId()); this.setName(other.getName()); @@ -56,9 +65,11 @@ public class RequirementDataDefinition extends ToscaDataDefinition implements Se this.setMinOccurrences(other.getMinOccurrences()); this.setMaxOccurrences(other.getMaxOccurrences()); this.setLeftOccurrences(other.getLeftOccurrences()); - this.setPath(other.getPath()); + if(other.getPath() == null) + this.setPath(Lists.newArrayList()); + else + this.setPath(Lists.newArrayList(other.getPath())); this.setSource(other.getSource()); - } /** @@ -122,19 +133,15 @@ public class RequirementDataDefinition extends ToscaDataDefinition implements Se setToscaPresentationValue(JsonPresentationFields.RELATIONSHIP, relationship); } - // public RequirementImplDef getRequirementImpl() { - // return requirementImpl; - // } - // - // public void setRequirementImpl(RequirementImplDef requirementImpl) { - // this.requirementImpl = requirementImpl; - // } - - // specifies the resource instance holding this requirement + /** + * specifies the resource instance holding this requirement + */ + @Override public String getOwnerId() { return (String) getToscaPresentationValue(JsonPresentationFields.OWNER_ID); } - + + @Override public void setOwnerId(String ownerId) { setToscaPresentationValue(JsonPresentationFields.OWNER_ID, ownerId); } @@ -175,6 +182,7 @@ public class RequirementDataDefinition extends ToscaDataDefinition implements Se setToscaPresentationValue(JsonPresentationFields.PATH, path); } + @SuppressWarnings({ "unchecked" }) public List<String> getPath() { return (List<String>) getToscaPresentationValue(JsonPresentationFields.PATH); } @@ -187,12 +195,18 @@ public class RequirementDataDefinition extends ToscaDataDefinition implements Se return (String) getToscaPresentationValue(JsonPresentationFields.SOURCE); } + /** + * Adds the element to the path avoiding duplication + * @param elementInPath + */ public void addToPath(String elementInPath) { List<String> path = getPath(); if (path == null) { path = new ArrayList<>(); } - path.add(elementInPath); + if(!path.contains(elementInPath)){ + path.add(elementInPath); + } setPath(path); } @@ -21,11 +21,9 @@ package org.openecomp.sdc.be.datatypes.elements; import java.io.Serializable; -import java.util.HashMap; import java.util.List; import java.util.Map; -import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; /** @@ -42,6 +42,7 @@ public enum JsonPresentationFields { IS_DELETED ("isDeleted", GraphPropertyEnum.IS_DELETED), ECOMP_GENERATED_NAMING ("ecompGeneratedNaming", null), NAMING_POLICY ("namingPolicy", null), + ENVIRONMENT_CONTEXT ("environmentContext", null), TOSCA_RESOURCE_NAME ("toscaResourceName", GraphPropertyEnum.TOSCA_RESOURCE_NAME), DESCRIPTION ("description", null), TYPE ("type", null), @@ -174,6 +175,11 @@ public enum JsonPresentationFields { CI_TOSCA_COMPONENT_NAME ("toscaComponentName", null), CI_INVARIANT_NAME ("invariantName", null), CI_ICON ("icon", null), + CI_SOURCE_MODEL_UUID ("sourceModelUuid", null), + CI_SOURCE_MODEL_UID ("sourceModelUid", null), + CI_SOURCE_MODEL_INVARIANT ("sourceModelInvariant", null), + CI_SOURCE_MODEL_NAME ("sourceModelName", null), + CI_IS_PROXY ("isProxy", null), ; @@ -27,9 +27,12 @@ public enum OriginTypeEnum { VFC("VFC", "VFC (Virtual Function Component)", "resource instance", ComponentTypeEnum.RESOURCE), CP("CP", "CP (Connection Point)", "resource instance", ComponentTypeEnum.RESOURCE), VL("VL", "VL (Virtual Link)", "resource instance", ComponentTypeEnum.RESOURCE), + Configuration("Configuration", "Configuration ()", "resource instance", ComponentTypeEnum.RESOURCE), VFCMT("VFCMT", "VFCMT (VFC Monitoring Template)", "resource instance", ComponentTypeEnum.RESOURCE), CVFC("CVFC", "CVFC (Complex Virtual Function Component)", "resource instance", ComponentTypeEnum.RESOURCE), - PNF("PNF", "PNF (Physical Network Function)", "resource instance", ComponentTypeEnum.RESOURCE); + PNF("PNF", "PNF (Physical Network Function)", "resource instance", ComponentTypeEnum.RESOURCE), + ServiceProxy("Service Proxy", "Service Proxy", "service proxy", ComponentTypeEnum.RESOURCE) + ; private String value; private String displayValue; @@ -33,7 +33,9 @@ public enum ResourceTypeEnum { PNF("PNF"/* (Physical Network Function)" */), CVFC("CVFC"/*Complex Virtual Function Component*/), VL( "VL (Virtual Link)"), - VFCMT("VFCMT (VFC Monitoring Template)"), + VFCMT("VFCMT (VFC Monitoring Template)"), + Configuration("Configuration ()"), + ServiceProxy("ServiceProxy ()"), ABSTRACT("Abstract (Generic VFC/VF/PNF/Service Type)"); private String value; @@ -28,25 +28,24 @@ import java.util.Set; import java.util.stream.Collectors; import org.codehaus.jackson.annotate.JsonCreator; -import org.codehaus.jackson.annotate.JsonIgnore; import org.codehaus.jackson.annotate.JsonValue; -import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; import fj.data.Either; public abstract class ToscaDataDefinition { - + protected Map<String, Object> toscaPresentation; - - public ToscaDataDefinition(){ + public ToscaDataDefinition() { toscaPresentation = new HashMap<String, Object>(); } + @JsonCreator - public ToscaDataDefinition(Map<String, Object> art){ + public ToscaDataDefinition(Map<String, Object> art) { toscaPresentation = art; } + @JsonValue public Object getToscaPresentationValue(JsonPresentationFields name) { if (toscaPresentation != null && toscaPresentation.containsKey(name.getPresentation())) { @@ -54,56 +53,57 @@ public abstract class ToscaDataDefinition { } return null; } - + public void setToscaPresentationValue(JsonPresentationFields name, Object value) { - if (toscaPresentation == null && value !=null) { - toscaPresentation = new HashMap<String, Object>(); + if (toscaPresentation == null && value != null) { + toscaPresentation = new HashMap<String, Object>(); } toscaPresentation.put(name.getPresentation(), value); - + } - public void setOwnerIdIfEmpty(String ownerId){ - if ( getOwnerId() == null ){ + + public void setOwnerIdIfEmpty(String ownerId) { + if (getOwnerId() == null) { setOwnerId(ownerId); } } - public void setOwnerId(String ownerId){ + + public void setOwnerId(String ownerId) { setToscaPresentationValue(JsonPresentationFields.OWNER_ID, ownerId); } - public String getOwnerId(){ + public String getOwnerId() { return (String) getToscaPresentationValue(JsonPresentationFields.OWNER_ID); } - - - //default merge function for merging data maps - implement where needed and use mergeDataMaps method where applicable instead of map1.putAll(map2) - public <T extends ToscaDataDefinition> T mergeFunction(T other, boolean allowDefaultValueOverride){ + + // default merge function for merging data maps - implement where needed and use mergeDataMaps method where applicable instead of map1.putAll(map2) + public <T extends ToscaDataDefinition> T mergeFunction(T other, boolean allowDefaultValueOverride) { other.setOwnerId(getOwnerId()); return other; } - - public static <T extends ToscaDataDefinition> Either<Map<String, T>, String> mergeDataMaps(Map<String, T> map1, Map<String, T> map2){ + + public static <T extends ToscaDataDefinition> Either<Map<String, T>, String> mergeDataMaps(Map<String, T> map1, Map<String, T> map2) { return mergeDataMaps(map1, map2, false); } - - //return Either.right(item key) if an illegal merge was attempted (overriding data type is forbidden) - public static <T extends ToscaDataDefinition> Either<Map<String, T>, String> mergeDataMaps(Map<String, T> map1, Map<String, T> map2, boolean allowDefaultValueOverride){ - for(Entry<String, T> entry : map2.entrySet()){ + + // return Either.right(item key) if an illegal merge was attempted (overriding data type is forbidden) + public static <T extends ToscaDataDefinition> Either<Map<String, T>, String> mergeDataMaps(Map<String, T> map1, Map<String, T> map2, boolean allowDefaultValueOverride) { + for (Entry<String, T> entry : map2.entrySet()) { map1.merge(entry.getKey(), entry.getValue(), (item1, item2) -> item1.mergeFunction(item2, allowDefaultValueOverride)); - //validate merge success - if(!map1.containsKey(entry.getKey())) - return Either.right(entry.getKey()); + // validate merge success + if (!map1.containsKey(entry.getKey())) + return Either.right(entry.getKey()); } return Either.left(map1); } - + public static <T extends ToscaDataDefinition> Map<String, T> listToMapByName(List<T> dataList) { - return null == dataList? new HashMap<>() : dataList.stream() - .collect(Collectors.toMap(p -> (String)p.getToscaPresentationValue(JsonPresentationFields.NAME), p -> p)); + return null == dataList ? new HashMap<>() : dataList.stream().collect(Collectors.toMap(p -> (String) p.getToscaPresentationValue(JsonPresentationFields.NAME), p -> p)); } - public boolean findUidMatch(String uid){ + public boolean findUidMatch(String uid) { return uid.equals(getToscaPresentationValue(JsonPresentationFields.UNIQUE_ID)); + } public <T extends ToscaDataDefinition> T removeByOwnerId(Set<String> ownerIdList) { return (T) this; @@ -111,6 +111,11 @@ public abstract class ToscaDataDefinition { public static <T extends ToscaDataDefinition> T removeAndCollectByOwnerId(T complexStructure, Set<String> ownerIdList) { return complexStructure.removeByOwnerId(ownerIdList); } + + public <T extends ToscaDataDefinition> T updateIfExist(T other, boolean allowDefaultValueOverride) { + return other; + } + public boolean isEmpty(){ return false; } @@ -20,10 +20,16 @@ package org.openecomp.sdc.be.workers; -import com.google.common.util.concurrent.ThreadFactoryBuilder; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.LinkedBlockingQueue; +import java.util.concurrent.ThreadFactory; +import java.util.concurrent.TimeUnit; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.concurrent.*; + +import com.google.common.util.concurrent.ThreadFactoryBuilder; /** * Created by michael on 6/24/2016. @@ -20,13 +20,13 @@ package org.openecomp.sdc.be.workers; +import java.util.concurrent.LinkedBlockingQueue; +import java.util.concurrent.TimeUnit; + import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.concurrent.LinkedBlockingQueue; -import java.util.concurrent.TimeUnit; - /** * Created by michael on 6/24/2016. */ @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.datatypes.category; import java.util.List; -import javax.annotation.Generated; - import org.junit.Assert; import org.junit.Test; @@ -1,7 +1,5 @@ package org.openecomp.sdc.be.datatypes.category; -import javax.annotation.Generated; - import org.junit.Assert; import org.junit.Test; @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.datatypes.category; import java.util.List; -import javax.annotation.Generated; - import org.junit.Assert; import org.junit.Test; @@ -1,7 +1,5 @@ package org.openecomp.sdc.be.datatypes.components; -import javax.annotation.Generated; - import org.junit.Test; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; @@ -1,7 +1,5 @@ package org.openecomp.sdc.be.datatypes.components; -import javax.annotation.Generated; - import org.junit.Assert; import org.junit.Test; @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.datatypes.elements; import java.util.List; -import javax.annotation.Generated; - import org.junit.Test; @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.datatypes.elements; import java.util.List; -import javax.annotation.Generated; - import org.junit.Assert; import org.junit.Test; import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum; @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.datatypes.elements; import java.util.List; -import javax.annotation.Generated; - import org.junit.Assert; import org.junit.Test; @@ -1,7 +1,5 @@ package org.openecomp.sdc.be.datatypes.elements; -import javax.annotation.Generated; - import org.junit.Test; import org.openecomp.sdc.be.datatypes.enums.OriginTypeEnum; @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.datatypes.elements; import java.util.Map; -import javax.annotation.Generated; - import org.junit.Test; @@ -1,7 +1,5 @@ package org.openecomp.sdc.be.datatypes.elements; -import javax.annotation.Generated; - import org.junit.Assert; import org.junit.Test; @@ -1,7 +1,5 @@ package org.openecomp.sdc.be.datatypes.elements; -import javax.annotation.Generated; - import org.junit.Test; @@ -1,7 +1,5 @@ package org.openecomp.sdc.be.datatypes.elements; -import javax.annotation.Generated; - import org.junit.Assert; import org.junit.Test; @@ -3,8 +3,6 @@ package org.openecomp.sdc.be.datatypes.elements; import java.util.List; import java.util.Map; -import javax.annotation.Generated; - import org.junit.Test; @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.datatypes.elements; import java.util.List; -import javax.annotation.Generated; - import org.junit.Test; @@ -3,8 +3,6 @@ package org.openecomp.sdc.be.datatypes.elements; import java.util.List; import java.util.Map; -import javax.annotation.Generated; - import org.junit.Test; @@ -1,7 +1,5 @@ package org.openecomp.sdc.be.datatypes.elements; -import javax.annotation.Generated; - import org.junit.Assert; import org.junit.Test; @@ -1,7 +1,5 @@ package org.openecomp.sdc.be.datatypes.elements; -import javax.annotation.Generated; - import org.junit.Test; @@ -1,7 +1,5 @@ package org.openecomp.sdc.be.datatypes.elements; -import javax.annotation.Generated; - import org.junit.Test; @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.datatypes.elements; import java.util.Map; -import javax.annotation.Generated; - import org.junit.Test; @@ -3,8 +3,6 @@ package org.openecomp.sdc.be.datatypes.elements; import java.util.ArrayList; import java.util.List; -import javax.annotation.Generated; - import org.junit.Test; @@ -3,8 +3,6 @@ package org.openecomp.sdc.be.datatypes.elements; import java.util.ArrayList; import java.util.List; -import javax.annotation.Generated; - import org.junit.Test; @@ -3,8 +3,6 @@ package org.openecomp.sdc.be.datatypes.elements; import java.util.ArrayList; import java.util.List; -import javax.annotation.Generated; - import org.junit.Test; @@ -3,8 +3,6 @@ package org.openecomp.sdc.be.datatypes.elements; import java.util.ArrayList; import java.util.List; -import javax.annotation.Generated; - import org.junit.Test; @@ -3,8 +3,6 @@ package org.openecomp.sdc.be.datatypes.elements; import java.util.HashMap; import java.util.Map; -import javax.annotation.Generated; - import org.junit.Test; @@ -3,8 +3,6 @@ package org.openecomp.sdc.be.datatypes.elements; import java.util.HashMap; import java.util.Map; -import javax.annotation.Generated; - import org.junit.Test; @@ -3,8 +3,6 @@ package org.openecomp.sdc.be.datatypes.elements; import java.util.HashMap; import java.util.Map; -import javax.annotation.Generated; - import org.junit.Test; @@ -1,12 +1,8 @@ package org.openecomp.sdc.be.datatypes.elements; -import java.util.ArrayList; import java.util.HashMap; -import java.util.List; import java.util.Map; -import javax.annotation.Generated; - import org.junit.Test; @@ -3,8 +3,6 @@ package org.openecomp.sdc.be.datatypes.elements; import java.util.HashMap; import java.util.Map; -import javax.annotation.Generated; - import org.junit.Test; @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.datatypes.elements; import java.util.Map; -import javax.annotation.Generated; - import org.junit.Test; @@ -3,8 +3,6 @@ package org.openecomp.sdc.be.datatypes.elements; import java.util.List; import java.util.Map; -import javax.annotation.Generated; - import org.junit.Test; @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.datatypes.elements; import java.util.List; -import javax.annotation.Generated; - import org.junit.Test; @@ -2,11 +2,8 @@ package org.openecomp.sdc.be.datatypes.elements; import java.util.List; -import javax.annotation.Generated; - import org.junit.Assert; import org.junit.Test; -import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; public class PropertyDataDefinitionTest { @@ -2,8 +2,6 @@ package org.openecomp.sdc.be.datatypes.elements; import java.util.List; -import javax.annotation.Generated; - import org.junit.Assert; import org.junit.Test; @@ -20,11 +20,10 @@ package org.openecomp.sdc.be.utils; -import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; import org.junit.Test; -import org.openecomp.sdc.be.utils.CommonBeUtils; public class CommonBeUtilsTest { diff --git a/common/.gitignore b/common/.gitignore deleted file mode 100644 index 2c9567e1a0..0000000000 --- a/ common/.gitignore+++ /dev/null @@ -1,13 +0,0 @@ -target -package -.settings -.project -.classpath -.idea - -*.log - -### idea files -*.iml -*.ipr -*.iws diff --git a/pom.xml b/pom.xml index 582261bf7a..bd7bb2a457 100644 --- a/ pom.xml+++ b/ pom.xml@@ -9,6 +9,9 @@ <name>sdc</name> <properties> + <maven.compiler.source>1.8</maven.compiler.source> + <maven.compiler.target>1.8</maven.compiler.target> + <!-- ==================== --> <!-- Generic properties --> <!-- ==================== --> @@ -34,6 +37,8 @@ <!-- Elastic Search mapper (reference the elastic search version actually). --> <elastic-search.version>2.1.0</elastic-search.version> + <catalog-artifacts.version>1.0.0-SNAPSHOT</catalog-artifacts.version> + <catalog-builders.version>1.0.0-SNAPSHOT</catalog-builders.version> <jetty.version>9.2.10.v20150310</jetty.version> <!-- JSON and YAML Parsing --> @@ -79,29 +84,21 @@ <commons-jci-core.version>1.1</commons-jci-core.version> <!--TESTING--> - <mockito.version>1.10.19</mockito.version> + <mockito.version>2.12.0</mockito.version> <junit.version>4.12</junit.version> <testng.version>6.9.10</testng.version> <extentreports.version>3.0.3</extentreports.version> <!-- parser--> - <sdc-tosca-parser.version>1.1.32</sdc-tosca-parser.version> + <sdc-tosca-parser.version>1.1.56-SNAPSHOT</sdc-tosca-parser.version> <!--JaCoCO --> <sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin> - <sonar.jacoco.reportPath>${project.basedir}/target/jacoco.exec</sonar.jacoco.reportPath> - <sonar.jacoco.itReportPath>${project.basedir}/target/it-jacoco.exec</sonar.jacoco.itReportPath> + <sonar.jacoco.reportPath>${project.basedir}/../target/jacoco.exec</sonar.jacoco.reportPath> + <sonar.jacoco.itReportPath>${project.basedir}/../target/it-jacoco.exec</sonar.jacoco.itReportPath> <sonar.language>java</sonar.language> - <sonar.version>${project.version}</sonar.version> - - <!--cassandra --> - <cassandra.driver.version>3.0.0</cassandra.driver.version> - <!-- maven central (Nexus) --> - <nexus.id.release>nexus</nexus.id.release> - <nexus.id.snapshot>nexus</nexus.id.snapshot> <!-- Sonar properties --> <sonar.sourceEncoding>${project.build.sourceEncoding}</sonar.sourceEncoding> - <sonar.skipDesign>true</sonar.skipDesign> <sonar.projectBaseDir>${project.basedir}</sonar.projectBaseDir> <sonar.sources>.</sonar.sources> <sonar.exclusions>**/scripts/**/*</sonar.exclusions> @@ -109,6 +106,22 @@ <sonar.inclusions>app/**/*.js,server-mock/**/*.js,src/**/*.js,src/main/**/*.java</sonar.inclusions> <sonar.branch>${project.version}</sonar.branch> + <assertj.version>3.8.0</assertj.version> + + <!--cassandra --> + <cassandra.driver.version>3.0.0</cassandra.driver.version> + <!-- maven central (Nexus) --> + <nexus.id.release>nexus</nexus.id.release> + <nexus.id.snapshot>nexus</nexus.id.snapshot> + + <assertj.version>3.8.0</assertj.version> + + <!--cassandra --> + <cassandra.driver.version>3.0.0</cassandra.driver.version> + <!-- maven central (Nexus) --> + <nexus.id.release>nexus</nexus.id.release> + <nexus.id.snapshot>nexus</nexus.id.snapshot> + <!--nexus--> <nexus.proxy>https://nexus.onap.org</nexus.proxy> <sitePath>/content/sites/site/org/openecomp/sdc/${project.version}</sitePath> @@ -117,6 +130,22 @@ <maven.build.timestamp.format>yyyyMMdd'T'HHmm</maven.build.timestamp.format> </properties> + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.assertj</groupId> + <artifactId>assertj-core</artifactId> + <version>${assertj.version}</version> + </dependency> + + <dependency> + <groupId>org.mockito</groupId> + <artifactId>mockito-core</artifactId> + <version>${mockito.version}</version> + </dependency> + </dependencies> + </dependencyManagement> + <reporting> <plugins> <plugin> @@ -214,56 +243,28 @@ </executions> </plugin> - <!-- Set the JDK compiler version. --> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - <version>2.5.1</version> - <inherited>true</inherited> - <configuration> - <source>1.8</source> - <target>1.8</target> - </configuration> - </plugin> - <!-- Java Code Coverage --> <plugin> <groupId>org.jacoco</groupId> <artifactId>jacoco-maven-plugin</artifactId> - <version>0.7.1.201405082137</version> - <inherited>True</inherited> + <version>0.7.9</version> + <configuration> + <append>true</append> + <destFile>${sonar.jacoco.reportPath}</destFile> + <dataFile>${sonar.jacoco.reportPath}</dataFile> + </configuration> <executions> - <!-- Unit-Tests --> <execution> - <id>prepare-agent</id> + <id>default-prepare-agent</id> <goals> <goal>prepare-agent</goal> </goals> - <configuration> - <destFile>${sonar.jacoco.reportPath}</destFile> - </configuration> </execution> <execution> - <id>report</id> + <id>default-report</id> <goals> <goal>report</goal> </goals> - <configuration> - <dataFile>${sonar.jacoco.reportPath}</dataFile> - <outputDirectory>${project.basedir}/target/site/jacoco</outputDirectory> - </configuration> - </execution> - - <!-- Integration Tests (Only report goal) --> - <execution> - <id>report-integration</id> - <goals> - <goal>report-integration</goal> - </goals> - <configuration> - <dataFile>${sonar.jacoco.itReportPath}</dataFile> - <outputDirectory>${project.basedir}/target/site/it-jacoco</outputDirectory> - </configuration> </execution> </executions> </plugin> @@ -365,6 +366,27 @@ </profile> <profile> + <id>catalog-be</id> + <activation> + <activeByDefault>false</activeByDefault> + </activation> + <modules> + <module>security-utils</module> + <module>common-app-api</module> + <module>common-be</module> + <module>catalog-dao</module> + <module>catalog-model</module> + <module>catalog-be</module> + </modules> + <properties> + <ecomp.version>1.2.7</ecomp.version> + <artifact-generator-api.version>1710.0.0</artifact-generator-api.version> + <artifact-generator-core.version>1710.0.0</artifact-generator-core.version> + <dox-common-lib.version>1710.0.0</dox-common-lib.version> + <sdc-tosca-parser.version>1.1.14</sdc-tosca-parser.version> + </properties> + </profile> + <profile> <id>onboarding</id> <activation> <activeByDefault>false</activeByDefault> @@ -12,20 +12,21 @@ "BE_VIP": "yyy", "FE_VIP": "yyy", "ES_VIP": "yyy", + "KB_VIP": "yyy", "interfaces": { "application": "eth0", "private": "eth1" }, "ECompP": { "ecomp_rest_url": "http://portal.api.simpledemo.onap.org:8989/ONAPPORTAL/auxapi", - "ueb_url_list": "10.0.11.1,10.0.11.1", - "app_secret": "XftIATw9Jr3VzAcPqt3NnJOu", - "app_key": "x9UfO7JsDn8BESVX", - "inbox_name": "ECOMP-PORTAL-INBOX", - "ecomp_redirect_url": "http://portal.api.simpledemo.openecomp.org:8989/ECOMPPORTAL/login.htm", + "ueb_url_list": "10.0.11.1,10.0.11.1", + "app_secret": "XftIATw9Jr3VzAcPqt3NnJOu", + "app_key": "x9UfO7JsDn8BESVX", + "inbox_name": "ECOMP-PORTAL-INBOX", + "ecomp_redirect_url": "http://portal.api.simpledemo.openecomp.org:8989/ECOMPPORTAL/login.htm", "app_topic_name": "ECOMP-PORTAL-OUTBOX-SDC1", "decryption_key": "AGLDdG4D04BKm2IxIWEr8o==" - }, + }, "UEB": { "PublicKey": "iPIxkpAMI8qTcQj8", "SecretKey": "Ehq3WyT4bkif4zwgEbvshGal", @@ -35,7 +36,8 @@ "CS": "yyy", "BE": "yyy", "FE": "yyy", - "ES": "yyy" + "ES": "yyy", + "KB": "yyy" } }, "override_attributes": { @@ -323,10 +323,28 @@ </resources> </configuration> </execution> + + <execution> + <id>copy-sdctool</id> + <phase>validate</phase> + <goals> + <goal>copy-resources</goal> + </goals> + <configuration> + <outputDirectory>${project.parent.basedir}/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/files/default</outputDirectory> + <resources> + <resource> + <directory>${project.parent.basedir}/asdctool/target</directory> + <includes> + <include>sdctool.tar</include> + </includes> + </resource> + </resources> + </configuration> + </execution> </executions> </plugin> - - + <plugin> <groupId>io.fabric8</groupId> <artifactId>docker-maven-plugin</artifactId> @@ -22,7 +22,7 @@ beProtocol: http beSslPort: <%= @ssl_port %> version: 1.0 released: 2012-11-30 -toscaConformanceLevel: 4.0 +toscaConformanceLevel: 5.0 minToscaConformanceLevel: 3.0 titanCfgFile: /var/lib/jetty/config/catalog-be/titan.properties @@ -557,6 +557,11 @@ onboarding: downloadCsarUri: "/onboarding-api/v1.0/vendor-software-products/packages" healthCheckUri: "/onboarding-api/v1.0/healthcheck" +dcae: + protocol: http + host: <%= @host_ip %> + port: <%= @catalog_port %> + healthCheckUri: "/dcae/healthCheck" # #GSS IDNS switchoverDetector: @@ -619,3 +624,23 @@ genericAssetNodeTypes: VF : org.openecomp.resource.abstract.nodes.VF PNF: org.openecomp.resource.abstract.nodes.PNF Service: org.openecomp.resource.abstract.nodes.service + +workloadContext: Production + +environmentContext: + defaultValue: General_Revenue-Bearing + validValues: + - Critical_Revenue-Bearing + - Vital_Revenue-Bearing + - Essential_Revenue-Bearing + - Important_Revenue-Bearing + - Needed_Revenue-Bearing + - Useful_Revenue-Bearing + - General_Revenue-Bearing + - Critical_Non-Revenue + - Vital_Non-Revenue + - Essential_Non-Revenue + - Important_Non-Revenue + - Needed_Non-Revenue + - Useful_Non-Revenue + - General_Non-Revenue @@ -11,7 +11,7 @@ bash "import-normatives" do cd normatives/scripts/import/tosca/ /bin/chmod +x importNormativeAll.py # add --debug=true to the importNormativeAll.py arguments to enable debug - python importNormativeAll.py -i localhost > /var/lib/jetty/logs/importNormativeAll.log + python importONAPNormativeAll.py -i localhost > /var/lib/jetty/logs/importNormativeAll.log EOH end @@ -11,7 +11,7 @@ bash "upgrade-normatives" do cd normatives/scripts/import/tosca/ /bin/chmod +x upgradeNormative.py importGroupTypes.py # add --debug=true to the importNormativeAll.py arguments to enable debug - python upgradeNormative.py -i localhost > /var/lib/jetty/logs/upgradeNormative.log + python upgradeONAPNormative.py -i localhost > /var/lib/jetty/logs/upgradeNormative.log EOH end @@ -22,7 +22,7 @@ beProtocol: http beSslPort: <%= @ssl_port %> version: 1.0 released: 2012-11-30 -toscaConformanceLevel: 4.0 +toscaConformanceLevel: 5.0 minToscaConformanceLevel: 3.0 titanCfgFile: <%= @titan_Path %>/titan.properties @@ -523,6 +523,11 @@ onboarding: downloadCsarUri: "/onboarding-api/v1.0/vendor-software-products/packages" healthCheckUri: "/onboarding-api/v1.0/healthcheck" +dcae: + protocol: http + host: <%= @host_ip %> + port: <%= @catalog_port %> + healthCheckUri: "/dcae/healthCheck" # #GSS IDNS switchoverDetector: @@ -581,4 +586,24 @@ vfModuleProperties: genericAssetNodeTypes: VFC: org.openecomp.resource.abstract.nodes.VFC VF : org.openecomp.resource.abstract.nodes.VF - Service: org.openecomp.resource.abstract.nodes.service
\ No newline at end of file + Service: org.openecomp.resource.abstract.nodes.service + +workloadContext: Production + +environmentContext: + defaultValue: General_Revenue-Bearing + validValues: + - Critical_Revenue-Bearing + - Vital_Revenue-Bearing + - Essential_Revenue-Bearing + - Important_Revenue-Bearing + - Needed_Revenue-Bearing + - Useful_Revenue-Bearing + - General_Revenue-Bearing + - Critical_Non-Revenue + - Vital_Non-Revenue + - Essential_Non-Revenue + - Important_Non-Revenue + - Needed_Non-Revenue + - Useful_Non-Revenue + - General_Non-Revenue @@ -1,12 +1,3 @@ -cookbook_file "/usr/share/elasticsearch/config/kibana_dashboard_virtualization.json" do - source "kibana_dashboard_virtualization.json" - owner "elasticsearch" - group "elasticsearch" - mode "0755" -end - - - ruby_block "check_ElasticSearch_Cluster_Health" do block do #tricky way to load this Chef::Mixin::ShellOut utilities @@ -29,12 +20,6 @@ ruby_block "check_ElasticSearch_Cluster_Health" do retry_delay 2 end -bash "echo status" do - code <<-EOH - echo "DOCKER STARTED" - EOH -end - bash "create Kibana dashboard" do code <<-EOH for file in /root/chef-solo/cookbooks/sdc-elasticsearch/files/default/dashboard_*.json; do @@ -55,4 +40,10 @@ bash "create Kibana visualization" do echo done EOH +end + +bash "echo status" do + code <<-EOH + echo "DOCKER STARTED" + EOH end
\ No newline at end of file @@ -10,6 +10,7 @@ template "catalog-fe-config" do variables({ :fe_host_ip => node['HOST_IP'], :be_host_ip => node['HOST_IP'], + :kb_host_ip => node['HOST_IP'], :catalog_port => node['BE'][:http_port], :ssl_port => node['BE'][:https_port] }) @@ -32,6 +32,12 @@ onboarding: port: 8181 healthCheckUri: "/onboarding/v1.0/healthcheck" +dcae: + protocol: http + host: localhost + port: 8181 + healthCheckUri: "/dcae/healthCheck" + identificationHeaderFields: - - &HTTP_IV_USER HTTP_IV_USER @@ -79,6 +85,6 @@ systemMonitoring: isProxy: true probeIntervalInSeconds: 15 -kibanaHost: localhost +kibanaHost: <%= @kb_host_ip %> kibanaPort: 5601 kibanaProtocol: http @@ -5,7 +5,7 @@ cd /root/chef-solo echo "normal['HOST_IP'] = \"${HOST_IP}\"" > /root/chef-solo/cookbooks/sdc-catalog-fe/attributes/default.rb chef-solo -c solo.rb -E ${CHEFNAME} -sed -i '/^set -e/aJAVA_OPTIONS=\"-XX:MaxPermSize=256m -Xmx512m -Xms512m -Dconfig.home=${JETTY_BASE}\/config -Dlog.home=${JETTY_BASE}\/logs -Dlogback.configurationFile=${JETTY_BASE}\/config\/catalog-fe\/logback.xml -Dconfiguration.yaml=${JETTY_BASE}\/config\/catalog-fe\/configuration.yaml -Donboarding_configuration.yaml=${JETTY_BASE}\/config\/onboarding-fe\/onboarding_configuration.yaml\"' /docker-entrypoint.sh +sed -i '/^set -e/aJAVA_OPTIONS=\"-XX:MaxPermSize=256m -Xmx512m -Dconfig.home=${JETTY_BASE}\/config -Dlog.home=${JETTY_BASE}\/logs -Dlogback.configurationFile=${JETTY_BASE}\/config\/catalog-fe\/logback.xml -Dconfiguration.yaml=${JETTY_BASE}\/config\/catalog-fe\/configuration.yaml -Donboarding_configuration.yaml=${JETTY_BASE}\/config\/onboarding-fe\/onboarding_configuration.yaml\"' /docker-entrypoint.sh sed -i '/^set -e/aTMPDIR=${JETTY_BASE}\/temp' /docker-entrypoint.sh cd /var/lib/jetty @@ -22,7 +22,7 @@ beProtocol: http beSslPort: <%= @ssl_port %> version: 1.0 released: 2012-11-30 -toscaConformanceLevel: 4.0 +toscaConformanceLevel: 5.0 minToscaConformanceLevel: 3.0 titanCfgFile: <%= @titan_Path %>/titan.properties @@ -544,6 +544,12 @@ onboarding: downloadCsarUri: "/onboarding-api/v1.0/vendor-software-products/packages" healthCheckUri: "/onboarding-api/v1.0/healthcheck" +dcae: + protocol: http + host: <%= @host_ip %> + port: <%= @catalog_port %> + healthCheckUri: "/dcae/healthCheck" + # #GSS IDNS switchoverDetector: @@ -607,3 +613,22 @@ genericAssetNodeTypes: PNF: org.openecomp.resource.abstract.nodes.PNF Service: org.openecomp.resource.abstract.nodes.service +workloadContext: Production + +environmentContext: + defaultValue: General_Revenue-Bearing + validValues: + - Critical_Revenue-Bearing + - Vital_Revenue-Bearing + - Essential_Revenue-Bearing + - Important_Revenue-Bearing + - Needed_Revenue-Bearing + - Useful_Revenue-Bearing + - General_Revenue-Bearing + - Critical_Non-Revenue + - Vital_Non-Revenue + - Essential_Non-Revenue + - Important_Non-Revenue + - Needed_Non-Revenue + - Useful_Non-Revenue + - General_Non-Revenue Binary files differ@@ -11,6 +11,10 @@ <version>1.2.0-SNAPSHOT</version> </parent> + <properties> + <sonar.skip>true</sonar.skip> + </properties> + <dependencies> <dependency> <groupId>junit</groupId> @@ -20,10 +20,9 @@ package org.openecomp.sdc.security; -import static org.junit.Assert.*; +import static org.junit.Assert.assertTrue; import org.junit.Test; -import org.openecomp.sdc.security.Passwords; public class PasswordTest { @@ -46,10 +46,8 @@ <dependency> <groupId>org.mockito</groupId> - <artifactId>mockito-all</artifactId> - <version>${mockito.version}</version> - <!--<version>1.10.19</version>--> - <scope>compile</scope> + <artifactId>mockito-core</artifactId> + <scope>test</scope> </dependency> <dependency> @@ -281,10 +279,10 @@ <artifactId>json</artifactId> <version>20090211</version> </dependency> - <dependency> + <dependency> <groupId>org.openecomp.sdc.sdc-tosca</groupId> <artifactId>sdc-tosca</artifactId> - <version>${sdc-tosca-parser.version}</version> + <version>${sdc-tosca-parser.version}</version> <scope>compile</scope> </dependency> </dependencies> @@ -20,13 +20,21 @@ package org.openecomp.sdc.ci.tests.api; -import com.aventstack.extentreports.ExtentTest; -import com.aventstack.extentreports.Status; -import com.thinkaurelius.titan.core.TitanFactory; -import com.thinkaurelius.titan.core.TitanGraph; -import com.thinkaurelius.titan.core.TitanVertex; +import static org.testng.AssertJUnit.assertEquals; +import static org.testng.AssertJUnit.assertNotNull; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.function.Consumer; +import java.util.stream.Collectors; + import org.apache.commons.collections.CollectionUtils; -import org.apache.commons.io.FileUtils; import org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.commons.lang3.tuple.ImmutableTriple; import org.apache.tinkerpop.gremlin.structure.Direction; @@ -37,7 +45,11 @@ import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; -import org.openecomp.sdc.be.model.*; +import org.openecomp.sdc.be.model.Component; +import org.openecomp.sdc.be.model.Product; +import org.openecomp.sdc.be.model.Resource; +import org.openecomp.sdc.be.model.Service; +import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.ci.tests.config.Config; import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; @@ -47,7 +59,13 @@ import org.openecomp.sdc.ci.tests.utils.cassandra.CassandraUtils; import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.openecomp.sdc.ci.tests.utils.general.FileHandling; -import org.openecomp.sdc.ci.tests.utils.rest.*; +import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils; +import org.openecomp.sdc.ci.tests.utils.rest.CatalogRestUtils; +import org.openecomp.sdc.ci.tests.utils.rest.CategoryRestUtils; +import org.openecomp.sdc.ci.tests.utils.rest.ProductRestUtils; +import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils; +import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; +import org.openecomp.sdc.ci.tests.utils.rest.ServiceRestUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.testng.ITestContext; @@ -57,31 +75,21 @@ import org.testng.annotations.AfterMethod; import org.testng.annotations.AfterSuite; import org.testng.annotations.BeforeMethod; import org.testng.annotations.BeforeSuite; -import org.testng.annotations.Test; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.util.*; -import java.util.function.Consumer; -import java.util.stream.Collectors; - -import static org.testng.AssertJUnit.assertEquals; -import static org.testng.AssertJUnit.assertNotNull; +import com.aventstack.extentreports.ExtentTest; +import com.aventstack.extentreports.Status; +import com.thinkaurelius.titan.core.TitanFactory; +import com.thinkaurelius.titan.core.TitanGraph; +import com.thinkaurelius.titan.core.TitanVertex; +import ch.qos.logback.classic.Level; +import ch.qos.logback.classic.LoggerContext; public abstract class ComponentBaseTest { -// private static Logger logger = LoggerFactory.getLogger(ComponentBaseTest.class.getName()); - protected static Logger logger= LoggerFactory.getLogger(ComponentBaseTest.class); - - -// public ComponentBaseTest(TestName testName, String className) { -// super(testName, className); -// } + protected static Logger logger= LoggerFactory.getLogger(ComponentBaseTest.class); protected static final String REPORT_FOLDER = "." + File.separator + "ExtentReport" + File.separator; private static final String VERSIONS_INFO_FILE_NAME = "versions.info"; private static final String REPORT_FILE_NAME = "SDC_CI_Extent_Report.html"; @@ -93,7 +101,8 @@ public abstract class ComponentBaseTest { /**************** METHODS ****************/ public static ExtentTest getExtendTest() { - return ExtentTestManager.getTest(); + SomeInterface testManager = new ExtentTestManager(); + return testManager.getTest(); } public static enum ComponentOperationEnum { @@ -101,16 +110,12 @@ public abstract class ComponentBaseTest { }; public ComponentBaseTest(TestName name, String name2) { - // TODO Auto-generated constructor stub -// LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory(); -// lc.getLogger("com.thinkaurelius").setLevel(Level.INFO); -// lc.getLogger("com.datastax").setLevel(Level.INFO); -// lc.getLogger("io.netty").setLevel(Level.INFO); -// lc.getLogger("c.d").setLevel(Level.INFO); -// lc.getLogger("o.a.h").setLevel(Level.INFO); -// lc.getLogger("o.o.s.c.t.d.h").setLevel(Level.INFO); - -} + LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory(); + lc.getLogger("com.thinkaurelius").setLevel(Level.INFO); + lc.getLogger("com.datastax").setLevel(Level.INFO); + lc.getLogger("io.netty").setLevel(Level.INFO); + lc.getLogger("c.d").setLevel(Level.INFO); + } public static String getReportFolder() { return REPORT_FOLDER; @@ -124,33 +129,26 @@ public abstract class ComponentBaseTest { AtomicOperationUtils.createDefaultConsumer(true); openTitanLogic(); performClean(); - - String basePath = FileHandling.getBasePath(); - String csarDir = FileHandling.getCreateDirByName("outputCsar"); - FileUtils.cleanDirectory(new File(csarDir)); + + + } @BeforeMethod(alwaysRun = true) - public void setBrowserBeforeTest(java.lang.reflect.Method method, ITestContext context) throws Exception { + public void setupBeforeTest(java.lang.reflect.Method method, ITestContext context) throws Exception { - -// String suiteName = ExtentManager.getSuiteName(context); -// ExtentTestManager.startTest(method.getName()); -// ExtentTestManager.assignCategory(this.getClass()); - - boolean emptyDataProvider = method.getAnnotation(Test.class).dataProvider().isEmpty(); - String className = method.getDeclaringClass().getName(); System.out.println(" method.getName() " + method.getName()); if (!method.getName().equals("onboardVNFShotFlow")) { - System.out.println("ExtentReport instance started from BeforeMethod..."); +// System.out.println("ExtentReport instance started from BeforeMethod..."); + logger.info("ExtentReport instance started from BeforeMethod..."); ExtentTestManager.startTest(method.getName()); ExtentTestManager.assignCategory(this.getClass()); } else { - System.out.println("ExtentReport instance started from Test..."); +// System.out.println("ExtentReport instance started from Test..."); + logger.debug("ExtentReport instance started from Test..."); } - } @AfterMethod(alwaysRun = true) @@ -187,8 +185,13 @@ public abstract class ComponentBaseTest { @AfterClass(alwaysRun = true) public synchronized static void cleanAfterClass() throws Exception{ +// System.out.println("<<<<<<<<class name>>>>>"+method.getDeclaringClass()); +// System.out.println("<<<<<<<<class name>>>>>"+method.getName()); + + System.out.println("delete components AfterClass"); deleteCreatedComponents(getCatalogAsMap()); +// extentReport.flush(); } @@ -197,6 +200,7 @@ public abstract class ComponentBaseTest { performClean(); shutdownTitanLogic(); + } protected static void openTitanLogic() throws Exception { @@ -228,8 +232,14 @@ public abstract class ComponentBaseTest { protected static void performClean() throws Exception, FileNotFoundException { // cleanComponents(); - deleteCreatedComponents(getCatalogAsMap()); - CassandraUtils.truncateAllKeyspaces(); + if(!config.getSystemUnderDebug()){ + deleteCreatedComponents(getCatalogAsMap()); + CassandraUtils.truncateAllKeyspaces(); + FileHandling.overWriteExistindDir("outputCsar"); + + }else{ + System.out.println("Accordindig to configuration components will not be deleted, in case to unable option to delete, please change systemUnderDebug parameter value to false ..."); + } } public void verifyErrorCode(RestResponse response, String action, int expectedCode) { @@ -372,13 +382,14 @@ public abstract class ComponentBaseTest { titanGraph.tx().commit(); String adminId = UserRoleEnum.ADMIN.getUserId(); - String productStrategistId = UserRoleEnum.PRODUCT_STRATEGIST1.getUserId(); + /* String productStrategistId = UserRoleEnum.PRODUCT_STRATEGIST1.getUserId();*/ // Component delete - for (String id : productsToDelete) { + +/* for (String id : productsToDelete) { RestResponse deleteProduct = ProductRestUtils.deleteProduct(id, productStrategistId); - } + }*/ for (String id : servicesToDelete) { RestResponse deleteServiceById = ServiceRestUtils.deleteServiceById(id, adminId); @@ -394,7 +405,7 @@ public abstract class ComponentBaseTest { } // Categories delete - product - String componentType = BaseRestUtils.PRODUCT_COMPONENT_TYPE; + /*String componentType = BaseRestUtils.PRODUCT_COMPONENT_TYPE; for (ImmutableTriple<String, String, String> triple : productGroupingsToDelete) { CategoryRestUtils.deleteGrouping(triple.getRight(), triple.getMiddle(), triple.getLeft(), productStrategistId, componentType); } @@ -403,10 +414,10 @@ public abstract class ComponentBaseTest { } for (String id : productCategoriesToDelete) { CategoryRestUtils.deleteCategory(id, productStrategistId, componentType); - } + }*/ // Categories delete - resource - componentType = BaseRestUtils.RESOURCE_COMPONENT_TYPE; + String componentType = BaseRestUtils.RESOURCE_COMPONENT_TYPE; for (ImmutablePair<String, String> pair : resourceSubsToDelete) { CategoryRestUtils.deleteSubCategory(pair.getRight(), pair.getLeft(), adminId, componentType); } @@ -33,8 +33,8 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; -import java.util.function.Function; import java.util.Set; +import java.util.function.Function; import java.util.stream.Collectors; import org.apache.commons.lang3.tuple.ImmutablePair; @@ -46,7 +46,7 @@ import org.openecomp.sdc.be.model.CapabilityDefinition; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.Product; -import org.openecomp.sdc.be.model.RequirementAndRelationshipPair; +import org.openecomp.sdc.be.model.RelationshipInfo; import org.openecomp.sdc.be.model.RequirementCapabilityRelDef; import org.openecomp.sdc.be.model.RequirementDefinition; import org.openecomp.sdc.be.model.Resource; @@ -641,7 +641,7 @@ public class ComponentInstanceBaseTest extends ComponentBaseTest { private void deleteAssociatedFromExpected(RequirementCapabilityRelDef requirementDef) { // removing from requirements - RequirementAndRelationshipPair relationship = requirementDef.getRelationships().get(0); + RelationshipInfo relationship = requirementDef.getRelationships().get(0).getRelation(); String type = relationship.getRelationship().getType(); String fromId = requirementDef.getFromNode(); List<RequirementDefinition> reqList = expectedContainerRequirements.get(type); @@ -729,7 +729,7 @@ public class ComponentInstanceBaseTest extends ComponentBaseTest { private void addDissociatedToExpected(RequirementCapabilityRelDef requirementDef) { // adding to requirements - RequirementAndRelationshipPair relationship = requirementDef.getRelationships().get(0); + RelationshipInfo relationship = requirementDef.getRelationships().get(0).getRelation(); String type = relationship.getRelationship().getType(); String fromId = requirementDef.getFromNode(); Map<String, List<RequirementDefinition>> map = removedRequirements.get(fromId); @@ -20,19 +20,19 @@ package org.openecomp.sdc.ci.tests.api; -import com.aventstack.extentreports.ExtentReports; -import com.aventstack.extentreports.reporter.ExtentHtmlReporter; -import com.aventstack.extentreports.reporter.ExtentXReporter; -import com.aventstack.extentreports.reporter.configuration.Protocol; -import com.aventstack.extentreports.reporter.configuration.Theme; -import org.openecomp.sdc.ci.tests.config.Config; +import java.io.File; +import org.openecomp.sdc.ci.tests.config.Config; import org.openecomp.sdc.ci.tests.utils.Utils; import org.openecomp.sdc.ci.tests.utils.general.FileHandling; import org.openecomp.sdc.ci.tests.utils.rest.AutomationUtils; import org.testng.ITestContext; -import java.io.File; +import com.aventstack.extentreports.ExtentReports; +import com.aventstack.extentreports.reporter.ExtentHtmlReporter; +import com.aventstack.extentreports.reporter.ExtentXReporter; +import com.aventstack.extentreports.reporter.configuration.Protocol; +import com.aventstack.extentreports.reporter.configuration.Theme; public class ExtentManager { @@ -40,7 +40,12 @@ public class ExtentManager { private static ExtentReports extent; private static ExtentHtmlReporter htmlReporter; private static ExtentXReporter extentxReporter; - + private static final String icon = "$(document).ready(function() {" +"\n"+ + "$('.brand-logo').html('').prepend(\"<span><img src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQ4AAAB7CAYAAACFKW5jAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABmJLR0QAAAAAAAD5Q7t/AAAACXBIWXMAAABaAAAAWgBwI7h9AAAAB3RJTUUH3wwXFAQf1clFIAAANNxJREFUeNrtnXeYXVXV/z+n3To101ImvZFGQiCANKUoSBEFebEj1hcb2MWC+lpAbGD5CaKoiL2ggIgoRUIgQAohJCG9TTLJ9Dszt52y9++PfSeZTO6duXfmTkk4n+eZJ5Nbztn7zNnrrL32Wt8NPj4+Pj4+Pj4+Pj4+Pj4+Pj4+Pj4+Pj4+PgOjjXYDhpX7WgkZMD2qY2qQFtDlSkSvjlsaGJpGUIeQAS1pyb60hMurRrv1Pj5jFnO0G1As9PvbmBiEDkeS8CSmpuEhCOi6FTW0sAYhiTRNTTM8JBoaGmDpSEODoK65EQM7YpLCCCVC97ciAUODuSU6UpO88Jpxo91NH58xwTHtcSx6vJ2DKUlTSlBVVqKVesnqlrSosaWcFTa0eXFX1nmSmrChjTc1qoCIKwlJ1W8NkDoITUPokAQ6U0I2uYL9FZZ+UNfYnvDkhoWlRnNdhIMP7HWcsqDOonKDsK7znzPLRvsS+PiMCsec4VjwWDvNaUFTh8eS8VbFvpSc4Qh5esJjKbBASDnDlZTqGmEpQQ7yPLoGSGxdIx4xtEZbyhdrA/pGIVk+ParveEt9qOH69d3i1AqTcbg8eE71aF8aH58RY8wbjresjbGiCTzpsb/JYUF9oKwpJZekhLzQkfJMIVnkCMoBY7BGIl90DQyNeEjXdhsaz4UN7V9TwvozK88p31Pzzza5uNykOqDzh2Wlo33ZfHyGlTFrOC58opMGT9DuCG6YGdG/ty0xxxby4pTgEkfKpa6gYrgNRX9ogKHhBHVta4WlPR4xtPtmRPXn/7U73XlGfYCoAf8+o2K0L6OPz7AwJg3H/Mc6aEoLFpUawe0J79RuV76525WXuYLpYrQblwUNCOh0Rk3tuQpL/119WHv4yS3O/lNnBji53OQnS6Kj3UQfn6IypgzHOcvb2ZWQnFRpWavbnDM6XfmelJCXOIKq0fQuCsHScKOmtqbE1H41K2r89Yl9qQPvmh3hnqX+9MXn+GHMGI4TH+vgX2eEtLOXJ09sscUHEx5XOUJWHysGoy+mhltmas9OCOl3/E998O9rO9yub82PMLf0uFkB93kFM+qG44HGNF/dnCSoU7s9Lt4bc+UHUp6cdqwajL6EdS01OaI/eOY469t3nxR9PuFJGTX10W6Wj8+QGFXDIaUE0M5d0XnW+k73pg5HnutJjNG+KMVG12Ba2NjzwWnB2z89O/xLDdoANG3U7baPz6AYlUeflLLHaES++nLius1d3m/bbHnB8Wg0AISEnXFvyv0H7Fu2x727gaU918HH51hkxA1Hr8EyrdkW31vZ7n67MSXqj/chJDXY3O1Zrba8HPgN8DYg2MuI+vgcM4yo4eg1QM4B7m1Kyw++2OlFRvsijEznoTaoMyGkA5wA/AT4IlDR59r4+Ix5Rsxw/L4hBWAAbwF+AZz5SprhmzpcPSnIpNChS14GfBa4HZjSYgu+uTkx2s308cmLETEc5yzvoMrSw2khrwN+AMwAmBrROXPc8b88qQNXTQxy3bQgxpHW0gLeCdxZFdAXfn5jguWtzmg318dnQIbdcLz26U7Chla+KuZ+xRbcAtT0vBc1NL4wJ8yp48zBV6ONZSSUmxrXzwzx/UURaoJZL7cGXPTPg/Yvrq4PvursPzT50xafMc+wGo4LVnRQH9LKG5LiyxNC+g0lpnZU7vXicpO7TyrhqkkBwoZ2fBgQCRFD47xai7uXlnDz/Ah1wf4v9ZOt7ikr2pw73v+qstO1n+z3jYfPmGbYwgyvf6aTqREt+uAB58uTw/rH/rSsNNhrfn8Una7kvkabn+5KsabDJeUNdwuLTGacjwtonFppcs3kIBfWBai0Bu5AhyO58rkuHm92mFFirHltrfXedTH3hWfOqRjtXvn4ZGVYhuWtWxK80CmsZ9rsT+9JiC9+bGYo/J2F0bzcm4NpwWPNDvc12qxsd9mXEoieyraxZER6OQSllsacEoPzqi0uGW+xtNyk1MyvsRL4xZ40H30xTsKT6BrMiBj/vaQu8J7tCXfHg6eXj3ZPfXyOouhD8SMvdHLj3BL99c90XrM17t2edGXpdxZG+OSscEHHSQvJ1m7Bs+0uT7Q4rIm57E4IEp7kCC9+JIxJn/OFdI1JYZ1ZUZ1lFSbnVFssLjOoCeoFN+fxFof3v9DN9m5xqC+mBnNLjL9cNSn4walhvfXaqaER6KSPT/4UdUlDSon221bWd3WdtyfpfS3pSVUSOojBHdQ1FpYZLCwzuGZKkH0pwY64x/pOj7Uxl21xwYGUoDktSAiJK6CYYQFNU0uoYV2jOqgxKaQzM2qwoFT9zIoa1Id1FZcZJI81O1y/Pn6E0QBwJWxPiDf+p9nZ8+mZoS883+4ml1Ue/6tPPscORX1ev3ZFDFfI2eu7vN+12PJkACR8dk6Ym+dHinYyiYoLtNmCVluyJynYkxQcTAmaMq/FHElaSBwJXsagmErBK/OvRkCHgK5haRDQIWRolJka5abGuIDG1IjBlLBOVUCjOqBTbmlF6UNaSP683+amTUl2xL2cf4VKS+u+bHzg479aWvJzQPq1LT5jhaLdiQ812fx2T7r0v63OHftT4m09gxUJ59da/PXUUsrynPcPlZQnSQpwhcRD1YqAKjbTAV3T0FEehaH1/CgDMtzsSgh+uCPJz3eniTmy37+ABiwsM3Z+aW7kf66aGFjlGw6fsULR/N/X11jaFzcm3tmUFld6fWICz7e7PN7icPn4wIh0KmRohIzMyccIHY7k/gM2P9ihVo1kHs2TwM6EmL4z7n0RuFZK2e4bD5+xQFHyOKSUfH5jYv7BlPh4WhDs+36nI7llS5It3d5gDn9ME3PUtOStq7r433VxVre7BaWqdDuS3UlxkSO4llGqZvbx6UuxbsRQxNA+1u7IWVnf1WBlu8snNyTYmxyLqqHF50Ba8Ku9af5nVRfXrOnm4YMOSU8OygnalxLBtJAfBZb4iWE+Y4EhT1UyN/IFC8uM/xnolv7HAZuPAN9eEGFOyfEnvZEW8HKXy0NNDvftt1nX6WJ7HN7+aZBICbrGNOB64DopZcKfsviMJkMyHBmjUQVcf3qlWbGk3OCZVjfnIJHA/QdsmtKCr5wQ4fwaixGKlw4bnoQ9ScEzbQ4PHHBY3uqwLyVUZ4doMHqYEtYJ6RrAG4G/PN5s3z/a/fZ5ZTOk2zpjON4P/BAIPnDA5n0vxGlKif6PLKEmpPOeKUHeOzXI7Oix5X2khVoCXtPh8Z9mm+WtLjsSHk6Pd1FEgrrGL5eW8JZJKrAsJI90OOLqXzekO26Y+cqQMvEZewz6Ns8YjQnAfcBpoJ6+9+xNc+PGBAcHMh4ZTigxuHpSgCsmBplXYmCNwfCfI6HdFmzu9lgT81je6rA25tGQ9NRUZEhXsh8kLKs0+ftppT0CQOxLitSdu1Mf+sbWxC/EG2qGeAIfn8ExVMPxQZS+xqF1Vk/CAwdsvrgpwYZOb+AzZFz6yWGdc6stLqixOL3SHHJW5mAREuKepM2WbI17bOzyeCHmsibmsjchaHN6bUg7zM0L6Ro/PjHKtVODh061Nuby4RfjK84cZ17+7QXRVj/W4TMaDCrGkTEa1cDb6WU0QCVTvXFCgFlRg1u2Jrmv0Sbh9rOakHl9b0Jwz540v9+XZmJI56Ryk6UVJovKDE4oMai0NEpMjUiRjIktIOFJ4p6kOS3ZnfTYHvfY1i3YFvfYnvBoSUs63SyGYgTGqga8tT7AVZMCR5zuYFqytds7pdLSzr9xY+KPw98SnwLp+XMd18tfgxoCpz3Zwcqzy98M3APkrF7rdiV/O2Dz4x0pVnW4uCLPM/a65BFTo9zSmBDUmRLRmRDUqQ3q1AY1qgIapaZOqan0L/Q+9R62kKQ96HKVAYi5klZb0pxWaelNaUFDStBqC5KeMiSMdAFdDi6tC/DjxVGmhI+cu31ra5IvbExwQqnxt1sXRt92SV0gOXqt9EEJUy0CFgNTgCjqzkkCDcALmZ+m0W5oMSnY45BS8udGO5ry5NUhQ+u35LXE1HhHfZDzqi3+2mhz7940L8Rc0gMFEXu9l/AkCU/SmBSs6Tj8uqEfrjnpSSXv7bXLjA0QEjzAkxJPcrhEP8f5RjXZVIKlw5snBbl5XuQoo9HpSh5rcfAkHEzLs//YkF4spFypj73pylnANeTOE4qjAupbBzjOFcAlo9D+DuA2YG8/n5kEvBV4MzAfKCH73dMNbAR+B/yW/AxIFfAZlFc/0vwX5RD0S8GG4/vbkzzR6i4bH9Bee1aVldd3JoZ0PjI9xJsnBHik2eEP+2yebXdoTWce7/nc930+4x0qXivQIxxzYyyDhPEhnQ/PCPGh6SHGZSmc+W+Lw8o2tdzd4YhxOxPiMg1WjnbT+2AC1wLvGeBzu4DvDfCZU/M4znDQDPya7IZDQ6n0fw04k4GTKEsy/VgKXAx8HliVx3feBtSPQt8FeRiOgtcw6sO6tqXLu+jZdrdghZnxIZ13TQ7yh1NK+PtpZXx+bpjTxvUSvTmuZ4U5kFBmalw1KcDvl5Vw4+xwVqPRlBb8YEeKTkddJE+i7Ut5F/xkZ2qsLa1MQw2sgbgYGGgn7tGqUXDIfTe+Dvg5cDaFjR8TeC1wF5kNuQbAHaW+53XNC/Y4VnV445psce7L3R5CZTQWTImpceY4kzPHmdwwQ/Bip8cTLQ6rOlw2dnkcSIvDy5wwdr2EwZJZSaoL6rym2uTt9UHOrbYoyZENlxZw+44UT7Q4h66FBNpsuWBlu7tESvnvMbS68mpgah6fOwkVF3hqtBtcADOAbwIzh3CMJShv5RqgZbQ7NFgKMhxSSi5d2XWiLZi3ocuj3ZFUBYZ2w9YEdc6v0Tm/xiLuSfYkBC/EXFbHPF7qVII9TWml/OX1jU+MmbEy0IU7/GvU1JhbYvC6WovLJwRYUm70ZIVmxZFw1+4UP9qRwu3zDOz2ZKTZFucD/x7tLmaIoDyJfOaw44CLgBUcG76mAbwbNfD7w830p79rcAFwGWp/oWOSgj2Odke8KunJ0p78hvNr8otz5EPU0JhXajCv1OCt9Wo1pNVWS6Uvd3lsjwt2Jz12JQSNKUG3K0l6kBIy96030salTztChlr9mVdqsKzC5Owqi5MqDMYHB/Zy0wLu3JXiKy8n1BSlT19cgbY/KZa91OWVA7ER7mk25gJnFPD516HygMbaikO2u6YOuJzc05O9wN+A9aipzhzgysy/fQmgAr9/AHLtwjVaj8W8zluQ4eh2ZUBDe5WUELMlv99nc1aVRR5jYFCUmhqlpsa0iM6rM4HYlJDEXYi5ksaUoCEp2J8SHEyrn6a04GBaJXAlPUlSqFUZZ5hny4aupmAlhkZtUGdmVGdeqcGiMpOFpQaTwnpBQkZtjuS27Ulu256iK4fgj1QrRgufb3enoG7Y0URDGYLaAr6zABU4fDDH+w65B1Y2LLI/6QWQJj/Ppmcpta9/Ox8Vv8lGM/BR4IE+3/s3Ksg6Kct3FqKCn1uyvCcz/U7m2WYdCJJ90DuZn3zQADufDxZkODQYb2rMEJn//L0xzVsmBYrqdQxESNcIBaAqoDEjcqTFcgTYUmILiLuSFlvSYgtabEGbncnhyEgLdjoqt6PLzUgMCnCkxJXZtUsNDayMzGDE0KiwlCcxIaQzMaQf+ndSSOWZRA3lbQyG9Z0e/7c5wd8bbZyeYrkcpDwqyi1toZRy/SjHOcpRU49sj5Fu1I3d90aJoJZb/0n2oNwfgLV5nl+ilkffkuW9PcD/AW15HiuV+U5vJpM7mPtQ5qevsfkvagn201m+U0luw9GCqoTOtxipFvgy2Q3Ub1CeUD5owM58PliQ4Qga2vSpEX0KLeoUzWnJzVuTzC81DtVSjCaWDhYaUQMqLY36MKip6WGEVMlhQspMfgekPUlKQNKTpAXILEY+oGvKaBlKwNjSD8sNDiZAnI1OV4n+fHdbko35pOsDZaYWmBU1lgC/Z3RjBUtRAc++eMAvUUHTRVnePxeVOJXtht2U+cmXE3O83okyTgeG0L8w2f8iHvAI2Z/qAvgPyhvpK1UfILdhSFBY3Koe+DjZDccG4O9D6HdW8jYcmTTzBadVmtF796bp8TqeaHb45pYkN8+P5FwVGEvoGqh4bq+2jnK7XQkr2xxu25HioQOFCf5MDutMi+jzUDdhfJS6oKO8jWxL9C3Ar1BP8WyGYwZqaTOvJ90Q2jdU7Zl0jtcFcLCf7+WaJLvkOS3Is3+5GBZ5/ELdhPkX1lra3FLj0LPNA362O8XXtyTpco+F4PjYQUhY3eHy0RfjXPV8N3/ZZ5MU+RsNTYMl5QZlpjYDKBvFrtShchSysQp4CfXEzxbAtVDTlWJsHpPrBtQZerAxRvaBbgCz+vnePDhaThM1fWsuQp9BGa/++l50CjloGJg5I2rw3inBI8rfU0JllH755YSqHvXpF1eqKtcbNyZ403Nd3LEzxYF0fjIEvSm3tJ74Uh2FBSWLzRmoFZW+COBfKG9jTeYnG2cCs4vQjly6lMWQVNpDdsOno+IqdVneOxGV+Zrt3Ps4Oo4yWCRj2HBUAHUa8O4pIS6sDRzRVFvAj3akuO6F7lekKHE+JDzJ8laHD63r5rKVXdy6LcneROEGAwAJZ42zWFJugjLqkwZxlGLQ4zFkq1tqRAUIQQ26B8nuuo9H5TYMlVyGoxgex2ZUvCAbZwEf43CluI6K3fyM7HEfULGPjiL0GTJlWf30vegUctByMkU3VQGNr84Ls7DMOMJ4OBL+uN/mHau7efCAjfPK0CUekIak4J69ad62ups3PdfFXbvS7OsRbR7k7Rw2Nd45OUipqZEWMrSy3c0nW3M4mIYKfGbjOQ6vGkhUEHF/ls8ZqBjJUKdbw+lxdAJ/JHsQ1AQ+hMrbqEMVqN0DLMtxrPWoZdpiPWFHfKpSSOCkDLWEBMDScpPvLYpy3bo427uPXAF4vt3l3Wu6efvkIB+eHjouhYkHIuZIVnW4/KvJ4ZEmh03dxREuBkDC62stLqpTq5vb48K4ZWuyLiEkkWIt8eTPa1CrIn3xgIdR05QetgJPonRc+nIKKni6YghtGU6PQ6LU7q4mu6GsAG5GTUFOJffY2g18FlUxWyxGfKpSiOGooM86/GtrLH6wKMr16+Ns6208NGh1JD/YkeLRZof3TA1x9aQAk8bAku1wEvckW7o9Hm12+GeTw+oOl5jdqwK4GGNawpSIzqdmhQ8llD3V6vBsmzsupDaoG0k/LwxcSvb7qAFY3ue1NCpJ6kqODoZWoryOpxn8snJ/+cPFuPoHgFuAE8ge05hK/3U661FG4+EitKVvv8es4ajM1oiL6ywiRpRPvpRgTcfRCucbOj0+syHO7xrSvL0+yOUTLKZHjh8PpMuVbO72+G+Ly2MtNms6PA6mhUoiK9bt2ouoqfG52WFOy2xCnfQkDx100DRqV7d7AY58wg83C8jozWZhJbA9y+tPoeIFi/u83pN5+gMGv9ownB5HD0+jvIW6Ar7johLEvgS8WKR29O33mDUc0VyNeE21xT0nl/ClTQkeOGAfWYylqSSrVe1Kt/Onuw3eNCHApXUBFpUZx0TuR2+UiI5gQ5fHilaHFW0uL3Z6NPc2FjAslQaWBh+eEeLdU4KHks7WxjxWtLlEDMpXxdyR3tL+tWRfzXFRy6/Zli8bUSstJ2a5SvNRbv4/Btme4Yxx9PAqVLp4vhwEfgz8P6C1SG3oy9j1OJrSIloTzK01taDU4K4lJdyxK8WPd6Ro7Ktyrqm8hU2dHpu6kvx0V4qlFSavrw1w5jiTuaXGiG1KXQieVBmd2+IeL8Y8VrSpKciOhCqyY5iNRQ+WBh+YFuLG2eFDIs4pIbl7T4qWtGBaVA82pcVIzgUrUZWw2Xq9m9yxCoFaXXk/vWJmGUqA16MMy2D0KIbT4wijYjM3ouQC82U5SrCov+S8bHUmWqY/NgNP3cau4bi3IV37jvqgXttPRVtVQLnRZ44zuX1HikeanKOFijO/t9iSRw6qwGFtUOeEEoNXjTM5rdJkYZnBhKB+lI7ocONJNRjbbMmOuMembo+1MY91MZedCXHYq+jVj2GvYZQQNuBDM0J8cU6Eil4iP/886PCX/XZPM4wRaE1vlpI7xXsFynjkYh3wPGpq0pfzUEvL/X2/n6uVlaF6HJUog/EhlOddCK8D3gXcSXbDthRVZ1KSpc0vomIiafpnIMOhUeRyhLwNx0MHHX121OCyAXacNzQ1dVlaYfLgAZuf7U7zTJtLKlsadeb/TWlBU0rwZItDyNAYH9KYHjFYVGYwt8RgWkRnWsSgKqDqRYIGBLTBGZWeQri0p4KZB9OCPQnBrqRge9xjc7fHnoQqjGvPthXCSA5NCXUhnU/NCnHd9BDRXkVz2+IeX9+SpMOWPdNBGfdGLPlOR+VuZFs+TaOCf/1VZHaigqQXcPQTsScFfTCGo2eu3/evNBSPoxK1WvJeBpe+XYaKbexGxTl6EwA+ALwhx3e3kp/nJRjhPI68L8TBtLAfOODw+rpAXqUdZabG2+qDXFgb4OEmJVT8dJt7SPoulxFJCcmuuGRXXPB4s1K8KsmU15ebGnUhnbqgRpWlUxXQKLNUKXuJqR3RLg9whTpetyuJe9DhqCrZNlsZjGZbEHeh25Mk+6bLj4ah6CGjrPaqKpMvzInwulqL3oW2bbbkpk1J1vYKRnsS1xUjVuQ2ETg/x3s7UQHEgfgPKnNyWp/Xgyij9CcGftL2JZfhGKzHEUZ5Gv0ZjRZUwPfUzHXJxgTUakwjR1b7LiC30WhGCRznk+sxdqcqpkb838223NAV1BaX5W94qwIab68Pctn4AM+0udzXaPNYi8OuuHc4QSyHEemh25V0O5JG4OWuo6+jnlE813p9USJ79CoQ/V3W0TQQfcm0cWpU592Tg7xvWoj6PkvYcU/yrW1J/rw/fUSXBHRPCGkjpVOZK8Uc4AnyS6XeDDxGdjHiM1H1HxvyOE5vih3jeBNwHbnHyUvAF1BG8ApULCNX/GMR8K1Mfxsyr12Eyprti4fSNc3HAMNYNhwBXduzJ+m59+61rYXzTQqVmigzNS6stTi/xmJvUvB4i8M/Dtisjrk0JMVhWcABNm7KhpBgD6R4PhYMQy4yzR4f0nnDhAD/Oy3I4jLzqKlYypN8d1uKH25P0bckKOnJfcsqzZFYig2gcjeyFW45KKOxkPz28NuMcsX73oeTULGOQg1HrgE0GI9jMvAJjo499LAWZVSezfz/d6j4x80cHfTt4Xzgq6gS+HJUPku2dq1AbR+Rb/Xs2F2OnR4x9u+IC/c3DWnryokBTq8c3MqfqcH0iM70KUHeXh9kR1ztxfpYi8MLMY/dCXGkFOBYHvBDJeNUT4noXFwX4JopQU4uN7Pun9vlSm7ZmuT27SlVQdsLS4fqgN68LuaORPLXdFQMIhsmKt36E3key6SvYIqiJ4byC1QVab7kGkCD8Tgu5+hckx52ATdw2GiA8hLuRhmPr5Ld4OjAO1Bp92Vk1y9NAneQPTU/F2M3OPrxmaFYY0p0PdnihL+7LcnPTyoZ8vJpUOeQxui1U0M0JAWbulye7/BY1eGyucujISWUPsXxYkgyxqLM1FhcbnJxncWldQHmlRo5vbiDacHXNif52e4U6SymIaRr4txqs/VjM8JcP/w9OI/c+31oqAzjYnAyyr1/poDvFCuPowS11JxtfLiovIzlWd5zUPkapcDnyC4VEOCwIlg2o7kJeLzAazV2pyqnVZqxyycEmp9td2ofPODw891pPjYjVPCUJRdWjycSCXBxnRLqbUh6bI0L1sVcNnR57Ih77E4q6b+UJ4+W+BuLRiXTRkOHSktnQanB2VUm59VYLC4zGTeASvyGLo8vbkrwQKOdPUomoT6kpy4dH9g1AtKB/Q2oYlMNXEjhhiOXx1EItSgdjWw0oVZHcg3UFPAdlOdxPX32Vs4QzPHdNCq2Uah489idqgAdb54YaL6/0ea/zQ63bk0yp0TnkrpAAYfIn6AOM6MGM6MGF9VaCAntjtIM3ZUQbOry2JXwaEwJ9qWUYHGrrfRD7VyXcTjHVZ/zBQyosHRmZ0SLT64wWVZhMiOqNtAeCEfAPw7afOXlBOtiuWUEdQ1eV2slLqix9g540KEzn9wp5sPBhcCPyH//kWLlcZSTO07RRP+KX6CSvb6BUmX7IPmPs3+gYiWFTjlHvKy+EMPRNSWs7/7YzBBrYy4HUoLPbEgwztJ51bjhfwDpmlqhqQqo3esvqlX1drZQmZ2drlI835sUHEgppfOmzJJrU1qJFic9JUjsCCWm4wglTlzw7C+zV62pKy3SoK4EjCeGdKZFdGZGDeaXGiwoNZkc1hkX0Aq6a3cmPH68M8Uvdqdps/tRBJMwOapz9aRgU8TQBrqZh4qGGsgjuZ/pIlTVbL5FYcWKcVj0e9XzIsbhxK53MvAAPgB8F2gf5LUaiTqdQxQy4iWw+ZI6i/dPC/H9jKDuR9fHuWNxlFMqRrpMQhHQoTqgUR0wmNGneM6VaiUiJSQpT+VrxDLq5j0q5zFHbZ9gS4ntKU0RL4vMuaFphA2lsh42lGhxmalRFdAZZ2lUB3XKTY0SE4KDTHeNOUqs+Ec7k6yLeeoO7edQmgZXTwxySoW5A5VUNZz0bKCUrUVp8pfgz9oV1NO577GjqCDpI+T3FO7P1yzkj5Ikd/5EBdlFi7LRisr8DKFWUPobJLsYeBPugfqejdH1ODRNQ0r5UlDX7E/NDAU2dXk8dMBmdbvL/66Lc9vCKGdVjY7xyNm5TPJYyZgMfhwm7kmebHH4ya40/25ysmfZ9kXCnFKDa5WM4yYK239kMJxC9uIuG7Ut4vMM/skWROVDnJzlvXNRwdh8ckP6C44WMoC6Uepc2aYrFaiktYY8j3UQ+CkqqNxfjcti4COo5dzBLKuPTcORYSvQOD6kT/32gggxR7Ci1WV1u8t71nbztXkRrpyYX2apj0pse7zF4Zd70jza4ijtjjyfjRFT45OzQswtNWzgBYZ3awQDVXyWLcV8F0rFfDAp4r05EVW30bf3s1HSfL/N4xjFyuNoz/Rnepb3ylGJYc+RX57FKcBXgKoBPhdGLWN3A7dRuAc3ZqUDQVnZ7QDzSw1uXxTl5Ew+x9Zujw+t6+abW5JqXu6Tk/0pwa8zUoLvXN3NX/fbxJw8vIwMGvCW+gBvqw8CtKcFw70Z00Rya4I+g1K9GipPkn26FUBNV4J5HKNYqwud5N4ISkeloL+H/h+8Zqbdd5P/zvYlwOdRe9QWIlozpjVHQVnDQ8tjJ1eY3LWkhFdXW6CpGoqvb05wzdpunm5zEb79OETCkzzX7vLVlxNc9mwX73uhmwcabWJu/gYDAKmKCL80J0JY13iyxdl/w/p4sWT2c3EW2Xdod1Dp1sVIdV8PvFzg+fvSXxykkHtdoAKyXTneL0dNzz6BynLtPciDqCnXt1EJbIsojArg68BVFHZnjNngaA9PoebTEYCTyg3uOinKjRszWxYKeLDR5oWYy3unBHn3lBDTIsNi9MY8CU+yMyF4qtXhHwcdnm13aVJbxQ0uCVrCSRUm310YYVpEZ1WHy81bk+v+tTmV73LlYOh54mdLZtrDkdmTQ6EN5XVkW+7tSUEfSKezv+BooTfhSlQtzeU53q8EvobKBH0eZfQqUbKCp5G74I1MG7ei0tqzBVprgVtRD+oHyY+xG+PIBEjXoZSrl/S8PjtqcOfiEuaVJPnRzhQdtqQhobId/9po8+4pQa6aGGRy+Pg3IDFHif482ery72aHlzpd9qcytThDKaiTsLDc4EcnRjmp3KQ5Lbh5S9Le0OU9EqwLuIWWkRbATNQTPxvPoWIcxUCgMiav4+h07Z4Yy6/I7QX0HCMXhd58ncD3UTGKXFtPBFAeRaFexUvA+1Cxkk+QPUlscub8CZQBy+f6FaPfeTEYj+Mgaq+MJb1frApo3DQ3wsIyg1u3plgTU1OV9TGPz25IcO9emysnBrhsfIB5JUbWeoxjkbgn2Z8UrImpNPnn2l1e7vaOFv0ZirMo4eRKk9sWRjljnIkj4Ac7UjzR6uycV2o83XB2xXB2MVeKuYfa33Qoy7B9WQtsI3sNx6moMvSV/V+pomZQLkd5FbdQvFT6nagVpOdQRX4VKDW0bDGNWcDtqJjKcwP0e8wbjp7dud5LnyeDpcPVk4KcXGFy2/YUv21I026rJKu1HS5rYy4/3ZXi3BqLi2pVoVx9WD+mVmE6XaXlsbHTY3XMZW2Hx0tdLo0pSbq3kE6RVC414Nwai+8sjHBSuYmQ8Mu9aX60M0W5pT16UXVw71D2ExiAKKoSNttNvZfC0sHzoRk1FV6S5b1xKDWtZ8ltHIo5Vek53t2ZY97E0Da9kqjB/3kO16LEUCI/JcDbcrRxIapS9n2oOFB/bc3G2DAcmenKs6inQ9YqyVlRg+8ujHJxXYAf7kjyeItDOpNOsych+NXuNL9vsJkW0TljnKrbOKXCZEpYyQWOFWwBLbbKSN3QpSQEN3UrlbCmdB/xn2IrmksIGWrTpS/ODTMlrKuNPRptbtqUICXoPiGk/21n0hvOitglwOk53lsN7Cjy+TyUW/4Bjnbfeypmf0JuFXRJdiNnUNgqRW8c4C7U9PwzqH1k8k0A62E/aoOmn3L05totqIK4EuCNOb5/Kqqw7v0oL6UQ+suCHTSDzdhq73bl/WFDO9PQslu0oK62Tji90uS+Rpu796RY1XF4U6K0kGzu8tjc5XFvQ5rxQZ0Ty0xOrTQ5vdJkdonB+KB2SJh3OJFApyNpslW6+ta4qoXZFvfYmRDsSXh0uZIjitaHYeuD3g2aEVV7p7xzcpASU0MCf2+0+eRLcQ6kBOND+qolZdbzdywpVAKzIKaSe6XjTxRvt/XePIcKCGYLLnZlXs9lONpQXlCkz+tphpZZK1ECRS+i0u6vQsU+xtNnr6FeJFCKX4+jCteeJ3c26j7gk6iM1Z7ckd5ygE6mDZeg8kv6JohJVFVttmncywxDjs+gbn0pJbdsSS4+s8p86Kwqa2I+BzmYFjx00OHXe9M81+4S73la9/5yZrUhYmhMDuvMiOrMLzWYX2oyI6JTG9SpDmiUWxpmRnN0oHMLUEpgUq1yxBxJW0ZCsCEl2BH32BEX7EkKGlKCgymlB+L1NRIjgVSJXZeNt/jkrDDLMmn8noQ/7U/z6ZcSNCQFloE3t8T4yEuNyTt4+8QhnrRfguQeGP2lZQ8FDbWCk8tDSJF7+dfIfLfvX0xmvles9oZQ8Yc5KI3U8ahSeoHyIPagPIvdqOBxvnGg3tfbI/v0I5fqeYjcMgBFF3ga9JCI3t8SvGJS8Ccfnxm69qTy/B2XNlvydJvDn/crCcF9SaHyPbL9qXsaqamNiKosjXEBncqARnVAoyagU2YqvdHenokjJEkhibtk6lFU5WwsU6PS4ajfU57kKOGwUdIYNXU4rdLkuukhLh8fOLTfTMKT3Lkrzc1bEjSnVc5HpaWtP63SvOT2RaV755YeJ1HmY5+eO+cVkb00+GFy135OnxM5a0bU+MvXTgjXzogWNoV0BGzu9ni0xeGxZofnO1TF7VHbD/RmIN3QfD47tF4XF6nK70+uMHlHfZArJwao67X9xL6U4Ftbk/xsd1rFUzSwdLy5UeNzvz+57DsLK46fHfF8ji2GNITu3Jm07tmb/t7EkP6R7y6MDjpPI+FJNnV5PN7i8Eyby+qYy/6kyC1mfCyTMWhllsaZ40yumhTk4jrrCIMhJDze4vDVzUlWtDpH+KuTQvraC2oCb6gL6g23LowUdm4fnyIxpCF5yTMxrpgYXHTXrtR99WF95m0Lo0waYpJX0pPsTgqebXd5ts1lVYfL9oSn6l+OVfnATLutjDjR+TUWl45XO9iV9lmLbkwJ7t6T5ic7U+xLHrkbXoWlpS+osT72p2WlPx0BtS8fn5wM+e6TUmq/3pv+1Pe2p745Oayb318YYWaB05ZcCAltjlp9WRVzWdXusr7TY19K0GqLI6UDx9I46tWusKkCvadVmpxfbXF2tcnU8NH6oklP8kizw/e2pVjR5hyZaYrSAXldrfXgh6eH3vly3O24fobvbfiMHkMebq6QGBoT/rjP/sPnNyXOnhTSuW2RSlYqNraAmCPYFld5FS9ktEj3JQVNtlAVpiNtTPqcL2JoTMgogZ1WqeQCl5SbTAzpBLI4Y46AZ9odfrorzT8O2od2ZuuNDlwxMdD8iZnht57x345HuaKQrUt9fIpPUYbWj3cm+dC00KV/3Gff8/GX4pXVAY1b5ke4sDYwrHu/isxer01pya6E2utV5V8I9ic9mjK7ttkiy+rJEK+anjES1QGNuqCSC1xYarC43GRuic6EUP/JbLaAtTGXe/am+ct+m4N9N+nOoANvmhjwbpwdvvXkCvPLgONPU3xGm6LcgVLNGQKe5Na/N9ofveGluJ7y4OMzQ7xvapCa4MgtGUrUU7zNOaw9ui8l2J3w2JPRI+12JUkBtpBZS/91DSxdI9Dzb0ZTtNzUqA4qQzElrDMprFMbUEai1NTyUnzvdiXPdbjcuzfNPw86HMhhMHr+OFdODPCNeZGn55QYb5GwV/eNhs8YoGh3YcZ4TJbwm4ebnLM/+VKcLV0e59ZYfGJmmPNrrKyu+kjSY1SSGR1SR2TPsOkRIrY0DUtXWzcE9PwSzrIhJOxNCh5tcfjrfptn2pz+RYhRm3e/tT7IN+ZFmqaE9WuE5GFjON03H58CKOqdmDEe5wG/Xt3hTvzcxgT/aXKoDGhcOTHA+6eGWFphHlNFbUOh2Zas7nB5+KDNv5sdtnZn9svtr/+Z7NEPTAvyhTlhpzqgfwP4hqaN2L6wPj4DMhyGQ0cVKX27ISlKbt2W5O7daeKOZGJE500TAry1PsjJFQah4+wJKiQ02YJ1MY8nWx0ebXbY2OXR5WRJr896AWFCSOezc8J8YGqQsKH9Fvgo0ObHNXzGEkW/GzPGI4ySP7s+5Unjj/ttvrMtyfqYKhWoCemcX23x5okBzqoyj0h+OtbodlUMZU2Hy1NtLk+3uWyPF2AsenFqpcn/nRDhtTUWmsYzmtqPY7tvNHzGGsNyR2aMRxVKhORtgLa52+OHO1L8fl+a1rQaVGFTY1GpwWtrLc6ttlhUZlA7xo1IzJEcSAu2dHs835HJLelSwj090gGFaoiWWRrvmBzkU7PCTIvo7E6IXZ2ueNeJZeZy32j4jEWG7a7MGI+pqJ23LwQ0W8CTrQ4/3ZXikSZH5V1kWlFqapxQYnBKhcmrxqnch0lhnUqrsF3QikmXq3aD259SZfYvdqrl3q1xj+bM/rWDzmaVavVmWaXJJ2aGuXyChY7GYy1O2+Mtzg3fumnXvfLP86VvOHzGIsNtOECVH98BnN/zQtyTPNXq8puGNI80OSqHoRemDjVBnRkRnRNKDRaXmcwtMRgf0qkNaoyzdEx96NJGErXbW7crabMFzbakISnYHle5IDsSHnsSgsa0IOX1KrUf6lWTMDWic+3UEO+ZorRYW23Jr/amuh466Hzu0fWpO9+9IOj9cnglAX18Bs2wPs56GY95KPmz83u/nxbwQszlj/tUTsO2hIfT293vcUgyy6FVmWSr2qDap7U6oFNhqbL6qKERMVS+RTCHupArJUlP5Xg0ppSR2J8StNhKn6PZFnS5Eq+vcmWxrpKE2pDOFRMCfGBa8FB27eoOl9t3pGKrO9ybtnaJn9RHDGfn6yqG80/j4zMkht0P7uN53A5cfNRngN0JwdNtDvc12qxoU9sIZH3C903Y0o78VdNU/kXfBRuJ2hPW65270c+xincBVJsmhnQuHR/gXZODLKswsXQVL/ndvjS/2JNubk6LL0wKa7+IpTV3/QUVw/K38PEpFiM2gc4YkCmo1Za3kkO2MOlJtsUFK1od/tXs8Hy7y8G0OCzbdyxM+TMGKWhozCs1eNOEAG8Yb7GgVBkMV8LTbQ7f357iuXZ32+SwfuMPFkf/+vEXu8XT51QO7dw+PiPAiA7DjPEYB3xWwHW6klvLSc+GRk+3uSxvdVjV4bI3oVLGR6cH/XVO/WPoMCmkc8Y4i8vGW7y62mJS6PDEaVOXx527Uvxxv40j5PMLy8xPPn5m2fIbXopz+6KSQZ7cx2dkGfFhJ6Uk4cnQupj3fk9y04Iyo7rSGrgZjlC6pes6XVa2uazucNkSFzSnBZ3u6FbFllqqIvbkCpNXV5mcXWUxI6ofSnCTqL11/7DP5t69afYkPbcupP9lbtS46ZGNiS3fObeCT80qVDjbx2f0GJXntSMk1p2N5gUnRi+dXWJ86dVV5tLzqq2CiuHinqTVlmzp9lgbUzodW7o9DqQELY5UYsi5dtjojwEqaDWl+UlNUGdOZvn41EqThaUGNUGd3l1IC8mLnR5/2mfzt0ab7XGPkKG1zIzqt79hQuD/PdbktN04O8QbJobw8TmWGDVH/9KVncyMaDzc5M60dD5bH9LfcnFdoPSiOouZEaPgcnxHqKlNY1qwOyHYm1QVsbuT6vd2R9Ltqp90piq2x0bomlraNTRVCRvQVVVsMFMVW2oqj2JmRJXPT4voTIsY1AS1o9LmJdCQFDzT5nL/ASXI3JgU6BqyOqivnB7Rv/G3ZSX//MLmpLj7pNLCOunjM0YY1QjBOU910pj0uKDGDD3a4l7W5crPVFraKa+psrh4vMXJFSodfSiN9KQqn+92JR0ZlfOUUEuzPQs+hga6pmFqaj+YoK6WdMO6UlcP6sqo5CrO8yQcSAtejHk83KSMxdZuoXZ206DE1JprgvrP5kb1Hz+8Pbnvo4tL+OGJfjzD59hl1EOLUkres6abX+xIcuXU0ORn2933tdry3YbGlDlRg7OqTM6qsjixzGBKWB+RDZoGQkg1VdqVEKyNufy3Ram0b48LEr32iwkbWrzS0v45Oaz/6OdLS5766Lq4d2qFxbd8kWGfY5zRH4UZ3vp8FwlP8rfTSrXTnoydtDsh3t9qiytcSa2lQ31IZ26JwbJKkxPLTKZHdCaHlYBOQM9PRGcwOEKpjLU5kt0Jj5e7PdbFPF6MuezOJJD1zjfRgJChpSstbfnUiH7XKZXmQw802t03zApz/fQQfgq5z/HAmLuLr9/QzQP7Hc6uMq2Vbe7p7Y54R6fDJSkhJ/UEJQIGjLN0qgIaUyMG0yNK43NCSCly1QQ1yjIGxeonNV2gJPxSQpL2VIxEbeCkpjX7kmqnt+0Jj8aUSkvvcGRWkWQdCBlavNzSnpoS1n89r9T4x1/22x1XTArwKz+W4XOcMeYMRw9nLu9gS7fHOyYHzYcOOItabXlFSshL00LOcwTBbKsflg5hQ+3qFtBV7MLsJzbhSBXr8DJbRLpCrYTYmbiI6CsPluU4GVnBhgpLe3xqxPjz7Kj+xIMHnM4zq0z+cmrZaF9GH59hYcwajh5e/VQH2+OChguf4pQnzpnQ5ohXdzjy9SmPM1wpp9oiy96mgxUlzvNqBFQA9WCJqa2psLR/zY7qj15dH9zy9c1Je3ZU5++nlflTEp/jmmPm7j5neSfNtkeXC5fWBaw1Mbu+xZanJ1zOTgq51BZM9aSsdYSamRRR0BxDBTq7TJ09tQF9o6nxxLSI8Vx9SN9457Z44uzxQWZGDX651J+S+LwyOGYMRw/jH9jH1LIoaaG2PvjdyaXGDRsSEUtjzr6kNytsaEsTnlzQbMvagMYENCpTHkFbSKOnv7n2t5YgLA0R0LUEcCBssH9CSN8LPDcxpG8aH9I3XjUx2HrpEx326yar2dIZ5QG+utDP+vR5ZXHMGY7enL68i1Jd0JiWVFoaqztc4peO47MbEta6Lq+kxNDqW21RtS3uhbtdWV1uaVODulZqaRi9Ku/TmqZ1t9ui5UBatpQYxKdFjXh9SG8I6TT+YVmpo922z3v96aWMD+lIqXFulck1U/1sT59XLse04ejLHTuSbOwSrIo5TI4YmEBTWvByt8fedhfWxeHmBmAb8CJQAcZ58I4aOKMcakyqQio7dGZER5OSoKlzTrXFtVN8Q+Hj4+Pj4+Pj4+Pj4+Pj4+Pj4+Pj4+Pj4+Pj4+Pj4+Pj4+Pj4+Pj4+Pj4+PzSuP/AzE1e5ONHe7vAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDE1LTEyLTIzVDIwOjA0OjMxKzAwOjAwHarZDQAAACV0RVh0ZGF0ZTptb2RpZnkAMjAxNS0xMi0yM1QyMDowNDozMSswMDowMGz3YbEAAABNdEVYdHNvZnR3YXJlAEltYWdlTWFnaWNrIDYuOS4yLTcgUTE2IHg4Nl82NCAyMDE1LTEyLTAyIGh0dHA6Ly93d3cuaW1hZ2VtYWdpY2sub3Jnbo4WPwAAAEp0RVh0c3ZnOmJhc2UtdXJpAGZpbGU6Ly8vdG1wL3ZpZ25ldHRlL2MxZDQ0ZGY2LWM1ZDYtNDkwMC04ZDBhLWQ0OWVmMzBiZGE3MS5zdmd90CehAAAAGHRFWHRUaHVtYjo6RG9jdW1lbnQ6OlBhZ2VzADGn/7svAAAAGHRFWHRUaHVtYjo6SW1hZ2U6OkhlaWdodAAyNjLFg9PDAAAAF3RFWHRUaHVtYjo6SW1hZ2U6OldpZHRoADU3Mz0hlMwAAAAZdEVYdFRodW1iOjpNaW1ldHlwZQBpbWFnZS9zdme/73BOAAAAF3RFWHRUaHVtYjo6TVRpbWUAMTQ1MDkwMTA3McPsyX0AAAAPdEVYdFRodW1iOjpTaXplADBCQpSiPuwAAABIdEVYdFRodW1iOjpVUkkAZmlsZTovLy90bXAvdmlnbmV0dGUvYzFkNDRkZjYtYzVkNi00OTAwLThkMGEtZDQ5ZWYzMGJkYTcxLnN2Z4N+SbEAAAAASUVORK5CYII=' style='display: block; margin-left: auto; margin-right: auto; margin-top: 7px; width: 89px;'/></span>\").width(\"120px\").css(\"float\",\"left\").css(\"padding-left\",\"0\");$('.report-name').css(\"font-weight\",\"bold\");"+"\n"+ +// "$('.logo-content' ).remove();"+"\n"+ +// "$('#slide-out li:first-child').on('click', function(){ $('#charts-row').hide() }) ; $('#slide-out li:last-child').on('click', function(){ $('#charts-row').show() });"+"\n"+ +// "$('.charts div:nth-child(2)').remove();"+"\n"+ + "})"; public enum suiteNameXml { @@ -145,7 +150,7 @@ public class ExtentManager { // htmlReporter.config().setReportName(AutomationUtils.getATTVersion()); htmlReporter.config().setReportName("SDC Automation Report"); htmlReporter.config().setChartVisibilityOnOpen(false); -// htmlReporter.config().setJS(icon); + htmlReporter.config().setJS(icon); return htmlReporter; } @@ -20,25 +20,26 @@ package org.openecomp.sdc.ci.tests.api; +import java.io.File; + import com.aventstack.extentreports.ExtentTest; -import com.aventstack.extentreports.MediaEntityBuilder; import com.aventstack.extentreports.Status; import com.aventstack.extentreports.markuputils.ExtentColor; import com.aventstack.extentreports.markuputils.Markup; import com.aventstack.extentreports.markuputils.MarkupHelper; -import java.io.File; - public class ExtentTestActions { + public static SomeInterface testManager = new ExtentTestManager(); + public static void log(Status logStatus, Markup mark){ - ExtentTest test = ExtentTestManager.getTest(); + ExtentTest test = testManager.getTest(); test.log(logStatus, mark); } public static void log(Status logStatus, String message){ - ExtentTest test = ExtentTestManager.getTest(); + ExtentTest test = testManager.getTest(); test.log(logStatus, message); } @@ -47,7 +48,7 @@ public class ExtentTestActions { } public static void log(Status logStatus, Throwable throwabel){ - ExtentTest test = ExtentTestManager.getTest(); + ExtentTest test = testManager.getTest(); test.log(logStatus, throwabel); } @@ -20,17 +20,20 @@ package org.openecomp.sdc.ci.tests.api; -import com.aventstack.extentreports.ExtentReports; -import com.aventstack.extentreports.ExtentTest; - import java.util.HashMap; -public class ExtentTestManager { +import com.aventstack.extentreports.ExtentReports; +import com.aventstack.extentreports.ExtentTest; +public class ExtentTestManager implements SomeInterface{ private static HashMap<Long, ExtentTest> extentTestMap = new HashMap<Long, ExtentTest>(); private static ExtentReports extent = ExtentManager.getReporter(); - - public static synchronized ExtentTest getTest() { + + public ExtentTestManager(){ + } + + @Override + public synchronized ExtentTest getTest() { return extentTestMap.get(Thread.currentThread().getId()); } @@ -54,7 +57,7 @@ public class ExtentTestManager { String[] parts = clazz.getName().split("\\."); String lastOne1 = parts[parts.length-1]; String lastOne2 = parts[parts.length-2]; - getTest().assignCategory(lastOne2 + "-" + lastOne1); + extentTestMap.get(Thread.currentThread().getId()).assignCategory(lastOne2 + "-" + lastOne1); } @@ -0,0 +1,9 @@ +package org.openecomp.sdc.ci.tests.api; + +import com.aventstack.extentreports.ExtentTest; + +public interface SomeInterface { + + abstract ExtentTest getTest(); + +} @@ -142,7 +142,7 @@ public interface Urls { final String GET_FOLLWED_LIST = "http://%s:%s/sdc2/rest/v1/followed"; - final String GET_CATALOG_DATA = "http://%s:%s/sdc2/rest/v1/screen"; + final String GET_CATALOG_DATA = "http://%s:%s/sdc2/rest/v1/screen/?excludeTypes=VFCMT&excludeTypes=Configuration"; // *****************************************Resources // ********************************************************************** @@ -179,6 +179,7 @@ public interface Urls { final String CHANGE_COMPONENT_LIFECYCLE_STATE = "http://%s:%s/sdc2/rest/v1/catalog/%s/%s/lifecycleState/%s"; final String CREATE_PROPERTY = "http://%s:%s/sdc2/rest/v1/catalog/resources/%s/properties"; + final String DECLARE_PROPERTIES = "http://%s:%s/sdc2/rest/v1/catalog/%s/%s/create/inputs"; final String UPDATE_RESOURCE_METADATA = "http://%s:%s/sdc2/rest/v1/catalog/resources/%s/metadata"; @@ -285,6 +286,7 @@ public interface Urls { final String DISTRIBUTION_DOWNLOAD_ARTIFACT = "http://%s:%s/download"; final String ACTIVATE_DISTRIBUTION = "http://%s:%s/sdc2/rest/v1/catalog/services/%s/distribution/%s/activate"; final String DISTRIBUTION_SERVICE_LIST = "http://%s:%s/sdc2/rest/v1/catalog/services/%s/distribution"; + final String DISTRIBUTION_SERVICE_MONITOR = "http://%s:%s/sdc2/rest/v1/catalog/services/distribution/%s"; final String DEPLOY_SERVICE = "http://%s:%s/sdc2/rest/v1/catalog/services/%s/distribution/%s/markDeployed"; final String UPDATE_SERVICE_METADATA = "http://%s:%s/sdc2/rest/v1/catalog/services/%s/metadata"; @@ -366,5 +368,22 @@ public interface Urls { // amdocs APIs final String GET_VENDOR_SOFTWARE_PRODUCT = "http://%s:%s/onboarding-api/v1.0/vendor-software-products/packages/%s"; - + final String UPLOAD_SNMP_POLL_ARTIFACT = "http://%s:%s/onboarding-api/v1.0/vendor-software-products/%s/versions/0.1/components/%s/uploads/types/SNMP_POLL"; + final String UPLOAD_SNMP_TRAP_ARTIFACT = "http://%s:%s/onboarding-api/v1.0/vendor-software-products/%s/versions/0.1/components/%s/uploads/types/SNMP_TRAP"; + final String UPLOAD_VES_EVENTS_ARTIFACT = "http://%s:%s/onboarding-api/v1.0/vendor-software-products/%s/versions/0.1/components/%s/uploads/types/VES_EVENTS"; + final String UPLOAD_AMDOCS_ARTIFACT = "http://%s:%s/onboarding-api/v1.0/vendor-software-products/%s/versions/0.1/components/%s/uploads/types/%s"; + final String DELETE_AMDOCS_ARTIFACT_BY_TYPE = "http://%s:%s/onboarding-api/v1.0/vendor-software-products/%s/versions/0.1/components/%s/monitors/%s"; + final String GET_VSP_COMPONENTS = "http://%s:%s/onboarding-api/v1.0/vendor-software-products/%s/versions/0.1/components"; + final String CREATE_VENDOR_LISENCE_MODELS = "http://%s:%s/onboarding-api/v1.0/vendor-license-models"; + final String CREATE_VENDOR_LISENCE_AGREEMENT = "http://%s:%s/onboarding-api/v1.0/vendor-license-models/%s/versions/0.1/license-agreements"; + final String CREATE_VENDOR_LISENCE_FEATURE_GROUPS = "http://%s:%s/onboarding-api/v1.0/vendor-license-models/%s/versions/0.1/feature-groups"; + final String CREATE_VENDOR_LISENCE_ENTITLEMENT_POOL = "http://%s:%s/onboarding-api/v1.0/vendor-license-models/%s/versions/0.1/entitlement-pools"; + final String CREATE_VENDOR_LISENCE_KEY_GROUPS = "http://%s:%s/onboarding-api/v1.0/vendor-license-models/%s/versions/0.1/license-key-groups"; + final String CREATE_VENDOR_SOFTWARE_PRODUCT = "http://%s:%s/onboarding-api/v1.0/vendor-software-products"; + final String VALIDATE_UPLOAD = "http://%s:%s/onboarding-api/v1.0/vendor-software-products/%s/versions/0.1/orchestration-template-candidate/process"; + final String UPLOAD_HEAT_PACKAGE = "http://%s:%s/onboarding-api/v1.0/vendor-software-products/%s/versions/%s/orchestration-template-candidate"; + final String ACTION_ON_COMPONENT = "http://%s:%s/onboarding-api/v1.0/%s/%s/versions/%s/actions"; + final String UPDATE_VSP = "http://%s:%s/onboarding-api/v1.0/vendor-software-products/%s/versions/%s"; + final String GET_VSP_COMPONENT_BY_VERSION = "http://%s:%s/onboarding-api/v1.0/vendor-software-products/%s/versions/%s"; + final String GET_VLM_COMPONENT_BY_VERSION = "http://%s:%s/onboarding-api/v1.0/vendor-license-models/%s/versions/%s"; } @@ -174,7 +174,6 @@ public class Config { try { in.close(); } catch (IOException e) { - // TODO Auto-generated catch block e.printStackTrace(); } } @@ -216,7 +215,6 @@ public class Config { try { in.close(); } catch (IOException e) { - // TODO Auto-generated catch block e.printStackTrace(); } } @@ -1,14 +1,13 @@ package org.openecomp.sdc.ci.tests.dataProviders; -import org.openecomp.sdc.ci.tests.utils.general.FileHandling; -import org.openecomp.sdc.ci.tests.utils.general.OnboardingUtils; -import org.testng.annotations.DataProvider; - - import java.util.ArrayList; import java.util.Collections; import java.util.List; +import org.openecomp.sdc.ci.tests.utils.general.FileHandling; +import org.openecomp.sdc.ci.tests.utils.general.OnboardingUtils; +import org.testng.annotations.DataProvider; + public class OnboardingDataProviders { protected static String filepath = FileHandling.getVnfRepositoryPath(); @@ -0,0 +1,76 @@ +package org.openecomp.sdc.ci.tests.dataProviders; + +import static org.testng.Assert.assertFalse; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.openecomp.sdc.ci.tests.utils.general.FileHandling; +import org.openecomp.sdc.ci.tests.utils.general.OnboardingUtils; +import org.testng.annotations.DataProvider; + +public class OnbordingDataProviders { + + protected static String filepath = FileHandling.getVnfRepositoryPath(); + +// -----------------------dataProviders----------------------------------------- + @DataProvider(name = "randomVNF_List", parallel = false) + private static final Object[][] randomVnfList() throws Exception { + int randomElementNumber = 3; //how many VNFs to onboard randomly + List<String> fileNamesFromFolder = OnboardingUtils.getVnfNamesFileListExcludeToscaParserFailure(); + List<String> newRandomFileNamesFromFolder = getRandomElements(randomElementNumber, fileNamesFromFolder); + if(newRandomFileNamesFromFolder == null){ + assertFalse(true,"Requered number of VNF files not exists under " + filepath); + } + System.out.println(String.format("There are %s zip file(s) to test", newRandomFileNamesFromFolder.size())); + return provideData(newRandomFileNamesFromFolder, filepath); + } + + @DataProvider(name = "VNF_List" , parallel = true) + private static final Object[][] VnfList() throws Exception { + + List<String> fileNamesFromFolder = OnboardingUtils.getVnfNamesFileList(); + + System.out.println(String.format("There are %s zip file(s) to test", fileNamesFromFolder.size())); + return provideData(fileNamesFromFolder, filepath); + } + +// -----------------------factories----------------------------------------- + + + + +// -----------------------methods----------------------------------------- + public static Object[][] provideData(List<String> fileNamesFromFolder, String filepath) { + + Object[][] arObject = new Object[fileNamesFromFolder.size()][]; + int index = 0; + for (Object obj : fileNamesFromFolder) { + arObject[index++] = new Object[] { filepath, obj }; + } + return arObject; + } + + public static List<String> getRandomElements(int randomElementNumber, List<String> fileNamesFromFolder) { + if(fileNamesFromFolder.size() == 0 || fileNamesFromFolder.size() < randomElementNumber){ + return null; + }else{ + List<Integer> indexList = new ArrayList<>(); + List<String> newRandomFileNamesFromFolder = new ArrayList<>(); + for(int i = 0; i < fileNamesFromFolder.size(); i++){ + indexList.add(i); + } + Collections.shuffle(indexList); + Integer[] randomArray = indexList.subList(0, randomElementNumber).toArray(new Integer[randomElementNumber]); + for(int i = 0; i < randomArray.length; i++){ + newRandomFileNamesFromFolder.add(fileNamesFromFolder.get(randomArray[i])); + } + return newRandomFileNamesFromFolder; + } + } + + + + +} @@ -6,6 +6,35 @@ public class AmdocsLicenseMembers { private String vendorLicenseName; private String vendorLicenseAgreementId; private String featureGroupId; + private String licenseVersionId; + private String licenseVersionLabel; + private String version; + + public AmdocsLicenseMembers(String vendorId, String vendorLicenseName, String vendorLicenseAgreementId, + String featureGroupId, String licenseVersionId, String licenseVersionLabel) { + this.vendorId = vendorId; + this.vendorLicenseName = vendorLicenseName; + this.vendorLicenseAgreementId = vendorLicenseAgreementId; + this.featureGroupId = featureGroupId; + this.licenseVersionId = licenseVersionId; + this.licenseVersionLabel = licenseVersionLabel; + } + + public String getLicenseVersionId() { + return licenseVersionId; + } + + public void setLicenseVersionId(String licenseVersionId) { + this.licenseVersionId = licenseVersionId; + } + + public String getLicenseVersionLabel() { + return licenseVersionLabel; + } + + public void setLicenseVersionLabel(String licenseVersionLabel) { + this.licenseVersionLabel = licenseVersionLabel; + } public AmdocsLicenseMembers(String vendorId, String vendorLicenseName, String vendorLicenseAgreementId, String featureGroupId) { super(); @@ -47,10 +76,26 @@ public class AmdocsLicenseMembers { this.featureGroupId = featureGroupId; } + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + @Override public String toString() { - return "AmdocsLicenseMembers [vendorId=" + vendorId + ", vendorLicenseName=" + vendorLicenseName + ", vendorLicenseAgreementId=" + vendorLicenseAgreementId + ", featureGroupId=" + featureGroupId + "]"; + return "AmdocsLicenseMembers{" + + "vendorId='" + vendorId + '\'' + + ", vendorLicenseName='" + vendorLicenseName + '\'' + + ", vendorLicenseAgreementId='" + vendorLicenseAgreementId + '\'' + + ", featureGroupId='" + featureGroupId + '\'' + + ", licenseVersionId='" + licenseVersionId + '\'' + + ", licenseVersionLabel='" + licenseVersionLabel + '\'' + + ", version='" + version + '\'' + + '}'; } - - + + } @@ -49,7 +49,6 @@ public class ArtifactAssetStructure { public ArtifactAssetStructure() { super(); - // TODO Auto-generated constructor stub } public String getArtifactName() { @@ -22,7 +22,6 @@ package org.openecomp.sdc.ci.tests.datatypes; import java.util.List; -import org.openecomp.sdc.be.model.ArtifactDefinition; import org.openecomp.sdc.be.model.HeatParameterDefinition; public class ArtifactReqDetails { @@ -33,7 +33,6 @@ public class ComponentInstanceReqDetails { public ComponentInstanceReqDetails() { super(); - // TODO Auto-generated constructor stub } public ComponentInstanceReqDetails(ComponentInstance componentInstance) { @@ -0,0 +1,69 @@ +package org.openecomp.sdc.ci.tests.datatypes; + +public class DistributionMonitorObject { + + private String omfComponentID; + private String timestamp; + private String url; + private String status; + private String errorReason; + + public DistributionMonitorObject() { + super(); + } + + public DistributionMonitorObject(String omfComponentID, String timestamp, String url, String status, String errorReason) { + super(); + this.omfComponentID = omfComponentID; + this.timestamp = timestamp; + this.url = url; + this.status = status; + this.errorReason = errorReason; + } + + public String getOmfComponentID() { + return omfComponentID; + } + + public void setOmfComponentID(String omfComponentID) { + this.omfComponentID = omfComponentID; + } + + public String getTimestamp() { + return timestamp; + } + + public void setTimestamp(String timestamp) { + this.timestamp = timestamp; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getErrorReason() { + return errorReason; + } + + public void setErrorReason(String errorReason) { + this.errorReason = errorReason; + } + + @Override + public String toString() { + return "DistributionMonitorObject [omfComponentID=" + omfComponentID + ", timestamp=" + timestamp + ", url=" + url + ", status=" + status + ", errorReason=" + errorReason + "]"; + } + +} @@ -36,7 +36,6 @@ public class HeatMetaFirstLevelDefinition { public HeatMetaFirstLevelDefinition() { super(); - // TODO Auto-generated constructor stub } public String getFileName() { @@ -32,12 +32,9 @@ import java.io.InputStream; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; -import java.util.HashSet; import java.util.Iterator; -import java.util.LinkedHashSet; import java.util.List; import java.util.Map; -import java.util.Set; import org.codehaus.jackson.map.ObjectMapper; import org.codehaus.jettison.json.JSONArray; @@ -0,0 +1,39 @@ +package org.openecomp.sdc.ci.tests.datatypes; +import java.util.List; + +public class LicensingData { + private String licenseAgreement; + private List<String> featureGroups = null; + + public LicensingData() { + } + + public LicensingData(String licenseAgreement, List<String> featureGroups) { + this.licenseAgreement = licenseAgreement; + this.featureGroups = 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; + } + + @Override + public String toString() { + return "LicensingData{" + + "licenseAgreement='" + licenseAgreement + '\'' + + ", featureGroups=" + featureGroups + + '}'; + } +} @@ -0,0 +1,31 @@ +package org.openecomp.sdc.ci.tests.datatypes; + +public class LicensingVersion { + + private String id; + private String label; + + public LicensingVersion(String id, String label) { + this.id = id; + this.label = label; + } + + public LicensingVersion() { + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + @Override + public String toString() { + return "LicensingVersion{" + + "id='" + id + '\'' + + ", label='" + label + '\'' + + '}'; + } +} @@ -23,7 +23,6 @@ package org.openecomp.sdc.ci.tests.datatypes; import java.util.List; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; -import org.openecomp.sdc.be.model.Resource; public class ResourceExternalReqDetails extends ComponentReqDetails { String vendorName; @@ -144,7 +144,6 @@ public class ResourceRespJavaObject { public ResourceRespJavaObject() { super(); - // TODO Auto-generated constructor stub } // public ResourceRespJavaObject(String uniqueId, String resourceName, @@ -29,7 +29,6 @@ public class ServiceDistributionStatus { public ServiceDistributionStatus() { super(); - // TODO Auto-generated constructor stub } public ServiceDistributionStatus(String distributionID, String timestamp, String userId, String deployementStatus) { @@ -27,10 +27,10 @@ import org.openecomp.sdc.be.model.category.CategoryDefinition; public class ServiceReqDetails extends ComponentReqDetails { - protected String serviceType; - protected String serviceRole; - protected String namingPolicy; - protected Boolean ecompGeneratedNaming; + protected String serviceType = "MyServiceType"; + protected String serviceRole = "MyServiceRole"; + protected String namingPolicy = "MyServiceNamingPolicy"; + protected Boolean ecompGeneratedNaming = true; public String getServiceType() { return serviceType; @@ -21,7 +21,6 @@ package org.openecomp.sdc.ci.tests.datatypes; import java.util.ArrayList; -import java.util.List; public class ServiceRespJavaObject { @@ -50,7 +49,6 @@ public class ServiceRespJavaObject { public ServiceRespJavaObject() { super(); - // TODO Auto-generated constructor stub } public ServiceRespJavaObject(String category, String creatorUserId, String creatorFullName, @@ -1,47 +1,27 @@ package org.openecomp.sdc.ci.tests.datatypes; -public class VendorSoftwareProductObject { +public class VendorSoftwareProductObject extends VendorSoftwareProductObjectReqDetails { - private String vendorName; private String vspId; - private String category; - private String subCategory; private String componentId; - private String description; private String attContact; - private String vspName; - - public VendorSoftwareProductObject() { - super(); - // TODO Auto-generated constructor stub - } + private String version; + + public VendorSoftwareProductObject(){super();} - public VendorSoftwareProductObject(String vendorName, String vspId, String category, String subCategory, String componentId, String description, String attContact) { - super(); - this.vendorName = vendorName; + public VendorSoftwareProductObject(String vspId, String componentId, String attContact, String version) { this.vspId = vspId; - this.category = category; - this.subCategory = subCategory; this.componentId = componentId; - this.description = description; this.attContact = attContact; + this.version = version; } - - public String getVspName() { - return vspName; - } - - public void setVspName(String vspName) { - this.vspName = vspName; - } - - public String getVendorName() { - return vendorName; - } - - public void setVendorName(String vendorName) { - this.vendorName = vendorName; + public VendorSoftwareProductObject(String name, String description, String category, String subCategory, String vendorId, String vendorName, LicensingVersion licensingVersion, LicensingData licensingData, String onboardingMethod, String networkPackageName, String onboardingOrigin, String vspId, String componentId, String attContact, String version) { + super(name, description, category, subCategory, vendorId, vendorName, licensingVersion, licensingData, onboardingMethod, networkPackageName, onboardingOrigin); + this.vspId = vspId; + this.componentId = componentId; + this.attContact = attContact; + this.version = version; } public String getVspId() { @@ -52,22 +32,6 @@ public class VendorSoftwareProductObject { this.vspId = vspId; } - public String getCategory() { - return category; - } - - public void setCategory(String category) { - this.category = category; - } - - public String getSubCategory() { - return subCategory; - } - - public void setSubCategory(String subCategory) { - this.subCategory = subCategory; - } - public String getComponentId() { return componentId; } @@ -76,14 +40,6 @@ public class VendorSoftwareProductObject { this.componentId = componentId; } - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - public String getAttContact() { return attContact; } @@ -92,11 +48,21 @@ public class VendorSoftwareProductObject { this.attContact = attContact; } + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + @Override public String toString() { - return "VendorSoftwareProductObject [vendorName=" + vendorName + ", vspId=" + vspId + ", category=" + category + ", subCategory=" + subCategory + ", componentId=" + componentId + ", description=" + description + ", attContact=" - + attContact + "]"; + return "VendorSoftwareProductObject{" + + "vspId='" + vspId + '\'' + + ", componentId='" + componentId + '\'' + + ", attContact='" + attContact + '\'' + + ", version='" + version + '\'' + + '}'; } - - } @@ -0,0 +1,148 @@ +package org.openecomp.sdc.ci.tests.datatypes; + +public class VendorSoftwareProductObjectReqDetails { + + private String name; + private String description; + private String category; + private String subCategory; + private String vendorId; + private String vendorName; + private LicensingVersion licensingVersion; + private LicensingData licensingData; + private String onboardingMethod; + private String networkPackageName; + private String onboardingOrigin; + + public String getIcon() { + return icon; + } + + public void setIcon(String icon) { + this.icon = icon; + } + + private String icon; + + public VendorSoftwareProductObjectReqDetails() { + } + + public VendorSoftwareProductObjectReqDetails(String name, String description, String category, String subCategory, String vendorId, String vendorName, LicensingVersion licensingVersion, LicensingData licensingData, String onboardingMethod, String networkPackageName, String onboardingOrigin) { + this.name = name; + this.description = description; + this.category = category; + this.subCategory = subCategory; + this.vendorId = vendorId; + this.vendorName = vendorName; + this.licensingVersion = licensingVersion; + this.licensingData = licensingData; + this.onboardingMethod = onboardingMethod; + this.networkPackageName = networkPackageName; + this.onboardingOrigin = onboardingOrigin; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getCategory() { + return category; + } + + public void setCategory(String category) { + this.category = category; + } + + public String getSubCategory() { + return subCategory; + } + + public void setSubCategory(String subCategory) { + this.subCategory = subCategory; + } + + public String getVendorId() { + return vendorId; + } + + public void setVendorId(String vendorId) { + this.vendorId = vendorId; + } + + public String getVendorName() { + return vendorName; + } + + public void setVendorName(String vendorName) { + this.vendorName = vendorName; + } + + public LicensingVersion getLicensingVersion() { + return licensingVersion; + } + + public void setLicensingVersion(LicensingVersion licensingVersion) { + this.licensingVersion = licensingVersion; + } + + public LicensingData getLicensingData() { + return licensingData; + } + + public void setLicensingData(LicensingData licensingData) { + this.licensingData = licensingData; + } + + public String getOnboardingMethod() { + return onboardingMethod; + } + + public void setOnboardingMethod(String onboardingMethod) { + this.onboardingMethod = onboardingMethod; + } + + public String getNetworkPackageName() { + return networkPackageName; + } + + public void setNetworkPackageName(String networkPackageName) { + this.networkPackageName = networkPackageName; + } + + public String getOnboardingOrigin() { + return onboardingOrigin; + } + + public void setOnboardingOrigin(String onboardingOrigin) { + this.onboardingOrigin = onboardingOrigin; + } + + @Override + public String toString() { + return "VendorSoftwareProductObjectReqDetails{" + + "name='" + name + '\'' + + ", description='" + description + '\'' + + ", category='" + category + '\'' + + ", subCategory='" + subCategory + '\'' + + ", vendorId='" + vendorId + '\'' + + ", vendorName='" + vendorName + '\'' + + ", licensingVersion=" + licensingVersion + + ", licensingData=" + licensingData + + ", onboardingMethod='" + onboardingMethod + '\'' + + ", networkPackageName='" + networkPackageName + '\'' + + ", onboardingOrigin='" + onboardingOrigin + '\'' + + '}'; + } +} @@ -0,0 +1,7 @@ +package org.openecomp.sdc.ci.tests.datatypes.enums; + +public enum CircleSize { + VF(), + SERVICE(), + NORMATIVE(); +} @@ -0,0 +1,19 @@ +package org.openecomp.sdc.ci.tests.datatypes.enums; + +public enum CvfcTypeEnum { + + SNMP_POLL ("SNMP_POLL"), + SNMP_TRAP ("SNMP_TRAP"), + VES_EVENTS ("VES_EVENTS"); + + private String value; + + public String getValue() { + return value; + } + + private CvfcTypeEnum(String value) { + this.value = value; + } + +} @@ -28,7 +28,6 @@ public class ErrorInfo { public ErrorInfo() { super(); - // TODO Auto-generated constructor stub } public ErrorInfo(Integer code, String message, String messageId) { @@ -20,8 +20,6 @@ package org.openecomp.sdc.ci.tests.datatypes.enums; -import java.util.List; - public enum LifeCycleStatesEnum { CHECKOUT("checkout", "NOT_CERTIFIED_CHECKOUT"), @@ -20,37 +20,40 @@ package org.openecomp.sdc.ci.tests.datatypes.enums; -import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; import org.openecomp.sdc.be.datatypes.elements.SchemaDefinition; import org.openecomp.sdc.be.model.PropertyDefinition; import org.openecomp.sdc.be.model.tosca.ToscaPropertyType; public enum PropertyTypeEnum { - INTEGER("defaultIntegerPropName1", "integer", "125", "default integer type property description", null), - STRING("defaultStringPropName1", "string", "string", "default string type property description", null), - BOOLEAN("defaultBooleanPropName1", "boolean", "true", "default boolean type property description", null), - FLOAT("defaultBooleanPropName1", "float", "1.2", "default float type property description", null), - STRING_LIST("defaultStringListPropName", "list", "[a,b]", "outer description", getDefaultStringSchema(ToscaPropertyType.STRING.getType())), - INTEGER_LIST("defaultIntegerListPropName", "list", "[1,2]", "outer description", getDefaultStringSchema(ToscaPropertyType.INTEGER.getType())), - BOOLEAN_LIST("defaultBooleanListPropName", "list", "[true,false]", "outer description", getDefaultStringSchema(ToscaPropertyType.BOOLEAN.getType())), - FLOAT_LIST("defaultFloatMapPropName", "list", "[1.0,2.0]", "outer description", getDefaultStringSchema(ToscaPropertyType.FLOAT.getType())), - STRING_MAP("defaultStringMapPropName", "map", "{\"key1\":val1 , \"key2\":val2}", "outer description", getDefaultStringSchema(ToscaPropertyType.STRING.getType())), - INTEGER_MAP("defaultIntegerMapPropName", "map", "{\"key1\":123 , \"key2\":-456}", "outer description", getDefaultStringSchema(ToscaPropertyType.INTEGER.getType())), - BOOLEAN_MAP("defaultBooleanMapPropName", "map", "{\"key1\":true , \"key2\":false}", "outer description", getDefaultStringSchema(ToscaPropertyType.BOOLEAN.getType())), - FLOAT_MAP("defaultFloatMapPropName", "map", "{\"key1\":0.2123 , \"key2\":43.545f}", "outer description", getDefaultStringSchema(ToscaPropertyType.FLOAT.getType())); + INTEGER("defaultIntegerPropName1", "integer", "125", "346", "default integer type property description", "updated integer type property description",null), + STRING("defaultStringPropName1", "string", "string", "updated string","default string type property description", "updated string type property description",null), + BOOLEAN("defaultBooleanPropName1", "boolean", "true", "false","default boolean type property description", "updated boolean type property description",null), + FLOAT("defaultFloatPropName1", "float", "1.2", "3.4","default float type property description", "updated float type property description",null), + STRING_LIST("defaultStringListPropName", "list", "[a,b]", "[c,d]","outer description", "updated outer description", getDefaultStringSchema(ToscaPropertyType.STRING.getType())), + INTEGER_LIST("defaultIntegerListPropName", "list", "[1,2]", "[3,4]","outer description", "updated outer description", getDefaultStringSchema(ToscaPropertyType.INTEGER.getType())), + BOOLEAN_LIST("defaultBooleanListPropName", "list", "[true,false]", "[false,true]","outer description", "updated outer description", getDefaultStringSchema(ToscaPropertyType.BOOLEAN.getType())), + FLOAT_LIST("defaultFloatMapPropName", "list", "[1.0,2.0]", "[3.0,4.0]","outer description", "updated outer description", getDefaultStringSchema(ToscaPropertyType.FLOAT.getType())), + STRING_MAP("defaultStringMapPropName", "map", "{\"key1\":val1 , \"key2\":val2}", "{\"key1\":val11 , \"key2\":val22}", "outer description", "updated outer description",getDefaultStringSchema(ToscaPropertyType.STRING.getType())), + INTEGER_MAP("defaultIntegerMapPropName", "map", "{\"key1\":123 , \"key2\":-456}", "{\"key1\":456 , \"key2\":-789}", "outer description", "updated outer description", getDefaultStringSchema(ToscaPropertyType.INTEGER.getType())), + BOOLEAN_MAP("defaultBooleanMapPropName", "map", "{\"key1\":true , \"key2\":false}", "{\"key1\":false , \"key2\":true}", "outer description", "updated outer description",getDefaultStringSchema(ToscaPropertyType.BOOLEAN.getType())), + FLOAT_MAP("defaultFloatMapPropName", "map", "{\"key1\":0.2123 , \"key2\":43.545f}", "{\"key1\":0.5678 , \"key2\":12.789f}","outer description", "updated outer description", getDefaultStringSchema(ToscaPropertyType.FLOAT.getType())); private String name; private String type; private String value; + private String updateValue; private String description; + private String updateDescription; private SchemaDefinition schemaDefinition; - private PropertyTypeEnum(String name, String type, String value, String description, + private PropertyTypeEnum(String name, String type, String value, String updateValue,String description,String updateDescription, SchemaDefinition schemaDefinition) { this.name = name; this.type = type; this.value = value; + this.updateValue = updateValue; this.description = description; + this.updateDescription = updateDescription; this.schemaDefinition = schemaDefinition; } @@ -77,6 +80,14 @@ public enum PropertyTypeEnum { public void setValue(String value) { this.value = value; } + + public String getUpdateValue() { + return updateValue; + } + + public void setUpdateValue(String updateValue) { + this.updateValue = updateValue; + } public String getDescription() { return description; @@ -85,6 +96,14 @@ public enum PropertyTypeEnum { public void setDescription(String description) { this.description = description; } + + public String getUpdateDescription() { + return updateDescription; + } + + public void setUpdateDescription(String updateDescription) { + this.updateDescription = updateDescription; + } public SchemaDefinition getSchemaDefinition() { return schemaDefinition; @@ -20,23 +20,87 @@ package org.openecomp.sdc.ci.tests.datatypes.enums; +import java.util.Random; + public enum ResourceCategoryEnum { - NETWORK_L2_3_ROUTERS("Network L2-3", "Router"), NETWORK_L2_3_GETEWAY("Network L2-3","Gateway"), NETWORK_L2_3_WAN_CONNECTORS("Network L2-3", "WAN Connectors"), NETWORK_L2_3_LAN_CONNECTORS("Network L2-3", "LAN Connectors"), - NETWORK_L2_3_INFRASTRUCTURE("Network L2-3", "Infrastructure"), NETWORK_L4("Network L4+", "Common Network Resources"), APPLICATION_L4_BORDER("Application L4+", "Border Element"), - APPLICATION_L4_APP_SERVER("Application L4+", "Application Server"), APPLICATION_L4_WEB_SERVERS("Application L4+", "Web Server"), APPLICATION_L4_CALL_CONTROL("Application L4+","Call Control"), - APPLICATION_L4_MEDIA_SERVER("Application L4+", "Media Servers"), APPLICATION_L4_LOAD_BALANCER("Application L4+", "Load Balancer"), APPLICATION_L4_DATABASE("Application L4+","Database"), - APPLICATION_L4_FIREWALL("Application L4+", "Firewall"), GENERIC_INFRASTRUCTURE("Generic", "Infrastructure"), GENERIC_ABSTRACT("Generic", "Abstract"), GENERIC_NETWORK_ELEMENTS("Generic","Network Elements"), - GENERIC_DATABASE("Generic", "Database"), NETWORK_CONNECTIVITY_CON_POINT("Network Connectivity", "Connection Points"), NETWORK_CONNECTIVITY_VIRTUAL_LINK("Network Connectivity","Virtual Links"), - TEMPLATE_MONITORING_TEMPLATE("Template", "Monitoring Template"), ALLOTTED_RESOURCE("Allotted Resource", "Allotted Resource"); + NETWORK_L2_3_ROUTERS("Network L2-3", "Router", "resourceNewCategory.network l2-3", "resourceNewCategory.network l2-3.router"), + NETWORK_L2_3_GETEWAY("Network L2-3","Gateway", "resourceNewCategory.network l2-3", "resourceNewCategory.network l2-3.gateway"), + NETWORK_L2_3_WAN_CONNECTORS("Network L2-3", "WAN Connectors", "resourceNewCategory.network l2-3", "resourceNewCategory.network l2-3.lan connectors"), + NETWORK_L2_3_LAN_CONNECTORS("Network L2-3", "LAN Connectors", "resourceNewCategory.network l2-3", "resourceNewCategory.network l2-3.wan connectors"), + NETWORK_L2_3_INFRASTRUCTURE("Network L2-3", "Infrastructure", "resourceNewCategory.network l2-3", "resourceNewCategory.network l2-3.infrastructure"), + + NETWORK_L4("Network L4+", "Common Network Resources", "resourceNewCategory.network l4+", "resourceNewCategory.network l4+.common network resources"), + + APPLICATION_L4_BORDER("Application L4+", "Border Element", "resourceNewCategory.application l4+", "resourceNewCategory.application l4+.border element"), + APPLICATION_L4_APP_SERVER("Application L4+", "Application Server", "resourceNewCategory.application l4+", "resourceNewCategory.application l4+.application server"), + APPLICATION_L4_WEB_SERVERS("Application L4+", "Web Server", "resourceNewCategory.application l4+", "resourceNewCategory.application l4+.web server"), + APPLICATION_L4_CALL_CONTROL("Application L4+","Call Control", "resourceNewCategory.application l4+", "resourceNewCategory.application l4+.call control"), + APPLICATION_L4_MEDIA_SERVER("Application L4+", "Media Servers", "resourceNewCategory.application l4+", "resourceNewCategory.application l4+.media servers"), + APPLICATION_L4_LOAD_BALANCER("Application L4+", "Load Balancer", "resourceNewCategory.application l4+", "resourceNewCategory.application l4+.load balancer"), + APPLICATION_L4_DATABASE("Application L4+","Database", "resourceNewCategory.application l4+", "resourceNewCategory.application l4+.database"), + APPLICATION_L4_FIREWALL("Application L4+", "Firewall", "resourceNewCategory.application l4+", "resourceNewCategory.application l4+.firewall"), + + GENERIC_INFRASTRUCTURE("Generic", "Infrastructure", "resourceNewCategory.generic", "resourceNewCategory.generic.infrastructure"), + GENERIC_ABSTRACT("Generic", "Abstract", "resourceNewCategory.generic", "resourceNewCategory.generic.abstract"), + GENERIC_NETWORK_ELEMENTS("Generic","Network Elements", "resourceNewCategory.generic", "resourceNewCategory.generic.network elements"), + GENERIC_DATABASE("Generic", "Database", "resourceNewCategory.generic", "resourceNewCategory.generic.database"), + GENERIC_RULES("Generic", "Rules", "resourceNewCategory.generic", "resourceNewCategory.generic.rules"), + + NETWORK_CONNECTIVITY_CON_POINT("Network Connectivity", "Connection Points", "resourceNewCategory.network connectivity", "resourceNewCategory.network connectivity.connection points"), + NETWORK_CONNECTIVITY_VIRTUAL_LINK("Network Connectivity","Virtual Links", "resourceNewCategory.network connectivity", "resourceNewCategory.network connectivity.virtual links"), + + TEMPLATE_MONITORING_TEMPLATE("Template", "Monitoring Template", "resourceNewCategory.template", "resourceNewCategory.template.monitoring template"), + + ALLOTTED_RESOURCE("Allotted Resource", "Allotted Resource", "resourceNewCategory.allotted resource", "resourceNewCategory.allotted resource.allotted resource"), + ALLOTTED_RESOURCE_SERVICE_ADMIN("Allotted Resource", "Service Admin", "resourceNewCategory.allotted resource", "resourceNewCategory.allotted resource.service admin"), + ALLOTTED_RESOURCE_CONTRAIL_ROUTE("Allotted Resource", "Contrail Route", "resourceNewCategory.allotted resource", "resourceNewCategory.allotted resource.contrail route"), + ALLOTTED_RESOURCE_TUNNEL_XCONNECT("Allotted Resource", "Tunnel XConnect", "resourceNewCategory.allotted resource", "resourceNewCategory.allotted resource.tunnel xconnect"), + ALLOTTED_RESOURCE_IP_MUX_DEMUX("Allotted Resource", "IP Mux Demux", "resourceNewCategory.allotted resource", "resourceNewCategory.allotted resource.ip mux demux"), + ALLOTTED_RESOURCE_SECURITY_ZONE("Allotted Resource", "Security Zone", "resourceNewCategory.allotted resource", "resourceNewCategory.allotted resource.security zone"), + + DCAE_COMPONENT_MICROSERVICE("DCAE Component", "Microservice", "resourceNewCategory.dcae component", "resourceNewCategory.dcae component.microservice"), + DCAE_COMPONENT_DATABASE("DCAE Component", "Database", "resourceNewCategory.dcae component", "resourceNewCategory.dcae component.database"), + DCAE_COMPONENT_POLICY("DCAE Component", "policy", "resourceNewCategory.dcae component", "resourceNewCategory.dcae component.policy"), + DCAE_COMPONENT_SOURCE("DCAE Component", "Source", "resourceNewCategory.dcae component", "resourceNewCategory.dcae component.source"), + DCAE_COMPONENT_ANALYSTICS("DCAE Component", "Analytics", "resourceNewCategory.dcae component", "resourceNewCategory.dcae component.analytics"), + DCAE_COMPONENT_UTILITY("DCAE Component", "Utility", "resourceNewCategory.dcae component", "resourceNewCategory.dcae component.utility"), + DCAE_COMPONENT_COLLECTOR("DCAE Component", "Collector", "resourceNewCategory.dcae component", "resourceNewCategory.dcae component.collector"), + ; private String category; private String subCategory; + private String categoryUniqeId; + private String subCategoryUniqeId; ResourceCategoryEnum(String category, String subCategory) { this.category = category; this.subCategory = subCategory; } + + private ResourceCategoryEnum(String category, String subCategory, String categoryUniqeId, String subCategoryUniqeId) { + this.category = category; + this.subCategory = subCategory; + this.categoryUniqeId = categoryUniqeId; + this.subCategoryUniqeId = subCategoryUniqeId; + } + + public String getCategoryUniqeId() { + return categoryUniqeId; + } + + public void setCategoryUniqeId(String categoryUniqeId) { + this.categoryUniqeId = categoryUniqeId; + } + + public String getSubCategoryUniqeId() { + return subCategoryUniqeId; + } + + public void setSubCategoryUniqeId(String subCategoryUniqeId) { + this.subCategoryUniqeId = subCategoryUniqeId; + } + public String getCategory() { return category; @@ -54,4 +118,44 @@ public enum ResourceCategoryEnum { this.subCategory = subCategory; } + + public static ResourceCategoryEnum findEnumNameByValues(String category, String subCategory){ + for(ResourceCategoryEnum resourceCategoryEnum : ResourceCategoryEnum.values()) { + if(resourceCategoryEnum.getCategory().equals(category) && resourceCategoryEnum.getSubCategory().equals(subCategory)){ + return resourceCategoryEnum; + } + } + return null; + } + + + /** + * @return random category enum except allotted category + */ + public static ResourceCategoryEnum getRandomElement() { + Random random = new Random(); + ResourceCategoryEnum resourceCategoryEnum = ResourceCategoryEnum.values()[random.nextInt(ResourceCategoryEnum.values().length)]; + + if(!resourceCategoryEnum.toString().startsWith("ALLOTTED")){ + return resourceCategoryEnum; + }else{ + return getRandomElement(); + } + } + + + /** + * @return random allotted category enum + */ + public static ResourceCategoryEnum getRandomAllottedElement() { + Random random = new Random(); + ResourceCategoryEnum resourceCategoryEnum = ResourceCategoryEnum.values()[random.nextInt(ResourceCategoryEnum.values().length)]; + + if(resourceCategoryEnum.toString().startsWith("ALLOTTED")){ + return resourceCategoryEnum; + }else{ + return getRandomAllottedElement(); + } + } + } @@ -20,6 +20,8 @@ package org.openecomp.sdc.ci.tests.datatypes.enums; +import java.util.Random; + public enum ServiceCategoriesEnum { VOIP("VoIP Call Control"), MOBILITY("Mobility"), NETWORK_L4("Network L4+"), NETWORK_L3("Network L1-3"); @@ -34,4 +36,8 @@ public enum ServiceCategoriesEnum { return value; } + public static ServiceCategoriesEnum getRandomElement() { + Random random = new Random(); + return ServiceCategoriesEnum.values()[random.nextInt(ServiceCategoriesEnum.values().length)]; + } } @@ -25,7 +25,7 @@ public enum UserRoleEnum { // ADMIN("jh0003", "Jimmy", "Hendrix"), DESIGNER("cs0008", "Carlos", "Santana"), DESIGNER2("me0009", "Melissa","Etheridge"), TESTER("jm0007", "Joni", "Mitchell"), ADMIN4("km2000", "Kot", "May"), // GOVERNOR("gv0001","David", "Shadmi"), OPS("op0001", "Steve", "Regev"), PRODUCT_STRATEGIST1("ps0001", "Eden","Rozin"), PRODUCT_STRATEGIST2("ps0002", "Ella", "Kvetny"), PRODUCT_STRATEGIST3("ps0003", "Geva", "Alon"), // PRODUCT_MANAGER1("pm0001", "Teddy", "Isashar"), PRODUCT_MANAGER2("pm0002", "Sarah", "Bettens"); - ADMIN("jh0003", "Jimmy", "Hendrix"), DESIGNER("cs0008", "Carlos", "Santana"), DESIGNER2("me0009", "Melissa","Etheridge"), TESTER("jm0007", "Johnny", "Depp"), ADMIN4("km2000", "Kot", "May"), + ADMIN("jh0003", "Jimmy", "Hendrix"), DESIGNER("m08740", "Zero", "ASDCMech"), DESIGNER2("me0009", "Melissa","Etheridge"), DESIGNER3("cs0008", "Carlos", "Santana"),TESTER("jm0007", "Johnny", "Depp"), ADMIN4("km2000", "Kot", "May"), GOVERNOR("gv0001","David", "Shadmi"), OPS("op0001", "Aretha", "Franklin"), PRODUCT_STRATEGIST1("ps0001", "Eden","Rozin"), PRODUCT_STRATEGIST2("ps0002", "Ella", "Kvetny"), PRODUCT_STRATEGIST3("ps0003", "Geva", "Alon"), PRODUCT_MANAGER1("pm0001", "Teddy", "Isashar"), PRODUCT_MANAGER2("pm0002", "Sarah", "Bettens"); private String userId; @@ -37,7 +37,6 @@ public class ExpectedExternalAudit { public ExpectedExternalAudit() { super(); - // TODO Auto-generated constructor stub } public String getRESOURCE_NAME() { @@ -142,7 +142,6 @@ public class ExpectedResourceAuditJavaObject { public ExpectedResourceAuditJavaObject() { super(); - // TODO Auto-generated constructor stub } public ExpectedResourceAuditJavaObject(String action, String modifierName, String modifierUid, String status, @@ -53,7 +53,6 @@ import org.apache.http.entity.mime.content.StringBody; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.util.EntityUtils; -import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -20,9 +20,6 @@ package org.openecomp.sdc.ci.tests.execute.TODO; -import org.testng.annotations.AfterClass; -import org.testng.annotations.Test; -import org.testng.AssertJUnit; import java.io.File; import java.io.IOException; @@ -36,8 +33,11 @@ import org.apache.tinkerpop.gremlin.structure.Vertex; import org.openecomp.sdc.ci.tests.api.Urls; import org.openecomp.sdc.ci.tests.config.Config; import org.openecomp.sdc.ci.tests.utils.DbUtils; -import org.openecomp.sdc.ci.tests.utils.Utils; import org.openecomp.sdc.ci.tests.utils.DbUtils.TitanState; +import org.openecomp.sdc.ci.tests.utils.Utils; +import org.testng.AssertJUnit; +import org.testng.annotations.AfterClass; +import org.testng.annotations.Test; import fj.data.Either; @@ -61,10 +61,8 @@ import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.datatypes.http.HttpHeaderEnum; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; -import org.openecomp.sdc.ci.tests.utils.Utils; import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; -import org.openecomp.sdc.ci.tests.utils.general.FileUtils; import org.openecomp.sdc.ci.tests.utils.rest.ArtifactRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils; @@ -78,7 +78,6 @@ import org.openecomp.sdc.ci.tests.utils.rest.ArtifactRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; -import org.openecomp.sdc.ci.tests.utils.rest.ServiceRestUtils; import org.openecomp.sdc.ci.tests.utils.validation.AuditValidationUtils; import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils; import org.openecomp.sdc.ci.tests.utils.validation.ServiceValidationUtils; @@ -91,15 +90,12 @@ import org.testng.Assert; import org.testng.AssertJUnit; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; -import org.testng.internal.Yaml; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.typesafe.config.ConfigException.Null; import fj.data.Either; -import fj.data.List; public class DownloadComponentArt extends ComponentBaseTest { @@ -35,7 +35,6 @@ import org.openecomp.sdc.be.datatypes.elements.HeatParameterDataDefinition; import org.openecomp.sdc.be.model.ArtifactDefinition; import org.openecomp.sdc.be.model.ArtifactUiDownloadData; import org.openecomp.sdc.be.model.ComponentInstance; -import org.openecomp.sdc.be.model.HeatParameterDefinition; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.be.model.User; @@ -39,20 +39,15 @@ import org.javatuples.Pair; import org.junit.Rule; import org.junit.rules.TestName; import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.model.ArtifactDefinition; import org.openecomp.sdc.be.model.Component; -import org.openecomp.sdc.be.model.Product; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.ci.tests.api.ComponentBaseTest; import org.openecomp.sdc.ci.tests.datatypes.ArtifactReqDetails; -import org.openecomp.sdc.ci.tests.datatypes.ComponentInstanceReqDetails; -import org.openecomp.sdc.ci.tests.datatypes.ProductReqDetails; import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; -import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.ErrorInfo; import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum; @@ -68,14 +63,11 @@ import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.openecomp.sdc.ci.tests.utils.general.FileUtils; import org.openecomp.sdc.ci.tests.utils.rest.ArtifactRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils; -import org.openecomp.sdc.ci.tests.utils.rest.ComponentInstanceRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.LifecycleRestUtils; -import org.openecomp.sdc.ci.tests.utils.rest.ProductRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; import org.openecomp.sdc.ci.tests.utils.rest.ServiceRestUtils; import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils; -import org.openecomp.sdc.exception.ResponseFormat; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.testng.annotations.BeforeMethod; @@ -121,7 +121,6 @@ public class ValidateArtResponse extends ComponentBaseTest { } protected void assertnull(String string, boolean equals) { - // TODO Auto-generated method stub } @@ -28,7 +28,6 @@ import org.junit.rules.TestName; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.datatypes.elements.HeatParameterDataDefinition; import org.openecomp.sdc.be.model.ArtifactDefinition; -import org.openecomp.sdc.be.model.HeatParameterDefinition; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.ci.tests.api.ComponentBaseTest; import org.openecomp.sdc.ci.tests.datatypes.ArtifactReqDetails; @@ -24,7 +24,6 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.Map; -import org.apache.log4j.lf5.util.ResourceUtils; import org.json.simple.JSONArray; import org.json.simple.JSONObject; import org.json.simple.JSONValue; @@ -49,7 +48,6 @@ import org.openecomp.sdc.ci.tests.utils.rest.CatalogRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.LifecycleRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; -import org.openecomp.sdc.ci.tests.utils.rest.ServiceRestUtils; import org.testng.AssertJUnit; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; @@ -54,7 +54,6 @@ import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.datatypes.expected.ExpectedCategoryAudit; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; import org.openecomp.sdc.ci.tests.utils.DbUtils; -import org.openecomp.sdc.ci.tests.utils.Utils; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.CategoryRestUtils; @@ -62,7 +61,6 @@ import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; import org.openecomp.sdc.ci.tests.utils.validation.AuditValidationUtils; import org.openecomp.sdc.ci.tests.utils.validation.CategoryValidationUtils; import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils; -import org.testng.SkipException; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; @@ -26,7 +26,6 @@ import static org.testng.AssertJUnit.assertNotNull; import java.util.HashMap; import java.util.Map; -import org.apache.log4j.lf5.util.ResourceUtils; import org.json.simple.JSONArray; import org.json.simple.JSONObject; import org.json.simple.JSONValue; @@ -48,15 +47,6 @@ public class ElementsApiTest extends ComponentBaseTest { super(name, ElementsApiTest.class.getName()); } - // public LCSbaseTest(TestName testName, String className) { - // super(testName, className); - // } - - // public ElementsApiTest(TestName name, String name2) { - //// super(name, name2); - // // TODO Auto-generated constructor stub - // } - // Expected 200 Keep @Test public void getAllPropertyScopesSuccess() throws Exception { @@ -32,9 +32,6 @@ import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.STATUS_CODE_RE import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.STATUS_CODE_SUCCESS; import static org.testng.AssertJUnit.assertEquals; -import java.util.ArrayList; -import java.util.List; - import org.junit.Rule; import org.junit.rules.TestName; import org.openecomp.sdc.be.dao.api.ActionStatus; @@ -47,7 +44,6 @@ import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.datatypes.expected.ExpectedCategoryAudit; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; import org.openecomp.sdc.ci.tests.utils.DbUtils; -import org.openecomp.sdc.ci.tests.utils.Utils; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.openecomp.sdc.ci.tests.utils.rest.CategoryRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; @@ -47,7 +47,6 @@ import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.datatypes.expected.ExpectedCategoryAudit; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; import org.openecomp.sdc.ci.tests.utils.DbUtils; -import org.openecomp.sdc.ci.tests.utils.Utils; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.openecomp.sdc.ci.tests.utils.rest.CategoryRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; @@ -21,27 +21,18 @@ package org.openecomp.sdc.ci.tests.execute.devCI; import java.io.File; -import java.io.IOException; import java.text.SimpleDateFormat; -import java.util.ArrayList; import java.util.Date; import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; import java.util.Map; +import org.openecomp.sdc.be.model.PropertyDefinition; +import org.openecomp.sdc.be.model.Resource; +import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaDefinition; import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaTopologyTemplateDefinition; import org.openecomp.sdc.ci.tests.utils.ToscaParserUtils; import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils; -import org.openecomp.sdc.tosca.parser.api.ISdcCsarHelper; -import org.openecomp.sdc.tosca.parser.exceptions.SdcToscaParserException; -import org.openecomp.sdc.tosca.parser.impl.SdcToscaParserFactory; -//import org.openecomp.sdc.toscaparser.api.Metadata; -import org.openecomp.sdc.toscaparser.api.Capability; -import org.openecomp.sdc.toscaparser.api.NodeTemplate; -import org.openecomp.sdc.toscaparser.api.common.JToscaException; -import org.testng.annotations.Test; public class AndreyTest { @@ -70,14 +61,14 @@ public class AndreyTest { toscaMainAmdocsDefinition = ToscaParserUtils.parseToscaMainYamlToJavaObjectByCsarLocation(new File(filesFolder.getPath() + amdocsCsarFileName)); toscaMainVfDefinition = ToscaParserUtils.parseToscaMainYamlToJavaObjectByCsarLocation(new File(filesFolder.getPath() + VfCsarFileName)); toscaMainServiceDefinition = ToscaParserUtils.parseToscaMainYamlToJavaObjectByCsarLocation(new File(filesFolder.getPath() + serviceCsarFileName)); -// Resource resource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, "Generic_VF", "1.0"); + Resource resource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, "Generic_VF", "1.0"); ToscaTopologyTemplateDefinition topologyTemplate = toscaMainAmdocsDefinition.getTopology_template(); // FileHandling.parseYamlFileToMapByPattern("",""); -// Map<String, Object> newInput = new HashMap<String, Object>(); -// for (PropertyDefinition property : resource.getProperties()) { -// newInput.put(property.getName(),property); -// } + Map<String, Object> newInput = new HashMap<String, Object>(); + for (PropertyDefinition property : resource.getProperties()) { + newInput.put(property.getName(),property); + } // topologyTemplate.addInputs(newInput); // @@ -104,7 +95,7 @@ public class AndreyTest { } - @Test + /*@Test public void distributionTest() throws SdcToscaParserException, JToscaException, IOException { //String serviceName = import and create().getName(); //getServiceObject(); @@ -157,6 +148,6 @@ public class AndreyTest { ArrayList<Object> requirements2 = nodeTemplate.getRequirements(); } - } + }*/ } @@ -28,10 +28,8 @@ import java.nio.file.DirectoryStream; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; -import java.text.SimpleDateFormat; import java.util.Arrays; import java.util.Collection; -import java.util.Collections; import java.util.HashMap; import java.util.LinkedList; import java.util.List; @@ -53,7 +51,6 @@ public class ArtifactFromCsar { public static void main(String[] args) throws Exception { - // TODO Auto-generated method stub String zipFile = "C:\\Users\\rp955r\\Documents\\InTesting\\resource-CivfonboardedFdnt2f792348-csar.csar"; // Map<String, Object> combinedMap = combineHeatArtifacstWithFolderArtifacsToMap(zipFile); @@ -138,7 +135,6 @@ public class ArtifactFromCsar { try { map.put(file.getName(), getMapArtifactFromFolderStructure(file)); } catch (IOException e) { - // TODO Auto-generated catch block e.printStackTrace(); } } @@ -20,20 +20,15 @@ package org.openecomp.sdc.ci.tests.execute.devCI; -import static org.testng.AssertJUnit.assertTrue; - import org.junit.Rule; import org.junit.rules.TestName; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.Resource; -import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.ci.tests.api.ComponentBaseTest; import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; -import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum; -import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; import org.openecomp.sdc.ci.tests.execute.imports.ImportCsarResourceTest; @@ -42,7 +37,6 @@ import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; -import org.openecomp.sdc.ci.tests.utils.validation.CsarValidationUtils; import org.testng.annotations.AfterTest; import org.testng.annotations.BeforeTest; import org.testng.annotations.DataProvider; @@ -25,16 +25,11 @@ import static org.testng.AssertJUnit.assertTrue; import org.junit.Rule; import org.junit.rules.TestName; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; -import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.Resource; -import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.ci.tests.api.ComponentBaseTest; import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; -import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum; -import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; -import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils; @@ -20,41 +20,11 @@ package org.openecomp.sdc.ci.tests.execute.devCI; -import static org.testng.AssertJUnit.assertEquals; - -import java.util.HashMap; -import java.util.Map; - -import org.apache.commons.lang3.tuple.Pair; import org.junit.Rule; import org.junit.rules.TestName; -import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; -import org.openecomp.sdc.be.model.Component; -import org.openecomp.sdc.be.model.Resource; -import org.openecomp.sdc.be.model.Service; -import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.ci.tests.api.ComponentBaseTest; -import org.openecomp.sdc.ci.tests.api.Urls; -import org.openecomp.sdc.ci.tests.config.Config; -import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; -import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum; -import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum; -import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; -import org.openecomp.sdc.ci.tests.datatypes.http.HttpHeaderEnum; -import org.openecomp.sdc.ci.tests.datatypes.http.HttpRequest; -import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; -import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaDefinition; -import org.openecomp.sdc.ci.tests.utils.ToscaParserUtils; -import org.openecomp.sdc.ci.tests.utils.Utils; -import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils; -import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; -import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils; -import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils; -import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; -import org.openecomp.sdc.ci.tests.utils.validation.CsarValidationUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.testng.annotations.Test; public class ToscaGroupInsideVF extends ComponentBaseTest { private static Logger logger = LoggerFactory.getLogger(ToscaGroupInsideVF.class.getName()); @@ -31,7 +31,6 @@ import java.util.Map; import java.util.zip.ZipInputStream; import org.apache.commons.codec.binary.Base64; -import org.apache.log4j.lf5.util.ResourceUtils; import org.junit.Rule; import org.junit.rules.TestName; import org.openecomp.sdc.be.datatypes.elements.ConsumerDataDefinition; @@ -53,7 +52,6 @@ import org.openecomp.sdc.ci.tests.datatypes.expected.ExpectedDistDownloadAudit; import org.openecomp.sdc.ci.tests.datatypes.http.HttpHeaderEnum; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; import org.openecomp.sdc.ci.tests.utils.Utils; -import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.openecomp.sdc.ci.tests.utils.rest.ArtifactRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils; @@ -66,7 +64,6 @@ import org.openecomp.sdc.common.api.Constants; import org.openecomp.sdc.common.util.GeneralUtility; import org.openecomp.sdc.common.util.ValidationUtils; import org.testng.AssertJUnit; -import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; @@ -52,7 +52,6 @@ import org.openecomp.sdc.ci.tests.datatypes.expected.ExpectedAuthenticationAudit import org.openecomp.sdc.ci.tests.datatypes.http.HttpHeaderEnum; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; import org.openecomp.sdc.ci.tests.utils.DbUtils; -import org.openecomp.sdc.ci.tests.utils.Utils; import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.openecomp.sdc.ci.tests.utils.rest.ArtifactRestUtils; @@ -35,7 +35,6 @@ import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.datatypes.expected.ExpectedEcomConsumerAudit; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; import org.openecomp.sdc.ci.tests.utils.DbUtils; -import org.openecomp.sdc.ci.tests.utils.Utils; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.openecomp.sdc.ci.tests.utils.rest.ConsumerRestUtils; import org.openecomp.sdc.ci.tests.utils.validation.AuditValidationUtils; @@ -25,7 +25,6 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import java.io.ByteArrayInputStream; -import java.io.File; import java.io.IOException; import java.io.InputStream; import java.util.Map; @@ -33,7 +32,6 @@ import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; import org.apache.commons.codec.binary.Base64; -import org.apache.commons.io.FileUtils; import org.junit.Rule; import org.junit.rules.TestName; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; @@ -39,8 +39,6 @@ import java.util.stream.Collectors; import org.apache.commons.codec.binary.Base64; import org.apache.commons.lang.WordUtils; -import org.apache.commons.lang3.tuple.ImmutablePair; -import org.apache.tinkerpop.gremlin.process.traversal.P; import org.junit.Rule; import org.junit.rules.TestName; import org.openecomp.sdc.be.dao.api.ActionStatus; @@ -49,14 +47,11 @@ import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.model.ArtifactDefinition; import org.openecomp.sdc.be.model.CapabilityDefinition; import org.openecomp.sdc.be.model.ComponentInstance; -import org.openecomp.sdc.be.model.ComponentInstanceProperty; import org.openecomp.sdc.be.model.GroupDefinition; -import org.openecomp.sdc.be.model.GroupProperty; import org.openecomp.sdc.be.model.RequirementCapabilityRelDef; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.be.model.tosca.ToscaPropertyType; import org.openecomp.sdc.ci.tests.api.ComponentBaseTest; import org.openecomp.sdc.ci.tests.api.Urls; import org.openecomp.sdc.ci.tests.config.Config; @@ -83,7 +78,6 @@ import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; import org.openecomp.sdc.ci.tests.utils.rest.ServiceRestUtils; import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils; -import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum; import org.openecomp.sdc.common.util.ValidationUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -1522,8 +1516,8 @@ public class ImportCsarResourceTest extends ComponentBaseTest { String cp1Uid = nodes.get("cp1node").getUniqueId(); String cp2Uid = nodes.get("cp2node").getUniqueId(); Map<String, List<RequirementCapabilityRelDef>> mappedByReqOwner = resource.getComponentInstancesRelations().stream().collect(Collectors.groupingBy(e -> e.getFromNode())); - assertEquals(mappedByReqOwner.get(cp1Uid).get(0).getRelationships().get(0).getCapabilityUid(), capabilities.get("virtual_linkable").getUniqueId()); - assertEquals(mappedByReqOwner.get(cp2Uid).get(0).getRelationships().get(0).getCapabilityUid(), capabilities.get("link").getUniqueId()); + assertEquals(mappedByReqOwner.get(cp1Uid).get(0).getRelationships().get(0).getRelation().getCapabilityUid(), capabilities.get("virtual_linkable").getUniqueId()); + assertEquals(mappedByReqOwner.get(cp2Uid).get(0).getRelationships().get(0).getRelation().getCapabilityUid(), capabilities.get("link").getUniqueId()); } @Test(enabled = true) @@ -46,7 +46,6 @@ import org.apache.http.entity.mime.content.FileBody; import org.apache.http.entity.mime.content.StringBody; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; - import org.junit.Rule; import org.junit.rules.TestName; import org.openecomp.sdc.be.model.LifecycleStateEnum; @@ -38,7 +38,6 @@ import org.junit.Rule; import org.junit.rules.TestName; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; -import org.openecomp.sdc.be.model.ArtifactDefinition; import org.openecomp.sdc.be.model.LifecycleStateEnum; import org.openecomp.sdc.be.model.PropertyDefinition; import org.openecomp.sdc.be.model.Resource; @@ -56,12 +55,9 @@ import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.datatypes.expected.ExpectedResourceAuditJavaObject; import org.openecomp.sdc.ci.tests.datatypes.http.HttpRequest; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; -import org.openecomp.sdc.ci.tests.utils.ArtifactUtils; import org.openecomp.sdc.ci.tests.utils.DbUtils; -import org.openecomp.sdc.ci.tests.utils.Utils; import org.openecomp.sdc.ci.tests.utils.general.Convertor; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; -import org.openecomp.sdc.ci.tests.utils.rest.ArtifactRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ImportRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.LifecycleRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils; @@ -71,7 +67,6 @@ import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils; import org.openecomp.sdc.ci.tests.utils.validation.ResourceValidationUtils; import org.openecomp.sdc.common.api.Constants; import org.openecomp.sdc.common.util.GeneralUtility; -import org.openecomp.sdc.exception.ResponseFormat; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; @@ -48,11 +48,12 @@ import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.model.CapReqDef; import org.openecomp.sdc.be.model.CapabilityDefinition; +import org.openecomp.sdc.be.model.CapabilityRequirementRelationship; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.LifecycleStateEnum; import org.openecomp.sdc.be.model.PropertyDefinition; import org.openecomp.sdc.be.model.RelationshipImpl; -import org.openecomp.sdc.be.model.RequirementAndRelationshipPair; +import org.openecomp.sdc.be.model.RelationshipInfo; import org.openecomp.sdc.be.model.RequirementCapabilityRelDef; import org.openecomp.sdc.be.model.RequirementDefinition; import org.openecomp.sdc.be.model.Resource; @@ -94,8 +95,6 @@ import org.testng.annotations.BeforeMethod; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; -import aj.org.objectweb.asm.Attribute; - /** * * @author Andrey + Pavel + Shay @@ -1341,7 +1340,7 @@ public class ImportToscaResourceTest extends ComponentBaseTest { requirementDef.setFromNode(riReq.getUniqueId()); requirementDef.setToNode(riCap.getUniqueId()); - RequirementAndRelationshipPair pair = new RequirementAndRelationshipPair(); + RelationshipInfo pair = new RelationshipInfo(); pair.setRequirementOwnerId(riReq.getUniqueId()); pair.setCapabilityOwnerId(riCap.getUniqueId()); pair.setRequirement("VirtualBinding"); @@ -1350,8 +1349,10 @@ public class ImportToscaResourceTest extends ComponentBaseTest { pair.setRelationships(relationship); pair.setCapabilityUid(capbilityUid); pair.setRequirementUid(requirementUid); - List<RequirementAndRelationshipPair> relationships = new ArrayList<>(); - relationships.add(pair); + List<CapabilityRequirementRelationship> relationships = new ArrayList<>(); + CapabilityRequirementRelationship capReqRel = new CapabilityRequirementRelationship(); + relationships.add(capReqRel); + capReqRel.setRelation(pair); requirementDef.setRelationships(relationships); RestResponse associateInstances = ComponentInstanceRestUtils.associateInstances(requirementDef, sdncUserDetails, @@ -21,7 +21,6 @@ package org.openecomp.sdc.ci.tests.execute.imports; import static org.testng.AssertJUnit.assertTrue; -import static org.testng.AssertJUnit.assertEquals; import java.nio.file.Files; import java.nio.file.Path; @@ -34,7 +34,6 @@ import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum; import org.openecomp.sdc.ci.tests.datatypes.expected.ExpectedProductAudit; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; import org.openecomp.sdc.ci.tests.utils.DbUtils; -import org.openecomp.sdc.ci.tests.utils.Utils; import org.openecomp.sdc.ci.tests.utils.general.Convertor; import org.openecomp.sdc.ci.tests.utils.rest.LifecycleRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ProductRestUtils; @@ -38,7 +38,6 @@ import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.datatypes.expected.ExpectedProductAudit; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; import org.openecomp.sdc.ci.tests.utils.DbUtils; -import org.openecomp.sdc.ci.tests.utils.Utils; import org.openecomp.sdc.ci.tests.utils.general.Convertor; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils; @@ -34,13 +34,10 @@ import org.junit.rules.TestName; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.model.LifecycleStateEnum; import org.openecomp.sdc.be.model.Product; -import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.model.category.CategoryDefinition; import org.openecomp.sdc.ci.tests.api.Urls; import org.openecomp.sdc.ci.tests.datatypes.ProductReqDetails; -import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; -import org.openecomp.sdc.ci.tests.datatypes.ResourceRespJavaObject; import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.datatypes.expected.ExpectedProductAudit; @@ -52,13 +49,10 @@ import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.CatalogRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.LifecycleRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ProductRestUtils; -import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; -import org.openecomp.sdc.ci.tests.utils.rest.ServiceRestUtils; import org.openecomp.sdc.ci.tests.utils.validation.AuditValidationUtils; import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils; import org.openecomp.sdc.ci.tests.utils.validation.ProductValidationUtils; -import org.openecomp.sdc.ci.tests.utils.validation.ResourceValidationUtils; import org.openecomp.sdc.common.api.Constants; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -28,7 +28,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import org.apache.log4j.lf5.util.ResourceUtils; import org.json.simple.JSONObject; import org.json.simple.JSONValue; import org.junit.Rule; @@ -46,7 +45,6 @@ import org.openecomp.sdc.ci.tests.datatypes.http.HttpHeaderEnum; import org.openecomp.sdc.ci.tests.datatypes.http.HttpRequest; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; import org.openecomp.sdc.ci.tests.preRequisites.SimpleOneRsrcOneServiceTest; -import org.openecomp.sdc.ci.tests.utils.Utils; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.openecomp.sdc.ci.tests.utils.rest.PropertyRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils; @@ -57,8 +55,6 @@ import org.testng.AssertJUnit; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; -import com.google.gson.Gson; - public class PropertyApisTest extends SimpleOneRsrcOneServiceTest { protected static final String RESOURCE_CATEGORY = "Generic/Databases"; @@ -25,7 +25,6 @@ import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; import org.openecomp.sdc.common.util.SerializationUtils; -import org.testng.annotations.Test; import fj.data.Either; @@ -39,9 +39,10 @@ import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.model.CapReqDef; import org.openecomp.sdc.be.model.CapabilityDefinition; +import org.openecomp.sdc.be.model.CapabilityRequirementRelationship; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.RelationshipImpl; -import org.openecomp.sdc.be.model.RequirementAndRelationshipPair; +import org.openecomp.sdc.be.model.RelationshipInfo; import org.openecomp.sdc.be.model.RequirementCapabilityRelDef; import org.openecomp.sdc.be.model.RequirementDefinition; import org.openecomp.sdc.be.model.Resource; @@ -119,7 +120,7 @@ public class ComponentRelationshipInVfTest extends ComponentBaseTest { requirementDef.setFromNode(riReq.getUniqueId()); requirementDef.setToNode(riCap.getUniqueId()); - RequirementAndRelationshipPair pair = new RequirementAndRelationshipPair(); + RelationshipInfo pair = new RelationshipInfo(); pair.setRequirementOwnerId(riReq.getUniqueId()); pair.setCapabilityOwnerId(riCap.getUniqueId()); pair.setRequirement("host"); @@ -128,8 +129,10 @@ public class ComponentRelationshipInVfTest extends ComponentBaseTest { pair.setRelationships(relationship); pair.setCapabilityUid(capbilityUid); pair.setRequirementUid(requirementUid); - List<RequirementAndRelationshipPair> relationships = new ArrayList<>(); - relationships.add(pair); + List<CapabilityRequirementRelationship> relationships = new ArrayList<>(); + CapabilityRequirementRelationship capReqRel = new CapabilityRequirementRelationship(); + relationships.add(capReqRel); + capReqRel.setRelation(pair); requirementDef.setRelationships(relationships); return requirementDef; } @@ -179,7 +182,7 @@ public class ComponentRelationshipInVfTest extends ComponentBaseTest { requirementDef.setFromNode(riReq.getUniqueId()); requirementDef.setToNode(riCap.getUniqueId()); - RequirementAndRelationshipPair pair = new RequirementAndRelationshipPair(); + RelationshipInfo pair = new RelationshipInfo(); pair.setRequirementOwnerId(riReq.getUniqueId()); pair.setCapabilityOwnerId(riCap.getUniqueId()); pair.setRequirement("host"); @@ -188,8 +191,10 @@ public class ComponentRelationshipInVfTest extends ComponentBaseTest { pair.setRelationships(relationship); pair.setCapabilityUid(capList.get(0).getUniqueId()); pair.setRequirementUid(reqList.get(0).getUniqueId()); - List<RequirementAndRelationshipPair> relationships = new ArrayList<>(); - relationships.add(pair); + List<CapabilityRequirementRelationship> relationships = new ArrayList<>(); + CapabilityRequirementRelationship capReqRel = new CapabilityRequirementRelationship(); + relationships.add(capReqRel); + capReqRel.setRelation(pair); requirementDef.setRelationships(relationships); RestResponse associateInstances = ComponentInstanceRestUtils.associateInstances(requirementDef, designerUser, @@ -979,7 +984,7 @@ public class ComponentRelationshipInVfTest extends ComponentBaseTest { RequirementCapabilityRelDef requirementDef = setRelationshipBetweenInstances(riReq, riCap, capReqDefBeforeAssociate); assertTrue(requirementDef.getRelationships().size() == 1); - String requirement = requirementDef.getRelationships().get(0).getRequirement(); + String requirement = requirementDef.getRelationships().get(0).getRelation().getRequirement(); RestResponse associateInstances = ComponentInstanceRestUtils.associateInstances(requirementDef, designerUser, resourceDetailsVF.getUniqueId(), ComponentTypeEnum.RESOURCE); assertEquals("Check response code ", 404, associateInstances.getErrorCode().intValue()); @@ -1122,7 +1127,7 @@ public class ComponentRelationshipInVfTest extends ComponentBaseTest { .getCapabilities(); Map<String, List<RequirementDefinition>> requirementsBeforeAssociate = capReqDefBeforeAssociate .getRequirements(); - String requirementName = requirementDef.getRelationships().get(0).getRequirement(); + String requirementName = requirementDef.getRelationships().get(0).getRelation().getRequirement(); RestResponse dissociateInstances = ComponentInstanceRestUtils.dissociateInstances(requirementDef, designerUser, resourceDetailsVF.getUniqueId(), ComponentTypeEnum.RESOURCE); @@ -23,7 +23,6 @@ package org.openecomp.sdc.ci.tests.execute.resource; import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.STATUS_CODE_SUCCESS; import static org.testng.AssertJUnit.assertEquals; import static org.testng.AssertJUnit.assertNotNull; -import static org.testng.AssertJUnit.assertTrue; import java.util.ArrayList; import java.util.Arrays; @@ -31,18 +30,13 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import javax.validation.constraints.AssertTrue; - -import org.apache.log4j.lf5.util.ResourceUtils; import org.junit.Rule; import org.junit.rules.TestName; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; -import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.LifecycleStateEnum; import org.openecomp.sdc.be.model.Resource; -import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.ci.tests.api.ComponentBaseTest; import org.openecomp.sdc.ci.tests.api.Urls; @@ -52,7 +46,6 @@ import org.openecomp.sdc.ci.tests.datatypes.ComponentInstanceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.ResourceRespJavaObject; import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; -import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.ErrorInfo; import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum; @@ -65,7 +58,6 @@ import org.openecomp.sdc.ci.tests.datatypes.http.HttpRequest; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; import org.openecomp.sdc.ci.tests.utils.DbUtils; import org.openecomp.sdc.ci.tests.utils.Utils; -import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils; import org.openecomp.sdc.ci.tests.utils.general.Convertor; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.openecomp.sdc.ci.tests.utils.rest.ArtifactRestUtils; @@ -78,7 +70,6 @@ import org.openecomp.sdc.ci.tests.utils.rest.ServiceRestUtils; import org.openecomp.sdc.ci.tests.utils.validation.AuditValidationUtils; import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils; import org.openecomp.sdc.ci.tests.utils.validation.ResourceValidationUtils; -import org.openecomp.sdc.ci.tests.utils.validation.ServiceValidationUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.testng.annotations.Test; @@ -27,7 +27,6 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.Map; -import org.apache.log4j.lf5.util.ResourceUtils; import org.junit.rules.TestName; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.User; @@ -38,7 +37,6 @@ import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; import org.openecomp.sdc.ci.tests.utils.DbUtils; -import org.openecomp.sdc.ci.tests.utils.Utils; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.openecomp.sdc.ci.tests.utils.rest.LifecycleRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils; @@ -30,7 +30,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import org.apache.log4j.lf5.util.ResourceUtils; import org.junit.Rule; import org.junit.rules.TestName; import org.openecomp.sdc.be.model.User; @@ -45,7 +44,6 @@ import org.openecomp.sdc.ci.tests.datatypes.http.HttpHeaderEnum; import org.openecomp.sdc.ci.tests.datatypes.http.HttpRequest; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; import org.openecomp.sdc.ci.tests.execute.imports.ImportGenericResourceCITest; -import org.openecomp.sdc.ci.tests.utils.Utils; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils; import org.slf4j.Logger; @@ -33,7 +33,6 @@ import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.util.EntityUtils; -import org.apache.log4j.lf5.util.ResourceUtils; import org.json.simple.JSONArray; import org.json.simple.JSONObject; import org.json.simple.JSONValue; @@ -40,7 +40,6 @@ import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.model.LifecycleStateEnum; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.be.model.category.CategoryDefinition; import org.openecomp.sdc.ci.tests.api.ComponentBaseTest; import org.openecomp.sdc.ci.tests.api.Urls; import org.openecomp.sdc.ci.tests.config.Config; @@ -432,7 +431,6 @@ public class UpdateResourceMetadataTest extends ComponentBaseTest { return ResourceResponse; } catch (FileNotFoundException e) { - // TODO Auto-generated catch block e.printStackTrace(); } @@ -57,7 +57,6 @@ import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils; import org.testng.annotations.BeforeMethod; -import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; import com.google.gson.Gson; @@ -23,7 +23,6 @@ package org.openecomp.sdc.ci.tests.execute.resource; import static org.testng.AssertJUnit.assertNotNull; import static org.testng.AssertJUnit.assertTrue; -import java.io.IOException; import java.util.List; import org.json.simple.JSONArray; @@ -32,8 +31,6 @@ import org.json.simple.JSONValue; import org.junit.Rule; import org.junit.rules.TestName; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; -import org.openecomp.sdc.be.model.ArtifactDefinition; -import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.User; @@ -46,7 +43,6 @@ import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; -import org.openecomp.sdc.ci.tests.execute.lifecycle.LCSbaseTest; import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.openecomp.sdc.ci.tests.utils.rest.LifecycleRestUtils; @@ -40,10 +40,11 @@ import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.model.CapReqDef; import org.openecomp.sdc.be.model.CapabilityDefinition; +import org.openecomp.sdc.be.model.CapabilityRequirementRelationship; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.LifecycleStateEnum; import org.openecomp.sdc.be.model.RelationshipImpl; -import org.openecomp.sdc.be.model.RequirementAndRelationshipPair; +import org.openecomp.sdc.be.model.RelationshipInfo; import org.openecomp.sdc.be.model.RequirementCapabilityRelDef; import org.openecomp.sdc.be.model.RequirementDefinition; import org.openecomp.sdc.be.model.Resource; @@ -1686,7 +1687,7 @@ public class VfComponentInstanceCRUDTest extends ComponentInstanceBaseTest { requirementDef.setFromNode(riReq.getUniqueId()); requirementDef.setToNode(riCap.getUniqueId()); - RequirementAndRelationshipPair pair = new RequirementAndRelationshipPair(); + RelationshipInfo pair = new RelationshipInfo(); pair.setRequirementOwnerId(riReq.getUniqueId()); pair.setCapabilityOwnerId(riCap.getUniqueId()); pair.setRequirement("host"); @@ -1695,8 +1696,10 @@ public class VfComponentInstanceCRUDTest extends ComponentInstanceBaseTest { pair.setRelationships(relationship); pair.setCapabilityUid(capList.get(0).getUniqueId()); pair.setRequirementUid(reqList.get(0).getUniqueId()); - List<RequirementAndRelationshipPair> relationships = new ArrayList<>(); - relationships.add(pair); + List<CapabilityRequirementRelationship> relationships = new ArrayList<>(); + CapabilityRequirementRelationship capReqRel = new CapabilityRequirementRelationship(); + relationships.add(capReqRel); + capReqRel.setRelation(pair); requirementDef.setRelationships(relationships); RestResponse associateInstances = ComponentInstanceRestUtils.associateInstances(requirementDef, @@ -32,7 +32,6 @@ import org.junit.Rule; import org.junit.rules.TestName; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; -import org.openecomp.sdc.be.model.ArtifactDefinition; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.DistributionStatusEnum; import org.openecomp.sdc.be.model.LifecycleStateEnum; @@ -45,7 +44,6 @@ import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.ErrorInfo; import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum; -import org.openecomp.sdc.ci.tests.datatypes.enums.ServiceCategoriesEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.datatypes.expected.ExpectedResourceAuditJavaObject; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; @@ -61,8 +59,6 @@ import org.openecomp.sdc.ci.tests.utils.validation.ServiceValidationUtils; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; -import fj.data.Either; - public class ChangeServiceDistributionStatusApiTest extends ComponentBaseTest { protected ResourceReqDetails resourceDetails; @@ -20,7 +20,6 @@ package org.openecomp.sdc.ci.tests.execute.service; -import static org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils.STATUS_CODE_SUCCESS; import static org.testng.AssertJUnit.assertEquals; import static org.testng.AssertJUnit.assertNotNull; @@ -37,7 +36,6 @@ import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.LifecycleStateEnum; -import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.ci.tests.api.ComponentBaseTest; @@ -49,7 +47,6 @@ import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.ErrorInfo; import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum; -import org.openecomp.sdc.ci.tests.datatypes.enums.ServiceCategoriesEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.datatypes.expected.ExpectedResourceAuditJavaObject; import org.openecomp.sdc.ci.tests.datatypes.http.HttpHeaderEnum; @@ -63,7 +60,6 @@ import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ComponentInstanceRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.LifecycleRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ProductRestUtils; -import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; import org.openecomp.sdc.ci.tests.utils.rest.ServiceRestUtils; import org.openecomp.sdc.ci.tests.utils.validation.AuditValidationUtils; @@ -28,7 +28,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import org.apache.cassandra.transport.Event.SchemaChange.Target; import org.junit.Rule; import org.junit.rules.TestName; import org.openecomp.sdc.be.dao.api.ActionStatus; @@ -27,10 +27,8 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.stream.Collectors; import org.apache.http.HttpStatus; -import org.apache.log4j.lf5.util.ResourceUtils; import org.junit.Rule; import org.junit.rules.TestName; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; @@ -67,7 +65,6 @@ import org.testng.annotations.Test; import com.google.gson.JsonArray; import com.google.gson.JsonElement; -import com.google.gson.JsonObject; import fj.data.Either; @@ -46,7 +46,6 @@ import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.ServiceCategoriesEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; -import org.openecomp.sdc.ci.tests.utils.Utils; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.openecomp.sdc.ci.tests.utils.rest.ArtifactRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.LifecycleRestUtils; @@ -39,10 +39,11 @@ import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.model.CapReqDef; import org.openecomp.sdc.be.model.CapabilityDefinition; +import org.openecomp.sdc.be.model.CapabilityRequirementRelationship; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.RelationshipImpl; -import org.openecomp.sdc.be.model.RequirementAndRelationshipPair; +import org.openecomp.sdc.be.model.RelationshipInfo; import org.openecomp.sdc.be.model.RequirementCapabilityRelDef; import org.openecomp.sdc.be.model.RequirementDefinition; import org.openecomp.sdc.be.model.Resource; @@ -1045,7 +1046,7 @@ public class ReqCapOccurrencesTest extends ComponentInstanceBaseTest { requirementDef.setFromNode(riReq.getUniqueId()); requirementDef.setToNode(riCap.getUniqueId()); - RequirementAndRelationshipPair pair = new RequirementAndRelationshipPair(); + RelationshipInfo pair = new RelationshipInfo(); pair.setRequirementOwnerId(riReq.getUniqueId()); pair.setCapabilityOwnerId(riCap.getUniqueId()); pair.setRequirement("host"); @@ -1054,8 +1055,10 @@ public class ReqCapOccurrencesTest extends ComponentInstanceBaseTest { pair.setRelationships(relationship); pair.setCapabilityUid(capbilityUid); pair.setRequirementUid(requirementUid); - List<RequirementAndRelationshipPair> relationships = new ArrayList<>(); - relationships.add(pair); + List<CapabilityRequirementRelationship> relationships = new ArrayList<>(); + CapabilityRequirementRelationship capReqRel = new CapabilityRequirementRelationship(); + relationships.add(capReqRel); + capReqRel.setRelation(pair); requirementDef.setRelationships(relationships); return requirementDef; } @@ -42,7 +42,6 @@ import org.openecomp.sdc.be.model.RequirementCapabilityRelDef; import org.openecomp.sdc.be.model.RequirementDefinition; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.ci.tests.api.ComponentInstanceBaseTest; -import org.openecomp.sdc.ci.tests.api.Urls; import org.openecomp.sdc.ci.tests.datatypes.ArtifactReqDetails; import org.openecomp.sdc.ci.tests.datatypes.ComponentInstanceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.ComponentReqDetails; @@ -50,10 +49,8 @@ import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum; -import org.openecomp.sdc.ci.tests.datatypes.enums.ServiceCategoriesEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; -import org.openecomp.sdc.ci.tests.utils.Utils; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.openecomp.sdc.ci.tests.utils.rest.ArtifactRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ComponentInstanceRestUtils; @@ -45,7 +45,6 @@ import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum; -import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.ServiceCategoriesEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; @@ -47,9 +47,7 @@ import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; -import org.openecomp.sdc.ci.tests.execute.lifecycle.LCSbaseTest; import org.openecomp.sdc.ci.tests.utils.DbUtils; -import org.openecomp.sdc.ci.tests.utils.Utils; import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.openecomp.sdc.ci.tests.utils.rest.ArtifactRestUtils; @@ -35,17 +35,11 @@ import java.util.jar.JarEntry; import java.util.jar.JarFile; import org.apache.log4j.PropertyConfigurator; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.openecomp.sdc.ci.tests.config.Config; import org.openecomp.sdc.ci.tests.utils.Utils; -//import org.junit.runner.JUnitCore; -//import org.junit.runner.Result; -//import org.junit.runner.notification.Failure; -import org.testng.TestListenerAdapter; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.testng.TestNG; -import org.testng.reporters.TestHTMLReporter; -import org.testng.xml.XmlSuite; public class StartTest { @@ -73,7 +67,6 @@ public class StartTest { try { config = Utils.getConfig(); } catch (FileNotFoundException e) { - // TODO Auto-generated catch block e.printStackTrace(); } @@ -72,7 +72,6 @@ public class StartTest2backup { try { config = Utils.getConfig(); } catch (FileNotFoundException e) { - // TODO Auto-generated catch block e.printStackTrace(); } @@ -20,14 +20,14 @@ package org.openecomp.sdc.ci.tests.sanity; +import static org.testng.AssertJUnit.assertTrue; + import java.util.ArrayList; import java.util.List; -import java.util.Map; import org.junit.Rule; import org.junit.rules.TestName; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; -import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.ci.tests.api.ComponentBaseTest; @@ -43,7 +43,6 @@ import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.openecomp.sdc.ci.tests.utils.rest.ComponentInstanceRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ProductRestUtils; import org.testng.annotations.Test; -import static org.testng.AssertJUnit.assertTrue; public class MultipleResourceUpdate extends ComponentBaseTest { @@ -21,38 +21,34 @@ package org.openecomp.sdc.ci.tests.sanity; -import com.aventstack.extentreports.Status; -import com.clearspring.analytics.util.Pair; -import fj.data.Either; import org.junit.Rule; import org.junit.rules.TestName; -import org.openecomp.sdc.be.datatypes.enums.AssetTypeEnum; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.ci.tests.api.ComponentBaseTest; import org.openecomp.sdc.ci.tests.api.ExtentTestActions; -import org.openecomp.sdc.ci.tests.dataProviders.OnboardingDataProviders; +import org.openecomp.sdc.ci.tests.dataProviders.OnbordingDataProviders; import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.VendorSoftwareProductObject; import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; -import org.openecomp.sdc.ci.tests.utils.CsarToscaTester; import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.openecomp.sdc.ci.tests.utils.general.OnboardingUtillViaApis; -import org.openecomp.sdc.ci.tests.utils.rest.AssetRestUtils; -import org.openecomp.sdc.tosca.parser.api.ISdcCsarHelper; -import org.openecomp.sdc.tosca.parser.impl.SdcToscaParserFactory; +import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Optional; import org.testng.annotations.Parameters; import org.testng.annotations.Test; -import java.io.File; +import com.aventstack.extentreports.Status; +import com.clearspring.analytics.util.Pair; + +import fj.data.Either; public class Onboard extends ComponentBaseTest { @@ -66,80 +62,81 @@ public class Onboard extends ComponentBaseTest { } protected String makeDistributionValue; - protected ISdcCsarHelper fdntCsarHelper; - protected SdcToscaParserFactory factory = SdcToscaParserFactory.getInstance(); - + protected String makeToscaValidationValue; @Parameters({ "makeDistribution" }) @BeforeMethod public void beforeTestReadParams(@Optional("true") String makeDistributionReadValue) { makeDistributionValue = makeDistributionReadValue; + logger.info("makeDistributionReadValue - > " + makeDistributionValue); + } + + @Parameters({ "makeToscaValidation" }) + @BeforeClass + public void makeToscaValidation(@Optional("false") String makeToscaValidationReadValue) { + makeToscaValidationValue = makeToscaValidationReadValue; + logger.info("makeToscaValidationReadValue - > " + makeToscaValidationValue); } - @Test(dataProviderClass = OnboardingDataProviders.class, dataProvider = "VNF_List") - public void onboardVNFShotFlow(String filepath, String vnfFile) throws Exception, Throwable { + @Test(dataProviderClass = OnbordingDataProviders.class, dataProvider = "VNF_List") + public void onboardVNFShotFlow(String filePath, String vnfFile) throws Exception, Throwable { setLog(vnfFile); - logger.info("Onboarding - > " + vnfFile); -// System.out.println("Onboarding - > " + vnfFile); - runOnboardToDistributionFlow(filepath, vnfFile); + System.out.println("print - >" + makeDistributionValue); + runOnboardToDistributionFlow(filePath, vnfFile); } - public void runOnboardToDistributionFlow(String filepath, String vnfFile) throws Exception { + public void runOnboardToDistributionFlow(String filePath, String vnfFile) throws Exception { ExtentTestActions.log(Status.INFO, String.format("Going to onboard the VNF %s", vnfFile)); - User user = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER); - - Pair<String, VendorSoftwareProductObject> createVendorSoftwareProduct = OnboardingUtillViaApis.createVspViaApis(filepath, vnfFile, user); + User user = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER3); + ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); + Pair<String, VendorSoftwareProductObject> createVendorSoftwareProduct = OnboardingUtillViaApis.createVspViaApis(resourceReqDetails, filePath, vnfFile, user); VendorSoftwareProductObject vendorSoftwareProductObject = createVendorSoftwareProduct.right; - vendorSoftwareProductObject.setVspName(createVendorSoftwareProduct.left); + vendorSoftwareProductObject.setName(createVendorSoftwareProduct.left); // create VF base on VNF imported from previous step - have, resourceReqDetails object include part of resource metadata - ResourceReqDetails resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(vendorSoftwareProductObject, vendorSoftwareProductObject.getVspName()); +// ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); + resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject); ExtentTestActions.log(Status.INFO, String.format("Create VF %s From VSP", resourceReqDetails.getName())); - Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails, vendorSoftwareProductObject.getVspName()); + Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails, UserRoleEnum.DESIGNER3); ExtentTestActions.log(Status.INFO, String.format("Certify VF")); - resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); + resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER3, LifeCycleStatesEnum.CERTIFY, true).getLeft(); //--------------------------SERVICE-------------------------------- ServiceReqDetails serviceReqDetails = OnboardingUtillViaApis.prepareServiceDetailsBeforeCreate(user); ExtentTestActions.log(Status.INFO, String.format("Create Service %s", serviceReqDetails.getName())); - Service service = AtomicOperationUtils.createCustomService(serviceReqDetails, UserRoleEnum.DESIGNER, true).left().value(); + Service service = AtomicOperationUtils.createCustomService(serviceReqDetails, UserRoleEnum.DESIGNER3, true).left().value(); ExtentTestActions.log(Status.INFO, String.format("add VF to Service")); - Either<ComponentInstance, RestResponse> addComponentInstanceToComponentContainer = AtomicOperationUtils.addComponentInstanceToComponentContainer(resource, service, UserRoleEnum.DESIGNER, true); + Either<ComponentInstance, RestResponse> addComponentInstanceToComponentContainer = AtomicOperationUtils.addComponentInstanceToComponentContainer(resource, service, UserRoleEnum.DESIGNER3, true); addComponentInstanceToComponentContainer.left().value(); ExtentTestActions.log(Status.INFO, String.format("Certify Service")); - service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); - - -// ExtentTestActions.log(Status.INFO, String.format("Distribute Service")); -// AtomicOperationUtils.distributeService(service, true); - try{ -// HttpResponse assetResponse = AssetRestUtils.getComponentToscaModel(AssetTypeEnum.SERVICES, service.getUUID()); -// InputStream inputStream = assetResponse.getEntity().getContent(); - File csarFile = AssetRestUtils.getToscaModelCsarFile(AssetTypeEnum.SERVICES, service.getUUID(), vnfFile); + service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER3, LifeCycleStatesEnum.CERTIFY, true).getLeft(); - ExtentTestActions.log(Status.INFO, "Tosca parser is going to convert service csar file to ISdcCsarHelper object..."); - fdntCsarHelper = factory.getSdcCsarHelper(csarFile.getAbsolutePath()); - CsarToscaTester.processCsar(fdntCsarHelper); + if (makeDistributionValue.equals("true")) { + ExtentTestActions.log(Status.INFO, String.format("Distribute Service")); + AtomicOperationUtils.distributeService(service, true); + } - ExtentTestActions.log(Status.INFO, String.format("Tosca parser successfully parsed service CSAR")); + if (makeToscaValidationValue.equals("true")) { - ExtentTestActions.log(Status.INFO, String.format("The onboarding %s test is passed ! ", vnfFile)); + ExtentTestActions.log(Status.INFO, String.format("Start tosca validation")); + AtomicOperationUtils.toscaValidation(service ,vnfFile); - }catch(Exception e){ - ExtentTestActions.log(Status.ERROR, "Tosca parser FAILED to convert service csar file to ISdcCsarHelper object..."); - ExtentTestActions.log(Status.FAIL, e); } + + ExtentTestActions.log(Status.INFO, String.format("The onboarding %s test is passed ! ", vnfFile)); } + + } @@ -20,8 +20,6 @@ package org.openecomp.sdc.ci.tests.tosca.datatypes; -import java.util.List; - public class ParametersDefinition { private String type; @@ -34,7 +32,6 @@ public class ParametersDefinition { public ParametersDefinition() { super(); - // TODO Auto-generated constructor stub } public ParametersDefinition(String type, String description, Object default1, String status, String entry_schema, Object value) { @@ -20,6 +20,8 @@ package org.openecomp.sdc.ci.tests.tosca.datatypes; +import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import java.util.Map; @@ -28,17 +30,15 @@ import org.yaml.snakeyaml.TypeDescription; public class ToscaDefinition { String tosca_definitions_version; - Map<String, String> metadata; - List<Map<String, ToscaImportsDefinition>> imports; - Map<String, ToscaNodeTypesDefinition> node_types; - ToscaTopologyTemplateDefinition topology_template; + Map<String, String> metadata = new HashMap<>(); + List<Map<String, ToscaImportsDefinition>> imports = new ArrayList<>(); + Map<String, ToscaNodeTypesDefinition> node_types = new HashMap<>(); + ToscaTopologyTemplateDefinition topology_template = new ToscaTopologyTemplateDefinition(); public ToscaDefinition() { super(); } - - public ToscaDefinition(String tosca_definitions_version, Map<String, String> metadata, List<Map<String, ToscaImportsDefinition>> imports, Map<String, ToscaNodeTypesDefinition> node_types, ToscaTopologyTemplateDefinition topology_template) { super(); @@ -49,28 +49,30 @@ public class ToscaDefinition { this.topology_template = topology_template; } + public ToscaDefinition(ToscaDefinition toscaDefinition){ + this.tosca_definitions_version = toscaDefinition.tosca_definitions_version; + this.metadata = new HashMap<>(toscaDefinition.metadata); + this.imports = new ArrayList<>(toscaDefinition.imports); + this.node_types = new HashMap<>(toscaDefinition.node_types); + this.topology_template = new ToscaTopologyTemplateDefinition(toscaDefinition.topology_template); + } + + public List<Map<String, ToscaImportsDefinition>> getImports() { + return imports; + } + public void setImports(List<Map<String, ToscaImportsDefinition>> imports) { + this.imports = imports; + } public Map<String, String> getMetadata() { return metadata; } - - public void setMetadata(Map<String, String> metadata) { this.metadata = metadata; } - - - public List<Map<String, ToscaImportsDefinition>> getImports() { - return imports; - } - - public void setImports(List<Map<String, ToscaImportsDefinition>> imports) { - this.imports = imports; - } - public String getTosca_definitions_version() { return tosca_definitions_version; } @@ -32,7 +32,6 @@ public class ToscaImportsDefinition { public ToscaImportsDefinition() { super(); - // TODO Auto-generated constructor stub } public ToscaImportsDefinition(String name, String file, String repository, String namespace_uri, String namespace_prefix) { @@ -20,32 +20,241 @@ package org.openecomp.sdc.ci.tests.tosca.datatypes; +import java.util.ArrayList; +import java.util.List; import java.util.Map; import org.yaml.snakeyaml.TypeDescription; +import com.google.gson.annotations.SerializedName; + public class ToscaInputsTopologyTemplateDefinition { - private Map<String,Map<String,Object>> inputs; + public String name; + public String type; + public String description; + public Boolean required; + public Boolean hidden; + public Boolean immutable; + @SerializedName("default") + public Object Default; - public ToscaInputsTopologyTemplateDefinition() { + public String status; + public List<Object> constraints = new ArrayList<Object>(); + public Map<String, Object> entry_schema; + public Object value; + + public ToscaInputsTopologyTemplateDefinition(String name, String type, String description, Boolean required, Object default1, String status, List<Object> constraints, Map<String, Object> entry_schema, Object value, Boolean immutable, Boolean hidden) { super(); - // TODO Auto-generated constructor stub + this.name = name; + this.type = type; + this.description = description; + this.required = required; + Default = default1; + this.status = status; + this.constraints = constraints; + this.entry_schema = entry_schema; + this.value = value; + this.immutable = immutable; + this.hidden = hidden; } - public Map<String, Map<String,Object>> getInputs() { - return inputs; + public ToscaInputsTopologyTemplateDefinition() { } - - public void setInputs(Map<String, Map<String,Object>> inputs) { - this.inputs = inputs; + public ToscaInputsTopologyTemplateDefinition(ToscaInputsTopologyTemplateDefinition definition){ +// this(definition.getName(), definition.getType(), definition.getDescription(), definition.getRequired(), definition.getDefault(), definition.getStatus(), definition.getConstraints(), definition.getEntry_schema(), definition.getValue()); + this.name = definition.name; + this.type = definition.type; + this.description = definition.description; + this.required = definition.required; + this.Default = definition.Default; + this.status = definition.status; + this.constraints = definition.constraints; + this.entry_schema = definition.entry_schema; + this.value = definition.value; + this.immutable = immutable; + this.hidden = hidden; } - + public Boolean getHidden() { + return hidden; + } + + public void setHidden(Boolean hidden) { + this.hidden = hidden; + } + + public Boolean getImmutable() { + return immutable; + } + + public void setImmutable(Boolean immutable) { + this.immutable = immutable; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Boolean getRequired() { + return required; + } + + public void setRequired(Boolean required) { + this.required = required; + } + + public Object getDefault() { + return Default; + } + + public void setDefault(Object default1) { + Default = default1; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public List<Object> getConstraints() { + return constraints; + } + + public void setConstraints(List<Object> constraints) { + this.constraints = constraints; + } + + public Map<String, Object> getEntry_schema() { + return entry_schema; + } + + public void setEntry_schema(Map<String, Object> entry_schema) { + this.entry_schema = entry_schema; + } + + public Object getValue() { + return value; + } + + public void setValue(Object value) { + this.value = value; + } + //gets Type description for Yaml snake public static TypeDescription getTypeDescription(){ TypeDescription typeDescription = new TypeDescription(ToscaInputsTopologyTemplateDefinition.class); + typeDescription.putListPropertyType("constraints", Object.class); + typeDescription.putMapPropertyType("entry_schema", String.class, Object.class); return typeDescription; } + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((Default == null) ? 0 : Default.hashCode()); + result = prime * result + ((constraints == null) ? 0 : constraints.hashCode()); + result = prime * result + ((description == null) ? 0 : description.hashCode()); + result = prime * result + ((entry_schema == null) ? 0 : entry_schema.hashCode()); + result = prime * result + ((hidden == null) ? 0 : hidden.hashCode()); + result = prime * result + ((immutable == null) ? 0 : immutable.hashCode()); + result = prime * result + ((name == null) ? 0 : name.hashCode()); + result = prime * result + ((required == null) ? 0 : required.hashCode()); + result = prime * result + ((status == null) ? 0 : status.hashCode()); + result = prime * result + ((type == null) ? 0 : type.hashCode()); + result = prime * result + ((value == null) ? 0 : value.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + ToscaInputsTopologyTemplateDefinition other = (ToscaInputsTopologyTemplateDefinition) obj; + if (Default == null) { + if (other.Default != null) + return false; + } else if (!Default.equals(other.Default)) + return false; + if (constraints == null) { + if (other.constraints != null) + return false; + } else if (!constraints.equals(other.constraints)) + return false; + if (description == null) { + if (other.description != null) + return false; + } else if (!description.equals(other.description)) + return false; + if (entry_schema == null) { + if (other.entry_schema != null) + return false; + } else if (!entry_schema.equals(other.entry_schema)) + return false; + if (hidden == null) { + if (other.hidden != null) + return false; + } else if (!hidden.equals(other.hidden)) + return false; + if (immutable == null) { + if (other.immutable != null) + return false; + } else if (!immutable.equals(other.immutable)) + return false; + if (name == null) { + if (other.name != null) + return false; + } else if (!name.equals(other.name)) + return false; + if (required == null) { + if (other.required != null) + return false; + } else if (!required.equals(other.required)) + return false; + if (status == null) { + if (other.status != null) + return false; + } else if (!status.equals(other.status)) + return false; + if (type == null) { + if (other.type != null) + return false; + } else if (!type.equals(other.type)) + return false; + if (value == null) { + if (other.value != null) + return false; + } else if (!value.equals(other.value)) + return false; + return true; + } + } @@ -32,24 +32,32 @@ public class ToscaNodeTemplatesTopologyTemplateDefinition { private String description; private String [] directives; private Map<String, Object> properties; - private List<Map<String, Object>> attributes; + private Map<String, Object> attributes; private List<Map<String, Object>> requirements; - private List<Map<String, Object>> capabilities; - private List<Map<String, Object>> interfaces; - private List<Map<String, Object>> artifacts; - private List<Map<String, Object>> node_filter; - private String copy; - private Map<String, String> metadata; - - + private Object capabilities; +// private List<Map<String, Object>> capabilities; // private Map<String, ToscaPropertiesNodeTemplatesDefinition> properties; // private Map<String, ToscaRequirementsNodeTemplatesDefinition> requirements; // private Map<String, ToscaCapabilitiesNodeTemplatesDefinition> capabilities; + private Map<String, Object> interfaces; + private Map<String, Object> artifacts; + private Map<String, Object> node_filter; + private String copy; + private Map<String, String> metadata; + public ToscaNodeTemplatesTopologyTemplateDefinition() { super(); } + public Object getCapabilities() { + return capabilities; + } + + public void setCapabilities(Object capabilities) { + this.capabilities = capabilities; + } + public Map<String, String> getMetadata() { return metadata; } @@ -100,11 +108,11 @@ public class ToscaNodeTemplatesTopologyTemplateDefinition { this.properties = properties; } - public List<Map<String, Object>> getAttributes() { + public Map<String, Object> getAttributes() { return attributes; } - public void setAttributes(List<Map<String, Object>> attributes) { + public void setAttributes(Map<String, Object> attributes) { this.attributes = attributes; } @@ -116,35 +124,27 @@ public class ToscaNodeTemplatesTopologyTemplateDefinition { this.requirements = requirements; } - public List<Map<String, Object>> getCapabilities() { - return capabilities; - } - - public void setCapabilities(List<Map<String, Object>> capabilities) { - this.capabilities = capabilities; - } - - public List<Map<String, Object>> getInterfaces() { + public Map<String, Object> getInterfaces() { return interfaces; } - public void setInterfaces(List<Map<String, Object>> interfaces) { + public void setInterfaces(Map<String, Object> interfaces) { this.interfaces = interfaces; } - public List<Map<String, Object>> getArtifacts() { + public Map<String, Object> getArtifacts() { return artifacts; } - public void setArtifacts(List<Map<String, Object>> artifacts) { + public void setArtifacts(Map<String, Object> artifacts) { this.artifacts = artifacts; } - public List<Map<String, Object>> getNode_filter() { + public Map<String, Object> getNode_filter() { return node_filter; } - public void setNode_filter(List<Map<String, Object>> node_filter) { + public void setNode_filter(Map<String, Object> node_filter) { this.node_filter = node_filter; } @@ -161,11 +161,12 @@ public class ToscaNodeTemplatesTopologyTemplateDefinition { TypeDescription typeDescription = new TypeDescription(ToscaNodeTemplatesTopologyTemplateDefinition.class); typeDescription.putMapPropertyType("properties", String.class, Object.class); typeDescription.putListPropertyType("requirements", Map.class); - typeDescription.putListPropertyType("capabilities", Map.class); - typeDescription.putListPropertyType("attributes", Map.class); - typeDescription.putListPropertyType("interfaces", Map.class); - typeDescription.putListPropertyType("artifacts", Map.class); - typeDescription.putListPropertyType("node_filter", Map.class); +// typeDescription.putMapPropertyType("capabilities",String.class, Object.class); +// typeDescription.putListPropertyType("capabilities", Object.class); + typeDescription.putMapPropertyType("attributes", String.class, Object.class); + typeDescription.putMapPropertyType("interfaces", String.class, Object.class); + typeDescription.putMapPropertyType("artifacts", String.class, Object.class); + typeDescription.putMapPropertyType("node_filter", String.class, Object.class); typeDescription.putMapPropertyType("metadata", String.class, String.class); return typeDescription; } @@ -20,6 +20,7 @@ package org.openecomp.sdc.ci.tests.tosca.datatypes; +import java.util.HashMap; import java.util.Map; // spec page 88 @@ -29,12 +30,12 @@ public class ToscaNodeTypesDefinition { private String derived_from; private String version; private String description; - private Map<String, Object> properties; - private Map<String, Object> attributes; - private Map<String, Object> requirements; - private Map<String, Object> capabilities; - private Map<String, Object> interfaces; - private Map<String, Object> artifacts; + private Map<String, Object> properties = new HashMap<>(); + private Map<String, Object> attributes = new HashMap<>(); + private Map<String, Object> requirements = new HashMap<>(); + private Map<String, Object> capabilities = new HashMap<>(); + private Map<String, Object> interfaces = new HashMap<>(); + private Map<String, Object> artifacts = new HashMap<>(); public ToscaNodeTypesDefinition() { super(); @@ -28,7 +28,6 @@ public class ToscaOutputsTopologyTemplateDefinition { public ToscaOutputsTopologyTemplateDefinition() { super(); - // TODO Auto-generated constructor stub } public Map<String, Object> getOutputs() { @@ -25,7 +25,6 @@ import java.util.Map; public class ToscaRelationshipTemplatesTopologyTemplateDefinition { public ToscaRelationshipTemplatesTopologyTemplateDefinition() { - // TODO Auto-generated constructor stub } private String type; @@ -30,7 +30,6 @@ public class ToscaServiceGroupsMetadataDefinition { public ToscaServiceGroupsMetadataDefinition() { super(); - // TODO Auto-generated constructor stub } public String getVfModuleModelName() { @@ -20,6 +20,7 @@ package org.openecomp.sdc.ci.tests.tosca.datatypes; +import java.util.HashMap; import java.util.Map; import org.yaml.snakeyaml.TypeDescription; @@ -27,12 +28,11 @@ import org.yaml.snakeyaml.TypeDescription; public class ToscaSubstitutionMappingsDefinition { private String node_type; - private Map<String, Object> requirements; - private Map<String, Object> capabilities; + private Map<String, Object> requirements = new HashMap<>(); + private Map<String, Object> capabilities = new HashMap<>(); public ToscaSubstitutionMappingsDefinition() { super(); - // TODO Auto-generated constructor stub } public String getNode_type() { @@ -20,8 +20,9 @@ package org.openecomp.sdc.ci.tests.tosca.datatypes; -import java.util.List; +import java.util.HashMap; import java.util.Map; +import java.util.stream.Collectors; import org.yaml.snakeyaml.TypeDescription; @@ -29,25 +30,52 @@ import org.yaml.snakeyaml.TypeDescription; public class ToscaTopologyTemplateDefinition { String description; - Map<String, Object> inputs; - Map<String,ToscaNodeTemplatesTopologyTemplateDefinition> node_templates; +// Map<String, Map<String, ToscaInputsDefinition>> inputs; + Map<String,ToscaNodeTemplatesTopologyTemplateDefinition> node_templates = new HashMap<>(); // Map<String,ToscaRelationshipTemplatesTopologyTemplateDefinition> relationship_templates; - Map<String,ToscaGroupsTopologyTemplateDefinition> groups; + Map<String,ToscaGroupsTopologyTemplateDefinition> groups = new HashMap<>(); + Map<String, ToscaInputsTopologyTemplateDefinition> inputs = new HashMap<>(); // Map<String,ToscaPoliciesTopologyTemplateDefinition> policies; // Map<String,ToscaOutputsTopologyTemplateDefinition> outputs; ToscaSubstitutionMappingsDefinition substitution_mappings; public ToscaTopologyTemplateDefinition() { super(); - // TODO Auto-generated constructor stub + } + + public ToscaTopologyTemplateDefinition(ToscaTopologyTemplateDefinition definition) { + this.description = definition.description; + this.node_templates = new HashMap<>(definition.node_templates); + this.groups = new HashMap<String,ToscaGroupsTopologyTemplateDefinition>(definition.groups); + this.inputs = definition.inputs.entrySet().stream().collect(Collectors.toMap(e -> e.getKey(), e -> new ToscaInputsTopologyTemplateDefinition(e.getValue()))); + this.substitution_mappings = definition.substitution_mappings; + } + + public ToscaTopologyTemplateDefinition(String description, Map<String, ToscaNodeTemplatesTopologyTemplateDefinition> node_templates, Map<String, ToscaGroupsTopologyTemplateDefinition> groups, + Map<String, ToscaInputsTopologyTemplateDefinition> inputs, ToscaSubstitutionMappingsDefinition substitution_mappings) { + super(); + this.description = description; + this.node_templates = node_templates; + this.groups = groups; + this.inputs = inputs; + this.substitution_mappings = substitution_mappings; +} + + public Map<String, ToscaInputsTopologyTemplateDefinition> getInputs() { + return inputs; } + public void setInputs(Map<String, ToscaInputsTopologyTemplateDefinition> inputs) { + this.inputs = inputs; + } + public void addInputs(Map<String, ToscaInputsTopologyTemplateDefinition> inputs) { + this.inputs.putAll(inputs); + } + public ToscaSubstitutionMappingsDefinition getSubstitution_mappings() { return substitution_mappings; } - - public void setSubstitution_mappings(ToscaSubstitutionMappingsDefinition substitution_mappings) { this.substitution_mappings = substitution_mappings; } @@ -60,18 +88,7 @@ public class ToscaTopologyTemplateDefinition { this.description = description; } - public Map<String, Object> getInputs() { - return inputs; - } - - public void setInputs(Map<String, Object> inputs) { - this.inputs = inputs; - } - public void addInputs(Map<String, Object> inputs) { - this.inputs.putAll(inputs); - } - public Map<String, ToscaNodeTemplatesTopologyTemplateDefinition> getNode_templates() { return node_templates; } @@ -80,14 +97,6 @@ public class ToscaTopologyTemplateDefinition { this.node_templates = node_templates; } -// public Map<String, ToscaRelationshipTemplatesTopologyTemplateDefinition> getRelationship_templates() { -// return relationship_templates; -// } -// -// public void setRelationship_templates(Map<String, ToscaRelationshipTemplatesTopologyTemplateDefinition> relationship_templates) { -// this.relationship_templates = relationship_templates; -// } - public Map<String, ToscaGroupsTopologyTemplateDefinition> getGroups() { return groups; } @@ -95,41 +104,12 @@ public class ToscaTopologyTemplateDefinition { public void setGroups(Map<String, ToscaGroupsTopologyTemplateDefinition> groups) { this.groups = groups; } -// -// public Map<String, ToscaPoliciesTopologyTemplateDefinition> getPolicies() { -// return policies; -// } -// -// public void setPolicies(Map<String, ToscaPoliciesTopologyTemplateDefinition> policies) { -// this.policies = policies; -// } -// -// public Map<String, ToscaOutputsTopologyTemplateDefinition> getOutputs() { -// return outputs; -// } -// -// public void setOutputs(Map<String, ToscaOutputsTopologyTemplateDefinition> outputs) { -// this.outputs = outputs; -// } -// -// public Map<String, ToscaSubstitutionMappingsDefinition> getSubstitution_mappings() { -// return substitution_mappings; -// } -// -// public void setSubstitution_mappings(Map<String, ToscaSubstitutionMappingsDefinition> substitution_mappings) { -// this.substitution_mappings = substitution_mappings; -// } - -// @Override -// public String toString() { -// return "ToscaTopologyTemplateDefinition [description=" + description + ", inputs=" + inputs + ", node_templates=" + node_templates + ", relationship_templates=" + relationship_templates + ", groups=" + groups + ", policies=" -// + policies + ", outputs=" + outputs + ", substitution_mappings=" + substitution_mappings + "]"; -// } + //gets Type description for Yaml snake public static TypeDescription getTypeDescription(){ TypeDescription typeDescription = new TypeDescription(ToscaTopologyTemplateDefinition.class); - typeDescription.putMapPropertyType("inputs", String.class, Object.class); + typeDescription.putMapPropertyType("inputs", String.class, ToscaInputsTopologyTemplateDefinition.class); typeDescription.putMapPropertyType("node_templates", String.class, ToscaNodeTemplatesTopologyTemplateDefinition.class); typeDescription.putMapPropertyType("groups", String.class, ToscaGroupsTopologyTemplateDefinition.class); return typeDescription; @@ -36,7 +36,6 @@ public class ToscaTopologyTemplateDefinition2 { public ToscaTopologyTemplateDefinition2() { super(); - // TODO Auto-generated constructor stub } public String getDescription() { @@ -1,5 +1,11 @@ package org.openecomp.sdc.ci.tests.utils; +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.util.List; +import java.util.Map; + import org.openecomp.sdc.tosca.parser.api.ISdcCsarHelper; import org.openecomp.sdc.tosca.parser.exceptions.SdcToscaParserException; import org.openecomp.sdc.tosca.parser.impl.SdcToscaParserFactory; @@ -8,63 +14,8 @@ import org.openecomp.sdc.toscaparser.api.Group; import org.openecomp.sdc.toscaparser.api.NodeTemplate; import org.openecomp.sdc.toscaparser.api.elements.Metadata; import org.openecomp.sdc.toscaparser.api.parameters.Input; -import org.openecomp.sdc.toscaparser.api.utils.ThreadLocalsHolder; - -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.text.SimpleDateFormat; -import java.util.Arrays; -import java.util.Date; -import java.util.List; -import java.util.Map; public class CsarToscaTester { - public static void main(String[] args) throws Exception { - System.out.println("CsarToscaParser - path to CSAR's Directory is " + Arrays.toString(args)); - SdcToscaParserFactory factory = SdcToscaParserFactory.getInstance(); - - File folder = new File(args[0]); - File[] listOfFiles = folder.listFiles(); - Date now = new Date(); - SimpleDateFormat dateFormat = new SimpleDateFormat("d-MM-y-HH_mm_ss"); - String time = dateFormat.format(now); - String csarsDir = args[1] + "/csar-reports-" + time; - File dir = new File(csarsDir); - dir.mkdir(); - - - for (File file : listOfFiles) { - if (file.isFile()) { - System.out.println("File " + file.getAbsolutePath()); - String name = file.getName(); - String currentCsarDir = csarsDir+"/"+name+"-"+time; - dir = new File(currentCsarDir); - dir.mkdir(); - try { - processCsar(factory, file); - } catch (SdcToscaParserException e){ - System.out.println("SdcToscaParserException caught. Code: "+e.getCode()+", message: "+ e.getMessage()); - } - List<String> notAnalyzedReport = ThreadLocalsHolder.getCollector().getNotAnalyzedExceptionsReport(); - System.out.println("NOT ANALYZED during CSAR parsing are: " + (notAnalyzedReport != null ? notAnalyzedReport.toString() : "none")); - List<String> warningsReport = ThreadLocalsHolder.getCollector().getWarningsReport(); - //System.out.println("WARNINGS during CSAR parsing are: " + (warningsReport != null ? warningsReport.toString() : "none")); - List<String> criticalsReport = ThreadLocalsHolder.getCollector().getCriticalsReport(); - System.out.println("CRITICALS during CSAR parsing are: " + (criticalsReport != null ? criticalsReport.toString() : "none")); - - try { - generateReport(time, name, currentCsarDir, criticalsReport, "critical"); - generateReport(time, name, currentCsarDir, warningsReport, "warning"); - generateReport(time, name, currentCsarDir, notAnalyzedReport, "notAnalyzed"); - - } catch (IOException ex) { - ex.printStackTrace(); - } - } - - } - } public static void processCsar(SdcToscaParserFactory factory, File file) throws SdcToscaParserException { ISdcCsarHelper sdcCsarHelper = factory.getSdcCsarHelper(file.getAbsolutePath()); @@ -29,7 +29,15 @@ import java.util.Map.Entry; import java.util.Set; import org.apache.tinkerpop.gremlin.structure.Edge; +import org.apache.tinkerpop.gremlin.structure.Element; import org.apache.tinkerpop.gremlin.structure.Vertex; +import org.apache.tinkerpop.gremlin.structure.util.ElementHelper; +import org.openecomp.sdc.ci.tests.api.Urls; +import org.openecomp.sdc.ci.tests.config.Config; +import org.openecomp.sdc.ci.tests.datatypes.http.HttpRequest; +import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; +import org.openecomp.sdc.ci.tests.users.UserAuditJavaObject; +import org.openecomp.sdc.ci.tests.utils.cassandra.CassandraUtils; import com.google.gson.Gson; import com.google.gson.JsonArray; @@ -43,19 +51,6 @@ import com.thinkaurelius.titan.core.TitanVertex; import fj.data.Either; -import org.apache.tinkerpop.gremlin.structure.Direction; -import org.apache.tinkerpop.gremlin.structure.Edge; -import org.apache.tinkerpop.gremlin.structure.Vertex; -import org.apache.tinkerpop.gremlin.structure.util.ElementHelper; -import org.openecomp.sdc.ci.tests.api.Urls; -import org.openecomp.sdc.ci.tests.config.Config; -import org.openecomp.sdc.ci.tests.datatypes.http.HttpRequest; -import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; -import org.openecomp.sdc.ci.tests.users.UserAuditJavaObject; -import org.openecomp.sdc.ci.tests.utils.cassandra.CassandraUtils; -import org.apache.tinkerpop.gremlin.structure.Element; -import org.apache.tinkerpop.gremlin.structure.Property; - public class DbUtils { private static String titanConfigFilePath; @@ -29,17 +29,30 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; +import org.codehaus.jettison.json.JSONArray; +import org.codehaus.jettison.json.JSONException; +import org.codehaus.jettison.json.JSONObject; import org.openecomp.sdc.be.model.ArtifactDefinition; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.Service; +import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.ci.tests.api.Urls; +import org.openecomp.sdc.ci.tests.config.Config; +import org.openecomp.sdc.ci.tests.datatypes.DistributionMonitorObject; import org.openecomp.sdc.ci.tests.datatypes.ServiceDistributionStatus; import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; +import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; import org.openecomp.sdc.ci.tests.utils.rest.ServiceRestUtils; +//import org.openecomp.sdc.be.components.distribution.engine.DistributionStatusNotificationEnum; - public class DistributionUtils { +import com.clearspring.analytics.util.Pair; +import com.google.gson.Gson; + + + public class DistributionUtils extends BaseRestUtils{ final static String serviceDistributionSuffix = "/sdc/v1/catalog/services/"; @@ -140,5 +153,112 @@ import org.openecomp.sdc.ci.tests.utils.rest.ServiceRestUtils; return distributionArtifactMap; } - + + + public static RestResponse getDistributionStatus(User sdncModifierDetails, String distributionId) throws IOException { + + Config config = Utils.getConfig(); + String url = String.format(Urls.DISTRIBUTION_SERVICE_MONITOR, config.getCatalogBeHost(), config.getCatalogBePort(), distributionId); + return sendGet(url, sdncModifierDetails.getUserId()); + + } + + + /** + * @param response + * @return parsed distribution list of DistributionMonitorObject java objects + * @throws JSONException + */ + public static Map<String, List<DistributionMonitorObject>> getSortedDistributionStatus(RestResponse response) throws JSONException{ + + ArrayList<DistributionMonitorObject> distributionStatusList = new ArrayList<DistributionMonitorObject>(); + String responseString = response.getResponse(); + JSONObject jObject; + JSONArray jsonArray = null; + jObject = new JSONObject(responseString); + jsonArray = jObject.getJSONArray("distributionStatusList"); + + Gson gson = new Gson(); + for(int i=0; i<jsonArray.length(); i++){ + String jsonElement = jsonArray.get(i).toString(); + DistributionMonitorObject distributionStatus = gson.fromJson(jsonElement, DistributionMonitorObject.class); + distributionStatusList.add(distributionStatus); + } + Map<String, List<DistributionMonitorObject>> sortedDistributionMapByConsumer = sortDistributionStatusByConsumer(distributionStatusList); + + return sortedDistributionMapByConsumer; + } + + /** + * @param distributionStatusList + * @return sorted distribution map where key is consumer name and value contains list of corresponded DistributionMonitorObject java object + */ + public static Map<String, List<DistributionMonitorObject>> sortDistributionStatusByConsumer(ArrayList<DistributionMonitorObject> distributionStatusList) { + // sort distribution status list per consumer + Map<String, List<DistributionMonitorObject>> distributionStatusMapByConsumer = new HashMap<String, List<DistributionMonitorObject>>(); + for(DistributionMonitorObject distributionListElement : distributionStatusList){ + String key = distributionListElement.getOmfComponentID(); + List<DistributionMonitorObject> list = new ArrayList<>(); + if(distributionStatusMapByConsumer.get(key) != null){ + list = distributionStatusMapByConsumer.get(key); + list.add(distributionListElement); + distributionStatusMapByConsumer.put(key, list); + }else{ + list.add(distributionListElement); + distributionStatusMapByConsumer.put(key, list); + } + + } + return distributionStatusMapByConsumer; + } + + + /** + * @param pair + * @return consumer Status map: if map is empty - all consumers successes download and deploy the artifacts, + * else - return failed consumer status per url + */ + public static Pair<Boolean, Map<String, List<String>>> verifyDistributionStatus(Map<String, List<DistributionMonitorObject>> map){ + + Map<String, List<String>> consumerStatusMap = new HashMap<>(); + List<Boolean> flag = new ArrayList<>(); + for (Entry<String, List<DistributionMonitorObject>> distributionMonitor : map.entrySet()){ + int notifiedCount = 0, downloadCount = 0, deployCount = 0; + List<String> failedList = new ArrayList<>(); + List<DistributionMonitorObject> listValue = distributionMonitor.getValue(); + for(DistributionMonitorObject distributionStatus : listValue){ + String status = distributionStatus.getStatus(); + switch (status) { + case "NOTIFIED": notifiedCount++; + break; + case "NOT_NOTIFIED": + break; + case "DOWNLOAD_OK": downloadCount++; + break; + case "DEPLOY_OK": deployCount++; + break; + default: + failedList.add("Url " + distributionStatus.getUrl() + " failed with status " + distributionStatus.getStatus()); + break; + } + } + if((notifiedCount != downloadCount || notifiedCount != deployCount) && notifiedCount != 0){ + consumerStatusMap.put(distributionMonitor.getKey(), failedList); + flag.add(false); + } + if(notifiedCount == 0){ + flag.add(true); + } + } + + if(!flag.contains(false)){ + return Pair.create(true, consumerStatusMap); + }else{ + return Pair.create(false, consumerStatusMap); + } + + } + + + } @@ -31,8 +31,8 @@ import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Map.Entry; -import java.util.function.Function; import java.util.Set; +import java.util.function.Function; import java.util.stream.Collectors; import org.apache.commons.lang3.tuple.ImmutablePair; @@ -42,7 +42,7 @@ import org.openecomp.sdc.be.model.CapabilityDefinition; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.Product; -import org.openecomp.sdc.be.model.RequirementAndRelationshipPair; +import org.openecomp.sdc.be.model.RelationshipInfo; import org.openecomp.sdc.be.model.RequirementCapabilityRelDef; import org.openecomp.sdc.be.model.RequirementDefinition; import org.openecomp.sdc.be.model.Resource; @@ -580,7 +580,7 @@ public class ReqCap { private static void deleteAssociatedFromExpected(RequirementCapabilityRelDef requirementDef) { // removing from requirements - RequirementAndRelationshipPair relationship = requirementDef.getRelationships().get(0); + RelationshipInfo relationship = requirementDef.getRelationships().get(0).getRelation(); String type = relationship.getRelationship().getType(); String fromId = requirementDef.getFromNode(); List<RequirementDefinition> reqList = expectedContainerRequirements.get(type); @@ -612,7 +612,7 @@ public class ReqCap { private static void addDissociatedToExpected(RequirementCapabilityRelDef requirementDef) { // adding to requirements - RequirementAndRelationshipPair relationship = requirementDef.getRelationships().get(0); + RelationshipInfo relationship = requirementDef.getRelationships().get(0).getRelation(); String type = relationship.getRelationship().getType(); String fromId = requirementDef.getFromNode(); String key = type + " " + fromId; @@ -143,7 +143,9 @@ public class ToscaParserUtils { toscaDefinition = (ToscaDefinition) yaml.load(payload); } catch (Exception e) { log.debug("Failed to parse tosca yaml file"); + log.debug("Exception: " + e); System.out.println("Exception: " + e); + assertTrue("Exception: " + e, false); } return toscaDefinition; @@ -160,6 +162,7 @@ public class ToscaParserUtils { toscaStructure.addTypeDescription(ToscaImportsDefinition.getTypeDescription()); toscaStructure.addTypeDescription(ToscaMetadataDefinition.getTypeDescription()); toscaStructure.addTypeDescription(ToscaInputsTopologyTemplateDefinition.getTypeDescription()); +// toscaStructure.addTypeDescription(ToscaInputsDefinition.getTypeDescription()); // Skip properties which are found in YAML, but not found in POJO PropertyUtils propertyUtils = new PropertyUtils(); propertyUtils.setSkipMissingProperties(true); @@ -20,10 +20,10 @@ package org.openecomp.sdc.ci.tests.utils.cassandra; -import com.datastax.driver.core.*; -import com.datastax.driver.core.querybuilder.QueryBuilder; -import com.datastax.driver.core.querybuilder.Select; -import com.datastax.driver.core.querybuilder.Select.Where; +import java.io.FileNotFoundException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; import org.javatuples.Pair; import org.openecomp.sdc.be.resources.data.auditing.AuditingTypesConstants; @@ -32,10 +32,15 @@ import org.openecomp.sdc.common.datastructure.AuditingFieldsKeysEnum; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.io.FileNotFoundException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; +import com.datastax.driver.core.Cluster; +import com.datastax.driver.core.KeyspaceMetadata; +import com.datastax.driver.core.Metadata; +import com.datastax.driver.core.Row; +import com.datastax.driver.core.Session; +import com.datastax.driver.core.TableMetadata; +import com.datastax.driver.core.querybuilder.QueryBuilder; +import com.datastax.driver.core.querybuilder.Select; +import com.datastax.driver.core.querybuilder.Select.Where; public final class CassandraUtils { private static Logger logger = LoggerFactory.getLogger(CassandraUtils.class.getName()); @@ -20,10 +20,10 @@ package org.openecomp.sdc.ci.tests.utils.cassandra; -import com.datastax.driver.core.*; -import com.datastax.driver.core.querybuilder.QueryBuilder; -import com.datastax.driver.core.querybuilder.Select; -import com.datastax.driver.core.querybuilder.Select.Where; +import java.io.FileNotFoundException; +import java.util.Collection; +import java.util.List; + import org.javatuples.Pair; import org.openecomp.sdc.be.resources.data.auditing.AuditingTypesConstants; import org.openecomp.sdc.ci.tests.utils.Utils; @@ -31,9 +31,15 @@ import org.openecomp.sdc.common.datastructure.AuditingFieldsKeysEnum; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.io.FileNotFoundException; -import java.util.Collection; -import java.util.List; +import com.datastax.driver.core.Cluster; +import com.datastax.driver.core.KeyspaceMetadata; +import com.datastax.driver.core.Metadata; +import com.datastax.driver.core.Row; +import com.datastax.driver.core.Session; +import com.datastax.driver.core.TableMetadata; +import com.datastax.driver.core.querybuilder.QueryBuilder; +import com.datastax.driver.core.querybuilder.Select; +import com.datastax.driver.core.querybuilder.Select.Where; public final class CassandraUtils2 { private static Logger logger = LoggerFactory.getLogger(CassandraUtils2.class.getName()); @@ -29,16 +29,16 @@ import java.nio.file.Path; import java.nio.file.Paths; import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.Map; - -import javax.xml.bind.helpers.AbstractUnmarshallerImpl; -import javax.xml.ws.Response; +import java.util.Map.Entry; +import java.util.concurrent.TimeUnit; import org.apache.commons.codec.binary.Base64; import org.apache.commons.lang3.tuple.Pair; -import org.aspectj.apache.bcel.classfile.Code; import org.json.JSONException; import org.openecomp.sdc.be.datatypes.elements.ConsumerDataDefinition; +import org.openecomp.sdc.be.datatypes.enums.AssetTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.model.ArtifactDefinition; @@ -50,14 +50,18 @@ import org.openecomp.sdc.be.model.Product; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.ci.tests.api.ComponentBaseTest; +import org.openecomp.sdc.ci.tests.api.ExtentTestActions; import org.openecomp.sdc.ci.tests.api.Urls; import org.openecomp.sdc.ci.tests.config.Config; import org.openecomp.sdc.ci.tests.datatypes.ArtifactReqDetails; import org.openecomp.sdc.ci.tests.datatypes.ComponentInstanceReqDetails; +import org.openecomp.sdc.ci.tests.datatypes.DistributionMonitorObject; import org.openecomp.sdc.ci.tests.datatypes.ImportReqDetails; import org.openecomp.sdc.ci.tests.datatypes.ProductReqDetails; import org.openecomp.sdc.ci.tests.datatypes.PropertyReqDetails; import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; +import org.openecomp.sdc.ci.tests.datatypes.ServiceDistributionStatus; import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum; @@ -69,8 +73,11 @@ import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.datatypes.http.HttpHeaderEnum; import org.openecomp.sdc.ci.tests.datatypes.http.HttpRequest; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; +import org.openecomp.sdc.ci.tests.utils.CsarToscaTester; +import org.openecomp.sdc.ci.tests.utils.DistributionUtils; import org.openecomp.sdc.ci.tests.utils.Utils; import org.openecomp.sdc.ci.tests.utils.rest.ArtifactRestUtils; +import org.openecomp.sdc.ci.tests.utils.rest.AssetRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ComponentInstanceRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ConsumerRestUtils; @@ -81,8 +88,11 @@ import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; import org.openecomp.sdc.ci.tests.utils.rest.ServiceRestUtils; import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum; +import org.openecomp.sdc.tosca.parser.api.ISdcCsarHelper; +import org.openecomp.sdc.tosca.parser.impl.SdcToscaParserFactory; import org.testng.SkipException; +import com.aventstack.extentreports.Status; import com.google.gson.Gson; import fj.data.Either; @@ -194,6 +204,25 @@ public final class AtomicOperationUtils { return Either.right(resourceResp); } + public static Either<Resource, RestResponse> updateResource(ResourceReqDetails resourceReqDetails, User defaultUser, Boolean validateState) { + try { + + RestResponse resourceResp = ResourceRestUtils.updateResource(resourceReqDetails, defaultUser, resourceReqDetails.getUniqueId()); + + if (validateState) { + assertTrue(resourceResp.getErrorCode() == ResourceRestUtils.STATUS_CODE_SUCCESS); + } + + if (resourceResp.getErrorCode() == ResourceRestUtils.STATUS_CODE_SUCCESS) { + Resource resourceResponseObject = ResponseParser.convertResourceResponseToJavaObject(resourceResp.getResponse()); + return Either.left(resourceResponseObject); + } + return Either.right(resourceResp); + } catch (Exception e) { + throw new AtomicOperationException(e); + } + } + // *********** SERVICE **************** public static Either<Service, RestResponse> createDefaultService(UserRoleEnum userRole, Boolean validateState) throws Exception { @@ -361,7 +390,7 @@ public final class AtomicOperationUtils { RestResponse distributionService = null; RestResponse approveDistribution = LifecycleRestUtils.changeDistributionStatus(serviceDetails, null, governotUser, "approveService", DistributionStatusEnum.DISTRIBUTION_APPROVED); - if (approveDistribution.getErrorCode() == 200) { + if (approveDistribution.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS) { distributionService = LifecycleRestUtils.changeDistributionStatus(serviceDetails, null, opsUser, "approveService", DistributionStatusEnum.DISTRIBUTED); } @@ -375,6 +404,19 @@ public final class AtomicOperationUtils { } + + public static void toscaValidation(Component component, String vnfFile) throws Exception { + + ISdcCsarHelper fdntCsarHelper; + SdcToscaParserFactory factory = SdcToscaParserFactory.getInstance(); + File csarFile = AssetRestUtils.getToscaModelCsarFile(AssetTypeEnum.SERVICES, component.getUUID() , vnfFile); + ExtentTestActions.log(Status.INFO, "Tosca parser is going to convert service csar file to ISdcCsarHelper object..."); + fdntCsarHelper = factory.getSdcCsarHelper(csarFile.getAbsolutePath()); + CsarToscaTester.processCsar(fdntCsarHelper); + ExtentTestActions.log(Status.INFO, String.format("Tosca parser successfully parsed service CSAR")); + + } + // *********** ARTIFACTS ***************** public static Either<ArtifactDefinition, RestResponse> uploadArtifactByType(ArtifactTypeEnum artifactType, Component component, UserRoleEnum userRole, Boolean deploymentTrue, Boolean validateState) throws Exception { @@ -769,13 +811,88 @@ public final class AtomicOperationUtils { } HttpRequest http = new HttpRequest(); RestResponse response = http.httpSendGet(url, headersMap); - if (response.getErrorCode() != 200 && response.getResponse().getBytes() == null && response.getResponse().getBytes().length == 0) { + if (response.getErrorCode() != BaseRestUtils.STATUS_CODE_SUCCESS && response.getResponse().getBytes() == null && response.getResponse().getBytes().length == 0) { return Either.right(response); } return Either.left(response.getResponse()); } + public static RestResponse getDistributionStatusByDistributionId(String distributionId ,Boolean validateState) { + + try { + User defaultUser = ElementFactory.getDefaultUser(UserRoleEnum.OPS); + RestResponse response = DistributionUtils.getDistributionStatus(defaultUser, distributionId); + + if (validateState) { + assertTrue(response.getErrorCode() == ResourceRestUtils.STATUS_CODE_SUCCESS); + } + return response; + + } catch (Exception e) { + throw new AtomicOperationException(e); + } + } + + public static Either <RestResponse, Map<String, List<DistributionMonitorObject>>> getSortedDistributionStatusMap(Service service ,Boolean validateState) { + + try { + ServiceDistributionStatus serviceDistributionObject = DistributionUtils.getLatestServiceDistributionObject(service); + RestResponse response = getDistributionStatusByDistributionId(serviceDistributionObject.getDistributionID(), true); + + if(validateState) { + assertTrue(response.getErrorCode() == ResourceRestUtils.STATUS_CODE_SUCCESS); + } + if(response.getErrorCode() == ResourceRestUtils.STATUS_CODE_SUCCESS){ + Map<String, List<DistributionMonitorObject>> parsedDistributionStatus = DistributionUtils.getSortedDistributionStatus(response); + return Either.right(parsedDistributionStatus); + } + return Either.left(response); + } catch (Exception e) { + throw new AtomicOperationException(e); + } + + } + /** + * @param service + * @param pollingCount + * @param pollingInterval + * Recommended values for service distribution for pollingCount is 4 and for pollingInterval is 15000ms + * @throws Exception + */ + public static Boolean distributeAndValidateService(Service service, int pollingCount, int pollingInterval) throws Exception { + + Boolean statusFlag = true; + AtomicOperationUtils.distributeService(service, true); + TimeUnit.MILLISECONDS.sleep(pollingInterval); + int timeOut = pollingCount * pollingInterval; + while (timeOut > 0) { + Map<String,List<DistributionMonitorObject>> sortedDistributionStatusMap = AtomicOperationUtils.getSortedDistributionStatusMap(service, true).right().value(); + com.clearspring.analytics.util.Pair<Boolean,Map<String,List<String>>> verifyDistributionStatus = DistributionUtils.verifyDistributionStatus(sortedDistributionStatusMap); + if(verifyDistributionStatus.left.equals(false)){ + if((verifyDistributionStatus.right != null && ! verifyDistributionStatus.right.isEmpty()) && timeOut == 0){ + for(Entry<String, List<String>> entry : verifyDistributionStatus.right.entrySet()){ + if(ComponentBaseTest.getExtendTest() != null){ + ComponentBaseTest.getExtendTest().log(Status.INFO, "Consumer: " + entry.getKey() + " failed on following: "+ entry.getValue()); + statusFlag = false; + }else{ + System.out.println("Consumer: " + entry.getKey() + " failed on following: "+ entry.getValue()); + } + } + } + TimeUnit.MILLISECONDS.sleep(pollingInterval); + timeOut-=pollingInterval; + }else { + timeOut = 0; + } + } + return statusFlag; + } + + public static Boolean distributeAndValidateService(Service service) throws Exception { + return distributeAndValidateService(service, 6, 10000); + } + } @@ -29,7 +29,6 @@ import java.util.List; import org.apache.commons.lang3.StringUtils; import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.model.DistributionStatusEnum; import org.openecomp.sdc.be.model.LifecycleStateEnum; import org.openecomp.sdc.be.model.Product; import org.openecomp.sdc.be.model.User; @@ -40,12 +39,10 @@ import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.ResourceRespJavaObject; import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.enums.ErrorInfo; -import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.datatypes.expected.ExpectedProductAudit; import org.openecomp.sdc.ci.tests.datatypes.expected.ExpectedResourceAuditJavaObject; import org.openecomp.sdc.ci.tests.datatypes.expected.ExpectedUserCRUDAudit; -import org.openecomp.sdc.ci.tests.utils.Utils; import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils; import org.openecomp.sdc.common.api.Constants; @@ -33,10 +33,11 @@ import org.openecomp.sdc.be.datatypes.enums.AssetTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.model.ArtifactDefinition; import org.openecomp.sdc.be.model.CapabilityDefinition; +import org.openecomp.sdc.be.model.CapabilityRequirementRelationship; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.LifecycleStateEnum; import org.openecomp.sdc.be.model.RelationshipImpl; -import org.openecomp.sdc.be.model.RequirementAndRelationshipPair; +import org.openecomp.sdc.be.model.RelationshipInfo; import org.openecomp.sdc.be.model.RequirementCapabilityRelDef; import org.openecomp.sdc.be.model.RequirementDefinition; import org.openecomp.sdc.be.model.Resource; @@ -80,6 +81,20 @@ public class ElementFactory { private static final String RESOURCE_INSTANCE_POS_X = "20"; private static final String RESOURCE_INSTANCE_POS_Y = "20"; private static final String RESOURCE_INSTANCE_DESCRIPTION = "description"; + + // *** Getters *** + + public static String getServicePrefix() { + return CI_SERVICE; + } + + public static String getResourcePrefix() { + return CI_RES; + } + + public static String getProductPrefix() { + return CI_PRODUCT; + } // *** RESOURCE *** @@ -149,6 +164,7 @@ public class ElementFactory { String icon = "defaulticon"; ResourceReqDetails resourceDetails = new ResourceReqDetails(resourceName, description, resourceTags, null, derivedFrom, vendorName, vendorRelease, contactId, icon); resourceDetails.addCategoryChain(category.getCategory(), category.getSubCategory()); + resourceDetails.setResourceVendorModelNumber("vendorNumber-1.5.7"); return resourceDetails; @@ -196,9 +212,15 @@ public class ElementFactory { String icon = "defaulticon"; ResourceReqDetails resourceDetails = new ResourceReqDetails(resourceName, description, resourceTags, null, derivedFrom, vendorName, vendorRelease, contactId, icon, resourceType.toString()); resourceDetails.addCategoryChain(category.getCategory(), category.getSubCategory()); + resourceDetails.setResourceVendorModelNumber("vendorNumber-1.5.7"); return resourceDetails; } - + + public static ResourceReqDetails getRandomCategoryResource() { + ResourceReqDetails resourceDetails = getDefaultResource(ResourceCategoryEnum.getRandomElement()); + return resourceDetails; + } + public static ResourceExternalReqDetails getDefaultResourceByType(String resourceName, ResourceCategoryEnum category, String contactId, String resourceType) { resourceName = (resourceName + resourceType + generateUUIDforSufix()); String description = "Represents a generic software component that can be managed and run by a Compute Node Type."; @@ -278,7 +300,7 @@ public class ElementFactory { return getDefaultService(CI_SERVICE, ServiceCategoriesEnum.MOBILITY, user.getUserId()); } - public static ServiceReqDetails getService(ServiceCategoriesEnum category) { + public static ServiceReqDetails getServiceByCategory(ServiceCategoriesEnum category) { return getDefaultService(CI_SERVICE, category, "al1976"); } @@ -300,6 +322,11 @@ public class ElementFactory { return serviceDetails; } + public static ServiceReqDetails getRandomCategoryService() { + ServiceReqDetails serviceReqDetails = getServiceByCategory(ServiceCategoriesEnum.getRandomElement()); + return serviceReqDetails; + } + // ***** PROPERTY *** public static PropertyReqDetails getDefaultProperty() { @@ -851,7 +878,6 @@ public class ElementFactory { try { errorInfo = ErrorValidationUtils.parseErrorConfigYaml(ActionStatus.COMPONENT_CATEGORY_NOT_FOUND.name()); } catch (FileNotFoundException e) { - // TODO Auto-generated catch block e.printStackTrace(); } String desc = (errorInfo.getMessageId() + ": " + errorInfo.getMessage()).replace("%2", "category").replace("%3", category).replace("%1", "resource"); @@ -964,17 +990,19 @@ public class ElementFactory { RequirementCapabilityRelDef requirementDef = new RequirementCapabilityRelDef(); requirementDef.setFromNode(fromCompInstId); requirementDef.setToNode(toCompInstId); - RequirementAndRelationshipPair pair = new RequirementAndRelationshipPair(); - pair.setRequirementOwnerId(reqOwnerId); - pair.setCapabilityOwnerId(capOwnerId); - pair.setRequirement(reqCapName); - RelationshipImpl relationship = new RelationshipImpl(); - relationship.setType(capType); - pair.setRelationships(relationship); - pair.setCapabilityUid(capList.get(0).getUniqueId()); - pair.setRequirementUid(reqList.get(0).getUniqueId()); - List<RequirementAndRelationshipPair> relationships = new ArrayList<>(); - relationships.add(pair); + RelationshipInfo relationInfo = new RelationshipInfo(); + relationInfo.setRequirementOwnerId(reqOwnerId); + relationInfo.setCapabilityOwnerId(capOwnerId); + relationInfo.setRequirement(reqCapName); + RelationshipImpl relationImpl = new RelationshipImpl(); + relationImpl.setType(capType); + relationInfo.setRelationships(relationImpl); + relationInfo.setCapabilityUid(capList.get(0).getUniqueId()); + relationInfo.setRequirementUid(reqList.get(0).getUniqueId()); + List<CapabilityRequirementRelationship> relationships = new ArrayList<>(); + CapabilityRequirementRelationship relationship = new CapabilityRequirementRelationship(); + relationship.setRelation(relationInfo); + relationships.add(relationship); requirementDef.setRelationships(relationships); return requirementDef; } @@ -95,19 +95,22 @@ public class FileHandling { } // ------------------------------------------------------------------------------------------------- + + /** + * @param folder, folder name under "Files" folder + * @return path to given folder from perspective of working directory or sdc-vnfs repository + */ public static String getFilePath(String folder) { - String filepath = System.getProperty("filepath"); - if (filepath == null && System.getProperty("os.name").contains("Windows")) { - filepath = FileHandling.getResourcesFilesPath() + folder + File.separator; - } - - else if(filepath.isEmpty() && !System.getProperty("os.name").contains("Windows")){ - filepath = FileHandling.getBasePath() + "Files" + File.separator + folder + File.separator; + String filepath = System.getProperty("filePath"); + boolean isFilePathEmptyOrNull = (filepath == null || filepath.isEmpty()); + + // return folder from perspective of sdc-vnfs repository + if (isFilePathEmptyOrNull && ( System.getProperty("os.name").contains("Windows") || System.getProperty("os.name").contains("Mac"))) { + return FileHandling.getResourcesFilesPath() + folder + File.separator; } - - System.out.println(filepath); - - return filepath; + + // return folder from perspective of working directory ( in general for nightly run from Linux, should already contain "Files" directory ) + return FileHandling.getBasePath() + "Files" + File.separator + folder + File.separator; } public static String getBasePath() { @@ -152,6 +155,10 @@ public class FileHandling { return getFilePath("VNFs"); } + public static String getPortMirroringRepositoryPath() { + return getFilePath("PortMirroring"); + } + public static File getConfigFile(String configFileName) throws Exception { File configFile = new File(FileHandling.getBasePath() + File.separator + "conf" + File.separator + configFileName); if (!configFile.exists()) { @@ -209,7 +216,7 @@ public class FileHandling { } public static String[] getArtifactsFromZip(String filepath, String zipFilename){ - try{ + try { ZipFile zipFile = new ZipFile(filepath + File.separator + zipFilename); Enumeration<? extends ZipEntry> entries = zipFile.entries(); @@ -227,8 +234,7 @@ public class FileHandling { } zipFile.close(); return artifactNames; - } - catch(ZipException zipEx){ + } catch(ZipException zipEx) { System.err.println("Error in zip file named : " + zipFilename); zipEx.printStackTrace(); } catch (IOException e) { @@ -240,6 +246,34 @@ public class FileHandling { } + public static List<String> getFileNamesFromZip(String zipFileLocation){ + try{ + ZipFile zipFile = new ZipFile(zipFileLocation); + Enumeration<? extends ZipEntry> entries = zipFile.entries(); + + List<String> artifactNames = new ArrayList<>(); + + int i = 0; + while(entries.hasMoreElements()){ + ZipEntry nextElement = entries.nextElement(); + if (!nextElement.isDirectory()){ + String name = nextElement.getName(); + artifactNames.add(name); + } + } + zipFile.close(); + return artifactNames; + } + catch(ZipException zipEx){ + System.err.println("Error in zip file named : " + zipFileLocation); + zipEx.printStackTrace(); + } catch (IOException e) { + System.err.println("Unhandled exception : "); + e.printStackTrace(); + } + return null; + } + // public static Object[] getZipFileNamesFromFolder(String filepath) { // return filterFileNamesFromFolder(filepath, ".zip"); // } @@ -562,4 +596,10 @@ public class FileHandling { return value.replaceAll("\"",""); } + + public static void overWriteExistindDir(String outputCsar) throws IOException { + String basePath = getBasePath(); + String csarDir = FileHandling.getCreateDirByName("outputCsar"); + FileUtils.cleanDirectory(new File(csarDir)); + } } @@ -20,16 +20,10 @@ package org.openecomp.sdc.ci.tests.utils.general; -import java.io.File; import java.io.IOException; import java.util.List; -import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.ci.tests.config.Config; import org.openecomp.sdc.ci.tests.datatypes.ImportReqDetails; -import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; -import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; -import org.openecomp.sdc.ci.tests.utils.Utils; public class ImportUtils { @@ -20,11 +20,21 @@ package org.openecomp.sdc.ci.tests.utils.general; -import com.aventstack.extentreports.Status; -import com.clearspring.analytics.util.Pair; -import com.google.gson.Gson; -import fj.data.Either; +import static org.testng.AssertJUnit.assertTrue; +import java.io.BufferedInputStream; +import java.io.BufferedOutputStream; +import java.io.ByteArrayInputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.commons.codec.binary.Base64; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.User; @@ -34,9 +44,7 @@ import org.openecomp.sdc.ci.tests.config.Config; import org.openecomp.sdc.ci.tests.datatypes.AmdocsLicenseMembers; import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; - import org.openecomp.sdc.ci.tests.datatypes.VendorSoftwareProductObject; -import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.ServiceCategoriesEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.datatypes.http.HttpHeaderEnum; @@ -45,14 +53,11 @@ import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; import org.openecomp.sdc.ci.tests.utils.Utils; import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils; -import java.io.*; -import java.nio.charset.StandardCharsets; -import java.util.*; -import org.apache.commons.codec.binary.Base64; - - +import com.aventstack.extentreports.Status; +import com.clearspring.analytics.util.Pair; +import com.google.gson.Gson; -import static org.testng.AssertJUnit.assertTrue; +import fj.data.Either; public class OnboardingUtillViaApis { @@ -64,13 +69,12 @@ public class OnboardingUtillViaApis { return headersMap; } - public static Pair<String, VendorSoftwareProductObject> createVspViaApis(String filepath, String vnfFile, User user) throws Exception { - + public static Pair<String, VendorSoftwareProductObject> createVspViaApis(ResourceReqDetails resourceReqDetails, String filepath, String vnfFile, User user) throws Exception { + VendorSoftwareProductObject vendorSoftwareProductObject = new VendorSoftwareProductObject(); ExtentTestActions.log(Status.INFO, String.format("Create Vendor License")); AmdocsLicenseMembers amdocsLicenseMembers = OnboardingUtils.createVendorLicense(user); - ExtentTestActions.log(Status.INFO, String.format("Create Vendor Software Product")); - Pair<String, Map<String, String>> createVendorSoftwareProduct = OnboardingUtils.createVendorSoftwareProduct(vnfFile, filepath, user, amdocsLicenseMembers); + Pair<String, Map<String, String>> createVendorSoftwareProduct = OnboardingUtils.createVendorSoftwareProduct(resourceReqDetails, vnfFile, filepath, user, amdocsLicenseMembers); Map<String, String> map = createVendorSoftwareProduct.right; vendorSoftwareProductObject.setAttContact(map.get("attContact")); vendorSoftwareProductObject.setCategory(map.get("category")); @@ -105,27 +109,17 @@ public class OnboardingUtillViaApis { return resource; }*/ - public static Resource createResourceFromVSP(ResourceReqDetails resourceDetails, String vspName) throws Exception { -// List<String> tags = new ArrayList<>(); -// tags.add(vspName); -// Map<String, String> map = createVendorSoftwareProduct.right; -// ResourceReqDetails resourceDetails = new ResourceReqDetails(); -// resourceDetails.setCsarUUID(map.get("vspId")); -// resourceDetails.setCsarVersion("1.0"); -// resourceDetails.setName(vspName); -// resourceDetails.setTags(tags); -// resourceDetails.setDescription(map.get("description")); -// resourceDetails.setResourceType(map.get("componentType")); -// resourceDetails.addCategoryChain(ResourceCategoryEnum.GENERIC_DATABASE.getCategory(), ResourceCategoryEnum.GENERIC_DATABASE.getSubCategory()); -// resourceDetails.setVendorName(map.get("vendorName")); -// resourceDetails.setVendorRelease("1.0"); -// resourceDetails.setResourceType("VF"); -// resourceDetails.setResourceVendorModelNumber("666"); -// resourceDetails.setContactId(map.get("attContact")); -// resourceDetails.setIcon("defaulticon"); + + public static Resource createResourceFromVSP(ResourceReqDetails resourceDetails, UserRoleEnum user) throws Exception { + Resource resource = AtomicOperationUtils.createResourceByResourceDetails(resourceDetails, user, true).left().value(); + + return resource; + } + + public static Resource createResourceFromVSP(ResourceReqDetails resourceDetails) throws Exception { Resource resource = AtomicOperationUtils.createResourceByResourceDetails(resourceDetails, UserRoleEnum.DESIGNER, true).left().value(); - return resource; + return resource; } public static void downloadToscaCsarToDirectory(Component component, File file) { try { @@ -134,7 +128,6 @@ public class OnboardingUtillViaApis { convertPayloadToFile(componentToscaArtifactPayload.left().value(), file); } } catch (Exception e) { - // TODO Auto-generated catch block e.printStackTrace(); } } @@ -258,25 +251,25 @@ public class OnboardingUtillViaApis { return Either.left(response.getResponse()); } - - public static ResourceReqDetails prepareOnboardedResourceDetailsBeforeCreate(VendorSoftwareProductObject vendorSoftwareProductObject, String vspName) { + + public static ResourceReqDetails prepareOnboardedResourceDetailsBeforeCreate(ResourceReqDetails resourceDetails, VendorSoftwareProductObject vendorSoftwareProductObject) { List<String> tags = new ArrayList<>(); - tags.add(vspName); - ResourceReqDetails resourceDetails = new ResourceReqDetails(); + tags.add(vendorSoftwareProductObject.getName()); +// ResourceReqDetails resourceDetails = new ResourceReqDetails(); resourceDetails.setCsarUUID(vendorSoftwareProductObject.getVspId()); - resourceDetails.setCsarVersion("1.0"); - resourceDetails.setName(vspName); + resourceDetails.setCsarVersion(vendorSoftwareProductObject.getVersion()); + resourceDetails.setName(vendorSoftwareProductObject.getName()); resourceDetails.setTags(tags); resourceDetails.setDescription(vendorSoftwareProductObject.getDescription()); - resourceDetails.addCategoryChain(ResourceCategoryEnum.GENERIC_DATABASE.getCategory(), ResourceCategoryEnum.GENERIC_DATABASE.getSubCategory()); +// resourceDetails.addCategoryChain(ResourceCategoryEnum.GENERIC_DATABASE.getCategory(), ResourceCategoryEnum.GENERIC_DATABASE.getSubCategory()); resourceDetails.setVendorName(vendorSoftwareProductObject.getVendorName()); - resourceDetails.setVendorRelease("1.0"); +// resourceDetails.setVendorRelease("1.0"); resourceDetails.setResourceType("VF"); resourceDetails.setResourceVendorModelNumber("666"); resourceDetails.setContactId(vendorSoftwareProductObject.getAttContact()); - resourceDetails.setIcon("defaulticon"); - +// resourceDetails.setIcon("defaulticon"); + return resourceDetails; } @@ -20,8 +20,21 @@ package org.openecomp.sdc.ci.tests.utils.general; -import com.aventstack.extentreports.Status; -import com.clearspring.analytics.util.Pair; +import static org.testng.AssertJUnit.assertEquals; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.io.StringWriter; +import java.nio.file.FileSystems; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.UUID; + import org.apache.commons.io.IOUtils; import org.apache.http.HttpEntity; import org.apache.http.client.ClientProtocolException; @@ -37,72 +50,145 @@ import org.json.simple.JSONArray; import org.json.simple.JSONValue; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.ci.tests.api.ComponentBaseTest; -import org.openecomp.sdc.ci.tests.api.ExtentTestActions; +import org.openecomp.sdc.ci.tests.api.Urls; import org.openecomp.sdc.ci.tests.config.Config; import org.openecomp.sdc.ci.tests.datatypes.AmdocsLicenseMembers; +import org.openecomp.sdc.ci.tests.datatypes.LicensingData; +import org.openecomp.sdc.ci.tests.datatypes.LicensingVersion; +import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; +import org.openecomp.sdc.ci.tests.datatypes.VendorSoftwareProductObject; +import org.openecomp.sdc.ci.tests.datatypes.VendorSoftwareProductObjectReqDetails; +import org.openecomp.sdc.ci.tests.datatypes.enums.CvfcTypeEnum; +import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum; import org.openecomp.sdc.ci.tests.datatypes.http.HttpHeaderEnum; import org.openecomp.sdc.ci.tests.datatypes.http.HttpRequest; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; import org.openecomp.sdc.ci.tests.utils.Utils; +import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; -import java.io.*; -import java.nio.file.FileSystems; -import java.util.*; - -import static org.testng.AssertJUnit.assertEquals; +import com.aventstack.extentreports.Status; +import com.clearspring.analytics.util.Pair; +import com.google.gson.Gson; public class OnboardingUtils { - protected static List<String> exludeVnfList = Arrays.asList("2016-197_vscp_vscp-fw_1610_e2e.zip", "2016-281_vProbes_BE_11_1_f_30_1610_e2e.zip", - "2016-282_vProbes_FE_11_1_f_30_1610_e2e.zip", "2016-044_vfw_fnat_30_1607_e2e.zip", "2017-376_vMOG_11_1.zip", "vMOG.zip", - - - "vMRF_USP_AIC3.0_1702.zip", "2016-211_vprobesbe_vprobes_be_30_1610_e2e.zip", "2016-005_vprobesfe_vprobes_fe_30_1607_e2e.zip", - "vMRF_RTT.zip", "2016-006_vvm_vvm_30_1607_e2e.zip", "2016-001_vvm_vvm_30_1607_e2e.zip"); + /** + * excluded VNF file list + */ + protected static List<String> exludeVnfList = +// new ArrayList<String>(); - protected static List<String> exludeVnfListForToscaParser = Arrays.asList("2016-043_vsaegw_fdnt_30_1607_e2e.zip", "vIRC_CC.zip", - "2016-045_vlb_lmsp_30_1607_e2e.zip", "2016-050_vdns_vmdns_30_1607_e2e.zip", - "2016-247_mns_mns_30_1610_e2e.zip", "2016-044_vfw_fcgi_30_1607_e2e.zip"); + Arrays.asList( + +// new VNFs + "Vhss-epc-rdm3-lab-vf-0921-v2.0-MOBILITY-10-20.zip", "Apndns-1710-vf-v3.0-10-20.zip", + "HeatCandidate_2017-09-22_01-48_55Name_2016-182-asbg-nsbg-tsbg-v1.0-(VOIP).zip", "HeatCandidate_2017-09-22_01-47_55Name_2016-182-asbg-nsbg-tsbg-v7.0-(VOIP).zip", + "Efmc-dbe-nin-v24.0-VOIP-10-20.zip", "VF_LMSP_v5-062317-V3.0-(Mobility).zip", "base_bwks_nfm_volume-236262502.zip", + +// newest failed VNFs + "HeatCandidate_2017-09-20_15-07_66Name_2016-20-visbc1vf-v4.0-(VOIP).zip", + "HeatCandidate_2017-09-20_15-06_66Name_2016-20-visbc1vf-v6.0-(VOIP).zip", "1-Vf-zrdm5bpxtc02-092017-(MOBILITY)_v3.0.zip", + "1-2017-491-4vshaken-HTTP-CM-vf-(VOIP)_v2.0.zip" + + ); + + /** + * additional files to exludeVnfList files for tosca parser tests + */ + protected static List<String> exludeVnfListForToscaParser = //new ArrayList<String>(); + Arrays.asList("1-Vvig-062017-(MOBILITY)_v5.1.zip", + "HeatCandidate_2017-09-22_01-43_57Name_2017389vtsbc4vf-v1.0-(VOIP).zip", + "1-Mvm-sbc-1710-092017-(MOBILITY)_v7.0.zip", + "1-2017-492-5vshaken-SIP-AS-vf-(VOIP)_v2.0.zip", + "HeatCandidate_2017-09-20_13-37_70Name_2017-491-4vshaken-HTTP-CM-vf-v1.0-(VOIP)_10202017.zip", "1-201712-488-adiod-vpe-(Layer-0-3)_v2.0.zip", + "2017-502.zip", + "1-2017-505-urlb-vhepe-(Layer-0-3)_v2.0.zip", + "2017-376_vMOG_11_1.zip", + "HeatCandidate_2017-09-22_00-55_62Name_2017-491-6vshaken-http-cm-vf-v1.0-(VOIP).zip", "HeatCandidate_2017-09-22_01-30_60Name_Vdbe-vsp-15.1x49-d50.3-v3.0-(VOIP).zip", + "HeatCandidate_2017-09-22_01-35_59Name_2017-418-afx-v1.0.zip", + "1-2017-488-adiod-vpe-(Layer-0-3)_v-5.0.zip", + "HeatCandidate_2017-09-22_01-42_57Name_2017389vtsbc4vf-v10.0-(VOIP).zip", + "HeatCandidate_2017-09-20_13-47_68Name_2017-492-5vshaken-SIP-AS-vf-v1.0-(VOIP)_10202017.zip", "1-2016-20-visbc3vf-(VOIP)_v2.1.zip", + "1-2017-404_vUSP_vCCF_AIC3.0-(VOIP)_v6.0.zip", "1-2017389vtsbc4vf-(VOIP)_v11.0.zip", + "HeatCandidate_2017-09-22_01-32_60Name_Vdbe-vsp-15.1x49-d50.3-v1.0-(VOIP).zip", "1-2017-418-afx-v1.1.zip"); public OnboardingUtils() { } - public static Pair<String, Map<String, String>> createVendorSoftwareProduct(String HeatFileName, String filepath, User user, AmdocsLicenseMembers amdocsLicenseMembers) + public static Pair<String, Map<String, String>> createVendorSoftwareProduct(ResourceReqDetails resourceReqDetails, String heatFileName, String filepath, User user, AmdocsLicenseMembers amdocsLicenseMembers, Map<CvfcTypeEnum, String> cvfcArtifacts) throws Exception { - Pair<String, Map<String, String>> pair = createVSP(HeatFileName, filepath, user, amdocsLicenseMembers); - + + Pair<String, Map<String, String>> pair = createVSP(resourceReqDetails, heatFileName, filepath, user, amdocsLicenseMembers); String vspid = pair.right.get("vspId"); - - prepareVspForUse(user, vspid); - + if(cvfcArtifacts != null && ! cvfcArtifacts.isEmpty()){ + OnboardingUtils.addCvfcArtifacts(cvfcArtifacts, vspid, user, null); + + } + prepareVspForUse(user, vspid, "0.1"); return pair; } - public static void prepareVspForUse(User user, String vspid) throws Exception { - RestResponse checkin = checkinVendorSoftwareProduct(vspid, user); + public static Pair<String, Map<String, String>> createVendorSoftwareProduct(ResourceReqDetails resourceReqDetails, String heatFileName, String filepath, User user, AmdocsLicenseMembers amdocsLicenseMembers) + throws Exception { + + Map<CvfcTypeEnum, String> cvfcArtifacts = new HashMap<>(); + return createVendorSoftwareProduct(resourceReqDetails, heatFileName, filepath, user, amdocsLicenseMembers, cvfcArtifacts); + } + +// duplicate function + public static void prepareVspForUse(User user, String vspid, String vspVersion) throws Exception { + + RestResponse checkin = OnboardingUtils.checkinVendorSoftwareProduct(vspid, user, vspVersion); assertEquals("did not succeed to checking new VSP", 200, checkin.getErrorCode().intValue()); - RestResponse submit = submitVendorSoftwareProduct(vspid, user); + RestResponse submit = OnboardingUtils.submitVendorSoftwareProduct(vspid, user, vspVersion); assertEquals("did not succeed to submit new VSP", 200, submit.getErrorCode().intValue()); - RestResponse createPackage = createPackageOfVendorSoftwareProduct(vspid, user); + RestResponse createPackage = OnboardingUtils.createPackageOfVendorSoftwareProduct(vspid, user, vspVersion); assertEquals("did not succeed to create package of new VSP ", 200, createPackage.getErrorCode().intValue()); - ComponentBaseTest.getExtendTest().log(Status.INFO, "Succeeded in creating the vendor software product"); +// ComponentBaseTest.getExtendTest().log(Status.INFO, "Succeeded in creating the vendor software product"); } - public static Pair<String, Map<String, String>> createVSP(String HeatFileName, String filepath, User user, AmdocsLicenseMembers amdocsLicenseMembers) throws Exception { - String vspName = handleFilename(HeatFileName); - - ComponentBaseTest.getExtendTest().log(Status.INFO, "Starting to create the vendor software product"); - - Pair<RestResponse, Map<String, String>> createNewVspPair = createNewVendorSoftwareProduct(vspName, amdocsLicenseMembers, user); + public static VendorSoftwareProductObject createAndFillVendorSoftwareProduct(ResourceReqDetails resourceReqDetails, String heatFileName, String filePath, User user, AmdocsLicenseMembers amdocsLicenseMembers, Map<CvfcTypeEnum, String> cvfcArtifacts) + throws Exception { + + Pair<String, Map<String, String>> createVendorSoftwareProduct = OnboardingUtils.createVendorSoftwareProduct(resourceReqDetails, heatFileName, filePath, user, amdocsLicenseMembers, cvfcArtifacts); + VendorSoftwareProductObject vendorSoftwareProductObject = fillVendorSoftwareProductObjectWithMetaData(heatFileName, createVendorSoftwareProduct); + return vendorSoftwareProductObject; + + } + + public static void updateVendorLicense(AmdocsLicenseMembers amdocsLicenseMembers, User user, String vlmVersion) throws Exception { + + RestResponse checkoutVendorLicense = checkoutVendorLicense(amdocsLicenseMembers.getVendorId(), user, vlmVersion); + assertEquals("did not succeed to checkout vendor license", 200, checkoutVendorLicense.getErrorCode().intValue()); + + RestResponse checkinVendorLicense = checkinVendorLicense(amdocsLicenseMembers.getVendorId(), user, vlmVersion); + assertEquals("did not succeed to checkin vendor license", 200, checkinVendorLicense.getErrorCode().intValue()); + + RestResponse submitVendorLicense = submitVendorLicense(amdocsLicenseMembers.getVendorId(), user, vlmVersion); + assertEquals("did not succeed to submit vendor license", 200, submitVendorLicense.getErrorCode().intValue()); + + if(ComponentBaseTest.getExtendTest() != null){ + ComponentBaseTest.getExtendTest().log(Status.INFO, "Succeeded in updating the vendor license"); + } + } + + public static Pair<String, Map<String, String>> createVSP(ResourceReqDetails resourceReqDetails, String heatFileName, String filepath, User user, AmdocsLicenseMembers amdocsLicenseMembers) throws Exception { + String vspName = handleFilename(heatFileName); + + if(ComponentBaseTest.getExtendTest() != null){ + ComponentBaseTest.getExtendTest().log(Status.INFO, "Starting to create the vendor software product"); + } + + Pair<RestResponse, Map<String, String>> createNewVspPair = createNewVendorSoftwareProduct(resourceReqDetails, vspName, amdocsLicenseMembers, user); RestResponse createNewVendorSoftwareProduct = createNewVspPair.left; assertEquals("did not succeed to create new VSP", 200,createNewVendorSoftwareProduct.getErrorCode().intValue()); String vspid = ResponseParser.getValueFromJsonResponse(createNewVendorSoftwareProduct.getResponse(), "vspId"); String componentId = ResponseParser.getValueFromJsonResponse(createNewVendorSoftwareProduct.getResponse(), "componentId"); - + Map<String, String> vspMeta = createNewVspPair.right; Map<String, String> vspObject = new HashMap<String, String>(); Iterator<String> iterator = vspMeta.keySet().iterator(); @@ -115,51 +201,63 @@ public class OnboardingUtils { vspObject.put("componentId", componentId); vspObject.put("vendorName", amdocsLicenseMembers.getVendorLicenseName()); vspObject.put("attContact", user.getUserId()); - - RestResponse uploadHeatPackage = uploadHeatPackage(filepath, HeatFileName, vspid, user); + + RestResponse uploadHeatPackage = uploadHeatPackage(filepath, heatFileName, vspid, user, "0.1"); assertEquals("did not succeed to upload HEAT package", 200, uploadHeatPackage.getErrorCode().intValue()); - - RestResponse validateUpload = validateUpload(vspid, user); - assertEquals("did not succeed to validate upload process", 200, validateUpload.getErrorCode().intValue()); - + + RestResponse validateUpload = validateUpload(vspid, user, "0.1"); + assertEquals("did not succeed to validate upload process, reason: " + validateUpload.getResponse(), 200, validateUpload.getErrorCode().intValue()); + Pair<String, Map<String, String>> pair = new Pair<String, Map<String, String>>(vspName, vspObject); - + return pair; } - - public static void updateVspWithVfcArtifacts(String filepath, String vspId, String updatedSnmpPoll, String updatedSnmpTrap, String componentId, User user) throws Exception{ - RestResponse checkout = checkoutVendorSoftwareProduct(vspId, user); + + public static void updateVspWithVfcArtifacts(String filepath, String vspId, String updatedSnmpPoll, String updatedSnmpTrap, String componentId, User user, String vspVersion) throws Exception{ + RestResponse checkout = checkoutVendorSoftwareProduct(vspId, user, vspVersion); assertEquals("did not succeed to checkout new VSP", 200, checkout.getErrorCode().intValue()); - ExtentTestActions.log(Status.INFO, "Deleting SNMP POLL"); - deleteSnmpArtifact(componentId, vspId, user, SnmpTypeEnum.SNMP_POLL); - ExtentTestActions.log(Status.INFO, "Deleting SNMP TRAP"); - deleteSnmpArtifact(componentId, vspId, user, SnmpTypeEnum.SNMP_TRAP); +// ExtentTestActions.log(Status.INFO, "Deleting SNMP POLL"); + deleteArtifactByType(componentId, vspId, user, CvfcTypeEnum.SNMP_POLL); +// ExtentTestActions.log(Status.INFO, "Deleting SNMP TRAP"); + deleteArtifactByType(componentId, vspId, user, CvfcTypeEnum.SNMP_TRAP); addVFCArtifacts(filepath, updatedSnmpPoll, updatedSnmpTrap, vspId, user, componentId); - prepareVspForUse(user, vspId); + prepareVspForUse(user, vspId, vspVersion); } - - public static String updateVendorSoftwareProduct(String vspId, String HeatFileName, String filepath, User user) - throws Exception, Throwable { - String vspName = handleFilename(HeatFileName); + + private static RestResponse deleteArtifactByType(String componentId, String vspId, User user, CvfcTypeEnum snmpType) throws Exception + { + Config config = Utils.getConfig(); + String url = String.format(Urls.DELETE_AMDOCS_ARTIFACT_BY_TYPE, config.getCatalogBeHost(),config.getCatalogBePort(), vspId, componentId, snmpType.getValue()); + String userId = user.getUserId(); + Map<String, String> headersMap = prepareHeadersMap(userId); + + HttpRequest http = new HttpRequest(); + RestResponse response = http.httpSendDelete(url, headersMap); + return response; + } + +// duplicated method + public static String updateVendorSoftwareProduct(String vspId, String HeatFileName, String filepath, User user, String vspVersion) + throws Exception, Throwable { + String vspName = OnboardingUtils.handleFilename(HeatFileName); ComponentBaseTest.getExtendTest().log(Status.INFO, "Starting to update the vendor software product"); - RestResponse checkout = checkoutVendorSoftwareProduct(vspId, user); + RestResponse checkout = OnboardingUtils.checkoutVendorSoftwareProduct(vspId, user, vspVersion); assertEquals("did not succeed to checkout new VSP", 200, checkout.getErrorCode().intValue()); - RestResponse uploadHeatPackage = uploadHeatPackage(filepath, HeatFileName, vspId, user); + RestResponse uploadHeatPackage = OnboardingUtils.uploadHeatPackage(filepath, HeatFileName, vspId, user, vspVersion); assertEquals("did not succeed to upload HEAT package", 200, uploadHeatPackage.getErrorCode().intValue()); - - RestResponse validateUpload = validateUpload(vspId, user); + + RestResponse validateUpload = OnboardingUtils.validateUpload(vspId, user, vspVersion); assertEquals("did not succeed to validate upload process", 200, validateUpload.getErrorCode().intValue()); - - RestResponse checkin = checkinVendorSoftwareProduct(vspId, user); - assertEquals("did not succeed to checking VSP", 200, checkin.getErrorCode().intValue()); + RestResponse checkin = OnboardingUtils.checkinVendorSoftwareProduct(vspId, user, vspVersion); + assertEquals("did not succeed to checking VSP", 200, checkin.getErrorCode().intValue()); - RestResponse submit = submitVendorSoftwareProduct(vspId, user); + RestResponse submit = OnboardingUtils.submitVendorSoftwareProduct(vspId, user, vspVersion); assertEquals("did not succeed to submit VSP", 200, submit.getErrorCode().intValue()); - RestResponse createPackage = createPackageOfVendorSoftwareProduct(vspId, user); + RestResponse createPackage = OnboardingUtils.createPackageOfVendorSoftwareProduct(vspId, user, vspVersion); assertEquals("did not succeed to update package of VSP ", 200, createPackage.getErrorCode().intValue()); ComponentBaseTest.getExtendTest().log(Status.INFO, "Succeeded in updating the vendor software product"); @@ -167,6 +265,21 @@ public class OnboardingUtils { return vspName; } + public static void updateVendorSoftwareProductToNextVersion(VendorSoftwareProductObject vendorSoftwareProductObject, String toVspVersion, User user) + throws Exception, Throwable { + + RestResponse checkout = checkoutVendorSoftwareProduct(vendorSoftwareProductObject.getVspId(), user, vendorSoftwareProductObject.getVersion()); + assertEquals("did not succeed to checkout new VSP", 200, checkout.getErrorCode().intValue()); + + RestResponse checkin = checkinVendorSoftwareProduct(vendorSoftwareProductObject.getVspId(), user, vendorSoftwareProductObject.getVersion()); + assertEquals("did not succeed to checking VSP", 200, checkin.getErrorCode().intValue()); + + RestResponse submit = submitVendorSoftwareProduct(vendorSoftwareProductObject.getVspId(), user, vendorSoftwareProductObject.getVersion()); + assertEquals("did not succeed to submit VSP", 200, submit.getErrorCode().intValue()); + + vendorSoftwareProductObject.setVersion(toVspVersion); + } + public static String handleFilename(String heatFileName) { final String namePrefix = "ciVFOnboarded-"; final String nameSuffix = "-" + getShortUUID(); @@ -190,12 +303,12 @@ public class OnboardingUtils { vspComponentId = (vspComponentId == null) ? getVSPComponentId(vspid, user) : vspComponentId; if (vspComponentId != null){ if (snmpPoll != null){ - ExtentTestActions.log(Status.INFO, "Adding VFC artifact of type SNMP POLL with the file " + snmpPoll); +// ExtentTestActions.log(Status.INFO, "Adding VFC artifact of type SNMP POLL with the file " + snmpPoll); RestResponse uploadSnmpPollArtifact = uploadSnmpPollArtifact(filepath, snmpPoll, vspid, user, vspComponentId); assertEquals("Did not succeed to add SNMP POLL", 200, uploadSnmpPollArtifact.getErrorCode().intValue()); } if (snmpTrap != null){ - ExtentTestActions.log(Status.INFO, "Adding VFC artifact of type SNMP TRAP with the file " + snmpTrap); +// ExtentTestActions.log(Status.INFO, "Adding VFC artifact of type SNMP TRAP with the file " + snmpTrap); RestResponse uploadSnmpTrapArtifact = uploadSnmpTrapArtifact(filepath, snmpTrap, vspid, user, vspComponentId); assertEquals("Did not succeed to add SNMP TRAP", 200, uploadSnmpTrapArtifact.getErrorCode().intValue()); } @@ -203,24 +316,41 @@ public class OnboardingUtils { return vspComponentId; } - + + public static String addCvfcArtifacts(Map<CvfcTypeEnum, String> componentVfcArtifacts, String vspid, User user, String vspComponentId) throws Exception{ + vspComponentId = (vspComponentId == null) ? getVSPComponentId(vspid, user) : vspComponentId; + if (vspComponentId != null){ + for(Map.Entry<CvfcTypeEnum, String> entry : componentVfcArtifacts.entrySet()){ +// ExtentTestActions.log(Status.INFO, "Adding VFC artifact of type " + entry.getKey().getValue() + " with the file " + entry.getValue()); + RestResponse uploadSnmpPollArtifact = uploadCvfcArtifact(entry.getValue(), entry.getKey().getValue(), vspid, user, vspComponentId); + assertEquals("Did not succeed to add " + entry.getKey().getValue(), BaseRestUtils.STATUS_CODE_SUCCESS, uploadSnmpPollArtifact.getErrorCode().intValue()); + } + } + return vspComponentId; + } + public static String addVFCArtifacts(String filepath, String snmpPoll, String snmpTrap, String vspid, User user) throws Exception{ return addVFCArtifacts(filepath, snmpPoll, snmpTrap, vspid, user, null); } + public static RestResponse uploadCvfcArtifact(String filepath, String cvfcType, String vspid, User user, String vspComponentId) throws FileNotFoundException, IOException, ClientProtocolException { + Config config = Utils.getConfig(); + String snmpPollUrl = String.format(Urls.UPLOAD_AMDOCS_ARTIFACT, config.getCatalogBeHost(),config.getCatalogBePort(), vspid, vspComponentId, cvfcType); + return uploadFile(filepath, null, snmpPollUrl, user); + } + + private static RestResponse uploadSnmpPollArtifact(String filepath, String zipArtifact, String vspid, User user, - String vspComponentId) throws FileNotFoundException, IOException, ClientProtocolException { + String vspComponentId) throws FileNotFoundException, IOException, ClientProtocolException { Config config = Utils.getConfig(); - String snmpPollUrl = String.format("http://%s:%s/onboarding-api/v1.0/vendor-software-products/%s/versions/0.1/components/%s/monitors/snmp/upload", - config.getCatalogBeHost(),config.getCatalogBePort(), vspid, vspComponentId); + String snmpPollUrl = String.format(Urls.UPLOAD_SNMP_POLL_ARTIFACT, config.getCatalogBeHost(),config.getCatalogBePort(), vspid, vspComponentId); return uploadFile(filepath, zipArtifact, snmpPollUrl, user); } - + private static RestResponse uploadSnmpTrapArtifact(String filepath, String zipArtifact, String vspid, User user, - String vspComponentId) throws FileNotFoundException, IOException, ClientProtocolException { + String vspComponentId) throws FileNotFoundException, IOException, ClientProtocolException { Config config = Utils.getConfig(); - String snmpTrapUrl = String.format("http://%s:%s/onboarding-api/v1.0/vendor-software-products/%s/versions/0.1/components/%s/monitors/snmp-trap/upload", - config.getCatalogBeHost(),config.getCatalogBePort(), vspid, vspComponentId); + String snmpTrapUrl = String.format(Urls.UPLOAD_SNMP_POLL_ARTIFACT, config.getCatalogBeHost(),config.getCatalogBePort(), vspid, vspComponentId); return uploadFile(filepath, zipArtifact, snmpTrapUrl, user); } @@ -237,8 +367,6 @@ public class OnboardingUtils { RestResponse response = http.httpSendDelete(url, headersMap); return response; } - - private static String getVSPComponentId(String vspid, User user) throws Exception, JSONException { RestResponse components = getVSPComponents(vspid, user); @@ -252,10 +380,10 @@ public class OnboardingUtils { } return null; } - + private static RestResponse getVSPComponents(String vspid, User user) throws Exception{ Config config = Utils.getConfig(); - String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-software-products/%s/versions/0.1/components", config.getCatalogBeHost(),config.getCatalogBePort(), vspid); + String url = String.format(Urls.GET_VSP_COMPONENTS, config.getCatalogBeHost(),config.getCatalogBePort(), vspid); String userId = user.getUserId(); Map<String, String> headersMap = prepareHeadersMap(userId); @@ -265,53 +393,91 @@ public class OnboardingUtils { return response; } + private static RestResponse getVLMComponentByVersion(String vlmId, String vlmVersion, User user) throws Exception{ + Config config = Utils.getConfig(); + String url = String.format(Urls.GET_VLM_COMPONENT_BY_VERSION, config.getCatalogBeHost(),config.getCatalogBePort(), vlmId,vlmVersion); + String userId = user.getUserId(); + + Map<String, String> headersMap = prepareHeadersMap(userId); + + HttpRequest http = new HttpRequest(); + RestResponse response = http.httpSendGet(url, headersMap); + return response; + } + + public static boolean validateVspExist(String vspId, String vspVersion, User user) throws Exception { + RestResponse restResponse = getVSPComponentByVersion(vspId, vspVersion, user); + assertEquals(String.format("Vsp version not updated, reponse message: %s", restResponse.getResponse()),restResponse.getErrorCode().intValue(),200); + return (restResponse.getErrorCode()==200); + } + + public static boolean validateVlmExist(String vlmId, String vlmVersion, User user) throws Exception { + RestResponse restResponse = getVLMComponentByVersion(vlmId, vlmVersion, user); + assertEquals(String.format("VLM version not updated, reponse code message: %s", restResponse.getResponse()),restResponse.getErrorCode().intValue(),200); + return (restResponse.getErrorCode()==200); + } + + + private static RestResponse getVSPComponentByVersion(String vspId, String vspVersion, User user) throws Exception{ + Config config = Utils.getConfig(); + String url = String.format(Urls.GET_VSP_COMPONENT_BY_VERSION, config.getCatalogBeHost(),config.getCatalogBePort(), vspId,vspVersion); + String userId = user.getUserId(); + + Map<String, String> headersMap = prepareHeadersMap(userId); + + HttpRequest http = new HttpRequest(); + RestResponse response = http.httpSendGet(url, headersMap); + return response; + } + +// Duplicate method public static AmdocsLicenseMembers createVendorLicense(User user) throws Exception { AmdocsLicenseMembers amdocsLicenseMembers; - ComponentBaseTest.getExtendTest().log(Status.INFO, "Starting to create the vendor license"); - String vendorLicenseName = "ciLicense" + getShortUUID(); - RestResponse vendorLicenseResponse = createVendorLicenseModels_1(vendorLicenseName, user); +// ComponentBaseTest.getExtendTest().log(Status.INFO, "Starting to create the vendor license"); + String vendorLicenseName = "ciLicense" + OnboardingUtils.getShortUUID(); + RestResponse vendorLicenseResponse = OnboardingUtils.createVendorLicenseModels_1(vendorLicenseName, user); assertEquals("did not succeed to create vendor license model", 200, vendorLicenseResponse.getErrorCode().intValue()); String vendorId = ResponseParser.getValueFromJsonResponse(vendorLicenseResponse.getResponse(), "value"); - RestResponse vendorKeyGroupsResponse = createVendorKeyGroups_2(vendorId, user); + RestResponse vendorKeyGroupsResponse = OnboardingUtils.createVendorKeyGroups_2(vendorId, user); assertEquals("did not succeed to create vendor key groups", 200, vendorKeyGroupsResponse.getErrorCode().intValue()); String keyGroupId = ResponseParser.getValueFromJsonResponse(vendorKeyGroupsResponse.getResponse(), "value"); - RestResponse vendorEntitlementPool = createVendorEntitlementPool_3(vendorId, user); + RestResponse vendorEntitlementPool = OnboardingUtils.createVendorEntitlementPool_3(vendorId, user); assertEquals("did not succeed to create vendor entitlement pool", 200, vendorEntitlementPool.getErrorCode().intValue()); String entitlementPoolId = ResponseParser.getValueFromJsonResponse(vendorEntitlementPool.getResponse(), "value"); - RestResponse vendorLicenseFeatureGroups = createVendorLicenseFeatureGroups_4(vendorId, keyGroupId, entitlementPoolId, user); + RestResponse vendorLicenseFeatureGroups = OnboardingUtils.createVendorLicenseFeatureGroups_4(vendorId, keyGroupId, entitlementPoolId, user); assertEquals("did not succeed to create vendor license feature groups", 200, vendorLicenseFeatureGroups.getErrorCode().intValue()); String featureGroupId = ResponseParser.getValueFromJsonResponse(vendorLicenseFeatureGroups.getResponse(), "value"); - RestResponse vendorLicenseAgreement = createVendorLicenseAgreement_5(vendorId, featureGroupId, user); + RestResponse vendorLicenseAgreement = OnboardingUtils.createVendorLicenseAgreement_5(vendorId, featureGroupId, user); assertEquals("did not succeed to create vendor license agreement", 200, vendorLicenseAgreement.getErrorCode().intValue()); String vendorLicenseAgreementId = ResponseParser.getValueFromJsonResponse(vendorLicenseAgreement.getResponse(), "value"); - RestResponse checkinVendorLicense = checkinVendorLicense(vendorId, user); + RestResponse checkinVendorLicense = OnboardingUtils.checkinVendorLicense(vendorId, user, "0.1"); assertEquals("did not succeed to checkin vendor license", 200, checkinVendorLicense.getErrorCode().intValue()); - RestResponse submitVendorLicense = submitVendorLicense(vendorId, user); + RestResponse submitVendorLicense = OnboardingUtils.submitVendorLicense(vendorId, user, "0.1"); assertEquals("did not succeed to submit vendor license", 200, submitVendorLicense.getErrorCode().intValue()); - ComponentBaseTest.getExtendTest().log(Status.INFO, "Succeeded in creating the vendor license"); +// ComponentBaseTest.getExtendTest().log(Status.INFO, "Succeeded in creating the vendor license"); amdocsLicenseMembers = new AmdocsLicenseMembers(vendorId, vendorLicenseName, vendorLicenseAgreementId, featureGroupId); - + amdocsLicenseMembers.setVersion("1.0"); // Once object created and submitted, his initial version is 1.0 + return amdocsLicenseMembers; } - private static String getShortUUID() { + public static String getShortUUID() { return UUID.randomUUID().toString().split("-")[0]; } - private static RestResponse actionOnComponent(String vspid, String action, String onboardComponent, User user) + private static RestResponse actionOnComponent(String vspid, String action, String onboardComponent, User user, String componentVersion) throws Exception { Config config = Utils.getConfig(); - String url = String.format("http://%s:%s/onboarding-api/v1.0/" + onboardComponent + "/%s/versions/0.1/actions", - config.getCatalogBeHost(), config.getCatalogBePort(), vspid); + String url = String.format(Urls.ACTION_ON_COMPONENT, config.getCatalogBeHost(), config.getCatalogBePort(), onboardComponent, vspid, componentVersion); String userId = user.getUserId(); JSONObject jObject = new JSONObject(); @@ -324,17 +490,22 @@ public class OnboardingUtils { return response; } - public static RestResponse checkinVendorLicense(String vspid, User user) throws Exception { - return actionOnComponent(vspid, "Checkin", "vendor-license-models", user); + + public static RestResponse checkinVendorLicense(String vspid, User user, String vlmVersion) throws Exception { + return actionOnComponent(vspid, "Checkin", "vendor-license-models", user, vlmVersion); + } + + public static RestResponse checkoutVendorLicense(String vspid, User user, String vlmVersion) throws Exception { + return actionOnComponent(vspid, "Checkout", "vendor-license-models", user, vlmVersion); } - public static RestResponse submitVendorLicense(String vspid, User user) throws Exception { - return actionOnComponent(vspid, "Submit", "vendor-license-models", user); + public static RestResponse submitVendorLicense(String vspid, User user, String vlmVersion) throws Exception { + return actionOnComponent(vspid, "Submit", "vendor-license-models", user, vlmVersion); } public static RestResponse createVendorLicenseModels_1(String name, User user) throws Exception { Config config = Utils.getConfig(); - String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-license-models", config.getCatalogBeHost(), + String url = String.format(Urls.CREATE_VENDOR_LISENCE_MODELS, config.getCatalogBeHost(), config.getCatalogBePort()); String userId = user.getUserId(); @@ -354,8 +525,7 @@ public class OnboardingUtils { public static RestResponse createVendorLicenseAgreement_5(String vspid, String featureGroupId, User user) throws Exception { Config config = Utils.getConfig(); - String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-license-models/%s/versions/0.1/license-agreements", - config.getCatalogBeHost(), config.getCatalogBePort(), vspid); + String url = String.format(Urls.CREATE_VENDOR_LISENCE_AGREEMENT, config.getCatalogBeHost(), config.getCatalogBePort(), vspid); String userId = user.getUserId(); JSONObject licenseTermpObject = new JSONObject(); @@ -377,10 +547,9 @@ public class OnboardingUtils { } public static RestResponse createVendorLicenseFeatureGroups_4(String vspid, String licenseKeyGroupId, - String entitlementPoolId, User user) throws Exception { + String entitlementPoolId, User user) throws Exception { Config config = Utils.getConfig(); - String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-license-models/%s/versions/0.1/feature-groups", - config.getCatalogBeHost(), config.getCatalogBePort(), vspid); + String url = String.format(Urls.CREATE_VENDOR_LISENCE_FEATURE_GROUPS, config.getCatalogBeHost(), config.getCatalogBePort(), vspid); String userId = user.getUserId(); JSONObject jObject = new JSONObject(); @@ -401,8 +570,7 @@ public class OnboardingUtils { public static RestResponse createVendorEntitlementPool_3(String vspid, User user) throws Exception { Config config = Utils.getConfig(); - String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-license-models/%s/versions/0.1/entitlement-pools", - config.getCatalogBeHost(), config.getCatalogBePort(), vspid); + String url = String.format(Urls.CREATE_VENDOR_LISENCE_ENTITLEMENT_POOL, config.getCatalogBeHost(), config.getCatalogBePort(), vspid); String userId = user.getUserId(); JSONObject jEntitlementMetricObject = new JSONObject(); @@ -442,8 +610,7 @@ public class OnboardingUtils { public static RestResponse createVendorKeyGroups_2(String vspid, User user) throws Exception { Config config = Utils.getConfig(); - String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-license-models/%s/versions/0.1/license-key-groups", - config.getCatalogBeHost(), config.getCatalogBePort(), vspid); + String url = String.format(Urls.CREATE_VENDOR_LISENCE_KEY_GROUPS, config.getCatalogBeHost(), config.getCatalogBePort(), vspid); String userId = user.getUserId(); JSONObject jOperationalScope = new JSONObject(); @@ -463,56 +630,51 @@ public class OnboardingUtils { return response; } - public static Pair<RestResponse, Map<String, String>> createNewVendorSoftwareProduct(String name, AmdocsLicenseMembers amdocsLicenseMembers, User user) throws Exception { + public static Pair<RestResponse, Map<String, String>> createNewVendorSoftwareProduct(ResourceReqDetails resourceReqDetails, String vspName, AmdocsLicenseMembers amdocsLicenseMembers, User user) throws Exception { Map<String, String> vspMetadta = new HashMap<String, String>(); - - Config config = Utils.getConfig(); - String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-software-products", - config.getCatalogBeHost(), config.getCatalogBePort()); + Config config = Utils.getConfig(); + String url = String.format(Urls.CREATE_VENDOR_SOFTWARE_PRODUCT, config.getCatalogBeHost(), config.getCatalogBePort()); String userId = user.getUserId(); + VendorSoftwareProductObject vendorSoftwareProductObject = new VendorSoftwareProductObject(); + LicensingData licensingData = new LicensingData(amdocsLicenseMembers.getVendorLicenseAgreementId(), Arrays.asList(amdocsLicenseMembers.getFeatureGroupId())); + LicensingVersion licensingVersion = new LicensingVersion("1.0", "1.0"); + ResourceCategoryEnum resourceCategoryEnum = ResourceCategoryEnum.findEnumNameByValues(resourceReqDetails.getCategories().get(0).getName(), resourceReqDetails.getCategories().get(0).getSubcategories().get(0).getName()); + + vendorSoftwareProductObject.setLicensingVersion(licensingVersion); + + vendorSoftwareProductObject.setName(vspName); + vendorSoftwareProductObject.setDescription(resourceReqDetails.getDescription()); + vendorSoftwareProductObject.setCategory(resourceCategoryEnum.getCategoryUniqeId()); + vendorSoftwareProductObject.setSubCategory(resourceCategoryEnum.getSubCategoryUniqeId()); + vendorSoftwareProductObject.setOnboardingMethod("NetworkPackage"); + vendorSoftwareProductObject.setVendorName(amdocsLicenseMembers.getVendorLicenseName()); + vendorSoftwareProductObject.setVendorId(amdocsLicenseMembers.getVendorId()); + vendorSoftwareProductObject.setIcon("icon"); + vendorSoftwareProductObject.setLicensingData(licensingData); + + vspMetadta.put("description", resourceReqDetails.getDescription()); + vspMetadta.put("category", resourceCategoryEnum.getCategory()); + vspMetadta.put("subCategory", resourceCategoryEnum.getSubCategory()); - JSONObject jlicensingDataObj = new JSONObject(); - jlicensingDataObj.put("licenseAgreement", amdocsLicenseMembers.getVendorLicenseAgreementId()); - jlicensingDataObj.put("featureGroups", Arrays.asList(amdocsLicenseMembers.getFeatureGroupId()).toArray()); - - JSONObject jlicensingVersionObj = new JSONObject(); - jlicensingVersionObj.put("id", "1.0"); - jlicensingVersionObj.put("label", "1.0"); - - JSONObject jObject = new JSONObject(); - jObject.put("name", name); - jObject.put("description", "new VSP description"); - jObject.put("category", "resourceNewCategory.generic"); - jObject.put("subCategory", "resourceNewCategory.generic.database"); - jObject.put("onboardingMethod", "NetworkPackage"); - jObject.put("licensingVersion", jlicensingVersionObj); - jObject.put("vendorName", amdocsLicenseMembers.getVendorLicenseName()); - jObject.put("vendorId", amdocsLicenseMembers.getVendorId()); - jObject.put("icon", "icon"); - jObject.put("licensingData", jlicensingDataObj); - - vspMetadta.put("description", jObject.getString("description")); - vspMetadta.put("category", jObject.getString("category")); - vspMetadta.put("subCategory", jObject.getString("subCategory").split("\\.")[2]); - Map<String, String> headersMap = prepareHeadersMap(userId); HttpRequest http = new HttpRequest(); + Gson gson = new Gson(); + String body = gson.toJson(vendorSoftwareProductObject); - RestResponse response = http.httpSendPost(url, jObject.toString(), headersMap); + RestResponse response = http.httpSendPost(url, body, headersMap); return new Pair<RestResponse, Map<String, String>>(response, vspMetadta); } - - public static RestResponse validateUpload(String vspid, User user) throws Exception { + + public static RestResponse validateUpload(String vspid, User user, String vspVersion) throws Exception { Config config = Utils.getConfig(); - String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-software-products/%s/versions/0.1/orchestration-template-candidate/process", - config.getCatalogBeHost(), config.getCatalogBePort(), vspid); + String url = String.format(Urls.VALIDATE_UPLOAD, config.getCatalogBeHost(), config.getCatalogBePort(), vspid,vspVersion); String userId = user.getUserId(); Map<String, String> headersMap = prepareHeadersMap(userId); HttpRequest http = new HttpRequest(); - + String body =null; RestResponse response = http.httpSendPut(url, body, headersMap); @@ -520,9 +682,9 @@ public class OnboardingUtils { return response; } - public static RestResponse uploadHeatPackage(String filepath, String filename, String vspid, User user) throws Exception { + public static RestResponse uploadHeatPackage(String filepath, String filename, String vspid, User user, String vspVersion) throws Exception { Config config = Utils.getConfig(); - String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-software-products/%s/versions/0.1/orchestration-template-candidate", config.getCatalogBeHost(), config.getCatalogBePort(), vspid); + String url = String.format(Urls.UPLOAD_HEAT_PACKAGE, config.getCatalogBeHost(), config.getCatalogBePort(), vspid, vspVersion); return uploadFile(filepath, filename, url, user); } @@ -553,11 +715,10 @@ public class OnboardingUtils { String responseBody = null; if (entity != null) { InputStream instream = entity.getContent(); - StringWriter writer = new StringWriter(); - IOUtils.copy(instream, writer); - responseBody = writer.toString(); try { - + StringWriter writer = new StringWriter(); + IOUtils.copy(instream, writer); + responseBody = writer.toString(); } finally { instream.close(); } @@ -595,27 +756,39 @@ public class OnboardingUtils { } } +// private static File getTestZipFile(String filepath, String filename) throws IOException { +// Config config = Utils.getConfig(); +// String sourceDir = config.getImportResourceTestsConfigDir(); +// java.nio.file.Path filePath = FileSystems.getDefault().getPath(filepath + File.separator + filename); +// return filePath.toFile(); +// } + private static File getTestZipFile(String filepath, String filename) throws IOException { Config config = Utils.getConfig(); String sourceDir = config.getImportResourceTestsConfigDir(); - java.nio.file.Path filePath = FileSystems.getDefault().getPath(filepath + File.separator + filename); + java.nio.file.Path filePath; + if(filename == null){ + filePath = FileSystems.getDefault().getPath(filepath); + }else{ + filePath = FileSystems.getDefault().getPath(filepath + File.separator + filename); + } return filePath.toFile(); } - public static RestResponse checkinVendorSoftwareProduct(String vspid, User user) throws Exception { - return actionOnComponent(vspid, "Checkin", "vendor-software-products", user); + public static RestResponse checkinVendorSoftwareProduct(String vspid, User user, String vspVersion) throws Exception { + return actionOnComponent(vspid, "Checkin", "vendor-software-products", user, vspVersion); } - - private static RestResponse checkoutVendorSoftwareProduct(String vspid, User user) throws Exception { - return actionOnComponent(vspid, "Checkout", "vendor-software-products", user); + + public static RestResponse checkoutVendorSoftwareProduct(String vspid, User user, String vspVersion) throws Exception { + return actionOnComponent(vspid, "Checkout", "vendor-software-products", user, vspVersion); } - public static RestResponse submitVendorSoftwareProduct(String vspid, User user) throws Exception { - return actionOnComponent(vspid, "Submit", "vendor-software-products", user); + public static RestResponse submitVendorSoftwareProduct(String vspid, User user, String vspVersion) throws Exception { + return actionOnComponent(vspid, "Submit", "vendor-software-products", user, vspVersion); } - public static RestResponse createPackageOfVendorSoftwareProduct(String vspid, User user) throws Exception { - return actionOnComponent(vspid, "Create_Package", "vendor-software-products", user); + public static RestResponse createPackageOfVendorSoftwareProduct(String vspid, User user, String vspVersion) throws Exception { + return actionOnComponent(vspid, "Create_Package", "vendor-software-products", user, vspVersion); } protected static Map<String, String> prepareHeadersMap(String userId) { @@ -626,7 +799,55 @@ public class OnboardingUtils { return headersMap; } - + public static VendorSoftwareProductObject updateVSPWithNewVLMParameters(VendorSoftwareProductObject vendorSoftwareProductObject, + AmdocsLicenseMembers amdocsLicenseMembers, User user, String vspCurrentVersion, String vspNextVersion) throws Exception { + + LicensingVersion licensingVersion = new LicensingVersion(amdocsLicenseMembers.getLicenseVersionId(),amdocsLicenseMembers.getLicenseVersionId()); + LicensingData licensingData = new LicensingData(amdocsLicenseMembers.getVendorLicenseAgreementId(), Arrays.asList(amdocsLicenseMembers.getFeatureGroupId())); + vendorSoftwareProductObject.setVendorId(amdocsLicenseMembers.getVendorId()); + vendorSoftwareProductObject.setVendorName(amdocsLicenseMembers.getVendorLicenseName()); + vendorSoftwareProductObject.setLicensingVersion(licensingVersion); + vendorSoftwareProductObject.setLicensingData(licensingData); + + VendorSoftwareProductObjectReqDetails vendorSoftwareProductObjectReqDetails = new VendorSoftwareProductObjectReqDetails( + vendorSoftwareProductObject.getName(), + vendorSoftwareProductObject.getDescription(), + vendorSoftwareProductObject.getCategory(), + vendorSoftwareProductObject.getSubCategory(), + vendorSoftwareProductObject.getVendorId(), + vendorSoftwareProductObject.getVendorName(), + licensingVersion, + licensingData, + vendorSoftwareProductObject.getOnboardingMethod(), + vendorSoftwareProductObject.getNetworkPackageName(), + vendorSoftwareProductObject.getOnboardingOrigin()); + + Gson gson = new Gson(); + String json = gson.toJson(vendorSoftwareProductObjectReqDetails); + + RestResponse checkout = checkoutVendorSoftwareProduct(vendorSoftwareProductObject.getVspId(), user, "1.0"); + assertEquals("did not succeed to checkout new VSP", 200, checkout.getErrorCode().intValue()); + + Config config = Utils.getConfig(); + String url = String.format(Urls.UPDATE_VSP, config.getCatalogBeHost(), config.getCatalogBePort(), vendorSoftwareProductObject.getVspId(), vspCurrentVersion); + String userId = user.getUserId(); + + Map<String, String> headersMap = prepareHeadersMap(userId); + HttpRequest http = new HttpRequest(); + + RestResponse response = http.httpSendPut(url, json, headersMap); + + RestResponse checkin = checkinVendorSoftwareProduct(vendorSoftwareProductObject.getVspId(), user, vspCurrentVersion); + assertEquals("did not succeed to checking VSP", 200, checkin.getErrorCode().intValue()); + + RestResponse submit = submitVendorSoftwareProduct(vendorSoftwareProductObject.getVspId(), user, vspCurrentVersion); + assertEquals("did not succeed to submit VSP", 200, submit.getErrorCode().intValue()); + + vendorSoftwareProductObject.setVersion(vspNextVersion); + + return vendorSoftwareProductObject; + } + // private static void importUpdateVSP(Pair<String, Map<String, String>> vsp, boolean isUpdate) throws Exception{ // String vspName = vsp.left; // Map<String, String> vspMetadata = vsp.right; @@ -785,7 +1006,63 @@ public class OnboardingUtils { fileNamesFromFolder.removeAll(exludeVnfListForToscaParser); return fileNamesFromFolder; } - + + public static VendorSoftwareProductObject fillVendorSoftwareProductObjectWithMetaData(String vnfFile, Pair<String, Map<String, String>> createVendorSoftwareProduct) { + VendorSoftwareProductObject vendorSoftwareProductObject = new VendorSoftwareProductObject(); + Map<String, String> map = createVendorSoftwareProduct.right; + vendorSoftwareProductObject.setAttContact(map.get("attContact")); + vendorSoftwareProductObject.setCategory(map.get("category")); + vendorSoftwareProductObject.setComponentId(map.get("componentId")); + vendorSoftwareProductObject.setDescription(map.get("description")); + vendorSoftwareProductObject.setSubCategory(map.get("subCategory")); + vendorSoftwareProductObject.setVendorName(map.get("vendorName")); + vendorSoftwareProductObject.setVspId(map.get("vspId")); + vendorSoftwareProductObject.setName(createVendorSoftwareProduct.left); + String[] arrFileNameAndExtension = vnfFile.split("\\."); + vendorSoftwareProductObject.setOnboardingMethod("NetworkPackage"); + vendorSoftwareProductObject.setNetworkPackageName(arrFileNameAndExtension[0]); + vendorSoftwareProductObject.setOnboardingOrigin(arrFileNameAndExtension[1]); + + return vendorSoftwareProductObject; + } + + public static void updateVendorSoftwareProductToNextVersion(VendorSoftwareProductObject vendorSoftwareProductObject, String toVspVersion, User user, String filepath, String heatFileName) + throws Exception, Throwable { + + RestResponse checkout = checkoutVendorSoftwareProduct(vendorSoftwareProductObject.getVspId(), user, vendorSoftwareProductObject.getVersion()); + assertEquals("did not succeed to checkout new VSP", 200, checkout.getErrorCode().intValue()); + + RestResponse uploadHeatPackage = uploadHeatPackage(filepath, heatFileName, vendorSoftwareProductObject.getVspId(), user, "1.1"); + assertEquals("did not succeed to upload HEAT package", 200, uploadHeatPackage.getErrorCode().intValue()); + + RestResponse validateUpload = validateUpload(vendorSoftwareProductObject.getVspId(), user, "1.1"); + assertEquals("did not succeed to validate upload process, reason: " + validateUpload.getResponse(), 200, validateUpload.getErrorCode().intValue()); + + prepareVspForUse(user,vendorSoftwareProductObject.getVspId(),toVspVersion); + + vendorSoftwareProductObject.setVersion(toVspVersion); + } + + public static Object[][] filterObjectArrWithExcludedVnfs(Object[][] objectArr) + { + Object[][] filteredArObject = new Object[objectArr.length][]; + + int index = 0; + + for (int i = 0; i < objectArr.length ; i++) { + + String vnfSourceFile = (String) objectArr[i][0]; + String vnfUpdateFile = (String) objectArr[i][1]; + + if(!exludeVnfList.contains(vnfSourceFile) && !exludeVnfList.contains(vnfUpdateFile)) + { + filteredArObject[index] = new Object[]{vnfSourceFile , vnfUpdateFile }; + index++; + } + } + + return filteredArObject; + } }
\ No newline at end of file @@ -20,56 +20,6 @@ package org.openecomp.sdc.ci.tests.utils.general; -import static org.testng.AssertJUnit.assertEquals; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; -import java.io.StringWriter; -import java.nio.file.FileSystems; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.UUID; -import java.util.stream.Collectors; - -import org.apache.commons.io.IOUtils; -import org.apache.http.HttpEntity; -import org.apache.http.client.ClientProtocolException; -import org.apache.http.client.methods.CloseableHttpResponse; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.entity.mime.MultipartEntityBuilder; -import org.apache.http.entity.mime.content.FileBody; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClients; -import org.json.JSONException; -import org.json.JSONObject; -import org.json.simple.JSONArray; -import org.json.simple.JSONValue; -import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.ci.tests.config.Config; -import org.openecomp.sdc.ci.tests.datatypes.AmdocsLicenseMembers; - -import org.openecomp.sdc.ci.tests.datatypes.HeatMetaFirstLevelDefinition; - -import org.openecomp.sdc.ci.tests.datatypes.http.HttpHeaderEnum; -import org.openecomp.sdc.ci.tests.datatypes.http.HttpRequest; -import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; -import org.openecomp.sdc.ci.tests.execute.devCI.ArtifactFromCsar; - - -import org.openecomp.sdc.ci.tests.utils.Utils; -import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; - -import org.testng.Assert; - -import com.aventstack.extentreports.Status; -import com.clearspring.analytics.util.Pair; - enum SnmpTypeEnum{ SNMP_POLL ("snmp"), SNMP_TRAP ("snmp-trap"); @@ -0,0 +1,88 @@ +/*- + * ============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.ci.tests.utils.general; + +import static org.testng.AssertJUnit.assertEquals; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.io.StringWriter; +import java.nio.file.FileSystems; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import java.util.stream.Collectors; + +import org.apache.commons.io.IOUtils; +import org.apache.http.HttpEntity; +import org.apache.http.client.ClientProtocolException; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.entity.mime.MultipartEntityBuilder; +import org.apache.http.entity.mime.content.FileBody; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.json.JSONException; +import org.json.JSONObject; +import org.json.simple.JSONArray; +import org.json.simple.JSONValue; +import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.ci.tests.config.Config; +import org.openecomp.sdc.ci.tests.datatypes.AmdocsLicenseMembers; + +import org.openecomp.sdc.ci.tests.datatypes.HeatMetaFirstLevelDefinition; + +import org.openecomp.sdc.ci.tests.datatypes.http.HttpHeaderEnum; +import org.openecomp.sdc.ci.tests.datatypes.http.HttpRequest; +import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; +import org.openecomp.sdc.ci.tests.execute.devCI.ArtifactFromCsar; + + +import org.openecomp.sdc.ci.tests.utils.Utils; +import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; + +import org.testng.Assert; + +import com.aventstack.extentreports.Status; +import com.clearspring.analytics.util.Pair; + +enum SnmpTypeEnum{ + SNMP_POLL ("snmp"), + SNMP_TRAP ("snmp-trap"); + + private String value; + + public String getValue() { + return value; + } + + private SnmpTypeEnum(String value) { + this.value = value; +} + +} + @@ -26,8 +26,12 @@ import static org.testng.AssertJUnit.assertTrue; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; -import java.util.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import java.util.Map.Entry; +import java.util.UUID; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; @@ -21,7 +21,8 @@ package org.openecomp.sdc.ci.tests.utils.rest; import java.io.IOException; -import java.util.*; +import java.util.HashMap; +import java.util.Map; import org.openecomp.sdc.ci.tests.api.Urls; import org.openecomp.sdc.ci.tests.config.Config; @@ -123,6 +123,7 @@ public class ConsumerRestUtils extends BaseRestUtils { String bodyToParse = restResponse.getResponse(); ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false); try { mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false); ConsumerDataDefinition component = mapper.readValue(bodyToParse, ConsumerDataDefinition.class); @@ -34,7 +34,6 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Properties; import org.apache.commons.io.IOUtils; @@ -22,8 +22,6 @@ package org.openecomp.sdc.ci.tests.utils.rest; import java.io.IOException; -import com.google.gson.Gson; - import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.model.LifecycleStateEnum; import org.openecomp.sdc.be.model.Product; @@ -39,6 +37,8 @@ import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.google.gson.Gson; + public class ProductRestUtils extends BaseRestUtils { private static Gson gson = new Gson(); private static Logger logger = LoggerFactory.getLogger(ProductRestUtils.class.getName()); @@ -25,11 +25,14 @@ import static org.testng.AssertJUnit.assertNull; import static org.testng.AssertJUnit.assertTrue; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import java.util.Map; +import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentInstance; +import org.openecomp.sdc.be.model.ComponentInstanceInput; import org.openecomp.sdc.be.model.ComponentInstanceProperty; import org.openecomp.sdc.be.model.PropertyDefinition; import org.openecomp.sdc.be.model.Resource; @@ -37,10 +40,15 @@ import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.ci.tests.api.Urls; import org.openecomp.sdc.ci.tests.config.Config; +import org.openecomp.sdc.ci.tests.datatypes.http.HttpHeaderEnum; +import org.openecomp.sdc.ci.tests.datatypes.http.HttpRequest; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; +import org.openecomp.sdc.common.util.GeneralUtility; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.google.gson.Gson; + public class PropertyRestUtils extends BaseRestUtils { private static Logger logger = LoggerFactory.getLogger(PropertyRestUtils.class.getName()); @@ -307,4 +315,26 @@ public class PropertyRestUtils extends BaseRestUtils { path.add(componentInstDetails.getUniqueId()); updatePropertyListWithPathParameterOnCompInst(service, path, list); } + + public static RestResponse declareProporties(Component componentObject, Map<String, List<ComponentInstanceInput>> componentInstancesInputs, User sdncModifierDetails) + throws Exception { + Config config = Config.instance(); + String url = String.format(Urls.DECLARE_PROPERTIES, config.getCatalogBeHost(), config.getCatalogBePort(), ComponentTypeEnum.findParamByType(componentObject.getComponentType()), componentObject.getUniqueId()); + String userId = sdncModifierDetails.getUserId(); + Map<String, String> headersMap = prepareHeadersMap(userId); + Map<String, Object> jsonBuilder = new HashMap<>(); + jsonBuilder.put("componentInstanceInputsMap", componentInstancesInputs); + Gson gson = new Gson(); + String userBodyJson = gson.toJson(jsonBuilder); + String calculateMD5 = GeneralUtility.calculateMD5Base64EncodedByString(userBodyJson); + headersMap.put(HttpHeaderEnum.Content_MD5.getValue(), calculateMD5); + HttpRequest http = new HttpRequest(); + // System.out.println(url); + // System.out.println(userBodyJson); + RestResponse declareProportiesResponse = http.httpSendPost(url, userBodyJson, headersMap); + if (declareProportiesResponse.getErrorCode() == STATUS_CODE_GET_SUCCESS) { + + } + return declareProportiesResponse; + } } @@ -53,13 +53,13 @@ import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; import org.openecomp.sdc.ci.tests.utils.Utils; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.openecomp.sdc.common.util.GeneralUtility; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonParser; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; public class ResourceRestUtils extends BaseRestUtils { private static Logger logger = LoggerFactory.getLogger(ResourceRestUtils.class.getName()); @@ -26,7 +26,6 @@ import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.ci.tests.api.Urls; import org.openecomp.sdc.ci.tests.config.Config; import org.openecomp.sdc.ci.tests.datatypes.ResourceExternalReqDetails; -import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.http.HttpHeaderEnum; import org.openecomp.sdc.ci.tests.datatypes.http.HttpRequest; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; @@ -28,15 +28,12 @@ import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; -import java.util.Optional; import org.apache.commons.codec.binary.Base64; import org.apache.log4j.Logger; -import org.codehaus.jackson.JsonParseException; import org.codehaus.jackson.Version; import org.codehaus.jackson.map.DeserializationConfig; import org.codehaus.jackson.map.JsonDeserializer; -import org.codehaus.jackson.map.JsonMappingException; import org.codehaus.jackson.map.ObjectMapper; import org.codehaus.jackson.map.module.SimpleModule; import org.json.JSONArray; @@ -55,14 +52,11 @@ import org.openecomp.sdc.be.model.category.CategoryDefinition; import org.openecomp.sdc.be.model.operations.impl.PropertyOperation.PropertyConstraintJacksonDeserialiser; import org.openecomp.sdc.ci.tests.datatypes.ArtifactReqDetails; import org.openecomp.sdc.ci.tests.datatypes.ResourceAssetStructure; -import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.ResourceRespJavaObject; import org.openecomp.sdc.ci.tests.datatypes.ServiceDistributionStatus; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; import org.openecomp.sdc.ci.tests.utils.Utils; -import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils; -import com.fasterxml.jackson.databind.DeserializationFeature; import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonElement; @@ -196,7 +190,6 @@ public class ResponseParser { List<Resource> resources = Arrays.asList(mapper.readValue(response.toString(), Resource[].class)); resource = resources.get(0); } catch (Exception e1) { - // TODO Auto-generated catch block e1.printStackTrace(); } } @@ -207,8 +200,7 @@ public class ResponseParser { public static ComponentInstanceProperty convertPropertyResponseToJavaObject(String response) { ObjectMapper mapper = new ObjectMapper(); - final SimpleModule module = new SimpleModule("customerSerializationModule", - new Version(1, 0, 0, "static version")); + final SimpleModule module = new SimpleModule("customerSerializationModule", new Version(1, 0, 0, "static version")); JsonDeserializer<PropertyConstraint> desrializer = new PropertyConstraintJacksonDeserialiser(); addDeserializer(module, PropertyConstraint.class, desrializer); @@ -219,7 +211,6 @@ public class ResponseParser { propertyDefinition = mapper.readValue(response, ComponentInstanceProperty.class); logger.debug(propertyDefinition.toString()); } catch (IOException e) { - // TODO Auto-generated catch block e.printStackTrace(); } return propertyDefinition; @@ -238,7 +229,6 @@ public class ResponseParser { artifactDefinition = mapper.readValue(response, ArtifactDefinition.class); logger.debug(artifactDefinition.toString()); } catch (IOException e) { - // TODO Auto-generated catch block e.printStackTrace(); } @@ -280,7 +270,6 @@ public class ResponseParser { // System.out.println("Class: "+clazz.getSimpleName()+", json: // "+json); } catch (IOException e) { - // TODO Auto-generated catch block e.printStackTrace(); } @@ -313,12 +302,12 @@ public class ResponseParser { mapper.registerModule(module); Service service = null; try { -// TODO Andrey L. uncomment line below in case to ignore on unknown properties, not recommended, added by Matvey +// TODO Andrey L. uncomment line below in case to ignore on unknown properties, not recommended, added by Matvey mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false); + service = mapper.readValue(response, Service.class); logger.debug(service.toString()); } catch (IOException e) { - // TODO Auto-generated catch block e.printStackTrace(); } @@ -342,7 +331,6 @@ public class ResponseParser { product = mapper.readValue(response, Product.class); logger.debug(product.toString()); } catch (IOException e) { - // TODO Auto-generated catch block e.printStackTrace(); } @@ -403,29 +391,9 @@ public class ResponseParser { } - public static List<Map<String, Object>> getAuditFromMessage(Map auditingMessage) { + public static List<Map<String, Object>> getAuditFromMessage(Map<String, Object> auditingMessage) { List<Map<String, Object>> auditList = new ArrayList<Map<String, Object>>(); - // JsonElement jElement = new JsonParser().parse(auditingMessage); - // JsonObject jObject = jElement.getAsJsonObject(); - // JsonObject hitsObject = (JsonObject) jObject.get("hits"); - // JsonArray hitsArray = (JsonArray) hitsObject.get("hits"); - // - // Iterator<JsonElement> hitsIterator = hitsArray.iterator(); - // while(hitsIterator.hasNext()) - // { - // JsonElement nextHit = hitsIterator.next(); - // JsonObject jHitObject = nextHit.getAsJsonObject(); - // JsonObject jSourceObject = (JsonObject) jHitObject.get("_source"); - // - // Gson gson=new Gson(); - // String auditUnparsed = jSourceObject.toString(); - // - // Map<String,Object> map = new HashMap<String,Object>(); - // map = (Map<String,Object>) gson.fromJson(auditUnparsed, - // map.getClass()); - auditList.add(auditingMessage); - // } return auditList; } @@ -609,4 +577,5 @@ public class ResponseParser { return null; } + } @@ -44,9 +44,7 @@ import org.openecomp.sdc.ci.tests.utils.Utils; import org.openecomp.sdc.ci.tests.utils.general.FileUtils; import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum; -import com.google.gson.Gson; import com.google.gson.JsonElement; -import com.google.gson.JsonObject; import com.google.gson.JsonParser; public class ArtifactValidationUtils { @@ -726,56 +726,22 @@ public class AuditValidationUtils { Map auditingMessage = null; auditingMessage = retrieveAuditMessagesByPattern(action, body, false); - return auditingMessage; } - // public static List<Map<String, Object>> - // parseAuditResourceByActionToList(String action, String body) throws - // Exception { - // - // List<Map<String, Object>> auditList = new ArrayList<Map<String, - // Object>>(); - // - //// String auditingMessage = null; - // - // Map auditingMessage = null; - // auditingMessage = retrieveAuditMessagesByPattern(action); - // - // if (body == null) { - //// String pattern = "/_search?q=ACTION:\"" + action + "\""; - //// auditingMessage = retrieveAuditMessagesByPattern(action); - //// auditingMessage = retrieveAuditMessagesByPattern(pattern); - // } else { - //// auditingMessage = retrieveAuditMessagesUsingBody(body); - // } - // - // return ResponseParser.getAuditFromMessage(auditingMessage); - // - // } - public static List<Map<String, Object>> parseAuditResourceByActionToList(String action, Map<AuditingFieldsKeysEnum, String> body) throws Exception { - List<Map<String, Object>> auditList = new ArrayList<Map<String, Object>>(); - - // String auditingMessage = null; - Map auditingMessage = null; if (body == null || body.isEmpty()) { auditingMessage = retrieveAuditMessagesByPattern(action, null, false); - // String pattern = "/_search?q=ACTION:\"" + action + "\""; - // auditingMessage = retrieveAuditMessagesByPattern(action); - // auditingMessage = retrieveAuditMessagesByPattern(pattern); } else { auditingMessage = retrieveAuditMessagesByPattern(action, body, false); - // auditingMessage = retrieveAuditMessagesUsingBody(body); } return ResponseParser.getAuditFromMessage(auditingMessage); - } public JSONObject buildElasticQueryStringObject(String defaultField, String queryValue) throws JSONException { @@ -28,7 +28,6 @@ import java.util.Arrays; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.ci.tests.datatypes.enums.ErrorInfo; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; -import org.openecomp.sdc.ci.tests.utils.Utils; import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; import org.openecomp.sdc.exception.ResponseFormat; import org.testng.Assert; @@ -20,9 +20,10 @@ package org.openecomp.sdc.ci.tests.utils.validation; +import static org.testng.AssertJUnit.assertEquals; import static org.testng.AssertJUnit.assertNotNull; import static org.testng.AssertJUnit.assertTrue; -import static org.testng.AssertJUnit.assertEquals; + import org.json.JSONObject; import org.openecomp.sdc.be.model.category.CategoryDefinition; import org.openecomp.sdc.be.model.category.GroupingDefinition; @@ -22,25 +22,14 @@ package org.openecomp.sdc.ci.tests.utils.validation; import static org.testng.AssertJUnit.assertTrue; -import java.io.File; -import java.nio.charset.StandardCharsets; -import java.nio.file.Files; -import java.nio.file.Path; import java.util.ArrayList; import java.util.List; -import java.util.Map; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.ci.tests.datatypes.GroupHeatMetaDefinition; import org.openecomp.sdc.ci.tests.datatypes.HeatMetaFirstLevelDefinition; import org.openecomp.sdc.ci.tests.datatypes.TypeHeatMetaDefinition; -import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.utils.CsarParserUtils; -import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; -import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils; -import org.openecomp.sdc.ci.tests.utils.rest.ImportRestUtils; -import org.openecomp.sdc.common.rest.api.RestResponseAsByteArray; -import org.openecomp.sdc.common.util.ZipUtil; public class CsarValidationUtils { @@ -29,7 +29,6 @@ import java.io.InputStream; import java.util.List; import java.util.Map; -import org.yaml.snakeyaml.Yaml; import org.codehaus.jettison.json.JSONException; import org.codehaus.jettison.json.JSONObject; import org.openecomp.sdc.ci.tests.config.Config; @@ -38,6 +37,7 @@ import org.openecomp.sdc.ci.tests.datatypes.enums.ExceptionEnumType; import org.openecomp.sdc.ci.tests.utils.Utils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.yaml.snakeyaml.Yaml; public class ErrorValidationUtils { static Logger logger = LoggerFactory.getLogger(ErrorValidationUtils.class.getName()); @@ -20,8 +20,9 @@ package org.openecomp.sdc.ci.tests.utils.validation; -import static org.testng.AssertJUnit.assertFalse; import static org.testng.AssertJUnit.assertEquals; +import static org.testng.AssertJUnit.assertFalse; + import java.util.LinkedHashSet; import java.util.List; import java.util.Set; @@ -20,8 +20,8 @@ package org.openecomp.sdc.ci.tests.utils.validation; -import static org.testng.AssertJUnit.assertTrue; import static org.testng.AssertJUnit.assertEquals; +import static org.testng.AssertJUnit.assertTrue; import java.util.List; @@ -296,8 +296,8 @@ public class AssetLifeCycle extends ComponentBaseTest { // {ElementFactory.getDefaultUser(UserRoleEnum.ADMIN)}, {ElementFactory.getDefaultUser(UserRoleEnum.GOVERNOR)}, {ElementFactory.getDefaultUser(UserRoleEnum.OPS)}, - {ElementFactory.getDefaultUser(UserRoleEnum.PRODUCT_STRATEGIST1)}, - {ElementFactory.getDefaultUser(UserRoleEnum.PRODUCT_MANAGER1)}, + /*due to those roles are not exists in the system {ElementFactory.getDefaultUser(UserRoleEnum.PRODUCT_STRATEGIST1)}, + {ElementFactory.getDefaultUser(UserRoleEnum.PRODUCT_MANAGER1)},*/ }; } @@ -332,8 +332,8 @@ public class AssetLifeCycle extends ComponentBaseTest { // {ElementFactory.getDefaultUser(UserRoleEnum.ADMIN)}, {ElementFactory.getDefaultUser(UserRoleEnum.GOVERNOR)}, {ElementFactory.getDefaultUser(UserRoleEnum.OPS)}, - {ElementFactory.getDefaultUser(UserRoleEnum.PRODUCT_STRATEGIST1)}, - {ElementFactory.getDefaultUser(UserRoleEnum.PRODUCT_MANAGER1)}, + /*due to those roles are not exists in the system {ElementFactory.getDefaultUser(UserRoleEnum.PRODUCT_STRATEGIST1)}, + {ElementFactory.getDefaultUser(UserRoleEnum.PRODUCT_MANAGER1)},*/ }; } @@ -370,8 +370,8 @@ public class AssetLifeCycle extends ComponentBaseTest { // {ElementFactory.getDefaultUser(UserRoleEnum.ADMIN)}, {ElementFactory.getDefaultUser(UserRoleEnum.GOVERNOR)}, {ElementFactory.getDefaultUser(UserRoleEnum.OPS)}, - {ElementFactory.getDefaultUser(UserRoleEnum.PRODUCT_STRATEGIST1)}, - {ElementFactory.getDefaultUser(UserRoleEnum.PRODUCT_MANAGER1)}, + /*due to those roles are not exists in the system {ElementFactory.getDefaultUser(UserRoleEnum.PRODUCT_STRATEGIST1)}, + {ElementFactory.getDefaultUser(UserRoleEnum.PRODUCT_MANAGER1)},*/ }; } @@ -406,8 +406,8 @@ public class AssetLifeCycle extends ComponentBaseTest { // {ElementFactory.getDefaultUser(UserRoleEnum.ADMIN)}, {ElementFactory.getDefaultUser(UserRoleEnum.GOVERNOR)}, {ElementFactory.getDefaultUser(UserRoleEnum.OPS)}, - {ElementFactory.getDefaultUser(UserRoleEnum.PRODUCT_STRATEGIST1)}, - {ElementFactory.getDefaultUser(UserRoleEnum.PRODUCT_MANAGER1)}, + /*due to those roles are not exists in the system {ElementFactory.getDefaultUser(UserRoleEnum.PRODUCT_STRATEGIST1)}, + {ElementFactory.getDefaultUser(UserRoleEnum.PRODUCT_MANAGER1)},*/ }; } @@ -444,8 +444,8 @@ public class AssetLifeCycle extends ComponentBaseTest { // {ElementFactory.getDefaultUser(UserRoleEnum.ADMIN)}, {ElementFactory.getDefaultUser(UserRoleEnum.GOVERNOR)}, {ElementFactory.getDefaultUser(UserRoleEnum.OPS)}, - {ElementFactory.getDefaultUser(UserRoleEnum.PRODUCT_STRATEGIST1)}, - {ElementFactory.getDefaultUser(UserRoleEnum.PRODUCT_MANAGER1)}, + /*due to those roles are not exists in the system {ElementFactory.getDefaultUser(UserRoleEnum.PRODUCT_STRATEGIST1)}, + {ElementFactory.getDefaultUser(UserRoleEnum.PRODUCT_MANAGER1)},*/ }; } @@ -480,8 +480,8 @@ public class AssetLifeCycle extends ComponentBaseTest { // {ElementFactory.getDefaultUser(UserRoleEnum.ADMIN)}, {ElementFactory.getDefaultUser(UserRoleEnum.GOVERNOR)}, {ElementFactory.getDefaultUser(UserRoleEnum.OPS)}, - {ElementFactory.getDefaultUser(UserRoleEnum.PRODUCT_STRATEGIST1)}, - {ElementFactory.getDefaultUser(UserRoleEnum.PRODUCT_MANAGER1)}, + /*due to those roles are not exists in the system {ElementFactory.getDefaultUser(UserRoleEnum.PRODUCT_STRATEGIST1)}, + {ElementFactory.getDefaultUser(UserRoleEnum.PRODUCT_MANAGER1)},*/ }; } @@ -518,8 +518,8 @@ public class AssetLifeCycle extends ComponentBaseTest { // {ElementFactory.getDefaultUser(UserRoleEnum.ADMIN)}, {ElementFactory.getDefaultUser(UserRoleEnum.GOVERNOR)}, {ElementFactory.getDefaultUser(UserRoleEnum.OPS)}, - {ElementFactory.getDefaultUser(UserRoleEnum.PRODUCT_STRATEGIST1)}, - {ElementFactory.getDefaultUser(UserRoleEnum.PRODUCT_MANAGER1)}, + /*due to those roles are not exists in the system {ElementFactory.getDefaultUser(UserRoleEnum.PRODUCT_STRATEGIST1)}, + {ElementFactory.getDefaultUser(UserRoleEnum.PRODUCT_MANAGER1)},*/ }; } @@ -554,8 +554,8 @@ public class AssetLifeCycle extends ComponentBaseTest { // {ElementFactory.getDefaultUser(UserRoleEnum.ADMIN)}, {ElementFactory.getDefaultUser(UserRoleEnum.GOVERNOR)}, {ElementFactory.getDefaultUser(UserRoleEnum.OPS)}, - {ElementFactory.getDefaultUser(UserRoleEnum.PRODUCT_STRATEGIST1)}, - {ElementFactory.getDefaultUser(UserRoleEnum.PRODUCT_MANAGER1)}, + /*due to those roles are not exists in the system {ElementFactory.getDefaultUser(UserRoleEnum.PRODUCT_STRATEGIST1)}, + {ElementFactory.getDefaultUser(UserRoleEnum.PRODUCT_MANAGER1)},*/ }; } @@ -624,7 +624,7 @@ public class AssetLifeCycle extends ComponentBaseTest { ActionStatus actionStatus, User user, User operationUser) throws Exception { if(initState.equals(LifeCycleStatesEnum.STARTCERTIFICATION) && targetState.equals(LifeCycleStatesEnum.CHECKIN)){ - throw new SkipException("Open bug DE270217"); + throw new SkipException("Open bug DE270217 or TDP number: 154592"); } getExtendTest().log(Status.INFO, String.format("initState: %s, targetState: %s, errorCode: %s," @@ -732,7 +732,7 @@ public class AssetLifeCycle extends ComponentBaseTest { currState, status, actionStatus, user, operationUser)); if(initState.equals(LifeCycleStatesEnum.STARTCERTIFICATION) && targetState.equals(LifeCycleStatesEnum.CHECKIN)){ - throw new SkipException("Open bug DE270217"); + throw new SkipException("Open bug DE270217 or TDP number: 154592"); } Either<Resource, RestResponse> createdComponent = AtomicOperationUtils.createResourcesByTypeNormTypeAndCatregory(ResourceTypeEnum.VF, NormativeTypesEnum.ROOT, ResourceCategoryEnum.GENERIC_INFRASTRUCTURE, UserRoleEnum.DESIGNER, true); @@ -81,7 +81,6 @@ import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.openecomp.sdc.ci.tests.utils.rest.ArtifactRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils; -import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; import org.openecomp.sdc.ci.tests.utils.validation.AuditValidationUtils; import org.openecomp.sdc.ci.tests.utils.validation.DistributionValidationUtils; import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils; @@ -1164,7 +1163,7 @@ public class CRUDExternalAPI extends ComponentBaseTest { {ComponentTypeEnum.SERVICE, UserRoleEnum.GOVERNOR, LifeCycleStatesEnum.CHECKOUT}, {ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.GOVERNOR, LifeCycleStatesEnum.CHECKOUT}, - {ComponentTypeEnum.RESOURCE, UserRoleEnum.PRODUCT_STRATEGIST1, LifeCycleStatesEnum.CHECKIN}, + /*due to those roles are not exists in the system {ComponentTypeEnum.RESOURCE, UserRoleEnum.PRODUCT_STRATEGIST1, LifeCycleStatesEnum.CHECKIN}, {ComponentTypeEnum.SERVICE, UserRoleEnum.PRODUCT_STRATEGIST1, LifeCycleStatesEnum.CHECKIN}, {ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.PRODUCT_STRATEGIST1, LifeCycleStatesEnum.CHECKIN}, {ComponentTypeEnum.RESOURCE, UserRoleEnum.PRODUCT_STRATEGIST1, LifeCycleStatesEnum.CHECKOUT}, @@ -1176,7 +1175,7 @@ public class CRUDExternalAPI extends ComponentBaseTest { {ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.PRODUCT_MANAGER1, LifeCycleStatesEnum.CHECKIN}, {ComponentTypeEnum.RESOURCE, UserRoleEnum.PRODUCT_MANAGER1, LifeCycleStatesEnum.CHECKOUT}, {ComponentTypeEnum.SERVICE, UserRoleEnum.PRODUCT_MANAGER1, LifeCycleStatesEnum.CHECKOUT}, - {ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.PRODUCT_MANAGER1, LifeCycleStatesEnum.CHECKOUT}, + {ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.PRODUCT_MANAGER1, LifeCycleStatesEnum.CHECKOUT},*/ }; } @@ -1737,7 +1736,7 @@ public class CRUDExternalAPI extends ComponentBaseTest { {ComponentTypeEnum.SERVICE, UserRoleEnum.GOVERNOR, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType()}, {ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.GOVERNOR, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType()}, - {ComponentTypeEnum.RESOURCE, UserRoleEnum.PRODUCT_STRATEGIST1, LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.OTHER.getType()}, + /*due to those roles are not exists in the system {ComponentTypeEnum.RESOURCE, UserRoleEnum.PRODUCT_STRATEGIST1, LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.OTHER.getType()}, {ComponentTypeEnum.SERVICE, UserRoleEnum.PRODUCT_STRATEGIST1, LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.OTHER.getType()}, {ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.PRODUCT_STRATEGIST1, LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType()}, {ComponentTypeEnum.RESOURCE, UserRoleEnum.PRODUCT_STRATEGIST1, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType()}, @@ -1749,7 +1748,7 @@ public class CRUDExternalAPI extends ComponentBaseTest { {ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.PRODUCT_MANAGER1, LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType()}, {ComponentTypeEnum.RESOURCE, UserRoleEnum.PRODUCT_MANAGER1, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType()}, {ComponentTypeEnum.SERVICE, UserRoleEnum.PRODUCT_MANAGER1, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType()}, - {ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.PRODUCT_MANAGER1, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType()}, + {ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.PRODUCT_MANAGER1, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType()},*/ }; } @@ -2803,7 +2802,7 @@ public class CRUDExternalAPI extends ComponentBaseTest { {ComponentTypeEnum.SERVICE, UserRoleEnum.GOVERNOR, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType()}, {ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.GOVERNOR, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType()}, - {ComponentTypeEnum.RESOURCE, UserRoleEnum.PRODUCT_STRATEGIST1, LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.OTHER.getType()}, + /*due to those roles are not exists in the system {ComponentTypeEnum.RESOURCE, UserRoleEnum.PRODUCT_STRATEGIST1, LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.OTHER.getType()}, {ComponentTypeEnum.SERVICE, UserRoleEnum.PRODUCT_STRATEGIST1, LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.OTHER.getType()}, {ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.PRODUCT_STRATEGIST1, LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType()}, {ComponentTypeEnum.RESOURCE, UserRoleEnum.PRODUCT_STRATEGIST1, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType()}, @@ -2815,7 +2814,7 @@ public class CRUDExternalAPI extends ComponentBaseTest { {ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.PRODUCT_MANAGER1, LifeCycleStatesEnum.CHECKIN, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType()}, {ComponentTypeEnum.RESOURCE, UserRoleEnum.PRODUCT_MANAGER1, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType()}, {ComponentTypeEnum.SERVICE, UserRoleEnum.PRODUCT_MANAGER1, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.OTHER.getType()}, - {ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.PRODUCT_MANAGER1, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType()}, + {ComponentTypeEnum.RESOURCE_INSTANCE, UserRoleEnum.PRODUCT_MANAGER1, LifeCycleStatesEnum.CHECKOUT, ArtifactTypeEnum.DCAE_INVENTORY_TOSCA.getType()},*/ }; } @@ -44,7 +44,6 @@ import org.junit.rules.TestName; import org.openecomp.sdc.be.datatypes.enums.AssetTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; -import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.model.category.CategoryDefinition; @@ -60,7 +59,6 @@ import org.openecomp.sdc.ci.tests.utils.rest.AssetRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.CatalogRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.CategoryRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; -import org.openecomp.sdc.ci.tests.utils.validation.AuditValidationUtils; import org.openecomp.sdc.common.util.ZipUtil; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; @@ -60,7 +60,6 @@ import org.openecomp.sdc.ci.tests.datatypes.expected.ExpectedExternalAudit; import org.openecomp.sdc.ci.tests.datatypes.http.HttpHeaderEnum; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; import org.openecomp.sdc.ci.tests.utils.Utils; -import org.openecomp.sdc.ci.tests.utils.cassandra.CassandraUtils; import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.openecomp.sdc.ci.tests.utils.rest.ArtifactRestUtils; @@ -72,7 +71,6 @@ import org.openecomp.sdc.ci.tests.utils.rest.ServiceRestUtils; import org.openecomp.sdc.ci.tests.utils.validation.AuditValidationUtils; import org.openecomp.sdc.common.api.Constants; import org.openecomp.sdc.common.datastructure.AuditingFieldsKeysEnum; -import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; import com.google.gson.Gson; @@ -69,7 +69,6 @@ import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum; import org.openecomp.sdc.common.datastructure.AuditingFieldsKeysEnum; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; public class GetFilteredAssetServlet extends ComponentBaseTest { @@ -50,7 +50,6 @@ import org.openecomp.sdc.ci.tests.utils.rest.ServiceRestUtils; import org.openecomp.sdc.ci.tests.utils.validation.AuditValidationUtils; import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils; import org.openecomp.sdc.common.datastructure.AuditingFieldsKeysEnum; -import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; public class GetSpecificAssetMetadataServlet extends ComponentBaseTest { @@ -113,11 +113,11 @@ public class UserAPIs extends ComponentBaseTest { sizeAfterChange = allusersList.size(); Assert.assertEquals(sizeBeforeChange, sizeAfterChange + 1, "Expected that list will change."); - } finally { + } finally { deleteUser(ecompUser.getLoginId()); } - } + } } @@ -179,7 +179,7 @@ public class UserAPIs extends ComponentBaseTest { allusersList = getAllusersList(); int sizeAfterChange = allusersList.size(); - assertTrue("List is Equel" , sizeBeforeChange != sizeAfterChange ); + assertTrue("Lists are Equal" , sizeBeforeChange != sizeAfterChange ); //update role ecompRole.setId((long) 2); @@ -22,7 +22,6 @@ package org.openecomp.sdc.externalApis; import static java.util.Arrays.asList; -import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -48,7 +47,6 @@ import org.openecomp.sdc.ci.tests.datatypes.enums.SearchCriteriaEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.datatypes.expected.ExpectedResourceAuditJavaObject; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; -import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.openecomp.sdc.ci.tests.utils.rest.AssetRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils; @@ -60,12 +58,9 @@ import org.openecomp.sdc.common.util.ValidationUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.testng.Assert; -import org.testng.SkipException; -import org.testng.annotations.BeforeMethod; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; -import com.google.common.util.concurrent.ListeningExecutorService; import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonElement; @@ -2,6 +2,12 @@ outputFolder: target reportName: index.html catalogBeHost: localhost catalogFeHost: fehost +#QA-SCRUM1 +#catalogBeHost: 135.21.125.97 +#catalogFeHost: 135.21.125.89 +#Automate +#catalogBeHost: 135.63.125.67 +#catalogFeHost: 135.63.125.63 esHost: eshost disributionClientHost: disClient catalogFePort: 8181 @@ -14,7 +20,7 @@ neoPort: 7474 neoDBusername: neo4j neoDBpassword: 123456 windowsDownloadDirectory: "c:\\apache-ftpserver-1.1.0\\res\\home" - +systemUnderDebug: false resourceConfigDir: src/test/resources/CI/tests componentsConfigDir: src/test/resources/CI/components importResourceConfigDir: ../catalog-be/src/main/resources/import/tosca/capability-types @@ -1,8 +1,11 @@ storage.backend=cassandra -#storage.hostname=cassandrahost storage.hostname=localhost storage.port=9160 cache.db-cache = false +cache.db-cache-clean-wait = 20 +cache.db-cache-time = 180000 +cache.db-cache-size = 0.5 - +cache.tx-cache-size = 500000 +storage.cassandra.keyspace=sdctitan @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd"> -<suite name="externalApis" configfailurepolicy="continue" verbose="2" parallel="methods" thread-count="2" data-provider-thread-count="2"> +<suite name="externalApis" configfailurepolicy="continue" verbose="2" parallel="methods" thread-count="1" data-provider-thread-count="1"> <test name="ExternalApis"> <classes> @@ -1,6 +1,8 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd"> <suite name="externalApis" configfailurepolicy="continue" verbose="2" parallel="methods" thread-count="1" data-provider-thread-count="1"> + <parameter name="makeDistribution" value="false"/> + <parameter name="makeToscaValidation" value="true"/> <test name="ExternalApis"> <classes> @@ -14,6 +14,7 @@ <properties> <sonar.skip>true</sonar.skip> + <jacoco.skip>true</jacoco.skip> </properties> <dependencies> @@ -21,6 +22,7 @@ <groupId>com.google.guava</groupId> <artifactId>guava</artifactId> <version>${guava.version}</version> +<!-- <version>21.0</version> --> <scope>compile</scope> </dependency> @@ -28,12 +30,14 @@ <groupId>org.seleniumhq.selenium</groupId> <artifactId>selenium-java</artifactId> <version>2.53.1</version> +<!-- <version>3.4.0</version> --> </dependency> <dependency> <groupId>org.seleniumhq.selenium</groupId> <artifactId>selenium-server</artifactId> <version>2.53.1</version> +<!-- <version>3.4.0</version> --> <scope>runtime</scope> </dependency> @@ -55,7 +59,7 @@ <groupId>org.openecomp.sdc</groupId> <artifactId>test-apis-ci</artifactId> <version>${project.version}</version> - <!-- <classifier>jar-with-dependencies</classifier> --> + <!-- <classifier>jar-with-dependencies</classifier> --> <scope>compile</scope> </dependency> @@ -176,7 +180,7 @@ <dependency> <groupId>org.openecomp.sdc.sdc-distribution-client</groupId> <artifactId>sdc-distribution-client</artifactId> - <version>1.1.9-SNAPSHOT</version> + <version>1.1.50</version> <scope>compile</scope> </dependency> @@ -49,16 +49,15 @@ import org.openecomp.sdc.ci.tests.pages.HomePage; import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage; import org.openecomp.sdc.ci.tests.pages.ToscaArtifactsPage; import org.openecomp.sdc.ci.tests.utilities.FileHandling; -import org.openecomp.sdc.ci.tests.utilities.OnboardingUtils; +import org.openecomp.sdc.ci.tests.utilities.OnboardingUiUtils; import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; +import org.openecomp.sdc.ci.tests.utils.general.OnboardingUtils; import org.openecomp.sdc.ci.tests.utils.rest.ArtifactRestUtils; import org.testng.Assert; -import org.testng.SkipException; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; -import com.aventstack.extentreports.Status; import com.clearspring.analytics.util.Pair; @@ -67,7 +66,7 @@ public class AddComponentInstancesArtifactsInCsar extends SetupCDTest { private String filePath; @BeforeClass public void beforeClass(){ - filePath = System.getProperty("filepath"); + filePath = System.getProperty("filePath"); if (filePath == null && System.getProperty("os.name").contains("Windows")) { filePath = FileHandling.getResourcesFilesPath() + "AddComponentInstancesArtifactsInCsar"+ File.separator; } @@ -86,16 +85,17 @@ public class AddComponentInstancesArtifactsInCsar extends SetupCDTest { String snmpFile = "Fault-alarms-ASDC-vprobes-vLB.zip"; AmdocsLicenseMembers amdocsLicenseMembers = OnboardingUtils.createVendorLicense(getUser()); - Pair<String, Map<String, String>> createVSP = OnboardingUtils.createVSP(vnfFile, filePath, getUser(), amdocsLicenseMembers); + ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT); + Pair<String, Map<String, String>> createVSP = OnboardingUtils.createVSP(resourceReqDetails, vnfFile, filePath, getUser(), amdocsLicenseMembers); String vspName = createVSP.left; resourceMetaData.setName(vspName); Map<String, String> resourceMeta = createVSP.right; String vspid = resourceMeta.get("vspId"); OnboardingUtils.addVFCArtifacts(filePath, snmpFile, null, vspid, getUser()); - OnboardingUtils.prepareVspForUse(getUser(), vspid); + OnboardingUtils.prepareVspForUse(getUser(), vspid, "0.1"); HomePage.showVspRepository(); - OnboardingUtils.importVSP(createVSP); + OnboardingUiUtils.importVSP(createVSP); resourceMetaData.setVersion("0.1"); Resource vfResource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, resourceMetaData.getName(), resourceMetaData.getVersion()); @@ -196,10 +196,6 @@ public class AddComponentInstancesArtifactsInCsar extends SetupCDTest { } else { compareArtifacts(artifactFromJavaObject.get(key), artifactsFromFileStructure.get(key)); } - - - - } } @@ -378,10 +374,10 @@ public class AddComponentInstancesArtifactsInCsar extends SetupCDTest { // Check response of external API Integer responseCode = uploadArtifactRestResponse.getErrorCode(); - if(responseCode.equals(404)) { - getExtendTest().log(Status.SKIP, String.format("DE271521")); - throw new SkipException("DE271521"); - } +// if(responseCode.equals(404)) { +// getExtendTest().log(Status.SKIP, String.format("DE271521")); +// throw new SkipException("DE271521"); +// } Assert.assertEquals(responseCode, (Integer)200, "Response code is not correct."); @@ -30,18 +30,19 @@ import org.json.simple.JSONValue; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.ci.tests.datatypes.AmdocsLicenseMembers; import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; +import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; import org.openecomp.sdc.ci.tests.pages.HomePage; import org.openecomp.sdc.ci.tests.utilities.FileHandling; import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; -import org.openecomp.sdc.ci.tests.utilities.OnboardingUtils; +import org.openecomp.sdc.ci.tests.utilities.OnboardingUiUtils; +import org.openecomp.sdc.ci.tests.utils.general.OnboardingUtils; import com.clearspring.analytics.util.Pair; public class LocalGeneralUtilities { public LocalGeneralUtilities() { - // TODO Auto-generated constructor stub } public static final String FILE_PATH = FileHandling.getBasePath() + "\\src\\main\\resources\\Files\\VNFs\\"; public static final String Env_FILE_PATH = FileHandling.getBasePath() + "\\src\\main\\resources\\Files\\Env_files\\"; @@ -74,12 +75,12 @@ public static List<String> getValuesFromJsonArray(RestResponse message) throws E return artifactTypesArrayFromApi; } -public static String simpleOnBoarding(String fileName, String filePath,User user) throws Exception { - AmdocsLicenseMembers amdocsLicenseMembers = OnboardingUtils.createVendorLicense(user); - Pair<String, Map<String, String>> createVendorSoftwareProduct = OnboardingUtils.createVendorSoftwareProduct(fileName, filePath, user, amdocsLicenseMembers); +public static String simpleOnBoarding(ResourceReqDetails resourceReqDetails, String fileName, String filePath,User user) throws Exception { + AmdocsLicenseMembers amdocsLicenseMembers = OnboardingUiUtils.createVendorLicense(user); + Pair<String, Map<String, String>> createVendorSoftwareProduct = OnboardingUtils.createVendorSoftwareProduct(resourceReqDetails, fileName, filePath, user, amdocsLicenseMembers); String vspName = createVendorSoftwareProduct.left; HomePage.showVspRepository(); - OnboardingUtils.importVSP(createVendorSoftwareProduct); + OnboardingUiUtils.importVSP(createVendorSoftwareProduct); GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.GeneralElementsEnum.CHECKIN_BUTTON.getValue()).click(); GeneralUIUtils.waitForLoader(); return vspName; @@ -30,7 +30,6 @@ import org.apache.commons.io.FileUtils; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.ci.tests.datatypes.ArtifactInfo; -import org.openecomp.sdc.ci.tests.datatypes.TopMenuButtonsEnum; import org.openecomp.sdc.ci.tests.datatypes.CanvasElement; import org.openecomp.sdc.ci.tests.datatypes.CanvasManager; import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; @@ -52,7 +51,6 @@ import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.openecomp.sdc.ci.tests.utils.rest.ArtifactRestUtils; import org.testng.Assert; -import org.testng.SkipException; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; @@ -23,14 +23,12 @@ package org.openecomp.sdc.ci.tests.US; import java.io.File; import java.io.IOException; import java.net.InetSocketAddress; +import java.net.Proxy; import java.net.ProxySelector; import java.net.SocketAddress; import java.net.URI; import java.util.List; -import java.net.Proxy; - -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; @@ -24,7 +24,6 @@ import static org.testng.AssertJUnit.assertTrue; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.ci.tests.datatypes.ArtifactInfo; -import org.openecomp.sdc.ci.tests.datatypes.TopMenuButtonsEnum; import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; @@ -25,7 +25,6 @@ import java.util.List; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.ci.tests.datatypes.ArtifactInfo; -import org.openecomp.sdc.ci.tests.datatypes.TopMenuButtonsEnum; import org.openecomp.sdc.ci.tests.datatypes.CanvasElement; import org.openecomp.sdc.ci.tests.datatypes.CanvasManager; import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.LeftPanelCanvasItems; @@ -28,15 +28,15 @@ import org.openecomp.sdc.ci.tests.datatypes.CanvasElement; import org.openecomp.sdc.ci.tests.datatypes.CanvasManager; import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.StepsEnum; +import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; -import org.openecomp.sdc.ci.tests.execute.sanity.Onboard; import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; import org.openecomp.sdc.ci.tests.pages.CompositionPage; import org.openecomp.sdc.ci.tests.utilities.FileHandling; import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; -import org.openecomp.sdc.ci.tests.utilities.OnboardingUtils; +import org.openecomp.sdc.ci.tests.utilities.OnboardingUiUtils; import org.openecomp.sdc.ci.tests.utilities.ServiceUIUtils; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.openecomp.sdc.ci.tests.utils.rest.ServiceRestUtils; @@ -47,14 +47,14 @@ import com.clearspring.analytics.util.Pair; public class Service_Tests_UI extends SetupCDTest{ public Service_Tests_UI() { - // TODO Auto-generated constructor stub } // US839610 - E2E Declare VL / CP properties as inputs in service level @Test public void declareVL_CP_InputsInServiceLevel() throws Exception { String vnfFile = "FDNT.zip"; - Pair<String,Map<String,String>> VspName =OnboardingUtils.onboardAndValidate(FileHandling.getVnfRepositoryPath(), vnfFile, getUser()); + ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT); + Pair<String,Map<String,String>> VspName = OnboardingUiUtils.onboardAndValidate(resourceReqDetails, FileHandling.getVnfRepositoryPath(), vnfFile, getUser()); ServiceReqDetails servicemetadata = ElementFactory.getDefaultService(getUser()); ServiceUIUtils.createService(servicemetadata, getUser()); GeneralUIUtils.moveToStep(StepsEnum.COMPOSITION); @@ -72,7 +72,8 @@ public class Service_Tests_UI extends SetupCDTest{ @Test public void CreateServiceWithCpInstance() throws Exception { String vnfFile = "FDNT.zip"; - Pair<String,Map<String,String>> VspName =OnboardingUtils.onboardAndValidate(FileHandling.getVnfRepositoryPath(), vnfFile, getUser()); + ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT); + Pair<String,Map<String,String>> VspName = OnboardingUiUtils.onboardAndValidate(resourceReqDetails, FileHandling.getVnfRepositoryPath(), vnfFile, getUser()); ServiceReqDetails servicemetadata = ElementFactory.getDefaultService(getUser()); ServiceUIUtils.createService(servicemetadata, getUser()); GeneralUIUtils.moveToStep(StepsEnum.COMPOSITION); @@ -99,7 +100,6 @@ public class Service_Tests_UI extends SetupCDTest{ @Override protected UserRoleEnum getRole() { - // TODO Auto-generated method stub return UserRoleEnum.DESIGNER; } @@ -22,7 +22,6 @@ package org.openecomp.sdc.ci.tests.US; import java.io.File; import java.text.SimpleDateFormat; -import java.util.Arrays; import java.util.Date; import java.util.HashMap; import java.util.Map; @@ -30,14 +29,11 @@ import java.util.Set; import org.openecomp.sdc.be.model.DataTypeDefinition; import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaDefinition; -import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaParameterConstants; import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaTopologyTemplateDefinition; import org.openecomp.sdc.ci.tests.utilities.FileHandling; import org.openecomp.sdc.ci.tests.utils.ToscaParserUtils; import org.testng.Assert; -import fj.data.Array; - @@ -179,7 +175,7 @@ public class Testing { additionalInputs = objectHelper.getNode_types().get(key).getProperties(); } } - topologyTemplate.addInputs(additionalInputs); +// topologyTemplate.addInputs(additionalInputs); @@ -29,11 +29,13 @@ import java.util.List; import java.util.Map; import org.openecomp.sdc.be.model.Service; +import org.openecomp.sdc.ci.tests.dataProviders.OnbordingDataProviders; import org.openecomp.sdc.ci.tests.datatypes.AmdocsLicenseMembers; import org.openecomp.sdc.ci.tests.datatypes.CanvasElement; import org.openecomp.sdc.ci.tests.datatypes.CanvasManager; import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.ToscaArtifactsScreenEnum; import org.openecomp.sdc.ci.tests.datatypes.HeatMetaFirstLevelDefinition; +import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.TypeHeatMetaDefinition; import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; @@ -49,12 +51,13 @@ import org.openecomp.sdc.ci.tests.utilities.ArtifactUIUtils; import org.openecomp.sdc.ci.tests.utilities.DownloadManager; import org.openecomp.sdc.ci.tests.utilities.FileHandling; import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; -import org.openecomp.sdc.ci.tests.utilities.OnboardingUtils; +import org.openecomp.sdc.ci.tests.utilities.OnboardingUiUtils; import org.openecomp.sdc.ci.tests.utilities.ServiceUIUtils; import org.openecomp.sdc.ci.tests.utils.CsarParserUtils; import org.openecomp.sdc.ci.tests.utils.ToscaParserUtils; import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; +import org.openecomp.sdc.ci.tests.utils.general.OnboardingUtils; import org.openecomp.sdc.ci.tests.verificator.ServiceVerificator; import org.openecomp.sdc.ci.tests.verificator.VfModuleVerificator; import org.testng.annotations.Test; @@ -73,15 +76,20 @@ public class VfModule extends SetupCDTest { @Test public void checkVfModulesCountAndStructure() throws Exception, AWTException { -// String filepath = "src\\main\\resources\\Files\\VNFs"; +// String filePath = "src\\main\\resources\\Files\\VNFs"; String filepath = FileHandling.getVnfRepositoryPath(); // String vnfFile = "LDSA.zip"; - String vnfFile = "FDNT.zip"; +// String vnfFile = "FDNT.zip"; + List<String> fileNamesFromFolder = OnboardingUtils.getVnfNamesFileListExcludeToscaParserFailure(); + List<String> newRandomFileNamesFromFolder = OnbordingDataProviders.getRandomElements(1, fileNamesFromFolder); + String filePath = org.openecomp.sdc.ci.tests.utils.general.FileHandling.getVnfRepositoryPath(); + String vnfFile = newRandomFileNamesFromFolder.get(0); getExtendTest().log(Status.INFO, String.format("Going to onboard the VNF %s......", vnfFile)); System.out.println(String.format("Going to onboard the VNF %s......", vnfFile)); - AmdocsLicenseMembers amdocsLicenseMembers = OnboardingUtils.createVendorLicense(getUser()); - Pair<String, Map<String, String>> createVendorSoftwareProduct = OnboardingUtils.createVendorSoftwareProduct(vnfFile, filepath, getUser(), amdocsLicenseMembers); + AmdocsLicenseMembers amdocsLicenseMembers = OnboardingUiUtils.createVendorLicense(getUser()); + ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT); + Pair<String, Map<String, String>> createVendorSoftwareProduct = OnboardingUtils.createVendorSoftwareProduct(resourceReqDetails, vnfFile, filepath, getUser(), amdocsLicenseMembers); String vspName = createVendorSoftwareProduct.left; // DownloadManager.downloadCsarByNameFromVSPRepository(vspName, createVendorSoftwareProduct.right.get("vspId")); @@ -92,7 +100,7 @@ public class VfModule extends SetupCDTest { HomePage.showVspRepository(); getExtendTest().log(Status.INFO, String.format("Going to import %s......", vnfFile.substring(0, vnfFile.indexOf(".")))); - OnboardingUtils.importVSP(createVendorSoftwareProduct); + OnboardingUiUtils.importVSP(createVendorSoftwareProduct); ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen(); @@ -20,39 +20,16 @@ package org.openecomp.sdc.ci.tests.US; -import java.awt.AWTException; -import java.io.File; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; -import org.openecomp.sdc.ci.tests.config.Config; -import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; -import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.ArtifactPageEnum; -import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.StepsEnum; import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; -import org.openecomp.sdc.ci.tests.execute.sanity.Onboard; import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; -import org.openecomp.sdc.ci.tests.pages.DeploymentArtifactPage; -import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage; -import org.openecomp.sdc.ci.tests.utilities.ArtifactUIUtils; -import org.openecomp.sdc.ci.tests.utilities.FileHandling; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; -import org.openecomp.sdc.ci.tests.utilities.OnboardingUtils; import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; -import org.openecomp.sdc.ci.tests.verificator.VfVerificator; -import org.openqa.selenium.WebElement; -import org.testng.Assert; -import org.testng.annotations.Test; public class Vf_Tests_UI extends SetupCDTest{ public Vf_Tests_UI() { - // TODO Auto-generated constructor stub } public void uploadHeatEnvVFLevel() throws Exception { @@ -68,7 +45,7 @@ public class Vf_Tests_UI extends SetupCDTest{ // String secondEnvArtifact = "mod_vmsi_dnt_fw_parent.env"; // String filePath=Config.instance().getWindowsDownloadDirectory(); // String vnfFile = "FDNT.zip"; -// OnboardingUtils.onboardAndValidate(Onboard.getFilePath(), vnfFile, getUser()); +// OnboardingUiUtils.onboardAndValidate(Onboard.getFilePath(), vnfFile, getUser()); // Map<String,File> mD5OfFilesToValidate = new HashMap<String,File>(); // mD5OfFilesToValidate.put(firstEnvArtifact,new File(FileHandling.getResourcesEnvFilesPath() + firstEnvArtifact)); // mD5OfFilesToValidate.put(secondEnvArtifact,new File(FileHandling.getResourcesEnvFilesPath() + secondEnvArtifact)); @@ -88,7 +65,6 @@ public class Vf_Tests_UI extends SetupCDTest{ // } @Override protected UserRoleEnum getRole() { - // TODO Auto-generated method stub return UserRoleEnum.DESIGNER; } } @@ -28,11 +28,9 @@ import java.util.Set; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; -import org.openecomp.sdc.ci.tests.datatypes.TopMenuButtonsEnum; -import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.ToscaArtifactsScreenEnum; -import org.openecomp.sdc.ci.tests.datatypes.TopMenuButtonsEnum; import org.openecomp.sdc.ci.tests.datatypes.CanvasElement; import org.openecomp.sdc.ci.tests.datatypes.CanvasManager; +import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.ToscaArtifactsScreenEnum; import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; @@ -42,6 +42,7 @@ import org.openecomp.sdc.ci.tests.pages.HomePage; import org.openecomp.sdc.ci.tests.utilities.FileHandling; import com.clearspring.analytics.util.Pair; +import com.google.gson.Gson; public class ArtifactBusinessLogic { @@ -175,7 +176,18 @@ public class ArtifactBusinessLogic { pair = Pair.create(envParametersMap.get(key).left, "\"" + parameter.getValue() + "\""); }else if(envParametersMap.get(key).left.equals("string") && parameter.getValue() == null){ pair = Pair.create(envParametersMap.get(key).left, ""); - }else if(parameter.getValue() == null){ + }else if(parameter.getValue() == null) { + pair = Pair.create(envParametersMap.get(key).left, ""); + } else if(envParametersMap.get(key).left.equals("json") && parameter.getValue() != null){ + String pairValue = ""; + Gson gson = new Gson(); + if(parameter.getValue() instanceof java.util.LinkedHashMap){ + pairValue = gson.toJson(parameter.getValue()); + } +// pair = Pair.create(envParametersMap.get(key).left, "\"" + pairValue + "\""); + pair = Pair.create(envParametersMap.get(key).left, pairValue ); + + }else if(envParametersMap.get(key).left.equals("json") && parameter.getValue() == null){ pair = Pair.create(envParametersMap.get(key).left, ""); }else{ pair = Pair.create(envParametersMap.get(key).left, parameter.getValue()); @@ -1,26 +1,23 @@ package org.openecomp.sdc.ci.tests.dataProvider; -import java.io.File; import java.util.ArrayList; import java.util.Collections; import java.util.List; import org.openecomp.sdc.ci.tests.execute.sanity.ToscaValidationTest; -import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; import org.openecomp.sdc.ci.tests.utilities.FileHandling; -import org.openecomp.sdc.ci.tests.utilities.OnboardingUtils; +import org.openecomp.sdc.ci.tests.utils.general.OnboardingUtils; import org.testng.annotations.DataProvider; import org.testng.annotations.Factory; - public class OnbordingDataProviders { protected static String filepath = FileHandling.getVnfRepositoryPath(); - + // -----------------------dataProviders----------------------------------------- @DataProvider(name = "randomVNF_List", parallel = false) private static final Object[][] randomVnfList() throws Exception { int randomElementNumber = 3; //how many VNFs to onboard randomly - List<String> fileNamesFromFolder = OnboardingUtils.getVnfNamesFileList(); + List<String> fileNamesFromFolder = OnboardingUtils.getVnfNamesFileListExcludeToscaParserFailure(); List<String> newRandomFileNamesFromFolder = getRandomElements(randomElementNumber, fileNamesFromFolder); System.out.println(String.format("There are %s zip file(s) to test", newRandomFileNamesFromFolder.size())); return provideData(newRandomFileNamesFromFolder, filepath); @@ -30,12 +27,29 @@ public class OnbordingDataProviders { private static final Object[][] VnfList() throws Exception { List<String> fileNamesFromFolder = OnboardingUtils.getVnfNamesFileList(); - + System.out.println(String.format("There are %s zip file(s) to test", fileNamesFromFolder.size())); return provideData(fileNamesFromFolder, filepath); } - -// -----------------------factories----------------------------------------- + + @DataProvider(name = "updateList") + private static final Object[][] updateList() throws Exception { + + Object[][] objectArr = new Object[2][]; + + Object[][] filteredArObject = null; + + objectArr[0] = new Object[]{ "1-2016-20-visbc3vf-(VOIP)_v2.1.zip", "2-2016-20-visbc3vf-(VOIP)_v2.1_RenameResourceToShay.zip" }; + objectArr[1] = new Object[]{ "1-2017-404_vUSP_vCCF_AIC3.0-(VOIP)_v6.0.zip", "2-2017-404_vUSP_vCCF_AIC3.0-(VOIP)_v6.0_Added2TestParameters.zip" }; + + filteredArObject = OnboardingUtils.filterObjectArrWithExcludedVnfs(objectArr); + + return filteredArObject; + + + } + + // -----------------------factories----------------------------------------- @Factory(dataProvider = "VNF_List") public Object[] OnbordingDataProviders(String filepath, String vnfFile){ return new Object[] { new ToscaValidationTest(filepath, vnfFile)}; @@ -54,7 +68,7 @@ public class OnbordingDataProviders { return arObject; } - private static List<String> getRandomElements(int randomElementNumber, List<String> fileNamesFromFolder) { + public static List<String> getRandomElements(int randomElementNumber, List<String> fileNamesFromFolder) { if(fileNamesFromFolder.size() == 0 || fileNamesFromFolder.size() < randomElementNumber){ return null; }else{ @@ -71,8 +85,38 @@ public class OnbordingDataProviders { return newRandomFileNamesFromFolder; } } - - - - + + +// private static String[][] arrangeFilesVersionPairs(List<String> filesArr) { +// String[][] filesArrangeByPairs = null; +// +// List<String> versionOneFiles= null; +// List<String> versionTowFiles= null; +// +// for ( String fileName : filesArr ) +// { +// if(fileName.startsWith("1-")) +// { +// versionOneFiles.add(fileName); +// } +// else if(fileName.startsWith("2-")) +// { +// versionTowFiles.add(fileName); +// } +// } +// +// Collections.sort(versionOneFiles); +// Collections.sort(versionTowFiles); +// +// for (int i=0 ; i<versionOneFiles.size() ; i++ ) +// { +// for (int j=0 ; j<versionTowFiles.size() ; j++ ) +// { +// +// } +// } +// +// return filesArrangeByPairs; +// } + } @@ -1,56 +0,0 @@ -package org.openecomp.sdc.ci.tests.datatypes; - -public class AmdocsLicenseMembers { - - private String vendorId; - private String vendorLicenseName; - private String vendorLicenseAgreementId; - private String featureGroupId; - - public AmdocsLicenseMembers(String vendorId, String vendorLicenseName, String vendorLicenseAgreementId, String featureGroupId) { - super(); - this.vendorId = vendorId; - this.vendorLicenseName = vendorLicenseName; - this.vendorLicenseAgreementId = vendorLicenseAgreementId; - this.featureGroupId = featureGroupId; - } - - public String getVendorId() { - return vendorId; - } - - public void setVendorId(String vendorId) { - this.vendorId = vendorId; - } - - public String getVendorLicenseName() { - return vendorLicenseName; - } - - public void setVendorLicenseName(String vendorLicenseName) { - this.vendorLicenseName = vendorLicenseName; - } - - public String getVendorLicenseAgreementId() { - return vendorLicenseAgreementId; - } - - public void setVendorLicenseAgreementId(String vendorLicenseAgreementId) { - this.vendorLicenseAgreementId = vendorLicenseAgreementId; - } - - public String getFeatureGroupId() { - return featureGroupId; - } - - public void setFeatureGroupId(String featureGroupId) { - this.featureGroupId = featureGroupId; - } - - @Override - public String toString() { - return "AmdocsLicenseMembers [vendorId=" + vendorId + ", vendorLicenseName=" + vendorLicenseName + ", vendorLicenseAgreementId=" + vendorLicenseAgreementId + ", featureGroupId=" + featureGroupId + "]"; - } - - -} @@ -25,12 +25,15 @@ import java.util.List; import java.util.Map; import java.util.Random; import java.util.UUID; +import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; import org.apache.commons.lang3.tuple.ImmutablePair; import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.LeftPanelCanvasItems; +import org.openecomp.sdc.ci.tests.datatypes.enums.CircleSize; import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions; import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; +import org.openecomp.sdc.ci.tests.pages.CompositionPage; import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; import org.openqa.selenium.By; import org.openqa.selenium.StaleElementReferenceException; @@ -39,6 +42,7 @@ import org.openqa.selenium.interactions.Actions; import org.testng.Assert; import com.aventstack.extentreports.Status; +import com.clearspring.analytics.util.Pair; public final class CanvasManager { private Map<String, CanvasElement> canvasElements; @@ -48,8 +52,14 @@ public final class CanvasManager { private CanvasElement canvasElement; // Offsets Are used to find upper right corner of canvas element in order to // connect links - private static final int CANVAS_ELEMENT_Y_OFFSET = 30; - private static final int CANVAS_ELEMENT_X_OFFSET = 18; // 14 - 27 + private static final int CANVAS_VF_Y_OFFSET = 30; + private static final int CANVAS_VF_X_OFFSET = 18; // 14 - 27 + + private static final int CANVAS_NORMATIVE_ELEMENT_Y_OFFSET = 12; + private static final int CANVAS_NORMATIVE_ELEMENT_X_OFFSET = 7; + + private static final int CANVAS_SERVICE_Y_OFFSET = 27; + private static final int CANVAS_SERVICE_X_OFFSET = 16; private CanvasManager() { canvasElements = new HashMap<>(); @@ -116,6 +126,8 @@ public final class CanvasManager { actions.perform(); actions.click().perform(); GeneralUIUtils.ultimateWait(); + + validateInstanceSelected(canvasElement); ExtentTestActions.log(Status.INFO, String.format("Canvas element %s selected", canvasElement.getElementType())); } @@ -152,7 +164,7 @@ public final class CanvasManager { } return null; } - + public CanvasElement createElementOnCanvas(String elementName) throws Exception { String actionDuration = GeneralUIUtils.getActionDuration(() -> { try { @@ -161,13 +173,13 @@ public final class CanvasManager { e.printStackTrace(); } }); - + if (canvasElement != null){ ExtentTestActions.log(Status.INFO, String.format("The element %s should now be on the canvas", elementName), actionDuration); } return canvasElement; } - + private CanvasElement createElementOnCanvasWithoutDuration(String elementDataTestId) throws Exception { try { WebElement element = findClickElement(elementDataTestId); @@ -183,7 +195,7 @@ public final class CanvasManager { addCanvasElement(canvasElement); GeneralUIUtils.ultimateWait(); return canvasElement; - } + } catch (Exception e) { System.out.println("Can't create element on canvas"); e.printStackTrace(); @@ -218,6 +230,7 @@ public final class CanvasManager { return new ImmutablePair<Integer, Integer>(xElement, yElement); } + // Will work only if 2 elements are big sized (VF size), if one of the elements is Small use the function linkElements public void linkElements(CanvasElement firstElement, CanvasElement secondElement) throws Exception { ExtentTestActions.log(Status.INFO, String.format("Linking between the %s instance and the %s instance.", firstElement.getElementType(), secondElement.getElementType())); drawSimpleLink(firstElement, secondElement); @@ -225,20 +238,41 @@ public final class CanvasManager { ExtentTestActions.log(Status.INFO, String.format("The instances %s and %s should now be connected.", firstElement.getElementType(), secondElement.getElementType())); } + public void linkElements(CanvasElement firstElement, CircleSize firstElementSize, CanvasElement secondElement, CircleSize secondElementSize) throws Exception { + drawSimpleLink(firstElement,firstElementSize, secondElement,secondElementSize); + selectReqAndCapAndConnect(); + ExtentTestActions.log(Status.INFO, String.format("The instances %s and %s should now be connected.", firstElement.getElementType(), secondElement.getElementType())); + } + private void selectReqAndCapAndConnect() throws Exception { - // Select First Cap - GeneralUIUtils.getWebElementsListByTestID(DataTestIdEnum.LinkMenuItems.LINK_ITEM_CAP.getValue()).get(0).click(); - // Select First Req - GeneralUIUtils.getWebElementsListByTestID(DataTestIdEnum.LinkMenuItems.LINK_ITEM_REQ.getValue()).get(0).click(); - // Connect - GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.LinkMenuItems.CONNECT_BUTTON.getValue()).click(); + addFitstReqOrCapAndPressNext(); + addFitstReqOrCapAndPressNext(); + linkMenuClickOnFinishButton(); + } - GeneralUIUtils.waitForLoader(); + private void addFitstReqOrCapAndPressNext() throws Exception { + addFirstReqOrCap(); + linkMenuClickOnNextButton(); } + private void addFirstReqOrCap() { + GeneralUIUtils.getWebElementsListByClassName(DataTestIdEnum.LinkMenuItems.LINK_ITEM_CAP_Or_REQ.getValue()).get(0).click(); + } + + private void linkMenuClickOnNextButton() throws Exception { + GeneralUIUtils.clickOnElementByText("Next"); + GeneralUIUtils.ultimateWait(); + } + + private void linkMenuClickOnFinishButton() throws Exception { + GeneralUIUtils.clickOnElementByText("Finish"); + GeneralUIUtils.ultimateWait(); + } + + private void drawSimpleLink(CanvasElement firstElement, CanvasElement secondElement) throws Exception { - int yOffset = CANVAS_ELEMENT_Y_OFFSET; - int xOffset = CANVAS_ELEMENT_X_OFFSET; + int yOffset = CANVAS_VF_Y_OFFSET; + int xOffset = CANVAS_VF_X_OFFSET; actions.moveToElement(canvas, firstElement.getLocation().left + xOffset, firstElement.getLocation().right - yOffset); @@ -250,6 +284,45 @@ public final class CanvasManager { GeneralUIUtils.ultimateWait(); } + private void drawSimpleLink(CanvasElement firstElement, CircleSize firstElementSize, CanvasElement secondElement, CircleSize secondElementSize) throws Exception { + ExtentTestActions.log(Status.INFO, String.format("Linking between the %s instance and the %s instance.", firstElement.getElementType(), secondElement.getElementType())); + Integer yOffset = getCircleOffset(firstElementSize).right; + Integer xOffset = getCircleOffset(firstElementSize).left; + firstElement.getElementType(); + + + actions.moveToElement(canvas, firstElement.getLocation().left + xOffset, + firstElement.getLocation().right - yOffset); + + actions.clickAndHold(); + + yOffset = getCircleOffset(secondElementSize).right; + xOffset = getCircleOffset(secondElementSize).left; + + actions.moveToElement(canvas, secondElement.getLocation().left + xOffset, secondElement.getLocation().right - yOffset); + actions.release(); + actions.perform(); + GeneralUIUtils.ultimateWait(); + } + + private Pair<Integer,Integer> getCircleOffset(CircleSize circleSize) + { + Pair<Integer,Integer> circleSizes; + if(circleSize.equals(CircleSize.VF)) + { + circleSizes = new Pair <Integer,Integer> (CANVAS_VF_X_OFFSET,CANVAS_VF_Y_OFFSET); + } + else if (circleSize.equals(CircleSize.NORMATIVE)) + { + circleSizes = new Pair <Integer,Integer> (CANVAS_NORMATIVE_ELEMENT_X_OFFSET,CANVAS_NORMATIVE_ELEMENT_Y_OFFSET); + } + else + { + circleSizes = new Pair <Integer,Integer> (CANVAS_SERVICE_X_OFFSET,CANVAS_SERVICE_Y_OFFSET); + } + return circleSizes; + } + public String updateElementNameInCanvas(CanvasElement canvasElement, String newInstanceName) throws Exception { GeneralUIUtils.ultimateWait();; clickOnCanvaElement(canvasElement); @@ -265,4 +338,52 @@ public final class CanvasManager { SetupCDTest.getExtendTest().log(Status.INFO, String.format("Name of element instance changed from %s to %s", oldInstanceName, newInstanceName)); return oldInstanceName; } + + /** + * @param canvasElement + * Validate that instance was selected on right sidebar + */ + public void validateInstanceSelected(CanvasElement canvasElement) { + long maxWait = 3000; + long sumOfWaiting = 0; + long napPeriod = 200; + boolean isInstanceSelected; + do { + isInstanceSelected = CompositionPage.getSelectedInstanceName().contains(canvasElement.getElementType()); + + if (!isInstanceSelected) { + try { + TimeUnit.MILLISECONDS.sleep(napPeriod); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + sumOfWaiting += napPeriod; + if (sumOfWaiting > maxWait) { + Assert.fail(String.format("Can't select instance properly, waited for %s seconds", (int) (maxWait/1000))); + } + } while (!isInstanceSelected); + } + + private void selectReqCapByName(String reqCapName) + { + GeneralUIUtils.clickOnElementByText(reqCapName); + GeneralUIUtils.ultimateWait(); + } + + private void selectTypeOfReqCap(String reqCapType) + { + GeneralUIUtils.getSelectList(reqCapType,DataTestIdEnum.LinkMenuItems.REQ_CAP_SELECT_DATA_TESTS_ID.getValue()); + GeneralUIUtils.ultimateWait(); + } + + public void linkElementsAndSelectCapReqTypeAndCapReqName(CanvasElement firstElement, CircleSize firstElementSize, CanvasElement secondElement, CircleSize secondElementSize, ConnectionWizardPopUpObject connectionWizardPopUpObject) throws Exception { + drawSimpleLink(firstElement, firstElementSize, secondElement, secondElementSize); + selectTypeOfReqCap(connectionWizardPopUpObject.getCapabilityTypeSecondItem()); + addFitstReqOrCapAndPressNext(); + selectReqCapByName(connectionWizardPopUpObject.getCapabilityNameSecondItem()); + linkMenuClickOnNextButton(); + linkMenuClickOnFinishButton(); + } } @@ -0,0 +1,58 @@ +package org.openecomp.sdc.ci.tests.datatypes; + +public class ConnectionWizardPopUpObject { + + private String capabilityTypeFirstItem; + private String capabilityTypeSecondItem; + private String capabilityNameFirstItem; + private String capabilityNameSecondItem; + + public ConnectionWizardPopUpObject(String capabilityTypeFirstItem, String capabilityNameFirstItem, String capabilityTypeSecondItem, String capabilityNameSecondItem) { + this.capabilityTypeFirstItem = capabilityTypeFirstItem; + this.capabilityTypeSecondItem = capabilityTypeSecondItem; + this.capabilityNameFirstItem = capabilityNameFirstItem; + this.capabilityNameSecondItem = capabilityNameSecondItem; + } + + public String getCapabilityTypeFirstItem() { + return capabilityTypeFirstItem; + } + + public void setCapabilityTypeFirstItem(String capabilityTypeFirstItem) { + this.capabilityTypeFirstItem = capabilityTypeFirstItem; + } + + public String getCapabilityTypeSecondItem() { + return capabilityTypeSecondItem; + } + + public void setCapabilityTypeSecondItem(String capabilityTypeSecondItem) { + this.capabilityTypeSecondItem = capabilityTypeSecondItem; + } + + public String getCapabilityNameFirstItem() { + return capabilityNameFirstItem; + } + + public void setCapabilityNameFirstItem(String capabilityNameFirstItem) { + this.capabilityNameFirstItem = capabilityNameFirstItem; + } + + public String getCapabilityNameSecondItem() { + return capabilityNameSecondItem; + } + + public void setCapabilityNameSecondItem(String capabilityNameSecondItem) { + this.capabilityNameSecondItem = capabilityNameSecondItem; + } + + @Override + public String toString() { + return "ConnectionWizardPopUpObject{" + + "capabilityTypeFirstItem='" + capabilityTypeFirstItem + '\'' + + ", capabilityTypeSecondItem='" + capabilityTypeSecondItem + '\'' + + ", capabilityNameFirstItem='" + capabilityNameFirstItem + '\'' + + ", capabilityNameSecondItem='" + capabilityNameSecondItem + '\'' + + '}'; + } +} @@ -151,11 +151,13 @@ public final class DataTestIdEnum { } public enum LinkMenuItems { - CANCEL_BUTTON("link-menu-button-cancel"), - CONNECT_BUTTON("link-menu-button-connect"), - LINK_ITEM_CAP("link-item-capabilities"), - LINK_ITEM_REQ("link-item-requirements"), - LINK_MENU("link-menu-open"); +// CANCEL_BUTTON("link-menu-button-cancel"), +// CONNECT_BUTTON("link-menu-button-connect"), +// LINK_ITEM_CAP("link-item-capabilities"), +// LINK_ITEM_REQ("link-item-requirements"), +// LINK_MENU("link-menu-open"); + LINK_ITEM_CAP_Or_REQ("req-or-cap-item"), + REQ_CAP_SELECT_DATA_TESTS_ID("SelectType"); private String value; @@ -167,6 +169,9 @@ public final class DataTestIdEnum { this.value = value; } } + + + public enum GeneralCanvasItems { CANVAS("canvas"), @@ -434,19 +439,20 @@ public final class DataTestIdEnum { } public enum StepsEnum { - GENERAL("General"), + GENERAL("GeneralLeftSideMenu"), ICON("Iconstep"), - DEPLOYMENT_ARTIFACT("Deployment Artifact"), - INFORMATION_ARTIFACT("Information Artifact"), - PROPERTIES("Properties"), - COMPOSITION("Composition"), - ACTIVITY_LOG("Activity Log"), - DEPLOYMENT_VIEW("Deployment"), - TOSCA_ARTIFACTS("TOSCA Artifacts"), - MONITOR("Monitor "), - MANAGEMENT_WORKFLOW("Management Workflow"), + DEPLOYMENT_ARTIFACT("Deployment ArtifactLeftSideMenu"), + INFORMATION_ARTIFACT("Information ArtifactLeftSideMenu"), + PROPERTIES("PropertiesLeftSideMenu"), + COMPOSITION("CompositionLeftSideMenu"), + ACTIVITY_LOG("Activity LogLeftSideMenu"), + DEPLOYMENT_VIEW("DeploymentLeftSideMenu"), + TOSCA_ARTIFACTS("TOSCA ArtifactsLeftSideMenu"), + MONITOR("Monitor LeftSideMenu"), + MANAGEMENT_WORKFLOW("Management WorkflowLeftSideMenu"), INPUTS("Inputs"), - HIERARCHY("Hierarchy"); + HIERARCHY("Hierarchy"), + PROPERTIES_ASSIGNMENT("Properties AssignmentLeftSideMenu"); private String value; @@ -799,6 +805,36 @@ public final class DataTestIdEnum { } } + public enum PropertiesAssignmentScreen { + + PROPERTIES_TAB("Properties"), + INPUTS_TAB("Inputs"), + COMPOSITION_TAB("Composition"), + PROPERTY_STRUCTURE_TAB("Property Structure"), + DECLARE_BUTTON("declare-button"), + SEARCH_BOX("search-box"), + SEARCH_BUTTON("search-button"), + FILTER_BUTTON("filter-button"), + FILTER_BOX("filter-box"), + CLEAR_FILTER_BUTTON("clear-filter-button"), + INPUT_DELETE_BUTTON("delete-input-button"), + INPUT_DELETE_DIALOG_DELETE("Delete"), + INPUT_DELETE_DIALOG_CLOSE("Close"), + FILTER_CHECKBOX_ALL("filter-checkbox-all"); + + + private String value; + + public String getValue() { + return value; + } + + private PropertiesAssignmentScreen(String value) { + this.value = value; + } + + } + public enum ImportVfRepository { SEARCH("onboarding-search"), IMPORT_VSP("import-csar"), @@ -0,0 +1,51 @@ +package org.openecomp.sdc.ci.tests.datatypes; + +import org.openecomp.sdc.be.model.Resource; +import org.openecomp.sdc.be.model.Service; + + +public class ServiceContainer { + private Service service; + private Resource resource; + private VendorSoftwareProductObject vendorSoftwareProductObject; + private AmdocsLicenseMembers amdocsLicenseMembers; + + public ServiceContainer(Service service, Resource resource, VendorSoftwareProductObject vendorSoftwareProductObject, AmdocsLicenseMembers amdocsLicenseMembers) { + this.service = service; + this.resource = resource; + this.vendorSoftwareProductObject = vendorSoftwareProductObject; + this.amdocsLicenseMembers = amdocsLicenseMembers; + } + + public Service getService() { + return service; + } + + public void setService(Service service) { + this.service = service; + } + + public Resource getResource() { + return resource; + } + + public void setResource(Resource resource) { + this.resource = resource; + } + + public VendorSoftwareProductObject getVendorSoftwareProductObject() { + return vendorSoftwareProductObject; + } + + public void setVendorSoftwareProductObject(VendorSoftwareProductObject vendorSoftwareProductObject) { + this.vendorSoftwareProductObject = vendorSoftwareProductObject; + } + + public AmdocsLicenseMembers getAmdocsLicenseMembers() { + return amdocsLicenseMembers; + } + + public void setAmdocsLicenseMembers(AmdocsLicenseMembers amdocsLicenseMembers) { + this.amdocsLicenseMembers = amdocsLicenseMembers; + } +} @@ -22,7 +22,7 @@ package org.openecomp.sdc.ci.tests.datatypes; public enum TypesEnum { - RESOURCE("checkbox-resource"), VF("checkbox-vf"), VFC("checkbox-vfc"), CP("checkbox-cp"), VL("checkbox-vl"), SERVICE("checkbox-service"), PRODUCT("checkbox-product"); + RESOURCE("checkbox-resource"), VF("checkbox-vf"), VFC("checkbox-vfc"), PNF("checkbox-pnf"), CP("checkbox-cp"), VL("checkbox-vl"), SERVICE("checkbox-service"), PRODUCT("checkbox-product"); private String value; public String getValue() { @@ -93,6 +93,7 @@ public class UserManagementTab { } public void updateUser(int index){ + GeneralUIUtils.ultimateWait(); GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.UserManagementEnum.UPDATE_USER_BUTTON.getValue() + index); } @@ -1,47 +1,27 @@ package org.openecomp.sdc.ci.tests.datatypes; -public class VendorSoftwareProductObject { +public class VendorSoftwareProductObject extends VendorSoftwareProductObjectReqDetails { - private String vendorName; private String vspId; - private String category; - private String subCategory; private String componentId; - private String description; private String attContact; - private String vspName; - - public VendorSoftwareProductObject() { - super(); - // TODO Auto-generated constructor stub - } + private String version; + + public VendorSoftwareProductObject(){super();} - public VendorSoftwareProductObject(String vendorName, String vspId, String category, String subCategory, String componentId, String description, String attContact) { - super(); - this.vendorName = vendorName; + public VendorSoftwareProductObject(String vspId, String componentId, String attContact, String version) { this.vspId = vspId; - this.category = category; - this.subCategory = subCategory; this.componentId = componentId; - this.description = description; this.attContact = attContact; + this.version = version; } - - public String getVspName() { - return vspName; - } - - public void setVspName(String vspName) { - this.vspName = vspName; - } - - public String getVendorName() { - return vendorName; - } - - public void setVendorName(String vendorName) { - this.vendorName = vendorName; + public VendorSoftwareProductObject(String name, String description, String category, String subCategory, String vendorId, String vendorName, LicensingVersion licensingVersion, LicensingData licensingData, String onboardingMethod, String networkPackageName, String onboardingOrigin, String vspId, String componentId, String attContact, String version) { + super(name, description, category, subCategory, vendorId, vendorName, licensingVersion, licensingData, onboardingMethod, networkPackageName, onboardingOrigin); + this.vspId = vspId; + this.componentId = componentId; + this.attContact = attContact; + this.version = version; } public String getVspId() { @@ -52,22 +32,6 @@ public class VendorSoftwareProductObject { this.vspId = vspId; } - public String getCategory() { - return category; - } - - public void setCategory(String category) { - this.category = category; - } - - public String getSubCategory() { - return subCategory; - } - - public void setSubCategory(String subCategory) { - this.subCategory = subCategory; - } - public String getComponentId() { return componentId; } @@ -76,14 +40,6 @@ public class VendorSoftwareProductObject { this.componentId = componentId; } - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - public String getAttContact() { return attContact; } @@ -92,11 +48,21 @@ public class VendorSoftwareProductObject { this.attContact = attContact; } + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + @Override public String toString() { - return "VendorSoftwareProductObject [vendorName=" + vendorName + ", vspId=" + vspId + ", category=" + category + ", subCategory=" + subCategory + ", componentId=" + componentId + ", description=" + description + ", attContact=" - + attContact + "]"; + return "VendorSoftwareProductObject{" + + "vspId='" + vspId + '\'' + + ", componentId='" + componentId + '\'' + + ", attContact='" + attContact + '\'' + + ", version='" + version + '\'' + + '}'; } - - } @@ -48,7 +48,6 @@ import org.openecomp.sdc.ci.tests.verificator.UserManagementVerificator; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; import org.testng.Assert; -import org.testng.SkipException; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; @@ -98,6 +97,7 @@ public class AdminUserManagment extends SetupCDTest { UserRoleEnum userRole = UserRoleEnum.DESIGNER; AdminWorkspaceUIUtilies.createNewUser(userId, userRole); ExtentTestActions.log(Status.INFO, "Trying to create the same user once again."); + GeneralUIUtils.ultimateWait(); // extra wait, necessary for system with large user list AdminWorkspaceUIUtilies.createNewUser(userId, userRole); ErrorMessageUIVerificator.validateErrorMessage(ActionStatus.USER_ALREADY_EXIST); } @@ -106,9 +106,9 @@ public class AdminUserManagment extends SetupCDTest { @Test public void createInvalidMacIdTest(){ - if(true){ - throw new SkipException("Open bug 324032"); - } +// if(true){ +// throw new SkipException("Open bug 324032"); +// } String macId = generateValidMacId(); StringBuilder invalidMacId = new StringBuilder(macId); @@ -41,7 +41,6 @@ import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.openecomp.sdc.ci.tests.verificator.DeploymentViewVerificator; import org.openqa.selenium.WebElement; -import org.testng.SkipException; import org.testng.annotations.BeforeMethod; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; @@ -59,7 +58,7 @@ public class DeploymentViewTests extends SetupCDTest { @DataProvider(name = "CSAR_VF_Files", parallel = false) public Object[][] createDataX() { - return new Object[][] { { "vSeGWdoubleMembers.csar" }, { "vSeGW.csar" }, {"vSeGWsingleModule.csar"}}; + return new Object[][] {{"vSeGWNew.csar"}, {"vSeGWNewDoubleMembers.csar"}, {"vSeGWNewSingleModule.csar"}}; } @@ -76,7 +75,7 @@ public class DeploymentViewTests extends SetupCDTest { List<WebElement> moduleRowsFromTable = GeneralUIUtils.getElementsByCSS(DataTestIdEnum.DeploymentScreen.MODULES.getValue()); DeploymentViewVerificator verificator = new DeploymentViewVerificator(filePath + baseFileName); verificator.verifyDeploymentPageModules(moduleRowsFromTable); - for(WebElement moduleRow :moduleRowsFromTable){ + for(WebElement moduleRow : moduleRowsFromTable){ String moduleRowText = moduleRow.getText(); verificator.verifyDeploymentPageSubElements(moduleRowText.split("\\.\\.")[1]); DeploymentPage.updateModuleName(moduleRowText, "updatedName"); @@ -89,8 +88,8 @@ public class DeploymentViewTests extends SetupCDTest { @Test public void deploymentScreenDCAEAssetUpdateWithNewGroupCSAR_TC1368223_Test() throws Exception{ - String baseFileName = "baseUpdateMinusGroupFlowVF.csar"; - String updateFileName = "baseUpdateFlowVF.csar"; + String baseFileName = "baseUpdateMinusGroupFlowVF_NEW.csar"; + String updateFileName = "baseUpdateFlowVF_NEW.csar"; ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString()); SetupCDTest.getExtendTest().log(Status.INFO, String.format("Creating resource with %s groups ", 2)); @@ -111,8 +110,8 @@ public class DeploymentViewTests extends SetupCDTest { @Test public void deploymentScreenDCAEAssetDeleteGroupFromCSAR_TC1368281_Test() throws Exception{ - String baseFileName = "baseUpdateFlowVF.csar"; - String updateFileName = "baseUpdateMinusGroupFlowVF.csar"; + String baseFileName = "baseUpdateFlowVF_NEW.csar"; + String updateFileName = "baseUpdateMinusGroupFlowVF_NEW.csar"; ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString()); SetupCDTest.getExtendTest().log(Status.INFO, String.format("Creating resource with %s groups ", 3)); @@ -145,9 +144,9 @@ public class DeploymentViewTests extends SetupCDTest { @Test public void deploymentScreenDCAEAssetUpdateWithNewGroupWithoutMembersCSAR_TC1368280_Test() throws Exception{ - String baseFileName = "baseUpdateMinusGroupFlowVF.csar"; - String updateFileName = "baseUpdateAddGroupNoMembersUpdateFlow.csar"; - String updateFileName2 = "baseUpdateFlowVF.csar"; + String baseFileName = "baseUpdateMinusGroupFlowVF_NEW.csar"; + String updateFileName = "baseUpdateAddGroupNoMembersUpdateFlow_NEW.csar"; + String updateFileName2 = "baseUpdateFlowVF_NEW.csar"; ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString()); SetupCDTest.getExtendTest().log(Status.INFO, String.format("Creating resource with %s groups ", 2)); @@ -167,10 +166,6 @@ public class DeploymentViewTests extends SetupCDTest { SetupCDTest.getExtendTest().log(Status.INFO, String.format("Updating VF with new file, should be %s groups now, base_ldsa group with members", 3)); ResourceUIUtils.updateVfWithCsar(filePath, updateFileName2); - if(true){ - throw new SkipException("Open bug 305812"); - } - // validate that member was added to base_ldsa group DeploymentViewVerificator.regularDepoymentScreenVerificator(metaDataFromUI, new DeploymentViewVerificator(filePath + updateFileName2)); DeploymentViewVerificator.validateModuleNameUpadate(); @@ -178,7 +173,7 @@ public class DeploymentViewTests extends SetupCDTest { @Test public void deploymentScreenDCAEAssetImportCSARWithArtifactSection_TC1368282_1_Test() throws Exception{ - String baseFileName = "baseUpdateFlowTwoArtifactsToGroup.csar"; + String baseFileName = "baseUpdateFlowTwoArtifactsToGroup_NEW.csar"; ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString()); SetupCDTest.getExtendTest().log(Status.INFO, String.format("Creating resource with %s groups, should be 4 artifacts in every group ", 3)); @@ -190,8 +185,8 @@ public class DeploymentViewTests extends SetupCDTest { @Test public void deploymentScreenDCAEAssetImportCSARRemoveArtifact_TC1368282_2_Test() throws Exception{ - String baseFileName = "baseUpdateFlowTwoArtifactsToGroup.csar"; - String updateFileName = "baseUpdateFlowOneArtifactToGroup.csar"; + String baseFileName = "baseUpdateFlowTwoArtifactsToGroup_NEW.csar"; + String updateFileName = "baseUpdateFlowOneArtifactToGroup_NEW.csar"; ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString()); SetupCDTest.getExtendTest().log(Status.INFO, String.format("Creating resource with %s groups, should be 4 artifacts in every group ", 3)); @@ -203,10 +198,6 @@ public class DeploymentViewTests extends SetupCDTest { // remove artifact from every group SetupCDTest.getExtendTest().log(Status.INFO, String.format("Updating VF with new file, should be 3 artifacts in every group")); ResourceUIUtils.updateVfWithCsar(filePath, updateFileName); - - if(true){ - throw new SkipException("Open bug 306329"); - } DeploymentViewVerificator.regularDepoymentScreenVerificator(metaDataFromUI, new DeploymentViewVerificator(filePath + updateFileName)); DeploymentViewVerificator.validateModuleNameUpadate(); @@ -214,8 +205,8 @@ public class DeploymentViewTests extends SetupCDTest { @Test public void deploymentScreenDCAEAssetImportCSARAddArtifact_TC1368282_3_Test() throws Exception{ - String baseFileName = "baseUpdateFlowTwoArtifactsToGroup.csar"; - String updateFileName = "baseUpdateFlowOneArtifactToGroup.csar"; + String baseFileName = "baseUpdateFlowTwoArtifactsToGroup_NEW.csar"; + String updateFileName = "baseUpdateFlowOneArtifactToGroup_NEW.csar"; ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString()); SetupCDTest.getExtendTest().log(Status.INFO, String.format("Creating resource with %s groups, should be 3 artifacts in every group ", 3)); @@ -227,10 +218,6 @@ public class DeploymentViewTests extends SetupCDTest { // add artifact to every group SetupCDTest.getExtendTest().log(Status.INFO, String.format("Updating VF with new file, should be 4 artifacts in every group")); ResourceUIUtils.updateVfWithCsar(filePath, baseFileName); - - if(true){ - throw new SkipException("Open bug 306005"); - } DeploymentViewVerificator.regularDepoymentScreenVerificator(metaDataFromUI, new DeploymentViewVerificator(filePath + baseFileName)); DeploymentViewVerificator.validateModuleNameUpadate(); @@ -238,8 +225,8 @@ public class DeploymentViewTests extends SetupCDTest { @Test public void deploymentScreenDCAEAssetImportCSARMixArtifacts_TC1368282_4_Test() throws Exception{ - String baseFileName = "baseUpdateFlowTwoArtifactsToGroup.csar"; - String updateFileName = "baseUpdateMixedArtifacts.csar"; + String baseFileName = "baseUpdateFlowTwoArtifactsToGroup_NEW.csar"; + String updateFileName = "baseUpdateMixedArtifacts_NEW.csar"; ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString()); SetupCDTest.getExtendTest().log(Status.INFO, String.format("Creating resource with %s groups, should be 4 artifacts in every group ", 3)); @@ -252,18 +239,14 @@ public class DeploymentViewTests extends SetupCDTest { SetupCDTest.getExtendTest().log(Status.INFO, String.format("Updating VF with new file, mixing between artifacts and groups", 3)); ResourceUIUtils.updateVfWithCsar(filePath, updateFileName); - if(true){ - throw new SkipException("Open bug 306005"); - } - DeploymentViewVerificator.regularDepoymentScreenVerificator(metaDataFromUI, new DeploymentViewVerificator()); DeploymentViewVerificator.validateModuleNameUpadate(); }; @Test public void deploymentScreenDCAEAssetUpdateVFModule_TC1296437_Test() throws Exception{ - String baseFileName = "baseUpdateMinusGroupFlowVF.csar"; - String updateFileName = "baseUpdateFlowVF.csar"; + String baseFileName = "baseUpdateMinusGroupFlowVF_NEW.csar"; + String updateFileName = "baseUpdateFlowVF_NEW.csar"; ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString()); SetupCDTest.getExtendTest().log(Status.INFO, String.format("Creating resource with %s groups ", 2)); @@ -71,7 +71,6 @@ import org.openecomp.sdc.ci.tests.verificator.VfVerificator; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; import org.testng.Assert; -import org.testng.SkipException; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; @@ -93,7 +92,7 @@ public class ImportDCAE extends SetupCDTest { // update Resource ResourceReqDetails updatedResource = new ResourceReqDetails(); - updatedResource.setName("ciUpdatedNameImportDCAE"); + updatedResource.setName(ElementFactory.getResourcePrefix() + "UpdatedName" + resourceMetaData.getName()); updatedResource.setDescription("kuku"); updatedResource.setVendorName("updatedVendor"); updatedResource.setVendorRelease("updatedRelease"); @@ -53,10 +53,10 @@ import org.openecomp.sdc.ci.tests.utilities.PropertiesUIUtils; import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils; +import org.openecomp.sdc.ci.tests.verificator.PropertyVerificator; import org.openecomp.sdc.ci.tests.verificator.VFCverificator; import org.openecomp.sdc.ci.tests.verificator.VfVerificator; import org.testng.Assert; -import org.testng.SkipException; import org.testng.annotations.BeforeClass; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; @@ -234,6 +234,37 @@ public class ImportVFCAsset extends SetupCDTest { } + @Test + public void updateAfterCheckoutNewSimplePropertiesVFCTest() throws Exception{ + String fileName = "importVFC_VFC16.yml"; + atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, + ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser()); + ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser()); + + ResourceGeneralPage.getLeftMenu().moveToPropertiesScreen(); + List<PropertyTypeEnum> propertyList = Arrays.asList(PropertyTypeEnum.STRING, PropertyTypeEnum.INTEGER, PropertyTypeEnum.FLOAT); + int propertiesCount = PropertiesPage.getElemenetsFromTable().size(); + for (PropertyTypeEnum prop : propertyList){ + PropertiesUIUtils.addNewProperty(prop); + } + ResourceGeneralPage.clickCheckinButton(atomicResourceMetaData.getName()); + GeneralUIUtils.findComponentAndClick(atomicResourceMetaData.getName()); + GeneralPageElements.clickCheckoutButton(); + ResourceGeneralPage.getLeftMenu().moveToPropertiesScreen(); + + for (PropertyTypeEnum prop : propertyList){ + PropertiesUIUtils.updateProperty(prop); + } + assertTrue(GeneralUIUtils.checkElementsCountInTable(propertiesCount + propertyList.size(), () -> PropertiesPage.getElemenetsFromTable())); + + for (PropertyTypeEnum prop : propertyList){ + PropertiesPage.clickOnProperty(prop.getName()); + PropertyVerificator.validateEditVFCPropertiesPopoverFields(prop); + PropertiesPage.getPropertyPopup().clickCancel(); + } + + } + @Test(dataProvider = "assetFiles") public void checkinCheckoutChangeDeleteVersionVFCTest(String customfileName) throws Exception{ @@ -285,12 +316,7 @@ public class ImportVFCAsset extends SetupCDTest { } @Test - public void activityLogVFCTest() throws Exception{ - - if(true){ - throw new SkipException("Open bug 291623"); - } - + public void activityLogVFCTest() throws Exception{ String fileName = "importVFC_VFC11.yml"; atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser()); @@ -28,7 +28,6 @@ import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; -import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -38,6 +37,7 @@ import org.openecomp.sdc.ci.tests.dataProvider.OnbordingDataProviders; import org.openecomp.sdc.ci.tests.datatypes.AmdocsLicenseMembers; import org.openecomp.sdc.ci.tests.datatypes.CanvasElement; import org.openecomp.sdc.ci.tests.datatypes.CanvasManager; +import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.execute.setup.ArtifactsCorrelationManager; @@ -53,14 +53,14 @@ import org.openecomp.sdc.ci.tests.pages.ServiceGeneralPage; import org.openecomp.sdc.ci.tests.pages.TesterOperationPage; import org.openecomp.sdc.ci.tests.utilities.FileHandling; import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; -import org.openecomp.sdc.ci.tests.utilities.OnboardingUtils; +import org.openecomp.sdc.ci.tests.utilities.OnboardingUiUtils; import org.openecomp.sdc.ci.tests.utilities.ServiceUIUtils; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; +import org.openecomp.sdc.ci.tests.utils.general.OnboardingUtils; import org.openecomp.sdc.ci.tests.verificator.ServiceVerificator; import org.openqa.selenium.WebElement; import org.testng.AssertJUnit; import org.testng.annotations.BeforeMethod; -import org.testng.annotations.DataProvider; import org.testng.annotations.Optional; import org.testng.annotations.Parameters; import org.testng.annotations.Test; @@ -70,7 +70,7 @@ import com.clearspring.analytics.util.Pair; public class Onboard extends SetupCDTest { - protected static String filepath = FileHandling.getVnfRepositoryPath(); + protected static String filePath = FileHandling.getVnfRepositoryPath(); protected String makeDistributionValue; @Parameters({ "makeDistribution" }) @@ -80,19 +80,35 @@ public class Onboard extends SetupCDTest { } @Test + public void onboardVNFTestSanityOneFile() throws Exception, Throwable { +// List<String> fileNamesFromFolder = OnboardingUiUtils.getVnfNamesFileList(); +// String vnfFile = fileNamesFromFolder.get(0).toString(); + String vnfFile = "2017-302_vNSO.zip"; +// String vnfFile = "1-Fn-vprobe-be-11-2-5-1-vf-(MOBILITY)_v5.0.zip"; + ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT); + ServiceReqDetails serviceReqDetails = ElementFactory.getDefaultService();//getServiceReqDetails(ComponentConfigurationTypeEnum.DEFAULT); + runOnboardToDistributionFlow(resourceReqDetails, serviceReqDetails, filePath, vnfFile); + } + + @Test public void onboardVNFTestSanity() throws Exception, Throwable { List<String> fileNamesFromFolder = OnboardingUtils.getVnfNamesFileList(); String vnfFile = fileNamesFromFolder.get(0).toString(); - runOnboardToDistributionFlow(filepath, vnfFile); + ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT); + ServiceReqDetails serviceReqDetails = ElementFactory.getDefaultService();//getServiceReqDetails(ComponentConfigurationTypeEnum.DEFAULT); + runOnboardToDistributionFlow(resourceReqDetails, serviceReqDetails, filePath, vnfFile); } - public void runOnboardToDistributionFlow(String filepath, String vnfFile) throws Exception, AWTException { - String vspName = onboardAndCertify(filepath, vnfFile); + public void runOnboardToDistributionFlow(ResourceReqDetails resourceReqDetails, ServiceReqDetails serviceMetadata, String filePath, String vnfFile) throws Exception, AWTException { + getExtendTest().log(Status.INFO, "Going to create resource with category: " + resourceReqDetails.getCategories().get(0).getName() + + " subCategory: " + resourceReqDetails.getCategories().get(0).getSubcategories().get(0).getName() + + " and service category: " + serviceMetadata.getCategory()); + String vspName = onboardAndCertify(resourceReqDetails, filePath, vnfFile); reloginWithNewRole(UserRoleEnum.DESIGNER); // create service - ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); +// ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); ServiceUIUtils.createService(serviceMetadata, getUser()); ServiceGeneralPage.getLeftMenu().moveToCompositionScreen(); @@ -135,8 +151,8 @@ public class Onboard extends SetupCDTest { getExtendTest().log(Status.INFO, String.format("The onboarding %s test is passed ! ", vnfFile)); } - public String onboardAndCertify(String filepath, String vnfFile) throws Exception, IOException { - Pair<String,Map<String,String>> onboardAndValidate = OnboardingUtils.onboardAndValidate(filepath, vnfFile, getUser()); + public String onboardAndCertify(ResourceReqDetails resourceReqDetails, String filePath, String vnfFile) throws Exception, IOException { + Pair<String,Map<String,String>> onboardAndValidate = OnboardingUiUtils.onboardAndValidate(resourceReqDetails, filePath, vnfFile, getUser()); String vspName = onboardAndValidate.left; DeploymentArtifactPage.getLeftPanel().moveToCompositionScreen(); @@ -152,36 +168,41 @@ public class Onboard extends SetupCDTest { @Test(dataProviderClass = OnbordingDataProviders.class, dataProvider = "VNF_List") - public void onboardVNFTest(String filepath, String vnfFile) throws Exception, Throwable { + public void onboardVNFTest(String filePath, String vnfFile) throws Exception, Throwable { setLog(vnfFile); System.out.println("printttttttttttttt - >" + makeDistributionValue); - runOnboardToDistributionFlow(filepath, vnfFile); + ResourceReqDetails resourceReqDetails = ElementFactory.getRandomCategoryResource(); + ServiceReqDetails serviceReqDetails = ElementFactory.getRandomCategoryService(); + runOnboardToDistributionFlow(resourceReqDetails, serviceReqDetails, filePath, vnfFile); } @Test(dataProviderClass = OnbordingDataProviders.class, dataProvider = "VNF_List") - public void onboardVNFShotFlow(String filepath, String vnfFile) throws Exception, Throwable { + public void onboardVNFShotFlow(String filePath, String vnfFile) throws Exception, Throwable { setLog(vnfFile); System.out.println("printttttttttttttt - >" + makeDistributionValue); - onboardAndCertify(filepath, vnfFile); + ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT); + onboardAndCertify(resourceReqDetails, filePath, vnfFile); } @Test(dataProviderClass = OnbordingDataProviders.class, dataProvider = "randomVNF_List") - public void onboardRandomVNFsTest(String filepath, String vnfFile) throws Exception, Throwable { + public void onboardRandomVNFsTest(String filePath, String vnfFile) throws Exception, Throwable { setLog(vnfFile); System.out.println("printttttttttttttt - >" + makeDistributionValue); System.out.println("Vnf File name is: " + vnfFile); - runOnboardToDistributionFlow(filepath, vnfFile); + ResourceReqDetails resourceReqDetails = ElementFactory.getRandomCategoryResource(); + ServiceReqDetails serviceReqDetails = ElementFactory.getRandomCategoryService(); + runOnboardToDistributionFlow(resourceReqDetails, serviceReqDetails, filePath, vnfFile); } @Test public void onboardUpdateVNFTest() throws Exception, Throwable { -// Object[] fileNamesFromFolder = FileHandling.getZipFileNamesFromFolder(filepath); - List<String> fileNamesFromFolder = FileHandling.getZipFileNamesFromFolder(filepath); +// Object[] fileNamesFromFolder = FileHandling.getZipFileNamesFromFolder(filePath); + List<String> fileNamesFromFolder = FileHandling.getZipFileNamesFromFolder(filePath); // String vnfFile = fileNamesFromFolder[0].toString(); String vnfFile = fileNamesFromFolder.get(0); - - Pair<String,Map<String,String>> vsp = OnboardingUtils.onboardAndValidate(filepath, vnfFile, getUser()); + ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT); + Pair<String,Map<String,String>> vsp = OnboardingUiUtils.onboardAndValidate(resourceReqDetails, filePath, vnfFile, getUser()); String vspName = vsp.left; ResourceGeneralPage.clickSubmitForTestingButton(vspName); @@ -209,7 +230,7 @@ public class Onboard extends SetupCDTest { getExtendTest().log(Status.INFO, String.format("Going to update the VNF with %s......", updatedVnfFile)); // update VendorSoftwareProduct - OnboardingUtils.updateVnfAndValidate(filepath, vsp, updatedVnfFile, getUser()); + OnboardingUiUtils.updateVnfAndValidate(filePath, vsp, updatedVnfFile, getUser()); ResourceGeneralPage.clickSubmitForTestingButton(vspName); @@ -257,9 +278,10 @@ public class Onboard extends SetupCDTest { @Test public void threeVMMSCsInServiceTest() throws Exception{ - + + String pathFile = FileHandling.getFilePath("VmmscArtifacts"); List<String> vmmscList = new ArrayList<String>(); - vmmscList = Arrays.asList(new File(filepath).list()).stream().filter(e -> e.contains("vmmsc") && e.endsWith(".zip")).collect(Collectors.toList()); + vmmscList = Arrays.asList(new File(pathFile).list()).stream().filter(e -> e.contains("vmmsc") && e.endsWith(".zip")).collect(Collectors.toList()); assertTrue("Did not find vMMSCs", vmmscList.size() > 0); Map<String, String> vspNames = new HashMap<String, String>(); @@ -267,16 +289,17 @@ public class Onboard extends SetupCDTest { getExtendTest().log(Status.INFO, String.format("Going to onboard the VNF %s......", vnfFile)); System.out.println(String.format("Going to onboard the VNF %s......", vnfFile)); - AmdocsLicenseMembers amdocsLicenseMembers = OnboardingUtils.createVendorLicense(getUser()); - Pair<String,Map<String,String>> createVendorSoftwareProduct = OnboardingUtils.createVendorSoftwareProduct(vnfFile, filepath, getUser(), amdocsLicenseMembers); + AmdocsLicenseMembers amdocsLicenseMembers = OnboardingUiUtils.createVendorLicense(getUser()); + ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT); + Pair<String,Map<String,String>> createVendorSoftwareProduct = OnboardingUtils.createVendorSoftwareProduct(resourceReqDetails, vnfFile, pathFile, getUser(), amdocsLicenseMembers); getExtendTest().log(Status.INFO, String.format("Searching for onboarded %s", vnfFile)); HomePage.showVspRepository(); getExtendTest().log(Status.INFO,String.format("Going to import %s......", vnfFile.substring(0, vnfFile.indexOf(".")))); - OnboardingUtils.importVSP(createVendorSoftwareProduct); + OnboardingUiUtils.importVSP(createVendorSoftwareProduct); ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen(); - DeploymentArtifactPage.verifyArtifactsExistInTable(filepath, vnfFile); + DeploymentArtifactPage.verifyArtifactsExistInTable(pathFile, vnfFile); String vspName = createVendorSoftwareProduct.left; DeploymentArtifactPage.clickSubmitForTestingButton(vspName); @@ -20,16 +20,12 @@ package org.openecomp.sdc.ci.tests.execute.sanity; -import static org.testng.AssertJUnit.assertEquals; +import static org.testng.AssertJUnit.assertTrue; import java.awt.AWTException; -import java.io.File; import java.sql.Timestamp; -import java.util.HashMap; -import java.util.Iterator; import java.util.List; import java.util.Map; -import java.util.UUID; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.Resource; @@ -38,16 +34,16 @@ import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.ci.tests.dataProvider.OnbordingDataProviders; import org.openecomp.sdc.ci.tests.datatypes.AmdocsLicenseMembers; import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; +import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.VendorSoftwareProductObject; import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; import org.openecomp.sdc.ci.tests.utilities.FileHandling; -import org.openecomp.sdc.ci.tests.utilities.OnboardingUtillViaApis; -import org.openecomp.sdc.ci.tests.utilities.OnboardingUtils; import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; -import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; +import org.openecomp.sdc.ci.tests.utils.general.OnboardingUtillViaApis; +import org.openecomp.sdc.ci.tests.utils.general.OnboardingUtils; import org.slf4j.LoggerFactory; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; @@ -58,6 +54,7 @@ import ch.qos.logback.classic.Level; import ch.qos.logback.classic.LoggerContext; import fj.data.Either; + public class OnboardViaApis{ @@ -79,23 +76,11 @@ public class OnboardViaApis{ // resourceDetails = ElementFactory.getDefaultResource(); } - @Test(dataProviderClass = OnbordingDataProviders.class, dataProvider = "VNF_List") + @Test(dataProviderClass = OnbordingDataProviders.class, dataProvider = "randomVNF_List") public void onboardVNFTestViaApis(String filepath, String vnfFile) throws Exception, Throwable { - Service service = null; - String fullFileName = FULL_PATH + vnfFile + ".csar"; - Timestamp timestamp = new Timestamp(System.currentTimeMillis()); - System.err.println(timestamp + " Starting test with VNF: " + vnfFile); - service = runOnboardViaApisOnly(filepath, vnfFile); - timestamp = new Timestamp(System.currentTimeMillis()); - System.err.println(timestamp + " Finished test with VNF: " + vnfFile); - timestamp = new Timestamp(System.currentTimeMillis()); - System.err.println(timestamp + " Starting download service csar file: " + vnfFile); - File file = new File(fullFileName); - OnboardingUtillViaApis.downloadToscaCsarToDirectory(service, file); - timestamp = new Timestamp(System.currentTimeMillis()); - System.err.println(timestamp + " Finished download service csar file: " + vnfFile); - System.out.println("end"); - + ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT); + ServiceReqDetails serviceReqDetails = ElementFactory.getDefaultService();//getServiceReqDetails(ComponentConfigurationTypeEnum.DEFAULT); + Service service = runOnboardViaApisOnly(serviceReqDetails, resourceReqDetails, filepath, vnfFile); } @@ -105,148 +90,83 @@ public class OnboardViaApis{ List<String> fileNamesFromFolder = FileHandling.getZipFileNamesFromFolder(filepath); String vnfFile = fileNamesFromFolder.get(7); System.err.println(timestamp + " Starting test with VNF: " + vnfFile); - service = runOnboardViaApisOnly(filepath, vnfFile); - -// AtomicOperationUtils.getServiceObjectByNameAndVersion(sdncModifierDetails, serviceName, serviceVersion); -// RestResponse distributeService = AtomicOperationUtils.distributeService(service, true); -// Map<Long, ServiceDistributionStatus> convertServiceDistributionStatusToObject = ResponseParser.convertServiceDistributionStatusToObject(distributeService.getResponse()); -// convertServiceDistributionStatusToObject. + ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT); + ServiceReqDetails serviceReqDetails = ElementFactory.getDefaultService();//getServiceReqDetails(ComponentConfigurationTypeEnum.DEFAULT); + service = runOnboardViaApisOnly(serviceReqDetails, resourceReqDetails, filepath, vnfFile); } - - - - public Service runOnboardViaApisOnly(String filepath, String vnfFile) throws Exception, AWTException { - Timestamp timestamp = new Timestamp(System.currentTimeMillis()); - System.err.println(timestamp + " Starting onboard VNF: " + vnfFile); - Pair<String, VendorSoftwareProductObject> createVendorSoftwareProduct = OnboardingUtillViaApis.createVspViaApis(filepath, vnfFile, sdncDesignerDetails1); - String vspName = createVendorSoftwareProduct.left; - VendorSoftwareProductObject vendorSoftwareProductObject = createVendorSoftwareProduct.right; - timestamp = new Timestamp(System.currentTimeMillis()); - System.err.println(timestamp + " Finished onboard VNF: " + vnfFile); - ResourceReqDetails resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(vendorSoftwareProductObject, vspName); - Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails, vspName); - - AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true); - resource = AtomicOperationUtils.getResourceObject(resource.getUniqueId()); - // create service - - Service service = AtomicOperationUtils.createDefaultService(UserRoleEnum.DESIGNER, true).left().value(); - Either<ComponentInstance,RestResponse> addComponentInstanceToComponentContainer = AtomicOperationUtils.addComponentInstanceToComponentContainer(resource, service, UserRoleEnum.DESIGNER, true); + @Test(dataProviderClass = OnbordingDataProviders.class, dataProvider = "randomVNF_List") + public void updateVSPFullScenario(String filepath, String vnfFile) throws Exception + { + //CREATE DATA REQUIRED FOR TEST + boolean skipReport = true; + AmdocsLicenseMembers amdocsLicenseMembers = OnboardingUtils.createVendorLicense(sdncDesignerDetails1); + ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT); + Pair<String, Map<String, String>> createVendorSoftwareProduct = OnboardingUtils.createVendorSoftwareProduct(resourceReqDetails, vnfFile, filepath, sdncDesignerDetails1, amdocsLicenseMembers); + VendorSoftwareProductObject vendorSoftwareProductObject = fillVendorSoftwareProductObjectWithMetaData(vnfFile, createVendorSoftwareProduct); + resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject); + Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails); + resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); + ServiceReqDetails serviceReqDetails = ElementFactory.getDefaultService();//getServiceReqDetails(ComponentConfigurationTypeEnum.DEFAULT); +// serviceReqDetails = OnboardingUtillViaApis.prepareServiceDetailsBeforeCreate(serviceReqDetails, sdncDesignerDetails1); + Service service = AtomicOperationUtils.createCustomService(serviceReqDetails, UserRoleEnum.DESIGNER, true).left().value(); + Either<ComponentInstance, RestResponse> addComponentInstanceToComponentContainer = AtomicOperationUtils.addComponentInstanceToComponentContainer(resource, service, UserRoleEnum.DESIGNER, true); + ComponentInstance componentInstanceDefinition = addComponentInstanceToComponentContainer.left().value(); service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); - return service; - } - - - - - - - - public static Pair<String, Map<String, String>> createVendorSoftwareProduct(String HeatFileName, String filepath, User user, AmdocsLicenseMembers amdocsLicenseMembers) - throws Exception { - Pair<String, Map<String, String>> pair = createVSP(HeatFileName, filepath, user, amdocsLicenseMembers); - - String vspid = pair.right.get("vspId"); - - prepareVspForUse(user, vspid); - - return pair; + // TEST START + + // Update exist VLM Version (From 1.0 to 2.0) + OnboardingUtils.updateVendorLicense(amdocsLicenseMembers, sdncDesignerDetails1, "1.0"); + // Set VLM version to 2.0 in VLM Meta data object + amdocsLicenseMembers.setLicenseVersionId("2.0"); + amdocsLicenseMembers.setLicenseVersionLabel("2.0"); + OnboardingUtils.validateVlmExist(amdocsLicenseMembers.getVendorId(), amdocsLicenseMembers.getLicenseVersionId(), sdncDesignerDetails1); + + // Update the VSP With the VLM new version and submit the VSP + vendorSoftwareProductObject = OnboardingUtils.updateVSPWithNewVLMParameters(vendorSoftwareProductObject, amdocsLicenseMembers, sdncDesignerDetails1, "1.1", "2.0"); + OnboardingUtils.validateVspExist(vendorSoftwareProductObject.getVspId(),vendorSoftwareProductObject.getVersion(), sdncDesignerDetails1); + Boolean distributeAndValidateService = AtomicOperationUtils.distributeAndValidateService(service); + assertTrue("Distribution status is " + distributeAndValidateService, distributeAndValidateService); + System.out.println(distributeAndValidateService); } - - public static void prepareVspForUse(User user, String vspid) throws Exception { - RestResponse checkin = OnboardingUtils.checkinVendorSoftwareProduct(vspid, user); - assertEquals("did not succeed to checking new VSP", 200, checkin.getErrorCode().intValue()); - - RestResponse submit = OnboardingUtils.submitVendorSoftwareProduct(vspid, user); - assertEquals("did not succeed to submit new VSP", 200, submit.getErrorCode().intValue()); - - RestResponse createPackage = OnboardingUtils.createPackageOfVendorSoftwareProduct(vspid, user); - assertEquals("did not succeed to create package of new VSP ", 200, createPackage.getErrorCode().intValue()); + public static VendorSoftwareProductObject fillVendorSoftwareProductObjectWithMetaData(String vnfFile, Pair<String, Map<String, String>> createVendorSoftwareProduct) { + VendorSoftwareProductObject vendorSoftwareProductObject = new VendorSoftwareProductObject(); + Map<String, String> map = createVendorSoftwareProduct.right; + vendorSoftwareProductObject.setAttContact(map.get("attContact")); + vendorSoftwareProductObject.setCategory(map.get("category")); + vendorSoftwareProductObject.setComponentId(map.get("componentId")); + vendorSoftwareProductObject.setDescription(map.get("description")); + vendorSoftwareProductObject.setSubCategory(map.get("subCategory")); + vendorSoftwareProductObject.setVendorName(map.get("vendorName")); + vendorSoftwareProductObject.setVspId(map.get("vspId")); + vendorSoftwareProductObject.setName(createVendorSoftwareProduct.left); + String[] arrFileNameAndExtension = vnfFile.split("\\."); + vendorSoftwareProductObject.setOnboardingMethod("NetworkPackage"); + vendorSoftwareProductObject.setNetworkPackageName(arrFileNameAndExtension[0]); + vendorSoftwareProductObject.setOnboardingOrigin(arrFileNameAndExtension[1]); + + return vendorSoftwareProductObject; } - public static AmdocsLicenseMembers createVendorLicense(User user) throws Exception { - - AmdocsLicenseMembers amdocsLicenseMembers; - String vendorLicenseName = "ciLicense" + UUID.randomUUID().toString().split("-")[0]; - RestResponse vendorLicenseResponse = OnboardingUtils.createVendorLicenseModels_1(vendorLicenseName, user); - assertEquals("did not succeed to create vendor license model", 200, vendorLicenseResponse.getErrorCode().intValue()); - String vendorId = ResponseParser.getValueFromJsonResponse(vendorLicenseResponse.getResponse(), "value"); - - RestResponse vendorKeyGroupsResponse = OnboardingUtils.createVendorKeyGroups_2(vendorId, user); - assertEquals("did not succeed to create vendor key groups", 200, vendorKeyGroupsResponse.getErrorCode().intValue()); - String keyGroupId = ResponseParser.getValueFromJsonResponse(vendorKeyGroupsResponse.getResponse(), "value"); - - RestResponse vendorEntitlementPool = OnboardingUtils.createVendorEntitlementPool_3(vendorId, user); - assertEquals("did not succeed to create vendor entitlement pool", 200, vendorEntitlementPool.getErrorCode().intValue()); - String entitlementPoolId = ResponseParser.getValueFromJsonResponse(vendorEntitlementPool.getResponse(), "value"); - - RestResponse vendorLicenseFeatureGroups = OnboardingUtils.createVendorLicenseFeatureGroups_4(vendorId, keyGroupId, entitlementPoolId, user); - assertEquals("did not succeed to create vendor license feature groups", 200, vendorLicenseFeatureGroups.getErrorCode().intValue()); - String featureGroupId = ResponseParser.getValueFromJsonResponse(vendorLicenseFeatureGroups.getResponse(), "value"); - RestResponse vendorLicenseAgreement = OnboardingUtils.createVendorLicenseAgreement_5(vendorId, featureGroupId, user); - assertEquals("did not succeed to create vendor license agreement", 200, vendorLicenseAgreement.getErrorCode().intValue()); - String vendorLicenseAgreementId = ResponseParser.getValueFromJsonResponse(vendorLicenseAgreement.getResponse(), "value"); + public Service runOnboardViaApisOnly(ServiceReqDetails serviceReqDetails, ResourceReqDetails resourceReqDetails, String filepath, String vnfFile) throws Exception, AWTException { - RestResponse checkinVendorLicense = OnboardingUtils.checkinVendorLicense(vendorId, user); - assertEquals("did not succeed to checkin vendor license", 200, checkinVendorLicense.getErrorCode().intValue()); - - RestResponse submitVendorLicense = OnboardingUtils.submitVendorLicense(vendorId, user); - assertEquals("did not succeed to submit vendor license", 200, submitVendorLicense.getErrorCode().intValue()); - - amdocsLicenseMembers = new AmdocsLicenseMembers(vendorId, vendorLicenseName, vendorLicenseAgreementId, featureGroupId); - - return amdocsLicenseMembers; - } - - - public static Pair<String, Map<String, String>> createVSP(String HeatFileName, String filepath, User user, AmdocsLicenseMembers amdocsLicenseMembers) throws Exception { - String vspName = OnboardingUtils.handleFilename(HeatFileName); - - Pair<RestResponse, Map<String, String>> createNewVspPair = OnboardingUtils.createNewVendorSoftwareProduct(vspName, amdocsLicenseMembers, user); - RestResponse createNewVendorSoftwareProduct = createNewVspPair.left; - assertEquals("did not succeed to create new VSP", 200,createNewVendorSoftwareProduct.getErrorCode().intValue()); - String vspid = ResponseParser.getValueFromJsonResponse(createNewVendorSoftwareProduct.getResponse(), "vspId"); - String componentId = ResponseParser.getValueFromJsonResponse(createNewVendorSoftwareProduct.getResponse(), "componentId"); - - Map<String, String> vspMeta = createNewVspPair.right; - Map<String, String> vspObject = new HashMap<String, String>(); - Iterator<String> iterator = vspMeta.keySet().iterator(); - while(iterator.hasNext()){ - Object key = iterator.next(); - Object value = vspMeta.get(key); - vspObject.put(key.toString(), value.toString()); - } - vspObject.put("vspId", vspid); - vspObject.put("componentId", componentId); - vspObject.put("vendorName", amdocsLicenseMembers.getVendorLicenseName()); - vspObject.put("attContact", user.getUserId()); - - RestResponse uploadHeatPackage = OnboardingUtils.uploadHeatPackage(filepath, HeatFileName, vspid, user); - assertEquals("did not succeed to upload HEAT package", 200, uploadHeatPackage.getErrorCode().intValue()); + Pair<String, VendorSoftwareProductObject> createVendorSoftwareProduct = OnboardingUtillViaApis.createVspViaApis(resourceReqDetails, filepath, vnfFile, sdncDesignerDetails1); + VendorSoftwareProductObject vendorSoftwareProductObject = createVendorSoftwareProduct.right; + vendorSoftwareProductObject.setName(createVendorSoftwareProduct.left); - RestResponse validateUpload = OnboardingUtils.validateUpload(vspid, user); - assertEquals("did not succeed to validate upload process", 200, validateUpload.getErrorCode().intValue()); + resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject); + Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails); + resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); - Pair<String, Map<String, String>> pair = new Pair<String, Map<String, String>>(vspName, vspObject); +// serviceReqDetails = OnboardingUtillViaApis.prepareServiceDetailsBeforeCreate(serviceReqDetails, sdncDesignerDetails1); + Service service = AtomicOperationUtils.createCustomService(serviceReqDetails, UserRoleEnum.DESIGNER, true).left().value(); - return pair; - } - - - - - - - - - -// ---------------------------------------------------------------------------------------------------------------------------------------- - - - - + Either<ComponentInstance, RestResponse> addComponentInstanceToComponentContainer = AtomicOperationUtils.addComponentInstanceToComponentContainer(resource, service, UserRoleEnum.DESIGNER, true); + ComponentInstance componentInstanceDefinition = addComponentInstanceToComponentContainer.left().value(); + service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); + return service; + } } @@ -0,0 +1,400 @@ +package org.openecomp.sdc.ci.tests.execute.sanity; + +import static org.testng.AssertJUnit.assertTrue; + +import java.io.File; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import org.openecomp.sdc.be.model.ArtifactDefinition; +import org.openecomp.sdc.be.model.ComponentInstance; +import org.openecomp.sdc.be.model.Resource; +import org.openecomp.sdc.be.model.Service; +import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.ci.tests.dataProviders.OnbordingDataProviders; +import org.openecomp.sdc.ci.tests.datatypes.AmdocsLicenseMembers; +import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; +import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; +import org.openecomp.sdc.ci.tests.datatypes.VendorSoftwareProductObject; +import org.openecomp.sdc.ci.tests.datatypes.enums.CvfcTypeEnum; +import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum; +import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; +import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; +import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; +import org.openecomp.sdc.ci.tests.utilities.OnboardingUiUtils; +import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils; +import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; +import org.openecomp.sdc.ci.tests.utils.general.FileHandling; +import org.openecomp.sdc.ci.tests.utils.general.OnboardingUtillViaApis; +import org.openecomp.sdc.ci.tests.utils.general.OnboardingUtils; +import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils; +import org.testng.annotations.Test; + +import com.aventstack.extentreports.Status; +import com.clearspring.analytics.util.Pair; + +import fj.data.Either; + +public class OnboardingFlows extends SetupCDTest{ + + protected boolean skipReport = false; + protected User sdncDesignerDetails = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER); + + +// https://sdp.web.att.com/fa3qm1/web/console/Application_Development_Tools_QM_20.20.01#action=com.ibm.rqm.planning.home.actionDispatcher&subAction=viewTestPlan&id=6184 + + @Test + public void addVesFileToVsp() throws Exception{ + String vnfFile = "vMME_Ericsson_small_v2.zip"; + String vesArtifactFile = "VES.zip"; + String filePath = FileHandling.getFilePath("VFCArtifacts"); + String vesArtifactFileLocation = filePath + File.separator + vesArtifactFile; + List<String> vesArtifacts = FileHandling.getFileNamesFromZip(vesArtifactFileLocation); + List<String> tempVesArtifacts = FileHandling.getFileNamesFromZip(vesArtifactFileLocation); + Map<CvfcTypeEnum, String> cvfcArtifacts = new HashMap<>(); + cvfcArtifacts.put(CvfcTypeEnum.VES_EVENTS, vesArtifactFileLocation); + getExtendTest().log(Status.INFO, "Going to upload VNF " + vnfFile); + + AmdocsLicenseMembers amdocsLicenseMembers = OnboardingUiUtils.createVendorLicense(getUser()); + ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT); + VendorSoftwareProductObject vendorSoftwareProductObject = OnboardingUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails, amdocsLicenseMembers, cvfcArtifacts); + resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject); + Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails); + List<ComponentInstance> componentInstances = resource.getComponentInstances(); + for(ComponentInstance componentInstance : componentInstances){ + if(componentInstance.getDeploymentArtifacts() !=null && !componentInstance.getDeploymentArtifacts().isEmpty()){ + Map<String, ArtifactDefinition> deploymentArtifacts = componentInstance.getDeploymentArtifacts(); + for(Entry<String, ArtifactDefinition> entry : deploymentArtifacts.entrySet()){ + if(entry.getValue().getArtifactType().equals(CvfcTypeEnum.VES_EVENTS.getValue())){ + for(String vesArtifact : vesArtifacts){ + if(entry.getValue().getArtifactName().equals(vesArtifact)){ + tempVesArtifacts.remove(vesArtifact); + } + } + } + } + } + } + assertTrue("Not all VES_EVENTS artifact files are on the resource instance", tempVesArtifacts.isEmpty()); + } + +// 741433: Update Old VSP +// 2. Updated VSP "JSA AUG 2017" with the attached zip from v3 to v4. Follow normal steps to update the VF +// 3. Update the VSP "vHSS-EPC-RDM3-Lab-0830" using the attached zip. Follow the normal steps to update the VF +// @Test(dataProviderClass = OnbordingDataProviders.class, dataProvider = "randomVNF_List") +// public void create2(String filePath, String vnfFile) throws Exception{ +// setLog(vnfFile); +// } + + +// 741509: E2E flow using old VLM + @Test + public void VlmReuse() throws Exception{ + List<String> fileNamesFromFolder = OnboardingUtils.getVnfNamesFileListExcludeToscaParserFailure(); + List<String> newRandomFileNamesFromFolder = OnbordingDataProviders.getRandomElements(2, fileNamesFromFolder); + String filePath = FileHandling.getVnfRepositoryPath(); + String vnfFile = newRandomFileNamesFromFolder.get(0); + getExtendTest().log(Status.INFO, "Going to upload VNF " + vnfFile); +// setLog(vnfFile); + AmdocsLicenseMembers amdocsLicenseMembers = OnboardingUiUtils.createVendorLicense(getUser()); + ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT); + VendorSoftwareProductObject vendorSoftwareProductObject = OnboardingUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails, amdocsLicenseMembers, null); + resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject); + Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails); + resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); + + ServiceReqDetails serviceReqDetails = OnboardingUtillViaApis.prepareServiceDetailsBeforeCreate(sdncDesignerDetails); + org.openecomp.sdc.be.model.Service service = AtomicOperationUtils.createCustomService(serviceReqDetails, UserRoleEnum.DESIGNER, true).left().value(); + + Either<ComponentInstance, RestResponse> addComponentInstanceToComponentContainer = AtomicOperationUtils.addComponentInstanceToComponentContainer(resource, service, UserRoleEnum.DESIGNER, true); + addComponentInstanceToComponentContainer.left().value(); + service = (org.openecomp.sdc.be.model.Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); + Boolean distributeAndValidateService = AtomicOperationUtils.distributeAndValidateService(service); + assertTrue("Distribution of service " + service.getName() + " failed", distributeAndValidateService); + +// update + vnfFile = newRandomFileNamesFromFolder.get(1); + getExtendTest().log(Status.INFO, "Going to update VNF with file " + vnfFile); + OnboardingUtils.updateVendorLicense(amdocsLicenseMembers, sdncDesignerDetails, "1.0"); + vendorSoftwareProductObject = OnboardingUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails, amdocsLicenseMembers, null); + resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject); + resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails); + resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); + + serviceReqDetails = OnboardingUtillViaApis.prepareServiceDetailsBeforeCreate(sdncDesignerDetails); + service = AtomicOperationUtils.createCustomService(serviceReqDetails, UserRoleEnum.DESIGNER, true).left().value(); + + addComponentInstanceToComponentContainer = AtomicOperationUtils.addComponentInstanceToComponentContainer(resource, service, UserRoleEnum.DESIGNER, true); + addComponentInstanceToComponentContainer.left().value(); + service = (org.openecomp.sdc.be.model.Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); + distributeAndValidateService = AtomicOperationUtils.distributeAndValidateService(service); + assertTrue("Distribution of service " + service.getName() + " failed", distributeAndValidateService); + + + } + + +// 741607: E2E flow using old VSP + @Test + public void updateVfiVersionOnServiceLevel() throws Throwable{ + List<String> fileNamesFromFolder = OnboardingUtils.getVnfNamesFileListExcludeToscaParserFailure(); + List<String> newRandomFileNamesFromFolder = OnbordingDataProviders.getRandomElements(2, fileNamesFromFolder); + String filePath = FileHandling.getVnfRepositoryPath(); + String vnfFile = newRandomFileNamesFromFolder.get(0); + getExtendTest().log(Status.INFO, "Going to upload VNF " + vnfFile); + AmdocsLicenseMembers amdocsLicenseMembers = OnboardingUiUtils.createVendorLicense(getUser()); + ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT); + VendorSoftwareProductObject vendorSoftwareProductObject = OnboardingUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails, amdocsLicenseMembers, null); + resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject); + Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails); + resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); + + ServiceReqDetails serviceReqDetails = OnboardingUtillViaApis.prepareServiceDetailsBeforeCreate(sdncDesignerDetails); + org.openecomp.sdc.be.model.Service service = AtomicOperationUtils.createCustomService(serviceReqDetails, UserRoleEnum.DESIGNER, true).left().value(); + + Either<ComponentInstance, RestResponse> addComponentInstanceToComponentContainer = AtomicOperationUtils.addComponentInstanceToComponentContainer(resource, service, UserRoleEnum.DESIGNER, true); + ComponentInstance componentInstance = addComponentInstanceToComponentContainer.left().value(); + service = (org.openecomp.sdc.be.model.Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); + Boolean distributeAndValidateService = AtomicOperationUtils.distributeAndValidateService(service); + assertTrue("Distribution of service " + service.getName() + " failed", distributeAndValidateService); + +// update resource to v2.0 + String updateVnfFile = newRandomFileNamesFromFolder.get(1); + getExtendTest().log(Status.INFO, "Going to update VNF with file " + vnfFile); + OnboardingUiUtils.updateVendorSoftwareProduct(vendorSoftwareProductObject.getVspId(), updateVnfFile, filePath, sdncDesignerDetails, "2.0"); + resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, true).getLeft(); + resourceReqDetails.setUniqueId(resource.getUniqueId()); + resourceReqDetails.setVersion(resource.getVersion()); + resource = AtomicOperationUtils.updateResource(resourceReqDetails, sdncDesignerDetails, true).left().value(); + resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); + + service = (org.openecomp.sdc.be.model.Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, true).getLeft(); + AtomicOperationUtils.changeComponentInstanceVersion(service, componentInstance, resource, UserRoleEnum.DESIGNER, true); + + service = (org.openecomp.sdc.be.model.Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); + distributeAndValidateService = AtomicOperationUtils.distributeAndValidateService(service); + assertTrue("Distribution of service " + service.getName() + " failed", distributeAndValidateService); + } + + +// 741608: E2E flow using old Service +// @Test(dataProviderClass = OnbordingDataProviders.class, dataProvider = "randomVNF_List") +// public void create5(String filePath, String vnfFile) throws Exception{ +// setLog(vnfFile); +// // 1. Create Service with old resource -> Certify this Service - > Distribute +// // 2. Service is distributed +// // 3. Update old Service: fetch few new resources and few old resources -> Certify this Service - > Distribute +// // 4. Service is distributed +// } + +// 741633: Update HEAT parameter value + @Test() + public void updateHeatParametersValue() throws Throwable{ + String msg = "VfArtifacts-->checkDefaultCreatedEnvArtifactsAfterVspUpdate tests with data provider index 4(last one) check it fully"; + getExtendTest().log(Status.INFO, msg); + } + + @Test() + public void UpdateVSPRevertToEarlierVersion() throws Throwable + { + // Test Case: 745821 +// 1. Import VSP v1.0 + List<String> fileNamesFromFolder = OnboardingUtils.getVnfNamesFileListExcludeToscaParserFailure(); + List<String> newRandomFileNamesFromFolder = OnbordingDataProviders.getRandomElements(1, fileNamesFromFolder); + String filePath = FileHandling.getVnfRepositoryPath(); + String vnfFile = newRandomFileNamesFromFolder.get(0); + getExtendTest().log(Status.INFO, "Going to upload VNF " + vnfFile); + User sdncDesignerDetails1 = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER); + AmdocsLicenseMembers amdocsLicenseMembers = OnboardingUiUtils.createVendorLicense(sdncDesignerDetails1); + getExtendTest().log(Status.INFO, "Create Vendor License Model " + amdocsLicenseMembers.getVendorLicenseName()); + ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT); + getExtendTest().log(Status.INFO, "Create Vendor Software Product " + resourceReqDetails.getName()); + Pair<String, Map<String, String>> createVendorSoftwareProduct = OnboardingUtils.createVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails1, amdocsLicenseMembers); + VendorSoftwareProductObject vendorSoftwareProductObject = OnboardViaApis.fillVendorSoftwareProductObjectWithMetaData(vnfFile, createVendorSoftwareProduct); +// 2. Create VF, certify - v1.0 is created + resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject); + getExtendTest().log(Status.INFO, "Create VF " + resourceReqDetails.getName()); + Resource resource_v1 = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails); + getExtendTest().log(Status.INFO, "Certify VF " + resourceReqDetails.getName()); + resource_v1 = (Resource) AtomicOperationUtils.changeComponentState(resource_v1, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); +// 3. Update VSP to v2.0 + getExtendTest().log(Status.INFO, "Update VSP to version 2.0"); + OnboardingUtils.updateVendorSoftwareProductToNextVersion(vendorSoftwareProductObject, "2.0", sdncDesignerDetails1, filePath, vnfFile); + OnboardingUtils.validateVspExist(vendorSoftwareProductObject.getVspId(),vendorSoftwareProductObject.getVersion(),sdncDesignerDetails1); +// 4. Update the VF with v2.0 of the VSP + getExtendTest().log(Status.INFO, "Checkout VF v1.1"); + resource_v1 = (Resource) AtomicOperationUtils.changeComponentState(resource_v1, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, true).getLeft(); + resourceReqDetails.setUniqueId(resource_v1.getUniqueId()); + resourceReqDetails.setVersion("1.1"); + resourceReqDetails.setCsarVersion("2.0"); + getExtendTest().log(Status.INFO, "Update VF to v2.0"); + resource_v1 = AtomicOperationUtils.updateResource(resourceReqDetails, sdncDesignerDetails, true).left().value(); + getExtendTest().log(Status.INFO, "Certify VF"); + Resource resource_v2 = (Resource) AtomicOperationUtils.changeComponentState(resource_v1, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); +// 5. Update VSP to v3.0 wih the zip from v1.0 + getExtendTest().log(Status.INFO, "Update VSP to version 3.0"); + OnboardingUtils.updateVendorSoftwareProductToNextVersion(vendorSoftwareProductObject, "3.0", sdncDesignerDetails1); + OnboardingUtils.validateVspExist(vendorSoftwareProductObject.getVspId(),vendorSoftwareProductObject.getVersion(),sdncDesignerDetails1); + getExtendTest().log(Status.INFO, "Checkout VF v2.1"); + resource_v1 = (Resource) AtomicOperationUtils.changeComponentState(resource_v1, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, true).getLeft(); + resourceReqDetails.setUniqueId(resource_v1.getUniqueId()); + resourceReqDetails.setVersion("2.1"); + resourceReqDetails.setCsarVersion("3.0"); + getExtendTest().log(Status.INFO, "Update VF to v3.0"); + ResourceRestUtils.updateResource(resourceReqDetails,sdncDesignerDetails1,resource_v1.getUniqueId()); +// 6. Update VF to v3.0 + getExtendTest().log(Status.INFO, "Certify VF"); + Resource resource_v3 = (Resource) AtomicOperationUtils.changeComponentState(resource_v1, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); +// 7. Compare versions v1.0 and v3.0 - should be the same +// TODO: Shay add resource comparison. +// 8. Add each of the versions to service, certify - OK + ServiceReqDetails serviceReqDetails = OnboardingUtillViaApis.prepareServiceDetailsBeforeCreate(sdncDesignerDetails1); + getExtendTest().log(Status.INFO, "Create Service " + serviceReqDetails.getName() ); + org.openecomp.sdc.be.model.Service service = AtomicOperationUtils.createCustomService(serviceReqDetails, UserRoleEnum.DESIGNER, true).left().value(); + getExtendTest().log(Status.INFO, "Add vf's v1 & v2 to service"); + Either<ComponentInstance, RestResponse> addComponentInstanceToComponentContainer = AtomicOperationUtils.addComponentInstanceToComponentContainer(resource_v1, service, UserRoleEnum.DESIGNER, true); + Either<ComponentInstance, RestResponse> addComponentInstanceToComponentContainer1 = AtomicOperationUtils.addComponentInstanceToComponentContainer(resource_v3, service, UserRoleEnum.DESIGNER, true); + getExtendTest().log(Status.INFO, "Certify Service"); + service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); + System.out.println(""); + } + + @Test(dataProviderClass = org.openecomp.sdc.ci.tests.dataProvider.OnbordingDataProviders.class, dataProvider = "updateList") + public void distributeServiceAndUpgradeWithNewHeatFile(String vnfFile1, String vnfFile2) throws Throwable + { + setLog(String.format("Update VSP Test: Create VF from %s add it to service, distribute than upgrade the VF with file %s and update the service and distribute", vnfFile1, vnfFile2)); +// 1. Import VSP v1.0 + String filePath = org.openecomp.sdc.ci.tests.utilities.FileHandling.getUpdateVSPVnfRepositoryPath(); + User sdncDesignerDetails1 = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER); + AmdocsLicenseMembers amdocsLicenseMembers = OnboardingUtils.createVendorLicense(sdncDesignerDetails1); + getExtendTest().log(Status.INFO, String.format("Creating Vendor Software License (VLM): %s v1.0", amdocsLicenseMembers.getVendorLicenseName())); + ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); + getExtendTest().log(Status.INFO, String.format("Creating Vendor Software Product (VSP): %s v1.0 from heat file: %s ", resourceReqDetails.getName(), vnfFile1)); + Pair<String, Map<String, String>> createVendorSoftwareProduct = OnboardingUtils.createVendorSoftwareProduct(resourceReqDetails, vnfFile1, filePath, sdncDesignerDetails1, amdocsLicenseMembers); + VendorSoftwareProductObject vendorSoftwareProductObject = OnboardViaApis.fillVendorSoftwareProductObjectWithMetaData(vnfFile1, createVendorSoftwareProduct); +// 2. Create VF, certify - v1.0 is created + resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject); + Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails); + resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); + getExtendTest().log(Status.INFO, String.format("Creating Virtual Function (VF): %s v1.0", resourceReqDetails.getName())); + getExtendTest().log(Status.INFO, String.format("Certify the VF")); +// 3. Create Service add to it the certified VF and certify the Service v1.0 + ServiceReqDetails serviceReqDetails = ElementFactory.getDefaultService(); + Service service = AtomicOperationUtils.createCustomService(serviceReqDetails, UserRoleEnum.DESIGNER, true).left().value(); + getExtendTest().log(Status.INFO, String.format("Creating Service: %s v1.0", serviceReqDetails.getName())); + Either<ComponentInstance, RestResponse> addComponentInstanceToComponentContainer = AtomicOperationUtils.addComponentInstanceToComponentContainer(resource, service, UserRoleEnum.DESIGNER, true); + ComponentInstance componentInstance = addComponentInstanceToComponentContainer.left().value(); + getExtendTest().log(Status.INFO, String.format("Adding VF instance to Service")); + service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); + getExtendTest().log(Status.INFO, String.format("Certify the Service")); +// 5. Distribute the Service v1.0 + Boolean distributeAndValidateService = AtomicOperationUtils.distributeAndValidateService(service); + getExtendTest().log(Status.INFO, String.format("Distribute and validate the Service")); + assertTrue("Distribution status is " + distributeAndValidateService, distributeAndValidateService); +// 6. Update VSP to v2.0 + getExtendTest().log(Status.INFO, "Upgrading the VSP with new file: " + vnfFile2); + OnboardingUtils.updateVendorSoftwareProductToNextVersion(vendorSoftwareProductObject, "2.0", sdncDesignerDetails1, filePath, vnfFile2); + getExtendTest().log(Status.INFO, String.format("Validating VSP %s upgrade to version 2.0: " ,vnfFile2)); + OnboardingUtils.validateVspExist(vendorSoftwareProductObject.getVspId(),vendorSoftwareProductObject.getVersion(),sdncDesignerDetails1); +// 7. Update the VF with v2.0 of the VSP and certify the VF + getExtendTest().log(Status.INFO, String.format("Checkout the VF %s v1.1 " ,resourceReqDetails.getName())); + resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, true).getLeft(); + resourceReqDetails.setUniqueId(resource.getUniqueId()); + resourceReqDetails.setVersion("1.1"); + resourceReqDetails.setCsarVersion("2.0"); + getExtendTest().log(Status.INFO, String.format("Upgrade the VF %s v1.1 with the new VSP %s v2.0 " ,resourceReqDetails.getName(),vendorSoftwareProductObject.getName())); + resource = AtomicOperationUtils.updateResource(resourceReqDetails, sdncDesignerDetails, true).left().value(); + getExtendTest().log(Status.INFO, String.format("Certify the VF to v2.0")); + Resource resource_v2 = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); +// 8. Update the Service with the VFi version 2.0 + getExtendTest().log(Status.INFO, String.format("Checkout the Service v1.1")); + service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, true).getLeft(); + getExtendTest().log(Status.INFO, String.format("Change the instance of the VF in the service to VFi v2.0")); + AtomicOperationUtils.changeComponentInstanceVersion(service, componentInstance, resource, UserRoleEnum.DESIGNER, true); + getExtendTest().log(Status.INFO, String.format("Certify the Service to v2.0")); + service = (org.openecomp.sdc.be.model.Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); +// 9. Distribute the service v2.0 + distributeAndValidateService = AtomicOperationUtils.distributeAndValidateService(service); + getExtendTest().log(Status.INFO, String.format("Distribute and validate the Service")); + assertTrue("Distribution status is " + distributeAndValidateService, distributeAndValidateService); + } + + @Test(dataProviderClass = org.openecomp.sdc.ci.tests.dataProvider.OnbordingDataProviders.class, dataProvider = "VNF_List") + public void distributeServiceFromHeatFile(String filePath, String vnfFile) throws Throwable + { +// String vnfFile1 = "1-2016-20-visbc3vf-(VOIP)_v2.1.zip"; +// String vnfFile2 = "2-2016-20-visbc3vf-(VOIP)_v2.0.zip"; + setLog(String.format("Distribute Service Test: Create VF from %s add it to service than distribute", vnfFile)); +// 1. Import VSP v1.0 + //String filePath = FileHandling.getVnfRepositoryPath(); + User sdncDesignerDetails1 = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER); + AmdocsLicenseMembers amdocsLicenseMembers = OnboardingUtils.createVendorLicense(sdncDesignerDetails1); + getExtendTest().log(Status.INFO, String.format("Creating Vendor Software License (VLM): %s v1.0", amdocsLicenseMembers.getVendorLicenseName())); + ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); + getExtendTest().log(Status.INFO, String.format("Creating Vendor Software Product (VSP): %s v1.0 from heat file: %s ", resourceReqDetails.getName(), vnfFile)); + Pair<String, Map<String, String>> createVendorSoftwareProduct = OnboardingUtils.createVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails1, amdocsLicenseMembers); + VendorSoftwareProductObject vendorSoftwareProductObject = OnboardViaApis.fillVendorSoftwareProductObjectWithMetaData(vnfFile, createVendorSoftwareProduct); +// 2. Create VF, certify - v1.0 is created + resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject); + Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails); + resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); + getExtendTest().log(Status.INFO, String.format("Creating Virtual Function (VF): %s v1.0", resourceReqDetails.getName())); + getExtendTest().log(Status.INFO, String.format("Certify the VF")); +// 3. Create Service add to it the certified VF and certify the Service v1.0 + ServiceReqDetails serviceReqDetails = ElementFactory.getDefaultService(); + Service service = AtomicOperationUtils.createCustomService(serviceReqDetails, UserRoleEnum.DESIGNER, true).left().value(); + getExtendTest().log(Status.INFO, String.format("Creating Service: %s v1.0", serviceReqDetails.getName())); + Either<ComponentInstance, RestResponse> addComponentInstanceToComponentContainer = AtomicOperationUtils.addComponentInstanceToComponentContainer(resource, service, UserRoleEnum.DESIGNER, true); + ComponentInstance componentInstance = addComponentInstanceToComponentContainer.left().value(); + getExtendTest().log(Status.INFO, String.format("Adding VF instance to Service")); + service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); + getExtendTest().log(Status.INFO, String.format("Certify the Service")); +// 5. Distribute the Service v1.0 + Boolean distributeAndValidateService = AtomicOperationUtils.distributeAndValidateService(service); + getExtendTest().log(Status.INFO, String.format("Distribute and validate the Service")); + assertTrue("Distribution status is " + distributeAndValidateService, distributeAndValidateService); + } + + @Test() + public void onboardE2EviaAPI() throws Throwable + { +// 1. Import VSP v1.0 + String filePath = FileHandling.getVnfRepositoryPath(); + String vnfFile1 = "HeatCandidate_2017-09-20_13-37_70Name_2017-491-4vshaken-HTTP-CM-vf-v1.0-(VOIP)_10202017.zip"; + User sdncDesignerDetails1 = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER); + AmdocsLicenseMembers amdocsLicenseMembers = OnboardingUtils.createVendorLicense(sdncDesignerDetails1); + getExtendTest().log(Status.INFO, String.format("Creating Vendor Software License (VLM): %s v1.0", amdocsLicenseMembers.getVendorLicenseName())); + ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); + getExtendTest().log(Status.INFO, String.format("Creating Vendor Software Product (VSP): %s v1.0 from heat file: %s ", resourceReqDetails.getName(), vnfFile1)); + Pair<String, Map<String, String>> createVendorSoftwareProduct = OnboardingUtils.createVendorSoftwareProduct(resourceReqDetails, vnfFile1, filePath, sdncDesignerDetails1, amdocsLicenseMembers); + VendorSoftwareProductObject vendorSoftwareProductObject = OnboardViaApis.fillVendorSoftwareProductObjectWithMetaData(vnfFile1, createVendorSoftwareProduct); +// 2. Create VF, certify - v1.0 is created + resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject); + Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails); + resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); + getExtendTest().log(Status.INFO, String.format("Creating Virtual Function (VF): %s v1.0", resourceReqDetails.getName())); + getExtendTest().log(Status.INFO, String.format("Certify the VF")); +// 3. Create Service add to it the certified VF and certify the Service v1.0 + ServiceReqDetails serviceReqDetails = ElementFactory.getDefaultService(); + Service service = AtomicOperationUtils.createCustomService(serviceReqDetails, UserRoleEnum.DESIGNER, true).left().value(); + getExtendTest().log(Status.INFO, String.format("Creating Service: %s v1.0", serviceReqDetails.getName())); + Either<ComponentInstance, RestResponse> addComponentInstanceToComponentContainer = AtomicOperationUtils.addComponentInstanceToComponentContainer(resource, service, UserRoleEnum.DESIGNER, true); + ComponentInstance componentInstance = addComponentInstanceToComponentContainer.left().value(); + getExtendTest().log(Status.INFO, String.format("Adding VF instance to Service")); + service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); + getExtendTest().log(Status.INFO, String.format("Certify the Service")); +// 5. Distribute the Service v1.0 + Boolean distributeAndValidateService = AtomicOperationUtils.distributeAndValidateService(service); + getExtendTest().log(Status.INFO, String.format("Distribute and validate the Service")); + assertTrue("Distribution status is " + distributeAndValidateService, distributeAndValidateService); + } + + @Override + protected UserRoleEnum getRole() { + return UserRoleEnum.DESIGNER; + } + + +} @@ -1,5 +1,7 @@ package org.openecomp.sdc.ci.tests.execute.sanity; +import static org.testng.Assert.assertTrue; + import java.util.List; import org.openecomp.sdc.be.dao.api.ActionStatus; @@ -10,22 +12,32 @@ import org.openecomp.sdc.ci.tests.datatypes.CanvasElement; import org.openecomp.sdc.ci.tests.datatypes.CanvasManager; import org.openecomp.sdc.ci.tests.datatypes.LifeCycleStateEnum; import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; +import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; +import org.openecomp.sdc.ci.tests.datatypes.TopMenuButtonsEnum; +import org.openecomp.sdc.ci.tests.datatypes.TypesEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum; +import org.openecomp.sdc.ci.tests.datatypes.enums.CircleSize; import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; import org.openecomp.sdc.ci.tests.pages.CompositionPage; +import org.openecomp.sdc.ci.tests.pages.DeploymentArtifactPage; import org.openecomp.sdc.ci.tests.pages.GeneralPageElements; +import org.openecomp.sdc.ci.tests.pages.GovernorOperationPage; import org.openecomp.sdc.ci.tests.pages.InformationalArtifactPage; +import org.openecomp.sdc.ci.tests.pages.OpsOperationPage; import org.openecomp.sdc.ci.tests.pages.PropertiesPage; import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage; +import org.openecomp.sdc.ci.tests.pages.ServiceGeneralPage; import org.openecomp.sdc.ci.tests.pages.TesterOperationPage; import org.openecomp.sdc.ci.tests.pages.ToscaArtifactsPage; import org.openecomp.sdc.ci.tests.utilities.ArtifactUIUtils; +import org.openecomp.sdc.ci.tests.utilities.CatalogUIUtilitis; import org.openecomp.sdc.ci.tests.utilities.FileHandling; import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils; +import org.openecomp.sdc.ci.tests.utilities.ServiceUIUtils; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils; import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils; @@ -60,7 +72,7 @@ public class PNF extends SetupCDTest { // update Resource ResourceReqDetails updatedResource = new ResourceReqDetails(); - updatedResource.setName("ciUpdatedName"); + updatedResource.setName(ElementFactory.getResourcePrefix() + "UpdatedName" + pnfMetaData.getName()); updatedResource.setDescription("kuku"); updatedResource.setVendorName("updatedVendor"); updatedResource.setVendorRelease("updatedRelease"); @@ -68,7 +80,7 @@ public class PNF extends SetupCDTest { updatedResource.setCategories(pnfMetaData.getCategories()); updatedResource.setVersion("0.1"); updatedResource.setResourceType(ResourceTypeEnum.VF.getValue()); - List<String> newTags = pnfMetaData.getTags(); + List<String> newTags = pnfMetaData.getTags(); newTags.remove(pnfMetaData.getName()); newTags.add(updatedResource.getName()); updatedResource.setTags(newTags); @@ -105,7 +117,7 @@ public class PNF extends SetupCDTest { @Test public void addPropertiesToVfcInstanceInPNFTest() throws Exception { - String fileName = "CP.yml"; + String fileName = "CP02.yml"; ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.CP, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser()); try{ @@ -130,6 +142,7 @@ public class PNF extends SetupCDTest { PropertiesPage.getPropertyPopup().clickSave(); findElement = properties.get(i).findElement(By.className("i-sdc-designer-sidebar-section-content-item-property-value")); + SetupCDTest.getExtendTest().log(Status.INFO, "Validating properties"); AssertJUnit.assertTrue(findElement.getText().equals(propertyValue)); } } @@ -145,7 +158,7 @@ public class PNF extends SetupCDTest { ResourceReqDetails pnfMetaData = null; CanvasManager vfCanvasManager; CanvasElement cpElement = null; - String fileName = "CP.yml"; + String fileName = "CP03.yml"; try{ atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.CP, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser()); ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser()); @@ -228,7 +241,7 @@ public class PNF extends SetupCDTest { } @Test - public void deletePNFCheckedoutTest() throws Exception{ + public void deletePNFTest() throws Exception{ ResourceReqDetails pnfMetaData = createPNFWithGenerateName(); GeneralPageElements.clickTrashButtonAndConfirm(); @@ -253,9 +266,9 @@ public class PNF extends SetupCDTest { VfVerificator.verifyVFMetadataInUI(pnfMetaData); } - + @Test - public void checkoutVfTest() throws Exception{ + public void checkoutPnfTest() throws Exception{ ResourceReqDetails pnfMetaData = createPNFWithGenerateName(); ResourceGeneralPage.clickCheckinButton(pnfMetaData.getName()); @@ -287,7 +300,105 @@ public class PNF extends SetupCDTest { ResourceUIUtils.createPNF(pnfMetaData, getUser()); return pnfMetaData; } - + + @Test + public void verifyPNF_UI_Limitations() throws Exception { + ResourceReqDetails pnfMetaData = createPNFWithGenerateName(); + + SetupCDTest.getExtendTest().log(Status.INFO, "Validating Deployment Artifact Left Side Menu not exist"); + assertTrue(GeneralUIUtils.isElementInvisibleByTestId("Deployment ArtifactLeftSideMenu")); + SetupCDTest.getExtendTest().log(Status.INFO, "Validating Deployment Left Side Menu not exist"); + assertTrue(GeneralUIUtils.isElementInvisibleByTestId("DeploymentLeftSideMenu")); + } + + @Test + public void filteringCatalogByPNF() throws Exception { + ResourceReqDetails pnfMetaData = createPNFWithGenerateName(); + + String pnfName = pnfMetaData.getName(); + ResourceGeneralPage.clickSubmitForTestingButton(pnfName); + reloginWithNewRole(UserRoleEnum.TESTER); + GeneralUIUtils.findComponentAndClick(pnfName); + TesterOperationPage.certifyComponent(pnfName); + + pnfMetaData.setVersion("1.0"); + VfVerificator.verifyVFLifecycle(pnfMetaData, getUser(), LifecycleStateEnum.CERTIFIED); + + reloginWithNewRole(UserRoleEnum.DESIGNER); + CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG); + CatalogUIUtilitis.catalogFilterTypeChecBox(TypesEnum.valueOf("PNF")); + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Validating resource %s found", pnfName)); + GeneralUIUtils.clickOnElementByTestId(pnfName); + } + + @Test + public void addPNFtoServiceAndDistribute() throws Exception { + ResourceReqDetails pnfMetaData = createPNFWithGenerateName(); + + ResourceGeneralPage.getLeftMenu().moveToCompositionScreen(); + CanvasManager vfCanvasManager = CanvasManager.getCanvasManager(); + CompositionPage.searchForElement("ContrailPort"); + vfCanvasManager.createElementOnCanvas("ContrailPort"); + + String pnfName = pnfMetaData.getName(); + ResourceGeneralPage.clickSubmitForTestingButton(pnfName); + + reloginWithNewRole(UserRoleEnum.TESTER); + GeneralUIUtils.findComponentAndClick(pnfName); + TesterOperationPage.certifyComponent(pnfName); + + pnfMetaData.setVersion("1.0"); + VfVerificator.verifyVFLifecycle(pnfMetaData, getUser(), LifecycleStateEnum.CERTIFIED); + + reloginWithNewRole(UserRoleEnum.DESIGNER); + ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); + ServiceUIUtils.createService(serviceMetadata, getUser()); + DeploymentArtifactPage.getLeftMenu().moveToCompositionScreen(); + CanvasManager canvasManager = CanvasManager.getCanvasManager(); + CompositionPage.searchForElement(pnfName); + CanvasElement pnfElement = canvasManager.createElementOnCanvas(pnfName); + CompositionPage.searchForElement("Network"); + CanvasElement networkElement = canvasManager.createElementOnCanvas("Network"); + + canvasManager.linkElements(pnfElement, CircleSize.VF, networkElement, CircleSize.NORMATIVE); + String serviceName = serviceMetadata.getName(); + ServiceGeneralPage.clickSubmitForTestingButton(serviceName); + reloginWithNewRole(UserRoleEnum.TESTER); + GeneralUIUtils.findComponentAndClick(serviceName); + TesterOperationPage.certifyComponent(serviceName); + + reloginWithNewRole(UserRoleEnum.GOVERNOR); + GeneralUIUtils.findComponentAndClick(serviceName); + GovernorOperationPage.approveSerivce(serviceName); + + reloginWithNewRole(UserRoleEnum.OPS); + GeneralUIUtils.findComponentAndClick(serviceName); + OpsOperationPage.distributeService(); + } + + @Test + public void checkInfomationArtifactUploadLimitation() throws Exception { + ResourceReqDetails pnfMetaData = createPNFWithGenerateName(); + ResourceGeneralPage.getLeftMenu().moveToInformationalArtifactScreen(); + List<WebElement> webElements = GeneralUIUtils.getWebElementsListBy(By.xpath("//button[@class='add-button ng-scope']")); + int numberOfElements = webElements.size(); + String buttonText = webElements.get(0).getText(); + SetupCDTest.getExtendTest().log(Status.INFO, "Verifying only one button exist: Add Other Artifact"); + assertTrue(buttonText.equalsIgnoreCase(("Add Other Artifact"))); + assertTrue(1==numberOfElements, "There should be only one option for uploading artifact in PNF"); + } + + @Test + public void checkNonCPVLObjectsNotExistInComosition() throws Exception { + ResourceReqDetails pnfMetaData = createPNFWithGenerateName(); + ResourceGeneralPage.getLeftMenu().moveToCompositionScreen(); + String pnfName = pnfMetaData.getName(); + // Searching for VFC element and make sure it not exist in PNF composition (Only VL/CP are allowed). + CompositionPage.searchForElement("BlockStorage"); + SetupCDTest.getExtendTest().log(Status.INFO, "Verifying Element found"); + assertTrue(GeneralUIUtils.isElementInvisibleByTestId("BlockStorage")); + } + @Override protected UserRoleEnum getRole() { return UserRoleEnum.DESIGNER; @@ -0,0 +1,124 @@ +package org.openecomp.sdc.ci.tests.execute.sanity; + +import java.util.Map; + +import org.openecomp.sdc.be.model.ComponentInstance; +import org.openecomp.sdc.be.model.Resource; +import org.openecomp.sdc.be.model.Service; +import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.ci.tests.datatypes.AmdocsLicenseMembers; +import org.openecomp.sdc.ci.tests.datatypes.CanvasElement; +import org.openecomp.sdc.ci.tests.datatypes.CanvasManager; +import org.openecomp.sdc.ci.tests.datatypes.ConnectionWizardPopUpObject; +import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; +import org.openecomp.sdc.ci.tests.datatypes.ServiceContainer; +import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; +import org.openecomp.sdc.ci.tests.datatypes.VendorSoftwareProductObject; +import org.openecomp.sdc.ci.tests.datatypes.enums.CircleSize; +import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum; +import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; +import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; +import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; +import org.openecomp.sdc.ci.tests.pages.CompositionPage; +import org.openecomp.sdc.ci.tests.pages.ServiceGeneralPage; +import org.openecomp.sdc.ci.tests.utilities.ServiceUIUtils; +import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils; +import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; +import org.openecomp.sdc.ci.tests.utils.general.FileHandling; +import org.openecomp.sdc.ci.tests.utils.general.OnboardingUtillViaApis; +import org.openecomp.sdc.ci.tests.utils.general.OnboardingUtils; +import org.openecomp.sdc.ci.tests.verificator.ServiceVerificator; +import org.testng.annotations.Test; + +import com.aventstack.extentreports.Status; +import com.clearspring.analytics.util.Pair; + +import fj.data.Either; + +public class PortMirroring extends SetupCDTest +{ + @Override + protected UserRoleEnum getRole() { + return UserRoleEnum.DESIGNER3; + } + + String portMirroringElementNameInPallete = "Port Mirroring Configuration"; + String portMirroringCapReqType = "org.openecomp.capabilities.PortMirroring"; + String portMirroringSourceCapability = "Port Mirroring Configuration 0: source: [1, UNBOUNDED]"; + String portMirroringCollectorCapability = "Port Mirroring Configuration 0: collector: [1, 1]"; + + @Test + public void createPortMirroringServiceProxy() throws Throwable { + //Using API onboard and certify 2 zip files Source: vmmme and Collector: Vprobe + String filePath = FileHandling.getPortMirroringRepositoryPath(); + ServiceContainer serviceContainerVmme_Source = createServiceFromHeatFile(filePath,"2016-227_vmme_vmme_30_1610_e2e.zip"); + ServiceContainer serviceContainerVprobe_Collector = createServiceFromHeatFile(filePath,"vProbe_2017-10-22_07-24.zip"); + +// String vmmeSourceName = "ciServiceb560327d162f"; +// String vprobeSourceName = "ciService3d9933d31791"; + + // create service + ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); + ServiceUIUtils.createService(serviceMetadata, getUser()); + + String vmmeSourceName = serviceContainerVmme_Source.getService().getName(); + String vprobeSourceName = serviceContainerVprobe_Collector.getService().getName(); + + ServiceGeneralPage.getLeftMenu().moveToCompositionScreen(); + CanvasManager canvasManager = CanvasManager.getCanvasManager(); + + CompositionPage.searchForElement(vmmeSourceName); + CanvasElement serviceElementVmmeSourceName = canvasManager.createElementOnCanvas(vmmeSourceName); + + CompositionPage.searchForElement(vprobeSourceName); + CanvasElement serviceElementVprobeCollector = canvasManager.createElementOnCanvas(vprobeSourceName); + + CompositionPage.searchForElement(portMirroringElementNameInPallete); + CanvasElement portMirroringConfigurationElement = canvasManager.createElementOnCanvas(portMirroringElementNameInPallete); + + ConnectionWizardPopUpObject connectionWizardPopUpObjectVMME = new ConnectionWizardPopUpObject("","", portMirroringCapReqType, portMirroringSourceCapability); + ConnectionWizardPopUpObject connectionWizardPopUpObjectVProbe = new ConnectionWizardPopUpObject("","", portMirroringCapReqType, portMirroringCollectorCapability); + + canvasManager.linkElementsAndSelectCapReqTypeAndCapReqName(serviceElementVmmeSourceName, CircleSize.SERVICE,portMirroringConfigurationElement, CircleSize.NORMATIVE, connectionWizardPopUpObjectVMME); + canvasManager.linkElementsAndSelectCapReqTypeAndCapReqName(serviceElementVprobeCollector, CircleSize.SERVICE, portMirroringConfigurationElement, CircleSize.NORMATIVE, connectionWizardPopUpObjectVProbe); + + serviceMetadata.setVersion("0.1"); + ServiceVerificator.verifyLinkCreated(serviceMetadata, getUser(), 2); + + System.out.println("End"); + } + + public ServiceContainer createServiceFromHeatFile(String filePath, String vnfFile) throws Throwable + { + setLog(String.format("Distribute Service Test: Create VF from %s add it to service than distribute", vnfFile)); +// 1. Import VSP v1.0 + User sdncDesignerDetails1 = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER3); + AmdocsLicenseMembers amdocsLicenseMembers = OnboardingUtils.createVendorLicense(sdncDesignerDetails1); + getExtendTest().log(Status.INFO, String.format("Creating Vendor Software License (VLM): %s v1.0", amdocsLicenseMembers.getVendorLicenseName())); + ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); + getExtendTest().log(Status.INFO, String.format("Creating Vendor Software Product (VSP): %s v1.0 from heat file: %s ", resourceReqDetails.getName(), vnfFile)); + Pair<String, Map<String, String>> createVendorSoftwareProduct = OnboardingUtils.createVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails1, amdocsLicenseMembers); + VendorSoftwareProductObject vendorSoftwareProductObject = OnboardViaApis.fillVendorSoftwareProductObjectWithMetaData(vnfFile, createVendorSoftwareProduct); +// 2. Create VF, certify - v1.0 is created + resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject); + Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails); + resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); + getExtendTest().log(Status.INFO, String.format("Creating Virtual Function (VF): %s v1.0", resourceReqDetails.getName())); + getExtendTest().log(Status.INFO, String.format("Certify the VF")); +// 3. Create Service add to it the certified VF and certify the Service v1.0 + ServiceReqDetails serviceReqDetails = ElementFactory.getDefaultService(); + Service service = AtomicOperationUtils.createCustomService(serviceReqDetails, UserRoleEnum.DESIGNER, true).left().value(); + getExtendTest().log(Status.INFO, String.format("Creating Service: %s v1.0", serviceReqDetails.getName())); + Either<ComponentInstance, RestResponse> addComponentInstanceToComponentContainer = AtomicOperationUtils.addComponentInstanceToComponentContainer(resource, service, UserRoleEnum.DESIGNER, true); + ComponentInstance componentInstance = addComponentInstanceToComponentContainer.left().value(); + getExtendTest().log(Status.INFO, String.format("Adding VF instance to Service")); + service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); + getExtendTest().log(Status.INFO, String.format("Certify the Service")); + + return new ServiceContainer(service,resource,vendorSoftwareProductObject,amdocsLicenseMembers); + } + + +} + + @@ -0,0 +1,95 @@ +/*- + * ============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.ci.tests.execute.sanity; + +import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; +import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; +import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum; +import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum; +import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; +import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; +import org.openecomp.sdc.ci.tests.pages.PropertiesAssignmentPage; +import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage; +import org.openecomp.sdc.ci.tests.utilities.FileHandling; +import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils; +import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; +import org.testng.AssertJUnit; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Test; + +import com.aventstack.extentreports.Status; + + +public class PropertiesAssignment extends SetupCDTest { + + private String filePath; + @BeforeClass + public void beforeClass(){ + filePath = FileHandling.getFilePath(""); + } + + @BeforeMethod + public void beforeTest(){ + System.out.println("File repository is : " + filePath); + getExtendTest().log(Status.INFO, "File repository is : " + filePath); + } + + + + @Test + public void declareAndDeleteInputVfTest() throws Exception { +// ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser()); +// ResourceUIUtils.createResource(vfMetaData, getUser()); + + String csarFile = "PCRF_OS_FIXED.csar"; + String componentName = "abstract_pcm"; + String propertyName = "min_instances"; + + ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString()); + resourceMetaData.setVersion("0.1"); + ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, csarFile, getUser()); + + + ResourceGeneralPage.getLeftMenu().moveToPropertiesAssignmentScreen(); + PropertiesAssignmentPage.clickOnComponentInComposition(componentName); + PropertiesAssignmentPage.findSearchBoxAndClick(propertyName); + PropertiesAssignmentPage.clickOnDeclareButton(); + AssertJUnit.assertTrue(PropertiesAssignmentPage.isPropertyChecked(propertyName)); + + PropertiesAssignmentPage.clickOnInputTab(); + PropertiesAssignmentPage.findInput(componentName, propertyName); + PropertiesAssignmentPage.clickOnDeleteInputButton(); + PropertiesAssignmentPage.clickOnDeleteInputDialogConfirmationButton(); + PropertiesAssignmentPage.clickOnPropertiesTab(); + PropertiesAssignmentPage.findProperty(propertyName); + AssertJUnit.assertFalse(PropertiesAssignmentPage.isPropertyChecked(propertyName)); + + + } + + @Override + protected UserRoleEnum getRole() { + return UserRoleEnum.DESIGNER; + } + +} + @@ -23,7 +23,6 @@ package org.openecomp.sdc.ci.tests.execute.sanity; import static org.testng.AssertJUnit.assertTrue; import java.awt.AWTException; -import java.io.File; import java.util.Arrays; import java.util.List; @@ -31,7 +30,6 @@ import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.model.LifecycleStateEnum; import org.openecomp.sdc.ci.tests.datatypes.ArtifactInfo; -import org.openecomp.sdc.ci.tests.datatypes.TopMenuButtonsEnum; import org.openecomp.sdc.ci.tests.datatypes.CanvasElement; import org.openecomp.sdc.ci.tests.datatypes.CanvasManager; import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; @@ -40,6 +38,7 @@ import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.ServiceMetadataEnum; import org.openecomp.sdc.ci.tests.datatypes.LifeCycleStateEnum; import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; +import org.openecomp.sdc.ci.tests.datatypes.TopMenuButtonsEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum; @@ -69,7 +68,6 @@ import org.openecomp.sdc.ci.tests.verificator.VfVerificator; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; import org.testng.AssertJUnit; -import org.testng.SkipException; import org.testng.TestException; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; @@ -117,7 +115,7 @@ public class Service extends SetupCDTest { // Update Service ServiceGeneralPage.deleteOldTags(serviceMetadata); - serviceMetadata.setName("ciUpdatedNameSanity"); + serviceMetadata.setName(ElementFactory.getServicePrefix() + "UpdatedName" + serviceMetadata.getName()); serviceMetadata.setDescription("updatedDescriptionSanity"); serviceMetadata.setProjectCode("654321"); serviceMetadata.setContactId("cs6543"); @@ -214,6 +212,23 @@ public class Service extends SetupCDTest { } @Test + public void createLinkService() throws Exception{ + String fileName2 = "vSeGW.csar"; + ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString()); + ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, fileName2, getUser()); + ResourceGeneralPage.clickCheckinButton(resourceMetaData.getName()); + + ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); + ServiceUIUtils.createService(serviceMetadata, getUser()); + DeploymentArtifactPage.getLeftMenu().moveToCompositionScreen(); + CanvasManager canvasManager = CanvasManager.getCanvasManager(); + CompositionPage.searchForElement(resourceMetaData.getName()); + CanvasElement firstElement = canvasManager.createElementOnCanvas(resourceMetaData.getName()); + CanvasElement secondElement = canvasManager.createElementOnCanvas(resourceMetaData.getName()); + canvasManager.linkElements(firstElement, secondElement); + } + + @Test public void addDeploymentArtifactInCompositionScreenTest() throws Exception{ ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); ServiceUIUtils.createService(serviceMetadata, getUser()); @@ -264,7 +279,7 @@ public class Service extends SetupCDTest { } @Test - public void addAPIArtifactInCompositionScreenTest() throws Exception{ + public void addAPIArtifactInCompositionScreenTest() throws Exception{ String fileName = HEAT_FILE_YAML_NAME, descriptionText = DESCRIPTION, url = "http://kuku.com"; @@ -272,7 +287,7 @@ public class Service extends SetupCDTest { ServiceUIUtils.createService(serviceMetadata, getUser()); ResourceGeneralPage.getLeftMenu().moveToCompositionScreen(); - ArtifactInfo artifactInfo = new ArtifactInfo(filePath, fileName, descriptionText, ARTIFACT_LABEL,"OTHER"); + new ArtifactInfo(filePath, fileName, descriptionText, ARTIFACT_LABEL,"OTHER"); CompositionPage.showAPIArtifactTab(); for(DataTestIdEnum.APIArtifactsService artifact: DataTestIdEnum.APIArtifactsService.values()){ @@ -367,10 +382,6 @@ public class Service extends SetupCDTest { @Test public void addDeploymentArtifactToVFInstanceTest() throws Exception{ - if(true){ - throw new SkipException("Open bug 321669"); - } - ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VF, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser()); ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); ArtifactInfo artifact = new ArtifactInfo(filePath, HEAT_FILE_YAML_NAME, DESCRIPTION, ARTIFACT_LABEL,ArtifactTypeEnum.SNMP_POLL.getType()); @@ -385,12 +396,12 @@ public class Service extends SetupCDTest { @Test public void deleteDeploymentArtifactFromVFInstanceTest() throws Exception{ - + ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VF, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser()); ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); ArtifactInfo artifact = new ArtifactInfo(filePath, HEAT_FILE_YAML_NAME, DESCRIPTION, ARTIFACT_LABEL,ArtifactTypeEnum.SNMP_POLL.getType()); - CanvasElement computeElement = createServiceWithRiArtifact(atomicResourceMetaData, serviceMetadata, artifact); + createServiceWithRiArtifact(atomicResourceMetaData, serviceMetadata, artifact); checkArtifactIfAdded(1, HEAT_FILE_YAML_NAME); List<WebElement> actualArtifactList = GeneralUIUtils.getWebElementsListBy(By.className(GET_ARTIFACT_LIST_BY_CLASS_NAME)); deleteAndVerifyArtifact(actualArtifactList); @@ -400,9 +411,9 @@ public class Service extends SetupCDTest { @Test public void deleteDeploymentArtifactFromVFInstanceNextVersionTest() throws Exception{ - if(true){ - throw new SkipException("Open bug 322930"); - } +// if(true){ +// throw new SkipException("Open bug 342260"); +// } ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VF, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser()); ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); @@ -429,9 +440,9 @@ public class Service extends SetupCDTest { @Test public void updateDeploymentArtifactOnVFInstanceNextVersionTest() throws Exception{ - if(true){ - throw new SkipException("Open bug 322930"); - } +// if(true){ +// throw new SkipException("Open bug 322930"); +// } ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VF, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser()); ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService(); @@ -569,7 +580,7 @@ public class Service extends SetupCDTest { @Test public void deploymentViewServiceTest() throws Exception{ - String fileName2 = "vSeGW.csar"; + String fileName2 = "vSeGWNew.csar"; ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString()); ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, fileName2, getUser()); @@ -1,39 +1,21 @@ -/*- - * ============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.ci.tests.execute.sanity; import java.io.File; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Random; -import org.junit.Rule; -import org.junit.rules.TemporaryFolder; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; +import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentInstance; +import org.openecomp.sdc.be.model.ComponentInstanceInput; +import org.openecomp.sdc.be.model.PropertyDefinition; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.ci.tests.dataProvider.OnbordingDataProviders; import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.VendorSoftwareProductObject; @@ -42,21 +24,22 @@ import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaDefinition; +import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaInputsTopologyTemplateDefinition; +import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaTopologyTemplateDefinition; import org.openecomp.sdc.ci.tests.tosca.model.ToscaMetadataFieldsPresentationEnum; import org.openecomp.sdc.ci.tests.utilities.DownloadManager; import org.openecomp.sdc.ci.tests.utilities.FileHandling; -import org.openecomp.sdc.ci.tests.utilities.OnboardingUtillViaApis; import org.openecomp.sdc.ci.tests.utils.ToscaParserUtils; import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; +import org.openecomp.sdc.ci.tests.utils.general.OnboardingUtillViaApis; +import org.openecomp.sdc.ci.tests.utils.rest.PropertyRestUtils; import org.openecomp.sdc.ci.tests.verificator.ToscaValidation; import org.openecomp.sdc.tosca.parser.api.ISdcCsarHelper; -import org.openecomp.sdc.tosca.parser.exceptions.SdcToscaParserException; import org.openecomp.sdc.tosca.parser.impl.SdcToscaParserFactory; import org.openecomp.sdc.toscaparser.api.NodeTemplate; import org.openecomp.sdc.toscaparser.api.elements.Metadata; import org.testng.Assert; -import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; import com.aventstack.extentreports.Status; @@ -66,27 +49,31 @@ import fj.data.Either; public class ToscaValidationTest extends SetupCDTest{ - - ToscaDefinition toscaMainAmdocsDefinition, toscaMainVfDefinition, toscaMainServiceDefinition; + + private static final String GENERIC_VF = "Generic_VF"; + private static final String GENERIC_PNF = "Generic_PNF"; + +// private ToscaDefinition toscaMainAmdocsDefinition, toscaMainVfDefinition, toscaMainServiceDefinition, toscaExpectedMainServiceDefinition; protected String vnfFile; protected String filepath; - protected File filesFolder; +// protected File filesFolder = new File(SetupCDTest.getWindowTest().getDownloadDirectory()); protected SdcToscaParserFactory factory = SdcToscaParserFactory.getInstance(); - protected ISdcCsarHelper fdntCsarHelper; - protected ResourceReqDetails resourceReqDetails; - protected Resource resource; - protected ServiceReqDetails serviceReqDetails; - protected Service service; - protected ComponentInstance componentInstanceDefinition; +// protected ISdcCsarHelper fdntCsarHelper; +// protected ResourceReqDetails resourceReqDetails; +// protected Resource resource; +// protected ServiceReqDetails serviceReqDetails; +// protected Service service; +// protected ComponentInstance componentInstanceDefinition; User user = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER); - File importToscaFilesFolder = new File("C:/Git_work/sdc/catalog-be/src/main/resources/import/tosca/"); +// File importToscaFilesFolder = new File("C:/Git_work/sdc/catalog-be/src/main/resources/import/tosca/"); - File dataTypesLocation = new File(importToscaFilesFolder.getPath() + "/data-types/dataTypes.yml"); +// File dataTypesLocation = new File(importToscaFilesFolder.getPath() + "/data-types/dataTypes.yml"); +// List<Boolean> status = new ArrayList<>(); - File genericVfFileLocation = new File(importToscaFilesFolder.getPath() + "/heat-types/Generic_VF/Generic_VF.yml"); - File genericVfcFileLocation = new File (importToscaFilesFolder.getPath() + "/heat-types/Generic_VFC/Generic_VFC.yml"); - File genericPnfFileLocation = new File (importToscaFilesFolder.getPath() + "/heat-types/Generic_PNF/Generic_PNF.yml"); - File genericServiceFileLocation = new File (importToscaFilesFolder.getPath() + "/heat-types/Generic_Service/Generic_Service.yml"); +// File genericVfFileLocation = new File(importToscaFilesFolder.getPath() + "/heat-types/Generic_VF/Generic_VF.yml"); +// File genericVfcFileLocation = new File (importToscaFilesFolder.getPath() + "/heat-types/Generic_VFC/Generic_VFC.yml"); +// File genericPnfFileLocation = new File (importToscaFilesFolder.getPath() + "/heat-types/Generic_PNF/Generic_PNF.yml"); +// File genericServiceFileLocation = new File (importToscaFilesFolder.getPath() + "/heat-types/Generic_Service/Generic_Service.yml"); // Map<String, DataTypeDefinition> parseDataTypesYaml = FileHandling.parseDataTypesYaml(dataTypesLocation.getAbsoluteFile().toString()); @@ -102,115 +89,246 @@ public class ToscaValidationTest extends SetupCDTest{ this.vnfFile = vnfFile; } + public ToscaValidationTest() { + } - @BeforeClass - - public void precondition() throws Exception{ + + +// @BeforeClass + @Test() + public void toscaFileValidator() throws Exception{ //--------------------------GENERAL-------------------------------- - setLog(vnfFile); - filesFolder = new File(SetupCDTest.getWindowTest().getDownloadDirectory()); -//--------------------------AMDOCS-------------------------------- - Pair<String, VendorSoftwareProductObject> createVendorSoftwareProduct = OnboardingUtillViaApis.createVspViaApis(filepath, vnfFile, user); - VendorSoftwareProductObject vendorSoftwareProductObject = createVendorSoftwareProduct.right; - vendorSoftwareProductObject.setVspName(createVendorSoftwareProduct.left); - DownloadManager.downloadCsarByNameFromVSPRepository(vendorSoftwareProductObject.getVspName(), vendorSoftwareProductObject.getVspId(), false); - File amdocsCsarFileName = FileHandling.getLastModifiedFileNameFromDir(filesFolder.getAbsolutePath()); +/*// for debugging only + setLog("Test"); + File amdocsCsarFileName = (new File("C:\\Users\\al714h\\Downloads\\d218be69637647b0b693647d84a8c03f.csar")); toscaMainAmdocsDefinition = ToscaParserUtils.parseToscaMainYamlToJavaObjectByCsarLocation(amdocsCsarFileName); - + toscaMainVfDefinition = ToscaParserUtils.parseToscaMainYamlToJavaObjectByCsarLocation(new File("C:\\Users\\al714h\\Downloads\\resource-Civfonboarded2016073VmxBv301072E2eE60f5c15-csar.csar")); + */ + setLog(vnfFile); + List<Boolean> status = new ArrayList<>(); + ISdcCsarHelper fdntCsarHelper; + File filesFolder = new File(SetupCDTest.getWindowTest().getDownloadDirectory()); +// filesFolder = new File(SetupCDTest.getWindowTest().getDownloadDirectory()); +//--------------------------AMDOCS-------------------------------- +// vnfFile = "HeatCandidate_2017-09-22_01-32_60Name_Vdbe-vsp-15.1x49-d50.3-v1.0-(VOIP).zip"; + ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, user);//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT); + resourceReqDetails = createCustomizedVsp(resourceReqDetails, filepath, vnfFile); + + ToscaDefinition toscaMainAmdocsDefinition = downloadAndGetToscaMainYamlObjectUI(resourceReqDetails, filesFolder); +//------adding generic inputs to expected object + toscaMainAmdocsDefinition = addGenericPropertiesToToscaDefinitionObject(toscaMainAmdocsDefinition, GENERIC_VF); +// copy object + ToscaDefinition toscaExpectedMainServiceDefinition = new ToscaDefinition(toscaMainAmdocsDefinition); //TODO--------------------------AMDOCS DOWNLOAD VIA APIS-------------------------------- //--------------------------VF-------------------------------- // create VF base on VNF imported from previous step - have, resourceReqDetails object include part of resource metadata - resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(vendorSoftwareProductObject, vendorSoftwareProductObject.getVspName()); - resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails, vendorSoftwareProductObject.getVspName()); + Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails); resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); - File VfCsarFileName = new File(File.separator + "VfCsar_" + ElementFactory.generateUUIDforSufix() + ".csar"); - OnboardingUtillViaApis.downloadToscaCsarToDirectory(resource, new File(filesFolder.getPath() + VfCsarFileName)); - toscaMainVfDefinition = ToscaParserUtils.parseToscaMainYamlToJavaObjectByCsarLocation(new File(filesFolder.getPath() + VfCsarFileName)); + ToscaDefinition toscaMainVfDefinition = downloadAndGetToscaMainYamlObjectApi(resource, filesFolder); + //--------------------------SERVICE-------------------------------- - serviceReqDetails = OnboardingUtillViaApis.prepareServiceDetailsBeforeCreate(user); - service = AtomicOperationUtils.createCustomService(serviceReqDetails, UserRoleEnum.DESIGNER, true).left().value(); + ServiceReqDetails serviceReqDetails = ElementFactory.getDefaultService();//getServiceReqDetails(ComponentConfigurationTypeEnum.DEFAULT); +// serviceReqDetails = OnboardingUtillViaApis.prepareServiceDetailsBeforeCreate(serviceReqDetails, user); + Service service = AtomicOperationUtils.createCustomService(serviceReqDetails, UserRoleEnum.DESIGNER, true).left().value(); Either<ComponentInstance, RestResponse> addComponentInstanceToComponentContainer = AtomicOperationUtils.addComponentInstanceToComponentContainer(resource, service, UserRoleEnum.DESIGNER, true); - componentInstanceDefinition = addComponentInstanceToComponentContainer.left().value(); -// TODO declare all VFi inputs + add all generic + ComponentInstance componentInstanceDefinition = addComponentInstanceToComponentContainer.left().value(); + +//--------------------------getProperties set values and declare-------------------- + + Component componentObject = AtomicOperationUtils.getComponentObject(service, UserRoleEnum.DESIGNER); + Map<String, List<ComponentInstanceInput>> componentInstancesInputs = componentObject.getComponentInstancesInputs(); + setValuesToPropertiesList(componentInstancesInputs, toscaExpectedMainServiceDefinition); + PropertyRestUtils.declareProporties(componentObject, componentInstancesInputs, user); + service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); File ServiceCsarFileName = new File(File.separator + "ServiceCsar_" + ElementFactory.generateUUIDforSufix() + ".csar"); OnboardingUtillViaApis.downloadToscaCsarToDirectory(service, new File(filesFolder.getPath() + ServiceCsarFileName)); - toscaMainServiceDefinition = ToscaParserUtils.parseToscaMainYamlToJavaObjectByCsarLocation(new File(filesFolder.getPath() + ServiceCsarFileName)); + ToscaDefinition toscaMainServiceDefinition = ToscaParserUtils.parseToscaMainYamlToJavaObjectByCsarLocation(new File(filesFolder.getPath() + ServiceCsarFileName)); + + + + -//--------------------------verification against Pavel Parser-------------------------------- +//--------------------------initialization of Tosca Parser-------------------------------- + + fdntCsarHelper = initSdcCsarHelper(ServiceCsarFileName, filesFolder); + + +//---------------------------TESTS-------------------------------------------------- + status = validateVfMetadata(toscaMainAmdocsDefinition, toscaMainVfDefinition, resourceReqDetails, resource, vnfFile, status); + status = validateResourceNodeTemplateMetadata(toscaMainVfDefinition, resource, vnfFile, status); + status = validateServiceMetadata(toscaMainServiceDefinition, serviceReqDetails, service, vnfFile, status); + status = validateServiceNodeTemplateMetadata(toscaMainServiceDefinition, componentInstanceDefinition, resourceReqDetails, resource, vnfFile, status); + status = validateServiceMetadataUsingParser(fdntCsarHelper, serviceReqDetails, service, vnfFile, status); + status = validateServiceNodeTemplateMetadataUsingParser(fdntCsarHelper, resourceReqDetails, resource, componentInstanceDefinition, vnfFile, status); + status = validateResourceInputs(toscaMainAmdocsDefinition, toscaMainVfDefinition, vnfFile, status); + status = validateServiceInputs(toscaExpectedMainServiceDefinition, toscaMainServiceDefinition, vnfFile, status); + status = validateServiceInputsUsingParser(fdntCsarHelper, toscaExpectedMainServiceDefinition, vnfFile, status); - SetupCDTest.getExtendTest().log(Status.INFO, "Tosca parser is going to convert service csar file to ISdcCsarHelper object..."); - fdntCsarHelper = factory.getSdcCsarHelper(filesFolder.getPath() + ServiceCsarFileName); + if(status.contains(false)){ + SetupCDTest.getExtendTest().log(Status.FAIL, "Summary: tosca validation test failed with zip file " + vnfFile); + Assert.assertFalse(true); + } + } + + + + + + + + /**The method set values to toscaDefinition object service level only, to resource level should put instead of setDefault --> setValue + * inputs.get(componentInstanceInput.getName()).setValue(randomString); + * @param componentInstancesInputs + * @param toscaDefinition + */ + private void setValuesToPropertiesList(Map<String, List<ComponentInstanceInput>> componentInstancesInputs, ToscaDefinition toscaDefinition) { + for(Map.Entry<String, List<ComponentInstanceInput>> entry : componentInstancesInputs.entrySet()) { + List<ComponentInstanceInput> value = entry.getValue(); + String[] names = entry.getKey().split("\\."); + String expectedServiceInputPrefix = null; + Map<String, ToscaInputsTopologyTemplateDefinition> inputs = toscaDefinition.getTopology_template().getInputs(); + if(names.length>0) { + expectedServiceInputPrefix = names[names.length - 1] + "_"; + } + for (ComponentInstanceInput componentInstanceInput :value) { + + String type = componentInstanceInput.getType(); + List<String> myList = new ArrayList<String>(); + myList.add("cbf8049e-69e8-48c3-a06f-255634391403"); + if (type.equals("string")) { + String randomString = getRandomString(); + componentInstanceInput.setValue(randomString); + inputs.get(componentInstanceInput.getName()).setDefault(randomString); + + } + else if (type.equals("integer") ) { + int randomInteger = getRandomInteger(); + componentInstanceInput.setValue(Integer.toString(randomInteger)); + inputs.get(componentInstanceInput.getName()).setDefault(randomInteger); + } + else if (type.equals("float") ){ + componentInstanceInput.setValue("5.5"); + inputs.get(componentInstanceInput.getName()).setDefault("5.5"); + + } + else if (type.equals("boolean") ){ + componentInstanceInput.setValue("true"); + inputs.get(componentInstanceInput.getName()).setDefault("true"); + } + else if (type.equals("list") ){ + String myListofStrings = myList.toString(); + componentInstanceInput.setValue(myListofStrings); + inputs.get(componentInstanceInput.getName()).setDefault(myListofStrings); + } + + String expectedServiceInputName = expectedServiceInputPrefix + componentInstanceInput.getName(); + ToscaInputsTopologyTemplateDefinition oldInput = inputs.get(componentInstanceInput.getName()); + inputs.put(expectedServiceInputName, oldInput); + inputs.remove(componentInstanceInput.getName()); + + } + + } } - + + protected String getRandomString() { + String SALTCHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"; + StringBuilder salt = new StringBuilder(); + Random rnd = new Random(); + while (salt.length() < 18) { // length of the random string. + int index = (int) (rnd.nextFloat() * SALTCHARS.length()); + salt.append(SALTCHARS.charAt(index)); + } + String strValue = salt.toString(); + return strValue; + + } + + protected int getRandomInteger() { + Random r = new Random(); + int Low = 10; + int High = 100; + int integerValue = r.nextInt(High - Low) + Low; + return integerValue; + } + + //--------------------------Metadata verification-------------------------------- //--------------------------Resource-------------------------------- - @Test() - public void validateVfMetadata() throws Exception{ - setLog(vnfFile); - SetupCDTest.getExtendTest().log(Status.INFO, "validateVfMetadata " + vnfFile); + public List<Boolean> validateVfMetadata(ToscaDefinition toscaMainAmdocsDefinition, ToscaDefinition toscaMainVfDefinition, ResourceReqDetails resourceReqDetails,Resource resource, String vnfFile, List<Boolean> status) throws Exception{ + reportStartTestPrint("validateVfMetadata", vnfFile); //add resource metadata to expected object toscaMainAmdocsDefinition = addAndGenerateResourceMetadataToExpectedObject(toscaMainAmdocsDefinition, resourceReqDetails, resource); Either<Boolean,Map<String,Object>> resourceToscaMetadataValidator = ToscaValidation.resourceToscaMetadataValidator(toscaMainAmdocsDefinition, toscaMainVfDefinition); - Assert.assertFalse(!resourceToscaMetadataValidator.left().value().equals(true), "Found error/s on Vf metadata verification"); - + if(resourceToscaMetadataValidator.isRight()) + status.add(false); + return status; } - @Test() - public void validateResourceNodeTemplateMetadata() throws Exception{ - setLog(vnfFile); - SetupCDTest.getExtendTest().log(Status.INFO, "validateResourceNodeTemplateMetadata " + vnfFile); + public List<Boolean> validateResourceNodeTemplateMetadata(ToscaDefinition toscaMainVfDefinition, Resource resource, String vnfFile, List<Boolean> status) throws Exception{ + reportStartTestPrint("validateResourceNodeTemplateMetadata", vnfFile); Map<String, Map<String, String>> generateReosurceNodeTemplateMetadataToExpectedObject = generateResourceNodeTemplateMetadataToExpectedObject(resource); Boolean resourceToscaMetadataValidator = ToscaValidation.resourceToscaNodeTemplateMetadataValidator(generateReosurceNodeTemplateMetadataToExpectedObject, toscaMainVfDefinition); - Assert.assertFalse(!resourceToscaMetadataValidator.equals(true), "Found error/s on Resource Node Template metadata verification"); + if(! resourceToscaMetadataValidator) + status.add(false); + return status; } //--------------------------Service-------------------------------- - @Test() - public void validateServiceMetadata() throws Exception{ - setLog(vnfFile); - SetupCDTest.getExtendTest().log(Status.INFO, "validateServiceMetadata " + vnfFile); + public List<Boolean> validateServiceMetadata(ToscaDefinition toscaMainServiceDefinition, ServiceReqDetails serviceReqDetails, Service service, String vnfFile, List<Boolean> status) throws Exception{ + reportStartTestPrint("validateServiceMetadata", vnfFile); Map<String, String> generateServiceMetadataToExpectedObject = generateServiceMetadataToExpectedObject(serviceReqDetails, service); Either<Boolean,Map<String, Object>> serviceToscaMetadataValidator = ToscaValidation.serviceToscaMetadataValidator(generateServiceMetadataToExpectedObject, toscaMainServiceDefinition); - Assert.assertFalse(!serviceToscaMetadataValidator.left().value().equals(true), "Found error/s on Service metadata verification"); + if(serviceToscaMetadataValidator.isRight()) + status.add(false); + return status; } - @Test() - public void validateServiceNodeTemplateMetadata() throws Exception{ - setLog(vnfFile); - SetupCDTest.getExtendTest().log(Status.INFO, "validateServiceNodeTemplateMetadata " + vnfFile); + public List<Boolean> validateServiceNodeTemplateMetadata(ToscaDefinition toscaMainServiceDefinition, ComponentInstance componentInstanceDefinition, ResourceReqDetails resourceReqDetails, Resource resource, String vnfFile, List<Boolean> status) throws Exception{ + reportStartTestPrint("validateServiceNodeTemplateMetadata", vnfFile); Map<String, String> generateServiceNodeTemplateMetadataToExpectedObject = generateServiceNodeTemplateMetadataToExpectedObject(resourceReqDetails, resource, componentInstanceDefinition); - Either<Boolean,Map<String, Object>> serviceToscaMetadataValidator = ToscaValidation.componentToscaNodeTemplateMetadataValidator(generateServiceNodeTemplateMetadataToExpectedObject, toscaMainServiceDefinition, componentInstanceDefinition.getName(), ComponentTypeEnum.SERVICE); - Assert.assertFalse(!serviceToscaMetadataValidator.left().value().equals(true), "Found error/s on Service Node Template metadata verification"); + Either<Boolean,Map<String, Object>> serviceToscaMetadataValidator = ToscaValidation.componentToscaNodeTemplateMetadataValidator(generateServiceNodeTemplateMetadataToExpectedObject, toscaMainServiceDefinition, componentInstanceDefinition.getName(), ComponentTypeEnum.SERVICE, componentInstanceDefinition.getName()); + if(serviceToscaMetadataValidator.isRight()) + status.add(false); + return status; } //--------------------------Service verification against Pavel Parser-------------------------------- - @Test() - public void validateServiceMetadataUsingParser() throws Exception{ - setLog(vnfFile); - SetupCDTest.getExtendTest().log(Status.INFO, "validateServiceMetadataUsingParser " + vnfFile); - Map<String, String> generateServiceMetadataToExpectedObject = generateServiceMetadataToExpectedObject(serviceReqDetails, service); - Metadata serviceMetadata = fdntCsarHelper.getServiceMetadata(); - Either<Boolean,Map<String, Object>> serviceToscaMetadataValidatorAgainstParser = ToscaValidation.serviceToscaMetadataValidatorAgainstParser(generateServiceMetadataToExpectedObject, serviceMetadata); - Assert.assertFalse(!serviceToscaMetadataValidatorAgainstParser.left().value().equals(true), "Found error/s on Service metadata verification"); + public List<Boolean> validateServiceMetadataUsingParser(ISdcCsarHelper fdntCsarHelper, ServiceReqDetails serviceReqDetails, Service service, String vnfFile, List<Boolean> status) throws Exception{ + if(fdntCsarHelper == null){ + reportSkipTestPrint("validateServiceMetadataUsingParser", status); + }else{ + reportStartTestPrint("validateServiceMetadataUsingParser", vnfFile); + Map<String, String> generateServiceMetadataToExpectedObject = generateServiceMetadataToExpectedObject(serviceReqDetails, service); + Metadata serviceMetadata = fdntCsarHelper.getServiceMetadata(); + Either<Boolean,Map<String, Object>> serviceToscaMetadataValidatorAgainstParser = ToscaValidation.serviceToscaMetadataValidatorAgainstParser(generateServiceMetadataToExpectedObject, serviceMetadata); + if(serviceToscaMetadataValidatorAgainstParser.isRight()) + status.add(false); + } + return status; } - @Test() - public void validateServiceNodeTemplateMetadataUsingParser() throws Exception{ - setLog(vnfFile); - SetupCDTest.getExtendTest().log(Status.INFO, "validateServiceMetadataUsingParser " + vnfFile); - Map<String, String> generateServiceNodeTemplateMetadataToExpectedObject = generateServiceNodeTemplateMetadataToExpectedObject(resourceReqDetails, resource, componentInstanceDefinition); - List<NodeTemplate> serviceNodeTemplates = fdntCsarHelper.getServiceNodeTemplates(); - Metadata serviceNodeTemplateMetadata = serviceNodeTemplates.get(0).getMetaData(); - Either<Boolean,Map<String, Object>> serviceNodeTemplateToscaMetadataValidatorAgainstParser = ToscaValidation.serviceToscaMetadataValidatorAgainstParser(generateServiceNodeTemplateMetadataToExpectedObject, serviceNodeTemplateMetadata); - Assert.assertFalse(!serviceNodeTemplateToscaMetadataValidatorAgainstParser.left().value().equals(true), "Found error/s on Service metadata verification"); + public List<Boolean> validateServiceNodeTemplateMetadataUsingParser(ISdcCsarHelper fdntCsarHelper, ResourceReqDetails resourceReqDetails,Resource resource, ComponentInstance componentInstanceDefinition, String vnfFile, List<Boolean> status) throws Exception{ + if(fdntCsarHelper == null){ + reportSkipTestPrint("validateServiceNodeTemplateMetadataUsingParser", status); + }else{ + reportStartTestPrint("validateServiceNodeTemplateMetadataUsingParser", vnfFile); + Map<String, String> generateServiceNodeTemplateMetadataToExpectedObject = generateServiceNodeTemplateMetadataToExpectedObject(resourceReqDetails, resource, componentInstanceDefinition); + List<NodeTemplate> serviceNodeTemplates = fdntCsarHelper.getServiceNodeTemplates(); + Metadata serviceNodeTemplateMetadata = serviceNodeTemplates.get(0).getMetaData(); + Either<Boolean,Map<String, Object>> serviceNodeTemplateToscaMetadataValidatorAgainstParser = ToscaValidation.serviceToscaMetadataValidatorAgainstParser(generateServiceNodeTemplateMetadataToExpectedObject, serviceNodeTemplateMetadata); + if(serviceNodeTemplateToscaMetadataValidatorAgainstParser.isRight()) + status.add(false); + } + return status; } @@ -218,13 +336,51 @@ public class ToscaValidationTest extends SetupCDTest{ //--------------------------Input verification-------------------------------- //--------------------------Resource-------------------------------- - + public List<Boolean> validateResourceInputs(ToscaDefinition toscaMainAmdocsDefinition, ToscaDefinition toscaMainVfDefinition, String vnfFile, List<Boolean> status) throws Exception{ + reportStartTestPrint("validateResourceInputs", vnfFile); + Map<String, ToscaInputsTopologyTemplateDefinition> expectedInputsMap = toscaMainAmdocsDefinition.getTopology_template().getInputs(); + Map<String, ToscaInputsTopologyTemplateDefinition> actualInputsMap = toscaMainVfDefinition.getTopology_template().getInputs(); + Either<Boolean,Map<String, Object>> toscaInputsValidator = ToscaValidation.toscaInputsValidator(expectedInputsMap, actualInputsMap); + if(toscaInputsValidator.isRight()) + status.add(false); + return status; + } //--------------------------Service-------------------------------- + public List<Boolean> validateServiceInputs(ToscaDefinition toscaExpectedMainServiceDefinition, ToscaDefinition toscaMainServiceDefinition, String vnfFile, List<Boolean> status) throws Exception{ + reportStartTestPrint("validateServiceInputs", vnfFile); + Map<String, ToscaInputsTopologyTemplateDefinition> expectedInputsMap = toscaExpectedMainServiceDefinition.getTopology_template().getInputs(); + Map<String, ToscaInputsTopologyTemplateDefinition> actualInputsMap = toscaMainServiceDefinition.getTopology_template().getInputs(); + Either<Boolean,Map<String, Object>> toscaInputsValidator = ToscaValidation.toscaInputsValidator(expectedInputsMap, actualInputsMap); + if(toscaInputsValidator.isRight()) + status.add(false); + return status; + } //--------------------------Service verification against Pavel Parser-------------------------------- + public List<Boolean> validateServiceInputsUsingParser(ISdcCsarHelper fdntCsarHelper, ToscaDefinition toscaExpectedMainServiceDefinition, String vnfFile, List<Boolean> status) throws Exception{ + if(fdntCsarHelper == null){ + reportSkipTestPrint("validateServiceInputsUsingParser", status); + }else{ + reportStartTestPrint("validateServiceInputsUsingParser", vnfFile); + Map<String, ToscaInputsTopologyTemplateDefinition> expectedInputsMap = toscaExpectedMainServiceDefinition.getTopology_template().getInputs(); + Either<Boolean,Map<String, Object>> toscaInputsValidator = ToscaValidation.toscaInputsValidatorAgainstParser(expectedInputsMap, fdntCsarHelper); + if(toscaInputsValidator.isRight()) + status.add(false); + } + return status; + } + //--------------------------XXX verification-------------------------------- + + //--------------------------Resource-------------------------------- + + + //--------------------------Service-------------------------------- + + + //--------------------------Service verification against Pavel Parser-------------------------------- @@ -239,6 +395,38 @@ public class ToscaValidationTest extends SetupCDTest{ } + public static ToscaDefinition addGenericInputsToToscaObject(ToscaDefinition toscaDefinition, String genericName) throws Exception { + Resource genericResource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, genericName, "1.0"); + ToscaTopologyTemplateDefinition topologyTemplate = toscaDefinition.getTopology_template(); + Map<String, ToscaInputsTopologyTemplateDefinition> newInput = new HashMap<String, ToscaInputsTopologyTemplateDefinition>(); + for (PropertyDefinition property : genericResource.getProperties()) { + ToscaInputsTopologyTemplateDefinition input = new ToscaInputsTopologyTemplateDefinition(); +// input.setConstraints(property.getConstraints()); + input.setDefault(property.getDefaultValue()); + input.setDescription(property.getDescription()); +// input.setEntry_schema(property.getSchema()); + input.setName(property.getName()); +// input.setRequired(property.get); + input.setStatus(property.getStatus()); + input.setType(property.getType()); + input.setValue(property.getValue()); + newInput.put(property.getName(),input); + } + + topologyTemplate.addInputs(newInput); + toscaDefinition.setTopology_template(topologyTemplate); + return toscaDefinition; + } + + public static ToscaDefinition setNameToToscaInput(ToscaDefinition toscaDefinition) { + Map<String, ToscaInputsTopologyTemplateDefinition> inputs = toscaDefinition.getTopology_template().getInputs(); + for (String name : inputs.keySet()) { + inputs.get(name).setName(name); + } + toscaDefinition.getTopology_template().setInputs(inputs); + return toscaDefinition; + } + public static ToscaDefinition addAndGenerateResourceMetadataToExpectedObject(ToscaDefinition toscaDefinition, ResourceReqDetails resourceReqDetails, Component component) { @@ -255,7 +443,7 @@ public class ToscaValidationTest extends SetupCDTest{ metadata.put(ToscaMetadataFieldsPresentationEnum.ToscaMetadataFieldsEnum.CATEGORY.value, resourceReqDetails.getCategories().get(0).getName()); metadata.put(ToscaMetadataFieldsPresentationEnum.ToscaMetadataFieldsEnum.DESCRIPTION.value, resourceReqDetails.getDescription()); metadata.put(ToscaMetadataFieldsPresentationEnum.ToscaMetadataFieldsEnum.INVARIANT_UUID.value, component.getInvariantUUID()); - metadata.put(ToscaMetadataFieldsPresentationEnum.ToscaMetadataFieldsEnum.TYPE.value, "VF"); + metadata.put(ToscaMetadataFieldsPresentationEnum.ToscaMetadataFieldsEnum.TYPE.value, resourceReqDetails.getResourceType()); metadata.put(ToscaMetadataFieldsPresentationEnum.ToscaMetadataFieldsEnum.UUID.value, component.getUUID()); metadata.put(ToscaMetadataFieldsPresentationEnum.ToscaMetadataFieldsEnum.NAME.value, component.getName()); @@ -329,6 +517,199 @@ public class ToscaValidationTest extends SetupCDTest{ return metadata; } - + public static void reportStartTestPrint (String testName, String vnfFile){ +// reportMessageInColor("info", "blue", "Running test \" + testName + \" with zip file - \" + vnfFile"); + SetupCDTest.getExtendTest().log(Status.INFO, "<html><font color=\"blue\"> Running test " + testName + " with zip file - " + vnfFile + "</font></html>"); + } + public static void reportSkipTestPrint (String testName, List<Boolean> status){ +// reportMessageInColor("error", "orange", "Skip test \" + testName + \" due to previous tosca parser error"); + SetupCDTest.getExtendTest().log(Status.ERROR, "<html><font color=\"orange\"> Skip test " + testName + " due to previous tosca parser error" + "</font></html>"); + status.add(false); + } + public static void reportMessageInColor(String status, String color, String message){ + String printLine = getReportMessageInColor(color, message); + SetupCDTest.getExtendTest().log(Status.valueOf(status), printLine); +// SetupCDTest.getExtendTest().log(Status.valueOf(status), getReportMessageInColor(color, message)); + } + /** + * @param color = red, green, orange, blue ... + * @param message - message string + * @return string in desired color + */ + public static String getReportMessageInColor(String color, String message){ + String returnValue = ("<html><font color=\\\"+color+\"\">" + message + "</font></html>").toString(); + return returnValue; + } + +/* @Test() + public void printTest(){ + System.out.println("print"); + reportMessageInColor("ERROR", "green", "green"); + reportMessageInColor("INFO", "orange", "orange"); + reportMessageInColor("INFO", "red", "red"); + }*/ + +/* @Test + public void allottedResourceModelTest() throws Exception{ + List<Boolean> status = new ArrayList<>(); + + List<String> fileNamesFromFolder = OnboardingUtils.getVnfNamesFileListExcludeToscaParserFailure(); + List<String> newRandomFileNamesFromFolder = OnbordingDataProviders.getRandomElements(1, fileNamesFromFolder); + String vnfFile = newRandomFileNamesFromFolder.get(0); + setLog(vnfFile); + String filePath = FileHandling.getVnfRepositoryPath(); + File filesFolder = new File(SetupCDTest.getWindowTest().getDownloadDirectory()); + + ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(ResourceCategoryEnum.ALLOTTED_RESOURCE_SERVICE_ADMIN); + resourceReqDetails = createCustomizedVsp(resourceReqDetails, filePath, vnfFile); + + ToscaDefinition toscaMainAmdocsDefinition = downloadAndGetToscaMainYamlObjectUI(resourceReqDetails, filesFolder); + toscaMainAmdocsDefinition = addGenericPropertiesToToscaDefinitionObject(toscaMainAmdocsDefinition, GENERIC_VF); + + Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails); + resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); + + ToscaDefinition toscaMainVfDefinition = downloadAndGetToscaMainYamlObjectApi(resource, filesFolder); + + status = validateVfMetadata(toscaMainAmdocsDefinition, toscaMainVfDefinition, resourceReqDetails, resource, vnfFile, status); + status = validateResourceNodeTemplateMetadata(toscaMainVfDefinition, resource, vnfFile, status); + status = validateResourceInputs(toscaMainAmdocsDefinition, toscaMainVfDefinition, vnfFile, status); + + if(status.contains(false)){ + SetupCDTest.getExtendTest().log(Status.FAIL, "Summary: allottedResourceModelTest tosca validation test failed with zip file " + vnfFile); + Assert.assertFalse(true); + } + } + + + + @Test() + public void NetworkModel() throws Exception{ +//--------------------------GENERAL-------------------------------- + String vnfFile = "networkModel"; + setLog(vnfFile); + List<Boolean> status = new ArrayList<>(); + ISdcCsarHelper fdntCsarHelper; + ToscaDefinition toscaMainAmdocsDefinition = new ToscaDefinition(); + File filesFolder = new File(SetupCDTest.getWindowTest().getDownloadDirectory()); +// filesFolder = new File(SetupCDTest.getWindowTest().getDownloadDirectory()); + + ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.PNF, user); + toscaMainAmdocsDefinition = addGenericPropertiesToToscaDefinitionObject(toscaMainAmdocsDefinition, GENERIC_PNF); + ToscaDefinition toscaExpectedMainServiceDefinition = new ToscaDefinition(toscaMainAmdocsDefinition); +//--------------------------VF-------------------------------- + Resource resource = AtomicOperationUtils.createResourceByResourceDetails(resourceReqDetails,UserRoleEnum.DESIGNER,true).left().value(); + resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); + + ToscaDefinition toscaMainVfDefinition = downloadAndGetToscaMainYamlObjectApi(resource, filesFolder); + +//--------------------------SERVICE-------------------------------- + ServiceReqDetails serviceReqDetails = ElementFactory.getDefaultService(); + Service service = AtomicOperationUtils.createCustomService(serviceReqDetails, UserRoleEnum.DESIGNER, true).left().value(); + + Either<ComponentInstance, RestResponse> addComponentInstanceToComponentContainer = AtomicOperationUtils.addComponentInstanceToComponentContainer(resource, service, UserRoleEnum.DESIGNER, true); + ComponentInstance componentInstanceDefinition = addComponentInstanceToComponentContainer.left().value(); + +//--------------------------getProperties set values and declare-------------------- + + Component componentObject = AtomicOperationUtils.getComponentObject(service, UserRoleEnum.DESIGNER); + Map<String, List<ComponentInstanceInput>> componentInstancesInputs = componentObject.getComponentInstancesInputs(); + setValuesToPropertiesList(componentInstancesInputs, toscaExpectedMainServiceDefinition); + PropertyRestUtils.declareProporties(componentObject, componentInstancesInputs, user); + + service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); + File ServiceCsarFileName = new File(File.separator + "ServiceCsar_" + ElementFactory.generateUUIDforSufix() + ".csar"); + OnboardingUtillViaApis.downloadToscaCsarToDirectory(service, new File(filesFolder.getPath() + ServiceCsarFileName)); + ToscaDefinition toscaMainServiceDefinition = ToscaParserUtils.parseToscaMainYamlToJavaObjectByCsarLocation(new File(filesFolder.getPath() + ServiceCsarFileName)); + +//--------------------------initialization of Tosca Parser-------------------------------- + + fdntCsarHelper = initSdcCsarHelper(ServiceCsarFileName, filesFolder); + + +//---------------------------TESTS-------------------------------------------------- + status = validateVfMetadata(toscaMainAmdocsDefinition, toscaMainVfDefinition, resourceReqDetails, resource, vnfFile, status); + status = validateResourceNodeTemplateMetadata(toscaMainVfDefinition, resource, vnfFile, status); + status = validateServiceMetadata(toscaMainServiceDefinition, serviceReqDetails, service, vnfFile, status); + status = validateServiceNodeTemplateMetadata(toscaMainServiceDefinition, componentInstanceDefinition, resourceReqDetails, resource, vnfFile, status); + status = validateServiceMetadataUsingParser(fdntCsarHelper, serviceReqDetails, service, vnfFile, status); + status = validateServiceNodeTemplateMetadataUsingParser(fdntCsarHelper, resourceReqDetails, resource, componentInstanceDefinition, vnfFile, status); + status = validateResourceInputs(toscaMainAmdocsDefinition, toscaMainVfDefinition, vnfFile, status); + status = validateServiceInputs(toscaExpectedMainServiceDefinition, toscaMainServiceDefinition, vnfFile, status); + status = validateServiceInputsUsingParser(fdntCsarHelper, toscaExpectedMainServiceDefinition, vnfFile, status); + + if(status.contains(false)){ + SetupCDTest.getExtendTest().log(Status.FAIL, "Summary: tosca validation test failed with zip file " + vnfFile); + Assert.assertFalse(true); + } + }*/ + + // help method to toscaValidation tests + private ISdcCsarHelper initSdcCsarHelper(File serviceCsarFileName, File filesFolder) { + + ISdcCsarHelper fdntCsarHelper; + try{ + SetupCDTest.getExtendTest().log(Status.INFO, "Tosca parser is going to convert service csar file to ISdcCsarHelper object..."); + fdntCsarHelper = factory.getSdcCsarHelper(filesFolder.getPath() + serviceCsarFileName); + }catch(Exception e){ + SetupCDTest.getExtendTest().log(Status.ERROR, "Tosca parser FAILED to convert service csar file to ISdcCsarHelper object..."); + SetupCDTest.getExtendTest().log(Status.FAIL, e); + fdntCsarHelper = null; + } + return fdntCsarHelper; + } + + + /** + * @param resourceReqDetails to create Vsp + * @return updated resourceReqDetails after Vsp was created + */ + private ResourceReqDetails createCustomizedVsp(ResourceReqDetails resourceReqDetails, String filePath, String vnfFile) throws Exception { + Pair<String, VendorSoftwareProductObject> createVendorSoftwareProduct = OnboardingUtillViaApis.createVspViaApis(resourceReqDetails, filePath, vnfFile, user); + VendorSoftwareProductObject vendorSoftwareProductObject = createVendorSoftwareProduct.right; + vendorSoftwareProductObject.setName(createVendorSoftwareProduct.left); + resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject); + return resourceReqDetails; + } + + /** + * @param resourceReqDetails to download csar file via UI + * @return Tosca definition object from main yaml file + */ + private ToscaDefinition downloadAndGetToscaMainYamlObjectUI(ResourceReqDetails resourceReqDetails, File filesFolder) throws Exception { + DownloadManager.downloadCsarByNameFromVSPRepository(resourceReqDetails.getName(), false); + File amdocsCsarFileName = FileHandling.getLastModifiedFileNameFromDir(filesFolder.getAbsolutePath()); + return ToscaParserUtils.parseToscaMainYamlToJavaObjectByCsarLocation(amdocsCsarFileName); + } + + /** + * @param toscaMainAmdocsDefinition object to add generic properties + * @param genericName resource name + * @return updated toscaMainAmdocsDefinition object + */ + private ToscaDefinition addGenericPropertiesToToscaDefinitionObject(ToscaDefinition toscaMainAmdocsDefinition, String genericName) throws Exception { + toscaMainAmdocsDefinition = setNameToToscaInput(toscaMainAmdocsDefinition); + toscaMainAmdocsDefinition = addGenericInputsToToscaObject(toscaMainAmdocsDefinition, genericName); + return toscaMainAmdocsDefinition; + } + + /** + * @param resource to download csar file via API + * @return Tosca definition object from main yaml file + */ + private ToscaDefinition downloadAndGetToscaMainYamlObjectApi(Resource resource, File filesFolder) throws Exception { + File VfCsarFileName = new File(File.separator + "VfCsar_" + ElementFactory.generateUUIDforSufix() + ".csar"); + OnboardingUtillViaApis.downloadToscaCsarToDirectory(resource, new File(filesFolder.getPath() + VfCsarFileName)); + return ToscaParserUtils.parseToscaMainYamlToJavaObjectByCsarLocation(new File(filesFolder.getPath() + VfCsarFileName)); + } + + /*public static void main(String[] args) { + ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); + List<CategoryDefinition> categories = resourceReqDetails.getCategories(); + System.out.println(categories); + }*/ + } + + @@ -46,12 +46,12 @@ import org.openecomp.sdc.ci.tests.pages.TesterOperationPage; import org.openecomp.sdc.ci.tests.utilities.DownloadManager; import org.openecomp.sdc.ci.tests.utilities.FileHandling; import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; -import org.openecomp.sdc.ci.tests.utilities.OnboardingUtils; +import org.openecomp.sdc.ci.tests.utilities.OnboardingUiUtils; import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils; import org.openecomp.sdc.ci.tests.utilities.RestCDUtils; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; +import org.openecomp.sdc.ci.tests.utils.general.OnboardingUtils; import org.openecomp.sdc.ci.tests.verificator.VFCArtifactVerificator; -import org.testng.SkipException; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; @@ -73,10 +73,6 @@ public class VFCArtifacts extends SetupCDTest { @Test public void ImportMultiVFCTest_TC1407998() throws Exception{ - if(true){ - throw new SkipException("Open bug 294400"); - } - String csarFile = "Import_Multi_VFC.csar"; ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString()); @@ -96,10 +92,6 @@ public class VFCArtifacts extends SetupCDTest { @Test public void updateCsarWithVFCArtifacts_ModifyArtifacts_TC1449482() throws Exception{ - if(true){ - throw new SkipException("Open bug 294400"); - } - String csarFile = "LDSA-ORIG.csar"; ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString()); resourceMetaData.setVersion("0.1"); @@ -125,10 +117,6 @@ public class VFCArtifacts extends SetupCDTest { @Test public void updateCsarWithVFCArtifacts_DeleteAndAddArtifacts_TC1449473() throws Exception{ - if(true){ - throw new SkipException("Open bug 294400"); - } - String csarFile = "LDSA-ORIG.csar"; ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString()); resourceMetaData.setVersion("0.1"); @@ -143,10 +131,6 @@ public class VFCArtifacts extends SetupCDTest { @Test public void updateCsarWithVFCArtifacts_AddFirstVFCIdentifier_TC1425896() throws Exception{ - if(true){ - throw new SkipException("Open bug 294400"); - } - String csarFile = "LDSA-ORIG-OLD_STRUCTURE.csar"; ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString()); resourceMetaData.setVersion("0.1"); @@ -172,10 +156,6 @@ public class VFCArtifacts extends SetupCDTest { @Test public void updateCsarWithVFCArtifacts_AddAdditionalVFCIdentifier_TC1425898() throws Exception{ - if(true){ - throw new SkipException("Open bug 294400"); - } - String csarFile = "LDSA-SINGLE.csar"; ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString()); resourceMetaData.setVersion("0.1"); @@ -210,6 +190,7 @@ public class VFCArtifacts extends SetupCDTest { @Test public void updateCsarWithVFCArtifacts_DeleteAll_TC1425581() throws Exception{ + String csarFile = "LDSA-ORIG.csar"; ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString()); resourceMetaData.setVersion("0.1"); @@ -232,30 +213,26 @@ public class VFCArtifacts extends SetupCDTest { @Test public void importComplexVFCArtifacts_Onboarding_TC1484153() throws Exception{ - if(true){ - throw new SkipException("Open bug 294400"); - } - ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser()); String vnfFile = "vProbes_FE.zip"; String snmpFile = "Fault-alarms-ASDC-vprobes-vLB.zip"; - AmdocsLicenseMembers amdocsLicenseMembers = OnboardingUtils.createVendorLicense(getUser()); - Pair<String, Map<String, String>> createVSP = OnboardingUtils.createVSP(vnfFile, filePath, getUser(), amdocsLicenseMembers); + AmdocsLicenseMembers amdocsLicenseMembers = OnboardingUiUtils.createVendorLicense(getUser()); + Pair<String, Map<String, String>> createVSP = OnboardingUtils.createVSP(resourceMetaData, vnfFile, filePath, getUser(), amdocsLicenseMembers); String vspName = createVSP.left; resourceMetaData.setName(vspName); Map<String, String> resourceMeta = createVSP.right; String vspid = resourceMeta.get("vspId"); OnboardingUtils.addVFCArtifacts(filePath, snmpFile, null, vspid, getUser()); - OnboardingUtils.prepareVspForUse(getUser(), vspid); + OnboardingUtils.prepareVspForUse(getUser(), vspid, "0.1"); String downloadDirectory = getWindowTest().getDownloadDirectory(); String csarFile = vspid + ".csar"; DownloadManager.downloadCsarByNameFromVSPRepository(vspName, vspid); HomePage.showVspRepository(); - OnboardingUtils.importVSP(createVSP); + OnboardingUiUtils.importVSP(createVSP); resourceMetaData.setVersion("0.1"); verifyVfcArtifacts(downloadDirectory, csarFile, resourceMetaData, null); @@ -268,10 +245,6 @@ public class VFCArtifacts extends SetupCDTest { @Test public void updateComplexVFCArtifacts_AddRemove_Onboarding_TC1484185() throws Exception{ - if(true){ - throw new SkipException("Open bug 294400"); - } - //check of version is 1 ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser()); @@ -279,21 +252,21 @@ public class VFCArtifacts extends SetupCDTest { String snmpPollFile = "vprobes-vLB.zip"; String updatedSnmpPollFile = "vprobes-vLBAgent.zip"; - AmdocsLicenseMembers amdocsLicenseMembers = OnboardingUtils.createVendorLicense(getUser()); - Pair<String, Map<String, String>> createVSP = OnboardingUtils.createVSP(vnfFile, filePath, getUser(), amdocsLicenseMembers); + AmdocsLicenseMembers amdocsLicenseMembers = OnboardingUiUtils.createVendorLicense(getUser()); + Pair<String, Map<String, String>> createVSP = OnboardingUtils.createVSP(resourceMetaData, vnfFile, filePath, getUser(), amdocsLicenseMembers); String vspName = createVSP.left; resourceMetaData.setName(vspName); Map<String, String> resourceMeta = createVSP.right; String vspid = resourceMeta.get("vspId"); String montoringComponentId = OnboardingUtils.addVFCArtifacts(filePath, snmpPollFile, null, vspid, getUser()); - OnboardingUtils.prepareVspForUse(getUser(), vspid); + OnboardingUiUtils.prepareVspForUse(getUser(), vspid, "0.1"); String downloadDirectory = getWindowTest().getDownloadDirectory(); String csarFile = vspid + ".csar"; DownloadManager.downloadCsarByNameFromVSPRepository(vspName, vspid); HomePage.showVspRepository(); - OnboardingUtils.importVSP(createVSP); + OnboardingUiUtils.importVSP(createVSP); ResourceGeneralPage.clickSubmitForTestingButton(vspName); @@ -302,10 +275,10 @@ public class VFCArtifacts extends SetupCDTest { TesterOperationPage.certifyComponent(vspName); reloginWithNewRole(UserRoleEnum.DESIGNER); - OnboardingUtils.updateVspWithVfcArtifacts(filePath, vspid, updatedSnmpPollFile, null, montoringComponentId, getUser()); + OnboardingUtils.updateVspWithVfcArtifacts(filePath, vspid, updatedSnmpPollFile, null, montoringComponentId, getUser(), "0.1"); DownloadManager.downloadCsarByNameFromVSPRepository(vspName, vspid); HomePage.showVspRepository(); - OnboardingUtils.updateVSP(createVSP); + OnboardingUiUtils.updateVSP(createVSP); resourceMetaData.setVersion("1.1"); ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen(); @@ -318,10 +291,6 @@ public class VFCArtifacts extends SetupCDTest { @Test public void updateComplexVFCArtifacts_Modify_Onboarding_TC1484195() throws Exception{ - if(true){ - throw new SkipException("Open bug 294400"); - } - //check of version is 2 ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser()); @@ -329,21 +298,21 @@ public class VFCArtifacts extends SetupCDTest { String snmpFile = "vprobes-vLB.zip"; String updatedSnmpFile = "vprobes-vLB-Modified.zip"; - AmdocsLicenseMembers amdocsLicenseMembers = OnboardingUtils.createVendorLicense(getUser()); - Pair<String, Map<String, String>> createVSP = OnboardingUtils.createVSP(vnfFile, filePath, getUser(), amdocsLicenseMembers); + AmdocsLicenseMembers amdocsLicenseMembers = OnboardingUiUtils.createVendorLicense(getUser()); + Pair<String, Map<String, String>> createVSP = OnboardingUtils.createVSP(resourceMetaData, vnfFile, filePath, getUser(), amdocsLicenseMembers); String vspName = createVSP.left; resourceMetaData.setName(vspName); Map<String, String> resourceMeta = createVSP.right; String vspid = resourceMeta.get("vspId"); String monitoringId = OnboardingUtils.addVFCArtifacts(filePath, snmpFile, null, vspid, getUser()); - OnboardingUtils.prepareVspForUse(getUser(), vspid); + OnboardingUiUtils.prepareVspForUse(getUser(), vspid, "0.1"); String downloadDirectory = getWindowTest().getDownloadDirectory(); String csarFile = vspid + ".csar"; DownloadManager.downloadCsarByNameFromVSPRepository(vspName, vspid); HomePage.showVspRepository(); - OnboardingUtils.importVSP(createVSP); + OnboardingUiUtils.importVSP(createVSP); Map<String, Object> artifactsFromCsar = ArtifactFromCsar.getVFCArtifacts(downloadDirectory + csarFile); List<String> vfcKeys = artifactsFromCsar.keySet().stream().filter(p -> p.contains("vfc")).collect(Collectors.toList()); @@ -359,10 +328,10 @@ public class VFCArtifacts extends SetupCDTest { TesterOperationPage.certifyComponent(vspName); reloginWithNewRole(UserRoleEnum.DESIGNER); - OnboardingUtils.updateVspWithVfcArtifacts(filePath, vspid, updatedSnmpFile, null, monitoringId, getUser()); + OnboardingUtils.updateVspWithVfcArtifacts(filePath, vspid, updatedSnmpFile, null, monitoringId, getUser(), "0.1"); DownloadManager.downloadCsarByNameFromVSPRepository(vspName, vspid); HomePage.showVspRepository(); - OnboardingUtils.updateVSP(createVSP); + OnboardingUiUtils.updateVSP(createVSP); resourceMetaData.setVersion("1.1"); ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen(); @@ -378,12 +347,6 @@ public class VFCArtifacts extends SetupCDTest { } - - - - - - @Override protected UserRoleEnum getRole() { return UserRoleEnum.DESIGNER; @@ -391,6 +354,7 @@ public class VFCArtifacts extends SetupCDTest { private Map<String, LinkedList<HeatMetaFirstLevelDefinition>> verifyVfcArtifacts(String filepath, String csarFile, ResourceReqDetails resourceMetaData, RestResponse getResponse) throws Exception { + ExtentTestActions.log(Status.INFO, "Verifying VFC artifacts"); Map<String, LinkedList<HeatMetaFirstLevelDefinition>> expectedArtifactMap = null; ExtentTestActions.log(Status.INFO, "Reading artifacts in CSAR file"); @@ -408,7 +372,7 @@ public class VFCArtifacts extends SetupCDTest { Map<String, LinkedList<HeatMetaFirstLevelDefinition>> expectedArtifactMap; Map<String,LinkedList<HeatMetaFirstLevelDefinition>> vfcDeploymentArtifacts = (Map<String,LinkedList<HeatMetaFirstLevelDefinition>>)artifactsFromCsar.get(key); LinkedList<HeatMetaFirstLevelDefinition> deploymentList = vfcDeploymentArtifacts.get(DEPLOYMENT); - LinkedList<HeatMetaFirstLevelDefinition> informationalList = (LinkedList<HeatMetaFirstLevelDefinition>) artifactsFromCsar.get(INFORMATIONAL); + LinkedList<HeatMetaFirstLevelDefinition> informationalList = (LinkedList<HeatMetaFirstLevelDefinition>) vfcDeploymentArtifacts.get(INFORMATIONAL); expectedArtifactMap = new HashMap<String, LinkedList<HeatMetaFirstLevelDefinition>>(); if(deploymentList == null){ @@ -422,7 +386,6 @@ public class VFCArtifacts extends SetupCDTest { expectedArtifactMap.put(ARTIFACTS, informationalList); } - VFCArtifactVerificator.verifyVfcArtifacts(resourceMetaData, getUser(), key, expectedArtifactMap, getResponse); return expectedArtifactMap; } @@ -63,10 +63,11 @@ import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaDefinition; import org.openecomp.sdc.ci.tests.utilities.ArtifactUIUtils; import org.openecomp.sdc.ci.tests.utilities.FileHandling; import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; -import org.openecomp.sdc.ci.tests.utilities.OnboardingUtils; +import org.openecomp.sdc.ci.tests.utilities.OnboardingUiUtils; import org.openecomp.sdc.ci.tests.utilities.PropertiesUIUtils; import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils; import org.openecomp.sdc.ci.tests.utilities.RestCDUtils; +import org.openecomp.sdc.ci.tests.utils.ToscaParserUtils; import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils; import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils; @@ -78,7 +79,6 @@ import org.openecomp.sdc.ci.tests.verificator.VfVerificator; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; import org.testng.AssertJUnit; -import org.testng.SkipException; import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; @@ -111,7 +111,7 @@ public class Vf extends SetupCDTest { // update Resource ResourceReqDetails updatedResource = new ResourceReqDetails(); - updatedResource.setName("ciUpdatedName"); + updatedResource.setName(ElementFactory.getResourcePrefix() + "UpdatedName" + resourceMetaData.getName()); updatedResource.setDescription("kuku"); updatedResource.setVendorName("updatedVendor"); updatedResource.setVendorRelease("updatedRelease"); @@ -646,8 +646,9 @@ public class Vf extends SetupCDTest { @Test public void exportToscaWithModulePropertiesVFTest() throws AWTException, Exception { - String vnfFile = "2016-042_vmsp_pxmc_30_1607_e2e.zip"; - Pair<String, Map<String, String>> vsp=OnboardingUtils.onboardAndValidate(FileHandling.getVnfRepositoryPath(), vnfFile, getUser()); + String vnfFile = "1-Vf-zrdm5bpxmc02-092017-(MOBILITY)_v2.0.zip"; + ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT); + Pair<String, Map<String, String>> vsp= OnboardingUiUtils.onboardAndValidate(resourceReqDetails, FileHandling.getVnfRepositoryPath(), vnfFile, getUser()); String vspName = vsp.left; ResourceGeneralPage.clickSubmitForTestingButton(vsp.left); Resource resource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, vspName, "0.1"); @@ -656,14 +657,17 @@ public class Vf extends SetupCDTest { @Test public void exportToscaWithModulePropertiesTemplateCheckVFTest() throws AWTException, Exception { - String vnfFile = "2016-042_vmsp_pxmc_30_1607_e2e.zip"; - OnboardingUtils.onboardAndValidate(FileHandling.getVnfRepositoryPath(), vnfFile, getUser()); + String vnfFile = "1-Vf-zrdm5bpxmc02-092017-(MOBILITY)_v2.0.zip"; + ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT); + OnboardingUiUtils.onboardAndValidate(resourceReqDetails, FileHandling.getVnfRepositoryPath(), vnfFile, getUser()); ResourceGeneralPage.getLeftMenu().moveToToscaArtifactsScreen(); GeneralUIUtils.clickOnElementByTestId(ToscaArtifactsScreenEnum.TOSCA_MODEL.getValue()); File latestFilefromDir = FileHandling.getLastModifiedFileNameFromDir(); - ToscaDefinition toscaDefinition = VfModuleVerificator.getToscaTemplate(latestFilefromDir.getAbsolutePath()); + ToscaDefinition toscaDefinition = ToscaParserUtils.parseToscaMainYamlToJavaObjectByCsarLocation(latestFilefromDir); VfModuleVerificator.validateSpecificModulePropertiesFromFile(toscaDefinition); } + + @Override protected UserRoleEnum getRole() { @@ -39,6 +39,7 @@ import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.CompositionScreenEnum; import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.StepsEnum; import org.openecomp.sdc.ci.tests.datatypes.HeatWithParametersDefinition; +import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions; @@ -50,9 +51,10 @@ import org.openecomp.sdc.ci.tests.utilities.ArtifactUIUtils; import org.openecomp.sdc.ci.tests.utilities.FileHandling; import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; import org.openecomp.sdc.ci.tests.utilities.HomeUtils; -import org.openecomp.sdc.ci.tests.utilities.OnboardingUtils; +import org.openecomp.sdc.ci.tests.utilities.OnboardingUiUtils; import org.openecomp.sdc.ci.tests.utils.Utils; import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils; +import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; import org.openqa.selenium.WebElement; import org.testng.SkipException; import org.testng.annotations.BeforeMethod; @@ -63,19 +65,29 @@ import com.aventstack.extentreports.Status; import com.clearspring.analytics.util.Pair; public class VfArtifacts extends SetupCDTest{ - + + public static final String VSAEGW_FDNT_30_1607_E2E_ZIP = "2016-043_vsaegw_fdnt_30_1607_e2e.zip"; + public static final String VFW_FCGI_30_1607_E2E_ZIP = "2016-044_vfw_fcgi_30_1607_e2e.zip"; + public static final String FDNT_UPDATE_HEAT_PARAMS_ZIP = "FDNT_UpdateHeatParams.zip"; + public static final String FDNT_WITHOUT_ENV_FILES_ZIP = "FDNT_WithoutEnvFiles.zip"; + public static final String VLANDSLIDE_LDSA_30_1607_E2E_ZIP = "2016-014_vlandslide_ldsa_30_1607_e2e.zip"; + public static final String VJSA_VJSA_30_1610_E2E_ZIP = "2016-209_vjsa_vjsa_30_1610_e2e.zip"; + public static final String VLB_LMSP_30_1607_E2E_ZIP = "2016-045_vlb_lmsp_30_1607_e2e.zip"; + public static final String MOBT_MOBT_30_1607_E2E_ZIP = "2016-109_mobt_mobt_30_1607_e2e.zip"; + public static final String MOBT_MOBT_30_1607_E2E_DIFFERENT_PARAMS_ZIP = "2016-109_mobt_mobt_30_1607_e2e_DifferentParams.zip"; + public static final String VMSP_PXMC_30_1607_E2E_ZIP = "2016-042_vmsp_pxmc_30_1607_e2e.zip"; + public static final String VFW_FNAT_30_1607_E2E_ZIP = "2016-044_vfw_fnat_30_1607_e2e.zip"; + public static final String VLANDSLIDE_LDST_30_1607_E2E_ZIP = "2016-014_vlandslide_ldst_30_1607_e2e.zip"; + public static final String VIXIA_IXLA_30_1607_E2E_ZIP = "2016-017_vixia_ixla_30_1607_e2e.zip"; private String filePath; private String vnfsRepositoryPath; - private String updatedVnfsRepositoryPath; private String createdEnvFilePath; private static final String PARAMETERS = "parameters"; @BeforeMethod public void beforeTest() throws FileNotFoundException{ filePath = getWindowTest().getDownloadDirectory(); - vnfsRepositoryPath = FileHandling.getVnfRepositoryPath(); -// vnfsRepositoryPath = FileHandling.getFilePath("Old_VNFs"); - updatedVnfsRepositoryPath = vnfsRepositoryPath + "UpdatedVNFs"; + vnfsRepositoryPath = FileHandling.getFilePath("VfArtifacts"); Config config = Utils.getConfig(); createdEnvFilePath = config.getWindowsDownloadDirectory(); } @@ -91,11 +103,11 @@ public class VfArtifacts extends SetupCDTest{ public Object[][] provideData() { return new Object[][] { - { "2016-043_vsaegw_fdnt_30_1607_e2e.zip", "FDNT_UpdateHeatParams.zip", "2", "2" }, // expected heat version 2 and heatEnv 2 - { "2016-043_vsaegw_fdnt_30_1607_e2e.zip", "FDNT_WithoutEnvFiles.zip", "1", "2" }, // expected heat version 1 and heatEnv 2 - { "2016-014_vlandslide_ldsa_30_1607_e2e.zip", "2016-209_vjsa_vjsa_30_1610_e2e.zip", "1", "1" }, // expected heat version 1 and heatEnv 1 - { "2016-045_vlb_lmsp_30_1607_e2e.zip", "2016-045_vlb_lmsp_30_1607_e2e.zip", "1", "2" }, // expected heat version 1 and heatEnv 2(DE270634) - { "2016-109_mobt_mobt_30_1607_e2e.zip", "2016-109_mobt_mobt_30_1607_e2e_DifferentParams.zip", "2", "2" } // expected heat version 2 and heatEnv 2 + { VSAEGW_FDNT_30_1607_E2E_ZIP, FDNT_UPDATE_HEAT_PARAMS_ZIP, "2", "2" }, // expected heat version 2 and heatEnv 2 + { VSAEGW_FDNT_30_1607_E2E_ZIP, FDNT_WITHOUT_ENV_FILES_ZIP, "1", "2" }, // expected heat version 1 and heatEnv 2 + {VLANDSLIDE_LDSA_30_1607_E2E_ZIP, VJSA_VJSA_30_1610_E2E_ZIP, "1", "1" }, // expected heat version 1 and heatEnv 1 + {VLB_LMSP_30_1607_E2E_ZIP, VLB_LMSP_30_1607_E2E_ZIP, "1", "2" }, // expected heat version 1 and heatEnv 2(DE270634) + {MOBT_MOBT_30_1607_E2E_ZIP, MOBT_MOBT_30_1607_E2E_DIFFERENT_PARAMS_ZIP, "2", "2" } // expected heat version 2 and heatEnv 2 }; } @@ -103,9 +115,10 @@ public class VfArtifacts extends SetupCDTest{ @Test public void uploadUpdatedHeatEnv() throws Exception{ - String vnfFile = "2016-042_vmsp_pxmc_30_1607_e2e.zip"; + String vnfFile = VMSP_PXMC_30_1607_E2E_ZIP; File updateEnvFile = null; - Pair<String,Map<String,String>> vsp = OnboardingUtils.onboardAndValidate(vnfsRepositoryPath, vnfFile, getUser()); + ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT); + Pair<String,Map<String,String>> vsp = OnboardingUiUtils.onboardAndValidate(resourceReqDetails, vnfsRepositoryPath, vnfFile, getUser()); String vspName = vsp.left; Resource resource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, vspName, "0.1"); Map<String, ArtifactDefinition> deploymentArtifacts = resource.getDeploymentArtifacts(); @@ -127,9 +140,10 @@ public class VfArtifacts extends SetupCDTest{ @Test public void uploadUpdatedAllHeatEnv() throws Exception{ - String vnfFile = "2016-044_vfw_fnat_30_1607_e2e.zip"; + String vnfFile = VFW_FNAT_30_1607_E2E_ZIP; File updateEnvFile = null; - Pair<String,Map<String,String>> vsp = OnboardingUtils.onboardAndValidate(vnfsRepositoryPath, vnfFile, getUser()); + ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT); + Pair<String,Map<String,String>> vsp = OnboardingUiUtils.onboardAndValidate(resourceReqDetails, vnfsRepositoryPath, vnfFile, getUser()); String vspName = vsp.left; Resource resource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, vspName, "0.1"); Map<String, ArtifactDefinition> deploymentArtifacts = resource.getDeploymentArtifacts(); @@ -150,9 +164,10 @@ public class VfArtifacts extends SetupCDTest{ @Test public void uploadUpdatedAllHeatEnvComposition() throws Exception{ - String vnfFile = "2016-014_vlandslide_ldst_30_1607_e2e.zip"; + String vnfFile = VLANDSLIDE_LDST_30_1607_E2E_ZIP; File updateEnvFile = null; - Pair<String,Map<String,String>> vsp = OnboardingUtils.onboardAndValidate(vnfsRepositoryPath, vnfFile, getUser()); + ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT); + Pair<String,Map<String,String>> vsp = OnboardingUiUtils.onboardAndValidate(resourceReqDetails, vnfsRepositoryPath, vnfFile, getUser()); String vspName = vsp.left; Resource resource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, vspName, "0.1"); Map<String, ArtifactDefinition> deploymentArtifacts = resource.getDeploymentArtifacts(); @@ -177,13 +192,14 @@ public class VfArtifacts extends SetupCDTest{ @Test // Download ENV file from VF level Update VSP. public void downloadEnvFromVFLevelUpdateVSP() throws Throwable { - String vnfFile = "2016-043_vsaegw_fdnt_30_1607_e2e.zip"; - String updatedVnfFile="2016-014_vlandslide_ldsa_30_1607_e2e.zip"; + String vnfFile = VSAEGW_FDNT_30_1607_E2E_ZIP; + String updatedVnfFile= VLANDSLIDE_LDSA_30_1607_E2E_ZIP; String downloadDirPath=SetupCDTest.getConfig().getWindowsDownloadDirectory(); - Pair<String, Map<String, String>> CreatedVsp=OnboardingUtils.onboardAndValidate(vnfsRepositoryPath, vnfFile, getUser()); + ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT); + Pair<String, Map<String, String>> CreatedVsp= OnboardingUiUtils.onboardAndValidate(resourceReqDetails, vnfsRepositoryPath, vnfFile, getUser()); String vspName = CreatedVsp.left; GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue()).click(); - OnboardingUtils.updateVnfAndValidate(vnfsRepositoryPath, CreatedVsp, updatedVnfFile, getUser()); + OnboardingUiUtils.updateVnfAndValidate(vnfsRepositoryPath, CreatedVsp, updatedVnfFile, getUser()); //get updated vsp env files Map<String, File> currentZipEnvfiles=ArtifactBusinessLogic.createEnvFilesListFromCsar(vspName, downloadDirPath); GeneralUIUtils.findComponentAndClick(vspName); @@ -203,11 +219,10 @@ public class VfArtifacts extends SetupCDTest{ @Test // Download ENV file from VF level Work-Space. public void downloadEnvFromVFLevelWorkSpace() throws AWTException, Exception { - String vnfFile = "2016-043_vsaegw_fdnt_30_1607_e2e.zip"; + String vnfFile = VSAEGW_FDNT_30_1607_E2E_ZIP; String downloadDirPath=SetupCDTest.getConfig().getWindowsDownloadDirectory(); - - Pair<String, Map<String, String>> vsp=OnboardingUtils.onboardAndValidate(FileHandling.getVnfRepositoryPath(), vnfFile, getUser()); - + ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT); + Pair<String, Map<String, String>> vsp= OnboardingUiUtils.onboardAndValidate(resourceReqDetails, vnfsRepositoryPath, vnfFile, getUser()); Map<String, File> currentZipEnvfiles=ArtifactBusinessLogic.createEnvFilesListFromCsar(vsp.left,downloadDirPath); GeneralUIUtils.findComponentAndClick(vsp.left); ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen(); @@ -229,9 +244,9 @@ public class VfArtifacts extends SetupCDTest{ public void downloadEnvVFLevelComposition() throws AWTException, Exception { String downloadDirPath=SetupCDTest.getConfig().getWindowsDownloadDirectory(); - String vnfFile = "2016-043_vsaegw_fdnt_30_1607_e2e.zip"; - - Pair<String, Map<String, String>> vsp=OnboardingUtils.onboardAndValidate(FileHandling.getVnfRepositoryPath(), vnfFile, getUser()); + String vnfFile = VSAEGW_FDNT_30_1607_E2E_ZIP; + ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT); + Pair<String, Map<String, String>> vsp= OnboardingUiUtils.onboardAndValidate(resourceReqDetails, vnfsRepositoryPath, vnfFile, getUser()); Map<String, File> currentZipEnvfiles=ArtifactBusinessLogic.createEnvFilesListFromCsar(vsp.left,downloadDirPath); GeneralUIUtils.findComponentAndClick(vsp.left); ResourceGeneralPage.getLeftMenu().moveToCompositionScreen(); @@ -253,10 +268,10 @@ public class VfArtifacts extends SetupCDTest{ // Download ENV file from VF level Update parameters in UI. public void downloadEnvVFLevelUpdateParameters() throws AWTException, Exception { - String vnfFile = "2016-044_vfw_fcgi_30_1607_e2e.zip"; + String vnfFile = VFW_FCGI_30_1607_E2E_ZIP; String downloadDirPath=SetupCDTest.getConfig().getWindowsDownloadDirectory(); - Pair<String, Map<String, String>> CreatedVsp=OnboardingUtils.onboardAndValidate(FileHandling.getVnfRepositoryPath(), vnfFile, getUser()); - + ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT); + Pair<String, Map<String, String>> CreatedVsp= OnboardingUiUtils.onboardAndValidate(resourceReqDetails, vnfsRepositoryPath, vnfFile, getUser()); Resource resource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, CreatedVsp.left, "0.1"); Map<String, ArtifactDefinition> deploymentArtifacts = resource.getDeploymentArtifacts(); List<HeatWithParametersDefinition> envFilesList = ArtifactBusinessLogic.extractHeatWithParametersDefinition(deploymentArtifacts); @@ -298,8 +313,9 @@ public class VfArtifacts extends SetupCDTest{ @Test public void checkDefaultCreatedEnvArtifacts() throws Exception{ - String vnfFile = "2016-017_vixia_ixla_30_1607_e2e.zip"; - Pair<String,Map<String,String>> vsp = OnboardingUtils.onboardAndValidate(vnfsRepositoryPath, vnfFile, getUser()); + String vnfFile = VIXIA_IXLA_30_1607_E2E_ZIP; + ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT); + Pair<String,Map<String,String>> vsp = OnboardingUiUtils.onboardAndValidate(resourceReqDetails, vnfsRepositoryPath, vnfFile, getUser()); String vspName = vsp.left; Map<String, File> generatedEnvFileList = ArtifactBusinessLogic.createEnvFilesListFromCsar(vspName, filePath); HomeUtils.findComponentAndClick(vspName); @@ -319,12 +335,12 @@ public class VfArtifacts extends SetupCDTest{ @Test(dataProvider = "heatEnvAndVersion") public void checkDefaultCreatedEnvArtifactsAfterVspUpdate(String vnfFile, String updatedVnfFile, String expectedHeatVersion, String expectedHeatEnvVersion) throws Throwable{ String stringForLog = String.format("%s:%s:%s:%s", vnfFile, updatedVnfFile, expectedHeatVersion, expectedHeatEnvVersion); - setLog(stringForLog); - - Pair<String,Map<String,String>> vsp = OnboardingUtils.onboardAndValidate(vnfsRepositoryPath, vnfFile, getUser()); + setLog(stringForLog); + ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT); + Pair<String,Map<String,String>> vsp = OnboardingUiUtils.onboardAndValidate(resourceReqDetails, vnfsRepositoryPath, vnfFile, getUser()); String vspName = vsp.left; GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue()).click(); - OnboardingUtils.updateVnfAndValidate(updatedVnfsRepositoryPath, vsp, updatedVnfFile, getUser()); + OnboardingUiUtils.updateVnfAndValidate(vnfsRepositoryPath, vsp, updatedVnfFile, getUser()); Map<String, File> generatedUpdatedEnvFileList = ArtifactBusinessLogic.createEnvFilesListFromCsar(vspName, filePath); HomeUtils.findComponentAndClick(vspName); GeneralUIUtils.moveToStep(StepsEnum.DEPLOYMENT_ARTIFACT); @@ -332,26 +348,27 @@ public class VfArtifacts extends SetupCDTest{ // TODO test will pass on case all objects on deployment view are visible GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ArtifactPageEnum.DOWNLOAD_ARTIFACT_ENV.getValue()+envFileEntry.getKey()); ArtifactUIUtils.compareYamlFilesByPattern(envFileEntry.getValue(), FileHandling.getLastModifiedFileNameFromDir(), PARAMETERS); - if(true){ - throw new SkipException("Test skipped, new artifact version design should be developed"); - } - ArtifactUIUtils.validateArtifactVersionByTypeAndLabel(envFileEntry.getKey(), expectedHeatEnvVersion, ArtifactTypeEnum.HEAT_ENV); - ArtifactUIUtils.validateArtifactVersionByTypeAndLabel(envFileEntry.getKey(), expectedHeatVersion, ArtifactTypeEnum.HEAT); +// ArtifactUIUtils.validateArtifactVersionByTypeAndLabel(envFileEntry.getKey(), expectedHeatEnvVersion, ArtifactTypeEnum.HEAT_ENV); +// ArtifactUIUtils.validateArtifactVersionByTypeAndLabel(envFileEntry.getKey(), expectedHeatVersion, ArtifactTypeEnum.HEAT); + } + if(true){ + throw new SkipException("Test skipped, new artifact version design should be developed"); } } // expected heat version 1 and heatEnv 3 @Test public void checkDefaultCreatedEnvArtifactsVspUpdatedWithSameVspTwice() throws Throwable{ - String vnfFile = "2016-044_vfw_fcgi_30_1607_e2e.zip"; - String updatedVnfFile = "2016-044_vfw_fcgi_30_1607_e2e.zip"; - Pair<String,Map<String,String>> vsp = OnboardingUtils.onboardAndValidate(vnfsRepositoryPath, vnfFile, getUser()); + String vnfFile = VFW_FCGI_30_1607_E2E_ZIP; + String updatedVnfFile = VFW_FCGI_30_1607_E2E_ZIP; + ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT); + Pair<String,Map<String,String>> vsp = OnboardingUiUtils.onboardAndValidate(resourceReqDetails, vnfsRepositoryPath, vnfFile, getUser()); String vspName = vsp.left; GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue()).click(); - OnboardingUtils.updateVnfAndValidate(vnfsRepositoryPath, vsp, updatedVnfFile, getUser()); + OnboardingUiUtils.updateVnfAndValidate(vnfsRepositoryPath, vsp, updatedVnfFile, getUser()); GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue()).click(); - OnboardingUtils.updateVnfAndValidate(vnfsRepositoryPath, vsp, updatedVnfFile, getUser()); + OnboardingUiUtils.updateVnfAndValidate(vnfsRepositoryPath, vsp, updatedVnfFile, getUser()); Map<String, File> generatedUpdatedSecondTimeEnvFileList = ArtifactBusinessLogic.createEnvFilesListFromCsar(vspName, filePath); HomeUtils.findComponentAndClick(vspName); GeneralUIUtils.moveToStep(StepsEnum.DEPLOYMENT_ARTIFACT); @@ -43,7 +43,6 @@ import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils; import org.openecomp.sdc.common.api.ArtifactTypeEnum; import org.openqa.selenium.WebElement; import org.testng.Assert; -import org.testng.SkipException; import org.testng.annotations.Test; @@ -94,11 +93,6 @@ public class VfDeploymentInformationalArtifacts extends SetupCDTest { // TC1434247 - Import VF Artifacts - Informational Artifacts - One Artifact, One Type @Test public void importVfArtifactsInformationalArtifactsOneArtifactOneType() throws Exception { - - if(true){ - throw new SkipException("Open bug 299719"); - } - String fileName = "TC1434247.csar"; String folder ="US825779"; @@ -116,11 +110,6 @@ public class VfDeploymentInformationalArtifacts extends SetupCDTest { // TC1434248 - Import VF Artifacts - Informational Artifacts - Multiple Artifacts, Multiple Types @Test public void importVfArtifactsInformationalArtifactsMultipleArtifactsMultipleTypes() throws Exception { - - if(true){ - throw new SkipException("Open bug 299719"); - } - String fileName = "TC1434248.csar"; String folder ="US825779"; @@ -140,11 +129,6 @@ public class VfDeploymentInformationalArtifacts extends SetupCDTest { // TC1434249 - Import VF Artifacts - Deployment and Informational Artifacts - Multiple Artifacts, Multiple Types @Test public void importVfArtifactsDeploymentAndInformationalArtifactsMultipleArtifactsMultipleTypes() throws Exception { - - if(true){ - throw new SkipException("Open bug 299719"); - } - String fileName = "TC1434249.csar"; String folder ="US825779"; @@ -171,11 +155,6 @@ public class VfDeploymentInformationalArtifacts extends SetupCDTest { // TC1438310 - Import VF Artifacts - Deployment Artifacts - Artifact Type Invalid @Test public void importVFArtifactsDeploymentArtifactsArtifactTypeInvalid() throws Exception { - - if(true){ - throw new SkipException("Open bug 299719"); - } - String fileName = "DeploymentArtifactWithInvalidType.csar"; String folder ="US825779"; @@ -191,11 +170,6 @@ public class VfDeploymentInformationalArtifacts extends SetupCDTest { // TC1438311 - Import VF Artifacts - Informational Artifacts - Artifact Type Invalid @Test public void importVfArtifactsInformationalArtifactsArtifactTypeInvalid() throws Exception { - - if(true){ - throw new SkipException("Open bug 299719"); - } - String fileName = "InformationArtifactWithInvalidType.csar"; String folder ="US825779"; @@ -335,11 +309,6 @@ public class VfDeploymentInformationalArtifacts extends SetupCDTest { // TC1443887 - Update With One New Informational Artifact @Test public void updateWithOneNewInformationalArtifact() throws Exception { - - if(true){ - throw new SkipException("Open bug 299719"); - } - String fileName = "ImportTC1443887.csar"; String folder ="US825779"; @@ -363,11 +332,6 @@ public class VfDeploymentInformationalArtifacts extends SetupCDTest { // TC1443888 - Update With One Removed Informational Artifact @Test public void updateWithOneRemovedInformationalArtifact() throws Exception { - - if(true){ - throw new SkipException("Open bug 299719"); - } - String folder ="US825779"; String fileName = "ImportTC1443888.csar"; @@ -397,11 +361,6 @@ public class VfDeploymentInformationalArtifacts extends SetupCDTest { // TC1443890 - Update With One New Artifact Version Informational Artifact @Test public void updateWithOneNewArtifactVersionInformationalArtifact() throws Exception { - - if(true){ - throw new SkipException("Open bug 299719"); - } - String folder ="US825779"; String fileName = "ImportTC1443890.csar"; @@ -426,12 +385,7 @@ public class VfDeploymentInformationalArtifacts extends SetupCDTest { // US825779 - Story: [BE] Import VSP - VF informational artifacts - Update // TC1443893 - Update CSAR With Same Artifacts As Imported @Test - public void updateCSARWithSameArtifactsAsImported() throws Exception { - - if(true){ - throw new SkipException("Open bug 299719"); - } - + public void updateCSARWithSameArtifactsAsImported() throws Exception { String folder ="US825779"; String fileName = "ImportUpdateTC1443893.csar"; @@ -462,11 +416,6 @@ public class VfDeploymentInformationalArtifacts extends SetupCDTest { // TC1443954 - Update With Multiple Changes In Deployment And Informational Artifacts @Test public void updateWithMultipleChangesInDeploymentAndInformationalArtifacts() throws Exception { - - if(true){ - throw new SkipException("Open bug 299719"); - } - String folder ="US825779"; String fileName = "ImportTC1443954.csar"; @@ -560,11 +509,6 @@ public class VfDeploymentInformationalArtifacts extends SetupCDTest { // TC1444207 - Update With Existed Informational Artifact By Artifact With Different Type @Test public void updateWithExistedInformationalArtifactByArtifactWithDifferentType() throws Exception { - - if(true){ - throw new SkipException("Open bug 299719"); - } - String folder ="US825779"; String fileName = "ImportTC1444207.csar"; @@ -667,11 +611,7 @@ public class VfDeploymentInformationalArtifacts extends SetupCDTest { // TC1444530 - Update Deployment Artifact With Invalid Type @Test public void updateDeploymentArtifactWithInvalidType() throws Exception { - - if(true){ - throw new SkipException("Open bug 299719"); - } - + String folder ="US825779"; String fileName = "ImportTC1444530.csar"; @@ -694,12 +634,7 @@ public class VfDeploymentInformationalArtifacts extends SetupCDTest { // US825779 - Story: [BE] Import VSP - VF informational artifacts - Update // TC1444531 - Update Informational Artifact With Invalid Type @Test - public void updateInformationalArtifactWithInvalidType() throws Exception { - - if(true){ - throw new SkipException("Open bug 299719"); - } - + public void updateInformationalArtifactWithInvalidType() throws Exception { String folder ="US825779"; String fileName = "ImportTC1444531.csar"; @@ -24,7 +24,6 @@ import java.io.BufferedOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; -import java.io.InputStream; import java.io.OutputStream; import java.text.DateFormat; import java.text.SimpleDateFormat; @@ -35,8 +34,6 @@ import java.util.Date; import java.util.List; import java.util.stream.Collectors; -import org.apache.commons.io.output.ByteArrayOutputStream; -import org.apache.commons.net.ftp.FTP; import org.apache.commons.net.ftp.FTPClient; import org.apache.commons.net.ftp.FTPFile; import org.apache.commons.net.ftp.FTPReply; @@ -205,7 +202,6 @@ public class AttFtpClient { try { deleted = apacheFtpClient.deleteFile(file.getName()); } catch (IOException e) { - // TODO Auto-generated catch block e.printStackTrace(); } @@ -37,8 +37,6 @@ import org.openecomp.sdc.ci.tests.utilities.FileHandling; import org.openecomp.sdc.ci.tests.utils.Utils; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxProfile; -import org.testng.ITestContext; -import org.testng.ITestResult; import org.testng.annotations.AfterSuite; import org.testng.annotations.BeforeSuite; @@ -59,7 +57,10 @@ public class DriverFactory { @BeforeSuite(alwaysRun = true) public static void instantiateDriverObject() { - + + // Selenium 3.4.0 change, location of gecko driver, set system property +// System.setProperty("webdriver.gecko.driver","C:\\Gekko18\\geckodriver-v0.18.0-win64\\geckodriver.exe"); //change for 3.4.0, gecko driver location + // End of Selenium 3.4.0 change File basePath = new File(FileHandling.getBasePath()); File[] listFiles = basePath.listFiles(new FilenameFilter() { @@ -24,6 +24,7 @@ import java.io.File; import java.io.IOException; import java.util.UUID; +import org.openecomp.sdc.ci.tests.api.SomeInterface; import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; import com.aventstack.extentreports.ExtentTest; @@ -35,13 +36,15 @@ import com.aventstack.extentreports.markuputils.MarkupHelper; public class ExtentTestActions { + public static SomeInterface testManager = new ExtentTestManager(); + public static void log(Status logStatus, Markup mark){ - ExtentTest test = ExtentTestManager.getTest(); + ExtentTest test = testManager.getTest(); test.log(logStatus, mark); } public static void log(Status logStatus, String message){ - ExtentTest test = ExtentTestManager.getTest(); + ExtentTest test = testManager.getTest(); test.log(logStatus, message); } @@ -50,7 +53,7 @@ public class ExtentTestActions { } public static void log(Status logStatus, Throwable throwabel){ - ExtentTest test = ExtentTestManager.getTest(); + ExtentTest test = testManager.getTest(); test.log(logStatus, throwabel); } @@ -90,7 +93,7 @@ public class ExtentTestActions { e.printStackTrace(); } - ExtentTest test = ExtentTestManager.getTest(); + ExtentTest test = testManager.getTest(); test.log(logStatus, message, MediaEntityBuilder.createScreenCaptureFromPath(imageFilePath).build()); return imageFilePath; } @@ -22,15 +22,22 @@ package org.openecomp.sdc.ci.tests.execute.setup; import java.util.HashMap; +import org.openecomp.sdc.ci.tests.api.SomeInterface; + import com.aventstack.extentreports.ExtentReports; import com.aventstack.extentreports.ExtentTest; -public class ExtentTestManager { +public class ExtentTestManager implements SomeInterface{ private static HashMap<Long, ExtentTest> extentTestMap = new HashMap<Long, ExtentTest>(); private static ExtentReports extent = ExtentManager.getReporter(); - - public static synchronized ExtentTest getTest() { + + public ExtentTestManager(){ + + } + + @Override + public synchronized ExtentTest getTest() { return extentTestMap.get(Thread.currentThread().getId()); } @@ -54,7 +61,7 @@ public class ExtentTestManager { String[] parts = clazz.getName().split("\\."); String lastOne1 = parts[parts.length-1]; String lastOne2 = parts[parts.length-2]; - getTest().assignCategory(lastOne2 + "-" + lastOne1); + extentTestMap.get(Thread.currentThread().getId()).assignCategory(lastOne2 + "-" + lastOne1); } } @@ -27,11 +27,9 @@ import java.net.SocketAddress; import java.net.URI; import java.util.HashMap; import java.util.List; -import java.util.stream.Collectors; import org.slf4j.LoggerFactory; -import com.aventstack.extentreports.ExtentTest; import com.github.markusbernhardt.proxy.ProxySearch; import com.github.markusbernhardt.proxy.ProxySearch.Strategy; import com.github.markusbernhardt.proxy.util.PlatformUtil; @@ -20,10 +20,8 @@ package org.openecomp.sdc.ci.tests.execute.setup; -import org.testng.Assert; import org.testng.IRetryAnalyzer; import org.testng.ITestResult; -import org.testng.annotations.Test; public class Retry implements IRetryAnalyzer { private int retryCount = 0; @@ -26,15 +26,10 @@ import java.io.IOException; import java.util.Arrays; import java.util.Map; import java.util.UUID; -import java.util.logging.FileHandler; -import java.util.logging.Handler; -import java.util.logging.LogManager; -import java.util.logging.Logger; import org.json.simple.JSONObject; -import org.littleshoot.proxy.impl.ClientToProxyConnection; -import org.littleshoot.proxy.impl.ProxyToServerConnection; import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.ci.tests.api.SomeInterface; import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; import org.openecomp.sdc.ci.tests.datatypes.UserCredentials; import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; @@ -60,16 +55,15 @@ import org.testng.annotations.AfterMethod; import org.testng.annotations.AfterSuite; import org.testng.annotations.BeforeMethod; import org.testng.annotations.BeforeSuite; +import org.testng.annotations.Optional; +import org.testng.annotations.Parameters; import org.testng.annotations.Test; -import com.aventstack.extentreports.ExtentReports; import com.aventstack.extentreports.ExtentTest; import com.aventstack.extentreports.Status; import ch.qos.logback.classic.Level; import ch.qos.logback.classic.LoggerContext; -import groovyjarjarantlr.Utils; -import net.lightbody.bmp.BrowserMobProxyServer; import net.lightbody.bmp.core.har.Har; public abstract class SetupCDTest extends DriverFactory { @@ -107,7 +101,8 @@ public abstract class SetupCDTest extends DriverFactory { /**************** METHODS ****************/ public static ExtentTest getExtendTest() { - return ExtentTestManager.getTest(); + SomeInterface testManager = new ExtentTestManager(); + return testManager.getTest(); } public static WindowTest getWindowTest(){ return WindowTestManager.getWindowMap(); @@ -230,7 +225,7 @@ public abstract class SetupCDTest extends DriverFactory { } public void addResultToCSV(ITestResult result, ITestContext context) { String suiteName = ExtentManager.getSuiteName(context); - ExtentTest test = ExtentTestManager.getTest(); + ExtentTest test = getExtendTest(); com.aventstack.extentreports.model.Test model = test.getModel(); String name = model.getName(); String status = model.getStatus().toString(); @@ -268,15 +263,19 @@ public abstract class SetupCDTest extends DriverFactory { } - - @AfterSuite(alwaysRun = true) - - public void afterSuite2() throws Exception { + @Parameters({ "eraseAfterTests" }) + @AfterSuite(alwaysRun = true) + public void afterSuite2(@Optional("true") String eraseAfterTestsReadValue) throws Exception { // public void afterSuite() throws Exception { csvReport.closeFile(); generateReport4Jenkins(myContext); - RestCDUtils.deleteOnDemand(); + + if (Boolean.parseBoolean(eraseAfterTestsReadValue)){ + RestCDUtils.deleteOnDemand(); + } else { + System.out.println("Resources will not be deleted according to suite configuration ..."); + } if (getConfig().getUseBrowserMobProxy()){ MobProxy.getPoxyServer().stop(); @@ -506,7 +505,7 @@ public abstract class SetupCDTest extends DriverFactory { navigateAndLogin(role); } - public static void setLocalUrl(UserRoleEnum role) { + /*public static void setLocalUrl(UserRoleEnum role) { switch (role) { case ADMIN: { url = "http://localhost:8181/sdc1/proxy-admin1#/dashboard"; @@ -548,7 +547,7 @@ public abstract class SetupCDTest extends DriverFactory { break; } } - } + }*/ public void addTrafficFileToReport(ITestResult result) { try { @@ -600,8 +599,8 @@ public abstract class SetupCDTest extends DriverFactory { System.out.println("attsdc.yaml file path is : " + attsdcFilePath); String filepath = FileHandling.getBasePath() + File.separator + "Files" + File.separator; - System.setProperty("filepath", filepath); - System.out.println("filepath is : " + System.getProperty("filepath")); + System.setProperty("filePath", filepath); + System.out.println("filePath is : " + System.getProperty("filePath")); Object[] testSuitsList = FileHandling.filterFileNamesFromFolder(FileHandling.getBasePath() + File.separator + "testSuites", ".xml"); if (testSuitsList != null) { @@ -21,17 +21,16 @@ package org.openecomp.sdc.ci.tests.execute.setup; import java.io.File; -import java.io.FileNotFoundException; import java.net.MalformedURLException; import java.net.URL; import java.util.UUID; import org.openecomp.sdc.ci.tests.config.Config; import org.openecomp.sdc.ci.tests.utilities.FileHandling; -import org.openecomp.sdc.ci.tests.utils.Utils; import org.openqa.selenium.Platform; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; +//import org.openqa.selenium.firefox.FirefoxOptions; // Selenium 3.4.0 change import org.openqa.selenium.firefox.FirefoxProfile; import org.openqa.selenium.remote.CapabilityType; import org.openqa.selenium.remote.DesiredCapabilities; @@ -74,6 +73,13 @@ public class WebDriverThread { if (mobProxyStatus){ setWebDriverWithMobProxy(); } else { + + // Selenium 3.4.0 change, add firefox options : set, add firefox 5.X location and enable +// FirefoxOptions options = new FirefoxOptions(); +// options.setBinary("C:\\Program Files (x86)\\Mozilla Firefox5\\firefox.exe"); //Location where Firefox is installed +// options.addPreference("dom.file.createInChild", true); // Enable file upload with sendKeys + // End of Selenium 3.4.0 change + System.out.println("Opening LOCAL browser"); DesiredCapabilities cap = new DesiredCapabilities(); @@ -81,6 +87,8 @@ public class WebDriverThread { cap.setBrowserName("firefox"); cap.setCapability(FirefoxDriver.PROFILE, initFirefoxProfile()); +// cap.setCapability("moz:firefoxOptions", options); //Add options to Capabilities, Selenium 3.4.0 change + firefoxProfile.setPreference("network.proxy.type", 2); firefoxProfile.setPreference("network.proxy.autoconfig_url", "http://emea-auto.proxy.att.com:8001/"); firefoxProfile.setPreference("network.proxy.no_proxies_on", "localhost"); @@ -22,8 +22,6 @@ package org.openecomp.sdc.ci.tests.execute.setup; import java.util.HashMap; -import com.aventstack.extentreports.ExtentTest; - public class WindowTestManager { private static HashMap<Long, WindowTest> windowMap = new HashMap<Long, WindowTest>(); @@ -109,6 +109,7 @@ public class DeploymentArtifactPage extends GeneralPageElements { } public static void clickOK(){ + SetupCDTest.getExtendTest().log(Status.INFO, "Artifact Page, Clicking OK"); GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPageEnum.OK.getValue()).click(); GeneralUIUtils.getWebElementBy(By.className("flex-container")); GeneralUIUtils.waitForAngular(); @@ -23,8 +23,6 @@ package org.openecomp.sdc.ci.tests.pages; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.stream.Collector; -import java.util.stream.Collectors; import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.DeploymentScreen; @@ -33,8 +31,6 @@ import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; -import static org.testng.Assert.assertTrue; - import com.aventstack.extentreports.Status; @@ -24,7 +24,6 @@ import java.io.File; import java.util.List; import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; -import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.MainMenuButtonsFromInsideFrame; import org.openecomp.sdc.ci.tests.utilities.DownloadManager; import org.openecomp.sdc.ci.tests.utilities.FileHandling; import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; @@ -0,0 +1,149 @@ +package org.openecomp.sdc.ci.tests.pages; + + +import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; +import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.PropertiesAssignmentScreen; +import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; +import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; +import org.openqa.selenium.WebElement; + +import com.aventstack.extentreports.Status; + +public class PropertiesAssignmentPage { + public static void clickOnInputTab(){ + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on Input Tab")); + GeneralUIUtils.clickOnElementByTestId(PropertiesAssignmentScreen.INPUTS_TAB.getValue()); + GeneralUIUtils.ultimateWait(); + } + + public static void clickOnPropertiesTab(){ + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on Properties Tab")); + GeneralUIUtils.clickOnElementByTestId(PropertiesAssignmentScreen.PROPERTIES_TAB.getValue()); + GeneralUIUtils.ultimateWait(); + } + + public static void clickOnCompositionRightTab(){ + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on Composition Right Tab")); + GeneralUIUtils.clickOnElementByTestId(PropertiesAssignmentScreen.COMPOSITION_TAB.getValue()); + GeneralUIUtils.ultimateWait(); + } + + public static void clickOnPropertyStructureRightTab(){ + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on Property Structure Right Tab")); + GeneralUIUtils.clickOnElementByTestId(PropertiesAssignmentScreen.PROPERTY_STRUCTURE_TAB.getValue()); + GeneralUIUtils.ultimateWait(); + } + + public static void clickOnDeclareButton(){ + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on Declare Button")); + GeneralUIUtils.clickOnElementByTestId(PropertiesAssignmentScreen.DECLARE_BUTTON.getValue()); + GeneralUIUtils.ultimateWait(); + } + + public static void findSearchBoxAndClick(String resourceName) throws Exception { + SetupCDTest.getExtendTest().log(Status.INFO, "Searching for " + resourceName + " in homepage"); + WebElement searchTextbox = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesAssignmentScreen.SEARCH_BOX.getValue()); + try{ + searchTextbox.clear(); + searchTextbox.sendKeys(resourceName); + GeneralUIUtils.ultimateWait(); + } + catch(Exception e){ + SetupCDTest.getExtendTest().log(Status.INFO, "Can't interact with search bar"); + e.printStackTrace(); + } + + + try{ + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on the %s component from home screen", resourceName)); + GeneralUIUtils.clickOnElementByTestId(resourceName); + GeneralUIUtils.ultimateWait(); + GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.GeneralElementsEnum.LIFECYCLE_STATE.getValue()); + } + catch(Exception e){ + SetupCDTest.getExtendTest().log(Status.INFO, "Can't click on component named " + resourceName); + e.printStackTrace(); + } + } + + public static void clickOnProperty(String propertyName) { + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on property %s ", propertyName)); + GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.InputsScreenService.RESOURCE_INSTANCE_PROPERTY_NAME.getValue() + propertyName); + GeneralUIUtils.ultimateWait(); + } + + public static void clickOnDeleteInputButton(){ + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on Delete Input Button")); + GeneralUIUtils.clickOnElementByTestId(PropertiesAssignmentScreen.INPUT_DELETE_BUTTON.getValue()); + GeneralUIUtils.ultimateWait(); + } + + public static void clickOnDeleteInputDialogConfirmationButton(){ + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on Delete Input Dialog Confirmation Button")); + GeneralUIUtils.clickOnElementByTestId(PropertiesAssignmentScreen.INPUT_DELETE_DIALOG_DELETE.getValue()); + GeneralUIUtils.ultimateWait(); + } + + public static void clickOnFilterAll() { + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on property %s ")); + GeneralUIUtils.clickOnElementByTestId(PropertiesAssignmentScreen.FILTER_CHECKBOX_ALL.getValue()); + GeneralUIUtils.ultimateWait(); + } + + public static void clickOnComponentInComposition(String resourceName) throws Exception{ + try{ + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on the %s component from properties composition", resourceName)); + GeneralUIUtils.clickOnElementByTestId(resourceName); + GeneralUIUtils.ultimateWait(); + GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.GeneralElementsEnum.LIFECYCLE_STATE.getValue()); + } + catch(Exception e){ + SetupCDTest.getExtendTest().log(Status.INFO, "Can't click on component named " + resourceName); + e.printStackTrace(); + } + } + + public static void findInput(String componentName, String resourceName) throws Exception { + SetupCDTest.getExtendTest().log(Status.INFO, "Searching for " + componentName + "_" + resourceName + " in homepage"); + WebElement searchTextbox = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesAssignmentScreen.SEARCH_BOX.getValue()); + String searchPattern = componentName + "_" + resourceName; + try{ + searchTextbox.clear(); + searchTextbox.sendKeys(searchPattern); + GeneralUIUtils.ultimateWait(); + } + catch(Exception e){ + SetupCDTest.getExtendTest().log(Status.INFO, "Can't interact with search bar"); + e.printStackTrace(); + } + + } + + public static void findProperty(String resourceName) throws Exception { + SetupCDTest.getExtendTest().log(Status.INFO, "Searching for " + resourceName + " in homepage"); + WebElement searchTextbox = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesAssignmentScreen.SEARCH_BOX.getValue()); + + try{ + searchTextbox.clear(); + searchTextbox.sendKeys(resourceName); + GeneralUIUtils.ultimateWait(); + } + catch(Exception e){ + SetupCDTest.getExtendTest().log(Status.INFO, "Can't interact with search bar"); + e.printStackTrace(); + } + + } + + public static Boolean isPropertyChecked(String resourceName){ +// TODO add better implementation for css string + GeneralUIUtils.ultimateWait(); + Boolean isDisabled = GeneralUIUtils.checkForDisabledAttributeInHiddenElement("checkbox[data-tests-id='" + resourceName + "'] input"); + if (isDisabled) + return true; + return false; + + } + + +} @@ -64,4 +64,8 @@ public class ResourceLeftMenu implements ComponentLeftMenu { public void moveToInputsScreen() { GeneralUIUtils.moveToStep(StepsEnum.INPUTS); } + + public void moveToPropertiesAssignmentScreen() { + GeneralUIUtils.moveToStep(StepsEnum.PROPERTIES_ASSIGNMENT); + } } @@ -28,7 +28,6 @@ import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.ui.Select; -import org.testng.TestException; import com.aventstack.extentreports.Status; @@ -20,8 +20,6 @@ package org.openecomp.sdc.ci.tests.utilities; -import java.util.concurrent.TimeUnit; - import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.WebDriver; import org.openqa.selenium.support.ui.ExpectedCondition; @@ -501,18 +501,18 @@ public final class ArtifactUIUtils { Map<String, Object> mapExpectedFile = FileHandling.parseYamlFileToMapByPattern(expectedFile, pattern); Map<String, Object> mapActualFile = FileHandling.parseYamlFileToMapByPattern(actualFile, pattern); - SetupCDTest.getExtendTest().log(Status.INFO, "Going to compare files ..."); + SetupCDTest.getExtendTest().log(Status.INFO, "Going to compare file " + expectedFile.getName()); assertTrue("File" + actualFile.getName() + " contains different parameters number from expected file", mapActualFile.size() == mapExpectedFile.size()); - assertTrue("File " + actualFile.getName() + " does not contains all expected parametrs", mapActualFile.entrySet().containsAll(mapExpectedFile.entrySet())); + assertTrue("File " + actualFile.getName() + " does not contains all expected parameters", mapActualFile.entrySet().containsAll(mapExpectedFile.entrySet())); } - public static void compareYamlParametersByPattern(Map<String, Object> mapExpectedproperties, File actualFileproperties, String pattern) throws Exception { + public static void compareYamlParametersByPattern(Map<String, Object> mapExpectedProperties, File actualFileProperties, String pattern) throws Exception { - Map<String, Object> mapActualFileProerties = FileHandling.parseYamlFileToMapByPattern(actualFileproperties, pattern); + Map<String, Object> mapActualFileProerties = FileHandling.parseYamlFileToMapByPattern(actualFileProperties, pattern); SetupCDTest.getExtendTest().log(Status.INFO, "Going to compare files ..."); - assertTrue("Actual file contains different parameters number from expected file", mapActualFileProerties.size() == mapExpectedproperties.size()); + assertTrue("Actual file contains different parameters number from expected file", mapActualFileProerties.size() == mapExpectedProperties.size()); Map<String, Object> newMap = new HashMap<>(mapActualFileProerties); - assertTrue("Actual file does not contains all expected parametrs", newMap.entrySet().containsAll(mapExpectedproperties.entrySet())); + assertTrue("Actual file does not contains all expected parameters", newMap.entrySet().containsAll(mapExpectedProperties.entrySet())); } @@ -1,179 +0,0 @@ -/*- - * ============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.ci.tests.utilities; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Random; -import java.util.UUID; -import java.util.stream.Collectors; - -import org.apache.commons.lang3.tuple.ImmutablePair; -import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.interactions.Actions; - -public final class CanvasManager { - private Map<String, CanvasElement> canvasElements; - private Actions actions; - private WebElement canvas; - private int reduceCanvasWidthFactor; - // Offsets Are used to find upper right corner of canvas element in order to - // connect links - private static final int CANVAS_ELEMENT_Y_OFFSET = 40; - private static final int CANVAS_ELEMENT_X_OFFSET = 21; // 14 - 27 - - private CanvasManager() { - canvasElements = new HashMap<>(); - actions = new Actions(GeneralUIUtils.getDriver()); - canvas = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.GeneralCanvasItems.CANVAS.getValue()); - try { - WebElement webElement = GeneralUIUtils - .getWebElementByTestID(DataTestIdEnum.GeneralCanvasItems.CANVAS_RIGHT_PANEL.getValue()); - reduceCanvasWidthFactor = webElement.getSize().width; - } catch (Exception e) { - reduceCanvasWidthFactor = 0; - } - } - - public static CanvasManager getCanvasManager() { - return new CanvasManager(); - } - - public List<CanvasElement> getCanvasElements() { - return canvasElements.values().stream().collect(Collectors.toList()); - } - - private void addCanvasElement(CanvasElement element) { - canvasElements.put(element.getUniqueId(), element); - } - - private void moveElementOnCanvas(CanvasElement canvasElement, ImmutablePair<Integer, Integer> newLocation) - throws Exception { - GeneralUIUtils.waitForLoader(); - Thread.sleep(500); - actions.moveToElement(canvas, canvasElement.getLocation().left, canvasElement.getLocation().right); - actions.clickAndHold(); - actions.moveToElement(canvas, newLocation.left, newLocation.right); - actions.release(); - actions.perform(); - canvasElement.setLocation(newLocation); - GeneralUIUtils.waitForLoader(); - - } - - public void moveElementOnCanvas(CanvasElement canvasElement) throws Exception { - moveElementOnCanvas(canvasElement, getFreePosition()); - } - - public void deleteElementFromCanvas(CanvasElement canvasElement) throws Exception { - GeneralUIUtils.waitForLoader(); - actions.moveToElement(canvas, canvasElement.getLocation().left, canvasElement.getLocation().right); - actions.click(); - actions.perform(); - GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.GeneralCanvasItems.DELETE_INSTANCE_BUTTON.getValue()) - .click(); - GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ModalItems.OK.getValue()).click(); - canvasElements.remove(canvasElement.getUniqueId()); - GeneralUIUtils.waitForLoader(); - } - - private String getItemName(WebElement canvasItem) { - String canvasItemName = canvasItem.getAttribute("data-tests-id"); - - return canvasItemName.substring(canvasItemName.lastIndexOf("-")); - } - - public CanvasElement createElementOnCanvas(WebElement canvasItem) throws Exception { - GeneralUIUtils.waitForLoader(); - ImmutablePair<Integer, Integer> freePosition = getFreePosition(); - actions.moveToElement(canvasItem, 0, 0); - actions.clickAndHold(); - actions.moveToElement(canvas, freePosition.left, freePosition.right); - actions.release(); - actions.perform(); - - String uniqueId = getItemName(canvasItem) + "_" + UUID.randomUUID().toString(); - CanvasElement canvasElement = new CanvasElement(uniqueId, freePosition, canvasItem); - addCanvasElement(canvasElement); - GeneralUIUtils.waitForLoader(); - return canvasElement; - } - - private ImmutablePair<Integer, Integer> getFreePosition() { - // TODO mshitrit use better method - ImmutablePair<Integer, Integer> randomPosition = null; - boolean freePosition = false; - int minSpace = 150; - while (!freePosition) { - ImmutablePair<Integer, Integer> tempRandomPosition = getRandomPosition(); - freePosition = !canvasElements.values().stream().map(e -> e.getLocation()) - .filter(e -> Math.abs(e.left - tempRandomPosition.left) < minSpace - && Math.abs(e.right - tempRandomPosition.right) < minSpace) - .findAny().isPresent(); - randomPosition = tempRandomPosition; - } - return randomPosition; - } - - private ImmutablePair<Integer, Integer> getRandomPosition() { - int edgeBuffer = 50; - Random random = new Random(); - int xElement = random.nextInt(canvas.getSize().width - 2 * edgeBuffer - reduceCanvasWidthFactor) + edgeBuffer; - int yElement = random.nextInt(canvas.getSize().height - 2 * edgeBuffer) + edgeBuffer; - return new ImmutablePair<Integer, Integer>(xElement, yElement); - } - - public void linkElements(CanvasElement firstElement, CanvasElement secondElement) throws Exception { - GeneralUIUtils.waitForLoader(); - drawSimpleLink(firstElement, secondElement); - - selectReqAndCapAndConnect(); - - GeneralUIUtils.waitForLoader(); - - } - - private void selectReqAndCapAndConnect() { - // Select First Cap - GeneralUIUtils.getWebElementsListByTestID(DataTestIdEnum.LinkMenuItems.LINK_ITEM_CAP.getValue()).get(0).click(); - // Select First Req - GeneralUIUtils.getWebElementsListByTestID(DataTestIdEnum.LinkMenuItems.LINK_ITEM_REQ.getValue()).get(0).click(); - // Connect - GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.LinkMenuItems.CONNECT_BUTTON.getValue()).click(); - } - - private void drawSimpleLink(CanvasElement firstElement, CanvasElement secondElement) { - - int yOffset = CANVAS_ELEMENT_Y_OFFSET; - int xOffset = CANVAS_ELEMENT_X_OFFSET; - - actions.moveToElement(canvas, firstElement.getLocation().left + xOffset, - firstElement.getLocation().right - yOffset); - - actions.clickAndHold(); - actions.moveToElement(canvas, secondElement.getLocation().left + xOffset, - secondElement.getLocation().right - yOffset); - actions.release(); - actions.perform(); - } -} @@ -27,10 +27,9 @@ import java.util.List; import org.codehaus.jettison.json.JSONArray; import org.codehaus.jettison.json.JSONException; -import org.openecomp.sdc.ci.tests.datatypes.TopMenuButtonsEnum; import org.openecomp.sdc.ci.tests.datatypes.CheckBoxStatusEnum; import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; -import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.CatalogPageLeftPanelFilterTitle; +import org.openecomp.sdc.ci.tests.datatypes.TopMenuButtonsEnum; import org.openecomp.sdc.ci.tests.datatypes.TypesEnum; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; @@ -68,7 +68,7 @@ public class DownloadManager { * @param vspName * @throws Exception */ - public static void downloadCsarByNameFromVSPRepository(String vspName, String vspId, Boolean isDelete) throws Exception{ + public static void downloadCsarByNameFromVSPRepository(String vspName, Boolean isDelete) throws Exception{ if(isDelete){ FileHandling.cleanCurrentDownloadDir(); @@ -78,21 +78,43 @@ public class DownloadManager { if (vspFound){ ExtentTestActions.log(Status.INFO, String.format("Going to downloading VSP %s", vspName)); List<WebElement> elemenetsFromTable = HomePage.getElemenetsFromTable(); + elemenetsFromTable.get(1).click(); + GeneralUIUtils.waitForLoader(); + GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ImportVfRepository.DOWNLOAD_CSAR.getValue()); + ExtentTestActions.log(Status.INFO, "Succeeded to downloaded CSAR file named " + vspName + " into folder " + SetupCDTest.getWindowTest().getDownloadDirectory()); + GeneralUIUtils.getElementsByCSS("div[class^='w-sdc-modal-close']").forEach(e -> e.click()); + GeneralUIUtils.ultimateWait(); + } + } + + + + /*public static void downloadCsarByNameFromVSPRepository(String vspName, String vspId, Boolean isDelete) throws Exception{ + + if(isDelete){ + FileHandling.cleanCurrentDownloadDir(); + } + HomePage.showVspRepository(); + boolean vspFound = HomePage.searchForVSP(vspName); + if (vspFound){ + ExtentTestActions.log(Status.INFO, String.format("Going to downloading VSP %s", vspName)); + List<WebElement> elemenetsFromTable = HomePage.getElemenetsFromTable(); // GeneralUIUtils.ultimateWait(); // WebDriverWait wait = new WebDriverWait(GeneralUIUtils.getDriver(), 5); // WebElement findElement = wait.until(ExpectedConditions.visibilityOf(elemenetsFromTable.get(1))); elemenetsFromTable.get(1).click(); // findElement.click(); GeneralUIUtils.waitForLoader(); - GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ImportVfRepository.DOWNLOAD_CSAR.getValue()); + GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ImportVfRepository.DOWNLOAD_CSAR.getValue()); ExtentTestActions.log(Status.INFO, "Succeeded to downloaded CSAR file named " + vspId + " into folder " + SetupCDTest.getWindowTest().getDownloadDirectory()); - GeneralUIUtils.getElementsByCSS("div[class^='w-sdc-modal-close']").forEach(e -> e.click()); - GeneralUIUtils.ultimateWait(); + GeneralUIUtils.getElementsByCSS("div[class^='w-sdc-modal-close']").forEach(e -> e.click()); + GeneralUIUtils.ultimateWait(); } - } - + }*/ + + public static void downloadCsarByNameFromVSPRepository(String vspName, String vspId) throws Exception{ - downloadCsarByNameFromVSPRepository(vspName, vspId, true); + downloadCsarByNameFromVSPRepository(vspName, true); } // AttFtpClient instance = AttFtpClient.getInstance(); @@ -26,7 +26,6 @@ import java.io.BufferedOutputStream; import java.io.BufferedWriter; import java.io.File; import java.io.FileInputStream; -import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.FileWriter; import java.io.FilenameFilter; @@ -47,7 +46,6 @@ import java.util.zip.ZipInputStream; import org.apache.commons.io.FileUtils; import org.openecomp.sdc.be.model.DataTypeDefinition; import org.openecomp.sdc.ci.tests.config.Config; -import org.openecomp.sdc.ci.tests.datatypes.enums.ErrorInfo; import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions; import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; import org.openecomp.sdc.common.util.GeneralUtility; @@ -63,7 +61,8 @@ public class FileHandling { Yaml yaml = new Yaml(); File file = new File(filePath); InputStream inputStream = new FileInputStream(file); - Map<?, ?> map = (Map<?, ?>) yaml.load(inputStream); + Map<?, ?> map = new HashMap<>(); + map = (Map<?, ?>) yaml.load(inputStream); return map; } @@ -99,19 +98,22 @@ public class FileHandling { } // ------------------------------------------------------------------------------------------------- + + /** + * @param folder, folder name under "Files" folder + * @return path to given folder from perspective of working directory or sdc-vnfs repository + */ public static String getFilePath(String folder) { - String filepath = System.getProperty("filepath"); - if (filepath == null && System.getProperty("os.name").contains("Windows")) { - filepath = FileHandling.getResourcesFilesPath() + folder + File.separator; - } + String filepath = System.getProperty("filePath"); + boolean isFilePathEmptyOrNull = (filepath == null || filepath.isEmpty()); - else if(filepath.isEmpty() && !System.getProperty("os.name").contains("Windows")){ - filepath = FileHandling.getBasePath() + "Files" + File.separator + folder + File.separator; + // return folder from perspective of sdc-vnfs repository + if (isFilePathEmptyOrNull && ( System.getProperty("os.name").contains("Windows") || System.getProperty("os.name").contains("Mac"))) { + return FileHandling.getResourcesFilesPath() + folder + File.separator; } - System.out.println(filepath); - - return filepath; + // return folder from perspective of working directory ( in general for nightly run from Linux, should already contain "Files" directory ) + return FileHandling.getBasePath() + "Files" + File.separator + folder + File.separator; } public static String getBasePath() { @@ -155,6 +157,10 @@ public class FileHandling { public static String getVnfRepositoryPath() { return getFilePath("VNFs"); } + + public static String getUpdateVSPVnfRepositoryPath() { + return getFilePath("UpdateVSP"); + } public static File getConfigFile(String configFileName) throws Exception { File configFile = new File(FileHandling.getBasePath() + File.separator + "conf" + File.separator + configFileName); @@ -244,8 +250,8 @@ public class FileHandling { } -// public static Object[] getZipFileNamesFromFolder(String filepath) { -// return filterFileNamesFromFolder(filepath, ".zip"); +// public static Object[] getZipFileNamesFromFolder(String filePath) { +// return filterFileNamesFromFolder(filePath, ".zip"); // } public static List<String> getZipFileNamesFromFolder(String filepath) { @@ -433,9 +433,9 @@ public final class GeneralUIUtils { } } - public static void moveToStep(DataTestIdEnum.StepsEnum Stepname) { - moveToStep(Stepname.getValue()); - SetupCDTest.getExtendTest().log(Status.INFO, String.format("Going to %s page ", Stepname.toString())); + public static void moveToStep(DataTestIdEnum.StepsEnum stepName) { + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Going to %s page ", stepName.toString())); + moveToStep(stepName.getValue()); } public static void moveToStep(String dataTestId) { @@ -785,5 +785,10 @@ public final class GeneralUIUtils { Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); clipboard.setContents(selection, selection); } + + public static boolean checkForDisabledAttributeInHiddenElement(String cssString){ + Object elementAttributes = getAllElementAttributes(getDriver().findElement(By.cssSelector(cssString))); + return elementAttributes.toString().contains("disabled"); + } } @@ -20,7 +20,6 @@ package org.openecomp.sdc.ci.tests.utilities; -import org.openecomp.sdc.ci.tests.datatypes.TopMenuButtonsEnum; import org.openecomp.sdc.ci.tests.datatypes.CheckBoxStatusEnum; import org.openecomp.sdc.ci.tests.datatypes.CreateAndImportButtonsEnum; import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; @@ -0,0 +1,969 @@ +/*- + * ============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.ci.tests.utilities; + +import static org.testng.AssertJUnit.assertEquals; + +import java.io.File; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.ci.tests.datatypes.AmdocsLicenseMembers; +import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; +import org.openecomp.sdc.ci.tests.datatypes.HeatMetaFirstLevelDefinition; +import org.openecomp.sdc.ci.tests.datatypes.LifeCycleStateEnum; +import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; +import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; +import org.openecomp.sdc.ci.tests.execute.devCI.ArtifactFromCsar; +import org.openecomp.sdc.ci.tests.execute.setup.ArtifactsCorrelationManager; +import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions; +import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; +import org.openecomp.sdc.ci.tests.pages.DeploymentArtifactPage; +import org.openecomp.sdc.ci.tests.pages.HomePage; +import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage; +import org.openecomp.sdc.ci.tests.utils.general.OnboardingUtils; +import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; +import org.openecomp.sdc.ci.tests.verificator.VfVerificator; +import org.openqa.selenium.WebElement; +import org.testng.Assert; + +import com.aventstack.extentreports.Status; +import com.clearspring.analytics.util.Pair; + + + + + + + + + +public class OnboardingUiUtils { + +// /** +// * excluded VNF file list +// */ +// protected static List<String> exludeVnfList = +//// new ArrayList<String>(); +// +// Arrays.asList( +// +//// new VNFs +// "Vhss-epc-rdm3-lab-vf-0921-v2.0-MOBILITY-10-20.zip", "Apndns-1710-vf-v3.0-10-20.zip", +// "HeatCandidate_2017-09-22_01-48_55Name_2016-182-asbg-nsbg-tsbg-v1.0-(VOIP).zip", "HeatCandidate_2017-09-22_01-47_55Name_2016-182-asbg-nsbg-tsbg-v7.0-(VOIP).zip", +// "Efmc-dbe-nin-v24.0-VOIP-10-20.zip", "VF_LMSP_v5-062317-V3.0-(Mobility).zip", "base_bwks_nfm_volume-236262502.zip", +// +//// newest failed VNFs +// "HeatCandidate_2017-09-20_15-07_66Name_2016-20-visbc1vf-v4.0-(VOIP).zip", +// "HeatCandidate_2017-09-20_15-06_66Name_2016-20-visbc1vf-v6.0-(VOIP).zip", "1-Vf-zrdm5bpxtc02-092017-(MOBILITY)_v3.0.zip", +// "2-Vf-zrdm5bpxtc02-092017-(MOBILITY)_v2.0.zip", "1-2017-491-4vshaken-HTTP-CM-vf-(VOIP)_v2.0.zip" +// +// ); +// +// /** +// * additional files to exludeVnfList files for tosca parser tests +// */ +// protected static List<String> exludeVnfListForToscaParser = new ArrayList<String>(); +// //Arrays.asList("2016-043_vsaegw_fdnt_30_1607_e2e.zip", "vIRC_CC.zip", +//// "2016-045_vlb_lmsp_30_1607_e2e.zip", "2016-050_vdns_vmdns_30_1607_e2e.zip", +//// "2016-247_mns_mns_30_1610_e2e.zip", "2016-044_vfw_fcgi_30_1607_e2e.zip"); + + public OnboardingUiUtils() { + } + +// public static Pair<String, Map<String, String>> createVendorSoftwareProduct(ResourceReqDetails resourceReqDetails, String heatFileName, String filepath, User user, AmdocsLicenseMembers amdocsLicenseMembers, Map<CvfcTypeEnum, String> cvfcArtifacts) +// throws Exception { +// +// Pair<String, Map<String, String>> pair = createVSP(resourceReqDetails, heatFileName, filepath, user, amdocsLicenseMembers); +// String vspid = pair.right.get("vspId"); +// if(cvfcArtifacts != null && ! cvfcArtifacts.isEmpty()){ +// OnboardingUiUtils.addCvfcArtifacts(cvfcArtifacts, vspid, user, null); +// +// } +// prepareVspForUse(user, vspid, "0.1"); +// return pair; +// } + + public static void prepareVspForUse(User user, String vspid, String vspVersion) throws Exception { + + RestResponse checkin = OnboardingUtils.checkinVendorSoftwareProduct(vspid, user, vspVersion); + assertEquals("did not succeed to checking new VSP", 200, checkin.getErrorCode().intValue()); + + RestResponse submit = OnboardingUtils.submitVendorSoftwareProduct(vspid, user, vspVersion); + assertEquals("did not succeed to submit new VSP", 200, submit.getErrorCode().intValue()); + + RestResponse createPackage = OnboardingUtils.createPackageOfVendorSoftwareProduct(vspid, user, vspVersion); + assertEquals("did not succeed to create package of new VSP ", 200, createPackage.getErrorCode().intValue()); + if(SetupCDTest.getExtendTest() != null){ + SetupCDTest.getExtendTest().log(Status.INFO, "Succeeded in creating the vendor software product"); + } + } + + +// public static VendorSoftwareProductObject createAndFillVendorSoftwareProduct(ResourceReqDetails resourceReqDetails, String heatFileName, String filePath, User user, AmdocsLicenseMembers amdocsLicenseMembers, Map<CvfcTypeEnum, String> cvfcArtifacts) +// throws Exception { +// +// Pair<String, Map<String, String>> createVendorSoftwareProduct = OnboardingUiUtils.createVendorSoftwareProduct(resourceReqDetails, heatFileName, filePath, user, amdocsLicenseMembers, cvfcArtifacts); +// VendorSoftwareProductObject vendorSoftwareProductObject = OnboardViaApis.fillVendorSoftwareProductObjectWithMetaData(heatFileName, createVendorSoftwareProduct); +// return vendorSoftwareProductObject; +// +// } + +// public static Pair<String, Map<String, String>> createVendorSoftwareProduct(ResourceReqDetails resourceReqDetails, String heatFileName, String filepath, User user, AmdocsLicenseMembers amdocsLicenseMembers) +// throws Exception { +// +// Map<CvfcTypeEnum, String> cvfcArtifacts = new HashMap<>(); +// return createVendorSoftwareProduct(resourceReqDetails, heatFileName, filepath, user, amdocsLicenseMembers, cvfcArtifacts); +// } + +// public static Pair<String, Map<String, String>> createVSP(ResourceReqDetails resourceReqDetails, String heatFileName, String filepath, User user, AmdocsLicenseMembers amdocsLicenseMembers) throws Exception { +// String vspName = handleFilename(heatFileName); +// +// if(SetupCDTest.getExtendTest() != null){ +// SetupCDTest.getExtendTest().log(Status.INFO, "Starting to create the vendor software product"); +// } +// +// Pair<RestResponse, Map<String, String>> createNewVspPair = createNewVendorSoftwareProduct(resourceReqDetails, vspName, amdocsLicenseMembers, user); +// RestResponse createNewVendorSoftwareProduct = createNewVspPair.left; +// assertEquals("did not succeed to create new VSP", 200,createNewVendorSoftwareProduct.getErrorCode().intValue()); +// String vspid = ResponseParser.getValueFromJsonResponse(createNewVendorSoftwareProduct.getResponse(), "vspId"); +// String componentId = ResponseParser.getValueFromJsonResponse(createNewVendorSoftwareProduct.getResponse(), "componentId"); +// +// Map<String, String> vspMeta = createNewVspPair.right; +// Map<String, String> vspObject = new HashMap<String, String>(); +// Iterator<String> iterator = vspMeta.keySet().iterator(); +// while(iterator.hasNext()){ +// Object key = iterator.next(); +// Object value = vspMeta.get(key); +// vspObject.put(key.toString(), value.toString()); +// } +// vspObject.put("vspId", vspid); +// vspObject.put("componentId", componentId); +// vspObject.put("vendorName", amdocsLicenseMembers.getVendorLicenseName()); +// vspObject.put("attContact", user.getUserId()); +// +// RestResponse uploadHeatPackage = uploadHeatPackage(filepath, heatFileName, vspid, user, "0.1"); +// assertEquals("did not succeed to upload HEAT package", 200, uploadHeatPackage.getErrorCode().intValue()); +// +// RestResponse validateUpload = validateUpload(vspid, user, "0.1"); +// assertEquals("did not succeed to validate upload process, reason: " + validateUpload.getResponse(), 200, validateUpload.getErrorCode().intValue()); +// +// Pair<String, Map<String, String>> pair = new Pair<String, Map<String, String>>(vspName, vspObject); +// +// return pair; +// } + +// public static void updateVspWithVfcArtifacts(String filepath, String vspId, String updatedSnmpPoll, String updatedSnmpTrap, String componentId, User user, String vspVersion) throws Exception{ +// RestResponse checkout = checkoutVendorSoftwareProduct(vspId, user, vspVersion); +// assertEquals("did not succeed to checkout new VSP", 200, checkout.getErrorCode().intValue()); +// ExtentTestActions.log(Status.INFO, "Deleting SNMP POLL"); +// deleteArtifactByType(componentId, vspId, user, CvfcTypeEnum.SNMP_POLL); +// ExtentTestActions.log(Status.INFO, "Deleting SNMP TRAP"); +// deleteArtifactByType(componentId, vspId, user, CvfcTypeEnum.SNMP_TRAP); +// addVFCArtifacts(filepath, updatedSnmpPoll, updatedSnmpTrap, vspId, user, componentId); +// prepareVspForUse(user, vspId, vspVersion); +// } + + public static String updateVendorSoftwareProduct(String vspId, String HeatFileName, String filepath, User user, String vspVersion) + throws Exception, Throwable { + String vspName = OnboardingUtils.handleFilename(HeatFileName); + SetupCDTest.getExtendTest().log(Status.INFO, "Starting to update the vendor software product"); + + RestResponse checkout = OnboardingUtils.checkoutVendorSoftwareProduct(vspId, user, vspVersion); + assertEquals("did not succeed to checkout new VSP", 200, checkout.getErrorCode().intValue()); + + RestResponse uploadHeatPackage = OnboardingUtils.uploadHeatPackage(filepath, HeatFileName, vspId, user, vspVersion); + assertEquals("did not succeed to upload HEAT package", 200, uploadHeatPackage.getErrorCode().intValue()); + + RestResponse validateUpload = OnboardingUtils.validateUpload(vspId, user, vspVersion); + assertEquals("did not succeed to validate upload process", 200, validateUpload.getErrorCode().intValue()); + + RestResponse checkin = OnboardingUtils.checkinVendorSoftwareProduct(vspId, user, vspVersion); + assertEquals("did not succeed to checking VSP", 200, checkin.getErrorCode().intValue()); + + RestResponse submit = OnboardingUtils.submitVendorSoftwareProduct(vspId, user, vspVersion); + assertEquals("did not succeed to submit VSP", 200, submit.getErrorCode().intValue()); + + RestResponse createPackage = OnboardingUtils.createPackageOfVendorSoftwareProduct(vspId, user, vspVersion); + assertEquals("did not succeed to update package of VSP ", 200, createPackage.getErrorCode().intValue()); + + SetupCDTest.getExtendTest().log(Status.INFO, "Succeeded in updating the vendor software product"); + + return vspName; + } + +// public static void updateVendorSoftwareProductToNextVersion(VendorSoftwareProductObject vendorSoftwareProductObject, String toVspVersion, User user) +// throws Exception, Throwable { +// +// RestResponse checkout = checkoutVendorSoftwareProduct(vendorSoftwareProductObject.getVspId(), user, vendorSoftwareProductObject.getVersion()); +// assertEquals("did not succeed to checkout new VSP", 200, checkout.getErrorCode().intValue()); +// +// RestResponse checkin = checkinVendorSoftwareProduct(vendorSoftwareProductObject.getVspId(), user, vendorSoftwareProductObject.getVersion()); +// assertEquals("did not succeed to checking VSP", 200, checkin.getErrorCode().intValue()); +// +// RestResponse submit = submitVendorSoftwareProduct(vendorSoftwareProductObject.getVspId(), user, vendorSoftwareProductObject.getVersion()); +// assertEquals("did not succeed to submit VSP", 200, submit.getErrorCode().intValue()); +// +// vendorSoftwareProductObject.setVersion(toVspVersion); +// } + +// public static String handleFilename(String heatFileName) { +// final String namePrefix = String.format("%sVFOnboarded-", ElementFactory.getResourcePrefix()); +// final String nameSuffix = "-" + getShortUUID(); +// +// String subHeatFileName = heatFileName.substring(0, heatFileName.lastIndexOf(".")); +// +// if ((namePrefix + subHeatFileName + nameSuffix).length() >= 50) { +// subHeatFileName = subHeatFileName.substring(0, 50 - namePrefix.length() - nameSuffix.length()); +// } +// +// if (subHeatFileName.contains("(") || subHeatFileName.contains(")")) { +// subHeatFileName = subHeatFileName.replace("(", "-"); +// subHeatFileName = subHeatFileName.replace(")", "-"); +// } +// +// String vnfName = namePrefix + subHeatFileName + nameSuffix; +// return vnfName; +// } + +// public static String addVFCArtifacts(String filepath, String snmpPoll, String snmpTrap, String vspid, User user, String vspComponentId) throws Exception{ +// vspComponentId = (vspComponentId == null) ? getVSPComponentId(vspid, user) : vspComponentId; +// if (vspComponentId != null){ +// if (snmpPoll != null){ +// ExtentTestActions.log(Status.INFO, "Adding VFC artifact of type SNMP POLL with the file " + snmpPoll); +// RestResponse uploadSnmpPollArtifact = uploadSnmpPollArtifact(filepath, snmpPoll, vspid, user, vspComponentId); +// assertEquals("Did not succeed to add SNMP POLL", 200, uploadSnmpPollArtifact.getErrorCode().intValue()); +// } +// if (snmpTrap != null){ +// ExtentTestActions.log(Status.INFO, "Adding VFC artifact of type SNMP TRAP with the file " + snmpTrap); +// RestResponse uploadSnmpTrapArtifact = uploadSnmpTrapArtifact(filepath, snmpTrap, vspid, user, vspComponentId); +// assertEquals("Did not succeed to add SNMP TRAP", 200, uploadSnmpTrapArtifact.getErrorCode().intValue()); +// } +// } +// +// return vspComponentId; +// } + +// public static String addCvfcArtifacts(Map<CvfcTypeEnum, String> componentVfcArtifacts, String vspid, User user, String vspComponentId) throws Exception{ +// vspComponentId = (vspComponentId == null) ? getVSPComponentId(vspid, user) : vspComponentId; +// if (vspComponentId != null){ +// for(Entry<CvfcTypeEnum, String> entry : componentVfcArtifacts.entrySet()){ +// ExtentTestActions.log(Status.INFO, "Adding VFC artifact of type " + entry.getKey().getValue() + " with the file " + entry.getValue()); +// RestResponse uploadSnmpPollArtifact = uploadCvfcArtifact(entry.getValue(), entry.getKey().getValue(), vspid, user, vspComponentId); +// assertEquals("Did not succeed to add " + entry.getKey().getValue(), BaseRestUtils.STATUS_CODE_SUCCESS, uploadSnmpPollArtifact.getErrorCode().intValue()); +// } +// } +// return vspComponentId; +// } + +// public static String addVFCArtifacts(String filepath, String snmpPoll, String snmpTrap, String vspid, User user) throws Exception{ +// return addVFCArtifacts(filepath, snmpPoll, snmpTrap, vspid, user, null); +// } + +// public static RestResponse uploadCvfcArtifact(String filepath, String cvfcType, String vspid, User user, String vspComponentId) throws FileNotFoundException, IOException, ClientProtocolException { +// Config config = Utils.getConfig(); +// String snmpPollUrl = String.format(Urls.UPLOAD_AMDOCS_ARTIFACT, config.getCatalogBeHost(),config.getCatalogBePort(), vspid, vspComponentId, cvfcType); +// return uploadFile(filepath, null, snmpPollUrl, user); +// } + +// private static RestResponse uploadSnmpPollArtifact(String filepath, String zipArtifact, String vspid, User user, +// String vspComponentId) throws FileNotFoundException, IOException, ClientProtocolException { +// Config config = Utils.getConfig(); +// String snmpPollUrl = String.format(Urls.UPLOAD_SNMP_POLL_ARTIFACT, config.getCatalogBeHost(),config.getCatalogBePort(), vspid, vspComponentId); +// return uploadFile(filepath, zipArtifact, snmpPollUrl, user); +// } + +// private static RestResponse uploadSnmpTrapArtifact(String filepath, String zipArtifact, String vspid, User user, +// String vspComponentId) throws FileNotFoundException, IOException, ClientProtocolException { +// Config config = Utils.getConfig(); +// String snmpTrapUrl = String.format(Urls.UPLOAD_SNMP_POLL_ARTIFACT, config.getCatalogBeHost(),config.getCatalogBePort(), vspid, vspComponentId); +// return uploadFile(filepath, zipArtifact, snmpTrapUrl, user); +// } + +// private static RestResponse deleteArtifactByType(String componentId, String vspId, User user, CvfcTypeEnum snmpType) throws Exception +// { +// Config config = Utils.getConfig(); +// String url = String.format(Urls.DELETE_AMDOCS_ARTIFACT_BY_TYPE, config.getCatalogBeHost(),config.getCatalogBePort(), vspId, componentId, snmpType.getValue()); +// String userId = user.getUserId(); +// Map<String, String> headersMap = prepareHeadersMap(userId); +// +// HttpRequest http = new HttpRequest(); +// RestResponse response = http.httpSendDelete(url, headersMap); +// return response; +// } + +// private static String getVSPComponentId(String vspid, User user) throws Exception, JSONException { +// RestResponse components = getVSPComponents(vspid, user); +// String response = components.getResponse(); +// Map<String, Object> responseMap = (Map<String, Object>) JSONValue.parse(response); +// JSONArray results = (JSONArray)responseMap.get("results"); +// for (Object res : results){ +// Map<String, Object> compMap= (Map<String, Object>) JSONValue.parse(res.toString()); +// String componentId = compMap.get("id").toString(); +// return componentId; +// } +// return null; +// } + +// private static RestResponse getVSPComponents(String vspid, User user) throws Exception{ +// Config config = Utils.getConfig(); +// String url = String.format(Urls.GET_VSP_COMPONENTS, config.getCatalogBeHost(),config.getCatalogBePort(), vspid); +// String userId = user.getUserId(); +// +// Map<String, String> headersMap = prepareHeadersMap(userId); +// +// HttpRequest http = new HttpRequest(); +// RestResponse response = http.httpSendGet(url, headersMap); +// return response; +// } + +// private static RestResponse getVSPComponentByVersion(String vspId, String vspVersion, User user) throws Exception{ +// Config config = Utils.getConfig(); +// String url = String.format(Urls.GET_VSP_COMPONENT_BY_VERSION, config.getCatalogBeHost(),config.getCatalogBePort(), vspId,vspVersion); +// String userId = user.getUserId(); +// +// Map<String, String> headersMap = prepareHeadersMap(userId); +// +// HttpRequest http = new HttpRequest(); +// RestResponse response = http.httpSendGet(url, headersMap); +// return response; +// } + +// private static RestResponse getVLMComponentByVersion(String vlmId, String vlmVersion, User user) throws Exception{ +// Config config = Utils.getConfig(); +// String url = String.format(Urls.GET_VLM_COMPONENT_BY_VERSION, config.getCatalogBeHost(),config.getCatalogBePort(), vlmId,vlmVersion); +// String userId = user.getUserId(); +// +// Map<String, String> headersMap = prepareHeadersMap(userId); +// +// HttpRequest http = new HttpRequest(); +// RestResponse response = http.httpSendGet(url, headersMap); +// return response; +// } + +// public static boolean validateVspExist(String vspId, String vspVersion, User user) throws Exception { +// RestResponse restResponse = getVSPComponentByVersion(vspId, vspVersion, user); +// assertEquals(String.format("Vsp version not updated, reponse message: %s", restResponse.getResponse()),restResponse.getErrorCode().intValue(),200); +// return (restResponse.getErrorCode()==200); +// } +// +// public static boolean validateVlmExist(String vlmId, String vlmVersion, User user) throws Exception { +// RestResponse restResponse = getVLMComponentByVersion(vlmId, vlmVersion, user); +// assertEquals(String.format("VLM version not updated, reponse code message: %s", restResponse.getResponse()),restResponse.getErrorCode().intValue(),200); +// return (restResponse.getErrorCode()==200); +// } + + public static AmdocsLicenseMembers createVendorLicense(User user) throws Exception { + + AmdocsLicenseMembers amdocsLicenseMembers; + if(SetupCDTest.getExtendTest() != null){ + SetupCDTest.getExtendTest().log(Status.INFO, "Starting to create the vendor license"); + } + String vendorLicenseName = "ciLicense" + OnboardingUtils.getShortUUID(); + RestResponse vendorLicenseResponse = OnboardingUtils.createVendorLicenseModels_1(vendorLicenseName, user); + assertEquals("did not succeed to create vendor license model", 200, vendorLicenseResponse.getErrorCode().intValue()); + String vendorId = ResponseParser.getValueFromJsonResponse(vendorLicenseResponse.getResponse(), "value"); + + RestResponse vendorKeyGroupsResponse = OnboardingUtils.createVendorKeyGroups_2(vendorId, user); + assertEquals("did not succeed to create vendor key groups", 200, vendorKeyGroupsResponse.getErrorCode().intValue()); + String keyGroupId = ResponseParser.getValueFromJsonResponse(vendorKeyGroupsResponse.getResponse(), "value"); + + RestResponse vendorEntitlementPool = OnboardingUtils.createVendorEntitlementPool_3(vendorId, user); + assertEquals("did not succeed to create vendor entitlement pool", 200, vendorEntitlementPool.getErrorCode().intValue()); + String entitlementPoolId = ResponseParser.getValueFromJsonResponse(vendorEntitlementPool.getResponse(), "value"); + + RestResponse vendorLicenseFeatureGroups = OnboardingUtils.createVendorLicenseFeatureGroups_4(vendorId, keyGroupId, entitlementPoolId, user); + assertEquals("did not succeed to create vendor license feature groups", 200, vendorLicenseFeatureGroups.getErrorCode().intValue()); + String featureGroupId = ResponseParser.getValueFromJsonResponse(vendorLicenseFeatureGroups.getResponse(), "value"); + + RestResponse vendorLicenseAgreement = OnboardingUtils.createVendorLicenseAgreement_5(vendorId, featureGroupId, user); + assertEquals("did not succeed to create vendor license agreement", 200, vendorLicenseAgreement.getErrorCode().intValue()); + String vendorLicenseAgreementId = ResponseParser.getValueFromJsonResponse(vendorLicenseAgreement.getResponse(), "value"); + + RestResponse checkinVendorLicense = OnboardingUtils.checkinVendorLicense(vendorId, user, "0.1"); + assertEquals("did not succeed to checkin vendor license", 200, checkinVendorLicense.getErrorCode().intValue()); + + RestResponse submitVendorLicense = OnboardingUtils.submitVendorLicense(vendorId, user, "0.1"); + assertEquals("did not succeed to submit vendor license", 200, submitVendorLicense.getErrorCode().intValue()); + + if(SetupCDTest.getExtendTest() != null){ + SetupCDTest.getExtendTest().log(Status.INFO, "Succeeded in creating the vendor license"); + } + + amdocsLicenseMembers = new AmdocsLicenseMembers(vendorId, vendorLicenseName, vendorLicenseAgreementId, featureGroupId); + amdocsLicenseMembers.setVersion("1.0"); // Once object created and submitted, his initial version is 1.0 + + return amdocsLicenseMembers; + } + +// public static void updateVendorLicense(AmdocsLicenseMembers amdocsLicenseMembers, User user, String vlmVersion) throws Exception { +// +// RestResponse checkoutVendorLicense = checkoutVendorLicense(amdocsLicenseMembers.getVendorId(), user, vlmVersion); +// assertEquals("did not succeed to checkout vendor license", 200, checkoutVendorLicense.getErrorCode().intValue()); +// +// RestResponse checkinVendorLicense = checkinVendorLicense(amdocsLicenseMembers.getVendorId(), user, vlmVersion); +// assertEquals("did not succeed to checkin vendor license", 200, checkinVendorLicense.getErrorCode().intValue()); +// +// RestResponse submitVendorLicense = submitVendorLicense(amdocsLicenseMembers.getVendorId(), user, vlmVersion); +// assertEquals("did not succeed to submit vendor license", 200, submitVendorLicense.getErrorCode().intValue()); +// +// if(SetupCDTest.getExtendTest() != null){ +// SetupCDTest.getExtendTest().log(Status.INFO, "Succeeded in updating the vendor license"); +// } +// } + + +// private static String getShortUUID() { +// return UUID.randomUUID().toString().split("-")[0]; +// } + +// private static RestResponse actionOnComponent(String vspid, String action, String onboardComponent, User user, String componentVersion) +// throws Exception { +// Config config = Utils.getConfig(); +// String url = String.format(Urls.ACTION_ON_COMPONENT, config.getCatalogBeHost(), config.getCatalogBePort(), onboardComponent, vspid, componentVersion); +// String userId = user.getUserId(); +// +// JSONObject jObject = new JSONObject(); +// jObject.put("action", action); +// +// Map<String, String> headersMap = prepareHeadersMap(userId); +// +// HttpRequest http = new HttpRequest(); +// RestResponse response = http.httpSendPut(url, jObject.toString(), headersMap); +// return response; +// } + +// public static RestResponse checkinVendorLicense(String vspid, User user, String vlmVersion) throws Exception { +// return actionOnComponent(vspid, "Checkin", "vendor-license-models", user, vlmVersion); +// } +// +// public static RestResponse checkoutVendorLicense(String vspid, User user, String vlmVersion) throws Exception { +// return actionOnComponent(vspid, "Checkout", "vendor-license-models", user, vlmVersion); +// } +// +// public static RestResponse submitVendorLicense(String vspid, User user, String vlmVersion) throws Exception { +// return actionOnComponent(vspid, "Submit", "vendor-license-models", user, vlmVersion); +// } + +// public static RestResponse createVendorLicenseModels_1(String name, User user) throws Exception { +// Config config = Utils.getConfig(); +// String url = String.format(Urls.CREATE_VENDOR_LISENCE_MODELS, config.getCatalogBeHost(), +// config.getCatalogBePort()); +// String userId = user.getUserId(); +// +// JSONObject jObject = new JSONObject(); +// jObject.put("vendorName", name); +// jObject.put("description", "new vendor license model"); +// jObject.put("iconRef", "icon"); +// +// Map<String, String> headersMap = prepareHeadersMap(userId); +// +// HttpRequest http = new HttpRequest(); +// RestResponse response = http.httpSendPost(url, jObject.toString(), headersMap); +// return response; +// +// } +// +// public static RestResponse createVendorLicenseAgreement_5(String vspid, String featureGroupId, User user) +// throws Exception { +// Config config = Utils.getConfig(); +// String url = String.format(Urls.CREATE_VENDOR_LISENCE_AGREEMENT, config.getCatalogBeHost(), config.getCatalogBePort(), vspid); +// String userId = user.getUserId(); +// +// JSONObject licenseTermpObject = new JSONObject(); +// licenseTermpObject.put("choice", "Fixed_Term"); +// licenseTermpObject.put("other", ""); +// +// JSONObject jObjectBody = new JSONObject(); +// jObjectBody.put("name", "abc"); +// jObjectBody.put("description", "new vendor license agreement"); +// jObjectBody.put("requirementsAndConstrains", "abc"); +// jObjectBody.put("licenseTerm", licenseTermpObject); +// jObjectBody.put("addedFeatureGroupsIds", Arrays.asList(featureGroupId).toArray()); +// +// Map<String, String> headersMap = prepareHeadersMap(userId); +// +// HttpRequest http = new HttpRequest(); +// RestResponse response = http.httpSendPost(url, jObjectBody.toString(), headersMap); +// return response; +// } +// +// public static RestResponse createVendorLicenseFeatureGroups_4(String vspid, String licenseKeyGroupId, +// String entitlementPoolId, User user) throws Exception { +// Config config = Utils.getConfig(); +// String url = String.format(Urls.CREATE_VENDOR_LISENCE_FEATURE_GROUPS, config.getCatalogBeHost(), config.getCatalogBePort(), vspid); +// String userId = user.getUserId(); +// +// JSONObject jObject = new JSONObject(); +// jObject.put("name", "xyz"); +// jObject.put("description", "new vendor license feature groups"); +// jObject.put("partNumber", "123abc456"); +// jObject.put("manufacturerReferenceNumber", "5"); +// jObject.put("addedLicenseKeyGroupsIds", Arrays.asList(licenseKeyGroupId).toArray()); +// jObject.put("addedEntitlementPoolsIds", Arrays.asList(entitlementPoolId).toArray()); +// +// Map<String, String> headersMap = prepareHeadersMap(userId); +// +// HttpRequest http = new HttpRequest(); +// RestResponse response = http.httpSendPost(url, jObject.toString(), headersMap); +// return response; +// +// } +// +// public static RestResponse createVendorEntitlementPool_3(String vspid, User user) throws Exception { +// Config config = Utils.getConfig(); +// String url = String.format(Urls.CREATE_VENDOR_LISENCE_ENTITLEMENT_POOL, config.getCatalogBeHost(), config.getCatalogBePort(), vspid); +// String userId = user.getUserId(); +// +// JSONObject jEntitlementMetricObject = new JSONObject(); +// jEntitlementMetricObject.put("choice", "CPU"); +// jEntitlementMetricObject.put("other", ""); +// +// JSONObject jAggregationFunctionObject = new JSONObject(); +// jAggregationFunctionObject.put("choice", "Peak"); +// jAggregationFunctionObject.put("other", ""); +// +// JSONObject jOperationalScope = new JSONObject(); +// jOperationalScope.put("choices", Arrays.asList("Availability_Zone").toArray()); +// jOperationalScope.put("other", ""); +// +// JSONObject jTimeObject = new JSONObject(); +// jTimeObject.put("choice", "Hour"); +// jTimeObject.put("other", ""); +// +// JSONObject jObjectBody = new JSONObject(); +// jObjectBody.put("name", "def"+ getShortUUID()); +// jObjectBody.put("description", "new vendor license entitlement pool"); +// jObjectBody.put("thresholdValue", "23"); +// jObjectBody.put("thresholdUnits", "Absolute"); +// jObjectBody.put("entitlementMetric", jEntitlementMetricObject); +// jObjectBody.put("increments", "abcd"); +// jObjectBody.put("aggregationFunction", jAggregationFunctionObject); +// jObjectBody.put("operationalScope", jOperationalScope); +// jObjectBody.put("time", jTimeObject); +// jObjectBody.put("manufacturerReferenceNumber", "123aaa"); +// +// Map<String, String> headersMap = prepareHeadersMap(userId); +// +// HttpRequest http = new HttpRequest(); +// RestResponse response = http.httpSendPost(url, jObjectBody.toString(), headersMap); +// return response; +// } +// +// public static RestResponse createVendorKeyGroups_2(String vspid, User user) throws Exception { +// Config config = Utils.getConfig(); +// String url = String.format(Urls.CREATE_VENDOR_LISENCE_KEY_GROUPS, config.getCatalogBeHost(), config.getCatalogBePort(), vspid); +// String userId = user.getUserId(); +// +// JSONObject jOperationalScope = new JSONObject(); +// jOperationalScope.put("choices", Arrays.asList("Tenant").toArray()); +// jOperationalScope.put("other", ""); +// +// JSONObject jObjectBody = new JSONObject(); +// jObjectBody.put("name", "keyGroup" + getShortUUID()); +// jObjectBody.put("description", "new vendor license key group"); +// jObjectBody.put("operationalScope", jOperationalScope); +// jObjectBody.put("type", "Universal"); +// +// Map<String, String> headersMap = prepareHeadersMap(userId); +// +// HttpRequest http = new HttpRequest(); +// RestResponse response = http.httpSendPost(url, jObjectBody.toString(), headersMap); +// return response; +// } + +// public static Pair<RestResponse, Map<String, String>> createNewVendorSoftwareProduct(ResourceReqDetails resourceReqDetails, String vspName, AmdocsLicenseMembers amdocsLicenseMembers, User user) throws Exception { +// Map<String, String> vspMetadta = new HashMap<String, String>(); +// +// Config config = Utils.getConfig(); +// String url = String.format(Urls.CREATE_VENDOR_SOFTWARE_PRODUCT, config.getCatalogBeHost(), config.getCatalogBePort()); +// String userId = user.getUserId(); +// VendorSoftwareProductObject vendorSoftwareProductObject = new VendorSoftwareProductObject(); +// LicensingData licensingData = new LicensingData(amdocsLicenseMembers.getVendorLicenseAgreementId(), Arrays.asList(amdocsLicenseMembers.getFeatureGroupId())); +// LicensingVersion licensingVersion = new LicensingVersion("1.0", "1.0"); +// ResourceCategoryEnum resourceCategoryEnum = ResourceCategoryEnum.findEnumNameByValues(resourceReqDetails.getCategories().get(0).getName(), resourceReqDetails.getCategories().get(0).getSubcategories().get(0).getName()); +// +// vendorSoftwareProductObject.setLicensingVersion(licensingVersion); +// +// vendorSoftwareProductObject.setName(vspName); +// vendorSoftwareProductObject.setDescription(resourceReqDetails.getDescription()); +// vendorSoftwareProductObject.setCategory(resourceCategoryEnum.getCategoryUniqeId()); +// vendorSoftwareProductObject.setSubCategory(resourceCategoryEnum.getSubCategoryUniqeId()); +// vendorSoftwareProductObject.setOnboardingMethod("NetworkPackage"); +// vendorSoftwareProductObject.setVendorName(amdocsLicenseMembers.getVendorLicenseName()); +// vendorSoftwareProductObject.setVendorId(amdocsLicenseMembers.getVendorId()); +// vendorSoftwareProductObject.setIcon("icon"); +// vendorSoftwareProductObject.setLicensingData(licensingData); +// +// vspMetadta.put("description", resourceReqDetails.getDescription()); +// vspMetadta.put("category", resourceCategoryEnum.getCategory()); +// vspMetadta.put("subCategory", resourceCategoryEnum.getSubCategory()); +// +// Map<String, String> headersMap = prepareHeadersMap(userId); +// HttpRequest http = new HttpRequest(); +// Gson gson = new Gson(); +// String body = gson.toJson(vendorSoftwareProductObject); +// +// RestResponse response = http.httpSendPost(url, body, headersMap); +// return new Pair<RestResponse, Map<String, String>>(response, vspMetadta); +// } + + +// public static RestResponse validateUpload(String vspid, User user, String vspVersion) throws Exception { +// Config config = Utils.getConfig(); +// String url = String.format(Urls.VALIDATE_UPLOAD, config.getCatalogBeHost(), config.getCatalogBePort(), vspid,vspVersion); +// +// String userId = user.getUserId(); +// +// Map<String, String> headersMap = prepareHeadersMap(userId); +// HttpRequest http = new HttpRequest(); +// +// String body =null; +// +// RestResponse response = http.httpSendPut(url, body, headersMap); +// +// return response; +// } + +// public static RestResponse uploadHeatPackage(String filepath, String filename, String vspid, User user, String vspVersion) throws Exception { +// Config config = Utils.getConfig(); +// String url = String.format(Urls.UPLOAD_HEAT_PACKAGE, config.getCatalogBeHost(), config.getCatalogBePort(), vspid, vspVersion); +// return uploadFile(filepath, filename, url, user); +// } + +// private static RestResponse uploadFile(String filepath, String filename, String url, User user) +// throws FileNotFoundException, IOException, ClientProtocolException { +// CloseableHttpResponse response = null; +// +// MultipartEntityBuilder mpBuilder = MultipartEntityBuilder.create(); +// mpBuilder.addPart("upload", new FileBody(getTestZipFile(filepath, filename))); +// +// Map<String, String> headersMap = prepareHeadersMap(user.getUserId()); +// headersMap.put(HttpHeaderEnum.CONTENT_TYPE.getValue(), "multipart/form-data"); +// +// CloseableHttpClient client = HttpClients.createDefault(); +// try { +// HttpPost httpPost = new HttpPost(url); +// RestResponse restResponse = new RestResponse(); +// +// Iterator<String> iterator = headersMap.keySet().iterator(); +// while (iterator.hasNext()) { +// String key = iterator.next(); +// String value = headersMap.get(key); +// httpPost.addHeader(key, value); +// } +// httpPost.setEntity(mpBuilder.build()); +// response = client.execute(httpPost); +// HttpEntity entity = response.getEntity(); +// String responseBody = null; +// if (entity != null) { +// InputStream instream = entity.getContent(); +// try { +// StringWriter writer = new StringWriter(); +// IOUtils.copy(instream, writer); +// responseBody = writer.toString(); +// } finally { +// instream.close(); +// } +// } +// +// restResponse.setErrorCode(response.getStatusLine().getStatusCode()); +// restResponse.setResponse(responseBody); +// +// return restResponse; +// +// } finally { +// closeResponse(response); +// closeHttpClient(client); +// +// } +// } + +// private static void closeResponse(CloseableHttpResponse response) { +// try { +// if (response != null) { +// response.close(); +// } +// } catch (IOException e) { +// System.out.println(String.format("failed to close client or response: %s", e.getMessage())); +// } +// } +// +// private static void closeHttpClient(CloseableHttpClient client) { +// try { +// if (client != null) { +// client.close(); +// } +// } catch (IOException e) { +// System.out.println(String.format("failed to close client or response: %s", e.getMessage())); +// } +// } + +// private static File getTestZipFile(String filepath, String filename) throws IOException { +// Config config = Utils.getConfig(); +// String sourceDir = config.getImportResourceTestsConfigDir(); +// java.nio.file.Path filePath; +// if(filename == null){ +// filePath = FileSystems.getDefault().getPath(filepath); +// }else{ +// filePath = FileSystems.getDefault().getPath(filepath + File.separator + filename); +// } +// return filePath.toFile(); +// } + +// public static RestResponse checkinVendorSoftwareProduct(String vspid, User user, String vspVersion) throws Exception { +// return actionOnComponent(vspid, "Checkin", "vendor-software-products", user, vspVersion); +// } +// +// private static RestResponse checkoutVendorSoftwareProduct(String vspid, User user, String vspVersion) throws Exception { +// return actionOnComponent(vspid, "Checkout", "vendor-software-products", user, vspVersion); +// } +// +// public static RestResponse submitVendorSoftwareProduct(String vspid, User user, String vspVersion) throws Exception { +// return actionOnComponent(vspid, "Submit", "vendor-software-products", user, vspVersion); +// } +// +// public static RestResponse createPackageOfVendorSoftwareProduct(String vspid, User user, String vspVersion) throws Exception { +// return actionOnComponent(vspid, "Create_Package", "vendor-software-products", user, vspVersion); +// } + +// protected static Map<String, String> prepareHeadersMap(String userId) { +// Map<String, String> headersMap = new HashMap<String, String>(); +// headersMap.put(HttpHeaderEnum.CONTENT_TYPE.getValue(), "application/json"); +// headersMap.put(HttpHeaderEnum.ACCEPT.getValue(), "application/json"); +// headersMap.put(HttpHeaderEnum.USER_ID.getValue(), userId); +// return headersMap; +// } + + + private static void importUpdateVSP(Pair<String, Map<String, String>> vsp, boolean isUpdate) throws Exception{ + String vspName = vsp.left; + Map<String, String> vspMetadata = vsp.right; + boolean vspFound = HomePage.searchForVSP(vspName); + + if (vspFound){ + + List<WebElement> elemenetsFromTable = HomePage.getElemenetsFromTable(); +// WebDriverWait wait = new WebDriverWait(GeneralUIUtils.getDriver(), 30); +// WebElement findElement = wait.until(ExpectedConditions.visibilityOf(elemenetsFromTable.get(1))); +// findElement.click(); + elemenetsFromTable.get(1).click(); + GeneralUIUtils.waitForLoader(); + + if (isUpdate){ + GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ImportVfRepository.UPDATE_VSP.getValue()); + + } + else{ + GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ImportVfRepository.IMPORT_VSP.getValue()); + } + + String lifeCycleState = ResourceGeneralPage.getLifeCycleState(); + boolean needCheckout = lifeCycleState.equals(LifeCycleStateEnum.CHECKIN.getValue()) || lifeCycleState.equals(LifeCycleStateEnum.CERTIFIED.getValue()); + if (needCheckout) + { + try { + ResourceGeneralPage.clickCheckoutButton(); + Assert.assertTrue(ResourceGeneralPage.getLifeCycleState().equals(LifeCycleStateEnum.CHECKOUT.getValue()), "Did not succeed to checkout"); + + } catch (Exception e) { + ExtentTestActions.log(Status.ERROR, "Did not succeed to checkout"); + e.printStackTrace(); + } + GeneralUIUtils.waitForLoader(); + } + + //Metadata verification + VfVerificator.verifyOnboardedVnfMetadata(vspName, vspMetadata); + + ExtentTestActions.log(Status.INFO, "Clicking create/update VNF"); + String duration = GeneralUIUtils.getActionDuration(() -> waitUntilVnfCreated()); + ExtentTestActions.log(Status.INFO, "Succeeded in importing/updating " + vspName, duration); + } + else{ + Assert.fail("Did not find VSP named " + vspName); + } + } + + private static void waitUntilVnfCreated() { + GeneralUIUtils.clickOnElementByTestIdWithoutWait(DataTestIdEnum.GeneralElementsEnum.CREATE_BUTTON.getValue()); + GeneralUIUtils.waitForLoader(60*10); + GeneralUIUtils.waitForAngular(); + GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.GeneralElementsEnum.CHECKIN_BUTTON.getValue()); + } + + public static void updateVSP(Pair<String, Map<String, String>> vsp) throws Exception{ + ExtentTestActions.log(Status.INFO, "Updating VSP " + vsp.left); + importUpdateVSP(vsp, true); + } + + public static void importVSP(Pair<String, Map<String, String>> vsp) throws Exception{ + ExtentTestActions.log(Status.INFO, "Importing VSP " + vsp.left); + importUpdateVSP(vsp, false); + } + + public static void updateVnfAndValidate(String filepath, Pair<String, Map<String, String>> vsp, String updatedVnfFile, User user) throws Exception, Throwable { + ExtentTestActions.log(Status.INFO, String.format("Going to update the VNF with %s......", updatedVnfFile)); + System.out.println(String.format("Going to update the VNF with %s......", updatedVnfFile)); + + Map<String, String> vspMap = vsp.right; + String vspId = vspMap.get("vspId"); + + updateVendorSoftwareProduct(vspId, updatedVnfFile, filepath, user, "0.1"); + HomePage.showVspRepository(); + updateVSP(vsp); + ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen(); + DeploymentArtifactPage.verifyArtifactsExistInTable(filepath, updatedVnfFile); + } + + public static Pair<String, Map<String, String>> onboardAndValidate(ResourceReqDetails resourceReqDetails, String filepath, String vnfFile, User user) throws Exception { + ExtentTestActions.log(Status.INFO, String.format("Going to onboard the VNF %s", vnfFile)); + System.out.println(String.format("Going to onboard the VNF %s", vnfFile)); + + AmdocsLicenseMembers amdocsLicenseMembers = createVendorLicense(user); + Pair<String, Map<String, String>> createVendorSoftwareProduct = OnboardingUtils.createVendorSoftwareProduct(resourceReqDetails, vnfFile, filepath, user, amdocsLicenseMembers); + String vspName = createVendorSoftwareProduct.left; + + DownloadManager.downloadCsarByNameFromVSPRepository(vspName, createVendorSoftwareProduct.right.get("vspId")); + File latestFilefromDir = FileHandling.getLastModifiedFileNameFromDir(); + + ExtentTestActions.log(Status.INFO, String.format("Searching for onboarded %s", vnfFile)); + HomePage.showVspRepository(); + ExtentTestActions.log(Status.INFO,String.format("Going to import %s", vnfFile.substring(0, vnfFile.indexOf(".")))); + importVSP(createVendorSoftwareProduct); + + ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen(); + + // Verify deployment artifacts + Map<String, Object> combinedMap = ArtifactFromCsar.combineHeatArtifacstWithFolderArtifacsToMap(latestFilefromDir.getAbsolutePath()); + + LinkedList<HeatMetaFirstLevelDefinition> deploymentArtifacts = ((LinkedList<HeatMetaFirstLevelDefinition>) combinedMap.get("Deployment")); + ArtifactsCorrelationManager.addVNFartifactDetails(vspName, deploymentArtifacts); + + List<String> heatEnvFilesFromCSAR = deploymentArtifacts.stream().filter(e -> e.getType().equals("HEAT_ENV")). + map(e -> e.getFileName()). + collect(Collectors.toList()); + + validateDeploymentArtifactsVersion(deploymentArtifacts, heatEnvFilesFromCSAR); + + DeploymentArtifactPage.verifyArtifactsExistInTable(filepath, vnfFile); + return createVendorSoftwareProduct; + } + + public static void validateDeploymentArtifactsVersion(LinkedList<HeatMetaFirstLevelDefinition> deploymentArtifacts, + List<String> heatEnvFilesFromCSAR) { + String artifactVersion; + String artifactName; + + for(HeatMetaFirstLevelDefinition deploymentArtifact: deploymentArtifacts) { + artifactVersion = "1"; + + if(deploymentArtifact.getType().equals("HEAT_ENV")) { + continue; + } else if(deploymentArtifact.getFileName().contains(".")) { + artifactName = deploymentArtifact.getFileName().trim().substring(0, deploymentArtifact.getFileName().lastIndexOf(".")); + } else { + artifactName = deploymentArtifact.getFileName().trim(); + } + + if (heatEnvFilesFromCSAR.contains(artifactName + ".env")){ + artifactVersion = "2"; + } + ArtifactUIUtils.validateArtifactNameVersionType(artifactName, artifactVersion, deploymentArtifact.getType()); + } + } + +// public static VendorSoftwareProductObject updateVSPWithNewVLMParameters(VendorSoftwareProductObject vendorSoftwareProductObject, +// AmdocsLicenseMembers amdocsLicenseMembers, User user, String vspCurrentVersion, String vspNextVersion) throws Exception { +// +// LicensingVersion licensingVersion = new LicensingVersion(amdocsLicenseMembers.getLicenseVersionId(),amdocsLicenseMembers.getLicenseVersionId()); +// LicensingData licensingData = new LicensingData(amdocsLicenseMembers.getVendorLicenseAgreementId(), Arrays.asList(amdocsLicenseMembers.getFeatureGroupId())); +// vendorSoftwareProductObject.setVendorId(amdocsLicenseMembers.getVendorId()); +// vendorSoftwareProductObject.setVendorName(amdocsLicenseMembers.getVendorLicenseName()); +// vendorSoftwareProductObject.setLicensingVersion(licensingVersion); +// vendorSoftwareProductObject.setLicensingData(licensingData); +// +// VendorSoftwareProductObjectReqDetails vendorSoftwareProductObjectReqDetails = new VendorSoftwareProductObjectReqDetails( +// vendorSoftwareProductObject.getName(), +// vendorSoftwareProductObject.getDescription(), +// vendorSoftwareProductObject.getCategory(), +// vendorSoftwareProductObject.getSubCategory(), +// vendorSoftwareProductObject.getVendorId(), +// vendorSoftwareProductObject.getVendorName(), +// licensingVersion, +// licensingData, +// vendorSoftwareProductObject.getOnboardingMethod(), +// vendorSoftwareProductObject.getNetworkPackageName(), +// vendorSoftwareProductObject.getOnboardingOrigin()); +// +// Gson gson = new Gson(); +// String json = gson.toJson(vendorSoftwareProductObjectReqDetails); +// +// RestResponse checkout = checkoutVendorSoftwareProduct(vendorSoftwareProductObject.getVspId(), user, "1.0"); +// assertEquals("did not succeed to checkout new VSP", 200, checkout.getErrorCode().intValue()); +// +// Config config = Utils.getConfig(); +// String url = String.format(Urls.UPDATE_VSP, config.getCatalogBeHost(), config.getCatalogBePort(), vendorSoftwareProductObject.getVspId(), vspCurrentVersion); +// String userId = user.getUserId(); +// +// Map<String, String> headersMap = prepareHeadersMap(userId); +// HttpRequest http = new HttpRequest(); +// +// RestResponse response = http.httpSendPut(url, json, headersMap); +// +// RestResponse checkin = checkinVendorSoftwareProduct(vendorSoftwareProductObject.getVspId(), user, vspCurrentVersion); +// assertEquals("did not succeed to checking VSP", 200, checkin.getErrorCode().intValue()); +// +// RestResponse submit = submitVendorSoftwareProduct(vendorSoftwareProductObject.getVspId(), user, vspCurrentVersion); +// assertEquals("did not succeed to submit VSP", 200, submit.getErrorCode().intValue()); +// +// vendorSoftwareProductObject.setVersion(vspNextVersion); +// +// return vendorSoftwareProductObject; +// } + +// /** +// * @return +// * The method returns VNF names list from Files directory under sdc-vnfs repository +// */ +// public static List<String> getVnfNamesFileList() { +// String filepath = FileHandling.getVnfRepositoryPath(); +// List<String> fileNamesFromFolder = FileHandling.getZipFileNamesFromFolder(filepath); +// fileNamesFromFolder.removeAll(exludeVnfList); +// return fileNamesFromFolder; +// } +// +// /** +// * @return +// * The method returns VNF names list from Files directory under sdc-vnfs repository excluding zip files that known as failed in tosca parser +// */ +// public static List<String> getVnfNamesFileListExcludeToscaParserFailure() { +// List<String> fileNamesFromFolder = getVnfNamesFileList(); +// fileNamesFromFolder.removeAll(exludeVnfListForToscaParser); +// return fileNamesFromFolder; +// } + +} + + @@ -20,73 +20,33 @@ package org.openecomp.sdc.ci.tests.utilities; -import static org.testng.AssertJUnit.assertTrue; - -import java.io.BufferedInputStream; -import java.io.BufferedOutputStream; -import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.bouncycastle.util.encoders.Base64; -import org.openecomp.sdc.be.model.Component; -import org.openecomp.sdc.be.model.Resource; -import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.ci.tests.api.Urls; -import org.openecomp.sdc.ci.tests.config.Config; -import org.openecomp.sdc.ci.tests.datatypes.AmdocsLicenseMembers; -import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; -import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; -import org.openecomp.sdc.ci.tests.datatypes.VendorSoftwareProductObject; -import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum; -import org.openecomp.sdc.ci.tests.datatypes.enums.ServiceCategoriesEnum; -import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; -import org.openecomp.sdc.ci.tests.datatypes.http.HttpHeaderEnum; -import org.openecomp.sdc.ci.tests.datatypes.http.HttpRequest; -import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; -import org.openecomp.sdc.ci.tests.utils.Utils; -import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils; -import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; -import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils; - -import com.clearspring.analytics.util.Pair; -import com.google.gson.Gson; - -import fj.data.Either; - public class OnboardingUtillViaApis { - protected static Map<String, String> prepareHeadersMap(String userId) { - Map<String, String> headersMap = new HashMap<String, String>(); - headersMap.put(HttpHeaderEnum.CONTENT_TYPE.getValue(), "application/json"); - headersMap.put(HttpHeaderEnum.ACCEPT.getValue(), "application/json"); - headersMap.put(HttpHeaderEnum.USER_ID.getValue(), userId); - return headersMap; - } +// protected static Map<String, String> prepareHeadersMap(String userId) { +// Map<String, String> headersMap = new HashMap<String, String>(); +// headersMap.put(HttpHeaderEnum.CONTENT_TYPE.getValue(), "application/json"); +// headersMap.put(HttpHeaderEnum.ACCEPT.getValue(), "application/json"); +// headersMap.put(HttpHeaderEnum.USER_ID.getValue(), userId); +// return headersMap; +// } - public static Pair<String, VendorSoftwareProductObject> createVspViaApis(String filepath, String vnfFile, User user) throws Exception { - - VendorSoftwareProductObject vendorSoftwareProductObject = new VendorSoftwareProductObject(); - - AmdocsLicenseMembers amdocsLicenseMembers = OnboardingUtils.createVendorLicense(user); - Pair<String, Map<String, String>> createVendorSoftwareProduct = OnboardingUtils.createVendorSoftwareProduct(vnfFile, filepath, user, amdocsLicenseMembers); - Map<String, String> map = createVendorSoftwareProduct.right; - vendorSoftwareProductObject.setAttContact(map.get("attContact")); - vendorSoftwareProductObject.setCategory(map.get("category")); - vendorSoftwareProductObject.setComponentId(map.get("componentId")); - vendorSoftwareProductObject.setDescription(map.get("description")); - vendorSoftwareProductObject.setSubCategory(map.get("subCategory")); - vendorSoftwareProductObject.setVendorName(map.get("vendorName")); - vendorSoftwareProductObject.setVspId(map.get("vspId")); - Pair<String, VendorSoftwareProductObject> pair = new Pair<String, VendorSoftwareProductObject>(createVendorSoftwareProduct.left, vendorSoftwareProductObject); - return pair; - } +// public static Pair<String, VendorSoftwareProductObject> createVspViaApis(ResourceReqDetails resourceReqDetails, String filepath, String vnfFile, User user, Boolean skipReport) throws Exception { +// +// VendorSoftwareProductObject vendorSoftwareProductObject = new VendorSoftwareProductObject(); +// +// AmdocsLicenseMembers amdocsLicenseMembers = OnboardingUiUtils.createVendorLicense(user); +// Pair<String, Map<String, String>> createVendorSoftwareProduct = OnboardingUiUtils.createVendorSoftwareProduct(resourceReqDetails, vnfFile, filepath, user, amdocsLicenseMembers); +// Map<String, String> map = createVendorSoftwareProduct.right; +// vendorSoftwareProductObject.setAttContact(map.get("attContact")); +// vendorSoftwareProductObject.setCategory(map.get("category")); +// vendorSoftwareProductObject.setComponentId(map.get("componentId")); +// vendorSoftwareProductObject.setDescription(map.get("description")); +// vendorSoftwareProductObject.setSubCategory(map.get("subCategory")); +// vendorSoftwareProductObject.setVendorName(map.get("vendorName")); +// vendorSoftwareProductObject.setVspId(map.get("vspId")); +// Pair<String, VendorSoftwareProductObject> pair = new Pair<String, VendorSoftwareProductObject>(createVendorSoftwareProduct.left, vendorSoftwareProductObject); +// return pair; +// } /* public static Resource createResourceFromVSP(Pair<String, Map<String, String>> createVendorSoftwareProduct, String vspName) throws Exception { List<String> tags = new ArrayList<>(); @@ -110,39 +70,22 @@ public class OnboardingUtillViaApis { return resource; }*/ - public static Resource createResourceFromVSP(ResourceReqDetails resourceDetails, String vspName) throws Exception { -// List<String> tags = new ArrayList<>(); -// tags.add(vspName); -// Map<String, String> map = createVendorSoftwareProduct.right; -// ResourceReqDetails resourceDetails = new ResourceReqDetails(); -// resourceDetails.setCsarUUID(map.get("vspId")); -// resourceDetails.setCsarVersion("1.0"); -// resourceDetails.setName(vspName); -// resourceDetails.setTags(tags); -// resourceDetails.setDescription(map.get("description")); -// resourceDetails.setResourceType(map.get("componentType")); -// resourceDetails.addCategoryChain(ResourceCategoryEnum.GENERIC_DATABASE.getCategory(), ResourceCategoryEnum.GENERIC_DATABASE.getSubCategory()); -// resourceDetails.setVendorName(map.get("vendorName")); -// resourceDetails.setVendorRelease("1.0"); -// resourceDetails.setResourceType("VF"); -// resourceDetails.setResourceVendorModelNumber("666"); -// resourceDetails.setContactId(map.get("attContact")); -// resourceDetails.setIcon("defaulticon"); - Resource resource = AtomicOperationUtils.createResourceByResourceDetails(resourceDetails, UserRoleEnum.DESIGNER, true).left().value(); - - return resource; - } - public static void downloadToscaCsarToDirectory(Component component, File file) { - try { - Either<String, RestResponse> componentToscaArtifactPayload = AtomicOperationUtils.getComponenetArtifactPayload(component, "assettoscacsar"); - if(componentToscaArtifactPayload.left().value() != null){ - convertPayloadToFile(componentToscaArtifactPayload.left().value(), file); - } - } catch (Exception e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } + +// public static Resource createResourceFromVSP(ResourceReqDetails resourceDetails) throws Exception { +// Resource resource = AtomicOperationUtils.createResourceByResourceDetails(resourceDetails, UserRoleEnum.DESIGNER, true).left().value(); +// return resource; +// } + +// public static void downloadToscaCsarToDirectory(Component component, File file) { +// try { +// Either<String, RestResponse> componentToscaArtifactPayload = AtomicOperationUtils.getComponenetArtifactPayload(component, "assettoscacsar"); +// if(componentToscaArtifactPayload.left().value() != null){ +// convertPayloadToFile(componentToscaArtifactPayload.left().value(), file); +// } +// } catch (Exception e) { +// e.printStackTrace(); +// } +// } // public static void convertPayloadToFile(String payload, File file, boolean isBased64, boolean isSdcFormat) throws IOException{ // @@ -167,132 +110,131 @@ public class OnboardingUtillViaApis { // // } - public static void convertPayloadToFile(String payload, File file) throws IOException{ - - Gson gson = new Gson(); - @SuppressWarnings("unchecked") - Map<String, String> fromJson = gson.fromJson(payload, Map.class); - String string = fromJson.get("base64Contents").toString(); - byte[] byteArray = Base64.decode(string.getBytes(StandardCharsets.UTF_8)); - File downloadedFile = new File(file.getAbsolutePath()); - FileOutputStream fos = new FileOutputStream(downloadedFile); - fos.write(byteArray); - fos.flush(); - fos.close(); - } +// public static void convertPayloadToFile(String payload, File file) throws IOException{ +// +// Gson gson = new Gson(); +// @SuppressWarnings("unchecked") +// Map<String, String> fromJson = gson.fromJson(payload, Map.class); +// String string = fromJson.get("base64Contents").toString(); +// byte[] byteArray = Base64.decode(string.getBytes(StandardCharsets.UTF_8)); +// File downloadedFile = new File(file.getAbsolutePath()); +// FileOutputStream fos = new FileOutputStream(downloadedFile); +// fos.write(byteArray); +// fos.flush(); +// fos.close(); +// } - public static void convertPayloadToZipFile(String payload, File file) throws IOException{ - - byte[] byteArray = payload.getBytes(StandardCharsets.ISO_8859_1); - File downloadedFile = new File(file.getAbsolutePath()); - FileOutputStream fos = new FileOutputStream(downloadedFile); - fos.write(byteArray); - fos.flush(); - fos.close(); - - -// ZipOutputStream fos = null; -// -// -// for (Charset charset : Charset.availableCharsets().values()) { -// try{ -// // System.out.println("How to do it???"); -// File downloadedFile = new File(file.getAbsolutePath() + "_" + charset +".csar"); -// fos = new ZipOutputStream(new FileOutputStream(downloadedFile)); -// byte[] byteArray = payload.getBytes(charset); -// fos.write(byteArray); -// fos.flush(); -// -// } -// catch(Exception e){ -// fos.close(); -// } -// } - System.out.println(""); - -// ZipInputStream zipStream = new ZipInputStream(new ByteArrayInputStream(byteArray)); -// ZipEntry entry = null; -// while ((entry = zipStream.getNextEntry()) != null) { +// public static void convertPayloadToZipFile(String payload, File file) throws IOException{ // -// String entryName = entry.getName(); +// byte[] byteArray = payload.getBytes(StandardCharsets.ISO_8859_1); +// File downloadedFile = new File(file.getAbsolutePath()); +// FileOutputStream fos = new FileOutputStream(downloadedFile); +// fos.write(byteArray); +// fos.flush(); +// fos.close(); // -// FileOutputStream out = new FileOutputStream(file+"/"+entryName); // -// byte[] byteBuff = new byte[4096]; -// int bytesRead = 0; -// while ((bytesRead = zipStream.read(byteBuff)) != -1) -// { -// out.write(byteBuff, 0, bytesRead); -// } +//// ZipOutputStream fos = null; +//// +//// +//// for (Charset charset : Charset.availableCharsets().values()) { +//// try{ +//// // System.out.println("How to do it???"); +//// File downloadedFile = new File(file.getAbsolutePath() + "_" + charset +".csar"); +//// fos = new ZipOutputStream(new FileOutputStream(downloadedFile)); +//// byte[] byteArray = payload.getBytes(charset); +//// fos.write(byteArray); +//// fos.flush(); +//// +//// } +//// catch(Exception e){ +//// fos.close(); +//// } +//// } +// System.out.println(""); // -// out.close(); -// zipStream.closeEntry(); -// } -// zipStream.close(); -// - - - - BufferedInputStream bis = new BufferedInputStream(new ByteArrayInputStream(payload.getBytes(StandardCharsets.ISO_8859_1))); - String filePath = file.toString(); - BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(new File(filePath))); - int inByte; - while((inByte = bis.read()) != -1) bos.write(inByte); - bis.close(); - bos.close(); - } +//// ZipInputStream zipStream = new ZipInputStream(new ByteArrayInputStream(byteArray)); +//// ZipEntry entry = null; +//// while ((entry = zipStream.getNextEntry()) != null) { +//// +//// String entryName = entry.getName(); +//// +//// FileOutputStream out = new FileOutputStream(file+"/"+entryName); +//// +//// byte[] byteBuff = new byte[4096]; +//// int bytesRead = 0; +//// while ((bytesRead = zipStream.read(byteBuff)) != -1) +//// { +//// out.write(byteBuff, 0, bytesRead); +//// } +//// +//// out.close(); +//// zipStream.closeEntry(); +//// } +//// zipStream.close(); +//// +// +// +// +// BufferedInputStream bis = new BufferedInputStream(new ByteArrayInputStream(payload.getBytes(StandardCharsets.ISO_8859_1))); +// String filePath = file.toString(); +// BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(new File(filePath))); +// int inByte; +// while((inByte = bis.read()) != -1) bos.write(inByte); +// bis.close(); +// bos.close(); +// } - public static Either<String, RestResponse> getVendorSoftwareProduct(String vspId, User user, Boolean validateState) throws Exception { - - Config config = Utils.getConfig(); - String url = String.format(Urls.GET_VENDOR_SOFTWARE_PRODUCT, config.getCatalogBeHost(), config.getCatalogBePort(), vspId); - String userId = user.getUserId(); - Map<String, String> headersMap = prepareHeadersMap(userId); - headersMap.put(HttpHeaderEnum.X_ECOMP_REQUEST_ID_HEADER.getValue(), "123456"); - headersMap.put(HttpHeaderEnum.ACCEPT.getValue(), "*/*"); - headersMap.put("Accept-Encoding", "gzip, deflate, br"); - HttpRequest http = new HttpRequest(); - RestResponse response = http.httpSendGet(url, headersMap); - if (validateState) { - assertTrue("add property to resource failed: " + response.getResponseMessage(), response.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS); - } - if (response.getErrorCode() != BaseRestUtils.STATUS_CODE_SUCCESS && response.getResponse().getBytes() == null && response.getResponse().getBytes().length == 0) { - return Either.right(response); - } - return Either.left(response.getResponse()); - - } +// public static Either<String, RestResponse> getVendorSoftwareProduct(String vspId, User user, Boolean validateState) throws Exception { +// +// Config config = Utils.getConfig(); +// String url = String.format(Urls.GET_VENDOR_SOFTWARE_PRODUCT, config.getCatalogBeHost(), config.getCatalogBePort(), vspId); +// String userId = user.getUserId(); +// Map<String, String> headersMap = prepareHeadersMap(userId); +// headersMap.put(HttpHeaderEnum.X_ECOMP_REQUEST_ID_HEADER.getValue(), "123456"); +// headersMap.put(HttpHeaderEnum.ACCEPT.getValue(), "*/*"); +// headersMap.put("Accept-Encoding", "gzip, deflate, br"); +// HttpRequest http = new HttpRequest(); +// RestResponse response = http.httpSendGet(url, headersMap); +// if (validateState) { +// assertTrue("add property to resource failed: " + response.getResponseMessage(), response.getErrorCode() == BaseRestUtils.STATUS_CODE_SUCCESS); +// } +// if (response.getErrorCode() != BaseRestUtils.STATUS_CODE_SUCCESS && response.getResponse().getBytes() == null && response.getResponse().getBytes().length == 0) { +// return Either.right(response); +// } +// return Either.left(response.getResponse()); +// +// } - public static ResourceReqDetails prepareOnboardedResourceDetailsBeforeCreate(VendorSoftwareProductObject vendorSoftwareProductObject, String vspName) { - - List<String> tags = new ArrayList<>(); - tags.add(vspName); - ResourceReqDetails resourceDetails = new ResourceReqDetails(); - resourceDetails.setCsarUUID(vendorSoftwareProductObject.getVspId()); - resourceDetails.setCsarVersion("1.0"); - resourceDetails.setName(vspName); - resourceDetails.setTags(tags); - resourceDetails.setDescription(vendorSoftwareProductObject.getDescription()); - resourceDetails.addCategoryChain(ResourceCategoryEnum.GENERIC_DATABASE.getCategory(), ResourceCategoryEnum.GENERIC_DATABASE.getSubCategory()); - resourceDetails.setVendorName(vendorSoftwareProductObject.getVendorName()); - resourceDetails.setVendorRelease("1.0"); - resourceDetails.setResourceType("VF"); - resourceDetails.setResourceVendorModelNumber("666"); - resourceDetails.setContactId(vendorSoftwareProductObject.getAttContact()); - resourceDetails.setIcon("defaulticon"); - - return resourceDetails; - } +// public static ResourceReqDetails prepareOnboardedResourceDetailsBeforeCreate(ResourceReqDetails resourceDetails, VendorSoftwareProductObject vendorSoftwareProductObject) { +// +// List<String> tags = new ArrayList<>(); +// tags.add(vendorSoftwareProductObject.getName()); +//// ResourceReqDetails resourceDetails = new ResourceReqDetails(); +// resourceDetails.setCsarUUID(vendorSoftwareProductObject.getVspId()); +// resourceDetails.setCsarVersion(vendorSoftwareProductObject.getVersion()); +// resourceDetails.setName(vendorSoftwareProductObject.getName()); +// resourceDetails.setTags(tags); +// resourceDetails.setDescription(vendorSoftwareProductObject.getDescription()); +//// resourceDetails.addCategoryChain(ResourceCategoryEnum.GENERIC_DATABASE.getCategory(), ResourceCategoryEnum.GENERIC_DATABASE.getSubCategory()); +// resourceDetails.setVendorName(vendorSoftwareProductObject.getVendorName()); +//// resourceDetails.setVendorRelease("1.0"); +// resourceDetails.setResourceType("VF"); +// resourceDetails.setResourceVendorModelNumber("666"); +// resourceDetails.setContactId(vendorSoftwareProductObject.getAttContact()); +//// resourceDetails.setIcon("defaulticon"); +// +// return resourceDetails; +// } - public static ServiceReqDetails prepareServiceDetailsBeforeCreate(User user) { + /*public static ServiceReqDetails prepareServiceDetailsBeforeCreate(ServiceReqDetails serviceDetails, User user) { - ServiceReqDetails serviceDetails = ElementFactory.getDefaultService(ServiceCategoriesEnum.NETWORK_L4, user); serviceDetails.setServiceType("MyServiceType"); serviceDetails.setServiceRole("MyServiceRole"); serviceDetails.setNamingPolicy("MyServiceNamingPolicy"); - serviceDetails.setEcompGeneratedNaming(false); + serviceDetails.setEcompGeneratedNaming(true); return serviceDetails; - } + }*/ } @@ -1,814 +0,0 @@ -/*- - * ============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.ci.tests.utilities; - -import static org.testng.AssertJUnit.assertEquals; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; -import java.io.StringWriter; -import java.nio.file.FileSystems; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.UUID; -import java.util.stream.Collectors; - -import org.apache.commons.io.IOUtils; -import org.apache.http.HttpEntity; -import org.apache.http.client.ClientProtocolException; -import org.apache.http.client.methods.CloseableHttpResponse; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.entity.mime.MultipartEntityBuilder; -import org.apache.http.entity.mime.content.FileBody; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClients; -import org.json.JSONException; -import org.json.JSONObject; -import org.json.simple.JSONArray; -import org.json.simple.JSONValue; -import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.ci.tests.config.Config; -import org.openecomp.sdc.ci.tests.datatypes.AmdocsLicenseMembers; -import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; -import org.openecomp.sdc.ci.tests.datatypes.HeatMetaFirstLevelDefinition; -import org.openecomp.sdc.ci.tests.datatypes.LifeCycleStateEnum; -import org.openecomp.sdc.ci.tests.datatypes.VendorSoftwareProductObject; -import org.openecomp.sdc.ci.tests.datatypes.http.HttpHeaderEnum; -import org.openecomp.sdc.ci.tests.datatypes.http.HttpRequest; -import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; -import org.openecomp.sdc.ci.tests.execute.devCI.ArtifactFromCsar; -import org.openecomp.sdc.ci.tests.execute.setup.ArtifactsCorrelationManager; -import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions; -import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; -import org.openecomp.sdc.ci.tests.pages.DeploymentArtifactPage; -import org.openecomp.sdc.ci.tests.pages.HomePage; -import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage; -import org.openecomp.sdc.ci.tests.utils.Utils; -import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; -import org.openecomp.sdc.ci.tests.verificator.VfVerificator; -import org.openqa.selenium.WebElement; -import org.testng.Assert; - -import com.aventstack.extentreports.Status; -import com.clearspring.analytics.util.Pair; - -public class OnboardingUtils { - - protected static List<String> exludeVnfList = Arrays.asList("2016-197_vscp_vscp-fw_1610_e2e.zip", "2016-281_vProbes_BE_11_1_f_30_1610_e2e.zip", - "2016-282_vProbes_FE_11_1_f_30_1610_e2e.zip", "2016-044_vfw_fnat_30_1607_e2e.zip", "2017-376_vMOG_11_1.zip", "vMOG.zip", - "vMRF_USP_AIC3.0_1702.zip", "2016-211_vprobesbe_vprobes_be_30_1610_e2e.zip", "2016-005_vprobesfe_vprobes_fe_30_1607_e2e.zip", - "vMRF_RTT.zip", "2016-006_vvm_vvm_30_1607_e2e.zip", "2016-001_vvm_vvm_30_1607_e2e.zip"); - - public OnboardingUtils() { - } - - public static Pair<String, Map<String, String>> createVendorSoftwareProduct(String HeatFileName, String filepath, User user, AmdocsLicenseMembers amdocsLicenseMembers) - throws Exception { - Pair<String, Map<String, String>> pair = createVSP(HeatFileName, filepath, user, amdocsLicenseMembers); - - String vspid = pair.right.get("vspId"); - - prepareVspForUse(user, vspid); - - return pair; - } - - public static void prepareVspForUse(User user, String vspid) throws Exception { - RestResponse checkin = checkinVendorSoftwareProduct(vspid, user); - assertEquals("did not succeed to checking new VSP", 200, checkin.getErrorCode().intValue()); - - RestResponse submit = submitVendorSoftwareProduct(vspid, user); - assertEquals("did not succeed to submit new VSP", 200, submit.getErrorCode().intValue()); - - RestResponse createPackage = createPackageOfVendorSoftwareProduct(vspid, user); - assertEquals("did not succeed to create package of new VSP ", 200, createPackage.getErrorCode().intValue()); - - SetupCDTest.getExtendTest().log(Status.INFO, "Succeeded in creating the vendor software product"); - } - - public static Pair<String, Map<String, String>> createVSP(String HeatFileName, String filepath, User user, AmdocsLicenseMembers amdocsLicenseMembers) throws Exception { - String vspName = handleFilename(HeatFileName); - - SetupCDTest.getExtendTest().log(Status.INFO, "Starting to create the vendor software product"); - - Pair<RestResponse, Map<String, String>> createNewVspPair = createNewVendorSoftwareProduct(vspName, amdocsLicenseMembers, user); - RestResponse createNewVendorSoftwareProduct = createNewVspPair.left; - assertEquals("did not succeed to create new VSP", 200,createNewVendorSoftwareProduct.getErrorCode().intValue()); - String vspid = ResponseParser.getValueFromJsonResponse(createNewVendorSoftwareProduct.getResponse(), "vspId"); - String componentId = ResponseParser.getValueFromJsonResponse(createNewVendorSoftwareProduct.getResponse(), "componentId"); - - Map<String, String> vspMeta = createNewVspPair.right; - Map<String, String> vspObject = new HashMap<String, String>(); - Iterator<String> iterator = vspMeta.keySet().iterator(); - while(iterator.hasNext()){ - Object key = iterator.next(); - Object value = vspMeta.get(key); - vspObject.put(key.toString(), value.toString()); - } - vspObject.put("vspId", vspid); - vspObject.put("componentId", componentId); - vspObject.put("vendorName", amdocsLicenseMembers.getVendorLicenseName()); - vspObject.put("attContact", user.getUserId()); - - RestResponse uploadHeatPackage = uploadHeatPackage(filepath, HeatFileName, vspid, user); - assertEquals("did not succeed to upload HEAT package", 200, uploadHeatPackage.getErrorCode().intValue()); - - RestResponse validateUpload = validateUpload(vspid, user); - assertEquals("did not succeed to validate upload process", 200, validateUpload.getErrorCode().intValue()); - - Pair<String, Map<String, String>> pair = new Pair<String, Map<String, String>>(vspName, vspObject); - - return pair; - } - - public static void updateVspWithVfcArtifacts(String filepath, String vspId, String updatedSnmpPoll, String updatedSnmpTrap, String componentId, User user) throws Exception{ - RestResponse checkout = checkoutVendorSoftwareProduct(vspId, user); - assertEquals("did not succeed to checkout new VSP", 200, checkout.getErrorCode().intValue()); - ExtentTestActions.log(Status.INFO, "Deleting SNMP POLL"); - deleteSnmpArtifact(componentId, vspId, user, SnmpTypeEnum.SNMP_POLL); - ExtentTestActions.log(Status.INFO, "Deleting SNMP TRAP"); - deleteSnmpArtifact(componentId, vspId, user, SnmpTypeEnum.SNMP_TRAP); - addVFCArtifacts(filepath, updatedSnmpPoll, updatedSnmpTrap, vspId, user, componentId); - prepareVspForUse(user, vspId); - } - - public static String updateVendorSoftwareProduct(String vspId, String HeatFileName, String filepath, User user) - throws Exception, Throwable { - String vspName = handleFilename(HeatFileName); - SetupCDTest.getExtendTest().log(Status.INFO, "Starting to update the vendor software product"); - - RestResponse checkout = checkoutVendorSoftwareProduct(vspId, user); - assertEquals("did not succeed to checkout new VSP", 200, checkout.getErrorCode().intValue()); - - RestResponse uploadHeatPackage = uploadHeatPackage(filepath, HeatFileName, vspId, user); - assertEquals("did not succeed to upload HEAT package", 200, uploadHeatPackage.getErrorCode().intValue()); - - RestResponse validateUpload = validateUpload(vspId, user); - assertEquals("did not succeed to validate upload process", 200, validateUpload.getErrorCode().intValue()); - - RestResponse checkin = checkinVendorSoftwareProduct(vspId, user); - assertEquals("did not succeed to checking VSP", 200, checkin.getErrorCode().intValue()); - - - RestResponse submit = submitVendorSoftwareProduct(vspId, user); - assertEquals("did not succeed to submit VSP", 200, submit.getErrorCode().intValue()); - - RestResponse createPackage = createPackageOfVendorSoftwareProduct(vspId, user); - assertEquals("did not succeed to update package of VSP ", 200, createPackage.getErrorCode().intValue()); - - SetupCDTest.getExtendTest().log(Status.INFO, "Succeeded in updating the vendor software product"); - - return vspName; - } - - public static String handleFilename(String heatFileName) { - final String namePrefix = "ciVFOnboarded-"; - final String nameSuffix = "-" + getShortUUID(); - - String subHeatFileName = heatFileName.substring(0, heatFileName.lastIndexOf(".")); - - if ((namePrefix + subHeatFileName + nameSuffix).length() >= 50) { - subHeatFileName = subHeatFileName.substring(0, 50 - namePrefix.length() - nameSuffix.length()); - } - - if (subHeatFileName.contains("(") || subHeatFileName.contains(")")) { - subHeatFileName = subHeatFileName.replace("(", "-"); - subHeatFileName = subHeatFileName.replace(")", "-"); - } - - String vnfName = namePrefix + subHeatFileName + nameSuffix; - return vnfName; - } - - public static String addVFCArtifacts(String filepath, String snmpPoll, String snmpTrap, String vspid, User user, String vspComponentId) throws Exception{ - vspComponentId = (vspComponentId == null) ? getVSPComponentId(vspid, user) : vspComponentId; - if (vspComponentId != null){ - if (snmpPoll != null){ - ExtentTestActions.log(Status.INFO, "Adding VFC artifact of type SNMP POLL with the file " + snmpPoll); - RestResponse uploadSnmpPollArtifact = uploadSnmpPollArtifact(filepath, snmpPoll, vspid, user, vspComponentId); - assertEquals("Did not succeed to add SNMP POLL", 200, uploadSnmpPollArtifact.getErrorCode().intValue()); - } - if (snmpTrap != null){ - ExtentTestActions.log(Status.INFO, "Adding VFC artifact of type SNMP TRAP with the file " + snmpTrap); - RestResponse uploadSnmpTrapArtifact = uploadSnmpTrapArtifact(filepath, snmpTrap, vspid, user, vspComponentId); - assertEquals("Did not succeed to add SNMP TRAP", 200, uploadSnmpTrapArtifact.getErrorCode().intValue()); - } - } - - return vspComponentId; - } - - public static String addVFCArtifacts(String filepath, String snmpPoll, String snmpTrap, String vspid, User user) throws Exception{ - return addVFCArtifacts(filepath, snmpPoll, snmpTrap, vspid, user, null); - } - - private static RestResponse uploadSnmpPollArtifact(String filepath, String zipArtifact, String vspid, User user, - String vspComponentId) throws FileNotFoundException, IOException, ClientProtocolException { - Config config = Utils.getConfig(); - String snmpPollUrl = String.format("http://%s:%s/onboarding-api/v1.0/vendor-software-products/%s/versions/0.1/components/%s/monitors/snmp/upload", - config.getCatalogBeHost(),config.getCatalogBePort(), vspid, vspComponentId); - return uploadFile(filepath, zipArtifact, snmpPollUrl, user); - } - - private static RestResponse uploadSnmpTrapArtifact(String filepath, String zipArtifact, String vspid, User user, - String vspComponentId) throws FileNotFoundException, IOException, ClientProtocolException { - Config config = Utils.getConfig(); - String snmpTrapUrl = String.format("http://%s:%s/onboarding-api/v1.0/vendor-software-products/%s/versions/0.1/components/%s/monitors/snmp-trap/upload", - config.getCatalogBeHost(),config.getCatalogBePort(), vspid, vspComponentId); - return uploadFile(filepath, zipArtifact, snmpTrapUrl, user); - } - - private static RestResponse deleteSnmpArtifact(String componentId, String vspId, User user, SnmpTypeEnum snmpType) throws Exception - { - Config config = Utils.getConfig(); - String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-software-products/%s/versions/0.1/components/%s/monitors/%s", - config.getCatalogBeHost(),config.getCatalogBePort(), vspId, componentId, snmpType.getValue()); - String userId = user.getUserId(); - - Map<String, String> headersMap = prepareHeadersMap(userId); - - HttpRequest http = new HttpRequest(); - RestResponse response = http.httpSendDelete(url, headersMap); - return response; - } - - - - private static String getVSPComponentId(String vspid, User user) throws Exception, JSONException { - RestResponse components = getVSPComponents(vspid, user); - String response = components.getResponse(); - Map<String, Object> responseMap = (Map<String, Object>) JSONValue.parse(response); - JSONArray results = (JSONArray)responseMap.get("results"); - for (Object res : results){ - Map<String, Object> compMap= (Map<String, Object>) JSONValue.parse(res.toString()); - String componentId = compMap.get("id").toString(); - return componentId; - } - return null; - } - - private static RestResponse getVSPComponents(String vspid, User user) throws Exception{ - Config config = Utils.getConfig(); - String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-software-products/%s/versions/0.1/components", config.getCatalogBeHost(),config.getCatalogBePort(), vspid); - String userId = user.getUserId(); - - Map<String, String> headersMap = prepareHeadersMap(userId); - - HttpRequest http = new HttpRequest(); - RestResponse response = http.httpSendGet(url, headersMap); - return response; - } - - public static AmdocsLicenseMembers createVendorLicense(User user) throws Exception { - - AmdocsLicenseMembers amdocsLicenseMembers; - SetupCDTest.getExtendTest().log(Status.INFO, "Starting to create the vendor license"); - String vendorLicenseName = "ciLicense" + getShortUUID(); - RestResponse vendorLicenseResponse = createVendorLicenseModels_1(vendorLicenseName, user); - assertEquals("did not succeed to create vendor license model", 200, vendorLicenseResponse.getErrorCode().intValue()); - String vendorId = ResponseParser.getValueFromJsonResponse(vendorLicenseResponse.getResponse(), "value"); - - RestResponse vendorKeyGroupsResponse = createVendorKeyGroups_2(vendorId, user); - assertEquals("did not succeed to create vendor key groups", 200, vendorKeyGroupsResponse.getErrorCode().intValue()); - String keyGroupId = ResponseParser.getValueFromJsonResponse(vendorKeyGroupsResponse.getResponse(), "value"); - - RestResponse vendorEntitlementPool = createVendorEntitlementPool_3(vendorId, user); - assertEquals("did not succeed to create vendor entitlement pool", 200, vendorEntitlementPool.getErrorCode().intValue()); - String entitlementPoolId = ResponseParser.getValueFromJsonResponse(vendorEntitlementPool.getResponse(), "value"); - - RestResponse vendorLicenseFeatureGroups = createVendorLicenseFeatureGroups_4(vendorId, keyGroupId, entitlementPoolId, user); - assertEquals("did not succeed to create vendor license feature groups", 200, vendorLicenseFeatureGroups.getErrorCode().intValue()); - String featureGroupId = ResponseParser.getValueFromJsonResponse(vendorLicenseFeatureGroups.getResponse(), "value"); - - RestResponse vendorLicenseAgreement = createVendorLicenseAgreement_5(vendorId, featureGroupId, user); - assertEquals("did not succeed to create vendor license agreement", 200, vendorLicenseAgreement.getErrorCode().intValue()); - String vendorLicenseAgreementId = ResponseParser.getValueFromJsonResponse(vendorLicenseAgreement.getResponse(), "value"); - - RestResponse checkinVendorLicense = checkinVendorLicense(vendorId, user); - assertEquals("did not succeed to checkin vendor license", 200, checkinVendorLicense.getErrorCode().intValue()); - - RestResponse submitVendorLicense = submitVendorLicense(vendorId, user); - assertEquals("did not succeed to submit vendor license", 200, submitVendorLicense.getErrorCode().intValue()); - - SetupCDTest.getExtendTest().log(Status.INFO, "Succeeded in creating the vendor license"); - - amdocsLicenseMembers = new AmdocsLicenseMembers(vendorId, vendorLicenseName, vendorLicenseAgreementId, featureGroupId); - - return amdocsLicenseMembers; - } - - private static String getShortUUID() { - return UUID.randomUUID().toString().split("-")[0]; - } - - private static RestResponse actionOnComponent(String vspid, String action, String onboardComponent, User user) - throws Exception { - Config config = Utils.getConfig(); - String url = String.format("http://%s:%s/onboarding-api/v1.0/" + onboardComponent + "/%s/versions/0.1/actions", - config.getCatalogBeHost(), config.getCatalogBePort(), vspid); - String userId = user.getUserId(); - - JSONObject jObject = new JSONObject(); - jObject.put("action", action); - - Map<String, String> headersMap = prepareHeadersMap(userId); - - HttpRequest http = new HttpRequest(); - RestResponse response = http.httpSendPut(url, jObject.toString(), headersMap); - return response; - } - - public static RestResponse checkinVendorLicense(String vspid, User user) throws Exception { - return actionOnComponent(vspid, "Checkin", "vendor-license-models", user); - } - - public static RestResponse submitVendorLicense(String vspid, User user) throws Exception { - return actionOnComponent(vspid, "Submit", "vendor-license-models", user); - } - - public static RestResponse createVendorLicenseModels_1(String name, User user) throws Exception { - Config config = Utils.getConfig(); - String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-license-models", config.getCatalogBeHost(), - config.getCatalogBePort()); - String userId = user.getUserId(); - - JSONObject jObject = new JSONObject(); - jObject.put("vendorName", name); - jObject.put("description", "new vendor license model"); - jObject.put("iconRef", "icon"); - - Map<String, String> headersMap = prepareHeadersMap(userId); - - HttpRequest http = new HttpRequest(); - RestResponse response = http.httpSendPost(url, jObject.toString(), headersMap); - return response; - - } - - public static RestResponse createVendorLicenseAgreement_5(String vspid, String featureGroupId, User user) - throws Exception { - Config config = Utils.getConfig(); - String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-license-models/%s/versions/0.1/license-agreements", - config.getCatalogBeHost(), config.getCatalogBePort(), vspid); - String userId = user.getUserId(); - - JSONObject licenseTermpObject = new JSONObject(); - licenseTermpObject.put("choice", "Fixed_Term"); - licenseTermpObject.put("other", ""); - - JSONObject jObjectBody = new JSONObject(); - jObjectBody.put("name", "abc"); - jObjectBody.put("description", "new vendor license agreement"); - jObjectBody.put("requirementsAndConstrains", "abc"); - jObjectBody.put("licenseTerm", licenseTermpObject); - jObjectBody.put("addedFeatureGroupsIds", Arrays.asList(featureGroupId).toArray()); - - Map<String, String> headersMap = prepareHeadersMap(userId); - - HttpRequest http = new HttpRequest(); - RestResponse response = http.httpSendPost(url, jObjectBody.toString(), headersMap); - return response; - } - - public static RestResponse createVendorLicenseFeatureGroups_4(String vspid, String licenseKeyGroupId, - String entitlementPoolId, User user) throws Exception { - Config config = Utils.getConfig(); - String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-license-models/%s/versions/0.1/feature-groups", - config.getCatalogBeHost(), config.getCatalogBePort(), vspid); - String userId = user.getUserId(); - - JSONObject jObject = new JSONObject(); - jObject.put("name", "xyz"); - jObject.put("description", "new vendor license feature groups"); - jObject.put("partNumber", "123abc456"); - jObject.put("manufacturerReferenceNumber", "5"); - jObject.put("addedLicenseKeyGroupsIds", Arrays.asList(licenseKeyGroupId).toArray()); - jObject.put("addedEntitlementPoolsIds", Arrays.asList(entitlementPoolId).toArray()); - - Map<String, String> headersMap = prepareHeadersMap(userId); - - HttpRequest http = new HttpRequest(); - RestResponse response = http.httpSendPost(url, jObject.toString(), headersMap); - return response; - - } - - public static RestResponse createVendorEntitlementPool_3(String vspid, User user) throws Exception { - Config config = Utils.getConfig(); - String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-license-models/%s/versions/0.1/entitlement-pools", - config.getCatalogBeHost(), config.getCatalogBePort(), vspid); - String userId = user.getUserId(); - - JSONObject jEntitlementMetricObject = new JSONObject(); - jEntitlementMetricObject.put("choice", "CPU"); - jEntitlementMetricObject.put("other", ""); - - JSONObject jAggregationFunctionObject = new JSONObject(); - jAggregationFunctionObject.put("choice", "Peak"); - jAggregationFunctionObject.put("other", ""); - - JSONObject jOperationalScope = new JSONObject(); - jOperationalScope.put("choices", Arrays.asList("Availability_Zone").toArray()); - jOperationalScope.put("other", ""); - - JSONObject jTimeObject = new JSONObject(); - jTimeObject.put("choice", "Hour"); - jTimeObject.put("other", ""); - - JSONObject jObjectBody = new JSONObject(); - jObjectBody.put("name", "def"+ getShortUUID()); - jObjectBody.put("description", "new vendor license entitlement pool"); - jObjectBody.put("thresholdValue", "23"); - jObjectBody.put("thresholdUnits", "Absolute"); - jObjectBody.put("entitlementMetric", jEntitlementMetricObject); - jObjectBody.put("increments", "abcd"); - jObjectBody.put("aggregationFunction", jAggregationFunctionObject); - jObjectBody.put("operationalScope", jOperationalScope); - jObjectBody.put("time", jTimeObject); - jObjectBody.put("manufacturerReferenceNumber", "123aaa"); - - Map<String, String> headersMap = prepareHeadersMap(userId); - - HttpRequest http = new HttpRequest(); - RestResponse response = http.httpSendPost(url, jObjectBody.toString(), headersMap); - return response; - } - - public static RestResponse createVendorKeyGroups_2(String vspid, User user) throws Exception { - Config config = Utils.getConfig(); - String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-license-models/%s/versions/0.1/license-key-groups", - config.getCatalogBeHost(), config.getCatalogBePort(), vspid); - String userId = user.getUserId(); - - JSONObject jOperationalScope = new JSONObject(); - jOperationalScope.put("choices", Arrays.asList("Tenant").toArray()); - jOperationalScope.put("other", ""); - - JSONObject jObjectBody = new JSONObject(); - jObjectBody.put("name", "keyGroup" + getShortUUID()); - jObjectBody.put("description", "new vendor license key group"); - jObjectBody.put("operationalScope", jOperationalScope); - jObjectBody.put("type", "Universal"); - - Map<String, String> headersMap = prepareHeadersMap(userId); - - HttpRequest http = new HttpRequest(); - RestResponse response = http.httpSendPost(url, jObjectBody.toString(), headersMap); - return response; - } - - public static Pair<RestResponse, Map<String, String>> createNewVendorSoftwareProduct(String name, AmdocsLicenseMembers amdocsLicenseMembers, User user) throws Exception { - Map<String, String> vspMetadta = new HashMap<String, String>(); - - Config config = Utils.getConfig(); - String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-software-products", - config.getCatalogBeHost(), config.getCatalogBePort()); - - String userId = user.getUserId(); - - JSONObject jlicensingDataObj = new JSONObject(); - jlicensingDataObj.put("licenseAgreement", amdocsLicenseMembers.getVendorLicenseAgreementId()); - jlicensingDataObj.put("featureGroups", Arrays.asList(amdocsLicenseMembers.getFeatureGroupId()).toArray()); - - JSONObject jlicensingVersionObj = new JSONObject(); - jlicensingVersionObj.put("id", "1.0"); - jlicensingVersionObj.put("label", "1.0"); - - JSONObject jObject = new JSONObject(); - jObject.put("name", name); - jObject.put("description", "new VSP description"); - jObject.put("category", "resourceNewCategory.generic"); - jObject.put("subCategory", "resourceNewCategory.generic.database"); - jObject.put("onboardingMethod", "HEAT"); - jObject.put("licensingVersion", jlicensingVersionObj); - jObject.put("vendorName", amdocsLicenseMembers.getVendorLicenseName()); - jObject.put("vendorId", amdocsLicenseMembers.getVendorId()); - jObject.put("icon", "icon"); - jObject.put("licensingData", jlicensingDataObj); - - vspMetadta.put("description", jObject.getString("description")); - vspMetadta.put("category", jObject.getString("category")); - vspMetadta.put("subCategory", jObject.getString("subCategory").split("\\.")[2]); - - Map<String, String> headersMap = prepareHeadersMap(userId); - HttpRequest http = new HttpRequest(); - - RestResponse response = http.httpSendPost(url, jObject.toString(), headersMap); - return new Pair<RestResponse, Map<String, String>>(response, vspMetadta); - } - - public static RestResponse validateUpload(String vspid, User user) throws Exception { - Config config = Utils.getConfig(); - String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-software-products/%s/versions/0.1/orchestration-template-candidate/process", - config.getCatalogBeHost(), config.getCatalogBePort(), vspid); - - String userId = user.getUserId(); - - Map<String, String> headersMap = prepareHeadersMap(userId); - HttpRequest http = new HttpRequest(); - - String body =null; - - RestResponse response = http.httpSendPut(url, body, headersMap); - - return response; - } - - public static RestResponse uploadHeatPackage(String filepath, String filename, String vspid, User user) throws Exception { - Config config = Utils.getConfig(); - String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-software-products/%s/versions/0.1/orchestration-template-candidate", config.getCatalogBeHost(), config.getCatalogBePort(), vspid); - return uploadFile(filepath, filename, url, user); - } - - private static RestResponse uploadFile(String filepath, String filename, String url, User user) - throws FileNotFoundException, IOException, ClientProtocolException { - CloseableHttpResponse response = null; - - MultipartEntityBuilder mpBuilder = MultipartEntityBuilder.create(); - mpBuilder.addPart("upload", new FileBody(getTestZipFile(filepath, filename))); - - Map<String, String> headersMap = prepareHeadersMap(user.getUserId()); - headersMap.put(HttpHeaderEnum.CONTENT_TYPE.getValue(), "multipart/form-data"); - - CloseableHttpClient client = HttpClients.createDefault(); - try { - HttpPost httpPost = new HttpPost(url); - RestResponse restResponse = new RestResponse(); - - Iterator<String> iterator = headersMap.keySet().iterator(); - while (iterator.hasNext()) { - String key = iterator.next(); - String value = headersMap.get(key); - httpPost.addHeader(key, value); - } - httpPost.setEntity(mpBuilder.build()); - response = client.execute(httpPost); - HttpEntity entity = response.getEntity(); - String responseBody = null; - if (entity != null) { - InputStream instream = entity.getContent(); - StringWriter writer = new StringWriter(); - IOUtils.copy(instream, writer); - responseBody = writer.toString(); - try { - - } finally { - instream.close(); - } - } - - restResponse.setErrorCode(response.getStatusLine().getStatusCode()); - restResponse.setResponse(responseBody); - - return restResponse; - - } finally { - closeResponse(response); - closeHttpClient(client); - - } - } - - private static void closeResponse(CloseableHttpResponse response) { - try { - if (response != null) { - response.close(); - } - } catch (IOException e) { - System.out.println(String.format("failed to close client or response: %s", e.getMessage())); - } - } - - private static void closeHttpClient(CloseableHttpClient client) { - try { - if (client != null) { - client.close(); - } - } catch (IOException e) { - System.out.println(String.format("failed to close client or response: %s", e.getMessage())); - } - } - - private static File getTestZipFile(String filepath, String filename) throws IOException { - Config config = Utils.getConfig(); - String sourceDir = config.getImportResourceTestsConfigDir(); - java.nio.file.Path filePath = FileSystems.getDefault().getPath(filepath + File.separator + filename); - return filePath.toFile(); - } - - public static RestResponse checkinVendorSoftwareProduct(String vspid, User user) throws Exception { - return actionOnComponent(vspid, "Checkin", "vendor-software-products", user); - } - - private static RestResponse checkoutVendorSoftwareProduct(String vspid, User user) throws Exception { - return actionOnComponent(vspid, "Checkout", "vendor-software-products", user); - } - - public static RestResponse submitVendorSoftwareProduct(String vspid, User user) throws Exception { - return actionOnComponent(vspid, "Submit", "vendor-software-products", user); - } - - public static RestResponse createPackageOfVendorSoftwareProduct(String vspid, User user) throws Exception { - return actionOnComponent(vspid, "Create_Package", "vendor-software-products", user); - } - - protected static Map<String, String> prepareHeadersMap(String userId) { - Map<String, String> headersMap = new HashMap<String, String>(); - headersMap.put(HttpHeaderEnum.CONTENT_TYPE.getValue(), "application/json"); - headersMap.put(HttpHeaderEnum.ACCEPT.getValue(), "application/json"); - headersMap.put(HttpHeaderEnum.USER_ID.getValue(), userId); - return headersMap; - } - - - private static void importUpdateVSP(Pair<String, Map<String, String>> vsp, boolean isUpdate) throws Exception{ - String vspName = vsp.left; - Map<String, String> vspMetadata = vsp.right; - boolean vspFound = HomePage.searchForVSP(vspName); - - if (vspFound){ - - List<WebElement> elemenetsFromTable = HomePage.getElemenetsFromTable(); -// WebDriverWait wait = new WebDriverWait(GeneralUIUtils.getDriver(), 30); -// WebElement findElement = wait.until(ExpectedConditions.visibilityOf(elemenetsFromTable.get(1))); -// findElement.click(); - elemenetsFromTable.get(1).click(); - GeneralUIUtils.waitForLoader(); - - if (isUpdate){ - GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ImportVfRepository.UPDATE_VSP.getValue()); - - } - else{ - GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ImportVfRepository.IMPORT_VSP.getValue()); - } - - String lifeCycleState = ResourceGeneralPage.getLifeCycleState(); - boolean needCheckout = lifeCycleState.equals(LifeCycleStateEnum.CHECKIN.getValue()) || lifeCycleState.equals(LifeCycleStateEnum.CERTIFIED.getValue()); - if (needCheckout) - { - try { - ResourceGeneralPage.clickCheckoutButton(); - Assert.assertTrue(ResourceGeneralPage.getLifeCycleState().equals(LifeCycleStateEnum.CHECKOUT.getValue()), "Did not succeed to checkout"); - - } catch (Exception e) { - ExtentTestActions.log(Status.ERROR, "Did not succeed to checkout"); - e.printStackTrace(); - } - GeneralUIUtils.waitForLoader(); - } - - //Metadata verification - VfVerificator.verifyOnboardedVnfMetadata(vspName, vspMetadata); - - ExtentTestActions.log(Status.INFO, "Clicking create/update VNF"); - String duration = GeneralUIUtils.getActionDuration(() -> waitUntilVnfCreated()); - ExtentTestActions.log(Status.INFO, "Succeeded in importing/updating " + vspName, duration); - } - else{ - Assert.fail("Did not find VSP named " + vspName); - } - } - - private static void waitUntilVnfCreated() { - GeneralUIUtils.clickOnElementByTestIdWithoutWait(DataTestIdEnum.GeneralElementsEnum.CREATE_BUTTON.getValue()); - GeneralUIUtils.waitForLoader(60*10); - GeneralUIUtils.waitForAngular(); - GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.GeneralElementsEnum.CHECKIN_BUTTON.getValue()); - } - - public static void updateVSP(Pair<String, Map<String, String>> vsp) throws Exception{ - ExtentTestActions.log(Status.INFO, "Updating VSP " + vsp.left); - importUpdateVSP(vsp, true); - } - - public static void importVSP(Pair<String, Map<String, String>> vsp) throws Exception{ - ExtentTestActions.log(Status.INFO, "Importing VSP " + vsp.left); - importUpdateVSP(vsp, false); - } - - public static void updateVnfAndValidate(String filepath, Pair<String, Map<String, String>> vsp, String updatedVnfFile, User user) throws Exception, Throwable { - ExtentTestActions.log(Status.INFO, String.format("Going to update the VNF with %s......", updatedVnfFile)); - System.out.println(String.format("Going to update the VNF with %s......", updatedVnfFile)); - - Map<String, String> vspMap = vsp.right; - String vspId = vspMap.get("vspId"); - - updateVendorSoftwareProduct(vspId, updatedVnfFile, filepath, user); - HomePage.showVspRepository(); - updateVSP(vsp); - ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen(); - DeploymentArtifactPage.verifyArtifactsExistInTable(filepath, updatedVnfFile); - } - - public static Pair<String, Map<String, String>> onboardAndValidate(String filepath, String vnfFile, User user) throws Exception { - ExtentTestActions.log(Status.INFO, String.format("Going to onboard the VNF %s", vnfFile)); - System.out.println(String.format("Going to onboard the VNF %s", vnfFile)); - - AmdocsLicenseMembers amdocsLicenseMembers = createVendorLicense(user); - Pair<String, Map<String, String>> createVendorSoftwareProduct = createVendorSoftwareProduct(vnfFile, filepath, user, amdocsLicenseMembers); - String vspName = createVendorSoftwareProduct.left; - - DownloadManager.downloadCsarByNameFromVSPRepository(vspName, createVendorSoftwareProduct.right.get("vspId")); - File latestFilefromDir = FileHandling.getLastModifiedFileNameFromDir(); - - ExtentTestActions.log(Status.INFO, String.format("Searching for onboarded %s", vnfFile)); - HomePage.showVspRepository(); - ExtentTestActions.log(Status.INFO,String.format("Going to import %s", vnfFile.substring(0, vnfFile.indexOf(".")))); - importVSP(createVendorSoftwareProduct); - - ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen(); - - // Verify deployment artifacts - Map<String, Object> combinedMap = ArtifactFromCsar.combineHeatArtifacstWithFolderArtifacsToMap(latestFilefromDir.getAbsolutePath()); - - LinkedList<HeatMetaFirstLevelDefinition> deploymentArtifacts = ((LinkedList<HeatMetaFirstLevelDefinition>) combinedMap.get("Deployment")); - ArtifactsCorrelationManager.addVNFartifactDetails(vspName, deploymentArtifacts); - - List<String> heatEnvFilesFromCSAR = deploymentArtifacts.stream().filter(e -> e.getType().equals("HEAT_ENV")). - map(e -> e.getFileName()). - collect(Collectors.toList()); - - validateDeploymentArtifactsVersion(deploymentArtifacts, heatEnvFilesFromCSAR); - - DeploymentArtifactPage.verifyArtifactsExistInTable(filepath, vnfFile); - return createVendorSoftwareProduct; - } - - public static void validateDeploymentArtifactsVersion(LinkedList<HeatMetaFirstLevelDefinition> deploymentArtifacts, - List<String> heatEnvFilesFromCSAR) { - String artifactVersion; - String artifactName; - - for(HeatMetaFirstLevelDefinition deploymentArtifact: deploymentArtifacts) { - artifactVersion = "1"; - - if(deploymentArtifact.getType().equals("HEAT_ENV")) { - continue; - } else if(deploymentArtifact.getFileName().contains(".")) { - artifactName = deploymentArtifact.getFileName().trim().substring(0, deploymentArtifact.getFileName().lastIndexOf(".")); - } else { - artifactName = deploymentArtifact.getFileName().trim(); - } - - if (heatEnvFilesFromCSAR.contains(artifactName + ".env")){ - artifactVersion = "2"; - } - ArtifactUIUtils.validateArtifactNameVersionType(artifactName, artifactVersion, deploymentArtifact.getType()); - } - } - - - /** - * @return - * The method returns VNF names list from Files directory under sdc-vnfs repository - */ - public static List<String> getVnfNamesFileList() { - String filepath = FileHandling.getVnfRepositoryPath(); - List<String> fileNamesFromFolder = FileHandling.getZipFileNamesFromFolder(filepath); - fileNamesFromFolder.removeAll(exludeVnfList); - return fileNamesFromFolder; - } - -} - - enum SnmpTypeEnum{ - SNMP_POLL ("snmp"), - SNMP_TRAP ("snmp-trap"); - - private String value; - - public String getValue() { - return value; - } - - private SnmpTypeEnum(String value) { - this.value = value; - } - -} - @@ -94,8 +94,8 @@ public class PropertiesUIUtils { public static void updateProperty(PropertyTypeEnum property) { SetupCDTest.getExtendTest().log(Status.INFO, String.format("Updating property: %s", property.name())); PropertiesPage.clickOnProperty(property.getName()); - PropertiesPage.getPropertyPopup().insertPropertyDescription(property.getDescription()); - PropertiesPage.getPropertyPopup().insertPropertyDefaultValue(property.getValue()); + PropertiesPage.getPropertyPopup().insertPropertyDescription(property.getUpdateDescription()); + PropertiesPage.getPropertyPopup().insertPropertyDefaultValue(property.getUpdateValue()); PropertiesPage.getPropertyPopup().clickSave(); } @@ -26,9 +26,6 @@ import static org.testng.AssertJUnit.assertTrue; import java.awt.AWTException; import java.awt.Robot; -import java.awt.Toolkit; -import java.awt.datatransfer.Clipboard; -import java.awt.datatransfer.StringSelection; import java.awt.event.KeyEvent; import java.io.File; import java.util.Arrays; @@ -32,7 +32,6 @@ import java.util.Map; import java.util.stream.Collectors; import org.codehaus.jackson.map.ObjectMapper; -import org.codehaus.jettison.json.JSONArray; import org.codehaus.jettison.json.JSONObject; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.model.Component; @@ -253,23 +252,26 @@ public class RestCDUtils { final String userId = defaultAdminUser.getUserId(); List<Component> resourcesArrayList = map.get("products"); - List<String> collect = resourcesArrayList.stream().filter(s -> s.getName().startsWith("Ci")).map(e -> e.getUniqueId()) - .collect(Collectors.toList()); + List<String> collect = resourcesArrayList.stream().filter(s -> s.getName().startsWith(ElementFactory.getProductPrefix())). + map(e -> e.getUniqueId()). + collect(Collectors.toList()); for (String uId : collect) { ProductRestUtils.deleteProduct(uId, userId); } resourcesArrayList = map.get("services"); - collect = resourcesArrayList.stream().filter(s -> s.getName().startsWith("ci")).map(e -> e.getUniqueId()) - .collect(Collectors.toList()); + collect = resourcesArrayList.stream().filter(s -> s.getName().startsWith(ElementFactory.getServicePrefix())). + map(e -> e.getUniqueId()). + collect(Collectors.toList()); for (String uId : collect) { ServiceRestUtils.markServiceToDelete(uId, userId); } ServiceRestUtils.deleteMarkedServices(userId); resourcesArrayList = map.get("resources"); - collect = resourcesArrayList.stream().filter(s -> s.getName().startsWith("ci")) - .map(e -> e.getUniqueId()).collect(Collectors.toList()); + collect = resourcesArrayList.stream().filter(s -> s.getName().startsWith(ElementFactory.getResourcePrefix())). + map(e -> e.getUniqueId()). + collect(Collectors.toList()); for (String uId : collect) { ResourceRestUtils.markResourceToDelete(uId, userId); } @@ -54,28 +54,16 @@ public class CatalogVerificator { Map<String, List<Component>> catalogAsMap = RestCDUtils.getCatalogAsMap(); switch (enumtype) { case RESOURCE: - return getResourceNumber(catalogAsMap); + return catalogAsMap.get("resources").size(); case SERVICE: - return getServiceNumber(catalogAsMap); + return catalogAsMap.get("services").size(); case PRODUCT: - return getProductsNumber(catalogAsMap); + return catalogAsMap.get("products").size(); default: return getResourceNumber(ResourceTypeEnum.valueOf(enumtype.name()), catalogAsMap); } } - public static int getResourceNumber(Map<String, List<Component>> catalogAsMap) throws Exception { - return catalogAsMap.get("resources").size(); - } - - public static int getServiceNumber(Map<String, List<Component>> catalogAsMap) throws Exception { - return catalogAsMap.get("services").size(); - } - - public static int getProductsNumber(Map<String, List<Component>> catalogAsMap) throws Exception { - return catalogAsMap.get("products").size(); - } - public static void validateType(TypesEnum enumtype) throws Exception{ int numberOfElementsFromBE = getTypeNumber(enumtype); int numberOfElementsFromUI = getNumberOfElementsFromCatalogHeader(); @@ -33,6 +33,7 @@ import java.util.List; import java.util.Map; import java.util.UUID; import java.util.stream.Collectors; +import java.util.stream.Stream; import org.apache.commons.io.FileUtils; import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; @@ -46,15 +47,12 @@ import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaGroupsTopologyTemplateDef import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; import org.openecomp.sdc.ci.tests.utils.ToscaParserUtils; import org.openqa.selenium.WebElement; -import org.testng.SkipException; -import org.testng.TestException; -import org.testng.TestNGException; import com.aventstack.extentreports.Status; public class DeploymentViewVerificator { - private static String[] currentProperties = {"isBase", + private static List<String> currentPropertiesForUI = Arrays.asList("isBase", "vf_module_label", "vf_module_description", "min_vf_module_instances", @@ -63,7 +61,28 @@ public class DeploymentViewVerificator { "vf_module_type", "volume_group", "vfc_list", - "availability_zone_count"}; + "availability_zone_count"); + + private static List<String> currentPropertiesWithoutIsBaseForFile = Arrays.asList("vf_module_label", + "vf_module_description", + "min_vf_module_instances", + "max_vf_module_instances", + "initial_count", + "vf_module_type", + "volume_group", + "vfc_list", + "availability_zone_count"); + + public static List<String> getCurrentProperties() { + return currentPropertiesForUI; + } + + public static List<String> getCurrentPropertiesWithoutIsBase() { + return currentPropertiesWithoutIsBaseForFile; + } + + + public static final String partToReplace = "_group"; private static Map<String, HashMap<String, List<String>>> deploymentViewData = new HashMap<String, HashMap<String, List<String>>>(){ { @@ -72,7 +91,7 @@ public class DeploymentViewVerificator { segw_heat_c3_base = new HashMap<String, List<String>>(); segw_heat_c3_base.put("members", Arrays.asList("segw_internet_security_group", "segw_security_group", "int_layer2vlan_net")); segw_heat_c3_base.put("artifacts", Arrays.asList("segw_heat_c3_base.yml", "segw_heat_c3_base.env")); - segw_heat_c3_base.put("properties", Arrays.asList(currentProperties)); + segw_heat_c3_base.put("properties", currentPropertiesForUI); put("segw_heat_c3_base", segw_heat_c3_base); segw_heat_c3_VMs1 = new HashMap<String, List<String>>(); segw_heat_c3_VMs1.put("members", Arrays.asList("segw_oam_protected_0_port", @@ -88,41 +107,42 @@ public class DeploymentViewVerificator { "fw_oam_0", "fw_gn_int_layer2vlan_1_port")); segw_heat_c3_VMs1.put("artifacts", Arrays.asList("segw_heat_c3_VMs1.yml", "segw_heat_c3_VMs1.env")); - segw_heat_c3_VMs1.put("properties", Arrays.asList(currentProperties)); + segw_heat_c3_VMs1.put("properties", currentPropertiesForUI); put("segw_heat_c3_VMs1", segw_heat_c3_VMs1); } }; - private static Map<String, HashMap<String, List<String>>> deploymentViewDataMixedArtefects = new HashMap<String, HashMap<String, List<String>>>(){ + private static Map<String, HashMap<String, List<String>>> deploymentViewDataMixedArtifacts = new HashMap<String, HashMap<String, List<String>>>(){ { HashMap<String, List<String>> module_1_ldsa, module_2_ldsa, base_ldsa; module_1_ldsa = new HashMap<String, List<String>>(); - module_1_ldsa.put("members", new ArrayList(Arrays.asList("ltm_oam_protected_0_port", "ltm_dmz_direct_0_port", "ltm_server_0"))); - module_1_ldsa.put("artifacts", new ArrayList(Arrays.asList("module_1_ldsa.yaml", "module_1_ldsa.env", "base_ldsa.33.yaml", "module_1_ldsa.11.yaml"))); - module_1_ldsa.put("properties", new ArrayList(Arrays.asList(currentProperties))); + module_1_ldsa.put("members", Stream.of("ltm_oam_protected_0_port", "ltm_dmz_direct_0_port", "ltm_server_0").collect(Collectors.toList())); + module_1_ldsa.put("artifacts", Stream.of("module_1_ldsa.yaml", "module_1_ldsa.env", "base_ldsa.33.yaml", "module_1_ldsa.11.yaml").collect(Collectors.toList())); + module_1_ldsa.put("properties", currentPropertiesForUI); put("module_1_ldsa", module_1_ldsa); module_2_ldsa = new HashMap<String, List<String>>(); - module_2_ldsa.put("members", new ArrayList(Arrays.asList("ltm_server_0"))); - module_2_ldsa.put("artifacts", new ArrayList(Arrays.asList("module_2_ldsa.yaml", "module_2_ldsa.env", "base_ldsa.3.yaml", "module_2_ldsa.22.yaml"))); - module_2_ldsa.put("properties", new ArrayList(Arrays.asList(currentProperties))); + module_2_ldsa.put("members", Stream.of("ltm_server_0").collect(Collectors.toList())); + module_2_ldsa.put("artifacts", Stream.of("module_2_ldsa.yaml", "module_2_ldsa.env", "base_ldsa.3.yaml", "module_2_ldsa.22.yaml").collect(Collectors.toList())); + module_2_ldsa.put("properties", currentPropertiesForUI); put("module_2_ldsa", module_2_ldsa); base_ldsa = new HashMap<String, List<String>>(); - base_ldsa.put("members", new ArrayList(Arrays.asList("ldsa_sec_grp_1"))); - base_ldsa.put("artifacts", new ArrayList(Arrays.asList("base_ldsa.yaml", "module_2_ldsa.2.yaml", "module_1_ldsa.1.yaml"))); - base_ldsa.put("properties", new ArrayList(Arrays.asList(currentProperties))); + base_ldsa.put("members", Stream.of("ldsa_sec_grp_1").collect(Collectors.toList())); + base_ldsa.put("artifacts", Stream.of("base_ldsa.yaml", "module_2_ldsa.2.yaml", "module_1_ldsa.1.yaml").collect(Collectors.toList())); + base_ldsa.put("properties", currentPropertiesForUI); put("base_ldsa", base_ldsa); } }; + private Map<String, HashMap<String, List<String>>> deploymentViewDataFromFile; - public DeploymentViewVerificator(String pathToCSAR) throws Exception { - deploymentViewDataFromFile = getDeploymentViewDataFromCSAR(pathToCSAR); + public DeploymentViewVerificator(String pathToCsar) throws Exception { + deploymentViewDataFromFile = buildDeploymentViewDataFromCSAR(pathToCsar); } public DeploymentViewVerificator() throws Exception { - deploymentViewDataFromFile = deploymentViewDataMixedArtefects; + deploymentViewDataFromFile = deploymentViewDataMixedArtifacts; } @@ -141,7 +161,7 @@ public class DeploymentViewVerificator { File imageFilePath = GeneralUIUtils.takeScreenshot(moduleName + UUID.randomUUID(), SetupCDTest.getScreenshotFolder(), null); final String absolutePath = new File(SetupCDTest.getReportFolder()).toURI().relativize(imageFilePath.toURI()).getPath(); - SetupCDTest.getExtendTest().log(Status.INFO, String.format("Validating group %s, should be %s members, %s artefacts " + SetupCDTest.getExtendTest().addScreenCaptureFromPath(absolutePath), + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Validating group %s, should be %s members, %s artifacts " + SetupCDTest.getExtendTest().addScreenCaptureFromPath(absolutePath), moduleName, moduleProperties.get("members").size(), moduleProperties.get("artifacts").size())); assertTrue(moduleProperties.get("artifacts").size() == artifacts.size(), "Artifacts amount not as expected, expected " + moduleProperties.get("artifacts").size()); @@ -183,52 +203,47 @@ public class DeploymentViewVerificator { return getDeploymentViewDataFromFile(); } - public static Map<String, HashMap<String, List<String>>> buildDeploymentViewDataFromCSAR(String pathToCSAR, File mainServiceTemplate) throws Exception{ - ToscaDefinition toscaDefinition = ToscaParserUtils.parseToscaYamlToJavaObject(mainServiceTemplate); + public static Map<String, HashMap<String, List<String>>> buildDeploymentViewDataFromCSAR(String pathToCSAR) throws Exception{ + ToscaDefinition toscaDefinition = ToscaParserUtils.parseToscaMainYamlToJavaObjectByCsarLocation(new File(pathToCSAR)); Map<String, HashMap<String, List<String>>> deploymentViewDataFromFile = new HashMap<String, HashMap<String, List<String>>>(); Map<String, ToscaGroupsTopologyTemplateDefinition> groups = toscaDefinition.getTopology_template().getGroups(); List<String> keyList = groups.keySet().stream().collect(Collectors.toList()); - HashMap<String, List<String>> groupsToArtefacts = getDeploymentArtefactsMapedToGroupsFromCSAR(pathToCSAR); + HashMap<String, List<String>> groupsToArtifacts = getDeploymentArtifactsMappedToGroupsFromCSAR(pathToCSAR); for(String groupKey: keyList){ HashMap<String, List<String>> tempGroupMap = new HashMap<String, List<String>>(); - tempGroupMap.put("artifacts", groupsToArtefacts.get(groupKey)); + tempGroupMap.put("artifacts", groupsToArtifacts.get(convertAmdocsCsarGroupNameToSdcCsarGroupName(groupKey))); if (groups.get(groupKey).getMembers() == null){ tempGroupMap.put("members", Arrays.asList()); } else { tempGroupMap.put("members", groups.get(groupKey).getMembers()); } - tempGroupMap.put("properties", Arrays.asList(currentProperties)); - deploymentViewDataFromFile.put(groupKey, tempGroupMap); + tempGroupMap.put("properties", currentPropertiesForUI); + deploymentViewDataFromFile.put(convertAmdocsCsarGroupNameToSdcCsarGroupName(groupKey), tempGroupMap); } return deploymentViewDataFromFile; } - public static HashMap<String, List<String>> getDeploymentArtefactsMapedToGroupsFromCSAR(String pathToFile) throws Exception { + public static HashMap<String, List<String>> getDeploymentArtifactsMappedToGroupsFromCSAR(String pathToFile) throws Exception { Map<String, Object> combinedMap = ArtifactFromCsar.combineHeatArtifacstWithFolderArtifacsToMap(pathToFile); LinkedList<HeatMetaFirstLevelDefinition> deploymentArtifacts = ((LinkedList<HeatMetaFirstLevelDefinition>) combinedMap.get("Deployment")); + HashMap<String, List<String>> tempGroupMap = new HashMap<String, List<String>>(); for(HeatMetaFirstLevelDefinition deploymentArtifact: deploymentArtifacts) { String groupName = deploymentArtifact.getFileName().trim().substring(0, deploymentArtifact.getFileName().indexOf(".")); - if(deploymentArtifact.getType().equals("HEAT")) { - tempGroupMap.put(groupName, new ArrayList(Arrays.asList(deploymentArtifact.getFileName().trim()))); + if(deploymentArtifact.getType().equals("HEAT") || deploymentArtifact.getType().equals("HEAT_NET") || deploymentArtifact.getType().equals("HEAT_VOL")) { + List<String> list = new ArrayList<>(); + list.add(deploymentArtifact.getFileName().trim()); + tempGroupMap.put(groupName, list); } else { // update current key - tempGroupMap.get(groupName).add(deploymentArtifact.getFileName().trim()); - tempGroupMap.put(groupName, tempGroupMap.get(groupName)); + List<String> list = tempGroupMap.get(groupName); + list.add(deploymentArtifact.getFileName().trim()); + tempGroupMap.put(groupName, list); } } return tempGroupMap; } - public static Map<String, HashMap<String, List<String>>> getDeploymentViewDataFromCSAR(String pathToCsar) throws Exception { - String outputFolder = unzipCsarFile(pathToCsar); - - File pathToMainServiceTemplate = new File(outputFolder + File.separator + "Definitions" + File.separator + "MainServiceTemplate.yaml"); - Map<String, HashMap<String, List<String>>> deploymentViewData = buildDeploymentViewDataFromCSAR(pathToCsar, pathToMainServiceTemplate); - cleanFolders(outputFolder); - - return deploymentViewData; - } public static void cleanFolders(String outputFolder) throws IOException { System.gc(); @@ -240,7 +255,7 @@ public class DeploymentViewVerificator { File csarFile = new File(pathToCsar); - File dir = new File(csarFile.getParent() + File.separator + "output"+UUID.randomUUID() + File.separator + UUID.randomUUID()); + File dir = new File(csarFile.getParent() + File.separator + "output"+ UUID.randomUUID() + File.separator + UUID.randomUUID()); if(!dir.exists()) { dir.mkdirs(); } @@ -322,6 +337,10 @@ public class DeploymentViewVerificator { } } + public static String convertAmdocsCsarGroupNameToSdcCsarGroupName(String originalString){ + return originalString.replace(partToReplace, ""); + } + @@ -48,7 +48,8 @@ public class ErrorMessageUIVerificator { public static void validateErrorMessage(ActionStatus errorMessage) { String errorMessageBox = null; try{ - errorMessageBox = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText(); +// errorMessageBox = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText(); + errorMessageBox = GeneralUIUtils.getWebElementByClassName("error-message-component").getText(); } catch(Exception e){ ExtentTestActions.log(Status.INFO, "Did not find an error message popup."); @@ -0,0 +1,18 @@ +package org.openecomp.sdc.ci.tests.verificator; + +import static org.testng.Assert.assertTrue; + +import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; +import org.openecomp.sdc.ci.tests.datatypes.enums.PropertyTypeEnum; +import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; + +public class PropertyVerificator { + + + public static void validateEditVFCPropertiesPopoverFields(PropertyTypeEnum propertyType){ + String propertyValue = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesPopupEnum.PROPERTY_VALUE.getValue()).getAttribute("value"); + String propertyDescription = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesPopupEnum.PROPERTY_DESCRIPTION.getValue()).getAttribute("value"); + assertTrue(propertyType.getUpdateValue().equals(propertyValue), String.format("Property Value of type %s. Expected: %s, Actual: %s ", propertyType.getType().toString(), propertyType.getUpdateValue(), propertyValue)); + assertTrue(propertyType.getUpdateDescription().equals(propertyDescription), String.format("Property Description of type %s. Expected: %s, Actual: %s ", propertyType.getType().toString(), propertyType.getUpdateDescription(), propertyDescription)); + } +}
\ No newline at end of file @@ -25,13 +25,10 @@ import static org.testng.Assert.assertTrue; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; -import java.util.Iterator; import java.util.List; import java.util.Random; import java.util.function.Predicate; -import java.util.stream.Collector; import java.util.stream.Collectors; -import java.util.stream.Stream; import org.json.simple.JSONArray; import org.json.simple.JSONObject; @@ -60,7 +57,6 @@ import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.ui.Select; -import org.testng.SkipException; import com.aventstack.extentreports.Status; @@ -1,12 +1,17 @@ package org.openecomp.sdc.ci.tests.verificator; +import java.lang.reflect.Field; import java.util.HashMap; +import java.util.List; import java.util.Map; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaDefinition; +import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaInputsTopologyTemplateDefinition; +import org.openecomp.sdc.tosca.parser.api.ISdcCsarHelper; import org.openecomp.sdc.toscaparser.api.elements.Metadata; +import org.openecomp.sdc.toscaparser.api.parameters.Input; import com.aventstack.extentreports.Status; @@ -16,8 +21,8 @@ public class ToscaValidation { /** - * @param expectedToscaDefinition - * @param actualToscaDefinition + * @param expectedToscaDefinition - expected toscaDefinition object + * @param actualToscaDefinition - actual toscaDefinition object * @return true if all validation success else return error map */ public static Either<Boolean, Map<String, Object>> resourceToscaMetadataValidator(ToscaDefinition expectedToscaDefinition, ToscaDefinition actualToscaDefinition){ @@ -25,7 +30,7 @@ public class ToscaValidation { SetupCDTest.getExtendTest().log(Status.INFO, "Going to validate resource TOSCA metadata..."); Map<String, String> expectedMetadata = expectedToscaDefinition.getMetadata(); Map<String, String> actualMetadata = actualToscaDefinition.getMetadata(); - Either<Boolean, Map<String, Object>> resourceToscaMetadataValidator = compareMapData(expectedMetadata, actualMetadata); + Either<Boolean, Map<String, Object>> resourceToscaMetadataValidator = compareStringMapData(expectedMetadata, actualMetadata); if(resourceToscaMetadataValidator.isLeft()){ SetupCDTest.getExtendTest().log(Status.INFO, "Resource TOSCA metadata verification success"); }else{ @@ -37,7 +42,7 @@ public class ToscaValidation { public static Boolean resourceToscaNodeTemplateMetadataValidator(Map<String, Map<String, String>> expectedMetadata, ToscaDefinition actualToscaDefinition){ boolean isTestFailed = true; for(String nodeTemplateName : expectedMetadata.keySet()){ - Either<Boolean,Map<String,Object>> serviceToscaMetadataValidator = componentToscaNodeTemplateMetadataValidator(expectedMetadata.get(nodeTemplateName), actualToscaDefinition, nodeTemplateName, ComponentTypeEnum.RESOURCE); + Either<Boolean,Map<String,Object>> serviceToscaMetadataValidator = componentToscaNodeTemplateMetadataValidator(expectedMetadata.get(nodeTemplateName), actualToscaDefinition, nodeTemplateName, ComponentTypeEnum.RESOURCE, nodeTemplateName); if(serviceToscaMetadataValidator.left().value() == false){ isTestFailed = false; } @@ -49,7 +54,7 @@ public class ToscaValidation { SetupCDTest.getExtendTest().log(Status.INFO, "Going to validate service TOSCA metadata..."); Map<String, String> actualMetadata = actualToscaDefinition.getMetadata(); - Either<Boolean,Map<String,Object>> serviceToscaMetadataValidator = compareMapData(expectedMetadata, actualMetadata); + Either<Boolean,Map<String,Object>> serviceToscaMetadataValidator = compareStringMapData(expectedMetadata, actualMetadata); if(serviceToscaMetadataValidator.isLeft()){ SetupCDTest.getExtendTest().log(Status.INFO, "Service TOSCA metadata verification success"); }else{ @@ -58,15 +63,15 @@ public class ToscaValidation { return serviceToscaMetadataValidator; } - public static Either<Boolean, Map<String, Object>> componentToscaNodeTemplateMetadataValidator(Map<String, String> expectedMetadata, ToscaDefinition actualToscaDefinition, String nodeTemplateName, ComponentTypeEnum componentType){ + public static Either<Boolean, Map<String, Object>> componentToscaNodeTemplateMetadataValidator(Map<String, String> expectedMetadata, ToscaDefinition actualToscaDefinition, String nodeTemplateName, ComponentTypeEnum componentType, String componentName){ - SetupCDTest.getExtendTest().log(Status.INFO, "Going to validate "+ componentType.getValue() + " node template TOSCA metadata..."); + SetupCDTest.getExtendTest().log(Status.INFO, "Going to validate "+ componentName + " " + componentType.getValue() + " node template TOSCA metadata..."); Map<String, String> actualMetadata = actualToscaDefinition.getTopology_template().getNode_templates().get(nodeTemplateName).getMetadata(); - Either<Boolean,Map<String,Object>> componentToscaMetadataValidator = compareMapData(expectedMetadata, actualMetadata); + Either<Boolean,Map<String,Object>> componentToscaMetadataValidator = compareStringMapData(expectedMetadata, actualMetadata); if(componentToscaMetadataValidator.isLeft()){ - SetupCDTest.getExtendTest().log(Status.INFO, componentType.getValue() + " TOSCA node template metadata verification success"); + SetupCDTest.getExtendTest().log(Status.INFO, " " + componentName + " " + componentType.getValue() + "TOSCA node template metadata verification success"); }else{ - SetupCDTest.getExtendTest().log(Status.ERROR, componentType.getValue() + " TOSCA node template metadata verification failed" + componentToscaMetadataValidator.right().value().toString()); + SetupCDTest.getExtendTest().log(Status.ERROR, " " +componentName + " " + componentType.getValue() + "TOSCA node template metadata verification failed" + componentToscaMetadataValidator.right().value().toString()); } return componentToscaMetadataValidator; } @@ -85,16 +90,16 @@ public class ToscaValidation { } - public static Either<Boolean, Map<String, Object>> compareMapData(Map<String, String> expectedMetadata, Map<String, String> actualMetadata) { + public static Either<Boolean, Map<String, Object>> compareStringMapData(Map<String, String> expectedMetadata, Map<String, String> actualMetadata) { Either.left(false); Map<String, Object> errorMap = new HashMap<>(); for(String key : expectedMetadata.keySet()){ - boolean isError = compaireValue(expectedMetadata.get(key), actualMetadata.get(key)); + boolean isError = compareValue(expectedMetadata.get(key), actualMetadata.get(key)); if(!isError){ errorMap.put("Data key["+key+"]", "expected: " + expectedMetadata.get(key) + ", actual: " + actualMetadata.get(key)); } } - if(errorMap != null && !errorMap.isEmpty()){ + if(!errorMap.isEmpty()){ return Either.right(errorMap); } return Either.left(true); @@ -103,23 +108,182 @@ public class ToscaValidation { public static Either<Boolean, Map<String, Object>> compareMetadataUsingToscaParser(Map<String, String> expectedMetadata, Metadata actualMetadata) { Map<String, Object> errorMap = new HashMap<>(); for(String key : expectedMetadata.keySet()){ - boolean isError = compaireValue(expectedMetadata.get(key), actualMetadata.getValue(key)); + boolean isError = compareValue(expectedMetadata.get(key), actualMetadata.getValue(key)); if(!isError){ errorMap.put("Data key["+key+"]", "expected: " + expectedMetadata.get(key) + ", actual: " + actualMetadata.getValue(key)); } } - if(errorMap != null && !errorMap.isEmpty()){ + if(!errorMap.isEmpty()){ return Either.right(errorMap); } return Either.left(true); } - private static boolean compaireValue(String expected, String actual) { + private static boolean compareValue(String expected, String actual) { + + return expected.equals(actual); + + } + + public static Either<Boolean, Map<String, Object>> toscaInputsValidator(Map<String, ToscaInputsTopologyTemplateDefinition> expectedInputs, Map<String, ToscaInputsTopologyTemplateDefinition> actualInputs){ + + SetupCDTest.getExtendTest().log(Status.INFO, "Going to validate TOSCA inputs..."); + Either<Boolean,Map<String,Object>> toscaInputsValidator = compareInputs(expectedInputs, actualInputs); + if(toscaInputsValidator.isLeft()){ + SetupCDTest.getExtendTest().log(Status.INFO, "TOSCA inputs verification success"); + }else{ + SetupCDTest.getExtendTest().log(Status.ERROR, "TOSCA inputs verification failed" + toscaInputsValidator.right().value().toString()); + } + + if(toscaInputsValidator.right() != null && ! toscaInputsValidator.right().equals("")){ + return toscaInputsValidator; + } + return Either.left(true); + } + + public static Either<Boolean,Map<String,Object>> compareInputs(Map<String, ToscaInputsTopologyTemplateDefinition> expectedInputs, Map<String, ToscaInputsTopologyTemplateDefinition> actualInputs) { + + Map<String, Object> errorMap = new HashMap<>(); + + for (String inputName : expectedInputs.keySet()){ + if (actualInputs.get(inputName) == null ){ + errorMap.put("input [" + inputName + "]", " does not exist in TOSCA main yaml"); + }else{ + compareInputData(expectedInputs.get(inputName), actualInputs.get(inputName), errorMap); + } + } + if(errorMap != null && !errorMap.isEmpty()){ + return Either.right(errorMap); + } + return Either.left(true); + } + + public static Either<Boolean, Map<String, Object>> compareInputData(ToscaInputsTopologyTemplateDefinition expectedInputDefinition, ToscaInputsTopologyTemplateDefinition actualInputDefinition, Map<String, Object> errorMap) { + + Field[] declaredFields = expectedInputDefinition.getClass().getDeclaredFields(); + for (Field field : declaredFields){ + try { + Object expectedValue = field.get(expectedInputDefinition); + Object actualValue = field.get(actualInputDefinition); +// verification exclude fields as (immutable, hidden, constraints, entry_schema) according Renana + if(expectedValue != null && expectedValue.toString().trim()!= "" && field.getName() != "name" && field.getName() != "immutable" && field.getName() != "hidden" && field.getName() != "constraints" && field.getName() != "entry_schema" && field.getName() != "required") { + if (actualValue != null) { + compareInputValue(expectedInputDefinition, errorMap, field, expectedValue, actualValue); + } else { + errorMap.put("Data field [" + field.getName() + "] in input [" + expectedInputDefinition.getName() + "]", " does not exist in actual object"); + System.out.println("Data field [" + field.getName() + "] in input [" + expectedInputDefinition.getName() + "] does not exist in actual object"); + } + } + }catch (IllegalAccessException e) { + e.printStackTrace(); + } + } - return expected.equals(actual) ? true : false; + if(errorMap != null && !errorMap.isEmpty()){ + return Either.right(errorMap); + } + return Either.left(true); + } + + public static void compareInputValue(ToscaInputsTopologyTemplateDefinition expectedInputDefinition, Map<String, Object> errorMap, Field field, Object expectedValue, Object actualValue) { + if(field.getName() == "value" || field.getName() == "Default"){ + switch (expectedInputDefinition.getType()) { + case "string": + if(! expectedValue.toString().replace("\n"," ").replaceAll("( +)", " ").equals(actualValue.toString().replace("\n"," ").replaceAll("( +)", " "))){ + errorMap.put("Data field [" + field.getName()+"] in input [" + expectedInputDefinition.getName() + "]", "expected: " + expectedValue + ", actual: " + actualValue); + System.out.println("Data field [" + field.getName()+"] in input [" + expectedInputDefinition.getName() + "]: expected: " + expectedValue + ", actual: " + actualValue); + } + break; + case "float": + float newExpectedValue = convertObjectToFloat(expectedValue); + float newActualValue = convertObjectToFloat(actualValue); + if(newExpectedValue != newActualValue){ + errorMap.put("Data field [" + field.getName()+"] in input [" + expectedInputDefinition.getName() + "]", "expected: " + newExpectedValue + ", actual: " + newActualValue); + System.out.println("Data field [" + field.getName()+"] in input [" + expectedInputDefinition.getName() + "]: expected: " + newExpectedValue + ", actual: " + newActualValue); + } + break; + case "boolean": + if(! expectedValue.toString().toLowerCase().equals(actualValue.toString().toLowerCase())){ + errorMap.put("Data field [" + field.getName()+"] in input [" + expectedInputDefinition.getName() + "]", "expected: " + expectedValue + ", actual: " + actualValue); + System.out.println("Data field [" + field.getName()+"] in input [" + expectedInputDefinition.getName() + "]: expected: " + expectedValue + ", actual: " + actualValue); + } + break; + case "list": + expectedInputDefinition.getEntry_schema().get("type"); + break; + case "map": + + break; + default: + break; + } + + + }else{ + if(! expectedValue.equals(actualValue)){ + errorMap.put("Data field [" + field.getName()+"] in input [" + expectedInputDefinition.getName() + "]", "expected: " + expectedValue + ", actual: " + actualValue); + System.out.println("Data field [" + field.getName()+"] in input [" + expectedInputDefinition.getName() + "]: expected: " + expectedValue + ", actual: " + actualValue); + } + } } + public static float convertObjectToFloat(Object object){ + + float floatValue = 0; + + if(object instanceof Integer){ + floatValue = ((Integer)object).floatValue(); + } + if(object instanceof Double){ + floatValue = ((Double)object).floatValue(); + } + if(object instanceof Float){ + floatValue = ((Float) object).floatValue(); + } + if(object instanceof String){ + floatValue = Float.parseFloat(object.toString()); + } + + if(object instanceof Long){ + floatValue = ((Long) object).floatValue(); + } + return floatValue; + } + + public static Either<Boolean, Map<String, Object>> toscaInputsValidatorAgainstParser(Map<String, ToscaInputsTopologyTemplateDefinition> expectedInputsMap, ISdcCsarHelper fdntCsarHelper) { + SetupCDTest.getExtendTest().log(Status.INFO, "Going to convert tosca parser inputs output to ToscaInputsTopologyTemplateDefinition object..."); + if(fdntCsarHelper.getServiceInputs().size() == 0){ + if(expectedInputsMap != null && ! expectedInputsMap.isEmpty()){ + return Either.left(true); + }else{ + Map<String, Object> errorMap = new HashMap<>(); + errorMap.put("Inputs", " do not exist on actual service"); + SetupCDTest.getExtendTest().log(Status.INFO, "Inputs do not exist on actual service csar"); + return Either.right(errorMap); + } + } + Map<String, ToscaInputsTopologyTemplateDefinition> actualInputsMap = convertInputsParserOutputToMap(fdntCsarHelper); + return toscaInputsValidator(expectedInputsMap, actualInputsMap); + } + + /** + * @param fdntCsarHelper convert list of inputs return from tosca parser to map of ToscaInputsTopologyTemplateDefinition + * @return + */ + public static Map<String, ToscaInputsTopologyTemplateDefinition> convertInputsParserOutputToMap(ISdcCsarHelper fdntCsarHelper) { + Map<String, ToscaInputsTopologyTemplateDefinition> actualInputsMap = new HashMap<>(); + List<Input> serviceInputs = fdntCsarHelper.getServiceInputs(); + for (Input input : serviceInputs){ + ToscaInputsTopologyTemplateDefinition actualInputDefinition = new ToscaInputsTopologyTemplateDefinition(); + actualInputDefinition.setDefault(input.getDefault()); + actualInputDefinition.setType(input.getType()); + actualInputDefinition.setDescription(input.getDescription()); + actualInputsMap.put(input.getName(), actualInputDefinition); + } + return actualInputsMap; + } + } @@ -26,12 +26,10 @@ import java.util.List; import org.apache.commons.lang3.text.WordUtils; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions; import org.openecomp.sdc.ci.tests.pages.AdminGeneralPage; -import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; import org.openecomp.sdc.ci.tests.utilities.RestCDUtils; import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils; import org.openqa.selenium.WebElement; @@ -32,21 +32,20 @@ import java.util.stream.Collectors; import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.GroupInstance; -import org.openecomp.sdc.be.model.GroupProperty; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.ci.tests.datatypes.TypeHeatMetaDefinition; import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest; import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaDefinition; -import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaServiceGroupsMetadataDefinition; import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaGroupsTopologyTemplateDefinition; -import org.openecomp.sdc.ci.tests.utils.ToscaParserUtils; +import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaServiceGroupsMetadataDefinition; import com.aventstack.extentreports.Status; public class VfModuleVerificator { - private static final String [] PROPERTY_TYPES = {"vf_module_label", "min_vf_module_instances", "max_vf_module_instances", "initial_count"}; + + private final static List<String> PROPERTY_TYPES = DeploymentViewVerificator.getCurrentPropertiesWithoutIsBase();//{"vf_module_label", "min_vf_module_instances", "max_vf_module_instances", "initial_count"}; private static final String VF_MODULE_TYPE = "org.openecomp.groups.VfModule"; /** @@ -107,7 +106,7 @@ public class VfModuleVerificator { filter(e -> e.getType().equals(VF_MODULE_TYPE)). map(e -> e.getProperties()). collect(Collectors.toList()); - for(String propertyType :PROPERTY_TYPES){ + for(String propertyType : PROPERTY_TYPES){ int numberOfTypes = getPropertyType(allProperties, propertyType).size(); SetupCDTest.getExtendTest().log(Status.INFO, String.format("Validating VF property %s exist, Expected: %s, Actual: %s ", propertyType, allProperties.size(), numberOfTypes)); assertTrue(numberOfTypes == allProperties.size()); @@ -126,7 +125,7 @@ public class VfModuleVerificator { filter(e -> e.getType().equals(VF_MODULE_TYPE)). collect(Collectors.toList()); - for(String propertyType :PROPERTY_TYPES){ + for(String propertyType : PROPERTY_TYPES){ int numberOfTypes = (int) vfModules.stream(). filter(e -> e.getProperties().containsKey(propertyType)). count(); @@ -135,18 +134,6 @@ public class VfModuleVerificator { } } - public static ToscaDefinition getToscaTemplate(String pathToCsar) throws Exception { - String outputFolder = DeploymentViewVerificator.unzipCsarFile(pathToCsar); - String templateFileName = VfModuleVerificator.getTemplateFilenname(pathToCsar); - - File pathToMainServiceTemplate = new File(outputFolder + File.separator + "Definitions" + File.separator + templateFileName); - ToscaDefinition toscaDefinition = ToscaParserUtils.parseToscaYamlToJavaObject(pathToMainServiceTemplate); - - DeploymentViewVerificator.cleanFolders(new File(outputFolder).getParent()); - - return toscaDefinition; - } - public static String getTemplateFilenname(String pathToCsar) { File csarFile = new File(pathToCsar); String templateFileName = csarFile.getName().replaceAll("-csar.csar", "-template.yml"); @@ -124,18 +124,21 @@ public final class VfVerificator { } public static void verifyVFLifecycle(ResourceReqDetails vf, User user, LifecycleStateEnum expectedLifecycleState) { + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Verfiying that object %s version is %s", vf.getName(),expectedLifecycleState)); String responseAfterDrag = RestCDUtils.getResource(vf, user).getResponse(); JSONObject jsonResource = (JSONObject) JSONValue.parse(responseAfterDrag); String actualLifecycleState = jsonResource.get("lifecycleState").toString(); assertTrue(expectedLifecycleState.name().equals(actualLifecycleState), "actual: " + actualLifecycleState + "-- expected: " + expectedLifecycleState); } - + public static void verifyVfLifecycleInUI(LifeCycleStateEnum lifecycleState){ + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Verfiying that object version is %s", lifecycleState.getValue())); GeneralUIUtils.ultimateWait(); assertTrue(ResourceGeneralPage.getLifeCycleState().equals(lifecycleState.getValue())); } public static void verifyInstanceVersion(ResourceReqDetails vf, User user, String instanceName, String instanceVersion){ + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Verfiying that instance %s version is %s", instanceName,instanceVersion)); String responseAfterDrag = RestCDUtils.getResource(vf, user).getResponse(); JSONObject jsonResource = (JSONObject) JSONValue.parse(responseAfterDrag); JSONArray jsonArrayResource = (JSONArray) jsonResource.get("componentInstances"); @@ -157,6 +160,7 @@ public final class VfVerificator { } public static void verifyVfDeleted(ResourceReqDetails vf, User user){ + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Validating resource %s was deleted", vf.getName())); RestResponse response = RestCDUtils.getResource(vf, user); assertTrue(response.getErrorCode().intValue() == 404); } @@ -182,6 +186,7 @@ public final class VfVerificator { } public static void verifyToscaArtifactsInfo(ResourceReqDetails vf, User user){ + SetupCDTest.getExtendTest().log(Status.INFO, String.format("Validating Tosca Aritfact Info of resource %s", vf.getName())); String responseAfterDrag = RestCDUtils.getResource(vf, user).getResponse(); JSONObject jsonResource = (JSONObject) JSONValue.parse(responseAfterDrag); JSONObject toscaArtifacts = (JSONObject) jsonResource.get("toscaArtifacts"); @@ -216,7 +221,7 @@ public final class VfVerificator { SetupCDTest.getExtendTest().log(Status.INFO, "Verifying metadata"); assertTrue(vspName.equals(ResourceGeneralPage.getNameText()), "VSP name is not valid."); assertTrue(vspMetadata.get("description").equals(ResourceGeneralPage.getDescriptionText()), "VSP description is not valid."); - assertTrue(vspMetadata.get("subCategory").equals(GeneralUIUtils.getSelectedElementFromDropDown(ResourceGeneralPage.getCategoryDataTestsIdAttribute()).getText().toLowerCase().trim()), "VSP category is not valid."); + assertTrue(vspMetadata.get("subCategory").equals(GeneralUIUtils.getSelectedElementFromDropDown(ResourceGeneralPage.getCategoryDataTestsIdAttribute()).getText().trim()), "VSP category is not valid."); assertTrue(vspMetadata.get("vendorName").equals(ResourceGeneralPage.getVendorNameText()), "VSP vendor name is not valid."); assertTrue("1.0".equals(ResourceGeneralPage.getVendorReleaseText()), "VSP version is not valid."); List<WebElement> tagsList = ResourceGeneralPage.getElementsFromTagsTable(); @@ -236,7 +241,6 @@ public final class VfVerificator { String expectedMd5OfFile = FileHandling.getMD5OfFile(expected); Assert.assertEquals(expectedMd5OfFile, actualMd5OfFile, "File does not exist"); } catch (IOException e) { - // TODO Auto-generated catch block e.printStackTrace(); } @@ -1,12 +1,15 @@ outputFolder: target reportName: index.html -#catalogBeHost: 127.0.0.1 +catalogBeHost: 127.0.0.1 #Automate #catalogBeHost: 135.63.125.67 #catalogFeHost: 135.63.125.63 #IFT -catalogBeHost: 135.21.143.248 -catalogFeHost: 135.21.125.96 +#catalogBeHost: 135.21.143.248 +#catalogFeHost: 135.21.125.96 +#QA-SCRUM1 +#catalogBeHost: 135.21.125.97 +#catalogFeHost: 135.21.125.89 esHost: eshost disributionClientHost: disClient catalogFePort: 8181 @@ -17,9 +20,10 @@ neoHost: neoHost neoPort: 7474 neoDBusername: neo4j neoDBpassword: 123456 -#url: http://localhost:8285/sdc1 +url: http://localhost:8285/sdc1 #url: https://www.e-access.att.com/QA-AUTOMATE1/sdc1/portal -url: https://www.e-access.att.com/AA-IFT-testing/sdc1/portal +#url: https://www.e-access.att.com/AA-IFT-testing/sdc1/portal +#url: https://www.e-access.att.com/QA-SCRUM1/sdc1/portal remoteTestingMachineIP: 0.0.0.0 remoteTestingMachinePort: 5566 remoteTesting: false @@ -32,7 +36,7 @@ configurationFile: ../catalog-be/src/main/resources/config/configuration.yaml importTypesConfigDir: src/test/resources/CI/importTypesTest browser: FireFox windowsDownloadDirectory: "c:\\apache-ftpserver-1.1.0\\res\\home\\" -systemUnderDebug: true +systemUnderDebug: false reportDBhost: dbhost reportDBport: 27017 @@ -102,7 +102,7 @@ if [ ${REMOTE_DEBUG} == "true" ]; then JAVA_OPTION="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=${debug_port}" ; fi -cmd="java -Xmx2048m -Xms1024m $JAVA_OPTION -DdisplayException=true -Dtargetlog=${TARGET_LOG_DIR} -Dfilepath=${FILES_TEST} -Dconfig.resource=${CONF_FILE} -Ddebug=${DEBUG} -Dlog4j.configuration=${LOGS_PROP_FILE} -cp $JAR_FILE ${MainClass} $SUITE_FILE &" +cmd="java -Xmx2048m -Xms1024m $JAVA_OPTION -DdisplayException=true -Dtargetlog=${TARGET_LOG_DIR} -DfilePath=${FILES_TEST} -Dconfig.resource=${CONF_FILE} -Ddebug=${DEBUG} -Dlog4j.configuration=${LOGS_PROP_FILE} -cp $JAR_FILE ${MainClass} $SUITE_FILE &" if [ $DEBUG == "true" ] @@ -117,7 +117,7 @@ if [ ${RERUN} == "true" ]; then echo "Prepare" ${TARGET_DIR}/${fileName} "file to rerun all failed tests ..."; prepareFailedXmlFile ${TARGET_DIR}/${fileName} $SUITE_FILE; SUITE_FILE=${fileName}; - cmd="java -Xmx2048m -Xms1024m $JAVA_OPTION -DdisplayException=true -Dtargetlog=${TARGET_LOG_DIR} -Dfilepath=${FILES_TEST} -Dconfig.resource=${CONF_FILE} -Ddebug=${DEBUG} -Dlog4j.configuration=${LOGS_PROP_FILE} -cp $JAR_FILE ${MainClass} $SUITE_FILE &" + cmd="java -Xmx2048m -Xms1024m $JAVA_OPTION -DdisplayException=true -Dtargetlog=${TARGET_LOG_DIR} -DfilePath=${FILES_TEST} -Dconfig.resource=${CONF_FILE} -Ddebug=${DEBUG} -Dlog4j.configuration=${LOGS_PROP_FILE} -cp $JAR_FILE ${MainClass} $SUITE_FILE &" $cmd; fi fi @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd"> +<suite name="uitests" configfailurepolicy="continue"> + <test name="uitests"> + <classes> + <!--onboard--> + <class name="org.openecomp.sdc.ci.tests.execute.sanity.Onboard"> + <methods> + <include name="onboardVNFTestSanityOneFile"/> + </methods> + </class> + </classes> + </test> <!-- uitests --> +</suite> <!-- uisuite -->
\ No newline at end of file @@ -6,11 +6,17 @@ <test name="uiSanity"> <classes> + <class name="org.openecomp.sdc.ci.tests.dataProvider.OnbordingDataProviders"> + <methods> + <include name="OnbordingDataProviders"/> + </methods> + </class> <class name="org.openecomp.sdc.ci.tests.execute.sanity.Onboard"> <methods> <exclude name="onboardVNFTestSanity"/> <exclude name="onboardVNFShotFlow"/> - <exclude name="onboardRandomVNFsTest"/> + <exclude name="onboardVNFTest"/> + <exclude name="onboardVNFTestSanityOneFile"/> </methods> </class> <class name="org.openecomp.sdc.ci.tests.execute.sanity.CatalogLeftPanelTest"/> @@ -23,12 +29,16 @@ <class name="org.openecomp.sdc.ci.tests.execute.sanity.VfArtifacts"/> <class name="org.openecomp.sdc.ci.tests.execute.sanity.VfDeploymentInformationalArtifacts"/> <class name="org.openecomp.sdc.ci.tests.execute.sanity.AdminUserManagment"/> + <class name="org.openecomp.sdc.ci.tests.execute.sanity.PNF"/> + <class name="org.openecomp.sdc.ci.tests.execute.sanity.PropertiesAssignment"/> <!-- <class name="org.openecomp.sdc.ci.tests.execute.sanity.Product"/> --> <class name="org.openecomp.sdc.ci.tests.US.ImportUpdateInformationalDeploymentArtifacts"/> <class name="org.openecomp.sdc.ci.tests.US.MIBsArtifactsOnResourceInstance"/> <class name="org.openecomp.sdc.ci.tests.US.NewArtifactTypeGuide"/> <class name="org.openecomp.sdc.ci.tests.US.RemoveRestrictionOfDeploymentArtifacts"/> + <class name="org.openecomp.sdc.ci.tests.execute.sanity.OnboardingFlows"/> + <class name="org.openecomp.sdc.ci.tests.execute.sanity.PortMirroring"/> <!-- <class name="org.openecomp.sdc.ci.tests.US.AddComponentInstancesArtifactsInCsar"/> --> @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd"> +<suite name="uitests" configfailurepolicy="continue" parallel="methods" thread-count="1" data-provider-thread-count="1"> + <parameter name="makeDistribution" value="false"/> + <parameter name="eraseAfterTests" value="false"/> + + <test name="uiSanity"> + <classes> + <class name="org.openecomp.sdc.ci.tests.execute.sanity.Onboard"> + <methods> + <include name="onboardVNFTestSanity"/> + </methods> + </class> + </classes> + </test> <!-- uitests --> +</suite> <!-- uisuite -->
\ No newline at end of file @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd"> -<suite name="uitests" configfailurepolicy="continue" parallel="instances" thread-count="2" data-provider-thread-count="2"> +<suite name="uitests" configfailurepolicy="continue" parallel="methods" thread-count="2" data-provider-thread-count="2"> <parameter name="makeDistribution" value="false"/> <test name="OnbordingDataProviders"> @@ -14,6 +14,7 @@ <!--maven--> <maven.build.timestamp.format>yyyyMMdd'T'HHmm</maven.build.timestamp.format> <nexus.proxy>https://nexus.onap.org</nexus.proxy> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <dependencies> @@ -161,7 +162,7 @@ <executions> <execution> <id>copy-resources-simulator</id> - <phase>validate</phase> + <phase>package</phase> <goals> <goal>copy-resources</goal> </goals> @@ -223,7 +224,7 @@ <alias>sdc-simulator</alias> <build> <cleanup>try</cleanup> - <dockerFileDir>${basedir}\sdc-simulator</dockerFileDir> + <dockerFileDir>${basedir}/sdc-simulator</dockerFileDir> <tags> <tag>${docker.tag}</tag> <tag>${docker.latest.tag}</tag> @@ -12,7 +12,6 @@ import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.openecomp.sdc.webseal.simulator.User; import org.openecomp.sdc.webseal.simulator.conf.Conf; public class Login extends HttpServlet { @@ -6,6 +6,7 @@ import java.util.List; import java.util.Map; import org.openecomp.sdc.webseal.simulator.User; + import com.typesafe.config.Config; import com.typesafe.config.ConfigFactory; |