From eb2b62f063e14a85a66cc8dfe54cf404b9099ef8 Mon Sep 17 00:00:00 2001 From: Kailun Qin Date: Mon, 16 Apr 2018 12:14:25 +0800 Subject: [PATCH] Update ip_address in create_port following the DM Change-Id: I9fa1d02b0c188169e83b52bfdca40c8e6eb3b990 Issue-ID: VFC-870 Signed-off-by: Kailun Qin --- lcm/lcm/pub/vimapi/adaptor.py | 8 ++++++-- lcm/lcm/samples/tests.py | 14 ++++++++------ 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/lcm/lcm/pub/vimapi/adaptor.py b/lcm/lcm/pub/vimapi/adaptor.py index 4ce0e697..b7e9a34f 100644 --- a/lcm/lcm/pub/vimapi/adaptor.py +++ b/lcm/lcm/pub/vimapi/adaptor.py @@ -194,8 +194,12 @@ def create_port(vim_cache, res_cache, data, port, do_notify, res_type): } set_opt_val(param, "subnetId", subnet_id) set_opt_val(param, "macAddress", ignore_case_get(port["properties"], "mac_address")) - l3_address_data = port["properties"]["protocol_data"]["address_data"]["l3_address_data"] - set_opt_val(param, "ip", ignore_case_get(l3_address_data, "fixed_ip_address")) + ip_address = [] + for one_protocol_data in port["properties"]["protocol_data"]: + l3_address_data = one_protocol_data["address_data"]["l3_address_data"] + fixed_ip_address = ignore_case_get(l3_address_data, "fixed_ip_address") + ip_address.extend(fixed_ip_address) + set_opt_val(param, "ip", ip_address) set_opt_val(param, "vnicType", ignore_case_get(port["properties"], "vnic_type")) set_opt_val(param, "securityGroups", "") # TODO vim_id, tenant_name = location_info["vimid"], location_info["tenant"] diff --git a/lcm/lcm/samples/tests.py b/lcm/lcm/samples/tests.py index c626675f..01c87deb 100644 --- a/lcm/lcm/samples/tests.py +++ b/lcm/lcm/samples/tests.py @@ -207,13 +207,15 @@ inst_res_data = { "properties": { "name": "vNat_big_subnet_port", - "protocol_data": { - "address_data": { - "l3_address_data": { - "fixed_ip_address": "10.43.38.253" + "protocol_data": [ + { + "address_data": { + "l3_address_data": { + "fixed_ip_address": ["10.43.38.253"] + }, }, - }, - }, + } + ], "vnic_type": "normal", "role": "root", "virtual_network_interface_requirements": [ -- 2.16.6