summaryrefslogtreecommitdiffstats
path: root/openecomp-be
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-be')
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapComponentDataToComponentDto.java21
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapComponentRequestDtoToComponentEntity.java19
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/ComponentRequestDto.java4
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/CompositionEntityDataManager.java14
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentManagerImpl.java10
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/CompositionEntityDataManagerImpl.java37
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java5
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentManagerImplTest.java11
-rw-r--r--openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-core/src/main/resources/entityHealingConfiguration.json3
-rw-r--r--openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/ComponentDataHealer.java101
-rw-r--r--openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/tosca/AbstractSubstituteToscaEnricher.java14
-rw-r--r--openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/tosca/ComponentQuestionnaireData.java34
-rw-r--r--openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/util/EnrichmentConstants.java24
-rw-r--r--openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/tosca/AbstractSubstituteToscaEnricherTest.java12
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/ComponentData.java43
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/questionnaire/component/general/General.java34
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/schemagenerator/ComponentQuestionnaireSchemaInput.java31
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/composition/CompositionDataExtractorImpl.java13
-rw-r--r--openecomp-be/tools/install/database/schemaTemplates/composition/component.ftl11
-rw-r--r--openecomp-be/tools/install/database/schemaTemplates/questionnaire/component.ftl9
20 files changed, 265 insertions, 185 deletions
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapComponentDataToComponentDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapComponentDataToComponentDto.java
index 346b39a6b7..eae59cf103 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapComponentDataToComponentDto.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapComponentDataToComponentDto.java
@@ -1,21 +1,17 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
+/*
+ * Copyright © 2016-2018 European Support Limited
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- * ============LICENSE_END=========================================================
*/
package org.openecomp.sdcrests.vsp.rest.mapping;
@@ -30,11 +26,6 @@ public class MapComponentDataToComponentDto extends MappingBase<ComponentData, C
target.setName(source.getName());
target.setDisplayName(
source.getDisplayName() == null ? source.getName() : source.getDisplayName());
- target.setVfcCode(
- source.getVfcCode() == null ? target.getDisplayName() : source.getVfcCode());
- target.setNfcCode(
- source.getNfcCode() == null ? source.getDisplayName() : source.getNfcCode());
- target.setNfcFunction(source.getNfcFunction());
target.setDescription(source.getDescription());
}
}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapComponentRequestDtoToComponentEntity.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapComponentRequestDtoToComponentEntity.java
index 6649c117e3..53a4482820 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapComponentRequestDtoToComponentEntity.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapComponentRequestDtoToComponentEntity.java
@@ -1,21 +1,17 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
+/*
+ * Copyright © 2016-2018 European Support Limited
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- * ============LICENSE_END=========================================================
*/
package org.openecomp.sdcrests.vsp.rest.mapping;
@@ -32,9 +28,6 @@ public class MapComponentRequestDtoToComponentEntity
ComponentData component = new ComponentData();
component.setName(source.getName());
component.setDisplayName(source.getDisplayName());
- component.setVfcCode(source.getVfcCode());
- component.setNfcCode(source.getNfcCode());
- component.setNfcFunction(source.getNfcFunction());
component.setDescription(source.getDescription());
target.setComponentCompositionData(component);
}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/ComponentRequestDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/ComponentRequestDto.java
index 8f4a51ed01..a14e0825ca 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/ComponentRequestDto.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/ComponentRequestDto.java
@@ -28,10 +28,6 @@ public class ComponentRequestDto {
@NotNull(message = "VFC displayName is mandatory.")
@Size(min = 1, max = 30, message = "VFC displayName length should be between 1 and 30.")
private String displayName;
- @Size(min = 0, max = 1000, message = "description length should not exceed 1000.")
- private String vfcCode;
- private String nfcCode;
- private String nfcFunction;
private String description;
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/CompositionEntityDataManager.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/CompositionEntityDataManager.java
index c4cb95808a..37af2b86e1 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/CompositionEntityDataManager.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/CompositionEntityDataManager.java
@@ -1,21 +1,17 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
+/*
+ * Copyright © 2016-2018 European Support Limited
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- * ============LICENSE_END=========================================================
*/
package org.openecomp.sdc.vendorsoftwareproduct;
@@ -59,7 +55,7 @@ public interface CompositionEntityDataManager {
Set<CompositionEntityValidationData> getAllErrorsByVsp(String vspId);
- ComponentEntity createComponent(ComponentEntity component);
+ ComponentEntity createComponent(ComponentEntity component, boolean isManualVsp);
NicEntity createNic(NicEntity nic);
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentManagerImpl.java
index 67867d52f6..ca8757dd11 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentManagerImpl.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentManagerImpl.java
@@ -1,11 +1,11 @@
/*
- * Copyright © 2016-2017 European Support Limited
+ * Copyright © 2016-2018 European Support Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -92,7 +92,7 @@ public class ComponentManagerImpl implements ComponentManager {
} else {
validateComponentManual(component);
updateComponentName(component);
- createdComponent = compositionEntityDataManager.createComponent(component);
+ createdComponent = compositionEntityDataManager.createComponent(component, true);
}
return createdComponent;
}
@@ -222,8 +222,8 @@ public class ComponentManagerImpl implements ComponentManager {
.map(nic -> nic.getNicCompositionData().getName()).collect(Collectors.toList());
questionnaireResponse.setSchema(getComponentQuestionnaireSchema(
new ComponentQuestionnaireSchemaInput(nicNames, questionnaireResponse.getData() == null
- ? null
- : JsonUtil.json2Object(questionnaireResponse.getData(), Map.class))));
+ ? null : JsonUtil.json2Object(questionnaireResponse.getData(), Map.class),
+ null, false)));
return questionnaireResponse;
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/CompositionEntityDataManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/CompositionEntityDataManagerImpl.java
index db6a63a2ba..1946db8b5d 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/CompositionEntityDataManagerImpl.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/CompositionEntityDataManagerImpl.java
@@ -1,21 +1,17 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
+/*
+ * Copyright © 2016-2018 European Support Limited
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- * ============LICENSE_END=========================================================
*/
package org.openecomp.sdc.vendorsoftwareproduct.impl;
@@ -38,15 +34,7 @@ import org.openecomp.sdc.vendorsoftwareproduct.dao.ImageDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.NetworkDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.NicDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.CompositionEntity;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComputeEntity;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.DeploymentFlavorEntity;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ImageEntity;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NetworkEntity;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspQuestionnaireEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.*;
import org.openecomp.sdc.vendorsoftwareproduct.services.schemagenerator.SchemaGenerator;
import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Component;
import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComponentData;
@@ -59,6 +47,7 @@ import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Image;
import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Network;
import org.openecomp.sdc.vendorsoftwareproduct.types.composition.NetworkType;
import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Nic;
+import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.ComponentQuestionnaireSchemaInput;
import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.SchemaTemplateContext;
import org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator.SchemaTemplateInput;
import org.openecomp.sdc.versioning.dao.types.Version;
@@ -268,7 +257,7 @@ public class CompositionEntityDataManagerImpl implements CompositionEntityDataMa
ComponentEntity componentEntity = new ComponentEntity(vspId, version, null);
componentEntity.setComponentCompositionData(component.getData());
- String componentId = createComponent(componentEntity).getId();
+ String componentId = createComponent(componentEntity, false).getId();
saveImagesByComponent(vspId, version, component, componentId);
saveComputesFlavorByComponent(vspId, version, component, componentId);
@@ -321,13 +310,13 @@ public class CompositionEntityDataManagerImpl implements CompositionEntityDataMa
}
@Override
- public ComponentEntity createComponent(ComponentEntity component) {
+ public ComponentEntity createComponent(ComponentEntity component, boolean isManualVsp) {
//component.setId(CommonMethods.nextUuId()); will be set by the dao
- component.setQuestionnaireData(
- new JsonSchemaDataGenerator(
- generateSchema(SchemaTemplateContext.questionnaire, CompositionEntityType.component,
- null))
- .generateData());
+ ComponentQuestionnaireSchemaInput schemaInput = new ComponentQuestionnaireSchemaInput(null,
+ null, component.getComponentCompositionData().getDisplayName(), isManualVsp);
+ String questionnarieData = new JsonSchemaDataGenerator(generateSchema(SchemaTemplateContext.questionnaire,
+ CompositionEntityType.component, schemaInput)).generateData();
+ component.setQuestionnaireData(questionnarieData);
componentDao.create(component);
return component;
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java
index 5874394e96..e3c7d6ecdd 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java
@@ -5,7 +5,7 @@
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -766,7 +766,8 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
componentDao.listCompositionAndQuestionnaire(vspId, version);
components.forEach(component -> compositionEntityDataManager.addEntity(component,
new ComponentQuestionnaireSchemaInput(nicNamesByComponent.get(component.getId()),
- JsonUtil.json2Object(component.getQuestionnaireData(), Map.class))));
+ JsonUtil.json2Object(component.getQuestionnaireData(), Map.class), null,
+ OnboardingMethod.Manual.name().equals(onboardingMethod))));
Collection<ComputeEntity> computes = computeDao.listByVsp(vspId, version);
computes.forEach(compute -> compositionEntityDataManager.addEntity(compute, null));
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentManagerImplTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentManagerImplTest.java
index 3652223e61..243da26152 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentManagerImplTest.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/ComponentManagerImplTest.java
@@ -1,9 +1,6 @@
package org.openecomp.sdc.vendorsoftwareproduct.impl;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.mockito.Spy;
+import org.mockito.*;
import org.openecomp.sdc.common.errors.CoreException;
import org.openecomp.sdc.vendorsoftwareproduct.NicManager;
import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDao;
@@ -106,7 +103,7 @@ public class ComponentManagerImplTest {
doReturn(true).when(vspInfoDao).isManual(anyObject(), anyObject());
Collection<ComponentEntity> vspComponentList = new ArrayList<>();
doReturn(vspComponentList).when(componentDaoMock).list(anyObject());
- doReturn(expected).when(compositionEntityDataManagerMock).createComponent(anyObject());
+ doReturn(expected).when(compositionEntityDataManagerMock).createComponent(anyObject(), Matchers.anyBoolean());
ComponentEntity created = componentManager.createComponent(expected);
Assert.assertNotNull(created);
@@ -234,9 +231,6 @@ public class ComponentManagerImplTest {
ComponentData compData = new ComponentData();
compData.setName(COMP1_ID + " name"); // no change
compData.setDisplayName(COMP1_ID + " display name"); // no change
- compData.setVfcCode(COMP1_ID + " display name"); // no change
- compData.setNfcCode(COMP1_ID + " display name"); // no change
- compData.setNfcFunction(COMP1_ID + " display name"); // no change
compData.setDescription(COMP1_ID + " desc updated"); // allowed change
component.setComponentCompositionData(compData);
@@ -457,7 +451,6 @@ public class ComponentManagerImplTest {
ComponentData compData = new ComponentData();
compData.setName(compId + " name");
compData.setDisplayName(compId + " display name");
- compData.setVfcCode(compId + " display name");
compData.setDescription(compId + " desc");
componentEntity.setComponentCompositionData(compData);
componentEntity.setQuestionnaireData("{}");
diff --git a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-core/src/main/resources/entityHealingConfiguration.json b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-core/src/main/resources/entityHealingConfiguration.json
index 51de9d0802..d8f6986a73 100644
--- a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-core/src/main/resources/entityHealingConfiguration.json
+++ b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-core/src/main/resources/entityHealingConfiguration.json
@@ -5,7 +5,8 @@
"org.openecomp.sdc.healing.healers.NetworkPackageHealer"
],
"data": [
- "org.openecomp.sdc.healing.healers.ToscaServiceModelHealer"
+ "org.openecomp.sdc.healing.healers.ToscaServiceModelHealer",
+ "org.openecomp.sdc.healing.healers.ComponentDataHealer"
]
},
"vlm": {
diff --git a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/ComponentDataHealer.java b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/ComponentDataHealer.java
new file mode 100644
index 0000000000..da3ad81d58
--- /dev/null
+++ b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/ComponentDataHealer.java
@@ -0,0 +1,101 @@
+/*
+ * Copyright © 2016-2018 European Support Limited
+ *
+ * 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.
+ */
+
+package org.openecomp.sdc.healing.healers;
+
+import com.google.gson.JsonObject;
+import com.google.gson.JsonParser;
+import org.apache.commons.lang.StringUtils;
+import org.openecomp.sdc.healing.interfaces.Healer;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDaoFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity;
+import org.openecomp.sdc.versioning.dao.types.Version;
+
+import java.util.Collection;
+import java.util.Objects;
+
+public class ComponentDataHealer implements Healer {
+
+ private static final String VFC_CODE = "vfcCode"; //earlier present in composition data
+ private static final String NFC_FUNCTION = "nfcFunction";
+ private static final String NFC_NAMING_CODE = "nfcNamingCode";
+ private static final String GENERAL = "general";
+ private final ComponentDao componentDao;
+
+ public ComponentDataHealer() {
+ this.componentDao = ComponentDaoFactory.getInstance().createInterface();
+ }
+
+ @Override
+ public boolean isHealingNeeded(String itemId, Version version) {
+ final Collection<ComponentEntity> componentEntities =
+ componentDao.listCompositionAndQuestionnaire(itemId, version);
+ return Objects.nonNull(componentEntities) && !componentEntities.isEmpty() &&
+ componentEntities.stream().anyMatch(this::checkNfcParams);
+ }
+
+ private boolean checkNfcParams(ComponentEntity componentEntity) {
+ final String compositionData = componentEntity.getCompositionData();
+ if (!StringUtils.isEmpty(compositionData)) {
+ JsonParser jsonParser = new JsonParser();
+ JsonObject json = (JsonObject) jsonParser.parse(compositionData);
+ return Objects.nonNull(json.get(VFC_CODE)) || Objects.nonNull(json.get(NFC_FUNCTION));
+ }
+ return false;
+ }
+
+ @Override
+ public void heal(String itemId, Version version) throws Exception {
+ final Collection<ComponentEntity> componentEntities =
+ componentDao.listCompositionAndQuestionnaire(itemId, version);
+ if (Objects.nonNull(componentEntities) && !componentEntities.isEmpty()) {
+ componentEntities.forEach(componentEntity -> {
+ final String compositionData = componentEntity.getCompositionData();
+ updateComponentData(itemId, version, componentEntity, componentEntity.getQuestionnaireData(), compositionData);
+ });
+ }
+ }
+
+ private void updateComponentData(String itemId, Version version, ComponentEntity componentEntity,
+ String questionnaireData, String compositionData) {
+ if (!StringUtils.isEmpty(compositionData)) {
+ JsonParser jsonParser = new JsonParser();
+ JsonObject json = (JsonObject) jsonParser.parse(compositionData);
+ JsonObject questionnaireJson = (JsonObject) jsonParser.parse(questionnaireData);
+ moveAttribute(json, questionnaireJson, questionnaireJson.getAsJsonObject(GENERAL), VFC_CODE,
+ NFC_NAMING_CODE);
+ moveAttribute(json, questionnaireJson, questionnaireJson.getAsJsonObject(GENERAL), NFC_FUNCTION,
+ NFC_FUNCTION);
+ componentEntity.setCompositionData(json.toString());
+ componentDao.update(componentEntity);
+ componentEntity.setQuestionnaireData(questionnaireJson.toString());
+ componentDao.updateQuestionnaireData(itemId,version,componentEntity.getId(), questionnaireJson.toString());
+ }
+ }
+
+ private static void moveAttribute(JsonObject compositionJsonObj, JsonObject questJsonObject,
+ JsonObject general, String compositionAttrName, String questAttrName ) {
+ if (Objects.nonNull(compositionJsonObj.get(compositionAttrName))) {
+ if (general == null) {
+ general = new JsonObject();
+ }
+ general.addProperty(questAttrName, compositionJsonObj.get(compositionAttrName).getAsString());
+ questJsonObject.add(GENERAL, general);
+ compositionJsonObj.remove(compositionAttrName);
+ }
+ }
+}
diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/tosca/AbstractSubstituteToscaEnricher.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/tosca/AbstractSubstituteToscaEnricher.java
index add04164c2..80e469771d 100644
--- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/tosca/AbstractSubstituteToscaEnricher.java
+++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/tosca/AbstractSubstituteToscaEnricher.java
@@ -21,8 +21,8 @@ import static org.openecomp.sdc.enrichment.impl.util.EnrichmentConstants.MANDATO
import static org.openecomp.sdc.enrichment.impl.util.EnrichmentConstants.MAX_INSTANCES;
import static org.openecomp.sdc.enrichment.impl.util.EnrichmentConstants.MIN_INSTANCES;
import static org.openecomp.sdc.enrichment.impl.util.EnrichmentConstants.VFC_CODE;
-import static org.openecomp.sdc.enrichment.impl.util.EnrichmentConstants.VFC_FUNCTION;
-import static org.openecomp.sdc.enrichment.impl.util.EnrichmentConstants.VFC_NAMING_CODE;
+import static org.openecomp.sdc.enrichment.impl.util.EnrichmentConstants.NFC_FUNCTION;
+import static org.openecomp.sdc.enrichment.impl.util.EnrichmentConstants.NFC_NAMING_CODE;
import static org.openecomp.sdc.enrichment.impl.util.EnrichmentConstants.VM_TYPE_TAG;
import static org.openecomp.sdc.tosca.datatypes.ToscaCapabilityType.NATIVE_NODE;
import static org.openecomp.sdc.tosca.datatypes.ToscaNodeType.VFC_ABSTRACT_SUBSTITUTE;
@@ -70,7 +70,7 @@ public class AbstractSubstituteToscaEnricher {
final Map<String, List<String>> sourceToTargetDependencies = componentQuestionnaireData
.populateDependencies(vspId, version,
componentQuestionnaireData
- .getSourceToTargetComponent());
+ .getSourceToTargetComponent());
Map<String, List<ErrorMessage>> errors = new HashMap<>();
final ServiceTemplate serviceTemplate =
@@ -124,15 +124,15 @@ public class AbstractSubstituteToscaEnricher {
getValueFromQuestionnaireDetails(componentProperties, componentDisplayName,
HIGH_AVAIL_MODE));
- setProperty(nodeTemplate, VFC_NAMING_CODE,
+ setProperty(nodeTemplate, NFC_NAMING_CODE,
getValueFromQuestionnaireDetails(componentProperties, componentDisplayName,
- VFC_NAMING_CODE));
+ NFC_NAMING_CODE));
setProperty(nodeTemplate, VFC_CODE,
getValueFromQuestionnaireDetails(componentProperties, componentDisplayName, VFC_CODE));
- setProperty(nodeTemplate, VFC_FUNCTION,
- getValueFromQuestionnaireDetails(componentProperties, componentDisplayName, VFC_FUNCTION));
+ setProperty(nodeTemplate, NFC_FUNCTION,
+ getValueFromQuestionnaireDetails(componentProperties, componentDisplayName, NFC_FUNCTION));
if (componentProperties.get(componentDisplayName).get(MIN_INSTANCES) != null) {
nodeTemplate.getProperties().put(MIN_INSTANCES,
diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/tosca/ComponentQuestionnaireData.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/tosca/ComponentQuestionnaireData.java
index 9ebe9e5e67..78242a6c61 100644
--- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/tosca/ComponentQuestionnaireData.java
+++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/tosca/ComponentQuestionnaireData.java
@@ -1,5 +1,20 @@
-package org.openecomp.sdc.enrichment.impl.tosca;
+/*
+ * Copyright © 2016-2018 European Support Limited
+ *
+ * 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.
+ */
+package org.openecomp.sdc.enrichment.impl.tosca;
import org.openecomp.core.utilities.json.JsonUtil;
import org.openecomp.sdc.enrichment.impl.util.EnrichmentConstants;
@@ -23,7 +38,7 @@ import static org.openecomp.sdc.enrichment.impl.util.EnrichmentConstants.HIGH_AV
import static org.openecomp.sdc.enrichment.impl.util.EnrichmentConstants.MANDATORY;
import static org.openecomp.sdc.enrichment.impl.util.EnrichmentConstants.MAX_INSTANCES;
import static org.openecomp.sdc.enrichment.impl.util.EnrichmentConstants.MIN_INSTANCES;
-import static org.openecomp.sdc.enrichment.impl.util.EnrichmentConstants.VFC_NAMING_CODE;
+import static org.openecomp.sdc.enrichment.impl.util.EnrichmentConstants.NFC_NAMING_CODE;
public class ComponentQuestionnaireData {
@@ -64,16 +79,13 @@ public class ComponentQuestionnaireData {
sourceToTarget.put(component.getId(), componentData.getDisplayName());
- String vfc_code = componentData != null ? componentData.getVfcCode() : null;
- questionnaireParams.put(VFC_NAMING_CODE, vfc_code);
-
- String nfcCode = componentData.getNfcCode() != null ? componentData.getNfcCode() : null;
- questionnaireParams.put(EnrichmentConstants.VFC_CODE, nfcCode);
+ String nfcNamingCode = componentQuestionnaire.getGeneral().getNfcNamingCode() != null ?
+ componentQuestionnaire.getGeneral().getNfcNamingCode() : null;
+ questionnaireParams.put(NFC_NAMING_CODE, nfcNamingCode);
- String vfcDescription =
- componentData.getNfcFunction() != null ? componentData.getNfcFunction() :
- null;
- questionnaireParams.put(EnrichmentConstants.VFC_FUNCTION, vfcDescription);
+ String vfcDescription = componentQuestionnaire.getGeneral().getNfcFunction() != null ?
+ componentQuestionnaire.getGeneral().getNfcFunction() : null;
+ questionnaireParams.put(EnrichmentConstants.NFC_FUNCTION, vfcDescription);
if (componentQuestionnaire.getHighAvailabilityAndLoadBalancing() != null) {
diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/util/EnrichmentConstants.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/util/EnrichmentConstants.java
index 036d64014a..18d28afb07 100644
--- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/util/EnrichmentConstants.java
+++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/util/EnrichmentConstants.java
@@ -1,14 +1,34 @@
+/*
+ * Copyright © 2016-2018 European Support Limited
+ *
+ * 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.
+ */
+
package org.openecomp.sdc.enrichment.impl.util;
public class EnrichmentConstants {
- public static final String VFC_NAMING_CODE = "nfc_naming_code";
+ public static final String NFC_NAMING_CODE = "nfc_naming_code";
public static final String MANDATORY = "mandatory";
public static final String HIGH_AVAIL_MODE = "high_availablity";
public static final String MIN_INSTANCES = "min_instances";
public static final String MAX_INSTANCES = "max_instances";
public static final String VM_TYPE_TAG = "vm_type_tag";
public static final String VFC_CODE = "nfc_code";
- public static final String VFC_FUNCTION = "nfc_function";
+ public static final String NFC_FUNCTION = "nfc_function";
+
+ private EnrichmentConstants() {
+
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/tosca/AbstractSubstituteToscaEnricherTest.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/tosca/AbstractSubstituteToscaEnricherTest.java
index 11cab5f0a5..d2fb48cb7d 100644
--- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/tosca/AbstractSubstituteToscaEnricherTest.java
+++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/tosca/AbstractSubstituteToscaEnricherTest.java
@@ -7,8 +7,8 @@ import static org.openecomp.sdc.enrichment.impl.util.EnrichmentConstants.MANDATO
import static org.openecomp.sdc.enrichment.impl.util.EnrichmentConstants.MAX_INSTANCES;
import static org.openecomp.sdc.enrichment.impl.util.EnrichmentConstants.MIN_INSTANCES;
import static org.openecomp.sdc.enrichment.impl.util.EnrichmentConstants.VFC_CODE;
-import static org.openecomp.sdc.enrichment.impl.util.EnrichmentConstants.VFC_FUNCTION;
-import static org.openecomp.sdc.enrichment.impl.util.EnrichmentConstants.VFC_NAMING_CODE;
+import static org.openecomp.sdc.enrichment.impl.util.EnrichmentConstants.NFC_FUNCTION;
+import static org.openecomp.sdc.enrichment.impl.util.EnrichmentConstants.NFC_NAMING_CODE;
import org.apache.commons.collections.map.HashedMap;
import org.mockito.InjectMocks;
@@ -57,9 +57,9 @@ public class AbstractSubstituteToscaEnricherTest extends BaseToscaEnrichmentTest
Map<String, Object> innerProps = new HashMap<>();
innerProps.put(MANDATORY, "YES");
innerProps.put(HIGH_AVAIL_MODE, "geo-activestandby");
- innerProps.put(VFC_NAMING_CODE, "Code1");
+ innerProps.put(NFC_NAMING_CODE, "Code1");
innerProps.put(VFC_CODE, "pd_server_code");
- innerProps.put(VFC_FUNCTION, "pd_server_description");
+ innerProps.put(NFC_FUNCTION, "pd_server_description");
innerProps.put(MIN_INSTANCES, 1);
innerProps.put(MAX_INSTANCES, 2);
@@ -99,9 +99,9 @@ public class AbstractSubstituteToscaEnricherTest extends BaseToscaEnrichmentTest
Map<String, Object> innerProps = new HashedMap();
innerProps.put(MANDATORY, "NO");
innerProps.put(HIGH_AVAIL_MODE, "");
- innerProps.put(VFC_NAMING_CODE, "pd_server_code1");
+ innerProps.put(NFC_NAMING_CODE, "pd_server_code1");
innerProps.put(VFC_CODE, "pd_server_code");
- innerProps.put(VFC_FUNCTION, "pd_server_description");
+ innerProps.put(NFC_FUNCTION, "pd_server_description");
innerProps.put(MIN_INSTANCES, null);
innerProps.put(MAX_INSTANCES, null);
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/ComponentData.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/ComponentData.java
index ba06d42fea..ec2b07b5cd 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/ComponentData.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/ComponentData.java
@@ -1,21 +1,17 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
+/*
+ * Copyright © 2016-2018 European Support Limited
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- * ============LICENSE_END=========================================================
*/
package org.openecomp.sdc.vendorsoftwareproduct.types.composition;
@@ -24,9 +20,6 @@ public class ComponentData implements CompositionDataEntity {
private String name;
private String description;
private String displayName;
- private String vfcCode;
- private String nfcCode;
- private String nfcFunction;
public String getName() {
return name;
@@ -52,22 +45,6 @@ public class ComponentData implements CompositionDataEntity {
this.displayName = displayName;
}
- public String getNfcCode() {
- return nfcCode;
- }
-
- public void setNfcCode(String nfcCode) {
- this.nfcCode = nfcCode;
- }
-
- public String getNfcFunction() {
- return nfcFunction;
- }
-
- public void setNfcFunction(String nfcFunction) {
- this.nfcFunction = nfcFunction;
- }
-
@Override
public int hashCode() {
int result = name.hashCode();
@@ -96,12 +73,4 @@ public class ComponentData implements CompositionDataEntity {
return displayName != null ? displayName.equals(that.displayName) : that.displayName == null;
}
-
- public String getVfcCode() {
- return vfcCode;
- }
-
- public void setVfcCode(String vfcCode) {
- this.vfcCode = vfcCode;
- }
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/questionnaire/component/general/General.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/questionnaire/component/general/General.java
index 7d64906741..0129fe0981 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/questionnaire/component/general/General.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/questionnaire/component/general/General.java
@@ -1,21 +1,17 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
+/*
+ * Copyright © 2016-2018 European Support Limited
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- * ============LICENSE_END=========================================================
*/
package org.openecomp.sdc.vendorsoftwareproduct.types.questionnaire.component.general;
@@ -29,6 +25,8 @@ public class General {
protected Recovery recovery;
private String dnsConfiguration;
private String vmCloneUsage;
+ private String nfcNamingCode;
+ private String nfcFunction;
public Hypervisor getHypervisor() {
return hypervisor;
@@ -69,4 +67,20 @@ public class General {
public void setVmCloneUsage(String vmCloneUsage) {
this.vmCloneUsage = vmCloneUsage;
}
+
+ public String getNfcNamingCode() {
+ return nfcNamingCode;
+ }
+
+ public void setNfcNamingCode(String nfcNamingCode) {
+ this.nfcNamingCode = nfcNamingCode;
+ }
+
+ public String getNfcFunction() {
+ return nfcFunction;
+ }
+
+ public void setNfcFunction(String nfcFunction) {
+ this.nfcFunction = nfcFunction;
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/schemagenerator/ComponentQuestionnaireSchemaInput.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/schemagenerator/ComponentQuestionnaireSchemaInput.java
index 1f92e6d957..65f9046fc0 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/schemagenerator/ComponentQuestionnaireSchemaInput.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/schemagenerator/ComponentQuestionnaireSchemaInput.java
@@ -1,21 +1,17 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
+/*
+ * Copyright © 2016-2018 European Support Limited
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- * ============LICENSE_END=========================================================
*/
package org.openecomp.sdc.vendorsoftwareproduct.types.schemagenerator;
@@ -24,12 +20,17 @@ import java.util.List;
import java.util.Map;
public class ComponentQuestionnaireSchemaInput implements SchemaTemplateInput {
+ private String componentDisplayName;
+ private boolean manual;
private List<String> nicNames;
private Map componentQuestionnaireData;
- public ComponentQuestionnaireSchemaInput(List<String> nicNames, Map componentQuestionnaireData) {
+ public ComponentQuestionnaireSchemaInput(List<String> nicNames, Map componentQuestionnaireData,
+ String componentDisplayName, boolean manual) {
this.nicNames = nicNames;
this.componentQuestionnaireData = componentQuestionnaireData;
+ this.componentDisplayName = componentDisplayName;
+ this.manual = manual;
}
public List<String> getNicNames() {
@@ -39,4 +40,12 @@ public class ComponentQuestionnaireSchemaInput implements SchemaTemplateInput {
public Map getComponentQuestionnaireData() {
return componentQuestionnaireData;
}
+
+ public String getComponentDisplayName() {
+ return componentDisplayName;
+ }
+
+ public boolean isManual() {
+ return manual;
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/composition/CompositionDataExtractorImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/composition/CompositionDataExtractorImpl.java
index e314f5cad8..0e76d8a01b 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/composition/CompositionDataExtractorImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/composition/CompositionDataExtractorImpl.java
@@ -1,21 +1,17 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
+/*
+ * Copyright © 2016-2018 European Support Limited
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- * ============LICENSE_END=========================================================
*/
package org.openecomp.sdc.vendorsoftwareproduct.services.impl.composition;
@@ -342,7 +338,6 @@ public class CompositionDataExtractorImpl implements CompositionDataExtractor {
ComponentData component = new ComponentData();
component.setName(computeNodeType);
component.setDisplayName(getComponentDisplayName(component.getName()));
- component.setVfcCode(component.getDisplayName());
Component componentModel = new Component();
componentModel.setData(component);
diff --git a/openecomp-be/tools/install/database/schemaTemplates/composition/component.ftl b/openecomp-be/tools/install/database/schemaTemplates/composition/component.ftl
index e2953b83d0..1c0cb4eb8a 100644
--- a/openecomp-be/tools/install/database/schemaTemplates/composition/component.ftl
+++ b/openecomp-be/tools/install/database/schemaTemplates/composition/component.ftl
@@ -16,16 +16,7 @@
],
"default": "${component.displayName}"</#if>
},
- "vfcCode": {
- "type": "string"
- },
-"nfcCode": {
-"type": "string"
-},
-"nfcFunction": {
-"type": "string"
-},
-"description": {
+ "description": {
"type": "string"
}
},
diff --git a/openecomp-be/tools/install/database/schemaTemplates/questionnaire/component.ftl b/openecomp-be/tools/install/database/schemaTemplates/questionnaire/component.ftl
index 6b00c37061..f99d7fa9e0 100644
--- a/openecomp-be/tools/install/database/schemaTemplates/questionnaire/component.ftl
+++ b/openecomp-be/tools/install/database/schemaTemplates/questionnaire/component.ftl
@@ -5,6 +5,15 @@
"general": {
"type": "object",
"properties": {
+ <#if !manual>
+ "nfcNamingCode": {
+ "type": "string",
+ "maxLength": 1000<#if componentDisplayName??>,
+ "default": "${componentDisplayName}"</#if>
+ },</#if>
+ "nfcFunction": {
+ "type": "string"
+ },
"hypervisor": {
"type": "object",
"properties": {