Preserve network interfaces order of vnfd template

The Python dictionary behavior of vnfd body does not guarantee the
network interfaces to be fetched in same order as specified in template.
This fix uses the third party python package tosca-parser to preserve
the order. This will ensure the interfaces come up in the same sequence
as specified in template.

Closes-Bug: #1504687
Change-Id: Ieddd2ba16328869cef901d94bb53dc9566c250df
This commit is contained in:
Sripriya 2015-10-12 14:01:15 -07:00
parent 0773f4e1a1
commit dc5024e232
2 changed files with 4 additions and 7 deletions

View File

@ -25,3 +25,4 @@ oslo.config>=1.11.0 # Apache-2.0
oslo.messaging!=1.17.0,!=1.17.1,>=1.16.0 # Apache-2.0
oslo.rootwrap>=2.0.0 # Apache-2.0
python-novaclient>=2.22.0
tosca-parser>=0.1.0

View File

@ -1,8 +1,6 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2015 Intel Corporation.
# Copyright 2015 Isaku Yamahata <isaku.yamahata at intel com>
# <isaku.yamahata at gmail com>
# All Rights Reserved.
#
#
@ -17,9 +15,6 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# @author: Isaku Yamahata, Intel Corporation.
# shamelessly many codes are stolen from gbp simplechain_driver.py
import sys
import time
@ -29,6 +24,7 @@ from heatclient import client as heat_client
from heatclient import exc as heatException
from keystoneclient.v2_0 import client as ks_client
from oslo_config import cfg
from toscaparser.utils import yamlparser
from tacker.common import log
from tacker.extensions import vnfm
@ -199,7 +195,7 @@ class DeviceHeat(abstract_driver.DeviceAbstractDriver):
network_param = {
'port': {'get_resource': port}
}
networks_list.append(network_param)
networks_list.append(dict(network_param))
@log.log
def create(self, plugin, context, device):
@ -233,7 +229,7 @@ class DeviceHeat(abstract_driver.DeviceAbstractDriver):
outputs_dict = {}
template_dict['outputs'] = outputs_dict
vnfd_dict = yaml.load(vnfd_yaml)
vnfd_dict = yamlparser.simple_ordered_parse(vnfd_yaml)
LOG.debug('vnfd_dict %s', vnfd_dict)
if 'get_input' in vnfd_yaml: