aria_extension_tosca.simple_v1_0.modeling

Creates ARIA service template models based on the TOSCA presentation.

Relies on many helper methods in the presentation classes.

aria_extension_tosca.simple_v1_0.modeling.create_artifact_template_model(context, service_template, artifact)
aria_extension_tosca.simple_v1_0.modeling.create_capability_template_model(context, service_template, capability)
aria_extension_tosca.simple_v1_0.modeling.create_constraint(context, node_filter, constraint_clause, property_name, capability_name)
aria_extension_tosca.simple_v1_0.modeling.create_group_template_model(context, service_template, group)
aria_extension_tosca.simple_v1_0.modeling.create_interface_template_model(context, service_template, interface)
aria_extension_tosca.simple_v1_0.modeling.create_interface_template_models(context, service_template, interfaces, source_interfaces)
aria_extension_tosca.simple_v1_0.modeling.create_metadata_models(context, service_template, metadata)
aria_extension_tosca.simple_v1_0.modeling.create_node_filter_constraints(context, node_filter, target_node_template_constraints)
aria_extension_tosca.simple_v1_0.modeling.create_node_template_model(context, service_template, node_template)
aria_extension_tosca.simple_v1_0.modeling.create_operation_template_model(context, service_template, operation)
aria_extension_tosca.simple_v1_0.modeling.create_parameter_models_from_assignments(properties, source_properties, model_cls)
aria_extension_tosca.simple_v1_0.modeling.create_parameter_models_from_values(properties, source_properties, model_cls)
aria_extension_tosca.simple_v1_0.modeling.create_plugin_specification_model(context, policy)
aria_extension_tosca.simple_v1_0.modeling.create_policy_template_model(context, service_template, policy)
aria_extension_tosca.simple_v1_0.modeling.create_relationship_template_model(context, service_template, relationship)
aria_extension_tosca.simple_v1_0.modeling.create_requirement_template_model(context, service_template, requirement)
aria_extension_tosca.simple_v1_0.modeling.create_service_template_model(context)
aria_extension_tosca.simple_v1_0.modeling.create_substitution_template_model(context, service_template, substitution_mappings)
aria_extension_tosca.simple_v1_0.modeling.create_types(context, root, types)
aria_extension_tosca.simple_v1_0.modeling.create_workflow_operation_template_model(context, service_template, policy)
aria_extension_tosca.simple_v1_0.modeling.extract_implementation_primary(context, service_template, presentation, model, primary)
aria_extension_tosca.simple_v1_0.modeling.fix_node_template_model(context, service_template, node_template)
aria_extension_tosca.simple_v1_0.modeling.set_nested(the_dict, keys, value)

If the keys list has just one item, puts the value in the the dict. If there are more items, puts the value in a sub-dict, creating sub-dicts as necessary for each key.

For example, if the_dict is an empty dict, keys is ['first', 'second', 'third'] and value is 'value', then the_dict will be: {'first':{'second':{'third':'value'}}}.

Parameters:
  • the_dict ({}) – Dict to change
  • keys ([basestring]) – Keys
  • value – Value
aria_extension_tosca.simple_v1_0.modeling.split_prefix(string)

Splits the prefix on the first non-escaped “>”.

aria_extension_tosca.simple_v1_0.modeling.artifacts

aria_extension_tosca.simple_v1_0.modeling.artifacts.get_inherited_artifact_definitions(context, presentation, for_presentation=None)

aria_extension_tosca.simple_v1_0.modeling.capabilities

aria_extension_tosca.simple_v1_0.modeling.capabilities.convert_capability_from_definition_to_assignment(context, presentation, container)
aria_extension_tosca.simple_v1_0.modeling.capabilities.get_inherited_capability_definitions(context, presentation, for_presentation=None)

Returns our capability capability definitions added on top of those of our parent, if we have one (recursively).

Allows overriding all aspects of parent capability properties except data type.

aria_extension_tosca.simple_v1_0.modeling.capabilities.get_inherited_valid_source_types(context, presentation)

If we haven’t set the valid_source_types fields, uses that value from our parent, if we have one (recursively).

aria_extension_tosca.simple_v1_0.modeling.capabilities.get_template_capabilities(context, presentation)

Returns the node type’s capabilities with our assignments to properties and attributes merged in.

Capability properties’ default values, if available, will be used if we did not assign them.

Makes sure that required properties indeed end up with a value.

aria_extension_tosca.simple_v1_0.modeling.capabilities.merge_capability_definition_from_type(context, presentation, capability_definition)

aria_extension_tosca.simple_v1_0.modeling.constraints

class aria_extension_tosca.simple_v1_0.modeling.constraints.Equal(property_name, capability_name, constraint, as_list=False)

Bases: aria_extension_tosca.simple_v1_0.modeling.constraints.EvaluatingNodeTemplateConstraint

matches_evaluated(value, constraint)
class aria_extension_tosca.simple_v1_0.modeling.constraints.EvaluatingNodeTemplateConstraint(property_name, capability_name, constraint, as_list=False)

Bases: aria.modeling.constraints.NodeTemplateConstraint

A version of NodeTemplateConstraint with boilerplate initialization for TOSCA constraints.

matches(source_node_template, target_node_template)
matches_evaluated(value, constraint)
class aria_extension_tosca.simple_v1_0.modeling.constraints.GreaterOrEqual(property_name, capability_name, constraint, as_list=False)

Bases: aria_extension_tosca.simple_v1_0.modeling.constraints.EvaluatingNodeTemplateConstraint

matches_evaluated(value, constraint)
class aria_extension_tosca.simple_v1_0.modeling.constraints.GreaterThan(property_name, capability_name, constraint, as_list=False)

Bases: aria_extension_tosca.simple_v1_0.modeling.constraints.EvaluatingNodeTemplateConstraint

matches_evaluated(value, constraint)
class aria_extension_tosca.simple_v1_0.modeling.constraints.InRange(property_name, capability_name, constraint)

Bases: aria_extension_tosca.simple_v1_0.modeling.constraints.EvaluatingNodeTemplateConstraint

matches_evaluated(value, constraints)
class aria_extension_tosca.simple_v1_0.modeling.constraints.Length(property_name, capability_name, constraint, as_list=False)

Bases: aria_extension_tosca.simple_v1_0.modeling.constraints.EvaluatingNodeTemplateConstraint

matches_evaluated(value, constraint)
class aria_extension_tosca.simple_v1_0.modeling.constraints.LessOrEqual(property_name, capability_name, constraint, as_list=False)

Bases: aria_extension_tosca.simple_v1_0.modeling.constraints.EvaluatingNodeTemplateConstraint

matches_evaluated(value, constraint)
class aria_extension_tosca.simple_v1_0.modeling.constraints.LessThan(property_name, capability_name, constraint, as_list=False)

Bases: aria_extension_tosca.simple_v1_0.modeling.constraints.EvaluatingNodeTemplateConstraint

matches_evaluated(value, constraint)
class aria_extension_tosca.simple_v1_0.modeling.constraints.MaxLength(property_name, capability_name, constraint, as_list=False)

Bases: aria_extension_tosca.simple_v1_0.modeling.constraints.EvaluatingNodeTemplateConstraint

matches_evaluated(value, constraint)
class aria_extension_tosca.simple_v1_0.modeling.constraints.MinLength(property_name, capability_name, constraint, as_list=False)

Bases: aria_extension_tosca.simple_v1_0.modeling.constraints.EvaluatingNodeTemplateConstraint

matches_evaluated(value, constraint)
class aria_extension_tosca.simple_v1_0.modeling.constraints.Pattern(property_name, capability_name, constraint, as_list=False)

Bases: aria_extension_tosca.simple_v1_0.modeling.constraints.EvaluatingNodeTemplateConstraint

matches_evaluated(value, constraint)
class aria_extension_tosca.simple_v1_0.modeling.constraints.ValidValues(property_name, capability_name, constraint)

Bases: aria_extension_tosca.simple_v1_0.modeling.constraints.EvaluatingNodeTemplateConstraint

matches_evaluated(value, constraints)

aria_extension_tosca.simple_v1_0.modeling.copy

aria_extension_tosca.simple_v1_0.modeling.copy.get_default_raw_from_copy(presentation, field_name)

Used for the _get_default_raw field hook.

aria_extension_tosca.simple_v1_0.modeling.data_types

aria_extension_tosca.simple_v1_0.modeling.data_types.apply_constraint_to_value(context, presentation, constraint_clause, value)

Returns false if the value does not conform to the constraint.

aria_extension_tosca.simple_v1_0.modeling.data_types.apply_constraints_to_value(context, presentation, constraints, value)

Applies all constraints to the value. If the value conforms, returns the value. If it does not conform, returns None.

aria_extension_tosca.simple_v1_0.modeling.data_types.coerce_data_type_value(context, presentation, data_type, entry_schema, constraints, value, aspect)

Handles the _coerce_data() hook for complex data types.

There are two kinds of handling:

  1. If we have a primitive type as our great ancestor, then we do primitive type coersion, and just check for constraints.
  2. Otherwise, for normal complex data types we return the assigned property values while making sure they are defined in our type. The property definition’s default value, if available, will be used if we did not assign it. We also make sure that required definitions indeed end up with a value.
aria_extension_tosca.simple_v1_0.modeling.data_types.coerce_to_data_type_class(context, presentation, cls, entry_schema, constraints, value, aspect=None)

Returns the value after it’s coerced to a data type class, reporting validation errors if it cannot be coerced. Constraints will be applied after coersion.

Will either call a _create static function in the class, or instantiate it using a constructor if _create is not available.

This will usually be called by a coerce_value extension hook in a DataType.

aria_extension_tosca.simple_v1_0.modeling.data_types.coerce_to_primitive(context, presentation, primitive_type, constraints, value, aspect=None)

Returns the value after it’s coerced to a primitive type, translating exceptions to validation errors if it cannot be coerced.

aria_extension_tosca.simple_v1_0.modeling.data_types.coerce_value(context, presentation, the_type, entry_schema, constraints, value, aspect=None)

Returns the value after it’s coerced to its type, reporting validation errors if it cannot be coerced.

Supports both complex data types and primitives.

Data types can use the coerce_value extension to hook their own specialized function. If the extension is present, we will delegate to that hook.

aria_extension_tosca.simple_v1_0.modeling.data_types.get_container_data_type(presentation)
aria_extension_tosca.simple_v1_0.modeling.data_types.get_data_type(context, presentation, field_name, allow_none=False)

Returns the type, whether it’s a complex data type (a DataType instance) or a primitive (a Python primitive type class).

If the type is not specified, defaults to str, per note in section 3.2.1.1 of the TOSCA Simple Profile v1.0 cos01 specification

aria_extension_tosca.simple_v1_0.modeling.data_types.get_data_type_name(the_type)

Returns the name of the type, whether it’s a DataType, a primitive type, or another class.

aria_extension_tosca.simple_v1_0.modeling.data_types.get_data_type_value(context, presentation, field_name, type_name)
aria_extension_tosca.simple_v1_0.modeling.data_types.get_inherited_constraints(context, presentation)

If we don’t have constraints, will return our parent’s constraints (if we have one), recursively.

Implication: if we define even one constraint, the parent’s constraints will not be inherited.

aria_extension_tosca.simple_v1_0.modeling.data_types.get_primitive_data_type(type_name)

Many of the types we use in this profile are built-in types from the YAML 1.2 specification (i.e., those identified by the “tag:yaml.org,2002” version tag) [YAML-1.2].

See the TOSCA Simple Profile v1.0 cos01 specification

aria_extension_tosca.simple_v1_0.modeling.data_types.get_property_constraints(context, presentation)

If we don’t have constraints, will return our type’s constraints (if we have one), recursively.

Implication: if we define even one constraint, the type’s constraints will not be inherited.

aria_extension_tosca.simple_v1_0.modeling.data_types.report_issue_for_bad_format(context, presentation, the_type, value, aspect, e)
aria_extension_tosca.simple_v1_0.modeling.data_types.validate_data_type_name(context, presentation)

Makes sure the complex data type’s name is not that of a built-in type.

aria_extension_tosca.simple_v1_0.modeling.functions

class aria_extension_tosca.simple_v1_0.modeling.functions.Concat(context, presentation, argument)

Bases: aria.modeling.functions.Function

The concat function is used to concatenate two or more string values within a TOSCA service template.

__evaluate__(container_holder)
as_raw
class aria_extension_tosca.simple_v1_0.modeling.functions.GetArtifact(context, presentation, argument)

Bases: aria.modeling.functions.Function

The get_artifact function is used to retrieve artifact location between modelable entities defined in the same service template.

as_raw
class aria_extension_tosca.simple_v1_0.modeling.functions.GetAttribute(context, presentation, argument)

Bases: aria.modeling.functions.Function

The get_attribute function is used to retrieve the values of named attributes declared by the referenced node or relationship template name.

__evaluate__(container_holder)
as_raw
class aria_extension_tosca.simple_v1_0.modeling.functions.GetInput(context, presentation, argument)

Bases: aria.modeling.functions.Function

The get_input function is used to retrieve the values of properties declared within the inputs section of a TOSCA Service Template.

__evaluate__(container_holder)
as_raw
class aria_extension_tosca.simple_v1_0.modeling.functions.GetNodesOfType(context, presentation, argument)

Bases: aria.modeling.functions.Function

The get_nodes_of_type function can be used to retrieve a list of all known instances of nodes of the declared Node Type.

__evaluate__(container)
as_raw
class aria_extension_tosca.simple_v1_0.modeling.functions.GetOperationOutput(context, presentation, argument)

Bases: aria.modeling.functions.Function

The get_operation_output function is used to retrieve the values of variables exposed / exported from an interface operation.

as_raw
class aria_extension_tosca.simple_v1_0.modeling.functions.GetProperty(context, presentation, argument)

Bases: aria.modeling.functions.Function

The get_property function is used to retrieve property values between modelable entities defined in the same service template.

__evaluate__(container_holder)
as_raw
class aria_extension_tosca.simple_v1_0.modeling.functions.Token(context, presentation, argument)

Bases: aria.modeling.functions.Function

The token function is used within a TOSCA service template on a string to parse out (tokenize) substrings separated by one or more token characters within a larger string.

__evaluate__(container_holder)
as_raw
aria_extension_tosca.simple_v1_0.modeling.functions.evaluate(value, final, container_holder)

Calls __evaluate__ and passes on final state.

aria_extension_tosca.simple_v1_0.modeling.functions.get_function(context, presentation, value)
aria_extension_tosca.simple_v1_0.modeling.functions.get_hosts(container_holder, name, locator)

A TOSCA orchestrator will interpret this keyword to refer to the all nodes that “host” the node using this reference (i.e., as identified by its HostedOn relationship).

Specifically, TOSCA orchestrators that encounter this keyword when evaluating the get_attribute or get_property functions SHALL search each node along the “HostedOn” relationship chain starting at the immediate node that hosts the node where the function was evaluated (and then that node’s host node, and so forth) until a match is found or the “HostedOn” relationship chain ends.

aria_extension_tosca.simple_v1_0.modeling.functions.get_modelable_entities(container_holder, name, locator, modelable_entity_name)

The following keywords MAY be used in some TOSCA function in place of a TOSCA Node or Relationship Template name.

aria_extension_tosca.simple_v1_0.modeling.functions.get_modelable_entity_parameter(modelable_entity, parameters, nested_parameter_name_or_index)
aria_extension_tosca.simple_v1_0.modeling.functions.get_self(container_holder, name, locator)

A TOSCA orchestrator will interpret this keyword as the Node or Relationship Template instance that contains the function at the time the function is evaluated.

aria_extension_tosca.simple_v1_0.modeling.functions.get_source(container_holder, name, locator)

A TOSCA orchestrator will interpret this keyword as the Node Template instance that is at the source end of the relationship that contains the referencing function.

aria_extension_tosca.simple_v1_0.modeling.functions.get_target(container_holder, name, locator)

A TOSCA orchestrator will interpret this keyword as the Node Template instance that is at the target end of the relationship that contains the referencing function.

aria_extension_tosca.simple_v1_0.modeling.functions.invalid_modelable_entity_name(name, index, value, locator, contexts)
aria_extension_tosca.simple_v1_0.modeling.functions.invalid_value(name, index, the_type, explanation, value, locator)
aria_extension_tosca.simple_v1_0.modeling.functions.parse_bool(context, presentation, name, index, explanation, value)
aria_extension_tosca.simple_v1_0.modeling.functions.parse_int(context, presentation, name, index, explanation, value)
aria_extension_tosca.simple_v1_0.modeling.functions.parse_modelable_entity_name(context, presentation, name, index, value)
aria_extension_tosca.simple_v1_0.modeling.functions.parse_self(presentation)
aria_extension_tosca.simple_v1_0.modeling.functions.parse_string_expression(context, presentation, name, index, explanation, value)

aria_extension_tosca.simple_v1_0.modeling.interfaces

aria_extension_tosca.simple_v1_0.modeling.interfaces.assign_raw_inputs(context, values, assignments, definitions, interface_name, operation_name, presentation)
aria_extension_tosca.simple_v1_0.modeling.interfaces.convert_interface_definition_from_type_to_raw_template(context, presentation)
aria_extension_tosca.simple_v1_0.modeling.interfaces.convert_interface_definition_from_type_to_template(context, presentation, container)
aria_extension_tosca.simple_v1_0.modeling.interfaces.convert_requirement_interface_definitions_from_type_to_raw_template(context, raw_requirement, interface_definitions)
aria_extension_tosca.simple_v1_0.modeling.interfaces.get_and_override_input_definitions_from_type(context, presentation)

Returns our input definitions added on top of those of the interface type, if specified.

Allows overriding all aspects of parent interface type inputs except data types.

aria_extension_tosca.simple_v1_0.modeling.interfaces.get_and_override_operation_definitions_from_type(context, presentation)

Returns our operation definitions added on top of those of the interface type, if specified.

Allows overriding all aspects of parent interface type inputs except data types.

aria_extension_tosca.simple_v1_0.modeling.interfaces.get_inherited_interface_definitions(context, presentation, type_name, for_presentation=None)

Returns our interface definitions added on top of those of our parent, if we have one (recursively).

Allows overriding all aspects of parent interfaces except interface and operation input data types.

aria_extension_tosca.simple_v1_0.modeling.interfaces.get_inherited_operations(context, presentation)

Returns our operation definitions added on top of those of our parent, if we have one (recursively).

Allows overriding all aspects of parent operations except input data types.

aria_extension_tosca.simple_v1_0.modeling.interfaces.get_template_interfaces(context, presentation, type_name)

Returns the assigned interface_template values while making sure they are defined in the type. This includes the interfaces themselves, their operations, and inputs for interfaces and operations.

Interface and operation inputs’ default values, if available, will be used if we did not assign them.

Makes sure that required inputs indeed end up with a value.

This code is especially complex due to the many levels of nesting involved.

aria_extension_tosca.simple_v1_0.modeling.interfaces.merge_input_definitions(context, inputs, our_inputs, interface_name, operation_name, presentation, type_name)
aria_extension_tosca.simple_v1_0.modeling.interfaces.merge_interface(context, presentation, interface_assignment, our_interface_assignment, interface_definition, interface_name)
aria_extension_tosca.simple_v1_0.modeling.interfaces.merge_interface_definition(context, interface, our_source, presentation, type_name)
aria_extension_tosca.simple_v1_0.modeling.interfaces.merge_interface_definitions(context, interfaces, our_interfaces, presentation, for_presentation=None)
aria_extension_tosca.simple_v1_0.modeling.interfaces.merge_interface_definitions_from_their_types(context, interfaces, presentation)
aria_extension_tosca.simple_v1_0.modeling.interfaces.merge_operation_definitions(context, operations, our_operations, interface_name, presentation, type_name)
aria_extension_tosca.simple_v1_0.modeling.interfaces.merge_raw_input_definition(context, the_raw_input, our_input, interface_name, operation_name, presentation, type_name)
aria_extension_tosca.simple_v1_0.modeling.interfaces.merge_raw_input_definitions(context, raw_inputs, our_inputs, interface_name, operation_name, presentation, type_name)
aria_extension_tosca.simple_v1_0.modeling.interfaces.merge_raw_operation_definition(context, raw_operation, our_operation, interface_name, presentation, type_name)
aria_extension_tosca.simple_v1_0.modeling.interfaces.merge_raw_operation_definitions(context, raw_operations, our_operations, interface_name, presentation, type_name)
aria_extension_tosca.simple_v1_0.modeling.interfaces.validate_required_inputs(context, presentation, assignment, definition, original_assignment, interface_name, operation_name=None)

aria_extension_tosca.simple_v1_0.modeling.parameters

aria_extension_tosca.simple_v1_0.modeling.parameters.coerce_parameter_value(context, presentation, definition, value, aspect=None)
aria_extension_tosca.simple_v1_0.modeling.parameters.convert_parameter_definitions_to_values(context, definitions)
aria_extension_tosca.simple_v1_0.modeling.parameters.get_assigned_and_defined_parameter_values(context, presentation, field_name)

Returns the assigned property values while making sure they are defined in our type.

The property definition’s default value, if available, will be used if we did not assign it.

Makes sure that required properties indeed end up with a value.

aria_extension_tosca.simple_v1_0.modeling.parameters.get_inherited_parameter_definitions(context, presentation, field_name, for_presentation=None)

Returns our parameter definitions added on top of those of our parent, if we have one (recursively).

Allows overriding all aspects of parent properties except data type.

aria_extension_tosca.simple_v1_0.modeling.parameters.get_parameter_values(context, presentation, field_name)
aria_extension_tosca.simple_v1_0.modeling.parameters.merge_parameter_definitions(context, presentation, property_definitions, our_property_definitions, field_name)
aria_extension_tosca.simple_v1_0.modeling.parameters.merge_raw_parameter_definition(context, presentation, raw_property_definition, our_property_definition, field_name, property_name)
aria_extension_tosca.simple_v1_0.modeling.parameters.merge_raw_parameter_definitions(context, presentation, raw_property_definitions, our_property_definitions, field_name)
aria_extension_tosca.simple_v1_0.modeling.parameters.validate_required_values(context, presentation, values, definitions)

Check if required properties have not been assigned.

aria_extension_tosca.simple_v1_0.modeling.policies

aria_extension_tosca.simple_v1_0.modeling.policies.get_inherited_targets(context, presentation)

Returns our target node types and group types if we have them or those of our parent, if we have one (recursively).

aria_extension_tosca.simple_v1_0.modeling.policies.get_policy_targets(context, presentation)

Returns our target node templates and groups if we have them.

aria_extension_tosca.simple_v1_0.modeling.requirements

aria_extension_tosca.simple_v1_0.modeling.requirements.add_requirement_assignments(context, presentation, requirement_assignments, requirement_definitions, our_requirement_assignments)
aria_extension_tosca.simple_v1_0.modeling.requirements.convert_requirement_from_definition_to_assignment(context, requirement_definition, our_requirement_assignment, container)
aria_extension_tosca.simple_v1_0.modeling.requirements.get_first_requirement(requirement_definitions, name)
aria_extension_tosca.simple_v1_0.modeling.requirements.get_inherited_requirement_definitions(context, presentation)

Returns our requirement definitions added on top of those of our parent, if we have one (recursively).

Allows overriding requirement definitions if they have the same name.

aria_extension_tosca.simple_v1_0.modeling.requirements.get_template_requirements(context, presentation)

Returns our requirements added on top of those of the node type if they exist there.

If the requirement has a relationship, the relationship properties and interfaces are assigned.

Returns the assigned property, interface input, and interface operation input values while making sure they are defined in our type. Default values, if available, will be used if we did not assign them. Also makes sure that required properties and inputs indeed end up with a value.

aria_extension_tosca.simple_v1_0.modeling.requirements.merge_requirement_assignment(context, relationship_property_definitions, relationship_interface_definitions, requirement, our_requirement)
aria_extension_tosca.simple_v1_0.modeling.requirements.merge_requirement_assignment_relationship(context, presentation, property_definitions, interface_definitions, requirement, our_relationship)
aria_extension_tosca.simple_v1_0.modeling.requirements.validate_requirement_assignment(context, presentation, requirement_assignment, relationship_property_definitions, relationship_interface_definitions)

aria_extension_tosca.simple_v1_0.modeling.substitution_mappings

aria_extension_tosca.simple_v1_0.modeling.substitution_mappings.get_node_template(context, presentation, name)
aria_extension_tosca.simple_v1_0.modeling.substitution_mappings.validate_format(context, presentation, name)
aria_extension_tosca.simple_v1_0.modeling.substitution_mappings.validate_subtitution_mappings_capability(context, presentation)
aria_extension_tosca.simple_v1_0.modeling.substitution_mappings.validate_subtitution_mappings_requirement(context, presentation)