summaryrefslogtreecommitdiffstats
path: root/ocata
diff options
context:
space:
mode:
authorHuang Haibin <haibin.huang@intel.com>2018-03-21 06:03:50 +0800
committerHuang Haibin <haibin.huang@intel.com>2018-03-21 06:17:51 +0800
commitfeda3be2cb84ed1a5778aad80c8becad6237ff65 (patch)
treeda4bab9e7db443430b7e15dc01b4bdad5b9b6cdf /ocata
parentbbfb70d39ea3a2dad2e89aad64714b7cb6819147 (diff)
Update pci passthrouge of HPA to AAI
Change-Id: I1d302a91816a322f4b20fa1a1f59847eb670cc01 Issue-ID: MULTICLOUD-194 Signed-off-by: Huang Haibin <haibin.huang@intel.com>
Diffstat (limited to 'ocata')
-rw-r--r--ocata/ocata/registration/views/registration.py44
1 files changed, 32 insertions, 12 deletions
diff --git a/ocata/ocata/registration/views/registration.py b/ocata/ocata/registration/views/registration.py
index 1bcfc60d..e3121240 100644
--- a/ocata/ocata/registration/views/registration.py
+++ b/ocata/ocata/registration/views/registration.py
@@ -77,14 +77,14 @@ class Registry(newton_registration.Registry):
if len(properties):
flavor_info['flavor-properties'] = flavor['properties']
hpa_caps.append("[")
- values = flavor['name'].split('_')
for p in range(len(properties)):
- if (properties[p] == "hw:cpu_policy") :
+ value = properties[p].split('=')[1]
+ if (properties[p].find("hw:cpu_policy") != -1) :
hpa_caps.append("{'hpa-attribute-key':'logicalCpuThreadPinningPolicy', ")
- hpa_caps.append("'hpa-attribute-value': {'value':'" + str(values[2]) + "'}}, ")
- if (properties[p] == "hw:cpu_thread_policy") :
+ hpa_caps.append("'hpa-attribute-value': {'value':'" + value + "'}}, ")
+ if (properties[p].find("hw:cpu_thread_policy") != -1) :
hpa_caps.append("{'hpa-attribute-key':'logicalCpuPinningPolicy', ")
- hpa_caps.append("'hpa-attribute-value': {'value':'" + str(values[3]) + "'}}, ")
+ hpa_caps.append("'hpa-attribute-value': {'value':'" + value + "'}}, ")
hpa_caps.append("]")
hpa_caps.append("},")
@@ -97,17 +97,17 @@ class Registry(newton_registration.Registry):
if len(properties):
flavor_info['flavor-properties'] = flavor['properties']
hpa_caps.append("[")
- values = flavor['name'].split('_')
for p in range(len(properties)):
- if (properties[p] == "hw:cpu_sockets") :
+ value = properties[p].split('=')[1]
+ if (properties[p].find("hw:cpu_sockets") != -1) :
hpa_caps.append("{'hpa-attribute-key':'numCpuSockets', ")
- hpa_caps.append("'hpa-attribute-value': {'value':'" + str(values[2]) + "'}}, ")
- if (properties[p] == "hw:cpu_cores") :
+ hpa_caps.append("'hpa-attribute-value': {'value':'" + value + "'}}, ")
+ if (properties[p].find("hw:cpu_cores") != -1) :
hpa_caps.append("{'hpa-attribute-key':'numCpuCores', ")
- hpa_caps.append("'hpa-attribute-value': {'value':'" + str(values[3]) + "'}}, ")
- if (properties[p] == "hw:cpu_threads") :
+ hpa_caps.append("'hpa-attribute-value': {'value':'" + value + "'}}, ")
+ if (properties[p].find("hw:cpu_threads") != -1) :
hpa_caps.append("{'hpa-attribute-key':'numCpuThreads', ")
- hpa_caps.append("'hpa-attribute-value': {'value':'" + str(values[4]) + "'}}, ")
+ hpa_caps.append("'hpa-attribute-value': {'value':'" + value + "'}}, ")
hpa_caps.append("]")
hpa_caps.append("},")
@@ -200,6 +200,26 @@ class Registry(newton_registration.Registry):
hpa_caps.append("]")
hpa_caps.append("},")
+ elif (flavor['name'].find('onap.pci_passthrough') != -1) :
+ hpa_caps.append("{'hpaCapabilityId': '" + str(uuid4) + "', ")
+ hpa_caps.append("'hpaFeature': 'pciPassthrough', ")
+ hpa_caps.append("'version': 'v1', ")
+ if len(properties):
+ values = properties[0].split('-')
+ hpa_caps.append("'hardwareArchitecture': '" + values[2] + "', ")
+
+ flavor_info['flavor-properties'] = flavor['properties']
+ hpa_caps.append("[")
+ value = values[4].split(':')
+ hpa_caps.append("{'hpa-attribute-key':'pciCount', ")
+ hpa_caps.append("'hpa-attribute-value': {'value':'" + value[1] + "'}}, ")
+ hpa_caps.append("{'hpa-attribute-key':'pciVendorId', ")
+ hpa_caps.append("'hpa-attribute-value': {'value':'" + values[3] + "'}}, ")
+ hpa_caps.append("{'hpa-attribute-key':'pciDeviceId', ")
+ hpa_caps.append("'hpa-attribute-value': {'value':'" + value[0] + "'}}, ")
+ hpa_caps.append("]")
+ hpa_caps.append("},")
+
else:
self._logger.info("can not support this flavor type")
hpa_caps.append("]")