2 * Copyright © 2017-2018 AT&T Intellectual Property.
\r
4 * Licensed under the Apache License, Version 2.0 (the "License");
\r
5 * you may not use this file except in compliance with the License.
\r
6 * You may obtain a copy of the License at
\r
8 * http://www.apache.org/licenses/LICENSE-2.0
\r
10 * Unless required by applicable law or agreed to in writing, software
\r
11 * distributed under the License is distributed on an "AS IS" BASIS,
\r
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
13 * See the License for the specific language governing permissions and
\r
14 * limitations under the License.
\r
17 package org.onap.ccsdk.apps.controllerblueprints.core.data
\r
19 import com.fasterxml.jackson.annotation.JsonIgnore
\r
20 import com.fasterxml.jackson.annotation.JsonProperty
\r
21 import com.fasterxml.jackson.databind.JsonNode
\r
26 * @author Brinda Santh
\r
28 open class EntityType {
\r
30 var id: String? = null
\r
31 var description: String? = null
\r
32 var version: String = "1.0.0"
\r
33 var metadata: MutableMap<String, String>? = null
\r
34 @get:JsonProperty("derived_from")
\r
35 lateinit var derivedFrom: String
\r
36 var attributes: MutableMap<String, AttributeDefinition>? = null
\r
37 var properties: MutableMap<String, PropertyDefinition>? = null
\r
41 5.3.2 tosca.datatypes.org.onap.ccsdk.apps.controllerblueprints.core.data.Credential
\r
42 The org.onap.ccsdk.apps.controllerblueprints.core.data.Credential type is a complex TOSCA data Type used when describing
\r
43 authorization credentials used to access network accessible resources.
\r
47 var id: String? = null
\r
48 var protocol: String? = null
\r
49 @get:JsonProperty("token_type")
\r
50 lateinit var tokenType: String
\r
51 lateinit var token: String
\r
52 var keys: MutableMap<String, String>? = null
\r
53 lateinit var user: String
\r
57 3.5.2 Constraint clause
\r
58 A constraint clause defines an operation along with one or more compatible values that can be used to define a constraint on a property or parameter’s allowed values when it is defined in a TOSCA Service Template or one of its entities.
\r
60 class ConstraintClause {
\r
61 @get:JsonProperty("equal")
\r
62 var equal: Any? = null
\r
63 @get:JsonProperty("greater_than")
\r
64 var greaterThan: Any? = null
\r
65 @get:JsonProperty("greater_or_equal")
\r
66 var greaterOrEqual: Any? = null
\r
67 @get:JsonProperty("less_than")
\r
68 var lessThan: Any? = null
\r
69 @get:JsonProperty("less_or_equal")
\r
70 var lessOrEqual: Any? = null
\r
71 @get:JsonProperty("in_range")
\r
72 var inRange: Any? = null
\r
73 @get:JsonProperty("valid_values")
\r
74 var validValues: MutableList<Any>? = null
\r
75 @get:JsonProperty("length")
\r
76 var length: Any? = null
\r
77 @get:JsonProperty("min_length")
\r
78 var minLength: Any? = null
\r
79 @get:JsonProperty("max_length")
\r
80 var maxLength: Any? = null
\r
81 @get:JsonProperty("pattern")
\r
82 var pattern: String? = null
\r
86 3.5.4 Node Filter definition
\r
87 A node filter definition defines criteria for selection of a TOSCA Node Template based upon the template’s property values, capabilities and capability properties.
\r
90 class NodeFilterDefinition {
\r
91 var properties: MutableMap<String, PropertyDefinition>? = null
\r
92 var capabilities : MutableList<String>? = null
\r
96 3.5.5 Repository definition
\r
97 A repository definition defines a named external repository which contains deployment
\r
98 and implementation artifacts that are referenced within the TOSCA Service Template.
\r
100 class RepositoryDefinition {
\r
102 var id: String? = null
\r
103 var description: String? = null
\r
104 lateinit var url: String
\r
105 var credential: Credential? = null
\r
110 3.5.6 Artifact definition
\r
111 An artifact definition defines a named, typed file that can be associated with Node Type
\r
112 or Node Template and used by orchestration engine to facilitate deployment and implementation of interface operations.
\r
114 class ArtifactDefinition {
\r
116 var id: String? = null
\r
117 var type: String? = null
\r
118 var file: String? = null
\r
119 var repository: String? = null
\r
120 var description: String? = null
\r
121 @get:JsonProperty("deploy_Path")
\r
122 var deployPath: String? = null
\r
123 var properties: MutableMap<String, JsonNode>? = null
\r
124 var content: String? = null
\r
125 @Deprecated("Mapping content is define by the Type")
\r
126 var mappingContent: String? = null
\r
131 3.5.7 Import definition
\r
132 An import definition is used within a TOSCA Service Template to locate and uniquely name
\r
133 another TOSCA Service Template file which has type and template definitions to be imported (included)
\r
134 and referenced within another Service Template.
\r
136 class ImportDefinition {
\r
138 var id: String? = null
\r
139 lateinit var file: String
\r
140 var repository: String? = null
\r
141 @get:JsonProperty("namespace_uri")
\r
142 var namespaceUri: String? = null
\r
143 @get:JsonProperty("namespace_prefix")
\r
144 var namespacePrefix: String? = null
\r
148 3.5.8 Property definition A property definition defines a named, typed value and related data that can be associated with an
\r
149 entity defined in this specification (e.g., Node Types, Relationship Types, Capability Types, etc.).
\r
150 Properties are used by template authors to provide input values to TOSCA entities which indicate their “desired state” when they are
\r
151 instantiated. The value of a property can be retrieved using the get_property function within TOSCA Service Templates.
\r
153 class PropertyDefinition {
\r
155 var id: String? = null
\r
156 var description: String? = null
\r
157 var required: Boolean? = null
\r
158 var type: String? = null
\r
159 @get:JsonProperty("default")
\r
160 var defaultValue: Any? = null
\r
161 var status: String? = null
\r
162 var constraints: MutableList<ConstraintClause>? = null
\r
163 @get:JsonProperty("entry_schema")
\r
164 var entrySchema: EntrySchema? = null
\r
165 var value: Any? = null
\r
170 3.5.10 Attribute definition
\r
172 An attribute definition defines a named, typed value that can be associated with an entity defined in this
\r
173 specification (e.g., a Node, Relationship or Capability Type). Specifically, it is used to expose the
\r
174 “actual state” of some property of a TOSCA entity after it has been deployed and instantiated
\r
175 (as set by the TOSCA orchestrator). Attribute values can be retrieved via the get_attribute function
\r
176 from the instance model and used as values to other entities within TOSCA Service Templates.
\r
179 class AttributeDefinition {
\r
181 var id: String? = null
\r
182 var description: String? = null
\r
183 lateinit var type: String
\r
184 @JsonProperty("default")
\r
185 var _default: Any? = null
\r
186 var status: String? = null
\r
187 @JsonProperty("entry_schema")
\r
188 var entry_schema: String? = null
\r
192 3.5.13 Operation definition
\r
193 An operation definition defines a named function or procedure that can be bound to an implementation artifact (e.g., a script).
\r
195 class OperationDefinition {
\r
197 var id: String? = null
\r
198 var description: String? = null
\r
199 var implementation: Implementation? = null
\r
200 var inputs: MutableMap<String, PropertyDefinition>? = null
\r
201 var outputs: MutableMap<String, PropertyDefinition>? = null
\r
204 class Implementation {
\r
205 var primary: String? = null
\r
206 var dependencies: MutableList<String>? = null
\r
210 3.5.14 Interface definition
\r
211 An interface definition defines a named interface that can be associated with a Node or Relationship Type
\r
213 class InterfaceDefinition {
\r
215 var id: String? = null
\r
216 var type: String? = null
\r
217 var operations: MutableMap<String, OperationDefinition>? = null
\r
218 var inputs: MutableMap<String, PropertyDefinition>? = null
\r
222 3.5.15 Event Filter definition
\r
223 An event filter definition defines criteria for selection of an attribute, for the purpose of monitoring it, within a TOSCA entity, or one its capabilities.
\r
225 class EventFilterDefinition {
\r
227 var id: String? = null
\r
228 lateinit var node: String
\r
229 var requirement: String? = null
\r
230 var capability: String? = null
\r
234 3.5.16 Trigger definition TODO
\r
235 A trigger definition defines the event, condition and action that is used to “trigger” a policy it is associated with.
\r
237 class TriggerDefinition {
\r
239 var id: String? = null
\r
240 var description: String? = null
\r
241 @get:JsonProperty("event_type")
\r
242 lateinit var eventType: String
\r
243 lateinit var action: String
\r
247 3.5.17 org.onap.ccsdk.apps.controllerblueprints.core.data.Workflow activity definition
\r
248 A workflow activity defines an operation to be performed in a TOSCA workflow. Activities allows to:
\r
249 · Delegate the workflow for a node expected to be provided by the orchestrator
\r
250 · Set the state of a node
\r
251 · Call an operation defined on a TOSCA interface of a node, relationship or group
\r
252 · Inline another workflow defined in the topology (to allow reusability)
\r
255 var delegate: String? = null
\r
256 @get:JsonProperty("set_state")
\r
257 var setState: String? = null
\r
258 @get:JsonProperty("call_operation")
\r
259 var callOperation: String? = null
\r
260 var inlines: ArrayList<String>? = null
\r
264 3.5.20 org.onap.ccsdk.apps.controllerblueprints.core.data.Workflow precondition definition
\r
265 A workflow condition can be used as a filter or precondition to check if a workflow can be processed or not based on the state of the instances of a TOSCA topology deployment. When not met, the workflow will not be triggered.
\r
267 class PreConditionDefinition {
\r
269 var id: String? = null
\r
270 lateinit var target: String
\r
271 @get:JsonProperty("target_relationship")
\r
272 lateinit var targetRelationship: String
\r
273 lateinit var condition: ArrayList<ConditionClause>
\r
277 3.5.21 org.onap.ccsdk.apps.controllerblueprints.core.data.Workflow step definition
\r
278 A workflow step allows to define one or multiple sequenced activities in a workflow and how they are connected to other steps in the workflow. They are the building blocks of a declarative workflow.
\r
282 var id: String? = null
\r
283 var description: String? = null
\r
284 var target: String? = null
\r
285 @JsonProperty("target_relationship")
\r
286 var targetRelationship: String? = null
\r
287 @JsonProperty("operation_host")
\r
288 var operationHost: String? = null
\r
289 var activities: ArrayList<Activity>? = null
\r
290 @get:JsonProperty("on_success")
\r
291 var onSuccess: ArrayList<String>? = null
\r
292 @get:JsonProperty("on_failure")
\r
293 var onFailure: ArrayList<String>? = null
\r
297 3.6.2 Capability definition
\r
298 A capability definition defines a named, typed set of data that can be associated with Node Type or Node Template to describe a transparent capability or feature of the software component the node describes.
\r
301 class CapabilityDefinition {
\r
303 var id: String? = null
\r
304 var type: String? = null
\r
305 var description: String? = null
\r
306 var properties: MutableMap<String, PropertyDefinition>? = null
\r
307 @get:JsonProperty("valid_source_types")
\r
308 var validSourceTypes: MutableList<String>? = null
\r
309 var occurrences: MutableList<Any>? = null
\r
313 3.6.3 Requirement definition
\r
314 The Requirement definition describes a named requirement (dependencies) of a TOSCA Node Type or Node template which needs to be fulfilled by a matching Capability definition declared by another TOSCA modelable entity. The requirement definition may itself include the specific name of the fulfilling entity (explicitly) or provide an abstract type, along with additional filtering characteristics, that a TOSCA orchestrator can use to fulfill the capability at runtime (implicitly).
\r
316 class RequirementDefinition {
\r
318 var id: String? = null
\r
319 var description: String? = null
\r
320 var capability: String? = null
\r
321 var node: String? = null
\r
322 var relationship: String? = null
\r
323 var occurrences: MutableList<Any>? = null
\r
327 3.6.4 Artifact Type
\r
328 An Artifact Type is a reusable entity that defines the type of one or more files that are used to define implementation or deployment artifacts that are referenced by nodes or relationships on their operations.
\r
330 class ArtifactType : EntityType() {
\r
331 @get:JsonProperty("mime_type")
\r
332 var mimeType: String? = null
\r
333 @get:JsonProperty("file_ext")
\r
334 var fileExt: MutableList<String>? = null
\r
340 A Data Type definition defines the schema for new named datatypes in TOSCA.
\r
343 class DataType : EntityType(){
\r
344 var constraints: MutableList<MutableMap<String, Any>>? = null
\r
349 A Node Type is a reusable entity that defines the type of one or more Node Templates. As such, a Node Type defines the structure of observable properties via a Properties Definition, the Requirements and Capabilities of the node as well as its supported interfaces.
\r
353 class NodeType : EntityType() {
\r
354 var capabilities: MutableMap<String, CapabilityDefinition>? = null
\r
355 var requirements: MutableMap<String, RequirementDefinition>? = null
\r
356 var interfaces: MutableMap<String, InterfaceDefinition>? = null
\r
357 var artifacts: MutableMap<String, ArtifactDefinition>? = null
\r
361 3.6.8 Requirement Type
\r
362 A Requirement Type is a reusable entity that describes a kind of requirement that a Node Type can declare to expose. The TOSCA Simple Profile seeks to simplify the need for declaring specific Requirement Types from nodes and instead rely upon nodes declaring their features sets using TOSCA Capability Types along with a named Feature notation.
\r
365 class RequirementType : EntityType() {
\r
366 var requirements: MutableMap<String, RequirementDefinition>? = null
\r
367 var capabilities: MutableMap<String, CapabilityDefinition>? = null
\r
368 var interfaces: MutableMap<String, InterfaceDefinition>? = null
\r
369 var artifacts: MutableMap<String, ArtifactDefinition>? = null
\r
373 3.6.10 Relationship Type
\r
374 A Relationship Type is a reusable entity that defines the type of one or more relationships between Node Types or Node Templates.
\r
377 class RelationshipType : EntityType() {
\r
378 var interfaces: MutableMap<String, InterfaceDefinition>? = null
\r
379 @get:JsonProperty("valid_target_types")
\r
380 var validTargetTypes: ArrayList<String>? = null
\r
385 A Group Type defines logical grouping types for nodes, typically for different management purposes.
\r
386 Groups can effectively be viewed as logical nodes that are not part of the physical deployment topology
\r
387 of an application, yet can have capabilities and the ability to attach policies and interfaces
\r
388 that can be applied (depending on the group type) to its member nodes.
\r
391 class GroupType : EntityType() {
\r
392 var members: MutableList<String>? = null
\r
393 var requirements: ArrayList<RequirementDefinition>? = null
\r
394 var capabilities: MutableMap<String, CapabilityDefinition>? = null
\r
395 var interfaces: MutableMap<String, InterfaceDefinition>? = null
\r
401 A Policy Type defines a type of requirement that affects or governs an application or service’s
\r
402 topology at some stage of its lifecycle, but is not explicitly part of the topology itself
\r
403 (i.e., it does not prevent the application or service from being deployed or run if it did not exist).
\r
405 class PolicyType : EntityType(){
\r
406 lateinit var targets: MutableList<String>
\r
410 3.7.1 Capability assignment
\r
411 A capability assignment allows node template authors to assign values to properties and attributes for a named capability definition that is part of a Node Template’s type definition.
\r
413 class CapabilityAssignment {
\r
415 var id: String? = null
\r
416 var attributes: MutableMap<String, JsonNode>? = null
\r
417 var properties: MutableMap<String, JsonNode>? = null
\r
421 3.7.4 Relationship Template
\r
422 A Relationship Template specifies the occurrence of a manageable relationship between node templates as part of an application’s topology model that is defined in a TOSCA Service Template. A Relationship template is an instance of a specified Relationship Type and can provide customized properties, constraints or operations which override the defaults provided by its Relationship Type and its implementations.
\r
424 class GroupDefinition {
\r
426 var id: String? = null
\r
427 lateinit var type: String
\r
428 var description: String? = null
\r
429 var metadata : MutableMap<String, String>? = null
\r
430 var properties : MutableMap<String, JsonNode>? = null
\r
431 var members = ArrayList<String>()
\r
432 var interfaces : MutableMap<String, InterfaceDefinition>?= null
\r
436 3.7.6 Policy definition
\r
437 A policy definition defines a policy that can be associated with a TOSCA topology or top-level entity definition (e.g., group definition, node template, etc.).
\r
439 class PolicyDefinition {
\r
441 var id: String? = null
\r
442 lateinit var type: String
\r
443 var description: String? = null
\r
444 var metadata: MutableMap<String, String>? = null
\r
445 var properties: MutableMap<String, JsonNode>? = null
\r
446 var targets: MutableList<String>? = null
\r
451 3.8 Topology Template definition
\r
452 This section defines the topology template of a cloud application. The main ingredients of the topology template are node templates representing components of the application and relationship templates representing links between the components. These elements are defined in the nested node_templates section and the nested relationship_templates sections, respectively. Furthermore, a topology template allows for defining input parameters, output parameters as well as grouping of node templates.
\r
454 class TopologyTemplate {
\r
456 var id: String? = null
\r
457 var description: String? = null
\r
458 var inputs: MutableMap<String, PropertyDefinition>? = null
\r
459 @get:JsonProperty("node_templates")
\r
460 var nodeTemplates: MutableMap<String, NodeTemplate>? = null
\r
461 @get:JsonProperty("relationship_templates")
\r
462 var relationshipTemplates: MutableMap<String, RelationshipTemplate>? = null
\r
463 var policies: MutableMap<String, PolicyDefinition>? = null
\r
464 var outputs: MutableMap<String, PropertyDefinition>? = null
\r
465 @get:JsonProperty("substitution_mappings")
\r
466 var substitutionMappings: Any? = null
\r
467 var workflows: MutableMap<String, Workflow>? = null
\r
470 class SubstitutionMapping {
\r
471 @get:JsonProperty("node_type")
\r
472 lateinit var nodeType: String
\r
473 lateinit var capabilities: ArrayList<String>
\r
474 lateinit var requirements: ArrayList<String>
\r
477 class EntrySchema {
\r
478 lateinit var type: String
\r
479 var constraints: MutableList<MutableMap<String, Any>>? = null
\r
482 class InterfaceAssignment {
\r
484 var id: String? = null
\r
485 var operations: MutableMap<String, OperationAssignment>? = null
\r
486 var inputs: MutableMap<String, JsonNode>? = null
\r
490 3.7.3 Node Template
\r
491 A Node Template specifies the occurrence of a manageable software component as part of an application’s topology model which is defined in a TOSCA Service Template. A Node template is an instance of a specified Node Type and can provide customized properties, constraints or operations which override the defaults provided by its Node Type and its implementations.
\r
494 class NodeTemplate {
\r
496 var id: String? = null
\r
497 var description: String? = null
\r
498 lateinit var type: String
\r
499 var metadata: MutableMap<String, String>? = null
\r
500 var directives: MutableList<String>? = null
\r
501 //@get:JsonSerialize(using = PropertyDefinitionValueSerializer::class)
\r
502 var properties: MutableMap<String, JsonNode>? = null
\r
503 var attributes: MutableMap<String, JsonNode>? = null
\r
504 var capabilities: MutableMap<String, CapabilityAssignment>? = null
\r
505 var requirements: MutableMap<String, RequirementAssignment>? = null
\r
506 var interfaces: MutableMap<String, InterfaceAssignment>? = null
\r
507 var artifacts: MutableMap<String, ArtifactDefinition>? = null
\r
508 @get:JsonProperty("node_filter")
\r
509 var nodeFilter: NodeFilterDefinition? = null
\r
510 var copy: String? = null
\r
513 class OperationAssignment {
\r
515 var id: String? = null
\r
516 var description: String? = null
\r
517 var implementation: Implementation? = null
\r
518 var inputs: MutableMap<String, JsonNode>? = null
\r
519 var outputs: MutableMap<String, JsonNode>? = null
\r
523 3.7.4 Relationship Template
\r
524 A Relationship Template specifies the occurrence of a manageable relationship between node templates as part of an application’s topology model that is defined in a TOSCA Service Template. A Relationship template is an instance of a specified Relationship Type and can provide customized properties, constraints or operations which override the defaults provided by its Relationship Type and its implementations.
\r
527 class RelationshipTemplate {
\r
528 var type: String? = null
\r
529 var description: String? = null
\r
530 var metadata: MutableMap<String, String>? = null
\r
531 var properties: MutableMap<String, PropertyDefinition>? = null
\r
532 var attributes: MutableMap<String, JsonNode>? = null
\r
533 var interfaces: MutableMap<String, InterfaceDefinition>? = null
\r
534 var copy: String? = null
\r
538 3.7.2 Requirement assignment
\r
539 A Requirement assignment allows template authors to provide either concrete names of TOSCA templates or provide abstract selection criteria for providers to use to find matching TOSCA templates that are used to fulfill a named requirement’s declared TOSCA Node Type.
\r
542 class RequirementAssignment {
\r
544 var id: String? = null
\r
545 var capability: String? = null
\r
546 var node: String? = null
\r
547 //Relationship Type or Relationship Template
\r
548 var relationship: String? = null
\r
554 var id: String? = null
\r
555 var description: String? = null
\r
556 var steps: MutableMap<String, Step>? = null
\r
557 var preconditions: ArrayList<PreConditionDefinition>? = null
\r
558 var inputs: MutableMap<String, PropertyDefinition>? = null
\r
562 class ConditionClause {
\r
563 var and: ArrayList<MutableMap<String, Any>>? = null
\r
564 var or: ArrayList<MutableMap<String, Any>>? = null
\r
565 @get:JsonProperty("assert")
\r
566 var assertConditions: ArrayList<MutableMap<String, Any>>? = null
\r
570 3.9 Service Template definition
\r
571 A TOSCA Service Template (YAML) document contains element definitions of building blocks for cloud application, or complete models of cloud applications. This section describes the top-level structural elements (TOSCA keynames) along with their grammars, which are allowed to appear in a TOSCA Service Template document.
\r
574 class ServiceTemplate {
\r
576 var id: String? = null
\r
577 @get:JsonProperty("tosca_definitions_version")
\r
578 var toscaDefinitionsVersion: String = "controller_blueprint_1_0_0"
\r
579 var metadata: MutableMap<String, String>? = null
\r
580 var description: String? = null
\r
581 @get:JsonProperty("dsl_definitions")
\r
582 var dslDefinitions: MutableMap<String, Any>? = null
\r
583 var repositories: MutableMap<String, RepositoryDefinition>? = null
\r
584 var imports: MutableList<ImportDefinition>? = null
\r
585 @get:JsonProperty("artifact_types")
\r
586 var artifactTypes: MutableMap<String, ArtifactType>? = null
\r
587 @get:JsonProperty("data_types")
\r
588 var dataTypes: MutableMap<String, DataType>? = null
\r
589 @get:JsonProperty("node_types")
\r
590 var nodeTypes: MutableMap<String, NodeType>? = null
\r
591 @get:JsonProperty("policy_types")
\r
592 var policyTypes: PolicyType? = null
\r
593 @get:JsonProperty("topology_template")
\r
594 var topologyTemplate: TopologyTemplate? = null
\r
597 class ToscaMetaData {
\r
598 lateinit var toscaMetaFileVersion: String
\r
599 lateinit var csarVersion: String
\r
600 lateinit var createdBy: String
\r
601 lateinit var entityDefinitions: String
\r
602 var templateTags: String? = null
\r