diff options
author | Huang Haibin <haibin.huang@intel.com> | 2018-08-23 14:50:14 +0800 |
---|---|---|
committer | Huang Haibin <haibin.huang@intel.com> | 2018-09-15 09:56:05 +0800 |
commit | a2ceda0b36ebdac266bfa5cddfd64a786455e96a (patch) | |
tree | d3767b1fee43fa66f8dfdad6914af9abd0909851 /share/newton_base | |
parent | 676ec47b90e7d98b3bf6655578e1c22b04c6e3a9 (diff) |
Add the registered sriov-nic flow
Change-Id: I234ed47b45c02abc1f7e496ba31baee5d02f32be
Issue-ID: MULTICLOUD-251
Signed-off-by: Huang Haibin <haibin.huang@intel.com>
Diffstat (limited to 'share/newton_base')
-rw-r--r-- | share/newton_base/registration/registration.py | 35 |
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() |