parameter value wrongly mapped in vnfd

In VNFD template, if we give 'sriov' value to the name property,
it is then converted to 'direct' in the heat template.

Solution: before changing the value, key-name is checked now

Change-Id: Ib7d96c7fccc781bc0615670ddf90bba4dcbdf24c
closes-bug: #1648003
This commit is contained in:
Ukesh Kumar Vasudevan 2016-12-07 17:26:53 +05:30
parent 36750161e2
commit 1da3bf459e
3 changed files with 14 additions and 10 deletions
tacker
tests/unit/vm/infra_drivers/openstack/data
vnfm/tosca

@ -10,7 +10,7 @@ outputs:
parameters: {}
resources:
CP1:
properties: {network: net-mgmt}
properties: {name: sriov, network: net-mgmt}
type: OS::Neutron::Port
CP2:
properties: {'binding:vnic_type': direct, network: sr3010}

@ -28,6 +28,7 @@ topology_template:
CP1:
type: tosca.nodes.nfv.CP.Tacker
properties:
name: sriov
management: true
requirements:
- virtualLink:

@ -70,8 +70,8 @@ convert_prop = {TACKERCP: {'anti_spoofing_protection':
'type':
'binding:vnic_type'}}
convert_prop_values = {TACKERCP: {'sriov': 'direct',
'vnic': 'normal'}}
convert_prop_values = {TACKERCP: {'type': {'sriov': 'direct',
'vnic': 'normal'}}}
deletenodes = (MONITORING, FAILURE, PLACEMENT)
@ -221,6 +221,16 @@ def post_process_template(template):
if prop == p.name:
nt.get_properties_objects().remove(p)
# change the property value first before the property key
if nt.type in convert_prop_values:
for prop in convert_prop_values[nt.type].keys():
for p in nt.get_properties_objects():
if (prop == p.name and
p.value in
convert_prop_values[nt.type][prop].keys()):
v = convert_prop_values[nt.type][prop][p.value]
p.value = v
if nt.type in convert_prop:
for prop in convert_prop[nt.type].keys():
for p in nt.get_properties_objects():
@ -232,13 +242,6 @@ def post_process_template(template):
nt.get_properties_objects().append(newprop)
nt.get_properties_objects().remove(p)
if nt.type in convert_prop_values:
for key in convert_prop_values[nt.type].keys():
for p in nt.get_properties_objects():
if key == p.value:
v = convert_prop_values[nt.type][p.value]
p.value = v
@log.log
def get_mgmt_driver(template):