summaryrefslogtreecommitdiffstats
path: root/ocata
diff options
context:
space:
mode:
authorBin Yang <bin.yang@windriver.com>2018-03-20 14:45:01 +0000
committerGerrit Code Review <gerrit@onap.org>2018-03-20 14:45:01 +0000
commitf01a05f3d12c2677f9f4dcaca20697642e13e3e4 (patch)
treefce7bc7079929ea97d47303b7baf47d80dc2ace5 /ocata
parent97a5f7b7b26cde8827c6ba52eb6997ef646cd107 (diff)
parentfeda3be2cb84ed1a5778aad80c8becad6237ff65 (diff)
Merge "Update pci passthrouge of HPA to AAI"
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("]")