From d55db757dbbbd506b5a9854f32f3c23491360816 Mon Sep 17 00:00:00 2001 From: Shaik Apsar Date: Tue, 12 Jul 2016 16:03:46 -0400 Subject: [PATCH] Implement tacker workflows 1. std.create_vnf for VNF creation. 2. std.create_vnfd for VNFD creation. 3. std.delete_vnf for VNF deletion. 4. std.delete_vnfd for VNFD deletion. Change-Id: I2c16c771d468db58728218fcf94154796e955ebb Implements: blueprint tacker-workflows --- .../devref/mistral_workflows_usage_guide.rst | 504 ++++++++++++++++++ doc/source/index.rst | 1 + ...-workflow-definition-1a5b7790b69f9eb7.yaml | 3 + samples/mistral/workflows/create_vnf.yaml | 53 ++ samples/mistral/workflows/create_vnfd.yaml | 22 + samples/mistral/workflows/delete_vnf.yaml | 16 + samples/mistral/workflows/delete_vnfd.yaml | 16 + .../mistral/workflows/input/create_vnf.json | 11 + .../mistral/workflows/input/create_vnfd.json | 10 + .../mistral/workflows/input/delete_vnf.json | 3 + .../mistral/workflows/input/delete_vnfd.json | 3 + 11 files changed, 642 insertions(+) create mode 100644 doc/source/devref/mistral_workflows_usage_guide.rst create mode 100644 releasenotes/notes/tacker-workflow-definition-1a5b7790b69f9eb7.yaml create mode 100644 samples/mistral/workflows/create_vnf.yaml create mode 100644 samples/mistral/workflows/create_vnfd.yaml create mode 100644 samples/mistral/workflows/delete_vnf.yaml create mode 100644 samples/mistral/workflows/delete_vnfd.yaml create mode 100644 samples/mistral/workflows/input/create_vnf.json create mode 100644 samples/mistral/workflows/input/create_vnfd.json create mode 100644 samples/mistral/workflows/input/delete_vnf.json create mode 100644 samples/mistral/workflows/input/delete_vnfd.json diff --git a/doc/source/devref/mistral_workflows_usage_guide.rst b/doc/source/devref/mistral_workflows_usage_guide.rst new file mode 100644 index 000000000..a07747056 --- /dev/null +++ b/doc/source/devref/mistral_workflows_usage_guide.rst @@ -0,0 +1,504 @@ +.. + Licensed under the Apache License, Version 2.0 (the "License"); you may + not use this file except in compliance with the License. You may obtain + a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + License for the specific language governing permissions and limitations + under the License. + +.. _ref-mistral: + +============================ +Mistral workflows for Tacker +============================ + +OpenStack Mistral already integrated with Tacker. The Tenant User or Operator +can make use of tacker actions to create custom Mistral Workflows. This +document describes the usage of Mistral CLI to validate, create and executing +Tacker workflows. + + +References +~~~~~~~~~~ + +- `Mistral workflow samples `_. +- `Mistral Client / CLI Guide `_. + +Workflow definition file validation +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Validate workflow definition files before registering with Mistral. + +:: + + usage: mistral workflow-validate + +:: + + $ mistral workflow-validate create_vnf.yaml + + +-------+-------+ + | Field | Value | + +-------+-------+ + | Valid | True | + | Error | None | + +-------+-------+ + + $ mistral workflow-validate create_vnfd.yaml + + +-------+-------+ + | Field | Value | + +-------+-------+ + | Valid | True | + | Error | None | + +-------+-------+ + + $ mistral workflow-validate delete_vnf.yaml + + +-------+-------+ + | Field | Value | + +-------+-------+ + | Valid | True | + | Error | None | + +-------+-------+ + + $ mistral workflow-validate delete_vnfd.yaml + + +-------+-------+ + | Field | Value | + +-------+-------+ + | Valid | True | + | Error | None | + +-------+-------+ + +Registering Tacker workflows with Mistral +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +To create std.create_vnf, std.create_vnfd, std.delete_vnfd and +std.delete_vnf workflows in Mistral. + +:: + + usage: mistral workflow-create --public + +:: + + $ mistral workflow-create create_vnf.yaml --public + + +--------------------------------------+----------------+----------------------------------+--------+-------+----------------------------+------------+ + | ID | Name | Project ID | Tags | Input | Created at | Updated at | + +--------------------------------------+----------------+----------------------------------+--------+-------+----------------------------+------------+ + | 445e165a-3654-4996-aad4-c6fea65e95d5 | std.create_vnf | bde60e557de840a8a837733aaa96e42e | | body | 2016-07-29 15:08:45.585192 | None | + +--------------------------------------+----------------+----------------------------------+--------+-------+----------------------------+------------+ + + $ mistral workflow-create create_vnfd.yaml --public + + +--------------------------------------+-----------------+----------------------------------+--------+-------+----------------------------+------------+ + | ID | Name | Project ID | Tags | Input | Created at | Updated at | + +--------------------------------------+-----------------+----------------------------------+--------+-------+----------------------------+------------+ + | 926caa3e-ee59-4ca0-ac1b-cae03538e389 | std.create_vnfd | bde60e557de840a8a837733aaa96e42e | | body | 2016-07-29 15:08:54.933874 | None | + +--------------------------------------+-----------------+----------------------------------+--------+-------+----------------------------+------------+ + + $ mistral workflow-create delete_vnfd.yaml --public + + +--------------------------------------+-----------------+----------------------------------+--------+---------+----------------------------+------------+ + | ID | Name | Project ID | Tags | Input | Created at | Updated at | + +--------------------------------------+-----------------+----------------------------------+--------+---------+----------------------------+------------+ + | f15b7402-ce31-4369-98d4-818125191564 | std.delete_vnfd | bde60e557de840a8a837733aaa96e42e | | vnfd_id | 2016-08-14 20:01:00.135104 | None | + +--------------------------------------+-----------------+----------------------------------+--------+---------+----------------------------+------------+ + + $ mistral workflow-create delete_vnf.yaml --public + +--------------------------------------+----------------+----------------------------------+--------+--------+----------------------------+------------+ + | ID | Name | Project ID | Tags | Input | Created at | Updated at | + +--------------------------------------+----------------+----------------------------------+--------+--------+----------------------------+------------+ + | d6451b4e-6448-4a26-aa33-ac5e18c7a412 | std.delete_vnf | bde60e557de840a8a837733aaa96e42e | | vnf_id | 2016-08-14 20:01:08.088654 | None | + +--------------------------------------+----------------+----------------------------------+--------+--------+----------------------------+------------+ + + + +VNFD resource creation with std.create_vnfd workflow +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +To create VNFD tacker resource based on the VNFD workflow input file. + +Create new execution for VNFD creation. + +:: + + usage: mistral execution-create [] [] + +:: + + $ mistral execution-create std.create_vnfd create_vnfd.json + + +-------------------+--------------------------------------+ + | Field | Value | + +-------------------+--------------------------------------+ + | ID | 31f086aa-a3c9-4f44-b8b2-bec560e32653 | + | Workflow ID | 926caa3e-ee59-4ca0-ac1b-cae03538e389 | + | Workflow name | std.create_vnfd | + | Description | | + | Task Execution ID | | + | State | RUNNING | + | State info | None | + | Created at | 2016-07-29 15:11:19.485722 | + | Updated at | 2016-07-29 15:11:19.491694 | + +-------------------+--------------------------------------+ + +Gather execution details based on execution id. + +:: + + usage: mistral execution-get + +:: + + $mistral execution-get 31f086aa-a3c9-4f44-b8b2-bec560e32653 + + +-------------------+--------------------------------------+ + | Field | Value | + +-------------------+--------------------------------------+ + | ID | 31f086aa-a3c9-4f44-b8b2-bec560e32653 | + | Workflow ID | 926caa3e-ee59-4ca0-ac1b-cae03538e389 | + | Workflow name | std.create_vnfd | + | Description | | + | Task Execution ID | | + | State | SUCCESS | + | State info | None | + | Created at | 2016-07-29 15:11:19 | + | Updated at | 2016-07-29 15:11:21 | + +-------------------+--------------------------------------+ + +.. note:: Wait until execution state become as SUCCESS. + +Gather VNFD ID from execution output data. + +:: + + usage: mistral execution-get-output + +:: + + $ mistral execution-get-output 31f086aa-a3c9-4f44-b8b2-bec560e32653 + + Response: + + { + "vnfd_id": "fb164b77-5e24-402d-b5f4-c6596352cabe" + } + +Verify VNFD details using tacker CLI +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +:: + + $ tacker vnfd-show "fb164b77-5e24-402d-b5f4-c6596352cabe" + + +---------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | Field | Value | + +---------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | attributes | {"vnfd": "tosca_definitions_version: tosca_simple_profile_for_nfv_1_0_0\n\ndescription: Demo example\n\nmetadata:\n template_name: sample-tosca- | + | | vnfd\n\ntopology_template:\n node_templates:\n VDU1:\n type: tosca.nodes.nfv.VDU.Tacker\n properties:\n image: cirros-0.3.4-x86_64-uec\n | + | | flavor: m1.tiny\n availability_zone: nova\n mgmt_driver: noop\n config: |\n param0: key1\n param1: key2\n\n CP1:\n type: | + | | tosca.nodes.nfv.CP.Tacker\n properties:\n management: true\n anti_spoofing_protection: false\n requirements:\n - virtualLink:\n | + | | node: VL1\n - virtualBinding:\n node: VDU1\n\n CP2:\n type: tosca.nodes.nfv.CP.Tacker\n properties:\n anti_spoofing_protection: | + | | false\n requirements:\n - virtualLink:\n node: VL2\n - virtualBinding:\n node: VDU1\n\n CP3:\n type: | + | | tosca.nodes.nfv.CP.Tacker\n properties:\n anti_spoofing_protection: false\n requirements:\n - virtualLink:\n node: VL3\n - | + | | virtualBinding:\n node: VDU1\n\n VL1:\n type: tosca.nodes.nfv.VL\n properties:\n network_name: net_mgmt\n vendor: Tacker\n\n | + | | VL2:\n type: tosca.nodes.nfv.VL\n properties:\n network_name: net0\n vendor: Tacker\n\n VL3:\n type: tosca.nodes.nfv.VL\n | + | | properties:\n network_name: net1\n vendor: Tacker\n"} | + | description | Demo example | + | id | fb164b77-5e24-402d-b5f4-c6596352cabe | + | infra_driver | heat | + | mgmt_driver | noop | + | name | tacker-create-vnfd | + | service_types | {"service_type": "vnfd", "id": "db7c5077-7bbf-4bd3-87d5-e3c52daba255"} | + | tenant_id | bde60e557de840a8a837733aaa96e42e | + +---------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + +VNF resource creation with std.create_vnf workflow +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Update the vnfd_id from the output of above exection in create_vnf.json + +Create new execution for VNF creation. + +:: + + $ mistral execution-create std.create_vnf create_vnf.json + + +-------------------+--------------------------------------+ + | Field | Value | + +-------------------+--------------------------------------+ + | ID | 3bf2051b-ac2e-433b-8f18-23f57f32f184 | + | Workflow ID | 445e165a-3654-4996-aad4-c6fea65e95d5 | + | Workflow name | std.create_vnf | + | Description | | + | Task Execution ID | | + | State | RUNNING | + | State info | None | + | Created at | 2016-07-29 15:16:13.066555 | + | Updated at | 2016-07-29 15:16:13.072436 | + +-------------------+--------------------------------------+ + +Gather execution details based on execution id. + +:: + + $ mistral execution-get 3bf2051b-ac2e-433b-8f18-23f57f32f184 + + +-------------------+--------------------------------------+ + | Field | Value | + +-------------------+--------------------------------------+ + | ID | 3bf2051b-ac2e-433b-8f18-23f57f32f184 | + | Workflow ID | 445e165a-3654-4996-aad4-c6fea65e95d5 | + | Workflow name | std.create_vnf | + | Description | | + | Task Execution ID | | + | State | SUCCESS | + | State info | None | + | Created at | 2016-07-29 15:16:13 | + | Updated at | 2016-07-29 15:16:45 | + +-------------------+--------------------------------------+ + +Gather VNF ID from execution output data. + +:: + + $ mistral execution-get-output 3bf2051b-ac2e-433b-8f18-23f57f32f184 + + Response: + + { + "status": "ACTIVE", + "mgmt_url": "{\"VDU1\": \"192.168.120.7\"}", + "vim_id": "22ac5ce6-1415-460c-badf-40ffc5091f94", + "vnf_id": "1c349534-a539-4d5a-b854-033f98036cd5" + } + +Verify VNF details using tacker CLI +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +:: + + $ tacker vnf-show "1c349534-a539-4d5a-b854-033f98036cd5" + + +----------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | Field | Value | + +----------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | attributes | {"heat_template": "heat_template_version: 2013-05-23\ndescription: 'Demo example\n\n '\nparameters: {}\nresources:\n VDU1:\n type: OS::Nova::Server\n | + | | properties:\n availability_zone: nova\n config_drive: false\n flavor: m1.tiny\n image: cirros-0.3.4-x86_64-uec\n networks:\n - port:\n | + | | get_resource: CP1\n - port:\n get_resource: CP2\n - port:\n get_resource: CP3\n user_data_format: SOFTWARE_CONFIG\n CP1:\n type: | + | | OS::Neutron::Port\n properties:\n network: net_mgmt\n port_security_enabled: false\n CP2:\n type: OS::Neutron::Port\n properties:\n network: | + | | net0\n port_security_enabled: false\n CP3:\n type: OS::Neutron::Port\n properties:\n network: net1\n port_security_enabled: false\noutputs:\n | + | | mgmt_ip-VDU1:\n value:\n get_attr: [CP1, fixed_ips, 0, ip_address]\n", "monitoring_policy": "{\"vdus\": {}}"} | + | description | Demo example | + | error_reason | | + | id | 1c349534-a539-4d5a-b854-033f98036cd5 | + | instance_id | 771c53df-9f41-454c-a719-7eccd3a4eba9 | + | mgmt_url | {"VDU1": "192.168.120.7"} | + | name | tacker-create-vnf | + | placement_attr | {"vim_name": "VIM0"} | + | status | ACTIVE | + | tenant_id | bde60e557de840a8a837733aaa96e42e | + | vim_id | 22ac5ce6-1415-460c-badf-40ffc5091f94 | + +----------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + +VNF resource deletion with std.delete_vnf workflow +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Update the vnf_id from the output of above exection in delete_vnf.json + +Create new execution for VNF deletion. + +:: + + $ mistral execution-create std.delete_vnf delete_vnf.json + + +-------------------+--------------------------------------+ + | Field | Value | + +-------------------+--------------------------------------+ + | ID | 677c7bab-18ee-4a34-b1e6-a305e98ba887 | + | Workflow ID | d6451b4e-6448-4a26-aa33-ac5e18c7a412 | + | Workflow name | std.delete_vnf | + | Description | | + | Task Execution ID | | + | State | RUNNING | + | State info | None | + | Created at | 2016-08-14 20:48:00.333116 | + | Updated at | 2016-08-14 20:48:00.340124 | + +-------------------+--------------------------------------+ + +Gather execution details based on execution id. + +:: + + $ mistral execution-get 677c7bab-18ee-4a34-b1e6-a305e98ba887 + + +-------------------+--------------------------------------+ + | Field | Value | + +-------------------+--------------------------------------+ + | ID | 677c7bab-18ee-4a34-b1e6-a305e98ba887 | + | Workflow ID | d6451b4e-6448-4a26-aa33-ac5e18c7a412 | + | Workflow name | std.delete_vnf | + | Description | | + | Task Execution ID | | + | State | SUCCESS | + | State info | None | + | Created at | 2016-08-14 20:48:00 | + | Updated at | 2016-08-14 20:48:03 | + +-------------------+--------------------------------------+ + + +Gather execution output data from execution id. + +:: + + $ mistral execution-get-output 677c7bab-18ee-4a34-b1e6-a305e98ba887 + + Response: + + { + "openstack": { + "project_name": "demo", + "user_id": "f39a28fa574848dfa950b50329c1309b", + "roles": [ + "anotherrole", + "Member" + ], + "auth_uri": "http://192.168.122.250:5000/v3", + "auth_cacert": null, + "auth_token": "2871049fae3643ca84f44f7e17f809a0", + "is_trust_scoped": false, + "service_catalog": "[{\"endpoints\": [{\"adminURL\": \"http://192.168.122.250/identity_v2_admin\", \"region\": \"RegionOne\", \"internalURL\": \"http://192.168.122.250/identity\", \"publicURL\": \"http://192.168.122.250/identity\"}], \"type\": \"identity\", \"name\": \"keystone\"}, {\"endpoints\": [{\"adminURL\": \"http://192.168.122.250:9292\", \"region\": \"RegionOne\", \"internalURL\": \"http://192.168.122.250:9292\", \"publicURL\": \"http://192.168.122.250:9292\"}], \"type\": \"image\", \"name\": \"glance\"}, {\"endpoints\": [{\"adminURL\": \"http://192.168.122.250:8774/v2.1\", \"region\": \"RegionOne\", \"internalURL\": \"http://192.168.122.250:8774/v2.1\", \"publicURL\": \"http://192.168.122.250:8774/v2.1\"}], \"type\": \"compute\", \"name\": \"nova\"}, {\"endpoints\": [{\"adminURL\": \"http://192.168.122.250:8776/v2/bde60e557de840a8a837733aaa96e42e\", \"region\": \"RegionOne\", \"internalURL\": \"http://192.168.122.250:8776/v2/bde60e557de840a8a837733aaa96e42e\", \"publicURL\": \"http://192.168.122.250:8776/v2/bde60e557de840a8a837733aaa96e42e\"}], \"type\": \"volumev2\", \"name\": \"cinderv2\"}, {\"endpoints\": [{\"adminURL\": \"http://192.168.122.250:8776/v1/bde60e557de840a8a837733aaa96e42e\", \"region\": \"RegionOne\", \"internalURL\": \"http://192.168.122.250:8776/v1/bde60e557de840a8a837733aaa96e42e\", \"publicURL\": \"http://192.168.122.250:8776/v1/bde60e557de840a8a837733aaa96e42e\"}], \"type\": \"volume\", \"name\": \"cinder\"}, {\"endpoints\": [{\"adminURL\": \"http://192.168.122.250:9494\", \"region\": \"RegionOne\", \"internalURL\": \"http://192.168.122.250:9494\", \"publicURL\": \"http://192.168.122.250:9494\"}], \"type\": \"artifact\", \"name\": \"glare\"}, {\"endpoints\": [{\"adminURL\": \"http://192.168.122.250:8004/v1/bde60e557de840a8a837733aaa96e42e\", \"region\": \"RegionOne\", \"internalURL\": \"http://192.168.122.250:8004/v1/bde60e557de840a8a837733aaa96e42e\", \"publicURL\": \"http://192.168.122.250:8004/v1/bde60e557de840a8a837733aaa96e42e\"}], \"type\": \"orchestration\", \"name\": \"heat\"}, {\"endpoints\": [{\"adminURL\": \"http://192.168.122.250:8774/v2/bde60e557de840a8a837733aaa96e42e\", \"region\": \"RegionOne\", \"internalURL\": \"http://192.168.122.250:8774/v2/bde60e557de840a8a837733aaa96e42e\", \"publicURL\": \"http://192.168.122.250:8774/v2/bde60e557de840a8a837733aaa96e42e\"}], \"type\": \"compute_legacy\", \"name\": \"nova_legacy\"}, {\"endpoints\": [{\"adminURL\": \"http://192.168.122.250:9890/\", \"region\": \"RegionOne\", \"internalURL\": \"http://192.168.122.250:9890/\", \"publicURL\": \"http://192.168.122.250:9890/\"}], \"type\": \"nfv-orchestration\", \"name\": \"tacker\"}, {\"endpoints\": [{\"adminURL\": \"http://192.168.122.250:8989/v2\", \"region\": \"RegionOne\", \"internalURL\": \"http://192.168.122.250:8989/v2\", \"publicURL\": \"http://192.168.122.250:8989/v2\"}], \"type\": \"workflowv2\", \"name\": \"mistral\"}, {\"endpoints\": [{\"adminURL\": \"http://192.168.122.250:9696/\", \"region\": \"RegionOne\", \"internalURL\": \"http://192.168.122.250:9696/\", \"publicURL\": \"http://192.168.122.250:9696/\"}], \"type\": \"network\", \"name\": \"neutron\"}, {\"endpoints\": [{\"adminURL\": \"http://192.168.122.250:8776/v3/bde60e557de840a8a837733aaa96e42e\", \"region\": \"RegionOne\", \"internalURL\": \"http://192.168.122.250:8776/v3/bde60e557de840a8a837733aaa96e42e\", \"publicURL\": \"http://192.168.122.250:8776/v3/bde60e557de840a8a837733aaa96e42e\"}], \"type\": \"volumev3\", \"name\": \"cinderv3\"}, {\"endpoints\": [{\"adminURL\": \"http://192.168.122.250:8082\", \"region\": \"RegionOne\", \"internalURL\": \"http://192.168.122.250:8082\", \"publicURL\": \"http://192.168.122.250:8082\"}], \"type\": \"application-catalog\", \"name\": \"murano\"}, {\"endpoints\": [{\"adminURL\": \"http://192.168.122.250:8779/v1.0/bde60e557de840a8a837733aaa96e42e\", \"region\": \"RegionOne\", \"internalURL\": \"http://192.168.122.250:8779/v1.0/bde60e557de840a8a837733aaa96e42e\", \"publicURL\": \"http://192.168.122.250:8779/v1.0/bde60e557de840a8a837733aaa96e42e\"}], \"type\": \"database\", \"name\": \"trove\"}, {\"endpoints\": [{\"adminURL\": \"http://192.168.122.250:8000/v1\", \"region\": \"RegionOne\", \"internalURL\": \"http://192.168.122.250:8000/v1\", \"publicURL\": \"http://192.168.122.250:8000/v1\"}], \"type\": \"cloudformation\", \"name\": \"heat-cfn\"}]", + "project_id": "bde60e557de840a8a837733aaa96e42e", + "user_name": "demo" + }, + "vnf_id": "f467e215-43a3-4083-8bbb-ce49d9c70443", + "__env": {}, + "__execution": { + "input": { + "vnf_id": "f467e215-43a3-4083-8bbb-ce49d9c70443" + }, + "params": {}, + "id": "677c7bab-18ee-4a34-b1e6-a305e98ba887", + "spec": { + "tasks": { + "delete_vnf": { + "action": "tacker.delete_vnf vnf=<% $.vnf_id %>", + "version": "2.0", + "type": "direct", + "description": "Request to delete a VNF.", + "name": "delete_vnf" + } + }, + "description": "Delete a VNF.\n", + "version": "2.0", + "input": [ + "vnf_id" + ], + "type": "direct", + "name": "std.delete_vnf" + } + } + } + + +VNFD resource deletion with std.delete_vnfd workflow +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Update the vnfd_id from the output of above exection in delete_vnfd.json + +Create new execution for VNF deletion. + +:: + + $ mistral execution-create std.delete_vnfd delete_vnfd.json + + +-------------------+--------------------------------------+ + | Field | Value | + +-------------------+--------------------------------------+ + | ID | 1e0340c0-bee8-4ca4-8150-ac6e5eb58c99 | + | Workflow ID | f15b7402-ce31-4369-98d4-818125191564 | + | Workflow name | std.delete_vnfd | + | Description | | + | Task Execution ID | | + | State | RUNNING | + | State info | None | + | Created at | 2016-08-14 20:57:06.500941 | + | Updated at | 2016-08-14 20:57:06.505780 | + +-------------------+--------------------------------------+ + +Gather execution details based on execution id. + +:: + + $ mistral execution-get 1e0340c0-bee8-4ca4-8150-ac6e5eb58c99 + + +-------------------+--------------------------------------+ + | Field | Value | + +-------------------+--------------------------------------+ + | ID | 1e0340c0-bee8-4ca4-8150-ac6e5eb58c99 | + | Workflow ID | f15b7402-ce31-4369-98d4-818125191564 | + | Workflow name | std.delete_vnfd | + | Description | | + | Task Execution ID | | + | State | SUCCESS | + | State info | None | + | Created at | 2016-08-14 20:57:06 | + | Updated at | 2016-08-14 20:57:07 | + +-------------------+--------------------------------------+ + + + +Gather execution output data from execution id. + +:: + + $ mistral execution-get-output 1e0340c0-bee8-4ca4-8150-ac6e5eb58c99 + + Response: + + { + "openstack": { + "project_name": "demo", + "user_id": "f39a28fa574848dfa950b50329c1309b", + "roles": [ + "anotherrole", + "Member" + ], + "auth_uri": "http://192.168.122.250:5000/v3", + "auth_cacert": null, + "auth_token": "176c9b5ebd9d40fb9fb0a8db921609eb", + "is_trust_scoped": false, + "service_catalog": "[{\"endpoints\": [{\"adminURL\": \"http://192.168.122.250/identity_v2_admin\", \"region\": \"RegionOne\", \"internalURL\": \"http://192.168.122.250/identity\", \"publicURL\": \"http://192.168.122.250/identity\"}], \"type\": \"identity\", \"name\": \"keystone\"}, {\"endpoints\": [{\"adminURL\": \"http://192.168.122.250:9292\", \"region\": \"RegionOne\", \"internalURL\": \"http://192.168.122.250:9292\", \"publicURL\": \"http://192.168.122.250:9292\"}], \"type\": \"image\", \"name\": \"glance\"}, {\"endpoints\": [{\"adminURL\": \"http://192.168.122.250:8774/v2.1\", \"region\": \"RegionOne\", \"internalURL\": \"http://192.168.122.250:8774/v2.1\", \"publicURL\": \"http://192.168.122.250:8774/v2.1\"}], \"type\": \"compute\", \"name\": \"nova\"}, {\"endpoints\": [{\"adminURL\": \"http://192.168.122.250:8776/v2/bde60e557de840a8a837733aaa96e42e\", \"region\": \"RegionOne\", \"internalURL\": \"http://192.168.122.250:8776/v2/bde60e557de840a8a837733aaa96e42e\", \"publicURL\": \"http://192.168.122.250:8776/v2/bde60e557de840a8a837733aaa96e42e\"}], \"type\": \"volumev2\", \"name\": \"cinderv2\"}, {\"endpoints\": [{\"adminURL\": \"http://192.168.122.250:8776/v1/bde60e557de840a8a837733aaa96e42e\", \"region\": \"RegionOne\", \"internalURL\": \"http://192.168.122.250:8776/v1/bde60e557de840a8a837733aaa96e42e\", \"publicURL\": \"http://192.168.122.250:8776/v1/bde60e557de840a8a837733aaa96e42e\"}], \"type\": \"volume\", \"name\": \"cinder\"}, {\"endpoints\": [{\"adminURL\": \"http://192.168.122.250:9494\", \"region\": \"RegionOne\", \"internalURL\": \"http://192.168.122.250:9494\", \"publicURL\": \"http://192.168.122.250:9494\"}], \"type\": \"artifact\", \"name\": \"glare\"}, {\"endpoints\": [{\"adminURL\": \"http://192.168.122.250:8004/v1/bde60e557de840a8a837733aaa96e42e\", \"region\": \"RegionOne\", \"internalURL\": \"http://192.168.122.250:8004/v1/bde60e557de840a8a837733aaa96e42e\", \"publicURL\": \"http://192.168.122.250:8004/v1/bde60e557de840a8a837733aaa96e42e\"}], \"type\": \"orchestration\", \"name\": \"heat\"}, {\"endpoints\": [{\"adminURL\": \"http://192.168.122.250:8774/v2/bde60e557de840a8a837733aaa96e42e\", \"region\": \"RegionOne\", \"internalURL\": \"http://192.168.122.250:8774/v2/bde60e557de840a8a837733aaa96e42e\", \"publicURL\": \"http://192.168.122.250:8774/v2/bde60e557de840a8a837733aaa96e42e\"}], \"type\": \"compute_legacy\", \"name\": \"nova_legacy\"}, {\"endpoints\": [{\"adminURL\": \"http://192.168.122.250:9890/\", \"region\": \"RegionOne\", \"internalURL\": \"http://192.168.122.250:9890/\", \"publicURL\": \"http://192.168.122.250:9890/\"}], \"type\": \"nfv-orchestration\", \"name\": \"tacker\"}, {\"endpoints\": [{\"adminURL\": \"http://192.168.122.250:8989/v2\", \"region\": \"RegionOne\", \"internalURL\": \"http://192.168.122.250:8989/v2\", \"publicURL\": \"http://192.168.122.250:8989/v2\"}], \"type\": \"workflowv2\", \"name\": \"mistral\"}, {\"endpoints\": [{\"adminURL\": \"http://192.168.122.250:9696/\", \"region\": \"RegionOne\", \"internalURL\": \"http://192.168.122.250:9696/\", \"publicURL\": \"http://192.168.122.250:9696/\"}], \"type\": \"network\", \"name\": \"neutron\"}, {\"endpoints\": [{\"adminURL\": \"http://192.168.122.250:8776/v3/bde60e557de840a8a837733aaa96e42e\", \"region\": \"RegionOne\", \"internalURL\": \"http://192.168.122.250:8776/v3/bde60e557de840a8a837733aaa96e42e\", \"publicURL\": \"http://192.168.122.250:8776/v3/bde60e557de840a8a837733aaa96e42e\"}], \"type\": \"volumev3\", \"name\": \"cinderv3\"}, {\"endpoints\": [{\"adminURL\": \"http://192.168.122.250:8082\", \"region\": \"RegionOne\", \"internalURL\": \"http://192.168.122.250:8082\", \"publicURL\": \"http://192.168.122.250:8082\"}], \"type\": \"application-catalog\", \"name\": \"murano\"}, {\"endpoints\": [{\"adminURL\": \"http://192.168.122.250:8779/v1.0/bde60e557de840a8a837733aaa96e42e\", \"region\": \"RegionOne\", \"internalURL\": \"http://192.168.122.250:8779/v1.0/bde60e557de840a8a837733aaa96e42e\", \"publicURL\": \"http://192.168.122.250:8779/v1.0/bde60e557de840a8a837733aaa96e42e\"}], \"type\": \"database\", \"name\": \"trove\"}, {\"endpoints\": [{\"adminURL\": \"http://192.168.122.250:8000/v1\", \"region\": \"RegionOne\", \"internalURL\": \"http://192.168.122.250:8000/v1\", \"publicURL\": \"http://192.168.122.250:8000/v1\"}], \"type\": \"cloudformation\", \"name\": \"heat-cfn\"}]", + "project_id": "bde60e557de840a8a837733aaa96e42e", + "user_name": "demo" + }, + "vnfd_id": "fb164b77-5e24-402d-b5f4-c6596352cabe", + "__env": {}, + "__execution": { + "input": { + "vnfd_id": "fb164b77-5e24-402d-b5f4-c6596352cabe" + }, + "params": {}, + "id": "1e0340c0-bee8-4ca4-8150-ac6e5eb58c99", + "spec": { + "tasks": { + "delete_vnfd": { + "action": "tacker.delete_vnfd vnfd=<% $.vnfd_id %>", + "version": "2.0", + "type": "direct", + "description": "Request to delete a VNFD.", + "name": "delete_vnfd" + } + }, + "description": "Delete a VNFD.\n", + "version": "2.0", + "input": [ + "vnfd_id" + ], + "type": "direct", + "name": "std.delete_vnfd" + } + } + } diff --git a/doc/source/index.rst b/doc/source/index.rst index 224f1b17f..733836f34 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -53,6 +53,7 @@ Feature Documentation devref/vnfd_template_parameterization.rst devref/enhanced_placement_awareness_usage_guide.rst devref/multisite_vim_usage_guide.rst + devref/mistral_workflows_usage_guide.rst API Documentation ================= diff --git a/releasenotes/notes/tacker-workflow-definition-1a5b7790b69f9eb7.yaml b/releasenotes/notes/tacker-workflow-definition-1a5b7790b69f9eb7.yaml new file mode 100644 index 000000000..8744c9369 --- /dev/null +++ b/releasenotes/notes/tacker-workflow-definition-1a5b7790b69f9eb7.yaml @@ -0,0 +1,3 @@ +--- +other: + - Tacker workflow definition samples. diff --git a/samples/mistral/workflows/create_vnf.yaml b/samples/mistral/workflows/create_vnf.yaml new file mode 100644 index 000000000..9ec5f8d7e --- /dev/null +++ b/samples/mistral/workflows/create_vnf.yaml @@ -0,0 +1,53 @@ +--- +version: '2.0' + +std.create_vnf: + type: direct + + description: | + Create a VNF and waits till VNF is active. + + input: + - body + output: + vnf_id: <% $.vnf_id %> + vim_id: <% $.vim_id %> + mgmt_url: <% $.mgmt_url %> + status: <% $.status %> + + task-defaults: + on-error: + - delete_vnf + + tasks: + create_vnf: + description: Request to create a VNF. + action: tacker.create_vnf body=<% $.body %> + input: + body: <% $.body %> + publish: + vnf_id: <% task(create_vnf).result.vnf.id %> + vim_id: <% task(create_vnf).result.vnf.vim_id %> + mgmt_url: <% task(create_vnf).result.vnf.mgmt_url %> + status: <% task(create_vnf).result.vnf.status %> + on-success: + - wait_vnf_active + + wait_vnf_active: + description: Waits till VNF is ACTIVE. + action: tacker.show_vnf vnf=<% $.vnf_id %> + retry: + count: 10 + delay: 10 + break-on: <% $.status = 'ACTIVE' %> + break-on: <% $.status = 'ERROR' %> + continue-on: <% $.status = 'PENDING_CREATE' %> + publish: + mgmt_url: <% task(wait_vnf_active).result.vnf.mgmt_url %> + status: <% task(wait_vnf_active).result.vnf.status %> + on-success: + - delete_vnf: <% $.status = 'ERROR' %> + + delete_vnf: + description: Request to delete a VNF. + action: tacker.delete_vnf vnf=<% $.vnf_id %> diff --git a/samples/mistral/workflows/create_vnfd.yaml b/samples/mistral/workflows/create_vnfd.yaml new file mode 100644 index 000000000..36e727ac5 --- /dev/null +++ b/samples/mistral/workflows/create_vnfd.yaml @@ -0,0 +1,22 @@ +--- +version: '2.0' + +std.create_vnfd: + type: direct + + description: | + Create a VNFD. + + input: + - body + output: + vnfd_id: <% $.vnfd_id %> + + tasks: + create_vnfd: + description: Request to create a VNFD. + action: tacker.create_vnfd body=<% $.body %> + input: + body: <% $.body %> + publish: + vnfd_id: <% task(create_vnfd).result.vnfd.id %> diff --git a/samples/mistral/workflows/delete_vnf.yaml b/samples/mistral/workflows/delete_vnf.yaml new file mode 100644 index 000000000..4be2a13cc --- /dev/null +++ b/samples/mistral/workflows/delete_vnf.yaml @@ -0,0 +1,16 @@ +--- +version: '2.0' + +std.delete_vnf: + type: direct + + description: | + Delete a VNF. + + input: + - vnf_id + + tasks: + delete_vnf: + description: Request to delete a VNF. + action: tacker.delete_vnf vnf=<% $.vnf_id %> diff --git a/samples/mistral/workflows/delete_vnfd.yaml b/samples/mistral/workflows/delete_vnfd.yaml new file mode 100644 index 000000000..45197ce58 --- /dev/null +++ b/samples/mistral/workflows/delete_vnfd.yaml @@ -0,0 +1,16 @@ +--- +version: '2.0' + +std.delete_vnfd: + type: direct + + description: | + Delete a VNFD. + + input: + - vnfd_id + + tasks: + delete_vnfd: + description: Request to delete a VNFD. + action: tacker.delete_vnfd vnfd=<% $.vnfd_id %> diff --git a/samples/mistral/workflows/input/create_vnf.json b/samples/mistral/workflows/input/create_vnf.json new file mode 100644 index 000000000..e69e69b09 --- /dev/null +++ b/samples/mistral/workflows/input/create_vnf.json @@ -0,0 +1,11 @@ +{ + "body": { + "vnf": { + "attributes": {}, + "vim_id": "", + "description": "Sample for tacker.create_vnf action", + "vnfd_id": "dda99d4c-f24d-4550-b104-0958fef427b3", + "name": "tacker-create-vnf" + } + } +} diff --git a/samples/mistral/workflows/input/create_vnfd.json b/samples/mistral/workflows/input/create_vnfd.json new file mode 100644 index 000000000..7a86cf4f0 --- /dev/null +++ b/samples/mistral/workflows/input/create_vnfd.json @@ -0,0 +1,10 @@ +{ + "body":{ + "vnfd":{ + "attributes":{ + "vnfd":"tosca_definitions_version: tosca_simple_profile_for_nfv_1_0_0\n\ndescription: Demo example\n\nmetadata:\n template_name: sample-tosca-vnfd\n\ntopology_template:\n node_templates:\n VDU1:\n type: tosca.nodes.nfv.VDU.Tacker\n properties:\n image: cirros-0.3.4-x86_64-uec\n flavor: m1.tiny\n availability_zone: nova\n mgmt_driver: noop\n config: |\n param0: key1\n param1: key2\n\n CP1:\n type: tosca.nodes.nfv.CP.Tacker\n properties:\n management: true\n anti_spoofing_protection: false\n requirements:\n - virtualLink:\n node: VL1\n - virtualBinding:\n node: VDU1\n\n CP2:\n type: tosca.nodes.nfv.CP.Tacker\n properties:\n anti_spoofing_protection: false\n requirements:\n - virtualLink:\n node: VL2\n - virtualBinding:\n node: VDU1\n\n CP3:\n type: tosca.nodes.nfv.CP.Tacker\n properties:\n anti_spoofing_protection: false\n requirements:\n - virtualLink:\n node: VL3\n - virtualBinding:\n node: VDU1\n\n VL1:\n type: tosca.nodes.nfv.VL\n properties:\n network_name: net_mgmt\n vendor: Tacker\n\n VL2:\n type: tosca.nodes.nfv.VL\n properties:\n network_name: net0\n vendor: Tacker\n\n VL3:\n type: tosca.nodes.nfv.VL\n properties:\n network_name: net1\n vendor: Tacker\n" + }, + "name":"tacker-create-vnfd" + } + } +} diff --git a/samples/mistral/workflows/input/delete_vnf.json b/samples/mistral/workflows/input/delete_vnf.json new file mode 100644 index 000000000..4241b2142 --- /dev/null +++ b/samples/mistral/workflows/input/delete_vnf.json @@ -0,0 +1,3 @@ +{ + "vnf_id": "d7606ee7-053a-4064-bb67-501ac704a6ed" +} diff --git a/samples/mistral/workflows/input/delete_vnfd.json b/samples/mistral/workflows/input/delete_vnfd.json new file mode 100644 index 000000000..036f1e5e7 --- /dev/null +++ b/samples/mistral/workflows/input/delete_vnfd.json @@ -0,0 +1,3 @@ +{ + "vnfd_id": "ad78e292-6b0b-47b5-80f4-3abe9e9c7e12" +}