diff options
author | Berezin, Chaya <cb478c@intl.att.com> | 2018-01-25 17:36:54 +0200 |
---|---|---|
committer | Michael Lando <ml636r@att.com> | 2018-02-08 14:41:03 +0000 |
commit | 8a2ddc31c576e4a8a39e01bfe1e0fe7631e6cdf2 (patch) | |
tree | 0952da288e13d310d6b36cf70d7d5609ae51eaef /src/test | |
parent | 8f26703ebe460602d150faaba7759031c6088a5a (diff) |
Support CR type
Issue-ID: SDC-965
Change-Id: Id87923f86ed402f7669a29f612aa3b1a9eb60832
Signed-off-by: Berezin, Chaya <cb478c@intl.att.com>
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/java/org/openecomp/sdc/impl/SdcToscaParserBasicTest.java | 2 | ||||
-rw-r--r-- | src/test/java/org/openecomp/sdc/impl/ToscaParserMetadataTest.java | 11 | ||||
-rw-r--r-- | src/test/java/org/openecomp/sdc/impl/ToscaParserNodeTemplateTest.java | 33 | ||||
-rw-r--r-- | src/test/resources/csars/service-CrTestService-csar.csar | bin | 0 -> 32794 bytes |
4 files changed, 46 insertions, 0 deletions
diff --git a/src/test/java/org/openecomp/sdc/impl/SdcToscaParserBasicTest.java b/src/test/java/org/openecomp/sdc/impl/SdcToscaParserBasicTest.java index 74e52db..1695671 100644 --- a/src/test/java/org/openecomp/sdc/impl/SdcToscaParserBasicTest.java +++ b/src/test/java/org/openecomp/sdc/impl/SdcToscaParserBasicTest.java @@ -35,6 +35,7 @@ public abstract class SdcToscaParserBasicTest { static ISdcCsarHelper resolveGetInputCsarQA; static ISdcCsarHelper resolveReqsCapsCsarQA; static ISdcCsarHelper portMirroring; + static ISdcCsarHelper csarHelperServiceWithCrs; static Map<String, HashMap<String, List<String>>> fdntCsarHelper_Data; @@ -57,6 +58,7 @@ public abstract class SdcToscaParserBasicTest { QAServiceForToscaParserTests = getCsarHelper("csars/service-ServiceForToscaParserTests-csar.csar"); resolveReqsCapsCsarQA = getCsarHelper("csars/service-sunny-flow2.csar"); portMirroring = getCsarHelper("csars/service-PortMirroring.csar"); + csarHelperServiceWithCrs = getCsarHelper("csars/service-CrTestService-csar.csar"); fdntCsarHelper_Data = new HashMap<String, HashMap<String, List<String>>>(){ { diff --git a/src/test/java/org/openecomp/sdc/impl/ToscaParserMetadataTest.java b/src/test/java/org/openecomp/sdc/impl/ToscaParserMetadataTest.java index 4e5c9bc..8af3db0 100644 --- a/src/test/java/org/openecomp/sdc/impl/ToscaParserMetadataTest.java +++ b/src/test/java/org/openecomp/sdc/impl/ToscaParserMetadataTest.java @@ -59,6 +59,17 @@ public class ToscaParserMetadataTest extends SdcToscaParserBasicTest { } //endregion + @Test + public void GetServiceNodeTemplateMetadataTypeCR() { + NodeTemplate nodeTemplate = csarHelperServiceWithCrs.getServiceNodeTemplateByNodeName("chaya best cr 0"); + Metadata nodeTemplateMetadata = csarHelperServiceWithCrs.getNodeTemplateMetadata(nodeTemplate); + assertNotNull(nodeTemplateMetadata); + assertEquals(nodeTemplateMetadata.getValue("resourceVendorModelNumber"), ""); + assertEquals(nodeTemplateMetadata.getValue("type"), "CR"); + assertEquals(nodeTemplateMetadata.getValue("name"), "chaya best cr"); + assertEquals(nodeTemplateMetadata.getValue("version"), "0.1"); + } + //region getConformanceLevel @Test public void testSunnyGetConformanceLevel() { diff --git a/src/test/java/org/openecomp/sdc/impl/ToscaParserNodeTemplateTest.java b/src/test/java/org/openecomp/sdc/impl/ToscaParserNodeTemplateTest.java index 7cb99e3..04675b4 100644 --- a/src/test/java/org/openecomp/sdc/impl/ToscaParserNodeTemplateTest.java +++ b/src/test/java/org/openecomp/sdc/impl/ToscaParserNodeTemplateTest.java @@ -6,6 +6,8 @@ import static org.testng.Assert.assertNull; import static org.testng.Assert.assertTrue; import java.util.*; import static org.hamcrest.CoreMatchers.is; + +import com.google.common.collect.ImmutableMap; import org.apache.commons.lang3.tuple.Pair; import org.openecomp.sdc.tosca.parser.exceptions.SdcToscaParserException; import org.openecomp.sdc.tosca.parser.impl.FilterType; @@ -934,6 +936,37 @@ public class ToscaParserNodeTemplateTest extends SdcToscaParserBasicTest { propertyAsObject = resolveGetInputCsarQA.getNodeTemplatePropertyAsObject(vfcs.get(0), "port_pd01_port_ip_requirements"); assertEquals( ((ArrayList)propertyAsObject).get(1), null); } + + @Test + public void testServiceNodeTemplateByCRType() { + List<NodeTemplate> serviceCRList = csarHelperServiceWithCrs.getServiceNodeTemplateBySdcType(SdcTypes.CR); + assertNotNull(serviceCRList); + assertEquals(serviceCRList.size(), 2); + assertEquals(serviceCRList.get(0).getName(), "chaya best cr 1"); + assertEquals(serviceCRList.get(0).getType(), "org.openecomp.resource.cr.ChayaBestCr"); + assertEquals(serviceCRList.get(1).getName(), "chaya best cr 0"); + assertEquals(serviceCRList.get(1).getType(), "org.openecomp.resource.cr.ChayaBestCr"); + } + + @Test + public void testGetCPOfCRNodeTemplate() { + NodeTemplate nodeTemplate = csarHelperServiceWithCrs.getServiceNodeTemplateByNodeName("chaya best cr 0"); + List<NodeTemplate> crCpChildren = csarHelperServiceWithCrs.getNodeTemplateBySdcType(nodeTemplate, SdcTypes.CP); + assertEquals(crCpChildren.get(0).getName(), "ContrailPort 0"); + assertEquals(crCpChildren.get(0).getMetaData().getValue("type"), SdcTypes.CP.name()); + } + + @Test + public void testServiceCRInstanceProps() { + List<NodeTemplate> serviceCrList = csarHelperServiceWithCrs.getServiceNodeTemplateBySdcType(SdcTypes.CR); + assertNotNull(serviceCrList); + NodeTemplate crTemplate = serviceCrList.get(0); + assertNotNull(crTemplate); + assertEquals(crTemplate.getPropertyValue("nf_naming").toString(), ImmutableMap.of("ecomp_generated_naming", "true").toString()); + assertEquals(crTemplate.getPropertyValue("contrailport0_virtual_network"), "chaya"); + } + + } diff --git a/src/test/resources/csars/service-CrTestService-csar.csar b/src/test/resources/csars/service-CrTestService-csar.csar Binary files differnew file mode 100644 index 0000000..445fd2b --- /dev/null +++ b/src/test/resources/csars/service-CrTestService-csar.csar |