aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIttay Stern <ittay.stern@att.com>2019-11-25 14:04:02 +0000
committerGerrit Code Review <gerrit@onap.org>2019-11-25 14:04:02 +0000
commit88e5a40c125893a5600bdd81ef943b921e9f8f08 (patch)
tree6a43657acd3769a82e05ccefdea273d29d2bda91
parent36cd35eebe45d15deb3a1d0ba272e4fb0548061b (diff)
parentcbe6877e50b69370170bea4057bb8d5baf42946e (diff)
Merge "identify macro services without instantiation type in BE by feature flag"
-rw-r--r--features.properties.md6
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/asdc/parser/VidNotionsBuilder.java57
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/properties/Features.java1
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/asdc/parser/VidNotionsBuilderTest.java124
-rw-r--r--vid-automation/src/main/java/vid/automation/test/infra/Features.java1
-rw-r--r--vid-automation/src/main/java/vid/automation/test/test/BrowseASDCTest.java9
-rw-r--r--vid-automation/src/main/resources/registration_to_simulator/sanity/get_csar_zip_file.json10
-rw-r--r--vid-automation/src/test/java/org/onap/vid/api/SdcApiTest.java14
-rw-r--r--vid-ext-services-simulator/src/main/resources/download_files/csar15782222_invariantUUIDMacro.zipbin27791 -> 38626 bytes
9 files changed, 156 insertions, 66 deletions
diff --git a/features.properties.md b/features.properties.md
index 1f9feccf7..45d5922c7 100644
--- a/features.properties.md
+++ b/features.properties.md
@@ -183,4 +183,8 @@
Any a-la-carte new service deployment will be open in modern UI, besides excluded services : Port mirroring, VLAN Tagging
* FLAG_2002_VFM_UPGRADE_ADDITIONAL_OPTIONS
- When flag is true the new popup will be opened with additional options to perform on VFM. \ No newline at end of file
+ When flag is true the new popup will be opened with additional options to perform on VFM.
+
+* FLAG_2002_IDENTIFY_INVARIANT_MACRO_UUID_BY_BACKEND,
+ When flag is true, VID use macro_services_by_invariant_uuid.json file to identify if csar without instantiation type is macro service.
+ Otherwise, MACRO_SERVICES list in vidConfiguration.js is used to identify if it's a macro service (in ng1 code)
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 3f18a5ace..760eb4251 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
@@ -24,6 +24,7 @@ import static java.util.stream.Collectors.toSet;
import static org.apache.commons.lang3.StringUtils.equalsAnyIgnoreCase;
import static org.apache.commons.lang3.StringUtils.equalsIgnoreCase;
import static org.apache.commons.lang3.StringUtils.isEmpty;
+import static org.hibernate.annotations.common.util.StringHelper.isNotEmpty;
import static org.onap.vid.utils.KotlinUtilsKt.JACKSON_OBJECT_MAPPER;
import com.google.common.collect.ImmutableMap;
@@ -42,6 +43,7 @@ import org.onap.sdc.toscaparser.api.elements.Metadata;
import org.onap.vid.exceptions.GenericUncheckedException;
import org.onap.vid.model.ServiceModel;
import org.onap.vid.model.VidNotions;
+import org.onap.vid.model.VidNotions.InstantiationType;
import org.onap.vid.model.VidNotions.InstantiationUI;
import org.onap.vid.model.VidNotions.ModelCategory;
import org.onap.vid.properties.Features;
@@ -78,11 +80,13 @@ public class VidNotionsBuilder {
VidNotions buildVidNotions(ISdcCsarHelper csarHelper, ServiceModel serviceModel) {
VidNotions.ModelCategory modelCategory = suggestModelCategory(csarHelper, serviceModel);
+ final InstantiationType instantiationType = suggestInstantiationType(serviceModel, modelCategory);
return new VidNotions(
- suggestInstantiationUI(csarHelper, serviceModel, modelCategory),
+ suggestInstantiationUI(csarHelper, serviceModel, modelCategory, instantiationType),
modelCategory,
- suggestViewEditUI(csarHelper, serviceModel, modelCategory),
- suggestInstantiationType(serviceModel, modelCategory));
+ suggestViewEditUI(csarHelper, serviceModel, modelCategory, instantiationType),
+ instantiationType
+ );
}
private boolean isMacroTypeByModelCategory(VidNotions.ModelCategory modelCategory) {
@@ -91,34 +95,47 @@ public class VidNotionsBuilder {
return (featureOfMacroType!=null && featureManager.isActive(featureOfMacroType));
}
- VidNotions.InstantiationType suggestInstantiationType(ServiceModel serviceModel, VidNotions.ModelCategory modelCategory) {
+ InstantiationType suggestInstantiationType(ServiceModel serviceModel, VidNotions.ModelCategory modelCategory) {
if (isMacroTypeByModelCategory(modelCategory)) {
- return VidNotions.InstantiationType.Macro;
+ return InstantiationType.Macro;
}
- if (serviceModel==null || serviceModel.getService()==null || isEmpty(serviceModel.getService().getInstantiationType())) {
- return VidNotions.InstantiationType.ClientConfig;
+ if (serviceModel==null || serviceModel.getService()==null) {
+ return defaultInstantiationType();
}
- String instantiationType = serviceModel.getService().getInstantiationType();
- if (instantiationType.equals(ToscaParserImpl2.Constants.MACRO)) {
- return VidNotions.InstantiationType.Macro;
+
+ if (StringUtils.equals(serviceModel.getService().getInstantiationType(), ToscaParserImpl2.Constants.MACRO)) {
+ return InstantiationType.Macro;
}
- if (instantiationType.equals(ToscaParserImpl2.Constants.A_LA_CARTE)) {
- return VidNotions.InstantiationType.ALaCarte;
+
+ if (StringUtils.equals(serviceModel.getService().getInstantiationType(), ToscaParserImpl2.Constants.A_LA_CARTE)) {
+ return InstantiationType.ALaCarte;
}
- return VidNotions.InstantiationType.ClientConfig;
+ if (!featureManager.isActive(Features.FLAG_2002_IDENTIFY_INVARIANT_MACRO_UUID_BY_BACKEND))
+ return InstantiationType.ClientConfig;
+
+ return isMacroByInvariantUuid(serviceModel.getService().getInvariantUuid()) ?
+ InstantiationType.Macro :
+ InstantiationType.ALaCarte;
+ }
+
+ @NotNull
+ private InstantiationType defaultInstantiationType() {
+ return featureManager.isActive(Features.FLAG_2002_IDENTIFY_INVARIANT_MACRO_UUID_BY_BACKEND) ?
+ InstantiationType.ALaCarte :
+ InstantiationType.ClientConfig;
}
//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, ModelCategory modelCategory) {
+ VidNotions.InstantiationUI suggestInstantiationUI(ISdcCsarHelper csarHelper, ServiceModel serviceModel, ModelCategory modelCategory, InstantiationType instantiationType) {
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) &&
+ !isMacro(instantiationType) &&
!isAlacarteExcludedByCategory(modelCategory)) {
return InstantiationUI.ANY_ALACARTE_WHICH_NOT_EXCLUDED;
}
@@ -206,13 +223,13 @@ public class VidNotionsBuilder {
return VidNotions.ModelCategory.OTHER;
}
- VidNotions.InstantiationUI suggestViewEditUI(ISdcCsarHelper csarHelper, ServiceModel serviceModel, ModelCategory modelCategory) {
+ VidNotions.InstantiationUI suggestViewEditUI(ISdcCsarHelper csarHelper, ServiceModel serviceModel, ModelCategory modelCategory, InstantiationType instantiationType) {
if (featureManager.isActive(Features.FLAG_1902_VNF_GROUPING) && isGrouping(csarHelper)) {
return VidNotions.InstantiationUI.SERVICE_WITH_VNF_GROUPING;
}
if (featureManager.isActive(Features.FLAG_1908_MACRO_NOT_TRANSPORT_NEW_VIEW_EDIT) &&
- isMacro(serviceModel) &&
+ isMacro(instantiationType) &&
!isTransportService(csarHelper) &&
//till new view/edit would support fabric service activation
!hasFabricConfiguration(csarHelper)) {
@@ -220,7 +237,7 @@ public class VidNotionsBuilder {
}
if (featureManager.isActive(Features.FLAG_1902_NEW_VIEW_EDIT)) {
- VidNotions.InstantiationUI instantiationUISuggestion = suggestInstantiationUI(csarHelper, serviceModel, modelCategory);
+ VidNotions.InstantiationUI instantiationUISuggestion = suggestInstantiationUI(csarHelper, serviceModel, modelCategory, instantiationType);
if (instantiationUISuggestion!=VidNotions.InstantiationUI.LEGACY) {
return instantiationUISuggestion;
}
@@ -229,8 +246,8 @@ public class VidNotionsBuilder {
return VidNotions.InstantiationUI.LEGACY;
}
- private boolean isMacro(ServiceModel serviceModel) {
- return ToscaParserImpl2.Constants.MACRO.equals(serviceModel.getService().getInstantiationType());
+ private boolean isMacro(InstantiationType instantiationType) {
+ return instantiationType==InstantiationType.Macro;
}
private boolean isUuidExactlyHardCoded1ffce89fef3f(ISdcCsarHelper csarHelper) {
diff --git a/vid-app-common/src/main/java/org/onap/vid/properties/Features.java b/vid-app-common/src/main/java/org/onap/vid/properties/Features.java
index 52899126c..d6d7a6aa2 100644
--- a/vid-app-common/src/main/java/org/onap/vid/properties/Features.java
+++ b/vid-app-common/src/main/java/org/onap/vid/properties/Features.java
@@ -80,6 +80,7 @@ public enum Features implements Feature {
FLAG_1911_INSTANTIATION_ORDER_IN_ASYNC_ALACARTE,
FLAG_2002_ANY_ALACARTE_BESIDES_EXCLUDED_NEW_INSTANTIATION_UI,
FLAG_2002_VFM_UPGRADE_ADDITIONAL_OPTIONS,
+ FLAG_2002_IDENTIFY_INVARIANT_MACRO_UUID_BY_BACKEND,
;
diff --git a/vid-app-common/src/test/java/org/onap/vid/asdc/parser/VidNotionsBuilderTest.java b/vid-app-common/src/test/java/org/onap/vid/asdc/parser/VidNotionsBuilderTest.java
index c32dd2141..0f6f25c7b 100644
--- a/vid-app-common/src/test/java/org/onap/vid/asdc/parser/VidNotionsBuilderTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/asdc/parser/VidNotionsBuilderTest.java
@@ -74,6 +74,9 @@ import org.togglz.core.manager.FeatureManager;
public class VidNotionsBuilderTest {
+ private static final String MACRO_SERVICE_INVARIANT_UUID = "2efab359-cdd4-4da2-9b79-61df990796c2";
+ private static final String NOT_MACRO_SERVICE_INVARIANT_UUID = "5d854f6b-759c-4aa6-b472-7e4bb1c003d4";
+
@InjectMocks
VidNotionsBuilder vidNotionsBuilder;
@@ -98,7 +101,7 @@ public class VidNotionsBuilderTest {
public void VLNetworkWithPropertyNetworkTechnologyOVS_UIHintIsPositive() {
ISdcCsarHelper csarHelper = mockForNonLegacyInstantiationUI();
- assertThat(vidNotionsBuilder.suggestInstantiationUI(csarHelper, serviceModel, ModelCategory.OTHER), is(InstantiationUI.NETWORK_WITH_PROPERTY_NETWORK_TECHNOLOGY_EQUALS_STANDARD_SRIOV_OR_OVS));
+ assertThat(vidNotionsBuilder.suggestInstantiationUI(csarHelper, serviceModel, ModelCategory.OTHER, InstantiationType.ALaCarte), is(InstantiationUI.NETWORK_WITH_PROPERTY_NETWORK_TECHNOLOGY_EQUALS_STANDARD_SRIOV_OR_OVS));
assertThat(vidNotionsBuilder.suggestModelCategory(csarHelper, serviceModel) , is(ModelCategory.IS_5G_PROVIDER_NETWORK_MODEL));
}
@@ -119,20 +122,87 @@ public class VidNotionsBuilderTest {
}
@DataProvider
+ public static Object[][] identifyInvariantFeatureFlagDataProvider() {
+ return new Object[][] {
+ {false, null, InstantiationType.ClientConfig},
+ {false, mock(ServiceModel.class), InstantiationType.ClientConfig},
+ {true, null, InstantiationType.ALaCarte},
+ {true, mock(ServiceModel.class), InstantiationType.ALaCarte},
+ };
+ }
+
+ @Test(dataProvider = "identifyInvariantFeatureFlagDataProvider")
+ public void whenCsarIsEmpty_suggestInstantiationType_byFeatureFlag(
+ boolean isFlagActive, ServiceModel serviceModel, InstantiationType expectedType) {
+ when(featureManagerMock.isActive(Features.FLAG_2002_IDENTIFY_INVARIANT_MACRO_UUID_BY_BACKEND)).thenReturn(isFlagActive);
+ if (serviceModel!=null) {
+ when(serviceModel.getService()).thenReturn(null);
+ }
+ assertEquals(expectedType, vidNotionsBuilder.suggestInstantiationType(serviceModel, null));
+ }
+
+ @DataProvider
+ public static Object[][] noMacroNoAlaCarteDataProvider() {
+ return new Object[][] {
+ {Constants.CLIENT_CONFIG},
+ {"don't know you"},
+ {null},
+ };
+ }
+
+ @Test(dataProvider = "noMacroNoAlaCarteDataProvider")
+ public void givenNoMacroNorALaCarte_when_FLAG_2002_IDENTIFY_INVARIANT_MACRO_UUID_BY_BACKEND_isOff_then_suggestInstantiationType_ClientConfig(String instantiationType) {
+ ServiceModel serviceModel = mockServiceModelInstantiationTypeAndInvariant(MACRO_SERVICE_INVARIANT_UUID, instantiationType);
+ when(featureManagerMock.isActive(Features.FLAG_2002_IDENTIFY_INVARIANT_MACRO_UUID_BY_BACKEND)).thenReturn(false);
+ assertEquals(InstantiationType.ClientConfig , vidNotionsBuilder.suggestInstantiationType(serviceModel, null));
+ }
+
+ @NotNull
+ private ServiceModel mockServiceModelInstantiationTypeAndInvariant(String invariantUUID, String instantiationType) {
+ ServiceModel serviceModel = mock(ServiceModel.class);
+ Service service = mock(Service.class);
+ when(serviceModel.getService()).thenReturn(service);
+ when(service.getInstantiationType()).thenReturn(instantiationType);
+ when(service.getInvariantUuid()).thenReturn(invariantUUID);
+ return serviceModel;
+ }
+
+ @DataProvider
+ public static Object[][] instantiationTypeByInvariantDataProvider() {
+ return new Object[][] {
+ {null, MACRO_SERVICE_INVARIANT_UUID, InstantiationType.Macro},
+ {null, NOT_MACRO_SERVICE_INVARIANT_UUID, InstantiationType.ALaCarte},
+ {Constants.CLIENT_CONFIG, MACRO_SERVICE_INVARIANT_UUID, InstantiationType.Macro},
+ {Constants.BOTH, NOT_MACRO_SERVICE_INVARIANT_UUID, InstantiationType.ALaCarte},
+ };
+ }
+
+ @Test(dataProvider = "instantiationTypeByInvariantDataProvider")
+ public void givenNoMacroNorALaCarte_givenFlagIsOn_suggestInstantiationTypeByInvariant(
+ String givenInstantiationType, String invariantUUID, InstantiationType expectedType
+ ) {
+ when(featureManagerMock.isActive(Features.FLAG_2002_IDENTIFY_INVARIANT_MACRO_UUID_BY_BACKEND)).thenReturn(true);
+ ServiceModel serviceModel = mockServiceModelInstantiationTypeAndInvariant(invariantUUID, givenInstantiationType);
+ assertEquals(expectedType, vidNotionsBuilder.suggestInstantiationType(serviceModel, null));
+ }
+
+ @DataProvider
public static Object[][] anyAlacarteDataProvider() {
return new Object[][] {
- {"A-La-Carte", InstantiationUI.ANY_ALACARTE_NEW_UI},
- {"Macro", InstantiationUI.LEGACY},
+ {InstantiationType.ALaCarte, InstantiationUI.ANY_ALACARTE_NEW_UI},
+ {InstantiationType.Macro, InstantiationUI.LEGACY},
};
}
@Test(dataProvider = "anyAlacarteDataProvider")
- public void FLAG_EXP_ANY_ALACARTE_NEW_INSTANTIATION_UI_is_active_UIHintIsPositive(String instantiationType, InstantiationUI expectedInstantiationUI) {
+ public void FLAG_EXP_ANY_ALACARTE_NEW_INSTANTIATION_UI_is_active_UIHintIsPositive(InstantiationType instantiationType, InstantiationUI expectedInstantiationUI) {
initServiceModelAndscarHelperWithMocks();
+ String instantiationTypeAsString = instantiationType==InstantiationType.ALaCarte ? "A-La-Carte" : "Macro";
+
when(featureManagerMock.isActive(Features.FLAG_EXP_ANY_ALACARTE_NEW_INSTANTIATION_UI)).thenReturn(true);
when(csarHelper.getServiceMetadata()).thenReturn(new Metadata(ImmutableMap.of(
- "instantiationType", instantiationType
+ "instantiationType", instantiationTypeAsString
)));
NodeTemplate nodeTemplate = mock(NodeTemplate.class);
@@ -143,7 +213,7 @@ public class VidNotionsBuilderTest {
when(csarHelper.getServiceVlList()).thenReturn(ImmutableList.of(nodeTemplate));
- assertThat(vidNotionsBuilder.suggestInstantiationUI(csarHelper, serviceModel, ModelCategory.OTHER), is(expectedInstantiationUI));
+ assertThat(vidNotionsBuilder.suggestInstantiationUI(csarHelper, serviceModel, ModelCategory.OTHER, instantiationType), is(expectedInstantiationUI));
}
@Test
@@ -159,7 +229,7 @@ public class VidNotionsBuilderTest {
when(csarHelper.getServiceVlList()).thenReturn(ImmutableList.of(nodeTemplate));
- assertThat(vidNotionsBuilder.suggestInstantiationUI(csarHelper, serviceModel, ModelCategory.OTHER), is(InstantiationUI.LEGACY));
+ assertThat(vidNotionsBuilder.suggestInstantiationUI(csarHelper, serviceModel, ModelCategory.OTHER, InstantiationType.ALaCarte), is(InstantiationUI.LEGACY));
assertThat(vidNotionsBuilder.suggestModelCategory(csarHelper, serviceModel) , is(ModelCategory.OTHER));
}
@@ -169,7 +239,7 @@ public class VidNotionsBuilderTest {
assertThat(vidNotionsBuilder.isALaCarte(csarHelper), is(false));
assertThat(vidNotionsBuilder.hasAnyNetworkWithPropertyEqualsToAnyOf(csarHelper, "unexpected_property_name"), is(false));
assertThat(vidNotionsBuilder.hasAnyNetworkWithPropertyEqualsToAnyOf(csarHelper, "network_technology","Standard-SR-IOV"), is(true));
- assertThat(vidNotionsBuilder.suggestInstantiationUI(csarHelper, serviceModel, ModelCategory.OTHER), is(InstantiationUI.LEGACY));
+ assertThat(vidNotionsBuilder.suggestInstantiationUI(csarHelper, serviceModel, ModelCategory.OTHER, InstantiationType.ClientConfig), is(InstantiationUI.LEGACY));
}
@Test
@@ -177,7 +247,7 @@ public class VidNotionsBuilderTest {
initServiceModelAndscarHelperWithRealCsar("/csars/service-fabric-configuration.zip");
assertThat(vidNotionsBuilder.isALaCarte(csarHelper), is(false));
assertThat(vidNotionsBuilder.hasFabricConfiguration(csarHelper), is(true));
- assertThat(vidNotionsBuilder.suggestInstantiationUI(csarHelper, serviceModel, ModelCategory.OTHER), is(InstantiationUI.LEGACY));
+ assertThat(vidNotionsBuilder.suggestInstantiationUI(csarHelper, serviceModel, ModelCategory.OTHER, InstantiationType.ClientConfig), is(InstantiationUI.LEGACY));
}
@Test(dataProvider = "trueAndFalse", dataProviderClass = TestUtils.class)
@@ -187,7 +257,7 @@ public class VidNotionsBuilderTest {
when(featureManagerMock.isActive(Features.FLAG_1908_TRANSPORT_SERVICE_NEW_INSTANTIATION_UI)).thenReturn(flagValue);
assertThat(vidNotionsBuilder.isALaCarte(csarHelper), is(false));
- assertThat(vidNotionsBuilder.suggestInstantiationUI(csarHelper, serviceModel, ModelCategory.OTHER), is(flagValue ? InstantiationUI.TRANSPORT_SERVICE : InstantiationUI.LEGACY));
+ assertThat(vidNotionsBuilder.suggestInstantiationUI(csarHelper, serviceModel, ModelCategory.OTHER, InstantiationType.ClientConfig), is(flagValue ? InstantiationUI.TRANSPORT_SERVICE : InstantiationUI.LEGACY));
assertThat(vidNotionsBuilder.suggestModelCategory(csarHelper, serviceModel), is(ModelCategory.Transport));
}
@@ -195,7 +265,7 @@ public class VidNotionsBuilderTest {
public void withoutMocks_givenZippedToscaFileOfInfraStructureVpn_InstantiationUIIsRight(boolean flagValue) throws SdcToscaParserException, IOException {
initServiceModelAndscarHelperWithRealCsar("/csars/service-Infravpn-csar.zip");
when(featureManagerMock.isActive(Features.FLAG_1908_INFRASTRUCTURE_VPN)).thenReturn(flagValue);
- assertThat(vidNotionsBuilder.suggestInstantiationUI(csarHelper, serviceModel, ModelCategory.OTHER), is(flagValue ? InstantiationUI.INFRASTRUCTURE_VPN : InstantiationUI.LEGACY));
+ assertThat(vidNotionsBuilder.suggestInstantiationUI(csarHelper, serviceModel, ModelCategory.OTHER, InstantiationType.ClientConfig), is(flagValue ? InstantiationUI.INFRASTRUCTURE_VPN : InstantiationUI.LEGACY));
assertThat(vidNotionsBuilder.suggestModelCategory(csarHelper, serviceModel), is(ModelCategory.INFRASTRUCTURE_VPN));
}
@@ -232,21 +302,20 @@ public class VidNotionsBuilderTest {
@DataProvider
public static Object[][] anyAlaCarteDataProvider() {
return new Object[][] {
- {true, Constants.A_LA_CARTE, InstantiationUI.ANY_ALACARTE_WHICH_NOT_EXCLUDED},
- {false, Constants.A_LA_CARTE, InstantiationUI.LEGACY},
- {true, Constants.MACRO, InstantiationUI.LEGACY},
- {true, Constants.CLIENT_CONFIG, InstantiationUI.ANY_ALACARTE_WHICH_NOT_EXCLUDED},
+ {true, InstantiationType.ALaCarte, InstantiationUI.ANY_ALACARTE_WHICH_NOT_EXCLUDED},
+ {false, InstantiationType.ALaCarte, InstantiationUI.LEGACY},
+ {true, InstantiationType.Macro, InstantiationUI.LEGACY},
+ {true, InstantiationType.ClientConfig, InstantiationUI.ANY_ALACARTE_WHICH_NOT_EXCLUDED},
{true, null, InstantiationUI.ANY_ALACARTE_WHICH_NOT_EXCLUDED},
- {true, "", InstantiationUI.ANY_ALACARTE_WHICH_NOT_EXCLUDED}
};
}
@Test(dataProvider = "anyAlaCarteDataProvider")
- public void testAnyAlaCarteNewUI_byInstantiationTypeAndFeatureFlag(boolean flag, String instantiationType, InstantiationUI expected) {
+ public void testAnyAlaCarteNewUI_byInstantiationTypeAndFeatureFlag(boolean flag, InstantiationType instantiationType, InstantiationUI expected) {
initServiceModelAndscarHelperWithMocks();
- mockInstantiationType(serviceModel, instantiationType);
+ //mockInstantiationType(serviceModel, instantiationType);
when(featureManagerMock.isActive(Features.FLAG_2002_ANY_ALACARTE_BESIDES_EXCLUDED_NEW_INSTANTIATION_UI)).thenReturn(flag);
- assertThat(vidNotionsBuilder.suggestInstantiationUI(csarHelper, serviceModel, ModelCategory.OTHER), is(expected));
+ assertThat(vidNotionsBuilder.suggestInstantiationUI(csarHelper, serviceModel, ModelCategory.OTHER, instantiationType), is(expected));
}
@Test
@@ -257,7 +326,7 @@ public class VidNotionsBuilderTest {
"UUID", "95eb2c44-bff2-4e8b-ad5d-8266870b7717"
)));
when(featureManagerMock.isActive(Features.FLAG_5G_IN_NEW_INSTANTIATION_UI)).thenReturn(true);
- assertThat(vidNotionsBuilder.suggestInstantiationUI(csarHelper, serviceModel, ModelCategory.OTHER), is(InstantiationUI.SERVICE_UUID_IS_1ffce89f_ef3f_4cbb_8b37_82134590c5de));
+ assertThat(vidNotionsBuilder.suggestInstantiationUI(csarHelper, serviceModel, ModelCategory.OTHER, InstantiationType.ClientConfig), is(InstantiationUI.SERVICE_UUID_IS_1ffce89f_ef3f_4cbb_8b37_82134590c5de));
}
@Test(dataProvider = "trueAndFalse", dataProviderClass = TestUtils.class)
@@ -290,7 +359,7 @@ public class VidNotionsBuilderTest {
"serviceRole", serviceRole
)));
- assertThat(vidNotionsBuilder.suggestViewEditUI(csarHelper, serviceModel, ModelCategory.OTHER), is(expectedViewEditUI));
+ assertThat(vidNotionsBuilder.suggestViewEditUI(csarHelper, serviceModel, ModelCategory.OTHER, InstantiationType.ClientConfig), is(expectedViewEditUI));
}
@DataProvider
@@ -316,7 +385,7 @@ public class VidNotionsBuilderTest {
ServiceModel serviceModel = mock(ServiceModel.class);
mockInstantiationType(serviceModel, Constants.A_LA_CARTE);
- InstantiationUI result = vidNotionsBuilder.suggestViewEditUI(csarHelper, serviceModel, ModelCategory.OTHER);
+ InstantiationUI result = vidNotionsBuilder.suggestViewEditUI(csarHelper, serviceModel, ModelCategory.OTHER, InstantiationType.ClientConfig);
assertEquals(expectedViewEditUi, result);
}
@@ -470,7 +539,7 @@ public class VidNotionsBuilderTest {
emptyMap() : ImmutableMap.of(ToscaParserImpl2.Constants.SERVICE_ROLE, serviceRole)
));
- assertEquals(expectedViewEditUi, vidNotionsBuilder.suggestInstantiationUI(csarHelper, serviceModel, ModelCategory.OTHER));
+ assertEquals(expectedViewEditUi, vidNotionsBuilder.suggestInstantiationUI(csarHelper, serviceModel, ModelCategory.OTHER, InstantiationType.ALaCarte));
}
private static NodeTemplate mockNodeTemplateChild(boolean withFabricConfiguration) {
@@ -524,15 +593,14 @@ public class VidNotionsBuilderTest {
initServiceModelAndscarHelperWithMocks();
Service service = mock(Service.class);
- String instantiationType = isMacro ? ToscaParserImpl2.Constants.MACRO : ToscaParserImpl2.Constants.A_LA_CARTE;
+ InstantiationType instantiationType = isMacro ? InstantiationType.Macro : InstantiationType.ALaCarte;
when(serviceModel.getService()).thenReturn(service);
- when(service.getInstantiationType()).thenReturn(instantiationType);
when(featureManagerMock.isActive(Features.FLAG_1908_MACRO_NOT_TRANSPORT_NEW_VIEW_EDIT)).thenReturn(flagActive);
when(featureManagerMock.isActive(Features.FLAG_1902_NEW_VIEW_EDIT)).thenReturn(false);
when(csarHelper.getServiceMetadata()).thenReturn(new Metadata(isTransport ? ImmutableMap.of(ToscaParserImpl2.Constants.SERVICE_TYPE, "TRANSPORT") : emptyMap()
));
- assertEquals(expectedViewEditUi, vidNotionsBuilder.suggestViewEditUI(csarHelper, serviceModel, ModelCategory.OTHER));
+ assertEquals(expectedViewEditUi, vidNotionsBuilder.suggestViewEditUI(csarHelper, serviceModel, ModelCategory.OTHER, instantiationType));
}
@DataProvider
@@ -540,10 +608,10 @@ public class VidNotionsBuilderTest {
return new Object[][]{
{"117f5f1a-1b47-4ae1-ae04-489c9a7ada28", true},
{"117F5f1a-1b47-4AE1-ae04-489C9A7ada28", true},
- {"2efab359-cdd4-4da2-9b79-61df990796c2", true},
+ {MACRO_SERVICE_INVARIANT_UUID, true},
{"67e09a1f-9e42-4b63-8dee-bc60bae50de1", false},
{"67e09A1F-9E42-4b63-8Dee-bc60bae50de1", false},
- {"5d854f6b-759c-4aa6-b472-7e4bb1c003d4", false},
+ {NOT_MACRO_SERVICE_INVARIANT_UUID, false},
{"I'm not a uuid", false},
{null, false},
};
diff --git a/vid-automation/src/main/java/vid/automation/test/infra/Features.java b/vid-automation/src/main/java/vid/automation/test/infra/Features.java
index 9e55b9fbc..c1a505276 100644
--- a/vid-automation/src/main/java/vid/automation/test/infra/Features.java
+++ b/vid-automation/src/main/java/vid/automation/test/infra/Features.java
@@ -55,6 +55,7 @@ public enum Features implements Feature {
FLAG_1911_INSTANTIATION_ORDER_IN_ASYNC_ALACARTE,
FLAG_2002_ANY_ALACARTE_BESIDES_EXCLUDED_NEW_INSTANTIATION_UI,
FLAG_2002_VFM_UPGRADE_ADDITIONAL_OPTIONS,
+ FLAG_2002_IDENTIFY_INVARIANT_MACRO_UUID_BY_BACKEND,
;
public boolean isActive() {
diff --git a/vid-automation/src/main/java/vid/automation/test/test/BrowseASDCTest.java b/vid-automation/src/main/java/vid/automation/test/test/BrowseASDCTest.java
index 0671815bd..a9378e6df 100644
--- a/vid-automation/src/main/java/vid/automation/test/test/BrowseASDCTest.java
+++ b/vid-automation/src/main/java/vid/automation/test/test/BrowseASDCTest.java
@@ -5,6 +5,7 @@ import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
import static vid.automation.test.infra.Features.FLAG_1908_COLLECTION_RESOURCE_NEW_INSTANTIATION_UI;
import static vid.automation.test.infra.Features.FLAG_2002_ANY_ALACARTE_BESIDES_EXCLUDED_NEW_INSTANTIATION_UI;
+import static vid.automation.test.infra.Features.FLAG_2002_IDENTIFY_INVARIANT_MACRO_UUID_BY_BACKEND;
import static vid.automation.test.infra.Features.FLAG_5G_IN_NEW_INSTANTIATION_UI;
import static vid.automation.test.infra.Features.FLAG_NETWORK_TO_ASYNC_INSTANTIATION;
import static vid.automation.test.infra.Features.FLAG_SHOW_ORCHESTRATION_TYPE;
@@ -29,7 +30,7 @@ import org.onap.simulator.presetGenerator.presets.ecompportal_att.PresetGetSessi
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.testng.Assert;
-import org.testng.TimeBombSkipException;
+import org.testng.SkipException;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.DataProvider;
@@ -181,9 +182,9 @@ public class BrowseASDCTest extends CreateInstanceDialogBaseTest {
@Test
private void browseServiceModel_deployServiceMacroByMACRO_SERVICESConfig_creationPopupIsOldMacro() {
- if (FLAG_2002_ANY_ALACARTE_BESIDES_EXCLUDED_NEW_INSTANTIATION_UI.isActive() ) {
- throw new TimeBombSkipException("skipping identify macro by uuid for awhile", "2019/11/25");
- //also need to handle the simulator preset by using good ModelInfo instance
+ if (FLAG_2002_ANY_ALACARTE_BESIDES_EXCLUDED_NEW_INSTANTIATION_UI.isActive() &&
+ ! FLAG_2002_IDENTIFY_INVARIANT_MACRO_UUID_BY_BACKEND.isActive()) {
+ throw new SkipException("some 2002 flags shall come along together");
}
deployServiceAndAssertInstantiationType(
"csar15782222_invariantUUIDMacro.zip",
diff --git a/vid-automation/src/main/resources/registration_to_simulator/sanity/get_csar_zip_file.json b/vid-automation/src/main/resources/registration_to_simulator/sanity/get_csar_zip_file.json
deleted file mode 100644
index 7b39f77e6..000000000
--- a/vid-automation/src/main/resources/registration_to_simulator/sanity/get_csar_zip_file.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "simulatorRequest": {
- "method": "GET",
- "path": "/vidSimulator/getSomeFile"
-} ,
- "simulatorResponse": {
- "responseCode": 200,
- "file": "csar15782222_invariantUUIDMacro.zip"
- }
-} \ No newline at end of file
diff --git a/vid-automation/src/test/java/org/onap/vid/api/SdcApiTest.java b/vid-automation/src/test/java/org/onap/vid/api/SdcApiTest.java
index 918c4131e..8549613f8 100644
--- a/vid-automation/src/test/java/org/onap/vid/api/SdcApiTest.java
+++ b/vid-automation/src/test/java/org/onap/vid/api/SdcApiTest.java
@@ -21,6 +21,7 @@
package org.onap.vid.api;
import static net.javacrumbs.jsonunit.JsonMatchers.jsonEquals;
+import static net.javacrumbs.jsonunit.JsonMatchers.jsonPartEquals;
import static net.javacrumbs.jsonunit.JsonMatchers.jsonStringEquals;
import static net.javacrumbs.jsonunit.core.Option.IGNORING_ARRAY_ORDER;
import static org.hamcrest.CoreMatchers.equalTo;
@@ -130,9 +131,16 @@ public class SdcApiTest extends BaseApiTest {
ResponseEntity<String> response = restTemplate.getForEntity(buildUri(SDC_GET_SERVICE_MODEL + MACRO_INSTANTIATION_TYPE_UUID), String.class);
assertEquals(response.getStatusCode(), HttpStatus.OK);
String emptyInstantiationTypeExpectedResponse = loadResourceAsString(EMPTY_INSTANTIATION_TYPE_EXPECTED_RESPONSE);
- assertThat(response.getBody(), jsonEquals(emptyInstantiationTypeExpectedResponse)
+
+ final String body = response.getBody();
+
+ assertThat(body, jsonEquals(emptyInstantiationTypeExpectedResponse)
.when(IGNORING_ARRAY_ORDER)
- .whenIgnoringPaths("service.vidNotions.instantiationUI"));
+ .whenIgnoringPaths("service.vidNotions.instantiationUI", "service.vidNotions.instantiationType"));
+
+ assertThat(body, jsonPartEquals("service.vidNotions.instantiationType",
+ Features.FLAG_2002_IDENTIFY_INVARIANT_MACRO_UUID_BY_BACKEND.isActive()
+ ? "ALaCarte" : "ClientConfig"));
}
@Test
@@ -154,7 +162,7 @@ public class SdcApiTest extends BaseApiTest {
String minMaxInitialExpectedResponse = loadResourceAsString("sdcApiTest/minMaxInitialExpectedResponse.json");
assertThat(response.getBody(), jsonEquals(minMaxInitialExpectedResponse)
.when(IGNORING_ARRAY_ORDER)
- .whenIgnoringPaths("service.vidNotions.instantiationUI"));
+ .whenIgnoringPaths("service.vidNotions.instantiationUI", "service.vidNotions.instantiationType"));
}
@Test
diff --git a/vid-ext-services-simulator/src/main/resources/download_files/csar15782222_invariantUUIDMacro.zip b/vid-ext-services-simulator/src/main/resources/download_files/csar15782222_invariantUUIDMacro.zip
index c76b42601..fe9a7dd83 100644
--- a/vid-ext-services-simulator/src/main/resources/download_files/csar15782222_invariantUUIDMacro.zip
+++ b/vid-ext-services-simulator/src/main/resources/download_files/csar15782222_invariantUUIDMacro.zip
Binary files differ