summaryrefslogtreecommitdiffstats
path: root/lcm/lcm/pub/vimapi
diff options
context:
space:
mode:
authorHuang Haibin <haibin.huang@intel.com>2018-09-04 20:13:58 +0800
committerHuang Haibin <haibin.huang@intel.com>2018-09-06 11:18:53 +0800
commit675e69bc8abbf5d9a38b68b5400c63a64d231be0 (patch)
tree83ce98119d9e48553aa8789e793b4ec37f908805 /lcm/lcm/pub/vimapi
parent0b8b410f563039cfc8879631bcb2587974de7875 (diff)
Add port of SR-IOV NIC support
Change-Id: I2f50063d6e9a7c383b62e81bd9cefb532172cae3 Issue-ID: VFC-939 Signed-off-by: Huang Haibin <haibin.huang@intel.com>
Diffstat (limited to 'lcm/lcm/pub/vimapi')
-rw-r--r--lcm/lcm/pub/vimapi/adaptor.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/lcm/lcm/pub/vimapi/adaptor.py b/lcm/lcm/pub/vimapi/adaptor.py
index 8ebddab0..bbc91098 100644
--- a/lcm/lcm/pub/vimapi/adaptor.py
+++ b/lcm/lcm/pub/vimapi/adaptor.py
@@ -15,6 +15,7 @@
import logging
import time
import ast
+import json
from lcm.pub.utils.values import ignore_case_get, set_opt_val
from lcm.pub.msapi.aai import get_flavor_info
@@ -245,8 +246,17 @@ def create_port(vim_cache, res_cache, data, port, do_notify, res_type):
l3_address_data = one_protocol_data["address_data"]["l3_address_data"] # l3 is not 13
fixed_ip_address = ignore_case_get(l3_address_data, "fixed_ip_address")
ip_address.extend(fixed_ip_address)
+ for one_virtual_network_interface in port["properties"]["virtual_network_interface_requirements"]:
+ interfaceTypeString = one_virtual_network_interface["network_interface_requirements"]["interfaceType"]
+ interfaceType = json.loads(interfaceTypeString)["configuration-value"]
+ vnic_type = ignore_case_get(port["properties"], "vnic_type")
+ if vnic_type == "":
+ if interfaceType == "SR-IOV":
+ set_opt_val(param, "vnicType", "direct")
+ else:
+ set_opt_val(param, "vnicType", vnic_type)
+
set_opt_val(param, "ip", ",".join(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"]
tenant_id = get_tenant_id(vim_cache, vim_id, tenant_name)