diff options
author | priyanshu <pagarwal@amdocs.com> | 2017-12-06 21:29:41 +0200 |
---|---|---|
committer | Michael Lando <ml636r@att.com> | 2018-01-03 16:10:43 +0000 |
commit | dba9f5edd78a8c7aafc9742ba15d271deca4d944 (patch) | |
tree | d37f34d6e9b1c25f30b6707b428f2caba97c4ee9 /src/test | |
parent | fb2c889566a00ab3311b8c5bf9958f332db4385d (diff) |
Extension loading is not working.
Updated files in JTosca Library.
Change-Id: I3323e34238228451bd1d396271fc89fdf28b3fd9
Issue-ID: SDC-565
Signed-off-by: priyanshu <pagarwal@amdocs.com>
Signed-off-by: Yuli Shlosberg <ys9693@att.com>
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/java/org/openecomp/sdc/toscaparser/api/elements/EntityTypeTest.java | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/src/test/java/org/openecomp/sdc/toscaparser/api/elements/EntityTypeTest.java b/src/test/java/org/openecomp/sdc/toscaparser/api/elements/EntityTypeTest.java new file mode 100644 index 0000000..8e74e99 --- /dev/null +++ b/src/test/java/org/openecomp/sdc/toscaparser/api/elements/EntityTypeTest.java @@ -0,0 +1,56 @@ +package org.openecomp.sdc.toscaparser.api.elements; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; + +import static org.junit.Assert.assertEquals; + +public class EntityTypeTest { + + private static final Map<String, Object> origMap = EntityType.TOSCA_DEF; + + @Test + public void testUpdateDefinitions() throws Exception { + + Map<String, Object> testData = new HashMap<>(); + testData.put("tosca.nodes.nfv.VNF", "{derived_from=tosca.nodes.Root, properties={id={type=string, description=ID of this VNF}, vendor={type=string, description=name of the vendor who generate this VNF}, version={type=version, description=version of the software for this VNF}}, requirements=[{virtualLink={capability=tosca.capabilities.nfv.VirtualLinkable, relationship=tosca.relationships.nfv.VirtualLinksTo, node=tosca.nodes.nfv.VL}}]}"); + testData.put("tosca.nodes.nfv.VDU", "{derived_from=tosca.nodes.Compute, capabilities={high_availability={type=tosca.capabilities.nfv.HA}, virtualbinding={type=tosca.capabilities.nfv.VirtualBindable}, monitoring_parameter={type=tosca.capabilities.nfv.Metric}}, requirements=[{high_availability={capability=tosca.capabilities.nfv.HA, relationship=tosca.relationships.nfv.HA, node=tosca.nodes.nfv.VDU, occurrences=[0, 1]}}]}"); + testData.put("tosca.nodes.nfv.CP", "{derived_from=tosca.nodes.network.Port, properties={type={type=string, required=false}}, requirements=[{virtualLink={capability=tosca.capabilities.nfv.VirtualLinkable, relationship=tosca.relationships.nfv.VirtualLinksTo, node=tosca.nodes.nfv.VL}}, {virtualBinding={capability=tosca.capabilities.nfv.VirtualBindable, relationship=tosca.relationships.nfv.VirtualBindsTo, node=tosca.nodes.nfv.VDU}}], attributes={address={type=string}}}"); + testData.put("tosca.nodes.nfv.VL", "{derived_from=tosca.nodes.network.Network, properties={vendor={type=string, required=true, description=name of the vendor who generate this VL}}, capabilities={virtual_linkable={type=tosca.capabilities.nfv.VirtualLinkable}}}"); + testData.put("tosca.nodes.nfv.VL.ELine", "{derived_from=tosca.nodes.nfv.VL, capabilities={virtual_linkable={occurrences=2}}}"); + testData.put("tosca.nodes.nfv.VL.ELAN", "{derived_from=tosca.nodes.nfv.VL}"); + testData.put("tosca.nodes.nfv.VL.ETree", "{derived_from=tosca.nodes.nfv.VL}"); + testData.put("tosca.nodes.nfv.FP", "{derived_from=tosca.nodes.Root, properties={policy={type=string, required=false, description=name of the vendor who generate this VL}}, requirements=[{forwarder={capability=tosca.capabilities.nfv.Forwarder, relationship=tosca.relationships.nfv.ForwardsTo}}]}"); + testData.put("tosca.groups.nfv.VNFFG", "{derived_from=tosca.groups.Root, properties={vendor={type=string, required=true, description=name of the vendor who generate this VNFFG}, version={type=string, required=true, description=version of this VNFFG}, number_of_endpoints={type=integer, required=true, description=count of the external endpoints included in this VNFFG}, dependent_virtual_link={type=list, entry_schema={type=string}, required=true, description=Reference to a VLD used in this Forwarding Graph}, connection_point={type=list, entry_schema={type=string}, required=true, description=Reference to Connection Points forming the VNFFG}, constituent_vnfs={type=list, entry_schema={type=string}, required=true, description=Reference to a list of VNFD used in this VNF Forwarding Graph}}}"); + testData.put("tosca.relationships.nfv.VirtualLinksTo", "{derived_from=tosca.relationships.network.LinksTo, valid_target_types=[tosca.capabilities.nfv.VirtualLinkable]}"); + testData.put("tosca.relationships.nfv.VirtualBindsTo", "{derived_from=tosca.relationships.network.BindsTo, valid_target_types=[tosca.capabilities.nfv.VirtualBindable]}"); + testData.put("tosca.relationships.nfv.HA", "{derived_from=tosca.relationships.Root, valid_target_types=[tosca.capabilities.nfv.HA]}"); + testData.put("tosca.relationships.nfv.Monitor", "{derived_from=tosca.relationships.ConnectsTo, valid_target_types=[tosca.capabilities.nfv.Metric]}"); + testData.put("tosca.relationships.nfv.ForwardsTo", "{derived_from=tosca.relationships.root, valid_target_types=[tosca.capabilities.nfv.Forwarder]}"); + testData.put("tosca.capabilities.nfv.VirtualLinkable", "{derived_from=tosca.capabilities.network.Linkable}"); + testData.put("tosca.capabilities.nfv.VirtualBindable", "{derived_from=tosca.capabilities.network.Bindable}"); + testData.put("tosca.capabilities.nfv.HA", "{derived_from=tosca.capabilities.Root, valid_source_types=[tosca.nodes.nfv.VDU]}"); + testData.put("tosca.capabilities.nfv.HA.ActiveActive", "{derived_from=tosca.capabilities.nfv.HA}"); + testData.put("tosca.capabilities.nfv.HA.ActivePassive", "{derived_from=tosca.capabilities.nfv.HA}"); + testData.put("tosca.capabilities.nfv.Metric", "{derived_from=tosca.capabilities.Root}"); + testData.put("tosca.capabilities.nfv.Forwarder", "{derived_from=tosca.capabilities.Root}"); + + Map<String, Object> expectedDefMap = origMap; + expectedDefMap.putAll(testData); + EntityType.updateDefinitions("tosca_simple_profile_for_nfv_1_0_0"); + + assertEquals(expectedDefMap, EntityType.TOSCA_DEF); + + } + + @After + public void tearDown() throws Exception { + EntityType.TOSCA_DEF = (LinkedHashMap<String, Object>) origMap; + } + +}
\ No newline at end of file |