aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmichai Hemli <amichai.hemli@intl.att.com>2019-11-10 11:53:15 +0000
committerGerrit Code Review <gerrit@onap.org>2019-11-10 11:53:15 +0000
commitc86c4353454d69f8f635451384a247aaa7f106e3 (patch)
tree310595dcc210c5785da1fe8ef6672bb2eee293f8
parent6129902bba87c1736aee9953b9dd99dbbf1336a5 (diff)
parentf460e950df7c5a411f1efa5437c4b8ed403a77c8 (diff)
Merge "VidNotion identify vlan tagging service"
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/asdc/parser/VidNotionsBuilder.java14
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/VidNotions.kt3
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/asdc/parser/VidNotionsBuilderTest.java10
3 files changed, 26 insertions, 1 deletions
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 042675899..5ed5f6a58 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
@@ -157,6 +157,9 @@ public class VidNotionsBuilder {
if (isPortMirroringService(serviceModel)) {
return ModelCategory.PORT_MIRRORING;
}
+ if (isVlanTaggingService(serviceModel)) {
+ return ModelCategory.VLAN_TAGGING;
+ }
if (isInfraStructureVpn(csarHelper)) {
return VidNotions.ModelCategory.INFRASTRUCTURE_VPN;
}
@@ -241,4 +244,15 @@ public class VidNotionsBuilder {
return (serviceModel.getService()!=null &&
StringUtils.equals(serviceModel.getService().getServiceType(), "portMirroring"));
}
+
+ private boolean isVlanTaggingService(ServiceModel serviceModel) {
+ if (serviceModel==null || serviceModel.getVnfs()==null) {
+ return false;
+ }
+
+ return serviceModel.getVnfs().values().stream().anyMatch(
+ vnf-> MapUtils.isNotEmpty(vnf.getVfcInstanceGroups())
+ );
+
+ }
}
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 66fe2ddba..205a79b50 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
@@ -59,7 +59,8 @@ class VidNotions(@get:JsonInclude(JsonInclude.Include.NON_NULL)
Transport,
SERVICE_WITH_COLLECTION_RESOURCE,
INFRASTRUCTURE_VPN,
- PORT_MIRRORING,
+ PORT_MIRRORING,
+ VLAN_TAGGING,
@JsonProperty("other")
OTHER
}
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 d6526d2f7..ec4bc2215 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
@@ -207,6 +207,16 @@ public class VidNotionsBuilderTest {
assertThat(vidNotionsBuilder.suggestModelCategory(csarHelper, serviceModel), is(ModelCategory.PORT_MIRRORING));
}
+ @Test()
+ public void withoutMocks_givenToscaOfVLanTagging_InstantiationUIIsLegacyAndCategoryIsVlanTagging() throws SdcToscaParserException, IOException {
+ initServiceModelAndscarHelperWithRealCsar("/csars/service-VdorotheaSrv-csar.zip");
+ when(featureManagerMock.isActive(Features.FLAG_2002_ANY_ALACARTE_BESIDES_EXCLUDED_NEW_INSTANTIATION_UI)).thenReturn(true);
+ assertThat(vidNotionsBuilder.suggestInstantiationUI(csarHelper, serviceModel), is(InstantiationUI.LEGACY));
+ assertThat(vidNotionsBuilder.suggestViewEditUI(csarHelper, serviceModel), is(InstantiationUI.LEGACY));
+ assertThat(vidNotionsBuilder.suggestModelCategory(csarHelper, serviceModel), is(ModelCategory.VLAN_TAGGING));
+ }
+
+
@Test
public void uuidIsExactly1ffce89fEtc_UIHintIsPositive() {
initServiceModelAndscarHelperWithMocks();