From 0e0d72aaae35976e0ef895754bcbfd387debdb70 Mon Sep 17 00:00:00 2001 From: Ethan Lynn Date: Mon, 7 May 2018 10:45:23 +0800 Subject: Support multiple IP addresses on server create API Add multiple IP addresses support for VFC server create API Change-Id: Ib71dfa608a95b3176d0d16d887b1cf589ef1df99 Issue-ID: MULTICLOUD-224 Signed-off-by: Ethan Lynn --- vio/vio/pub/vim/vimapi/network/OperatePort.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/vio/vio/pub/vim/vimapi/network/OperatePort.py b/vio/vio/pub/vim/vimapi/network/OperatePort.py index 4a059f1..b9abb60 100644 --- a/vio/vio/pub/vim/vimapi/network/OperatePort.py +++ b/vio/vio/pub/vim/vimapi/network/OperatePort.py @@ -58,8 +58,13 @@ class OperatePort(BaseNet): subnet = network.subnet_get(body['subnetId']) body['subnetId'] = subnet.id if "ip" in body: - body['fixed_ips'] = [{'subnet_id': body.pop('subnetId'), - "ip_address": body.pop('ip')}] + ips = body.pop("ip").split(",") + body['fixed_ips'] = [] + subnet_id = body.pop('subnetId') + for ip in ips: + body['fixed_ips'].append({ + 'subnet_id': subnet_id, + "ip_address": ip}) else: body['fixed_ips'] = [{'subnet_id': body.pop('subnetId')}] port = network.port_create(**body) -- cgit 1.2.3-korg