summaryrefslogtreecommitdiffstats
path: root/share/newton_base/registration/registration.py
diff options
context:
space:
mode:
authorBin Hu <bh526r@att.com>2018-09-17 04:01:55 +0000
committerGerrit Code Review <gerrit@onap.org>2018-09-17 04:01:55 +0000
commit5a925b04bee358d573e0f49caa37690399c32204 (patch)
tree1e571053131d00ec014a87cc903691ca1f09c91d /share/newton_base/registration/registration.py
parentd07b4081cd7e1771e99ea4b4012852fb296a057e (diff)
parenta2ceda0b36ebdac266bfa5cddfd64a786455e96a (diff)
Merge "Add the registered sriov-nic flow"
Diffstat (limited to 'share/newton_base/registration/registration.py')
-rw-r--r--share/newton_base/registration/registration.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/share/newton_base/registration/registration.py b/share/newton_base/registration/registration.py
index 46447c07..01748f8a 100644
--- a/share/newton_base/registration/registration.py
+++ b/share/newton_base/registration/registration.py
@@ -252,6 +252,12 @@ class Registry(APIView):
self._logger.debug("pci_passthrough_capabilities_info: %s" % caps_dict)
hpa_caps.append(caps_dict)
+ # SRIOV-NIC capabilities
+ caps_dict = self._get_sriov_nic_capabilities(extra_specs)
+ if len(caps_dict) > 0:
+ self._logger.debug("sriov_nic_capabilities_info: %s" % caps_dict)
+ hpa_caps.append(caps_dict)
+
# ovsdpdk capabilities
caps_dict = self._get_ovsdpdk_capabilities(extra_specs, viminfo)
if len(caps_dict) > 0:
@@ -469,6 +475,35 @@ class Registry(APIView):
return pci_passthrough_capability
+ def _get_sriov_nic_capabilities(self, extra_specs):
+ sriov_capability = {}
+ feature_uuid = uuid.uuid4()
+
+ if extra_specs.has_key('sriov_nic'):
+ value1 = extra_specs['sriov_nic'].split(':')
+ value2 = value1[0].split('-')
+
+ sriov_capability['hpa-capability-id'] = str(feature_uuid)
+ sriov_capability['hpa-feature'] = 'sriovNICNetwork'
+ sriov_capability['architecture'] = str(value2[2])
+ sriov_capability['hpa-version'] = 'v1'
+
+ sriov_capability['hpa-feature-attributes'] = []
+ sriov_capability['hpa-feature-attributes'].append({'hpa-attribute-key': 'pciCount',
+ 'hpa-attribute-value':
+ '{{\"value\":\"{0}\"}}'.format(value1[1]) })
+ sriov_capability['hpa-feature-attributes'].append({'hpa-attribute-key': 'pciVendorId',
+ 'hpa-attribute-value':
+ '{{\"value\":\"{0}\"}}'.format(value2[3]) })
+ sriov_capability['hpa-feature-attributes'].append({'hpa-attribute-key': 'pciDeviceId',
+ 'hpa-attribute-value':
+ '{{\"value\":\"{0}\"}}'.format(value2[4]) })
+ sriov_capability['hpa-feature-attributes'].append({'hpa-attribute-key': 'physicalNetwork',
+ 'hpa-attribute-value':
+ '{{\"value\":\"{0}\"}}'.format(value2[5]) })
+
+ return sriov_capability
+
def _get_ovsdpdk_capabilities(self, extra_specs, viminfo):
ovsdpdk_capability = {}
feature_uuid = uuid.uuid4()