Skip to content

resolve-simple

This test is of type template.

Service Template

The following service template is used.

tests/query/resolve-simple/template.yaml
tosca_definitions_version: tosca_simple_yaml_1_3
topology_template:
  node_templates:
    webapp:
      type: WebApplication
      properties:
        db_username: executeQuery(SELECT node_templates.mysql_database.properties.username)
        db_password: executeQuery(SELECT node_templates.mysql_database.properties.password)
        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: user
        db_password: password
        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: March 27, 2024