Add test templates for topology template
The templates is used for testing topology template functions. They contain most of the features provided by topology template. But still need improvement as the development of the TOSCA spec going on. subsystem.yaml is used to test elements in topology template. system.yaml is used to test substitution mapping. For it is not well defined currently, it will be implemented later. definition.yaml provides definitions required by the above two files. partially implements: bp tosca-topology-template Change-Id: I73006bb2880a69d20b647db750d806c87d0edfeb
This commit is contained in:
parent
c0a2e2621e
commit
305d7584ed
@ -0,0 +1,44 @@
|
||||
tosca_definitions_version: tosca_simple_yaml_1_0_0
|
||||
|
||||
node_types:
|
||||
example.TransactionSubsystem:
|
||||
properties:
|
||||
mq_server_ip:
|
||||
type: string
|
||||
receiver_port:
|
||||
type: integer
|
||||
attributes:
|
||||
receiver_ip:
|
||||
type: string
|
||||
receiver_port:
|
||||
type: integer
|
||||
capabilities:
|
||||
message_receiver:
|
||||
type: example.capabilities.Receiver
|
||||
requirements:
|
||||
- database_endpoint: tosca.capabilities.Endpoint.Database
|
||||
|
||||
example.QueuingSubsystem:
|
||||
derived_from: tosca.nodes.SoftwareComponent
|
||||
|
||||
example.DatabaseSubsystem:
|
||||
derived_from: tosca.nodes.Database
|
||||
|
||||
example.SomeApp:
|
||||
derived_from: tosca.nodes.SoftwareComponent
|
||||
properties:
|
||||
admin_user:
|
||||
type: string
|
||||
pool_size:
|
||||
type: integer
|
||||
capabilities:
|
||||
message_receiver:
|
||||
type: example.capabilities.Receiver
|
||||
|
||||
capability_types:
|
||||
example.capabilities.Receiver:
|
||||
derived_from: tosca.capabilities.Endpoint
|
||||
properties:
|
||||
server_ip:
|
||||
type: string
|
||||
|
@ -0,0 +1,82 @@
|
||||
tosca_definitions_version: tosca_simple_yaml_1_0_0
|
||||
|
||||
description: >
|
||||
Service template with topology_template, act as a nested system inside another system.
|
||||
|
||||
imports:
|
||||
- definitions.yaml
|
||||
|
||||
topology_template:
|
||||
description: Template of a database including its hosting stack.
|
||||
|
||||
inputs:
|
||||
mq_server_ip:
|
||||
type: string
|
||||
description: IP address of the message queuing server to receive messages from.
|
||||
receiver_port:
|
||||
type: string
|
||||
description: Port to be used for receiving messages.
|
||||
my_cpus:
|
||||
type: integer
|
||||
description: Number of CPUs for the server.
|
||||
constraints:
|
||||
- valid_values: [ 1, 2, 4, 8 ]
|
||||
|
||||
substitution_mappings:
|
||||
node_type: example.TransactionSubsystem
|
||||
capabilities:
|
||||
message_receiver: [ app, message_receiver ]
|
||||
requirements:
|
||||
database_endpoint: [ app, database ]
|
||||
|
||||
node_templates:
|
||||
app:
|
||||
type: example.SomeApp
|
||||
properties:
|
||||
admin_user: foo
|
||||
pool_size: 10
|
||||
capabilities:
|
||||
message_receiver:
|
||||
properties:
|
||||
server_ip: { get_input: mq_server_ip }
|
||||
requirements:
|
||||
- host: websrv
|
||||
|
||||
websrv:
|
||||
type: tosca.nodes.WebServer
|
||||
capabilities:
|
||||
data_endpoint:
|
||||
properties:
|
||||
port_name: { get_input: receiver_port }
|
||||
requirements:
|
||||
- host: server
|
||||
|
||||
server:
|
||||
type: tosca.nodes.Compute
|
||||
properties:
|
||||
disk_size: 10 GB
|
||||
num_cpus: { get_input: my_cpus }
|
||||
mem_size: 4096 MB
|
||||
capabilities:
|
||||
os:
|
||||
properties:
|
||||
architecture: x86_64
|
||||
type: Linux
|
||||
distribution: Ubuntu
|
||||
version: 14.04
|
||||
|
||||
outputs:
|
||||
receiver_ip:
|
||||
description: private IP address of the message receiver application
|
||||
value: { get_attribute: [ server, private_address ] }
|
||||
# It seems current _process_intrisic_function can not handle more than 2 arguments, save it for later
|
||||
# receiver_port:
|
||||
# description: Port of the message receiver endpoint
|
||||
# value: { get_attribute: [ app, data_endpoint, port_name ] }
|
||||
|
||||
groups:
|
||||
webserver_group:
|
||||
members: [ websrv, server ]
|
||||
policies:
|
||||
- policy_name: none
|
||||
|
46
translator/toscalib/tests/data/topology_template/system.yaml
Normal file
46
translator/toscalib/tests/data/topology_template/system.yaml
Normal file
@ -0,0 +1,46 @@
|
||||
tosca_definitions_version: tosca_simple_yaml_1_0_0
|
||||
|
||||
topology_template:
|
||||
description: Template of online transaction processing service.
|
||||
|
||||
node_templates:
|
||||
mq:
|
||||
type: example.QueuingSubsystem
|
||||
# properties:
|
||||
# to be updated when substitution_mapping is implemented
|
||||
# capabilities:
|
||||
# message_queue_endpoint:
|
||||
# to be updated when substitution_mapping is implemented
|
||||
requirements:
|
||||
- receiver: trans1
|
||||
- receiver: trans2
|
||||
|
||||
trans1:
|
||||
type: example.TransactionSubsystem
|
||||
properties:
|
||||
mq_server_ip: { get_attribute: [ mq, server_ip ] }
|
||||
receiver_port: 8080
|
||||
# capabilities:
|
||||
# message_receiver:
|
||||
# to be updated when substitution_mapping is implemented
|
||||
requirements:
|
||||
- database_endpoint: dbsys
|
||||
|
||||
trans2:
|
||||
type: example.TransactionSubsystem
|
||||
properties:
|
||||
mq_server_ip: { get_attribute: [ mq, server_ip ] }
|
||||
receiver_port: 8080
|
||||
# capabilities:
|
||||
# message_receiver:
|
||||
# to be updated when substitution_mapping is implemented
|
||||
requirements:
|
||||
- database_endpoint: dbsys
|
||||
|
||||
dbsys:
|
||||
type: example.DatabaseSubsystem
|
||||
# properties:
|
||||
# to be updated when substitution_mapping is implemented
|
||||
# capabilities:
|
||||
# database_endpoint:
|
||||
# to be updated when substitution_mapping is implemented
|
Loading…
x
Reference in New Issue
Block a user