Hi everyone,
I am modelling an OOP programming language and I want to populate a node with attributes taken from other nodes.
I have a generic node class representing a class of the language. Every class has an attribute id which is assigned only when the class instance is created. The class has also has a property parameters to state the inputs passed to the class constructor and a requirement contractId to specify the dependency between classes
The node_types is:
class:
...
requirements:
contractId: ... -> based on DependsOn relationship
attributes:
id:
type: string -> field populated after the node creation
properties:
parameters:
type: list
The ServiceTemplate looks like the following:
classA:
... # Once the node is created an id value is stored in an attribute id
classB:
...
classC:
requirements:
- contractId: classA
- contractId: classB
What I want to achieve is this translate in code:
A = contract()
B = contract()
C = contract(A.id, B.id)
The solution proposed in ServiceTemplate works fine if I have only one contractId requirement because I am able to retrieve the class id with { get_attribute: [SELF, contractId, id] } but it doesn't work with multiple requirements of the same type.
Am I missing something in the TOSCA specification/xopera implementation or this kind of operation can not be achieved? 😄
Hi everyone,
I am modelling an OOP programming language and I want to populate a node with attributes taken from other nodes.
I have a generic node
classrepresenting a class of the language. Every class has an attributeidwhich is assigned only when the class instance is created. The class has also has a propertyparametersto state the inputs passed to the class constructor and a requirementcontractIdto specify the dependency between classesThe
node_typesis:The
ServiceTemplatelooks like the following:What I want to achieve is this translate in code:
The solution proposed in
ServiceTemplateworks fine if I have only onecontractIdrequirement because I am able to retrieve the class id with{ get_attribute: [SELF, contractId, id] }but it doesn't work with multiple requirements of the same type.Am I missing something in the TOSCA specification/xopera implementation or this kind of operation can not be achieved? 😄