From 81edb057a2658964c20330ed34fdf591e689b2d8 Mon Sep 17 00:00:00 2001 From: Eylon Malin Date: Sun, 10 Nov 2019 16:17:58 +0200 Subject: a-la-carte services new instantiation ui Issue-ID: VID-701 Change-Id: I1a58fd2221f0936d32a8289fa666c6ffcfc7e2fa Signed-off-by: Eylon Malin --- .../onap/vid/asdc/parser/VidNotionsBuilder.java | 22 +++++++++++++++++----- .../src/main/java/org/onap/vid/model/VidNotions.kt | 5 +++-- 2 files changed, 20 insertions(+), 7 deletions(-) (limited to 'vid-app-common/src/main/java/org') diff --git a/vid-app-common/src/main/java/org/onap/vid/asdc/parser/VidNotionsBuilder.java b/vid-app-common/src/main/java/org/onap/vid/asdc/parser/VidNotionsBuilder.java index 786f74f25..76e911b4e 100644 --- a/vid-app-common/src/main/java/org/onap/vid/asdc/parser/VidNotionsBuilder.java +++ b/vid-app-common/src/main/java/org/onap/vid/asdc/parser/VidNotionsBuilder.java @@ -34,6 +34,7 @@ import org.onap.sdc.toscaparser.api.NodeTemplate; import org.onap.sdc.toscaparser.api.elements.Metadata; import org.onap.vid.model.ServiceModel; import org.onap.vid.model.VidNotions; +import org.onap.vid.model.VidNotions.InstantiationUI; import org.onap.vid.model.VidNotions.ModelCategory; import org.onap.vid.properties.Features; import org.togglz.core.manager.FeatureManager; @@ -56,9 +57,9 @@ public class VidNotionsBuilder { VidNotions buildVidNotions(ISdcCsarHelper csarHelper, ServiceModel serviceModel) { VidNotions.ModelCategory modelCategory = suggestModelCategory(csarHelper, serviceModel); return new VidNotions( - suggestInstantiationUI(csarHelper, serviceModel), + suggestInstantiationUI(csarHelper, serviceModel, modelCategory), modelCategory, - suggestViewEditUI(csarHelper, serviceModel), + suggestViewEditUI(csarHelper, serviceModel, modelCategory), suggestInstantiationType(serviceModel, modelCategory)); } @@ -89,10 +90,17 @@ public class VidNotionsBuilder { //UI route a-la-carte services to old UI only if InstantiationUI is LEGACY //So any other value for InstantiationUI other than LEGACY make UI to route //a-la-carte services to new UI - VidNotions.InstantiationUI suggestInstantiationUI(ISdcCsarHelper csarHelper, ServiceModel serviceModel) { + VidNotions.InstantiationUI suggestInstantiationUI(ISdcCsarHelper csarHelper, ServiceModel serviceModel, ModelCategory modelCategory) { if(featureManager.isActive(Features.FLAG_EXP_ANY_ALACARTE_NEW_INSTANTIATION_UI) && isALaCarte(csarHelper)) { return VidNotions.InstantiationUI.ANY_ALACARTE_NEW_UI; } + + if (featureManager.isActive(Features.FLAG_2002_ANY_ALACARTE_BESIDES_EXCLUDED_NEW_INSTANTIATION_UI) && + !isMacro(serviceModel) && + !isAlacarteExcludedByCategory(modelCategory)) { + return InstantiationUI.ANY_ALACARTE_WHICH_NOT_EXCLUDED; + } + if (featureManager.isActive(Features.FLAG_1902_VNF_GROUPING) && isGrouping(csarHelper)) { return VidNotions.InstantiationUI.SERVICE_WITH_VNF_GROUPING; } @@ -116,6 +124,10 @@ public class VidNotionsBuilder { } + private boolean isAlacarteExcludedByCategory(ModelCategory modelCategory) { + return modelCategory==ModelCategory.PORT_MIRRORING || modelCategory==ModelCategory.VLAN_TAGGING ; + } + private boolean isVnfServiceRole(ISdcCsarHelper csarHelper) { final String serviceRole = csarHelper.getServiceMetadata().getValue(ToscaParserImpl2.Constants.SERVICE_ROLE ); return StringUtils.equalsIgnoreCase("VNF" , serviceRole); @@ -172,7 +184,7 @@ public class VidNotionsBuilder { return VidNotions.ModelCategory.OTHER; } - VidNotions.InstantiationUI suggestViewEditUI(ISdcCsarHelper csarHelper, ServiceModel serviceModel) { + VidNotions.InstantiationUI suggestViewEditUI(ISdcCsarHelper csarHelper, ServiceModel serviceModel, ModelCategory modelCategory) { if (featureManager.isActive(Features.FLAG_1902_VNF_GROUPING) && isGrouping(csarHelper)) { return VidNotions.InstantiationUI.SERVICE_WITH_VNF_GROUPING; } @@ -186,7 +198,7 @@ public class VidNotionsBuilder { } if (featureManager.isActive(Features.FLAG_1902_NEW_VIEW_EDIT)) { - VidNotions.InstantiationUI instantiationUISuggestion = suggestInstantiationUI(csarHelper, serviceModel); + VidNotions.InstantiationUI instantiationUISuggestion = suggestInstantiationUI(csarHelper, serviceModel, modelCategory); if (instantiationUISuggestion!=VidNotions.InstantiationUI.LEGACY) { return instantiationUISuggestion; } diff --git a/vid-app-common/src/main/java/org/onap/vid/model/VidNotions.kt b/vid-app-common/src/main/java/org/onap/vid/model/VidNotions.kt index 205a79b50..c6de51c1a 100644 --- a/vid-app-common/src/main/java/org/onap/vid/model/VidNotions.kt +++ b/vid-app-common/src/main/java/org/onap/vid/model/VidNotions.kt @@ -25,7 +25,7 @@ import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.annotation.JsonValue import com.google.common.base.CaseFormat -class VidNotions(@get:JsonInclude(JsonInclude.Include.NON_NULL) +data class VidNotions(@get:JsonInclude(JsonInclude.Include.NON_NULL) val instantiationUI: InstantiationUI, val modelCategory: ModelCategory, val viewEditUI: InstantiationUI, @@ -41,7 +41,8 @@ class VidNotions(@get:JsonInclude(JsonInclude.Include.NON_NULL) TRANSPORT_SERVICE, SERVICE_WITH_COLLECTION_RESOURCE, A_LA_CARTE_VNF_SERVICE_ROLE, - INFRASTRUCTURE_VPN + INFRASTRUCTURE_VPN, + ANY_ALACARTE_WHICH_NOT_EXCLUDED, ; @JsonValue -- cgit 1.2.3-korg