Skip to content

result-structure-complex

This test is of type default.

Service Template

The following service template is used.

tests/query/template.yaml
tosca_definitions_version: tosca_simple_yaml_1_3
topology_template:
    node_templates:
        webapp:
            type: WebApplication
            properties:
                db_username:
                    get_property:
                        - mysql_database
                        - username
                db_password:
                    get_property:
                        - mysql_database
                        - password
                port: 3306
            requirements:
                - database_endpoint: mysql_database
                - host: tomcat
        tomcat:
            type: Tomcat
            requirements:
                - host: vm_1
        mysql_database:
            type: Database
            properties:
                username: dbuser
                password: dbpwd
            requirements:
                - my_db_connection:
                      node: dbms
                      relationship: my_db_connection
        dbms:
            type: DBMS
            requirements:
                - host: vm_2
        vm_1:
            type: VirtualMachine
            properties:
                num_cpus: 2
                mem_size: 4 GB
            requirements:
                - host: openstack
        vm_2:
            type: VirtualMachine
            properties:
                num_cpus: 2
                mem_size: 4 GB
            requirements:
                - host: openstack
        openstack:
            type: OpenStack
    groups:
        database_group:
            type: tosca.groups.Root
            members:
                - mysql_database
                - dbms
    policies:
        - placement_policy:
              type: tosca.policies.placement
              targets:
                  - vm_1
                  - vm_2
    relationship_templates:
        my_db_connection:
            type: ConnectsTo
            interfaces:
                Configure:
                    pre_configure_source: scripts/wp_db_configure.sh

Query

The following query is executed.

FROM templates/tests/query/template.yaml SELECT node_templates.*{"Node Name": name, "Node Type": type}

Query Result

The following query result is expected.

- Node Name: webapp
  Node Type: WebApplication
- Node Name: tomcat
  Node Type: Tomcat
- Node Name: mysql_database
  Node Type: Database
- Node Name: dbms
  Node Type: DBMS
- Node Name: vm_1
  Node Type: VirtualMachine
- Node Name: vm_2
  Node Type: VirtualMachine
- Node Name: openstack
  Node Type: OpenStack

Last update: November 18, 2024