Specify a model while creating a VSP
Change-Id: I6ed0a3c979e14c62ecd6488dfd70589df40636e9
Issue-ID: SDC-3656
Signed-off-by: André Schmid <andre.schmid@est.tech>
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/VspCreationModal.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/VspCreationModal.java
index e83eac4..5950b2d 100644
--- a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/VspCreationModal.java
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/VspCreationModal.java
@@ -59,6 +59,7 @@
selectCategory("resourceNewCategory.network l4+.common network resources");
fillDescription(vspName);
selectNetworkPackageOnboardingProcedure();
+ selectDefaultModel();
}
/**
@@ -97,6 +98,13 @@
}
/**
+ * Selects the default model.
+ */
+ public void selectDefaultModel() {
+ clickElement(XpathSelector.DEFAULT_MODEL_RADIO);
+ }
+
+ /**
* Selects a category in the category list based on the option value.
*
* @param categoryOptionValue the option value
@@ -109,7 +117,7 @@
* Selects the network package onboarding procedure option.
*/
public void selectNetworkPackageOnboardingProcedure() {
- wrappingElement.findElement(By.xpath(XpathSelector.METHOD_RADIO.getXpath())).click();
+ wrappingElement.findElement(By.xpath(XpathSelector.ONBOARDING_METHOD_RADIO.getXpath())).click();
}
private void setInputValue(final XpathSelector inputTestId, final String value) {
@@ -138,7 +146,8 @@
VENDOR_SELECT("new-vsp-vendor", "//select[@data-test-id='%s']"),
CATEGORY_SELECT("new-vsp-category", "//select[@data-test-id='%s']"),
DESCRIPTION_TXT("new-vsp-description", "//textarea[@data-test-id='%s']"),
- METHOD_RADIO("new-vsp-creation-procedure-heat", "//input[@data-test-id='%s']/parent::label"),
+ ONBOARDING_METHOD_RADIO("new-vsp-creation-procedure-heat", "//input[@data-test-id='%s']/parent::label"),
+ DEFAULT_MODEL_RADIO("model-option-default", "//input[@data-test-id='%s']/parent::label"),
CREATE_BTN("form-submit-button", "//*[@data-test-id='%s']");
@Getter
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/MapVspDescriptionDtoToVspDetails.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/MapVspDescriptionDtoToVspDetails.java
index 4c9c16d..418a512 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/MapVspDescriptionDtoToVspDetails.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/MapVspDescriptionDtoToVspDetails.java
@@ -3,6 +3,7 @@
* SDC
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2021 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -48,5 +49,6 @@
target.setLicenseAgreement(licensingData.getLicenseAgreement());
target.setFeatureGroups(licensingData.getFeatureGroups());
}
+ target.setModelIdList(source.getSelectedModelList());
}
}
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/MapVspDetailsToDto.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/MapVspDetailsToDto.java
index 1605ab7..897327e 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/MapVspDetailsToDto.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/MapVspDetailsToDto.java
@@ -3,6 +3,7 @@
* SDC
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2021 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -52,5 +53,6 @@
target.setLicensingData(licensingData);
}
target.setOnboardingMethod(source.getOnboardingMethod());
+ target.setSelectedModelList(source.getModelIdList());
}
}
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/VspDescriptionDto.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/VspDescriptionDto.java
index 90a094e..e5f4ae0 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/VspDescriptionDto.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/VspDescriptionDto.java
@@ -1,5 +1,6 @@
/*
* Copyright © 2016-2018 European Support Limited
+ * Modifications Copyright (C) 2021 Nordix Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,13 +16,22 @@
*/
package org.openecomp.sdcrests.vendorsoftwareproducts.types;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.stream.Collectors;
import javax.validation.constraints.NotNull;
import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.ToString;
+import org.apache.commons.collections.CollectionUtils;
import org.openecomp.sdc.common.util.ValidationUtils;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.LicenseType;
import org.openecomp.sdc.vendorsoftwareproduct.types.LicensingData;
@Data
+@ToString
+@EqualsAndHashCode
public class VspDescriptionDto {
@NotNull
@@ -40,6 +50,7 @@
private String licensingVersion; // this will be populated with vlm version
private LicenseType licenseType;
private LicensingData licensingData;
+ private List<String> selectedModelList;
public void setName(final String name) {
this.name = ValidationUtils.sanitizeInputString(name);
@@ -52,4 +63,19 @@
public void setDescription(final String description) {
this.description = ValidationUtils.sanitizeInputString(description);
}
+
+ public void setSelectedModelList(final List<String> selectedModelList) {
+ if (CollectionUtils.isEmpty(selectedModelList)) {
+ this.selectedModelList = new ArrayList<>();
+ return;
+ }
+ this.selectedModelList = selectedModelList.stream().map(ValidationUtils::sanitizeInputString).collect(Collectors.toList());
+ }
+
+ public List<String> getSelectedModelList() {
+ if (selectedModelList == null) {
+ return Collections.emptyList();
+ }
+ return new ArrayList<>(selectedModelList);
+ }
}
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/VspDetailsDto.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/VspDetailsDto.java
index 2acc27e..973d8ea 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/VspDetailsDto.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/VspDetailsDto.java
@@ -17,12 +17,16 @@
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.ToString;
import org.openecomp.sdc.heat.datatypes.structure.ValidationStructureList;
/**
* Created by TALIO on 4/25/2016.
*/
@Data
+@EqualsAndHashCode(callSuper = true)
+@ToString(callSuper = true)
@Schema(description = "VspDetails")
public class VspDetailsDto extends VspRequestDto {
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/VspRequestDto.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/VspRequestDto.java
index 13e21ba..99334bc 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/VspRequestDto.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/VspRequestDto.java
@@ -1,5 +1,6 @@
/*
* Copyright © 2016-2018 European Support Limited
+ * Modifications Copyright (C) 2021 Nordix Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,8 +18,12 @@
import javax.validation.constraints.NotNull;
import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.ToString;
@Data
+@EqualsAndHashCode(callSuper = true)
+@ToString(callSuper = true)
public class VspRequestDto extends VspDescriptionDto {
@NotNull
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/test/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/VspDescriptionDtoTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/test/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/VspDescriptionDtoTest.java
index 2fd5d40..fa8acb1 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/test/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/VspDescriptionDtoTest.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/test/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/VspDescriptionDtoTest.java
@@ -1,50 +1,53 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2019 Nokia. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+/*
+ * -
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Nokia. All rights reserved.
+ * Modifications Copyright (C) 2021 Nordix Foundation.
+ * ================================================================================
+ * 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=========================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
*/
package org.openecomp.sdcrests.vendorsoftwareproducts.types;
-import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanEquals;
-import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanHashCode;
-import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanToString;
-import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanEqualsExcluding;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanHashCodeExcluding;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanToStringExcluding;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSettersExcluding;
import static org.hamcrest.MatcherAssert.assertThat;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-public class VspDescriptionDtoTest {
+class VspDescriptionDtoTest {
+
@Test
- public void shouldHaveValidGettersAndSetters() {
- assertThat(VspDescriptionDto.class, hasValidGettersAndSetters());
+ void shouldHaveValidGettersAndSetters() {
+ assertThat(VspDescriptionDto.class, hasValidGettersAndSettersExcluding("selectedModelList"));
}
@Test
- public void shouldHaveValidToString() {
- assertThat(VspDescriptionDto.class, hasValidBeanToString());
+ void shouldHaveValidToString() {
+ assertThat(VspDescriptionDto.class, hasValidBeanToStringExcluding("selectedModelList"));
}
@Test
- public void shouldHaveEquals() {
- assertThat(VspDescriptionDto.class, hasValidBeanEquals());
+ void shouldHaveEquals() {
+ assertThat(VspDescriptionDto.class, hasValidBeanEqualsExcluding("selectedModelList"));
}
@Test
- public void shouldHaveHashCode() {
- assertThat(VspDescriptionDto.class, hasValidBeanHashCode());
+ void shouldHaveHashCode() {
+ assertThat(VspDescriptionDto.class, hasValidBeanHashCodeExcluding("selectedModelList"));
}
}
\ No newline at end of file
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/test/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/VspDetailsDtoTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/test/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/VspDetailsDtoTest.java
index be87a61..077f3a6 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/test/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/VspDetailsDtoTest.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/test/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/VspDetailsDtoTest.java
@@ -19,14 +19,15 @@
*/
package org.openecomp.sdcrests.vendorsoftwareproducts.types;
-import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSettersExcluding;
import static org.hamcrest.MatcherAssert.assertThat;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-public class VspDetailsDtoTest {
+class VspDetailsDtoTest {
+
@Test
- public void shouldHaveValidGettersAndSetters() {
- assertThat(VspDetailsDto.class, hasValidGettersAndSetters());
+ void shouldHaveValidGettersAndSetters() {
+ assertThat(VspDetailsDto.class, hasValidGettersAndSettersExcluding("selectedModelList"));
}
}
\ No newline at end of file
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/test/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/VspRequestDtoTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/test/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/VspRequestDtoTest.java
index dde6143..de35922 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/test/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/VspRequestDtoTest.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/test/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/VspRequestDtoTest.java
@@ -19,14 +19,15 @@
*/
package org.openecomp.sdcrests.vendorsoftwareproducts.types;
-import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSettersExcluding;
import static org.hamcrest.MatcherAssert.assertThat;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-public class VspRequestDtoTest {
+class VspRequestDtoTest {
+
@Test
- public void shouldHaveValidGettersAndSetters() {
- assertThat(VspRequestDto.class, hasValidGettersAndSetters());
+ void shouldHaveValidGettersAndSetters() {
+ assertThat(VspRequestDto.class, hasValidGettersAndSettersExcluding("selectedModelList"));
}
}
\ No newline at end of file
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/dao/type/VspDetails.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/VspDetails.java
index 88b020b..01d1f0b 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/VspDetails.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/VspDetails.java
@@ -3,6 +3,7 @@
* SDC
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2021 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,6 +20,8 @@
*/
package org.openecomp.sdc.vendorsoftwareproduct.dao.type;
+import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import lombok.Getter;
import lombok.NoArgsConstructor;
@@ -46,6 +49,7 @@
private String licenseAgreement;
private List<String> featureGroups;
private String onboardingMethod;
+ private List<String> modelIdList;
public VspDetails(String id, Version version) {
this.id = id;
@@ -62,10 +66,16 @@
return getId();
}
+ public List<String> getModelIdList() {
+ if (modelIdList == null) {
+ return Collections.emptyList();
+ }
+ return new ArrayList<>(modelIdList);
+ }
+
@Override
public String toString() {
- return String
- .format("Vsp id = '%s', Version = %s', Name = %s', Category = %s', Description = %s', Vendor = %s'", this.id, this.version, this.name,
- this.category, this.description, this.vendorName);
+ return String.format("Vsp id = '%s', Version = '%s', Name = '%s', Category = '%s', Description = '%s', Vendor = '%s', Model = '%s'",
+ this.id, this.version, this.name, this.category, this.description, this.vendorName, this.modelIdList);
}
}
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/dao/impl/zusammen/VendorSoftwareProductInfoDaoZusammenImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/VendorSoftwareProductInfoDaoZusammenImpl.java
index 9655434..78ab818 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/VendorSoftwareProductInfoDaoZusammenImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/VendorSoftwareProductInfoDaoZusammenImpl.java
@@ -1,5 +1,6 @@
/*
* Copyright © 2016-2018 European Support Limited
+ * Modifications Copyright (C) 2021 Nordix Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -26,6 +27,8 @@
import java.io.ByteArrayInputStream;
import java.util.Collection;
import java.util.stream.Collectors;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
import org.openecomp.core.zusammen.api.ZusammenAdaptor;
import org.openecomp.sdc.datatypes.model.ElementType;
import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao;
@@ -189,7 +192,7 @@
return questionnaireElement;
}
- private void addVspDetailsToInfo(Info info, VspDetails vspDetails) {
+ private void addVspDetailsToInfo(final Info info, final VspDetails vspDetails) {
info.addProperty(InfoPropertyName.NAME.getValue(), vspDetails.getName());
info.addProperty(InfoPropertyName.DESCRIPTION.getValue(), vspDetails.getDescription());
info.addProperty(InfoPropertyName.ICON.getValue(), vspDetails.getIcon());
@@ -204,8 +207,13 @@
info.addProperty(InfoPropertyName.LICENSE_AGREEMENT.getValue(), vspDetails.getLicenseAgreement());
info.addProperty(InfoPropertyName.FEATURE_GROUPS.getValue(), vspDetails.getFeatureGroups());
info.addProperty(InfoPropertyName.ON_BOARDING_METHOD.getValue(), vspDetails.getOnboardingMethod());
+ if (!vspDetails.getModelIdList().isEmpty()) {
+ info.addProperty(InfoPropertyName.MODELS.getValue(), vspDetails.getModelIdList());
+ }
}
+ @AllArgsConstructor
+ @Getter
public enum InfoPropertyName {
// @formatter:off
NAME("name"),
@@ -219,17 +227,11 @@
LICENSE_TYPE("licenseType"),
LICENSE_AGREEMENT("licenseAgreement"),
FEATURE_GROUPS("featureGroups"),
- ON_BOARDING_METHOD("onboardingMethod");
+ ON_BOARDING_METHOD("onboardingMethod"),
+ MODELS("models");
// @formatter:on
- private String value;
+ private final String value;
- InfoPropertyName(String value) {
- this.value = value;
- }
-
- public String getValue() {
- return value;
- }
}
}
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/dao/impl/zusammen/convertor/ElementToVSPGeneralConvertor.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/convertor/ElementToVSPGeneralConvertor.java
index 8234eee..016c80a 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/convertor/ElementToVSPGeneralConvertor.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/convertor/ElementToVSPGeneralConvertor.java
@@ -3,6 +3,7 @@
* SDC
* ================================================================================
* Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2021 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,10 +26,11 @@
import com.amdocs.zusammen.datatypes.item.Item;
import org.openecomp.convertor.ElementConvertor;
import org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.VendorSoftwareProductInfoDaoZusammenImpl;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.VendorSoftwareProductInfoDaoZusammenImpl.InfoPropertyName;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
import org.openecomp.sdc.versioning.dao.types.Version;
-public class ElementToVSPGeneralConvertor extends ElementConvertor {
+public class ElementToVSPGeneralConvertor extends ElementConvertor<VspDetails> {
@Override
public VspDetails convert(Element element) {
@@ -43,7 +45,7 @@
if (item == null) {
return null;
}
- VspDetails vspDetails = mapInfoToVspDetails(item.getInfo());
+ var vspDetails = mapInfoToVspDetails(item.getInfo());
vspDetails.setId(item.getId().getValue());
return vspDetails;
}
@@ -56,8 +58,8 @@
return mapInfoToVspDetails(elementInfo.getInfo());
}
- private VspDetails mapInfoToVspDetails(Info info) {
- VspDetails vspDetails = new VspDetails();
+ private VspDetails mapInfoToVspDetails(final Info info) {
+ final var vspDetails = new VspDetails();
vspDetails.setName(info.getProperty(VendorSoftwareProductInfoDaoZusammenImpl.InfoPropertyName.NAME.getValue()));
vspDetails.setDescription(info.getProperty(VendorSoftwareProductInfoDaoZusammenImpl.InfoPropertyName.DESCRIPTION.getValue()));
vspDetails.setIcon(info.getProperty(VendorSoftwareProductInfoDaoZusammenImpl.InfoPropertyName.ICON.getValue()));
@@ -73,6 +75,7 @@
vspDetails.setLicenseAgreement(info.getProperty(VendorSoftwareProductInfoDaoZusammenImpl.InfoPropertyName.LICENSE_AGREEMENT.getValue()));
vspDetails.setFeatureGroups(info.getProperty(VendorSoftwareProductInfoDaoZusammenImpl.InfoPropertyName.FEATURE_GROUPS.getValue()));
vspDetails.setOnboardingMethod(info.getProperty(VendorSoftwareProductInfoDaoZusammenImpl.InfoPropertyName.ON_BOARDING_METHOD.getValue()));
+ vspDetails.setModelIdList(info.getProperty(InfoPropertyName.MODELS.getValue()));
return vspDetails;
}
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/convertor/ElementToVSPGeneralConvertorTest.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/convertor/ElementToVSPGeneralConvertorTest.java
new file mode 100644
index 0000000..d5b80f1
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/convertor/ElementToVSPGeneralConvertorTest.java
@@ -0,0 +1,127 @@
+/*
+ * -
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.convertor;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+import static org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.VendorSoftwareProductInfoDaoZusammenImpl.InfoPropertyName.CATEGORY;
+import static org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.VendorSoftwareProductInfoDaoZusammenImpl.InfoPropertyName.DESCRIPTION;
+import static org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.VendorSoftwareProductInfoDaoZusammenImpl.InfoPropertyName.FEATURE_GROUPS;
+import static org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.VendorSoftwareProductInfoDaoZusammenImpl.InfoPropertyName.ICON;
+import static org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.VendorSoftwareProductInfoDaoZusammenImpl.InfoPropertyName.LICENSE_AGREEMENT;
+import static org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.VendorSoftwareProductInfoDaoZusammenImpl.InfoPropertyName.LICENSE_TYPE;
+import static org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.VendorSoftwareProductInfoDaoZusammenImpl.InfoPropertyName.MODELS;
+import static org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.VendorSoftwareProductInfoDaoZusammenImpl.InfoPropertyName.NAME;
+import static org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.VendorSoftwareProductInfoDaoZusammenImpl.InfoPropertyName.ON_BOARDING_METHOD;
+import static org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.VendorSoftwareProductInfoDaoZusammenImpl.InfoPropertyName.SUB_CATEGORY;
+import static org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.VendorSoftwareProductInfoDaoZusammenImpl.InfoPropertyName.VENDOR_ID;
+import static org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.VendorSoftwareProductInfoDaoZusammenImpl.InfoPropertyName.VENDOR_NAME;
+import static org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.VendorSoftwareProductInfoDaoZusammenImpl.InfoPropertyName.VENDOR_VERSION;
+
+import com.amdocs.zusammen.adaptor.inbound.api.types.item.Element;
+import com.amdocs.zusammen.adaptor.inbound.api.types.item.ElementInfo;
+import com.amdocs.zusammen.datatypes.Id;
+import com.amdocs.zusammen.datatypes.item.Info;
+import com.amdocs.zusammen.datatypes.item.Item;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Set;
+import org.junit.jupiter.api.Test;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.VendorSoftwareProductInfoDaoZusammenImpl.InfoPropertyName;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
+
+class ElementToVSPGeneralConvertorTest {
+
+ final ElementToVSPGeneralConvertor elementToVSPGeneralConvertor = new ElementToVSPGeneralConvertor();
+
+ @Test
+ void convertElementTest() {
+ VspDetails actualVspDetails = elementToVSPGeneralConvertor.convert((Element) null);
+ assertNull(actualVspDetails);
+ final Element elementMock = mock(Element.class);
+ final Info defaultInfo = createDefaultInfo();
+ when(elementMock.getInfo()).thenReturn(defaultInfo);
+ actualVspDetails = elementToVSPGeneralConvertor.convert(elementMock);
+ assertNotNull(actualVspDetails);
+ assertVspDetails(actualVspDetails, defaultInfo);
+ }
+
+ @Test
+ void convertElementInfoTest() {
+ VspDetails actualVspDetails = elementToVSPGeneralConvertor.convert((ElementInfo) null);
+ assertNull(actualVspDetails);
+ final ElementInfo elementInfoMock = mock(ElementInfo.class);
+ final Info defaultInfo = createDefaultInfo();
+ when(elementInfoMock.getInfo()).thenReturn(defaultInfo);
+ actualVspDetails = elementToVSPGeneralConvertor.convert(elementInfoMock);
+ assertNotNull(actualVspDetails);
+ assertVspDetails(actualVspDetails, defaultInfo);
+ }
+
+ @Test
+ void convertItemTest() {
+ VspDetails actualVspDetails = elementToVSPGeneralConvertor.convert((Item) null);
+ assertNull(actualVspDetails);
+ final Item elementInfoMock = mock(Item.class);
+ final Info defaultInfo = createDefaultInfo();
+ final var itemId = new Id();
+ final var id = "anId";
+ itemId.setValue(id);
+
+ when(elementInfoMock.getInfo()).thenReturn(defaultInfo);
+ when(elementInfoMock.getId()).thenReturn(itemId);
+ actualVspDetails = elementToVSPGeneralConvertor.convert(elementInfoMock);
+
+ assertNotNull(actualVspDetails);
+ assertEquals(actualVspDetails.getId(), id);
+ assertVspDetails(actualVspDetails, defaultInfo);
+ }
+
+ private void assertVspDetails(final VspDetails vspDetails, final Info info) {
+ assertEquals(vspDetails.getName(), info.getProperty(NAME.getValue()));
+ assertEquals(vspDetails.getDescription(), info.getProperty(DESCRIPTION.getValue()));
+ assertEquals(vspDetails.getIcon(), info.getProperty(ICON.getValue()));
+ assertEquals(vspDetails.getCategory(), info.getProperty(CATEGORY.getValue()));
+ assertEquals(vspDetails.getSubCategory(), info.getProperty(SUB_CATEGORY.getValue()));
+ assertEquals(vspDetails.getVendorId(), info.getProperty(VENDOR_ID.getValue()));
+ assertEquals(vspDetails.getVendorName(), info.getProperty(VENDOR_NAME.getValue()));
+ assertEquals(vspDetails.getVlmVersion().getId(), info.getProperty(VENDOR_VERSION.getValue()));
+ assertEquals(vspDetails.getLicenseType(), info.getProperty(LICENSE_TYPE.getValue()));
+ assertEquals(vspDetails.getLicenseAgreement(), info.getProperty(LICENSE_AGREEMENT.getValue()));
+ assertEquals(vspDetails.getFeatureGroups(), info.getProperty(FEATURE_GROUPS.getValue()));
+ assertEquals(vspDetails.getOnboardingMethod(), info.getProperty(ON_BOARDING_METHOD.getValue()));
+ assertEquals(vspDetails.getModelIdList(), info.getProperty(MODELS.getValue()));
+ }
+
+ private Info createDefaultInfo() {
+ var info = new Info();
+ final Set<InfoPropertyName> collectionProperties = Set.of(FEATURE_GROUPS, MODELS);
+ Arrays.stream(InfoPropertyName.values()).filter(propertyName -> !collectionProperties.contains(propertyName))
+ .forEach(propertyName -> info.addProperty(propertyName.getValue(), propertyName.getValue()));
+ info.addProperty(FEATURE_GROUPS.getValue(), List.of("group1", "group2"));
+ info.addProperty(MODELS.getValue(), List.of("model1", "model2"));
+ return info;
+ }
+}
\ No newline at end of file
diff --git a/openecomp-ui/resources/scss/components/_forms.scss b/openecomp-ui/resources/scss/components/_forms.scss
index 40c1aa1..1d80691 100644
--- a/openecomp-ui/resources/scss/components/_forms.scss
+++ b/openecomp-ui/resources/scss/components/_forms.scss
@@ -4,6 +4,10 @@
&:first-child {
padding-top: 0;
}
+ span.required {
+ color: $red;
+ margin: 0 4px 0 0;
+ }
}
.validation-form-content {
diff --git a/openecomp-ui/resources/scss/components/_inputOptions.scss b/openecomp-ui/resources/scss/components/_inputOptions.scss
index eb0fe79..7ac9752 100644
--- a/openecomp-ui/resources/scss/components/_inputOptions.scss
+++ b/openecomp-ui/resources/scss/components/_inputOptions.scss
@@ -63,6 +63,20 @@
border-color: $gray;
}
}
+ .select-multiple {
+ border: 1px solid $light-gray;
+ border-radius: 2px;
+ min-height: 60px;
+ float: left;
+ transition-property: width;
+ transition-duration: 300ms;
+ padding-top: 0;
+ padding-bottom: 0;
+ width: 100%;
+ &:hover {
+ border-color: $gray;
+ }
+ }
.input-options-other {
float: left;
height: 30px;
diff --git a/openecomp-ui/resources/scss/modules/_softwareProductLandingPage.scss b/openecomp-ui/resources/scss/modules/_softwareProductLandingPage.scss
index a0620b3..c1cf3cf 100644
--- a/openecomp-ui/resources/scss/modules/_softwareProductLandingPage.scss
+++ b/openecomp-ui/resources/scss/modules/_softwareProductLandingPage.scss
@@ -1,3 +1,25 @@
+/*!
+ * -
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2021 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
.upload-modal-body-content {
padding-left: 30px;
padding-right: 30px;
@@ -132,7 +154,8 @@
}
border: 1px solid $light-gray;
padding: 20px 18px 0 18px;
- height: 225px;
+ min-height: 285px;
+ height: 100%;
display: flex;
justify-content: space-between;
background-color: $white;
diff --git a/openecomp-ui/src/nfvo-components/grid/GridSection.jsx b/openecomp-ui/src/nfvo-components/grid/GridSection.jsx
index f2e3588..46063b2 100644
--- a/openecomp-ui/src/nfvo-components/grid/GridSection.jsx
+++ b/openecomp-ui/src/nfvo-components/grid/GridSection.jsx
@@ -22,7 +22,8 @@
children,
className = '',
titleClassName,
- hasLastColSet = false
+ hasLastColSet = false,
+ required = false
}) => {
return (
<div
@@ -32,6 +33,7 @@
{title && (
<div className={`section-title ${titleClassName || ''}`}>
{title}
+ {required && <span className={'required'}>*</span>}
</div>
)}
<div className="grid-items">{children}</div>
diff --git a/openecomp-ui/src/nfvo-utils/i18n/en.json b/openecomp-ui/src/nfvo-utils/i18n/en.json
index 786fe16..a5518ef 100644
--- a/openecomp-ui/src/nfvo-utils/i18n/en.json
+++ b/openecomp-ui/src/nfvo-utils/i18n/en.json
@@ -284,6 +284,7 @@
"Log Backup Frequency (days)": "Log Backup Frequency (days)",
"Log File Location": "Log File Location",
"Model": "Model",
+ "model.sdc.label": "SDC AID",
"License Details": "License Details",
"Feature Group": "Feature Group",
"Please assign Feature Groups in VSP General": "Please assign Feature Groups in VSP General",
@@ -386,6 +387,7 @@
"VendorSoftwareProduct/vendorName": "Vendor",
"VendorSoftwareProduct/onboardingOrigin": "Onboarding Origin",
"VendorSoftwareProduct/networkPackageName": "Network Package Name",
+ "vsp.model.select.label": "Other Models",
"EntitlementPool" : "Entitlement Pool",
"EntitlementPool/name" : "Name",
diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductActionHelper.js b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductActionHelper.js
index 38600a6..29e278f 100644
--- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductActionHelper.js
+++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductActionHelper.js
@@ -1,6 +1,7 @@
/*!
* Copyright © 2016-2018 European Support Limited
* Modifications copyright (c) 2021 Nokia
+ * Modifications Copyright (C) 2021 Nordix Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -100,11 +101,17 @@
const restPrefix = Configuration.get('restPrefix');
return `${restPrefix}/v1.0/vendor-software-products/`;
}
+
function softwareProductCategoriesUrl() {
const restCatalogPrefix = Configuration.get('restCatalogPrefix');
return `${restCatalogPrefix}/v1/categories/resources/`;
}
+function getModelUrl() {
+ const restCatalogPrefix = Configuration.get('restCatalogPrefix');
+ return `${restCatalogPrefix}/v1/catalog/model/`;
+}
+
function uploadFile(vspId, formData, version) {
return RestAPIUtil.post(
`${baseUrl()}${vspId}/versions/${
@@ -135,6 +142,7 @@
: undefined,
icon: softwareProduct.icon,
licenseType: softwareProduct.licenseType,
+ selectedModelList: softwareProduct.selectedModelList,
licensingData: getLicensingData(softwareProduct.licensingData)
}
);
@@ -264,6 +272,17 @@
.catch(() => handleResponse(null));
}
+function fetchModelList(dispatch) {
+ let handleResponse = response =>
+ dispatch({
+ type: actionTypes.SOFTWARE_PRODUCT_MODELS_LOADED,
+ modelList: response
+ });
+ RestAPIUtil.fetch(getModelUrl())
+ .then(handleResponse)
+ .catch(() => handleResponse(null));
+}
+
function loadLicensingData(dispatch, { licenseModelId, licensingVersion }) {
return ItemsHelper.fetchVersion({
itemId: licenseModelId,
@@ -329,6 +348,7 @@
loadSoftwareProductAssociatedData(dispatch) {
fetchSoftwareProductCategories(dispatch);
+ fetchModelList(dispatch);
LicenseModelActionHelper.fetchFinalizedLicenseModels(dispatch);
},
diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductConstants.js b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductConstants.js
index e132250..22a11ea 100644
--- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductConstants.js
+++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductConstants.js
@@ -1,5 +1,6 @@
/*!
* Copyright © 2016-2018 European Support Limited
+ * Modifications Copyright (C) 2021 Nordix Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,6 +24,7 @@
FINALIZED_SOFTWARE_PRODUCT_LIST_LOADED: null,
SOFTWARE_PRODUCT_LIST_EDIT: null,
SOFTWARE_PRODUCT_CATEGORIES_LOADED: null,
+ SOFTWARE_PRODUCT_MODELS_LOADED: null,
SOFTWARE_PRODUCT_QUESTIONNAIRE_UPDATE: null,
LOAD_LICENSING_VERSIONS_LIST: null,
TOGGLE_NAVIGATION_ITEM: null,
@@ -43,6 +45,11 @@
NETWORK_PACKAGE: 'NetworkPackage'
};
+export const ModelOption = {
+ DEFAULT: 'default',
+ SELECTED: 'selected'
+};
+
export const onboardingOriginTypes = {
NONE: 'none',
ZIP: 'zip',
diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductReducer.js b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductReducer.js
index dcec5c6..06e974c 100644
--- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductReducer.js
+++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductReducer.js
@@ -1,5 +1,6 @@
/*!
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2021 Nordix Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -160,6 +161,12 @@
}
return state;
},
+ modelList: (state = [], action) => {
+ if (action.type === actionTypes.SOFTWARE_PRODUCT_MODELS_LOADED) {
+ return action.modelList;
+ }
+ return state;
+ },
softwareProductQuestionnaire: createJSONSchemaReducer(
PRODUCT_QUESTIONNAIRE
),
diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/creation/SoftwareProductCreation.js b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/creation/SoftwareProductCreation.js
index 539bc12..cccde78 100644
--- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/creation/SoftwareProductCreation.js
+++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/creation/SoftwareProductCreation.js
@@ -1,5 +1,6 @@
/*!
* Copyright © 2016-2018 European Support Limited
+ * Modifications Copyright (C) 2021 Nordix Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -33,7 +34,11 @@
archivedSoftwareProductList,
softwareProductList,
finalizedSoftwareProductList,
- softwareProduct: { softwareProductCreation, softwareProductCategories }
+ softwareProduct: {
+ softwareProductCreation,
+ softwareProductCategories,
+ modelList
+ }
}) => {
let { genericFieldInfo, vendorList = [] } = softwareProductCreation;
let isFormValid = ValidationHelper.checkFormValid(genericFieldInfo);
@@ -55,6 +60,7 @@
softwareProductCategories,
finalizedLicenseModelList,
vendorList,
+ modelList: modelList,
isFormValid,
formReady: softwareProductCreation.formReady,
genericFieldInfo,
@@ -65,12 +71,13 @@
export const mapActionsToProps = dispatch => {
return {
- onDataChanged: (deltaData, formName, customValidations) =>
+ onDataChanged: (deltaData, formName, customValidations) => {
ValidationHelper.dataChanged(dispatch, {
deltaData,
formName,
customValidations
- }),
+ });
+ },
onCancel: () => SoftwareProductCreationActionHelper.resetData(dispatch),
onSubmit: (softwareProduct, usersList) => {
SoftwareProductCreationActionHelper.resetData(dispatch);
diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/creation/SoftwareProductCreationReducer.js b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/creation/SoftwareProductCreationReducer.js
index 8860374..496a251 100644
--- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/creation/SoftwareProductCreationReducer.js
+++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/creation/SoftwareProductCreationReducer.js
@@ -1,5 +1,6 @@
/*!
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2021 Nordix Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -70,6 +71,18 @@
validations: [
{ type: 'requiredChooseOption', data: true }
]
+ },
+ modelOption: {
+ isValid: true,
+ errorText: '',
+ validations: [
+ { type: 'requiredChooseOption', data: true }
+ ]
+ },
+ selectedModelList: {
+ isValid: true,
+ errorText: '',
+ validations: []
}
},
showModal: true
diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/creation/SoftwareProductCreationView.jsx b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/creation/SoftwareProductCreationView.jsx
index e4a9893..51e8834 100644
--- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/creation/SoftwareProductCreationView.jsx
+++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/creation/SoftwareProductCreationView.jsx
@@ -1,5 +1,6 @@
/*!
* Copyright © 2016-2018 European Support Limited
+ * Modifications Copyright (C) 2021 Nordix Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,7 +15,7 @@
* permissions and limitations under the License.
*/
import React from 'react';
-import PropTypes from 'prop-types';
+import PropTypes, { string } from 'prop-types';
import i18n from 'nfvo-utils/i18n/i18n.js';
import Validator from 'nfvo-utils/Validator.js';
import Input from 'nfvo-components/input/validation/Input.jsx';
@@ -26,7 +27,11 @@
import sortByStringProperty from 'nfvo-utils/sortByStringProperty.js';
import SoftwareProductCategoriesHelper from 'sdc-app/onboarding/softwareProduct/SoftwareProductCategoriesHelper.js';
-import { onboardingMethod as onboardingMethodConst } from '../SoftwareProductConstants.js';
+import {
+ ModelOption,
+ onboardingMethod as onboardingMethodConst
+} from '../SoftwareProductConstants.js';
+import SelectInput from 'nfvo-components/input/SelectInput.jsx';
const SoftwareProductPropType = PropTypes.shape({
id: PropTypes.string,
@@ -34,7 +39,8 @@
description: PropTypes.string,
category: PropTypes.string,
subCategory: PropTypes.string,
- vendorId: PropTypes.string
+ vendorId: PropTypes.string,
+ selectedModelList: PropTypes.arrayOf(string)
});
class SoftwareProductCreationView extends React.Component {
@@ -44,6 +50,7 @@
softwareProductCategories: PropTypes.array,
VSPNames: PropTypes.object,
usersList: PropTypes.array,
+ modelList: PropTypes.array,
onDataChanged: PropTypes.func.isRequired,
onSubmit: PropTypes.func.isRequired,
onCancel: PropTypes.func.isRequired
@@ -56,14 +63,17 @@
onDataChanged,
onCancel,
genericFieldInfo,
- disableVendor
+ disableVendor,
+ modelList
} = this.props;
let {
name,
description,
vendorId,
subCategory,
- onboardingMethod
+ onboardingMethod,
+ modelOption,
+ selectedModelList
} = data;
const vendorList = this.getVendorList();
@@ -193,11 +203,24 @@
/>
</GridItem>
</GridSection>
- <OnboardingProcedure
- genericFieldInfo={genericFieldInfo}
- onboardingMethod={onboardingMethod}
- onDataChanged={onDataChanged}
- />
+ <GridSection>
+ <GridItem colSpan={2}>
+ <OnboardingProcedure
+ genericFieldInfo={genericFieldInfo}
+ onboardingMethod={onboardingMethod}
+ onDataChanged={onDataChanged}
+ />
+ </GridItem>
+ <GridItem colSpan={2}>
+ <ModelSelection
+ genericFieldInfo={genericFieldInfo}
+ modelOption={modelOption}
+ modelList={modelList}
+ selectedModelList={selectedModelList}
+ onDataChanged={onDataChanged}
+ />
+ </GridItem>
+ </GridSection>
</Form>
)}
</div>
@@ -235,14 +258,12 @@
}
submit() {
- let {
- data: softwareProduct,
- finalizedLicenseModelList,
- usersList
- } = this.props;
+ let { finalizedLicenseModelList, usersList } = this.props;
+ const softwareProduct = { ...this.props.data };
softwareProduct.vendorName = finalizedLicenseModelList.find(
vendor => vendor.id === softwareProduct.vendorId
).name;
+ delete softwareProduct.modelOption;
this.props.onSubmit(softwareProduct, usersList);
}
@@ -284,7 +305,7 @@
genericFieldInfo
}) => {
return (
- <GridSection title={i18n('Onboarding procedure')}>
+ <GridSection title={i18n('Onboarding procedure')} required={true}>
<GridItem colSpan={4}>
<Input
label={i18n('Network Package')}
@@ -329,4 +350,77 @@
);
};
+const ModelSelection = ({
+ modelOption,
+ onDataChanged,
+ genericFieldInfo,
+ modelList = [],
+ selectedModelList = []
+}) => {
+ function onSelectChanged(selectedValueList) {
+ let modelList1 = [];
+ if (selectedValueList) {
+ modelList1 = selectedValueList.map(item => item.value);
+ }
+ onDataChanged({ selectedModelList: modelList1 }, SP_CREATION_FORM_NAME);
+ }
+
+ function selectDefaultModel() {
+ return () => {
+ onDataChanged(
+ { modelOption: ModelOption.DEFAULT },
+ SP_CREATION_FORM_NAME
+ );
+ onDataChanged({ selectedModelList: [] }, SP_CREATION_FORM_NAME);
+ };
+ }
+
+ return (
+ <GridSection title={i18n('Model')} required={true}>
+ <GridItem colSpan={4}>
+ <Input
+ label={i18n('model.sdc.label')}
+ checked={modelOption === ModelOption.DEFAULT}
+ errorText={genericFieldInfo.modelOption.errorText}
+ onChange={selectDefaultModel()}
+ type="radio"
+ data-test-id="model-option-default"
+ />
+ <Input
+ label={i18n('vsp.model.select.label')}
+ checked={modelOption === ModelOption.SELECTED}
+ isValid={genericFieldInfo.modelOption.isValid}
+ errorText={genericFieldInfo.modelOption.errorText}
+ onChange={() =>
+ onDataChanged(
+ { modelOption: ModelOption.SELECTED },
+ SP_CREATION_FORM_NAME
+ )
+ }
+ type="radio"
+ data-test-id="model-option-selected"
+ groupClassName="no-bottom-margin"
+ />
+ </GridItem>
+ <GridItem colSpan={4}>
+ {modelOption === ModelOption.SELECTED && <br />}
+ {modelOption === ModelOption.SELECTED && (
+ <SelectInput
+ options={modelList.map(model => ({
+ label: model.name,
+ value: model.name
+ }))}
+ onMultiSelectChanged={onSelectChanged}
+ value={selectedModelList}
+ clearable={true}
+ placeholder={i18n('vsp.model.select.label')}
+ multi
+ />
+ )}
+ {modelOption === ModelOption.SELECTED && <br />}
+ </GridItem>
+ </GridSection>
+ );
+};
+
export default SoftwareProductCreationView;
diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/details/SoftwareProductDetailsView.jsx b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/details/SoftwareProductDetailsView.jsx
index 7df610a..d24916f 100644
--- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/details/SoftwareProductDetailsView.jsx
+++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/details/SoftwareProductDetailsView.jsx
@@ -1,5 +1,6 @@
/*!
* Copyright © 2016-2018 European Support Limited
+ * Modifications Copyright (C) 2021 Nordix Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -51,6 +52,7 @@
name: PropTypes.string,
description: PropTypes.string,
subCategory: PropTypes.string,
+ selectedModelList: PropTypes.arrayOf(PropTypes.string),
softwareProductCategories: PropTypes.array,
finalizedLicenseModelList: PropTypes.array,
onDataChanged: PropTypes.func.isRequired,
@@ -164,6 +166,22 @@
)
)}
</Input>
+ <div className="form-group">
+ <label className="control-label">
+ {i18n('Model')}
+ </label>
+ <div>
+ {this.props.selectedModelList.length > 0 ? (
+ <ul>
+ {this.props.selectedModelList.map(
+ value => <li>{value}</li>
+ )}
+ </ul>
+ ) : (
+ i18n('model.sdc.label')
+ )}
+ </div>
+ </div>
</GridItem>
<GridItem colSpan={2} stretch>
<Input
@@ -509,7 +527,8 @@
description,
vendorId,
subCategory,
- vendorName
+ vendorName,
+ selectedModelList = []
} = currentSoftwareProduct;
return {
name,
@@ -523,6 +542,7 @@
onSelectSubCategory: args => this.onSelectSubCategory(args),
genericFieldInfo,
vendorName,
+ selectedModelList,
isVendorArchived,
onArchivedVendorRemove
};
diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/landingPage/SoftwareProductLandingPageView.jsx b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/landingPage/SoftwareProductLandingPageView.jsx
index 0f18a44..5f20834 100644
--- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/landingPage/SoftwareProductLandingPageView.jsx
+++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/landingPage/SoftwareProductLandingPageView.jsx
@@ -1,5 +1,6 @@
/*
* Copyright © 2016-2018 European Support Limited
+ * Modifications Copyright (C) 2021 Nordix Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -36,7 +37,8 @@
licenseType: PropTypes.string,
status: PropTypes.string,
licensingData: PropTypes.object,
- validationData: PropTypes.object
+ validationData: PropTypes.object,
+ selectedModelList: PropTypes.arrayOf(PropTypes.string)
});
const ComponentPropType = PropTypes.shape({
@@ -259,7 +261,8 @@
name = '',
description = '',
vendorName = '',
- fullCategoryDisplayName = ''
+ fullCategoryDisplayName = '',
+ selectedModelList = []
} = currentSoftwareProduct;
return (
<div className="details-panel">
@@ -286,6 +289,20 @@
</div>
</div>
<div className="detail-col">
+ <div className="title">{i18n('Model')}</div>
+ <div className="description">
+ {selectedModelList.length > 0 ? (
+ <ul>
+ {selectedModelList.map(value => (
+ <li>{value}</li>
+ ))}
+ </ul>
+ ) : (
+ i18n('model.sdc.label')
+ )}
+ </div>
+ </div>
+ <div className="detail-col">
<div className="title extra-large">
{i18n('License Agreement')}
</div>
diff --git a/openecomp-ui/test/softwareProduct/creation/SoftwareProductCreation.test.js b/openecomp-ui/test/softwareProduct/creation/SoftwareProductCreation.test.js
index 20ca17d..2758e28 100644
--- a/openecomp-ui/test/softwareProduct/creation/SoftwareProductCreation.test.js
+++ b/openecomp-ui/test/softwareProduct/creation/SoftwareProductCreation.test.js
@@ -1,17 +1,23 @@
/*
- * Copyright © 2016-2018 European Support Limited
+ * -
+ * ============LICENSE_START=======================================================
+ * Copyright © 2016-2018 European Support Limited
+ * Modifications Copyright (C) 2021 Nordix Foundation.
+ * ================================================================================
+ * 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
*
- * 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.
*
- * 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.
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
*/
import React from 'react';
@@ -71,6 +77,22 @@
expect(props.VSPNames).toEqual({vsp1: 'vsp1_id', vsp2: 'vsp2_id'});
});
+ it ('should return model list', () => {
+ const modelList = ["model1", "model2", "model3"];
+ let state = {
+ finalizedSoftwareProductList: [],
+ archivedSoftwareProductList: [],
+ softwareProductList: [],
+ softwareProduct: {
+ modelList: modelList,
+ softwareProductCreation: {}
+ },
+ users: {}
+ };
+ let props = mapStateToProps(state);
+ expect(props.modelList).toEqual(modelList);
+ });
+
it('simple jsx test', () => {
const store = storeCreator();
let dispatch = store.dispatch;
diff --git a/openecomp-ui/test/softwareProduct/details/test.js b/openecomp-ui/test/softwareProduct/details/test.js
index 92390f6..0e0c9ec 100644
--- a/openecomp-ui/test/softwareProduct/details/test.js
+++ b/openecomp-ui/test/softwareProduct/details/test.js
@@ -1,5 +1,6 @@
/*
* Copyright © 2016-2018 European Support Limited
+ * Modifications Copyright (C) 2021 Nordix Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -217,6 +218,13 @@
});
mockRest.addHandler('fetch', ({options, data, baseUrl}) => {
+ expect(baseUrl).toEqual('/sdc1/feProxy/rest/v1/catalog/model/');
+ expect(data).toEqual(undefined);
+ expect(options).toEqual(undefined);
+ return [];
+ });
+
+ mockRest.addHandler('fetch', ({options, data, baseUrl}) => {
expect(baseUrl).toEqual('/onboarding-api/v1.0/vendor-license-models/?versionFilter=Certified');
expect(data).toEqual(undefined);
expect(options).toEqual(undefined);