Skip to content

match-rel-filter

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 MATCH ()-{[type="ConnectsTo"]}->(node2) SELECT node2

Query Result

The following query result is expected.

1
2
3
4
dbms:
    type: DBMS
    requirements:
        - host: vm_2

Last update: December 13, 2024