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
This commit is contained in:
dharmendra 2019-02-13 11:59:05 +00:00
parent 48a5f80be7
commit ae8f8c7d9d
2 changed files with 10 additions and 5 deletions

View File

@ -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 = {

View File

@ -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}