Skip to content

node-template

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.webapp

Query Result

The following query result is expected.

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

Last update: March 27, 2024