The Data Model reflects the IM's The ComputeDesc and MemoryDesc elements as the TOSCA capability type onap.capabilities.Compute.
capability_types: onap.capabilities.Compute: derived_from: tosca.capabilities.Container description: a description of the required hardware resources properties: num_cpus: type: integer required: false constraints: - greater_or_equal: 1 cpu_frequency: type: scalar-unit.frequency required: false constraints: - greater_or_equal: 0.1 GHz mem_size: type: scalar-unit.size required: false constraints: - greater_or_equal: 0 MB storage_size: type: scalar-unit.size required: false constraints: - greater_or_equal: 0 MB io_bitrate: description: bits per second type: integer required: false architecture: description: vendor+architecture, for example, Intel64 type: string required: false custom_features: description: | Additional features description, serialized in a well-known format. type: string required: false
In addtition to the obvious properties required by the IM, this capability type also includes properties that allow for easy customization:
- architecture - allows the VFC vendors to focus their requirements on a specific hardware architecture, for example "Intel x86".
- custom_features - an opaque container for a list of feature definitions. Any text, the only limitation is that it should not break the YAML/TOSCA formatting. The contents of this property is actually not part of the TOSCA model!
In spite the changes made in the capability type defininitions, the definition of the node type onap.nodes.Container does not change:
Examples of requirement assignments in their simplest form:
Examples of requirement assignments in the combined (TOSCA properties + custom_features) form:
In the example above the text in the custom_features property is actually a JSON document.
The hardware vendors are encouraged to provide a well-defined schema (JSON Schema for JSON-formatted texts, DTD or XML Schema for XML-formatted texts, etc) to govern syntax of their custom_feature texts. For example, a JSON schema for the CPU custom feature fron the example above may look like this:
The idea of using a schema document together with the custom_features text seems to be very powerful. For a demostration of how such a schema would work, please visit any of the JSON schema validators available online, for example, https://json-schema-validator.herokuapp.com/. Just copy and paste over there the above JSON schema and the value of the custom_feature field and check on the validation results:
TOSCA 1.2 allows using a JSON schema as a TOSCA constraint in parameter definition and node_filter clauses. Using an external schema document (with a Web URL in the TOSCA constraint clause) seems to be especially promising, since such usage combines the benefits of schema-driven validation with the flexibility of having the schema hosted outside: