aboutsummaryrefslogtreecommitdiffstats
path: root/common/openecomp-tosca-datatype
diff options
context:
space:
mode:
authorAvi Ziv <avi.ziv@amdocs.com>2017-07-18 19:45:38 +0300
committerAvi Ziv <avi.ziv@amdocs.com>2017-07-18 19:45:38 +0300
commitb8e2faf476202b6ffe61bc3a9a37df1304881d40 (patch)
treef78b8c0517d8e16c5ae610bf8b49f68ea8a312a1 /common/openecomp-tosca-datatype
parent75aacbbe1acf78fa53378f07f0a8c7769449a17e (diff)
[SDC] Onboarding 1710 rebase.
Change-Id: If3b6b81d221fde13908f1e8160db6f7d9433c535 Signed-off-by: Avi Ziv <avi.ziv@amdocs.com>
Diffstat (limited to 'common/openecomp-tosca-datatype')
-rw-r--r--common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/services/ToscaExtensionYamlUtil.java69
-rw-r--r--common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/services/YamlUtil.java4
-rw-r--r--common/openecomp-tosca-datatype/src/main/resources/globalTypes/openecomp/data.yml107
-rw-r--r--common/openecomp-tosca-datatype/src/main/resources/globalTypes/openecomp/nodes.yml33
4 files changed, 199 insertions, 14 deletions
diff --git a/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/services/ToscaExtensionYamlUtil.java b/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/services/ToscaExtensionYamlUtil.java
new file mode 100644
index 0000000000..e6360461ef
--- /dev/null
+++ b/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/services/ToscaExtensionYamlUtil.java
@@ -0,0 +1,69 @@
+package org.openecomp.sdc.tosca.services;
+
+import org.yaml.snakeyaml.constructor.Constructor;
+import org.yaml.snakeyaml.introspector.Property;
+import org.yaml.snakeyaml.introspector.PropertyUtils;
+import org.yaml.snakeyaml.nodes.MappingNode;
+import org.yaml.snakeyaml.nodes.NodeId;
+
+import java.beans.IntrospectionException;
+
+
+public class ToscaExtensionYamlUtil extends YamlUtil {
+
+ @Override
+ public <T> Constructor getConstructor(Class<T> typClass) {
+ return new ToscaWithHeatExtensionConstructor(typClass);
+ }
+
+ @Override
+ protected PropertyUtils getPropertyUtils() {
+ return new ToscaPropertyUtilsWithHeatExtension();
+ }
+
+ public class ToscaPropertyUtilsWithHeatExtension extends MyPropertyUtils {
+ @Override
+ public Property getProperty(Class<? extends Object> type, String name)
+ throws IntrospectionException {
+ try {
+ if (type
+ .equals(Class.forName("org.openecomp.sdc.tosca.datatypes.model.ParameterDefinition"))) {
+ type = Class
+ .forName("org.openecomp.sdc.tosca.datatypes.model.heatextend.ParameterDefinitionExt");
+ }
+ } catch (ClassNotFoundException ex) {
+ throw new RuntimeException(ex);
+ }
+ return super.getProperty(type, name);
+ }
+ }
+
+ protected class ToscaWithHeatExtensionConstructor extends StrictMapAppenderConstructor {
+ public ToscaWithHeatExtensionConstructor(Class<?> theRoot) {
+ super(theRoot);
+ yamlClassConstructors.put(NodeId.mapping, new MyPersistentObjectConstruct());
+ }
+
+ class MyPersistentObjectConstruct extends Constructor.ConstructMapping {
+ @Override
+ protected Object constructJavaBean2ndStep(MappingNode node, Object object) {
+ Class type = node.getType();
+ try {
+ if (type.equals(
+ Class.forName("org.openecomp.sdc.tosca.datatypes.model.ParameterDefinition"))) {
+ Class extendHeatClass = Class.forName(
+ "org.openecomp.sdc.tosca.datatypes.model.heatextend.ParameterDefinitionExt");
+ Object extendHeatObject = extendHeatClass.newInstance();
+ // create JavaBean
+ return super.constructJavaBean2ndStep(node, extendHeatObject);
+ } else {
+ // create JavaBean
+ return super.constructJavaBean2ndStep(node, object);
+ }
+ } catch (ClassNotFoundException | InstantiationException | IllegalAccessException ex) {
+ throw new RuntimeException(ex);
+ }
+ }
+ }
+ }
+}
diff --git a/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/services/YamlUtil.java b/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/services/YamlUtil.java
index 7d0bcfeb83..755f02a4f8 100644
--- a/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/services/YamlUtil.java
+++ b/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/services/YamlUtil.java
@@ -48,6 +48,10 @@ public class YamlUtil {
return yamlObj;
}
+ public InputStream loadYamlFileIs(String yamlFullFileName) {
+ return YamlUtil.class.getResourceAsStream(yamlFullFileName);
+ }
+
/**
* Yaml to object t.
*
diff --git a/common/openecomp-tosca-datatype/src/main/resources/globalTypes/openecomp/data.yml b/common/openecomp-tosca-datatype/src/main/resources/globalTypes/openecomp/data.yml
index 53ea8a8656..c7ce3c13e0 100644
--- a/common/openecomp-tosca-datatype/src/main/resources/globalTypes/openecomp/data.yml
+++ b/common/openecomp-tosca-datatype/src/main/resources/globalTypes/openecomp/data.yml
@@ -123,7 +123,17 @@ data_types:
count:
description: number of assignments required
type: integer
- required: false
+ required: false
+
+ org.openecomp.resource.abstract.nodes.PNF:
+ derived_from: tosca.nodes.Root
+ properties:
+ nf_function:
+ type: string
+ nf_role:
+ type: string
+ nf_type:
+ type: string
org.openecomp.datatypes.network.IpRequirements:
@@ -133,23 +143,16 @@ data_types:
type: integer
required: true
constraints:
- - valid_values:
- - 4
- - 6
+ - valid_values:
+ - 4
+ - 6
ip_count:
description: identifies the number of ip address to assign to the CP from the plan
type: integer
required: false
- ip_count_required:
- description: identifies the number of ip address to assign to the CP from the plan
- type: org.openecomp.datatypes.AssignmentRequirements
- required: false
floating_ip_count:
type: integer
required: false
- floating_ip_count_required:
- type: org.openecomp.datatypes.AssignmentRequirements
- required: false
subnet_role:
type: string
required: false
@@ -157,9 +160,25 @@ data_types:
type: string
required: true
constraints:
- - valid_values:
- - fixed
- - dhcp
+ - valid_values:
+ - fixed
+ - dhcp
+ dhcp_enabled:
+ type: boolean
+ required: false
+ ip_count_required:
+ description: identifies the number of ip address to assign to the CP from the plan
+ type: org.openecomp.datatypes.AssignmentRequirements
+ required: false
+ floating_ip_count_required:
+ type: org.openecomp.datatypes.AssignmentRequirements
+ required: false
+ ip_address_plan_name:
+ type: string
+ required: false
+ vrf_name:
+ type: string
+ required: false
org.openecomp.datatypes.network.PhysicalNetwork:
derived_from: org.openecomp.datatypes.Root
@@ -475,4 +494,64 @@ data_types:
description: Reference to naming policy that OPENECOMP will use when the name is auto-generated
type: string
required: false
+
+ org.openecomp.datatypes.flavors.DeploymentFlavor:
+ properties:
+ sp_part_number:
+ type: string # under discussion; need confirmation
+ description: Part number of the feature group associated with the deployment flavor
+ vendor_info:
+ type: org.opencomp.datatypes.flavors.VendorInfo
+ description: Vendor information for the deployment flavor
+ compute_flavor:
+ type: org.opencomp.datatypes.flavors.ComputeFlavor
+ description: Compute information for the deployment flavor
+ license_flavor:
+ type: org.opencomp.datatypes.flavors.LicenseFlavor
+ description: License information for the deployment flavor
+ required: false
+
+ org.openecomp.datatypes.flavors.ComputeFlavor:
+ properties:
+ num_cpus:
+ type: integer
+ description: Number of CPUs for the VM
+ disk_size:
+ type: scalar-unit.size
+ description: Disk size of the VM
+ mem_size:
+ type: scalar-unit.size
+ description: Memory size of the VM
+
+ org.openecomp.datatypes.flavors.LicenseFlavor:
+ properties:
+ feature_group_uuid:
+ type: string
+ description: Feature Group Id
+
+ org.openecomp.datatypes.flavors.VendorInfo:
+ properties:
+ manufacturer_reference_number:
+ type: string
+ description: Manufacturer reference number
+ vendor_model:
+ type: string
+ description: Vendor License Model Id
+
+ org.openecomp.datatypes.ImageInfo:
+ properties:
+ software_version:
+ type: string
+ description: Image version
+ file_name:
+ type: string
+ description: Image file name
+ file_hash:
+ type: string
+ description: checksum/signature
+ file_hash_type:
+ type: string
+ description: Hash type
+ required: false
+ default: md5
diff --git a/common/openecomp-tosca-datatype/src/main/resources/globalTypes/openecomp/nodes.yml b/common/openecomp-tosca-datatype/src/main/resources/globalTypes/openecomp/nodes.yml
index fd1a8e5f9a..fb2e030a06 100644
--- a/common/openecomp-tosca-datatype/src/main/resources/globalTypes/openecomp/nodes.yml
+++ b/common/openecomp-tosca-datatype/src/main/resources/globalTypes/openecomp/nodes.yml
@@ -320,6 +320,9 @@ node_types:
- 1
- UNBOUNDED
+ org.openecomp.resource.abstract.nodes.ComplexVFC:
+ derived_from: org.openecomp.resource.abstract.nodes.AbstractSubstitute
+
org.openecomp.resource.abstract.nodes.VFC:
derived_from: org.openecomp.resource.abstract.nodes.AbstractSubstitute
properties:
@@ -343,6 +346,16 @@ node_types:
type: string
status: SUPPORTED
required: false
+ nfc_code:
+ type: string
+ description: nfc code
+ status: SUPPORTED
+ required: false
+ nfc_function:
+ type: string
+ description: nfc function
+ status: SUPPORTED
+ required: false
vm_type_tag:
description: vm type based on naming Convention
type: string
@@ -537,3 +550,23 @@ node_types:
org.openecomp.resource.vfc.nodes.volume:
derived_from: tosca.nodes.BlockStorage
+ ### Node types related to Deployment Flavors
+ org.openecomp.resource.abstract.nodes.VnfConfiguration:
+ derived_from: tosca.nodes.Root
+ description: a container for the available flavors
+ properties:
+ allowed_flavors:
+ description: a collection of all available flavor valuesets
+ type: map
+ entry_schema:
+ type: org.openecomp.datatypes.flavors.DeploymentFlavor
+
+ org.openecomp.resource.abstract.nodes.MultiFlavorVFC:
+ derived_from: org.openecomp.resource.abstract.nodes.VFC
+ description: Multi flavored VFC node
+ properties:
+ images:
+ type: map
+ entry_schema:
+ type: org.openecomp.datatypes.ImageInfo
+ required: false \ No newline at end of file