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 lateinit var type: String
\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 lateinit var primary: String
\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 @get:JsonProperty("target_filter")
\r
244 var targetFilter: EventFilterDefinition? = null
\r
245 var condition: ConditionClause? = null
\r
246 var constraint: ConditionClause? = null
\r
247 var method: String? = null
\r
248 lateinit var action: String
\r
252 3.5.17 org.onap.ccsdk.apps.controllerblueprints.core.data.Workflow activity definition
\r
253 A workflow activity defines an operation to be performed in a TOSCA workflow. Activities allows to:
\r
254 · Delegate the workflow for a node expected to be provided by the orchestrator
\r
255 · Set the state of a node
\r
256 · Call an operation defined on a TOSCA interface of a node, relationship or group
\r
257 · Inline another workflow defined in the topology (to allow reusability)
\r
260 var delegate: String? = null
\r
261 @get:JsonProperty("set_state")
\r
262 var setState: String? = null
\r
263 @get:JsonProperty("call_operation")
\r
264 var callOperation: String? = null
\r
265 var inlines: ArrayList<String>? = null
\r
269 3.5.20 org.onap.ccsdk.apps.controllerblueprints.core.data.Workflow precondition definition
\r
270 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
272 class PreConditionDefinition {
\r
274 var id: String? = null
\r
275 lateinit var target: String
\r
276 @get:JsonProperty("target_relationship")
\r
277 lateinit var targetRelationship: String
\r
278 lateinit var condition: ArrayList<ConditionClause>
\r
282 3.5.21 org.onap.ccsdk.apps.controllerblueprints.core.data.Workflow step definition
\r
283 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
287 var id: String? = null
\r
288 var description: String? = null
\r
289 var target: String? = null
\r
290 @JsonProperty("target_relationship")
\r
291 var targetRelationship: String? = null
\r
292 @JsonProperty("operation_host")
\r
293 var operationHost: String? = null
\r
294 var activities: ArrayList<Activity>? = null
\r
295 @get:JsonProperty("on_success")
\r
296 var onSuccess: ArrayList<String>? = null
\r
297 @get:JsonProperty("on_failure")
\r
298 var onFailure: ArrayList<String>? = null
\r
302 3.6.2 Capability definition
\r
303 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
306 class CapabilityDefinition {
\r
308 var id: String? = null
\r
309 var type: String? = null
\r
310 var description: String? = null
\r
311 var properties: MutableMap<String, PropertyDefinition>? = null
\r
312 @get:JsonProperty("valid_source_types")
\r
313 var validSourceTypes: MutableList<String>? = null
\r
314 var occurrences: MutableList<Any>? = null
\r
318 3.6.3 Requirement definition
\r
319 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
321 class RequirementDefinition {
\r
323 var id: String? = null
\r
324 var description: String? = null
\r
325 var capability: String? = null
\r
326 var node: String? = null
\r
327 var relationship: String? = null
\r
328 var occurrences: MutableList<Any>? = null
\r
332 3.6.4 Artifact Type
\r
333 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
335 class ArtifactType : EntityType() {
\r
336 @get:JsonProperty("mime_type")
\r
337 var mimeType: String? = null
\r
338 @get:JsonProperty("file_ext")
\r
339 var fileExt: MutableList<String>? = null
\r
345 A Data Type definition defines the schema for new named datatypes in TOSCA.
\r
348 class DataType : EntityType(){
\r
349 var constraints: MutableList<MutableMap<String, Any>>? = null
\r
354 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
358 class NodeType : EntityType() {
\r
359 var capabilities: MutableMap<String, CapabilityDefinition>? = null
\r
360 var requirements: MutableMap<String, RequirementDefinition>? = null
\r
361 var interfaces: MutableMap<String, InterfaceDefinition>? = null
\r
362 var artifacts: MutableMap<String, ArtifactDefinition>? = null
\r
366 3.6.8 Requirement Type
\r
367 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
370 class RequirementType : EntityType() {
\r
371 var requirements: MutableMap<String, RequirementDefinition>? = null
\r
372 var capabilities: MutableMap<String, CapabilityDefinition>? = null
\r
373 var interfaces: MutableMap<String, InterfaceDefinition>? = null
\r
374 var artifacts: MutableMap<String, ArtifactDefinition>? = null
\r
378 3.6.10 Relationship Type
\r
379 A Relationship Type is a reusable entity that defines the type of one or more relationships between Node Types or Node Templates.
\r
382 class RelationshipType : EntityType() {
\r
383 var interfaces: MutableMap<String, InterfaceDefinition>? = null
\r
384 @get:JsonProperty("valid_target_types")
\r
385 var validTargetTypes: ArrayList<String>? = null
\r
390 A Group Type defines logical grouping types for nodes, typically for different management purposes.
\r
391 Groups can effectively be viewed as logical nodes that are not part of the physical deployment topology
\r
392 of an application, yet can have capabilities and the ability to attach policies and interfaces
\r
393 that can be applied (depending on the group type) to its member nodes.
\r
396 class GroupType : EntityType() {
\r
397 var members: MutableList<String>? = null
\r
398 var requirements: ArrayList<RequirementDefinition>? = null
\r
399 var capabilities: MutableMap<String, CapabilityDefinition>? = null
\r
400 var interfaces: MutableMap<String, InterfaceDefinition>? = null
\r
406 A Policy Type defines a type of requirement that affects or governs an application or service’s
\r
407 topology at some stage of its lifecycle, but is not explicitly part of the topology itself
\r
408 (i.e., it does not prevent the application or service from being deployed or run if it did not exist).
\r
410 class PolicyType : EntityType(){
\r
411 lateinit var targets: MutableList<String>
\r
415 3.7.1 Capability assignment
\r
416 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
418 class CapabilityAssignment {
\r
420 var id: String? = null
\r
421 var attributes: MutableMap<String, JsonNode>? = null
\r
422 var properties: MutableMap<String, JsonNode>? = null
\r
426 3.7.4 Relationship Template
\r
427 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
429 class GroupDefinition {
\r
431 var id: String? = null
\r
432 lateinit var type: String
\r
433 var description: String? = null
\r
434 var metadata : MutableMap<String, String>? = null
\r
435 var properties : MutableMap<String, JsonNode>? = null
\r
436 var members = ArrayList<String>()
\r
437 var interfaces : MutableMap<String, InterfaceDefinition>?= null
\r
441 3.7.6 Policy definition
\r
442 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
444 class PolicyDefinition {
\r
446 var id: String? = null
\r
447 lateinit var type: String
\r
448 var description: String? = null
\r
449 var metadata: MutableMap<String, String>? = null
\r
450 var properties: MutableMap<String, JsonNode>? = null
\r
451 var targets: MutableList<String>? = null
\r
456 3.8 Topology Template definition
\r
457 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
459 class TopologyTemplate {
\r
461 var id: String? = null
\r
462 var description: String? = null
\r
463 var inputs: MutableMap<String, PropertyDefinition>? = null
\r
464 @get:JsonProperty("node_templates")
\r
465 var nodeTemplates: MutableMap<String, NodeTemplate>? = null
\r
466 @get:JsonProperty("relationship_templates")
\r
467 var relationshipTemplates: MutableMap<String, RelationshipTemplate>? = null
\r
468 var policies: MutableMap<String, PolicyDefinition>? = null
\r
469 var outputs: MutableMap<String, PropertyDefinition>? = null
\r
470 @get:JsonProperty("substitution_mappings")
\r
471 var substitutionMappings: Any? = null
\r
472 var workflows: MutableMap<String, Workflow>? = null
\r
475 class SubstitutionMapping {
\r
476 @get:JsonProperty("node_type")
\r
477 lateinit var nodeType: String
\r
478 lateinit var capabilities: ArrayList<String>
\r
479 lateinit var requirements: ArrayList<String>
\r
482 class EntrySchema {
\r
483 lateinit var type: String
\r
484 var constraints: MutableList<MutableMap<String, Any>>? = null
\r
487 class InterfaceAssignment {
\r
489 var id: String? = null
\r
490 var operations: MutableMap<String, OperationAssignment>? = null
\r
491 var inputs: MutableMap<String, JsonNode>? = null
\r
495 3.7.3 Node Template
\r
496 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
499 class NodeTemplate {
\r
501 var id: String? = null
\r
502 var description: String? = null
\r
503 lateinit var type: String
\r
504 var metadata: MutableMap<String, String>? = null
\r
505 var directives: MutableList<String>? = null
\r
506 //@get:JsonSerialize(using = PropertyDefinitionValueSerializer::class)
\r
507 var properties: MutableMap<String, JsonNode>? = null
\r
508 var attributes: MutableMap<String, JsonNode>? = null
\r
509 var capabilities: MutableMap<String, CapabilityAssignment>? = null
\r
510 var requirements: MutableMap<String, RequirementAssignment>? = null
\r
511 var interfaces: MutableMap<String, InterfaceAssignment>? = null
\r
512 var artifacts: MutableMap<String, ArtifactDefinition>? = null
\r
513 @get:JsonProperty("node_filter")
\r
514 var nodeFilter: NodeFilterDefinition? = null
\r
515 var copy: String? = null
\r
518 class OperationAssignment {
\r
520 var id: String? = null
\r
521 var description: String? = null
\r
522 var implementation: Implementation? = null
\r
523 var inputs: MutableMap<String, JsonNode>? = null
\r
524 var outputs: MutableMap<String, JsonNode>? = null
\r
528 3.7.4 Relationship Template
\r
529 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
532 class RelationshipTemplate {
\r
533 var type: String? = null
\r
534 var description: String? = null
\r
535 var metadata: MutableMap<String, String>? = null
\r
536 var properties: MutableMap<String, PropertyDefinition>? = null
\r
537 var attributes: MutableMap<String, JsonNode>? = null
\r
538 var interfaces: MutableMap<String, InterfaceDefinition>? = null
\r
539 var copy: String? = null
\r
543 3.7.2 Requirement assignment
\r
544 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
547 class RequirementAssignment {
\r
549 var id: String? = null
\r
550 var capability: String? = null
\r
551 var node: String? = null
\r
552 //Relationship Type or Relationship Template
\r
553 var relationship: String? = null
\r
559 var id: String? = null
\r
560 var description: String? = null
\r
561 var steps: MutableMap<String, Step>? = null
\r
562 var preconditions: ArrayList<PreConditionDefinition>? = null
\r
563 var inputs: MutableMap<String, PropertyDefinition>? = null
\r
567 class ConditionClause {
\r
568 var and: ArrayList<MutableMap<String, Any>>? = null
\r
569 var or: ArrayList<MutableMap<String, Any>>? = null
\r
570 @get:JsonProperty("assert")
\r
571 var assertConditions: ArrayList<MutableMap<String, Any>>? = null
\r
575 3.9 Service Template definition
\r
576 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
579 class ServiceTemplate {
\r
581 var id: String? = null
\r
582 @get:JsonProperty("tosca_definitions_version")
\r
583 var toscaDefinitionsVersion: String = "controller_blueprint_1_0_0"
\r
584 var metadata: MutableMap<String, String>? = null
\r
585 var description: String? = null
\r
586 @get:JsonProperty("dsl_definitions")
\r
587 var dslDefinitions: MutableMap<String, Any>? = null
\r
588 var repositories: MutableMap<String, RepositoryDefinition>? = null
\r
589 var imports: MutableList<ImportDefinition>? = null
\r
590 @get:JsonProperty("artifact_types")
\r
591 var artifactTypes: MutableMap<String, ArtifactType>? = null
\r
592 @get:JsonProperty("data_types")
\r
593 var dataTypes: MutableMap<String, DataType>? = null
\r
594 @get:JsonProperty("node_types")
\r
595 var nodeTypes: MutableMap<String, NodeType>? = null
\r
596 @get:JsonProperty("policy_types")
\r
597 var policyTypes: PolicyType? = null
\r
598 @get:JsonProperty("topology_template")
\r
599 var topologyTemplate: TopologyTemplate? = null
\r
602 class ToscaMetaData {
\r
603 lateinit var toscaMetaFileVersion: String
\r
604 lateinit var csarVersion: String
\r
605 lateinit var createdBy: String
\r
606 lateinit var entityDefinitions: String
\r
607 var templateTags: String? = null
\r