--- /dev/null
+Feature: Component - Test Component Composition and Questionnaire Data
+
+ Background: Init
+ Given I want to create a VLM
+
+ Scenario: Test Component Composition and Questionnaire Data After Same Heat Reupload
+ When I want to create a VSP with onboarding type "NetworkPackage"
+ Then I want to make sure this Item has status "Draft"
+
+ When I want to upload a NetworkPackage for this VSP from path "resources/uploads/vMME_Ericsson_small_v2.zip"
+ And I want to process the NetworkPackage file for this VSP
+
+ When I want to get path "/vendor-software-products/{item.id}/versions/{item.versionId}/components"
+ Then I want to copy to property "componentId" from response data path "results[0].id"
+ Then I want to check property "listCount" for value 4
+ Then I want to check property "results[0].id" exists
+
+ #Verify composition data for first component
+ When I want to get path "/vendor-software-products/{item.id}/versions/{item.versionId}/components/{componentId}"
+ Then I want to check property "data.name" exists
+ Then I want to check property "data.displayName" exists
+ Then I want to copy to property "firstCompDisplayName" from response data path "data.displayName"
+ #Ensure composition data does not have vfcCode and nfcFunction since they are moved to questionnaire
+ Then I want to check property "data.vfcCode" does not exist
+ Then I want to check property "data.nfcFunction" does not exist
+
+ When I want to get the questionnaire for this component
+ #Ensure questionnaire data has nfcNamingCode in "general" and populated with value of component displayName
+ Then I want to check value of "general.nfcNamingCode" in the questionnaire data with value of property "firstCompDisplayName"
+
+ #Update questionnaire nfcNamingCode and nfcFunction in "general"
+ And I want to update this questionnaire with value "general/nfcNamingCode" for property "test_update_naming_code"
+ And I want to update this questionnaire with value "general/nfcFunction" for property "test_function"
+ And I want to update this questionnaire
+
+ #Retrive questionnaire and verify nfcNamingCode and nfcFunction in "general" has updated value
+ When I want to get the questionnaire for this component
+ Then I want to check this questionnaire has value "general/nfcNamingCode" for property "test_update_naming_code"
+ Then I want to check this questionnaire has value "general/nfcFunction" for property "test_function"
+
+ #Reupload the same Heat
+ When I want to upload a NetworkPackage for this VSP from path "resources/uploads/vMME_Ericsson_small_v2.zip"
+ And I want to process the NetworkPackage file for this VSP
+
+ When I want to get path "/vendor-software-products/{item.id}/versions/{item.versionId}/components"
+ #Find component id for which nfcNamingCode and nfcFunction were set in previous HEAT based on component display name
+ Then I want to set componentId for component name in property "firstCompDisplayName"
+
+ #Retrive questionnaire and verify nfcNamingCode and nfcFunction in "general" has retained values that were before heat upload
+ When I want to get the questionnaire for this component
+ Then I want to check this questionnaire has value "general/nfcNamingCode" for property "test_update_naming_code"
+ Then I want to check this questionnaire has value "general/nfcFunction" for property "test_function"
\ No newline at end of file
**/
Then('I want to update this questionnaire', function () {
return util.request(this.context, 'PUT', this.context.qurl, this.context.qdata);
+});
+
+/**
+ * @module Questionnaire
+ * @description Checks if the value of given property name in questionnaire data on the context is same as provided value
+ * @exampleFile ComponentData.feature
+ * @step I want to check value of {string} in the questionnaire data with value of property {string}
+ */
+Then('I want to check value of {string} in the questionnaire data with value of property {string}', function (string,
+ propertyName) {
+ expectedValue = _.get(this.context, propertyName)
+ data1 = this.context.qdata;
+ assert.equal(_.get(data1, string), expectedValue);
+});
+
+/**
+ * @module Questionnaire - Defined in Questionnaire module since this is used to fetch componentId for which questionnaire is to be fetched
+ * @description Finds and set componentId in context from list of components in responseData for component name in given property
+ * @exampleFile ComponentData.feature
+ * @step I want to set componentId for component name in property {string}
+ */
+Then('I want to set componentId for component name in property {string}', function (string) {
+ displayName = _.get(this.context, string);
+ results = this.context.responseData.results;
+ for (i=0; i<results.length; i++) {
+ if (results[i].displayName == displayName ){
+ this.context.componentId = results[i].id;
+ return;
+ }
+ }
});
\ No newline at end of file
-/*-
- * ============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;
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());
}
}
-/*-
- * ============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;
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);
}
@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;
}
-/*-
- * ============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;
Set<CompositionEntityValidationData> getAllErrorsByVsp(String vspId);
- ComponentEntity createComponent(ComponentEntity component);
+ ComponentEntity createComponent(ComponentEntity component, boolean isManualVsp);
NicEntity createNic(NicEntity nic);
/*
- * 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,
} else {
validateComponentManual(component);
updateComponentName(component);
- createdComponent = compositionEntityDataManager.createComponent(component);
+ createdComponent = compositionEntityDataManager.createComponent(component, true);
}
return createdComponent;
}
.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;
}
-/*-
- * ============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;
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;
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;
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);
}
@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;
* 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,
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));
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;
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);
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);
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("{}");
"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": {
--- /dev/null
+/*
+ * 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);
+ }
+ }
+}
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;
final Map<String, List<String>> sourceToTargetDependencies = componentQuestionnaireData
.populateDependencies(vspId, version,
componentQuestionnaireData
- .getSourceToTargetComponent());
+ .getSourceToTargetComponent());
Map<String, List<ErrorMessage>> errors = new HashMap<>();
final ServiceTemplate serviceTemplate =
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,
-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;
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 {
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) {
+/*
+ * 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() {
+
+ }
}
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;
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);
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);
-/*-
- * ============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;
private String name;
private String description;
private String displayName;
- private String vfcCode;
- private String nfcCode;
- private String nfcFunction;
public String getName() {
return name;
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();
return displayName != null ? displayName.equals(that.displayName) : that.displayName == null;
}
-
- public String getVfcCode() {
- return vfcCode;
- }
-
- public void setVfcCode(String vfcCode) {
- this.vfcCode = vfcCode;
- }
}
-/*-
- * ============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;
protected Recovery recovery;
private String dnsConfiguration;
private String vmCloneUsage;
+ private String nfcNamingCode;
+ private String nfcFunction;
public Hypervisor getHypervisor() {
return hypervisor;
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;
+ }
}
-/*-
- * ============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;
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() {
public Map getComponentQuestionnaireData() {
return componentQuestionnaireData;
}
+
+ public String getComponentDisplayName() {
+ return componentDisplayName;
+ }
+
+ public boolean isManual() {
+ return manual;
+ }
}
-/*-
- * ============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;
ComponentData component = new ComponentData();
component.setName(computeNodeType);
component.setDisplayName(getComponentDisplayName(component.getName()));
- component.setVfcCode(component.getDisplayName());
Component componentModel = new Component();
componentModel.setData(component);
],
"default": "${component.displayName}"</#if>
},
- "vfcCode": {
- "type": "string"
- },
-"nfcCode": {
-"type": "string"
-},
-"nfcFunction": {
-"type": "string"
-},
-"description": {
+ "description": {
"type": "string"
}
},
"general": {
"type": "object",
"properties": {
+ <#if !manual>
+ "nfcNamingCode": {
+ "type": "string",
+ "maxLength": 1000<#if componentDisplayName??>,
+ "default": "${componentDisplayName}"</#if>
+ },</#if>
+ "nfcFunction": {
+ "type": "string"
+ },
"hypervisor": {
"type": "object",
"properties": {
-/*!
- * 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.
+ * 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.
*/
import RestAPIUtil from 'nfvo-utils/RestAPIUtil.js';
import Configuration from 'sdc-app/config/Configuration.js';
{
name: vspComponent.name,
displayName: vspComponent.displayName,
- vfcCode: vspComponent.vfcCode,
- nfcFunction: vspComponent.nfcFunction,
description: vspComponent.description
}
);
-/*!
- * 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.
+ * 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.
*/
import React from 'react';
import i18n from 'nfvo-utils/i18n/i18n.js';
const GeneralSection = ({
onDataChanged,
displayName,
- vfcCode,
- nfcFunction,
description,
isReadOnlyMode,
genericFieldInfo,
- isManual
+ isManual,
+ dataMap,
+ onQDataChanged,
+ qgenericFieldInfo
}) => (
<GridSection title={i18n('General')}>
{/* disabled until backend will be ready to implement it
<Input
data-test-id="vfcCode"
label={i18n('Naming Code')}
- value={vfcCode}
- isValid={genericFieldInfo.vfcCode.isValid}
- errorText={genericFieldInfo.vfcCode.errorText}
- onChange={vfcCode => onDataChanged({ vfcCode })}
disabled={isReadOnlyMode}
type="text"
+ onChange={nfcFunction =>
+ onQDataChanged({ 'general/nfcNamingCode': nfcFunction })
+ }
+ isValid={qgenericFieldInfo['general/nfcNamingCode'].isValid}
+ errorText={
+ qgenericFieldInfo['general/nfcNamingCode'].errorText
+ }
+ value={dataMap['general/nfcNamingCode']}
/>
)}
<Input
data-test-id="nfcFunction"
label={i18n('Function')}
- value={nfcFunction}
- isValid={genericFieldInfo.nfcFunction.isValid}
- errorText={genericFieldInfo.nfcFunction.errorText}
- onChange={nfcFunction => onDataChanged({ nfcFunction })}
disabled={isReadOnlyMode}
type="text"
+ onChange={nfcFunction =>
+ onQDataChanged({ 'general/nfcFunction': nfcFunction })
+ }
+ isValid={qgenericFieldInfo['general/nfcFunction'].isValid}
+ errorText={qgenericFieldInfo['general/nfcFunction'].errorText}
+ value={dataMap['general/nfcFunction']}
/>
</GridItem>
<GridItem colSpan={2}>
genericFieldInfo,
dataMap,
qGenericFieldInfo,
- componentData: { displayName, vfcCode, nfcFunction, description },
+ componentData: { displayName, vfcCode, description },
isReadOnlyMode
} = this.props;
return (
onDataChanged={onDataChanged}
displayName={displayName}
vfcCode={vfcCode}
- nfcFunction={nfcFunction}
description={description}
isManual={isManual}
isReadOnlyMode={isReadOnlyMode}
genericFieldInfo={genericFieldInfo}
+ dataMap={dataMap}
+ onQDataChanged={onQDataChanged}
+ qgenericFieldInfo={qGenericFieldInfo}
/>
<HypervisorSection
onQDataChanged={onQDataChanged}