Fix create_vnffgd cannot get description from TOSCA file

- Fix create_vnffgd cannot get 'description' and 'name'
from TOSCA yaml file
- Delete redundant 'description' line in vnffgd template
file following the standard in vnffg_usage_guide.rst

Change-Id: I9c384678058c5e27239e9afc8cc2ae1de01ff750
Closes-Bug: #1751433
This commit is contained in:
Nguyen Hai 2018-03-29 23:42:39 +09:00
parent a99bcb3999
commit d50bb9578d
27 changed files with 70 additions and 37 deletions

View File

@ -4,7 +4,7 @@ Overview
--------
This document explains VNFFGD template structure and its various fields based
on TOSCA standards V1.0 CSD 03 [#f1]_.
on TOSCA standards V1.0 [#f1]_.
For VNFFG usage, please refer to the document available at [#f6]_.
@ -43,7 +43,7 @@ Each VNFFGD template will have below fields:
..
For examples, please refer sample VNFD templates available at GitHub [#f2]_.
For examples, please refer sample VNFFGD templates available at GitHub [#f2]_.
Node types
----------
@ -231,7 +231,6 @@ composed of a Forwarding Path and a VNFFG. A full VNFFGD is shown below:
description: Sample VNFFG template
topology_template:
description: Sample VNFFG template
node_templates:

View File

@ -41,6 +41,7 @@ User Guide
scale_usage_guide.rst
vnf_component_usage_guide.rst
vnffg_usage_guide.rst
vnffg_usage_guide_advanced.rst
vnfm_usage_guide.rst
../reference/mistral_workflows_usage_guide.rst
../reference/block_storage_usage_guide.rst

View File

@ -62,6 +62,14 @@ Firstly, HTTP client and HTTP server must be launched.
Creating the VNFFGD
~~~~~~~~~~~~~~~~~~~
.. note::
Deprecated: 'tacker' command line is deprecated, will be deleted after
Rocky is released. Please use 'openstack' client command line instead.
Read more: https://docs.openstack.org/tacker/latest/admin/index.html
Once OpenStack/Devstack along with Tacker has been successfully installed,
deploy a sample VNFFGD template such as the one `here <https://github.com/
openstack/tacker/tree/master/samples/tosca-templates/vnffgd/
@ -325,7 +333,6 @@ derived from the following VNFFGD template.
description: Sample VNFFG template
topology_template:
description: Sample VNFFG template
node_templates:
@ -367,7 +374,6 @@ By using the below VNFFGD template we can update the exisitng VNFFG.
description: Sample VNFFG template
topology_template:
description: Sample VNFFG template
node_templates:

View File

@ -11,8 +11,6 @@
License for the specific language governing permissions and limitations
under the License.
.. _ref-vnffg:
=========================================
VNF Forwarding Graph Advanced Usage Guide
=========================================
@ -38,7 +36,6 @@ Forwarding_path1, the **path** shows that VNFFG1 will go through VNF1 and VNF2.
description: Sample VNFFG template
topology_template:
description: Sample VNFFG template
node_templates:
@ -85,7 +82,6 @@ goes through VNF1.
description: Sample VNFFG template
topology_template:
description: Sample VNFFG template
node_templates:

View File

@ -0,0 +1,6 @@
---
fixes:
- |
Get right VNFFGD name and description from TOSCA template if not
given via API, and move the description key position in vnffgd
template to above topology_template.

View File

@ -3,7 +3,6 @@ tosca_definitions_version: tosca_simple_profile_for_nfv_1_0_0
description: Sample VNFFG template
topology_template:
description: Sample VNFFG template
node_templates:

View File

@ -3,7 +3,6 @@ tosca_definitions_version: tosca_simple_profile_for_nfv_1_0_0
description: Sample VNFFG template
topology_template:
description: Sample VNFFG template
node_templates:

View File

@ -3,7 +3,6 @@ tosca_definitions_version: tosca_simple_profile_for_nfv_1_0_0
description: Sample symmetrical VNFFG template (network_dst_port_id and ip_dst_prefix must be set)
topology_template:
description: Sample symmetrical VNFFG template
node_templates:

View File

@ -3,7 +3,6 @@ tosca_definitions_version: tosca_simple_profile_for_nfv_1_0_0
description: Sample VNFFG template
topology_template:
description: Sample VNFFG template
node_templates:

View File

@ -3,7 +3,6 @@ tosca_definitions_version: tosca_simple_profile_for_nfv_1_0_0
description: Sample VNFFG template with no flow classifier
topology_template:
description: Sample VNFFG template
node_templates:

View File

@ -3,7 +3,6 @@ tosca_definitions_version: tosca_simple_profile_for_nfv_1_0_0
description: Sample VNFFG parameterized template
topology_template:
description: Sample VNFFG parameterized template
inputs:
net_src_port_id:

View File

@ -3,7 +3,6 @@ tosca_definitions_version: tosca_simple_profile_for_nfv_1_0_0
description: Sample VNFFG template
topology_template:
description: Sample VNFFG template
node_templates:

View File

@ -3,7 +3,6 @@ tosca_definitions_version: tosca_simple_profile_for_nfv_1_0_0
description: Sample VNFFG template
topology_template:
description: Sample VNFFG template
node_templates:

View File

@ -3,7 +3,6 @@ tosca_definitions_version: tosca_simple_profile_for_nfv_1_0_0
description: Sample symmetrical VNFFG template (network_dst_port_id and ip_dst_prefix must be set)
topology_template:
description: Sample symmetrical VNFFG template
node_templates:

View File

@ -301,6 +301,13 @@ class NfvoPlugin(nfvo_db_plugin.NfvoPluginDb, vnffg_db.VnffgPluginDbMixin,
self.validate_vnffg_properties(template['template'])
template_yaml = template['template']['vnffgd']
if not template.get('description'):
template['description'] = template_yaml.get('description', '')
if not template.get('name') and 'metadata' in template_yaml:
template['name'] = template_yaml['metadata'].get(
'template_name', '')
return super(NfvoPlugin, self).create_vnffgd(context, vnffgd)
@log.log

View File

@ -191,6 +191,20 @@ def get_dummy_vnffgd_obj_inline():
'template_source': 'inline'}}
def get_dummy_vnffgd_obj_no_description():
return {u'vnffgd': {'name': 'dummy_vnffgd',
'tenant_id': u'ad7ebc56538745a08ef7c5e97f8bd437',
u'template': {u'vnffgd': vnffgd_tosca_template},
'template_source': 'onboarded'}}
def get_dummy_vnffgd_obj_no_name():
return {u'vnffgd': {'tenant_id': u'ad7ebc56538745a08ef7c5e97f8bd437',
u'template': {u'vnffgd': vnffgd_tosca_template},
'description': 'dummy_vnffgd_description',
'template_source': 'onboarded'}}
def get_dummy_vnffg_obj():
return {'vnffg': {'description': 'dummy_vnffg_description',
'vnffgd_id': u'eb094833-995e-49f0-a047-dfb56aaf7c4e',

View File

@ -559,6 +559,8 @@ class TestNfvoPlugin(db_base.SqlTestCase):
self.assertIn('id', result)
self.assertIn('template', result)
self.assertIn('template_source', result)
self.assertEqual('dummy_vnffgd', result['name'])
self.assertEqual('dummy_vnffgd_description', result['description'])
self.assertEqual('onboarded', result['template_source'])
def test_create_vnffgd_inline(self):
@ -569,6 +571,24 @@ class TestNfvoPlugin(db_base.SqlTestCase):
self.assertIn('template', result)
self.assertEqual('inline', result['template_source'])
def test_create_vnffgd_no_input_description(self):
vnffgd_obj = utils.get_dummy_vnffgd_obj_no_description()
result = self.nfvo_plugin.create_vnffgd(self.context, vnffgd_obj)
self.assertIsNotNone(result)
self.assertIn('id', result)
self.assertIn('template', result)
self.assertIn('template_source', result)
self.assertEqual('Example VNFFG template', result['description'])
def test_create_vnffgd_no_input_name(self):
vnffgd_obj = utils.get_dummy_vnffgd_obj_no_name()
result = self.nfvo_plugin.create_vnffgd(self.context, vnffgd_obj)
self.assertIsNotNone(result)
self.assertIn('id', result)
self.assertIn('template', result)
self.assertIn('template_source', result)
self.assertEqual('example_vnffgd', result['name'])
def test_create_vnffg_pre(self):
VNFFG_ID = 'ffc1a59b-65bb-4874-94d3-84f639e63c74'
ACLMATCHCRI_ID = 'ffc1a59b-65bb-4874-94d3-84f639e63c75'

View File

@ -1,9 +1,8 @@
tosca_definitions_version: tosca_simple_profile_for_nfv_1_0_0
description: example template
description: Example VNFFG template
topology_template:
description: Example VNFFG template
node_templates:

View File

@ -1,9 +1,8 @@
tosca_definitions_version: tosca_simple_profile_for_nfv_1_0_0
description: example template
description: Example VNFFG template
topology_template:
description: Example VNFFG template
node_templates:

View File

@ -1,9 +1,8 @@
tosca_definitions_version: tosca_simple_profile_for_nfv_1_0_0
description: example template for update
description: Example VNFFG template for update
topology_template:
description: Example VNFFG template for update
node_templates:

View File

@ -3,7 +3,6 @@ tosca_definitions_version: tosca_simple_profile_for_nfv_1_0_0
description: Sample VNFFG parameterized template
topology_template:
description: Sample VNFFG parameterized template
inputs:
net_src_port_id:

View File

@ -1,8 +1,7 @@
tosca_definitions_version: tosca_simple_profile_for_nfv_1_0_0
description: example template
description: Example VNFFG template without any flow classifiers
topology_template:
description: Example VNFFG template without any flow classifiers
node_templates:
Forwarding_path1:
type: tosca.nodes.nfv.FP.TackerV2

View File

@ -1,9 +1,8 @@
tosca_definitions_version: tosca_simple_profile_for_nfv_1_0_0
description: example template
description: Example VNFFG template
topology_template:
description: Example VNFFG template
inputs:
net_src_port_id:

View File

@ -1,9 +1,8 @@
tosca_definitions_version: tosca_simple_profile_for_nfv_1_0_0
description: example template
description: Example VNFFG template
topology_template:
description: Example VNFFG template
inputs:
net_name:

View File

@ -1,9 +1,11 @@
tosca_definitions_version: tosca_simple_profile_for_nfv_1_0_0
description: example template
description: Example VNFFG template
metadata:
template_name: example_vnffgd
topology_template:
description: Example VNFFG template
node_templates:

View File

@ -1,9 +1,8 @@
tosca_definitions_version: tosca_simple_profile_for_nfv_1_0_0
description: example template for update
description: Example VNFFG template for update
topology_template:
description: Example VNFFG template for update
node_templates:

View File

@ -1,9 +1,8 @@
tosca_definitions_version: tosca_simple_profile_for_nfv_1_0_0
description: example template
description: Example VNFFG template
topology_template:
description: Example VNFFG template
node_templates: