Skip to content

resolve-self

This test is of type template.

Service Template

The following service template is used.

tests/query/resolve-self/template.yaml
tosca_definitions_version: tosca_simple_yaml_1_3
topology_template:
    node_templates:
        webapp:
            type: WebApplication
            properties:
                db_username: executeQuery(SELECT SELF.properties.db_password)
                db_password: mypassword
                port:
            requirements:
                - database_endpoint: mysql_database
                - host: tomcat
        tomcat:
            type: Tomcat
            requirements:
                - host: vm_1
        mysql_database:
            type: Database
            properties:
                username: user
                password: password
            requirements:
                - my_db_connection: dbms
        dbms:
            type: DBMS
            requirements:
                - host: vm_2
        vm_1:
            type: VirtualMachine
            requirements:
                - host: openstack
        vm_2:
            type: VirtualMachine
            requirements:
                - host: openstack
        openstack:
            type: Compute
            capabilities:
                host:
                    properties:
                        num_cpus: 1
                        mem_size: 2 GB
            os:
                properties:
                    type: linux
                    distribution: ubuntu
    groups:
        database_group:
            type: tosca.groups.Root
            members:
                - mysql_database
                - dbms
    policies:
        - placement_policy:
              type: tosca.policies.placement
              targets:
                  - vm_1
                  - vm_2

Query Result

The following query result is expected.

tosca_definitions_version: tosca_simple_yaml_1_3
topology_template:
    node_templates:
        webapp:
            type: WebApplication
            properties:
                db_username: mypassword
                db_password: mypassword
                port:
            requirements:
                - database_endpoint: mysql_database
                - host: tomcat
        tomcat:
            type: Tomcat
            requirements:
                - host: vm_1
        mysql_database:
            type: Database
            properties:
                username: user
                password: password
            requirements:
                - my_db_connection: dbms
        dbms:
            type: DBMS
            requirements:
                - host: vm_2
        vm_1:
            type: VirtualMachine
            requirements:
                - host: openstack
        vm_2:
            type: VirtualMachine
            requirements:
                - host: openstack
        openstack:
            type: Compute
            capabilities:
                host:
                    properties:
                        num_cpus: 1
                        mem_size: 2 GB
            os:
                properties:
                    type: linux
                    distribution: ubuntu
    groups:
        database_group:
            type: tosca.groups.Root
            members:
                - mysql_database
                - dbms
    policies:
        - placement_policy:
              type: tosca.policies.placement
              targets:
                  - vm_1
                  - vm_2

Last update: November 18, 2024