aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpriyanshu <pagarwal@amdocs.com>2017-12-06 21:29:41 +0200
committerMichael Lando <ml636r@att.com>2018-01-03 16:10:43 +0000
commitdba9f5edd78a8c7aafc9742ba15d271deca4d944 (patch)
treed37f34d6e9b1c25f30b6707b428f2caba97c4ee9
parentfb2c889566a00ab3311b8c5bf9958f332db4385d (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>
-rw-r--r--pom.xml6
-rw-r--r--src/main/java/org/openecomp/sdc/toscaparser/api/elements/EntityType.java46
-rw-r--r--src/main/java/org/openecomp/sdc/toscaparser/api/extensions/ExtTools.java156
-rw-r--r--src/main/resources/extensions/TOSCA_simple_yaml_definition_1_0_0/TOSCA_simple_yaml_definition_1_0_0.py19
-rw-r--r--src/main/resources/extensions/TOSCA_simple_yaml_definition_1_0_0/TOSCA_simple_yaml_definition_1_0_0.yaml240
-rw-r--r--src/test/java/org/openecomp/sdc/toscaparser/api/elements/EntityTypeTest.java56
6 files changed, 415 insertions, 108 deletions
diff --git a/pom.xml b/pom.xml
index 442686a..6246e2f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -75,6 +75,12 @@
<artifactId>commons-io</artifactId>
<version>1.3.2</version>
</dependency>
+
+ <dependency>
+ <groupId>org.reflections</groupId>
+ <artifactId>reflections</artifactId>
+ <version>0.9.11</version>
+ </dependency>
</dependencies>
diff --git a/src/main/java/org/openecomp/sdc/toscaparser/api/elements/EntityType.java b/src/main/java/org/openecomp/sdc/toscaparser/api/elements/EntityType.java
index 70f7ae7..50ef715 100644
--- a/src/main/java/org/openecomp/sdc/toscaparser/api/elements/EntityType.java
+++ b/src/main/java/org/openecomp/sdc/toscaparser/api/elements/EntityType.java
@@ -1,15 +1,15 @@
package org.openecomp.sdc.toscaparser.api.elements;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
+import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.Map;
+import org.openecomp.sdc.toscaparser.api.common.JToscaValidationIssue;
import org.openecomp.sdc.toscaparser.api.extensions.ExtTools;
import org.openecomp.sdc.toscaparser.api.utils.CopyUtils;
+import org.openecomp.sdc.toscaparser.api.utils.ThreadLocalsHolder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.yaml.snakeyaml.Yaml;
@@ -238,30 +238,30 @@ public class EntityType {
public static void updateDefinitions(String version) {
ExtTools exttools = new ExtTools();
String extensionDefsFile = exttools.getDefsFile(version);
-
- InputStream input = null;
- try {
- input = new FileInputStream(new File(extensionDefsFile));
- }
- catch (FileNotFoundException e) {
- log.error("EntityType - updateDefinitions - Failed to open extension defs file ", extensionDefsFile);
- return;
- }
- Yaml yaml = new Yaml();
- LinkedHashMap<String,Object> nfvDefFile = (LinkedHashMap<String,Object>)yaml.load(input);
- LinkedHashMap<String,Object> nfvDef = new LinkedHashMap<>();
- for(String section: TOSCA_DEF_SECTIONS) {
- if(nfvDefFile.get(section) != null) {
- LinkedHashMap<String,Object> value =
- (LinkedHashMap<String,Object>)nfvDefFile.get(section);
- for(String key: value.keySet()) {
- nfvDef.put(key, value.get(key));
+
+ try (InputStream input = EntityType.class.getClassLoader().getResourceAsStream(extensionDefsFile);){
+ Yaml yaml = new Yaml();
+ LinkedHashMap<String,Object> nfvDefFile = (LinkedHashMap<String,Object>)yaml.load(input);
+ LinkedHashMap<String,Object> nfvDef = new LinkedHashMap<>();
+ for(String section: TOSCA_DEF_SECTIONS) {
+ if(nfvDefFile.get(section) != null) {
+ LinkedHashMap<String,Object> value =
+ (LinkedHashMap<String,Object>)nfvDefFile.get(section);
+ for(String key: value.keySet()) {
+ nfvDef.put(key, value.get(key));
+ }
}
}
+ TOSCA_DEF.putAll(nfvDef);
+ }
+ catch (IOException e) {
+ log.error("EntityType - updateDefinitions - Failed to update definitions from defs file {}",extensionDefsFile);
+ log.error("Exception:", e);
+ ThreadLocalsHolder.getCollector().appendValidationIssue(new JToscaValidationIssue("JE280",
+ String.format("Failed to update definitions from defs file \"%s\" ",extensionDefsFile)));
+ return;
}
- TOSCA_DEF.putAll(nfvDef);
}
-
}
/*python
diff --git a/src/main/java/org/openecomp/sdc/toscaparser/api/extensions/ExtTools.java b/src/main/java/org/openecomp/sdc/toscaparser/api/extensions/ExtTools.java
index 90aa35c..f0e0afa 100644
--- a/src/main/java/org/openecomp/sdc/toscaparser/api/extensions/ExtTools.java
+++ b/src/main/java/org/openecomp/sdc/toscaparser/api/extensions/ExtTools.java
@@ -1,16 +1,19 @@
package org.openecomp.sdc.toscaparser.api.extensions;
+import org.openecomp.sdc.toscaparser.api.common.JToscaValidationIssue;
+import org.openecomp.sdc.toscaparser.api.utils.ThreadLocalsHolder;
+import org.reflections.Reflections;
+import org.reflections.scanners.ResourcesScanner;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileInputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.LinkedHashMap;
+import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -24,89 +27,72 @@ public class ExtTools {
EXTENSION_INFO = _loadExtensions();
}
-
- private LinkedHashMap<String,Object> _loadExtensions() {
-
- LinkedHashMap<String,Object> extensions = new LinkedHashMap<>();
-
- String path = ExtTools.class.getProtectionDomain().getCodeSource().getLocation().getPath();
- //String extdir = path + File.separator + "resources/extensions";
-
- String extdir = ExtTools.class.getClassLoader().getResource("extensions").getFile();
-
- // for all folders in extdir
- File extDir = new File(extdir);
- File extDirList[] = extDir.listFiles();
- if (extDirList != null) {
- for(File f: extDirList) {
- if(f.isDirectory()) {
- // for all .py files in folder
- File extFileList[] = f.listFiles();
- for(File pyf: extFileList) {
- String pyfName = pyf.getName();
- String pyfPath = pyf.getAbsolutePath();
- if(pyfName.endsWith(".py")) {
- // get VERSION,SECTIONS,DEF_FILE
- try {
- String version = null;
- ArrayList<String> sections = null;
- String defsFile = null;
- String line;
- InputStream fis = new FileInputStream(pyfPath);
- InputStreamReader isr = new InputStreamReader(fis, Charset.forName("UTF-8"));
- BufferedReader br = new BufferedReader(isr);
- Pattern pattern = Pattern.compile("^([^#]\\S+)\\s*=\\s*(\\S.*)$");
- while((line = br.readLine()) != null) {
- line = line.replace("'","\"");
- Matcher matcher = pattern.matcher(line.toString());
- if(matcher.find()) {
- if(matcher.group(1).equals("VERSION")) {
- version = matcher.group(2);
- if(version.startsWith("'") || version.startsWith("\"")) {
- version = version.substring(1,version.length()-1);
- }
- }
- else if(matcher.group(1).equals("DEFS_FILE")) {
- String fn = matcher.group(2);
- if(fn.startsWith("'") || fn.startsWith("\"")) {
- fn = fn.substring(1,fn.length()-1);
- }
- defsFile = pyf.getParent() + File.separator + fn;//matcher.group(2);
- }
- else if(matcher.group(1).equals("SECTIONS")) {
- sections = new ArrayList<>();
- Pattern secpat = Pattern.compile("\"([^\"]+)\"");
- Matcher secmat = secpat.matcher(matcher.group(2));
- while(secmat.find()) {
- sections.add(secmat.group(1));
- }
- }
- }
- }
- br.close();
-
- if(version != null && defsFile != null) {
- LinkedHashMap<String,Object> ext = new LinkedHashMap<>();
- ext.put("defs_file", defsFile);
- if(sections != null) {
- ext.put("sections", sections);
- }
- extensions.put(version, ext);
- }
- else {
- // error
- }
- }
- catch(Exception e) {
- log.error("ExtTools - _loadExtensions - {}", e.getMessage());
- // ...
- }
- }
- }
- }
- }
- }
- return extensions;
+
+ private LinkedHashMap<String,Object> _loadExtensions() {
+
+ LinkedHashMap<String, Object> extensions = new LinkedHashMap<>();
+
+ Reflections reflections = new Reflections("extensions", new ResourcesScanner());
+ Set<String> resourcePaths = reflections.getResources(Pattern.compile(".*\\.py$"));
+
+ for(String resourcePath : resourcePaths) {
+ try (InputStream is = ExtTools.class.getClassLoader().getResourceAsStream(resourcePath);
+ InputStreamReader isr = new InputStreamReader(is, Charset.forName("UTF-8"));
+ BufferedReader br = new BufferedReader(isr);){
+ String version = null;
+ ArrayList<String> sections = null;
+ String defsFile = null;
+ String line;
+
+ Pattern pattern = Pattern.compile("^([^#]\\S+)\\s*=\\s*(\\S.*)$");
+ while ((line = br.readLine()) != null) {
+ line = line.replace("'", "\"");
+ Matcher matcher = pattern.matcher(line.toString());
+ if (matcher.find()) {
+ if (matcher.group(1).equals("VERSION")) {
+ version = matcher.group(2);
+ if (version.startsWith("'") || version.startsWith("\"")) {
+ version = version.substring(1, version.length() - 1);
+ }
+ }
+ else if (matcher.group(1).equals("DEFS_FILE")) {
+ String fn = matcher.group(2);
+ if (fn.startsWith("'") || fn.startsWith("\"")) {
+ fn = fn.substring(1, fn.length() - 1);
+ }
+ defsFile = resourcePath.replaceFirst("\\w*.py$", fn);
+ }
+ else if (matcher.group(1).equals("SECTIONS")) {
+ sections = new ArrayList<>();
+ Pattern secpat = Pattern.compile("\"([^\"]+)\"");
+ Matcher secmat = secpat.matcher(matcher.group(2));
+ while (secmat.find()) {
+ sections.add(secmat.group(1));
+ }
+ }
+ }
+ }
+
+ if (version != null && defsFile != null) {
+ LinkedHashMap<String, Object> ext = new LinkedHashMap<>();
+ ext.put("defs_file", defsFile);
+ if (sections != null) {
+ ext.put("sections", sections);
+ }
+ extensions.put(version, ext);
+ }
+ else {
+ // error
+ }
+ }
+ catch (Exception e) {
+ log.error("ExtTools - _loadExtensions - {}", e);
+ ThreadLocalsHolder.getCollector().appendValidationIssue(new JToscaValidationIssue
+ ("JE281", "Failed to load extensions" + e.getMessage()));
+ // ...
+ }
+ }
+ return extensions;
}
public ArrayList<String> getVersions() {
diff --git a/src/main/resources/extensions/TOSCA_simple_yaml_definition_1_0_0/TOSCA_simple_yaml_definition_1_0_0.py b/src/main/resources/extensions/TOSCA_simple_yaml_definition_1_0_0/TOSCA_simple_yaml_definition_1_0_0.py
new file mode 100644
index 0000000..a5bda4a
--- /dev/null
+++ b/src/main/resources/extensions/TOSCA_simple_yaml_definition_1_0_0/TOSCA_simple_yaml_definition_1_0_0.py
@@ -0,0 +1,19 @@
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+# VERSION and DEFS_FILE are required for all extensions
+
+VERSION = 'tosca_simple_yaml_1_0_0'
+
+DEFS_FILE = "TOSCA_simple_yaml_definition_1_0_0.yaml"
+
+SECTIONS = ('metadata')
diff --git a/src/main/resources/extensions/TOSCA_simple_yaml_definition_1_0_0/TOSCA_simple_yaml_definition_1_0_0.yaml b/src/main/resources/extensions/TOSCA_simple_yaml_definition_1_0_0/TOSCA_simple_yaml_definition_1_0_0.yaml
new file mode 100644
index 0000000..c645e27
--- /dev/null
+++ b/src/main/resources/extensions/TOSCA_simple_yaml_definition_1_0_0/TOSCA_simple_yaml_definition_1_0_0.yaml
@@ -0,0 +1,240 @@
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+##########################################################################
+# The content of this file reflects TOSCA NFV Profile in YAML version
+# 1.0.0. It describes the definition for TOSCA NFV types including Node Type,
+# Relationship Type, CapabilityAssignment Type and Interfaces.
+##########################################################################
+tosca_definitions_version: tosca_simple_yaml_1_0_0
+
+##########################################################################
+# Node Type.
+# A Node Type is a reusable entity that defines the type of one or more
+# Node Templates.
+##########################################################################
+node_types:
+ tosca.nodes.nfv.VNF:
+ derived_from: tosca.nodes.Root # Or should this be its own top - level type?
+ 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
+
+ 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 ]
+
+ 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
+
+ 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
+
+ tosca.nodes.nfv.VL.ELine:
+ derived_from: tosca.nodes.nfv.VL
+ capabilities:
+ virtual_linkable:
+ occurrences: 2
+
+ tosca.nodes.nfv.VL.ELAN:
+ derived_from: tosca.nodes.nfv.VL
+
+ tosca.nodes.nfv.VL.ETree:
+ derived_from: tosca.nodes.nfv.VL
+
+ 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
+
+##########################################################################
+# Relationship Type.
+# A Relationship Type is a reusable entity that defines the type of one
+# or more relationships between Node Types or Node Templates.
+##########################################################################
+
+relationship_types:
+ tosca.relationships.nfv.VirtualLinksTo:
+ derived_from: tosca.relationships.network.LinksTo
+ valid_target_types: [ tosca.capabilities.nfv.VirtualLinkable ]
+
+ tosca.relationships.nfv.VirtualBindsTo:
+ derived_from: tosca.relationships.network.BindsTo
+ valid_target_types: [ tosca.capabilities.nfv.VirtualBindable ]
+
+ tosca.relationships.nfv.HA:
+ derived_from: tosca.relationships.Root
+ valid_target_types: [ tosca.capabilities.nfv.HA ]
+
+ tosca.relationships.nfv.Monitor:
+ derived_from: tosca.relationships.ConnectsTo
+ valid_target_types: [ tosca.capabilities.nfv.Metric ]
+
+ tosca.relationships.nfv.ForwardsTo:
+ derived_from: tosca.relationships.root
+ valid_target_types: [ tosca.capabilities.nfv.Forwarder]
+
+##########################################################################
+# CapabilityAssignment Type.
+# A CapabilityAssignment Type is a reusable entity that describes a kind of
+# capability that a Node Type can declare to expose.
+##########################################################################
+
+capability_types:
+ tosca.capabilities.nfv.VirtualLinkable:
+ derived_from: tosca.capabilities.network.Linkable
+
+ tosca.capabilities.nfv.VirtualBindable:
+ derived_from: tosca.capabilities.network.Bindable
+
+ tosca.capabilities.nfv.HA:
+ derived_from: tosca.capabilities.Root
+ valid_source_types: [ tosca.nodes.nfv.VDU ]
+
+ tosca.capabilities.nfv.HA.ActiveActive:
+ derived_from: tosca.capabilities.nfv.HA
+
+ tosca.capabilities.nfv.HA.ActivePassive:
+ derived_from: tosca.capabilities.nfv.HA
+
+ tosca.capabilities.nfv.Metric:
+ derived_from: tosca.capabilities.Root
+
+ tosca.capabilities.nfv.Forwarder:
+ derived_from: tosca.capabilities.Root
+
+##########################################################################
+ # Interfaces Type.
+ # The Interfaces element describes a list of one or more interface
+ # definitions for a modelable entity (e.g., a Node or Relationship Type)
+ # as defined within the TOSCA Simple Profile specification.
+##########################################################################
+
+##########################################################################
+ # Data Type.
+ # A Datatype is a complex data type declaration which contains other
+ # complex or simple data types.
+##########################################################################
+
+##########################################################################
+ # Artifact Type.
+ # An Artifact Type is a reusable entity that defines the type of one or more
+ # files which Node Types or Node Templates can have dependent relationships
+ # and used during operations such as during installation or deployment.
+##########################################################################
+
+##########################################################################
+ # Policy Type.
+ # TOSCA Policy Types represent logical grouping of TOSCA nodes that have
+ # an implied relationship and need to be orchestrated or managed together
+ # to achieve some result.
+##########################################################################
+
+##########################################################################
+ # Group Type
+ #
+##########################################################################
+group_types:
+ 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
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