summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--vio/vio/pub/utils/restcall.py40
-rw-r--r--vio/vio/swagger/urls.py181
2 files changed, 131 insertions, 90 deletions
diff --git a/vio/vio/pub/utils/restcall.py b/vio/vio/pub/utils/restcall.py
index 12934ff..d647770 100644
--- a/vio/vio/pub/utils/restcall.py
+++ b/vio/vio/pub/utils/restcall.py
@@ -526,6 +526,13 @@ class AAIClient(object):
logger.debug("pci_passthrough_capabilities_info: %s" % caps_dict)
hpa_caps.append(caps_dict)
+ # SRIOV NIC capabilities
+ caps_dict = self._get_sriov_nic_capabilities(
+ flavor['extra_specs'])
+ if len(caps_dict) > 0:
+ logger.debug("sriov_nic_capabilities_info: %s" % caps_dict)
+ hpa_caps.append(caps_dict)
+
# ovsdpdk capabilities
caps_dict = self._get_ovsdpdk_capabilities()
if len(caps_dict) > 0:
@@ -814,3 +821,36 @@ class AAIClient(object):
{'value': cloud_dpdk_info.get("libversion")})
})
return ovsdpdk_capability
+
+ def _get_sriov_nic_capabilities(self, extra_specs):
+ sriov_capability = {}
+ feature_uuid = uuid.uuid4()
+
+ if extra_specs.get('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': json.dumps({'value': value1[1]})
+ })
+ sriov_capability['hpa-feature-attributes'].append({
+ 'hpa-attribute-key': 'pciVendorId',
+ 'hpa-attribute-value': json.dumps({'value': value2[3]})
+ })
+ sriov_capability['hpa-feature-attributes'].append({
+ 'hpa-attribute-key': 'pciDeviceId',
+ 'hpa-attribute-value': json.dumps(value2[4])
+ })
+ sriov_capability['hpa-feature-attributes'].append({
+ 'hpa-attribute-key': 'physicalNetwork',
+ 'hpa-attribute-value': json.dumps(value2[5])
+ })
+
+ return sriov_capability
diff --git a/vio/vio/swagger/urls.py b/vio/vio/swagger/urls.py
index bae4d15..c509a42 100644
--- a/vio/vio/swagger/urls.py
+++ b/vio/vio/swagger/urls.py
@@ -125,6 +125,97 @@ urlpatterns = [
# swagger
url(r'^api/multicloud-vio/v0/swagger.json$', SwaggerJsonView.as_view()),
+
+ # fake urls
+ url(r'^api/multicloud-vio/v[01]/vmware[_/]fake/neutron/networks$',
+ FakeNeutronNetwork.as_view()),
+ url(r'^api/multicloud-vio/v[01]/vmware[_/]fake/neutron/networks/'
+ r'(?P<netid>[0-9a-z-A-Z]+)$',
+ FakeNeutronDetail.as_view()),
+ url(r'^api/multicloud-vio/v[01]/vmware[_/]fake/capacity_check$',
+ FakeCapacity.as_view()),
+ url(r'^api/multicloud-vio/v[01]/vmware[_/]fake/identity/v3',
+ FakeToken.as_view()),
+ url(r'api/multicloud-vio/v[01]/vmware[_/]fake/identity/v2.0',
+ FakeTokenV2.as_view()),
+ url(r'^api/multicloud-vio/v[01]/vmware[_/]fake/identity/projects$',
+ FakeProjects.as_view()),
+ url(r'^api/multicloud-vio/v[01]/vmware[_/]fake/identity/projects/'
+ r'(?P<projectid>[0-9a-z-A-Z]+)$',
+ FakeProjects.as_view()),
+ url(r'api/multicloud-vio/v[01]/vmware[_/]fake/identity/tenants',
+ FakeTenants.as_view()),
+ url(r'^api/multicloud-vio/v[01]/vmware[_/]fake/nova/'
+ r'(?P<tenantid>[0-9a-z-A-Z\-\_]+)'
+ r'/os-hypervisors/detail$',
+ FakeNovaHypervisors.as_view()),
+ url(r'^api/multicloud-vio/v[01]/vmware[_/]fake/nova/'
+ r'(?P<tenantid>[0-9a-z-A-Z\-\_]+)/os-hypervisors/'
+ r'(?P<hyperid>[0-9a-z-A-Z]+)$',
+ FakeNovaHypervisors.as_view()),
+ url(r'^api/multicloud-vio/v[01]/vmware[_/]fake/nova/'
+ r'(?P<tenantid>[0-9a-z-A-Z\-\_]+)/os-hypervisors/'
+ r'(?P<hyperid>[0-9a-z-A-Z]+)/uptime$',
+ FakeNovaHypervisorsUptime.as_view()),
+ url(r'^api/multicloud-vio/v[01]/vmware[_/]fake/nova/'
+ r'(?P<tenantid>[0-9a-z-A-Z\-\_]+)/os-aggregates$',
+ FakeNovaAggregate.as_view()),
+ url(r'^api/multicloud-vio/v[01]/vmware[_/]fake/nova/'
+ r'(?P<tenantid>[0-9a-z-A-Z\-\_]+)/servers$',
+ FakeNovaServer.as_view()),
+ url(r'^api/multicloud-vio/v[01]/vmware[_/]fake/nova/'
+ r'(?P<tenantid>[0-9a-z-A-Z\-\_]+)/servers/detail$',
+ FakeNovaServerDetail.as_view()),
+ url(r'^api/multicloud-vio/v[01]/vmware[_/]fake/nova/'
+ r'(?P<tenantid>[0-9a-z-A-Z\-\_]+)/servers/'
+ r'(?P<serverid>[0-9a-z-A-Z]+)$',
+ FakeNovaServer.as_view()),
+ url(r'^api/multicloud-vio/v[01]/vmware[_/]fake/nova/'
+ r'(?P<tenantid>[0-9a-z-A-Z\-\_]+)/servers/'
+ r'(?P<serverid>[0-9a-z-A-Z]+)/action$',
+ FakeNovaServer.as_view()),
+ url(r'^api/multicloud-vio/v[01]/vmware[_/]fake/nova/'
+ r'(?P<tenantid>[0-9a-z-A-Z\-\_]+)/flavors$',
+ FakeFlavorList.as_view()),
+ url(r'^api/multicloud-vio/v[01]/vmware[_/]fake/nova/'
+ r'(?P<tenantid>[0-9a-z-A-Z\-\_]+)/flavors/'
+ r'(?P<flavorid>[0-9a-z-A-Z]+)$',
+ FakeFlavorDetail.as_view()),
+ url(r'^api/multicloud-vio/v[01]/vmware[_/]fake/glance/v2/schemas/image$',
+ FakeImageSchema.as_view()),
+ url(r'^api/multicloud-vio/v[01]/vmware[_/]fake/glance/v2/images/'
+ r'(?P<imageid>[0-9a-z-A-Z\-\_]+)$',
+ FakeImageDetail.as_view()),
+ url(r'^api/multicloud-vio/v[01]/vmware[_/]fake/glance/v2/images',
+ FakeImage.as_view()),
+ url(r'^api/multicloud-vio/v[01]/vmware[_/]fake/glance/v2/image/file/'
+ r'(?P<imageid>[0-9a-z-A-Z\-\_]+)$',
+ FakeImageDownload.as_view()),
+ url(r'^api/multicloud-vio/v[01]/vmware[_/]fake/glance/v2/image/file$',
+ FakeImageUpload.as_view()),
+ url(r'^api/multicloud-vio/v[01]/vmware[_/]fake/glance/version',
+ FakeImageVersion.as_view()),
+ url(r'^api/multicloud-vio/v[01]/vmware[_/]fake/neutron$',
+ FakeNeutron.as_view()),
+ url(r'api/multicloud-vio/v[01]/vmware[_/]fake/heat/'
+ r'(?P<tenantid>[0-9a-z-A-Z\-\_]+)'
+ r'/stacks/(?P<stack_id>[0-9a-z-A-Z\-\_]+)/resources$',
+ FakeHeatResources.as_view()),
+ url(r'api/multicloud-vio/v[01]/vmware[_/]fake/heat/'
+ r'(?P<tenantid>[0-9a-z-A-Z\-\_]+)'
+ r'/stacks$', FakeHeatService.as_view()),
+ url(r'api/multicloud-vio/v[01]/vmware[_/]fake/heat/'
+ r'(?P<tenantid>[0-9a-z-A-Z\-\_]+)'
+ r'/stacks/preview$', FakeHeatServicePreview.as_view()),
+ url(r'api/multicloud-vio/v[01]/vmware[_/]fake/heat/'
+ r'(?P<tenantid>[0-9a-z-A-Z\-\_]+)'
+ r'/stacks/(?P<stackName>[0-9a-z-A-Z\-\_]+)',
+ FakeHeatService.as_view()),
+ url(r'api/multicloud-vio/v[01]/vmware[_/]fake/heat/'
+ r'(?P<tenantid>[0-9a-z-A-Z\-\_]+)'
+ r'/stacks/(?P<stackName>[0-9a-z-A-Z\-\_]+)'
+ r'/(?P<stackID>[0-9a-z-A-Z\-\_]+)$', FakeHeatService.as_view()),
+
# vio
url(r'^api/multicloud-vio/v0/(?P<vimid>[0-9a-zA-Z_-]+)/'
r'tenants$', ListTenantsView.as_view()),
@@ -285,96 +376,6 @@ urlpatterns = [
r'(?P<workload_id>[0-9a-zA-Z\-\_]+)$',
GetDelStackViewV1.as_view()),
- # fake urls
- url(r'^api/multicloud-vio/v[01]/vmware[_/]fake/neutron/networks$',
- FakeNeutronNetwork.as_view()),
- url(r'^api/multicloud-vio/v[01]/vmware[_/]fake/neutron/networks/'
- r'(?P<netid>[0-9a-z-A-Z]+)$',
- FakeNeutronDetail.as_view()),
- url(r'^api/multicloud-vio/v[01]/vmware[_/]fake/capacity_check$',
- FakeCapacity.as_view()),
- url(r'^api/multicloud-vio/v[01]/vmware[_/]fake/identity/v3',
- FakeToken.as_view()),
- url(r'api/multicloud-vio/v[01]/vmware[_/]fake/identity/v2.0',
- FakeTokenV2.as_view()),
- url(r'^api/multicloud-vio/v[01]/vmware[_/]fake/identity/projects$',
- FakeProjects.as_view()),
- url(r'^api/multicloud-vio/v[01]/vmware[_/]fake/identity/projects/'
- r'(?P<projectid>[0-9a-z-A-Z]+)$',
- FakeProjects.as_view()),
- url(r'api/multicloud-vio/v[01]/vmware[_/]fake/identity/tenants',
- FakeTenants.as_view()),
- url(r'^api/multicloud-vio/v[01]/vmware[_/]fake/nova/'
- r'(?P<tenantid>[0-9a-z-A-Z\-\_]+)'
- r'/os-hypervisors/detail$',
- FakeNovaHypervisors.as_view()),
- url(r'^api/multicloud-vio/v[01]/vmware[_/]fake/nova/'
- r'(?P<tenantid>[0-9a-z-A-Z\-\_]+)/os-hypervisors/'
- r'(?P<hyperid>[0-9a-z-A-Z]+)$',
- FakeNovaHypervisors.as_view()),
- url(r'^api/multicloud-vio/v[01]/vmware[_/]fake/nova/'
- r'(?P<tenantid>[0-9a-z-A-Z\-\_]+)/os-hypervisors/'
- r'(?P<hyperid>[0-9a-z-A-Z]+)/uptime$',
- FakeNovaHypervisorsUptime.as_view()),
- url(r'^api/multicloud-vio/v[01]/vmware[_/]fake/nova/'
- r'(?P<tenantid>[0-9a-z-A-Z\-\_]+)/os-aggregates$',
- FakeNovaAggregate.as_view()),
- url(r'^api/multicloud-vio/v[01]/vmware[_/]fake/nova/'
- r'(?P<tenantid>[0-9a-z-A-Z\-\_]+)/servers$',
- FakeNovaServer.as_view()),
- url(r'^api/multicloud-vio/v[01]/vmware[_/]fake/nova/'
- r'(?P<tenantid>[0-9a-z-A-Z\-\_]+)/servers/detail$',
- FakeNovaServerDetail.as_view()),
- url(r'^api/multicloud-vio/v[01]/vmware[_/]fake/nova/'
- r'(?P<tenantid>[0-9a-z-A-Z\-\_]+)/servers/'
- r'(?P<serverid>[0-9a-z-A-Z]+)$',
- FakeNovaServer.as_view()),
- url(r'^api/multicloud-vio/v[01]/vmware[_/]fake/nova/'
- r'(?P<tenantid>[0-9a-z-A-Z\-\_]+)/servers/'
- r'(?P<serverid>[0-9a-z-A-Z]+)/action$',
- FakeNovaServer.as_view()),
- url(r'^api/multicloud-vio/v[01]/vmware[_/]fake/nova/'
- r'(?P<tenantid>[0-9a-z-A-Z\-\_]+)/flavors$',
- FakeFlavorList.as_view()),
- url(r'^api/multicloud-vio/v[01]/vmware[_/]fake/nova/'
- r'(?P<tenantid>[0-9a-z-A-Z\-\_]+)/flavors/'
- r'(?P<flavorid>[0-9a-z-A-Z]+)$',
- FakeFlavorDetail.as_view()),
- url(r'^api/multicloud-vio/v[01]/vmware[_/]fake/glance/v2/schemas/image$',
- FakeImageSchema.as_view()),
- url(r'^api/multicloud-vio/v[01]/vmware[_/]fake/glance/v2/images/'
- r'(?P<imageid>[0-9a-z-A-Z\-\_]+)$',
- FakeImageDetail.as_view()),
- url(r'^api/multicloud-vio/v[01]/vmware[_/]fake/glance/v2/images',
- FakeImage.as_view()),
- url(r'^api/multicloud-vio/v[01]/vmware[_/]fake/glance/v2/image/file/'
- r'(?P<imageid>[0-9a-z-A-Z\-\_]+)$',
- FakeImageDownload.as_view()),
- url(r'^api/multicloud-vio/v[01]/vmware[_/]fake/glance/v2/image/file$',
- FakeImageUpload.as_view()),
- url(r'^api/multicloud-vio/v[01]/vmware[_/]fake/glance/version',
- FakeImageVersion.as_view()),
- url(r'^api/multicloud-vio/v[01]/vmware[_/]fake/neutron$',
- FakeNeutron.as_view()),
- url(r'api/multicloud-vio/v[01]/vmware[_/]fake/heat/'
- r'(?P<tenantid>[0-9a-z-A-Z\-\_]+)'
- r'/stacks/(?P<stack_id>[0-9a-z-A-Z\-\_]+)/resources$',
- FakeHeatResources.as_view()),
- url(r'api/multicloud-vio/v[01]/vmware[_/]fake/heat/'
- r'(?P<tenantid>[0-9a-z-A-Z\-\_]+)'
- r'/stacks$', FakeHeatService.as_view()),
- url(r'api/multicloud-vio/v[01]/vmware[_/]fake/heat/'
- r'(?P<tenantid>[0-9a-z-A-Z\-\_]+)'
- r'/stacks/preview$', FakeHeatServicePreview.as_view()),
- url(r'api/multicloud-vio/v[01]/vmware[_/]fake/heat/'
- r'(?P<tenantid>[0-9a-z-A-Z\-\_]+)'
- r'/stacks/(?P<stackName>[0-9a-z-A-Z\-\_]+)',
- FakeHeatService.as_view()),
- url(r'api/multicloud-vio/v[01]/vmware[_/]fake/heat/'
- r'(?P<tenantid>[0-9a-z-A-Z\-\_]+)'
- r'/stacks/(?P<stackName>[0-9a-z-A-Z\-\_]+)'
- r'/(?P<stackID>[0-9a-z-A-Z\-\_]+)$', FakeHeatService.as_view()),
-
# Registry
url(r'^api/multicloud-vio/v0/(?P<vimid>[0-9a-z-A-Z\-\_]+)/registry$',
Registry.as_view()),