Open lauwers opened 2 years ago
Capability filter functionality is now fully supported using the new node_filter
syntax described in https://docs.oasis-open.org/tosca/TOSCA/v2.0/csd05/TOSCA-v2.0-csd05.html#_Toc125468604. The following shows a complete capability filter example:
tosca_definitions_version: tosca_2_0
capability_types:
ProviderCapability:
properties:
performance:
type: string
validation:
$valid_values: [ $value, [ high, medium, low ] ]
relationship_types:
ServedBy: {}
node_types:
Server:
capabilities:
service:
type: ProviderCapability
Client:
requirements:
- server:
capability: ProviderCapability
relationship: ServedBy
service_template:
node_templates:
client:
type: Client
requirements:
- server:
node: Server
node_filter:
$equal:
- $get_property: [ SELF, CAPABILITY, performance ]
- high
high_performance_server:
type: Server
capabilities:
service:
properties:
performance: high
low_performance_server:
type: Server
capabilities:
service:
properties:
performance: low
Requirement definitions and assignments support a node_filter keyword to narrow down the set of target nodes that can be used to fulfill a requirement. This keyword presumes that the node type of the target node is provided (using the node keyword in the requirement definition or requirement assignment). When the node type is not specified, target filters can not be applied. To remedy this situation, we should add support for capability filters that narrow down the set of possible targets based on constraints on the values of the properties of the target capability. To harmonize support for node filters and capability filters, I propose that we introduce an extended notation for defining target capability type and target node types in requirement definitions as in the following example:
Similar syntax would be used inside the requirement assignment. Of course, if no filters are provided, the old single-line syntax should still work.