summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfengyuanxing <feng.yuanxing@zte.com.cn>2018-03-07 17:09:51 +0800
committerfengyuanxing <feng.yuanxing@zte.com.cn>2018-03-07 17:09:58 +0800
commit12cc77707a7780d33603898186794bca9fdbe74d (patch)
treee794d5667a607b858d367f5f24861a3399156c71
parent6fc735893ad67f2291f5db72f8df279e1d3c761d (diff)
Fix a bug and modify test cases
Change-Id: Ice7d75ed231edd4c36383b185a4c307df942607e Issue-ID: VFC-784 Signed-off-by: fengyuanxing <feng.yuanxing@zte.com.cn>
-rw-r--r--lcm/pub/tests/test_scaleaspect.py3
-rw-r--r--lcm/pub/utils/scaleaspect.py4
2 files changed, 5 insertions, 2 deletions
diff --git a/lcm/pub/tests/test_scaleaspect.py b/lcm/pub/tests/test_scaleaspect.py
index 58fca5a4..400e31d0 100644
--- a/lcm/pub/tests/test_scaleaspect.py
+++ b/lcm/pub/tests/test_scaleaspect.py
@@ -223,6 +223,9 @@ class TestScaleAspect(TestCase):
self.add_another_nf_instance()
result = set_scacle_vnf_instance_id(self.vnf_scale_info_list)
self.assertEqual(3, result.__len__())
+ self.assertEqual("231", result[0]["vnfInstanceId"])
+ self.assertEqual("232", result[1]["vnfInstanceId"])
+ self.assertEqual("233", result[2]["vnfInstanceId"])
def test_get_nsdId(self):
nsd_id = get_nsdId("1")
diff --git a/lcm/pub/utils/scaleaspect.py b/lcm/pub/utils/scaleaspect.py
index e642ab01..941d1b48 100644
--- a/lcm/pub/utils/scaleaspect.py
+++ b/lcm/pub/utils/scaleaspect.py
@@ -219,10 +219,10 @@ def set_scacle_vnf_instance_id(vnf_scale_info_list):
vnf_scale_info = vnf_scale_info_list[i]
vnfd_id = vnf_scale_info["vnfd_id"]
vnf_instance_id_list = get_vnf_instance_id_list(vnfd_id)
- copy_vnf_scale_info = copy.deepcopy(vnf_scale_info)
- copy_vnf_scale_info.pop("vnfd_id")
index = 0
while index < vnf_instance_id_list.__len__():
+ copy_vnf_scale_info = copy.deepcopy(vnf_scale_info)
+ copy_vnf_scale_info.pop("vnfd_id")
copy_vnf_scale_info["vnfInstanceId"] = vnf_instance_id_list[index]
index += 1
scale_vnf_data_info_list.append(copy_vnf_scale_info)