summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFu Jinhua <fu.jinhua@zte.com.cn>2018-11-10 03:31:00 +0000
committerGerrit Code Review <gerrit@onap.org>2018-11-10 03:31:00 +0000
commit69e8df4924955330f03e5cc73e64653a312d0b57 (patch)
tree1a542a03974a78dc9aeb1be62e1c80b99ad2f571
parent2820a53704746876524ec39f0b81a2e17a867ef4 (diff)
parent009ef38cecd950729d260bbb1f600b3f564b8d92 (diff)
Merge "fix vnfmodel error"
-rw-r--r--catalog/pub/utils/toscaparser/vnfdmodel.py18
1 files changed, 13 insertions, 5 deletions
diff --git a/catalog/pub/utils/toscaparser/vnfdmodel.py b/catalog/pub/utils/toscaparser/vnfdmodel.py
index ce0206fe..8c1b97ed 100644
--- a/catalog/pub/utils/toscaparser/vnfdmodel.py
+++ b/catalog/pub/utils/toscaparser/vnfdmodel.py
@@ -199,11 +199,19 @@ class EtsiVnfdInfoModel(BaseInfoModel):
def _get_external_cps(self, vnf_requirements):
external_cps = []
if vnf_requirements:
- for key, value in vnf_requirements.items():
- if isinstance(value, list) and len(value) > 0:
- external_cps.append({"key_name": key, "cpd_id": value[0]})
- else:
- external_cps.append({"key_name": key, "cpd_id": value})
+ if isinstance(vnf_requirements, dict):
+ for key, value in vnf_requirements.items():
+ if isinstance(value, list) and len(value) > 0:
+ external_cps.append({"key_name": key, "cpd_id": value[0]})
+ else:
+ external_cps.append({"key_name": key, "cpd_id": value})
+ elif isinstance(vnf_requirements, list):
+ for vnf_requirement in vnf_requirements:
+ for key, value in vnf_requirement.items():
+ if isinstance(value, list) and len(value) > 0:
+ external_cps.append({"key_name": key, "cpd_id": value[0]})
+ else:
+ external_cps.append({"key_name": key, "cpd_id": value})
return external_cps
def _get_forward_cps(self, vnf_capabilities):