failed to retrieve vnfd on tacker horizon

Asked by futangw on 2016-12-24

Hello,

Today I upgraded the tacker on newton from 0.5.0 to master branch (including python-heatclient from 0.5.0 and tacker-horizon from 0.5.0 to branch master), after that, the tacker horizon failed to retrieve VNF catalog with 'Error: Unable to get instances'. But VNF Manager and VIM Management stiall work. And the tacker command line works too (including vnfd-list). In this situation, when i tried to 'deploy VNF', I could see all the vnfd on the lists (including the one i newly created via command line).

anyone kindly has any idea? Appreciate the help.

Merry Christmas and Happy New Year.

futangw

Question information

Language:
English Edit question
Status:
Solved
For:
tacker Edit question
Assignee:
No assignee Edit question
Solved by:
futangw
Solved:
2016-12-27
Last query:
2016-12-27
Last reply:
futangw (futangw) said : #1

I looked into more detail, and found there's an exeption raised in function get_vnfcatalog_data() of file tacker_horizon/openstack_dashboard/dashboards/nfv/vnfcatalog/tabs.py
            instances = []
            vnfds = api.tacker.vnfd_list(self.request)
            for vnfd in vnfds:
                services = vnfd['service_types']
                vnfd_services = []
                for s in services:
                    if s['service_type'] != 'vnfd':
                        vnfd_services.append(s['service_type'])
                vnfds_services_string = ""
                if len(vnfd_services) > 0:
                    vnfds_services_string = ', '.join(
                        [str(item) for item in vnfd_services])
                item = VNFCatalogItem(vnfd['name'],
                                      vnfd['description'],
                                      vnfds_services_string, vnfd['id'])
                instances.append(item)
            return instances

after statement services = vnfd['service_types'], services gets only a string (e.g. u'vnfd') and it raises an exept on
s['service_type'] then it returns empty [] only.

But even i fixes it, the dashboard still display nothing! i confirmed the returned instances has correct objects.

futangw (futangw) said : #2

Now everything is clear now.

firstly let me correct an statement above:
after statement services = vnfd['service_types'], services gets only a string (e.g. u'vnfd')

here the services gets a list with only one element, instead of a string. i.e. [u'vnfd']

secondly now i can view the vnfd on tacker horizon now. the reason of 'return []' was caused by my debug code. so this is not an issue.

thirdly the original issue is really a bug that supposed to be fixed. it was caused by code change in tacker _make_service_types_list().

on tacker 0.5.0, the code:
178 def _make_service_types_list(self, service_types):
179 return [{'id': service_type.id,
180 'service_type': service_type.service_type}
181 for service_type in service_types]

on tacker master, the code:
176 def _make_service_types_list(self, service_types):
177 return [service_type.service_type
178 for service_type in service_types]

So the new code will return a list with string element inside. This will caused an except in the function get_vnfcatalog_data().
Can the code be changed to:
                 for s in services:
# if s['service_type'] != 'vnfd':
                         vnfd_services.append(s)

I don't understand why here 'vnfd' is excluded.

futangw (futangw) said : #3

i'd like to open a bug report.