From ae8f8c7d9d2d3940959381e1176994d52d9425d2 Mon Sep 17 00:00:00 2001 From: dharmendra Date: Wed, 13 Feb 2019 11:59:05 +0000 Subject: [PATCH] vnffg-create failed abnormally due to invalid network_src_port_id When create a vnffg with a non-existent network_src_port_id in vnffgd, create command failed abnormally with "internal server error". This patch will handle the issue and raise FlowClassifierPortNotFound exception. Partially Implements: blueprint improve-return-message Closes-bug: #1710633 Change-Id: If9c36cb260d43bec515a52b93e10f714d063dc92 --- tacker/extensions/nfvo.py | 4 ++++ tacker/nfvo/drivers/vim/openstack_driver.py | 11 ++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/tacker/extensions/nfvo.py b/tacker/extensions/nfvo.py index d3d563756..9b4ae735c 100644 --- a/tacker/extensions/nfvo.py +++ b/tacker/extensions/nfvo.py @@ -278,6 +278,10 @@ class UpdateVnffgException(exceptions.TackerException): message = _("%(message)s") +class FlowClassiferCreationFailed(exceptions.TackerException): + message = _("%(message)s") + + NAME_MAX_LEN = 255 RESOURCE_ATTRIBUTE_MAP = { diff --git a/tacker/nfvo/drivers/vim/openstack_driver.py b/tacker/nfvo/drivers/vim/openstack_driver.py index 9070ccd22..b2834960c 100644 --- a/tacker/nfvo/drivers/vim/openstack_driver.py +++ b/tacker/nfvo/drivers/vim/openstack_driver.py @@ -840,12 +840,13 @@ class NeutronClient(object): def flow_classifier_create(self, fc_dict): LOG.debug("fc_dict passed is {fc_dict}".format(fc_dict=fc_dict)) - fc = self.client.create_sfc_flow_classifier( - {'flow_classifier': fc_dict}) - if fc: + try: + fc = self.client.create_sfc_flow_classifier( + {'flow_classifier': fc_dict}) return fc['flow_classifier']['id'] - else: - return None + except Exception as ex: + LOG.error("Error while creating Flow Classifier: %s", str(ex)) + raise nfvo.FlowClassiferCreationFailed(message=str(ex)) def flow_classifier_update(self, fc_id, update_fc): update_fc_dict = {'flow_classifier': update_fc}