Description:

policy2tosca module injects "policy types" and "policy definitions" into an existing Tosca Service template.

APIs

policy2tosca add-type --policy_type <policy_type_name> --derived_from <parent_policy_type_name> --v <version_number> --targets <target1,target2,...,targetN> --metadata <metadata> – description <description> --properties <p1,p2,...,pn> --triggers <t1,t2,...,tk> --source <tosca_yaml_file>

Behavior: check if policy type area exists in the source file, if it does not create one. If <policy_type_name> exists in policy type area in the sourced <tosca_yaml_file>,  create a new one with the specified fields, else update the existing one. 

policy2tosca delete-type --policy_type <policy_type_name>

policy2tosca add-def --policy_name <policy_name> --policy_type <policy_type_name> --description <description> --metadata <metadata> --properties <p1,p2,...,pn> --targets <target1,target2,...,targetN> --triggers <t1,t2,...,tk> --source <tosca_yaml_file>

Behavior: check if <policy_name> exists under "policies:" under "topology_template:" in the sourced <tosca_yaml_file>. If not, create this new policy definition with the specified fields. Else update the existing one.

policy2tosca delete-policy --policy_name <policy_name>

ETHERPAD

Use the following etherpad for design related discussions: https://etherpad.opnfv.org/p/policy2tosca

REFERENCES from Tosca Simple Profile YAML v1.1

Policy in Tosca

Policy Example - I

Normative Policy Types

Policy Type

Policy Triggers

Policy Definitions

Topology Template