diff options
-rw-r--r-- | vio/docker/Dockerfile | 2 | ||||
-rw-r--r-- | vio/vio/pub/utils/fileutil.py | 2 | ||||
-rw-r--r-- | vio/vio/pub/vim/vimapi/keystone/auth.py | 2 | ||||
-rw-r--r-- | vio/vio/swagger/multivim.server.swagger.json | 82 | ||||
-rw-r--r-- | vio/vio/swagger/urls.py | 197 | ||||
-rw-r--r-- | vio/vio/swagger/views/capacity/views.py | 6 | ||||
-rw-r--r-- | vio/vio/swagger/views/extensions/views.py | 6 | ||||
-rw-r--r-- | vio/vio/swagger/views/fakeplugin/fakeData/fakeResponse.py | 2 | ||||
-rw-r--r-- | vio/vio/swagger/views/flavor/views.py | 20 | ||||
-rw-r--r-- | vio/vio/swagger/views/hypervisor/views.py | 6 | ||||
-rw-r--r-- | vio/vio/swagger/views/image/views.py | 32 | ||||
-rw-r--r-- | vio/vio/swagger/views/limits/views.py | 6 | ||||
-rw-r--r-- | vio/vio/swagger/views/network/views.py | 20 | ||||
-rw-r--r-- | vio/vio/swagger/views/port/views.py | 20 | ||||
-rw-r--r-- | vio/vio/swagger/views/registry/views.py | 12 | ||||
-rw-r--r-- | vio/vio/swagger/views/server/views.py | 20 | ||||
-rw-r--r-- | vio/vio/swagger/views/service/views.py | 6 | ||||
-rw-r--r-- | vio/vio/swagger/views/subnet/views.py | 20 | ||||
-rw-r--r-- | vio/vio/swagger/views/tenant/views.py | 6 | ||||
-rw-r--r-- | vio/vio/swagger/views/volume/views.py | 20 |
20 files changed, 437 insertions, 50 deletions
diff --git a/vio/docker/Dockerfile b/vio/docker/Dockerfile index 2e3f30d..ba78332 100644 --- a/vio/docker/Dockerfile +++ b/vio/docker/Dockerfile @@ -20,7 +20,7 @@ RUN apt-get update && \ RUN cd /opt/ && \ - wget -q -O multicloud-vio.zip 'https://nexus.onap.org/service/local/artifact/maven/redirect?r=snapshots&g=org.onap.multicloud.openstack.vmware&a=multicloud-openstack-vmware&v=LATEST&e=zip' && \ + wget -q -O multicloud-vio.zip 'https://nexus.onap.org/service/local/artifact/maven/redirect?r=staging&g=org.onap.multicloud.openstack.vmware&a=multicloud-openstack-vmware&v=LATEST&e=zip' && \ unzip multicloud-vio.zip && \ rm -rf multicloud-vio.zip && \ pip install -r vio/requirements.txt diff --git a/vio/vio/pub/utils/fileutil.py b/vio/vio/pub/utils/fileutil.py index 9adf807..094e71e 100644 --- a/vio/vio/pub/utils/fileutil.py +++ b/vio/vio/pub/utils/fileutil.py @@ -20,7 +20,7 @@ logger = logging.getLogger(__name__) def make_dirs(path): if not os.path.exists(path): - os.makedirs(path, 0777) + os.makedirs(path, mode=0o777) def delete_dirs(path): diff --git a/vio/vio/pub/vim/vimapi/keystone/auth.py b/vio/vio/pub/vim/vimapi/keystone/auth.py index 504fb4a..866df20 100644 --- a/vio/vio/pub/vim/vimapi/keystone/auth.py +++ b/vio/vio/pub/vim/vimapi/keystone/auth.py @@ -22,4 +22,4 @@ logger = logging.getLogger(__name__) def login(data): - print data + print(data) diff --git a/vio/vio/swagger/multivim.server.swagger.json b/vio/vio/swagger/multivim.server.swagger.json index bd37954..112c03f 100644 --- a/vio/vio/swagger/multivim.server.swagger.json +++ b/vio/vio/swagger/multivim.server.swagger.json @@ -219,6 +219,65 @@ } } } + }, + "/{vimid}/{tenantid}/servers/{serverid}/action": { + "post": { + "tags": [ + "vim servers action" + ], + "summary": "operate a server", + "description": "operate a server", + "operationId": "operate_vim_server", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "vimid", + "in": "path", + "description": "vim instance id", + "required": true, + "type": "string" + }, + { + "name": "tenantid", + "in": "path", + "description": "tenant UUID", + "required": true, + "type": "string" + }, + { + "name": "serverid", + "in": "path", + "description": "vim server id", + "required": true, + "type": "string" + }, + { + "in": "body", + "name": "body", + "description": "operate vim server request param", + "required": true, + "schema": { + "$ref": "#/definitions/OperateVimServer" + } + } + ], + "responses": { + "202": { + "description": "successful operation" + }, + "404": { + "description": "the vim id, tenant UUID or server id is wrong" + }, + "500": { + "description": "the vim server is not accessable" + } + } + } } }, "definitions": { @@ -488,6 +547,29 @@ "description": "0: Already exist 1: Newly created" } } + }, + "OperateVimServer": { + "type": "object", + "properties": { + "os-start": { + "type": "null", + "description": "the action to start a stopped server" + }, + "os-stop": { + "type": "null", + "description": "the action to stop a running server" + }, + "reboot": { + "type": "object", + "description": "The action to reboot a server", + "properties": { + "type": { + "type": "string", + "description": "the type of the reboot action: the valid values are HARD and SOFT" + } + } + } + } } } } diff --git a/vio/vio/swagger/urls.py b/vio/vio/swagger/urls.py index c68c297..b7bdbcf 100644 --- a/vio/vio/swagger/urls.py +++ b/vio/vio/swagger/urls.py @@ -31,6 +31,25 @@ from vio.swagger.views.network.views import DeleteNetworkView from vio.swagger.views.subnet.views import CreateSubnetView, DeleteSubnetView from vio.swagger.views.port.views import CreatePortView, DeletePortView +# V1 API +from vio.swagger.views.image.views import CreateListImagesViewV1 +from vio.swagger.views.image.views import GetDeleteImageViewV1 +from vio.swagger.views.image.views import CreateImageFileViewV1 +from vio.swagger.views.image.views import GetImageFileViewV1 +from vio.swagger.views.volume.views import CreateListVolumeViewV1 +from vio.swagger.views.volume.views import GetDeleteVolumeViewV1 +from vio.swagger.views.server.views import ListServersViewV1, GetServerViewV1 +from vio.swagger.views.flavor.views import FlavorsViewV1, FlavorViewV1 +from vio.swagger.views.limits.views import LimitsViewV1 +from vio.swagger.views.hypervisor.views import HostViewV1 +from vio.swagger.views.service.views import HostsViewV1 +from vio.swagger.views.network.views import CreateNetworkViewV1 +from vio.swagger.views.network.views import DeleteNetworkViewV1 +from vio.swagger.views.subnet.views import CreateSubnetViewV1 +from vio.swagger.views.subnet.views import DeleteSubnetViewV1 +from vio.swagger.views.port.views import CreatePortViewV1, DeletePortViewV1 +from vio.swagger.views.tenant.views import ListTenantsViewV1 + # proxy from vio.swagger.views.proxyplugin.identity.views import TokenView from vio.swagger.views.proxyplugin.identity.views import TokenV2View @@ -47,14 +66,14 @@ from vio.swagger.views.proxyplugin.dns.views import DesignateServer from vio.swagger.views.proxyplugin.dns.views import DesignateVersionLink # Registry -from vio.swagger.views.registry.views import Registry -from vio.swagger.views.registry.views import UnRegistry +from vio.swagger.views.registry.views import Registry, RegistryV1 +from vio.swagger.views.registry.views import UnRegistry, UnRegistryV1 # Capacity Check -from vio.swagger.views.capacity.views import CapacityCheck +from vio.swagger.views.capacity.views import CapacityCheck, CapacityCheckV1 # Extensions -from vio.swagger.views.extensions.views import Extensions +from vio.swagger.views.extensions.views import Extensions, ExtensionsV1 # fake from vio.swagger.views.fakeplugin.identity.views import FakeProjects @@ -87,16 +106,6 @@ urlpatterns = [ # swagger url(r'^api/multicloud-vio/v0/swagger.json$', SwaggerJsonView.as_view()), - # fake urls - url(r'^api/multicloud-vio/v0/vmware_fake/neutron/networks$', - FakeNeutronNetwork.as_view()), - url(r'^api/multicloud-vio/v0/vmware_fake/neutron/networks/' - r'(?P<netid>[0-9a-z-A-Z]+)$', - FakeNeutronDetail.as_view()), - - url(r'^api/multicloud-vio/v0/vmware_fake/capacity_check$', - FakeCapacity.as_view()), - # vio url(r'^api/multicloud-vio/v0/(?P<vimid>[0-9a-zA-Z_-]+)/' r'tenants$', ListTenantsView.as_view()), @@ -161,87 +170,172 @@ urlpatterns = [ r'(?P<portid>[0-9a-zA-Z\-\_]+)$', DeletePortView.as_view()), + # V1 urls + url(r'^api/multicloud-vio/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)/' + r'(?P<cloud_region>[0-9a-zA-Z_-]+)/tenants$', + ListTenantsViewV1.as_view()), + url(r'^api/multicloud-vio/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)/' + r'(?P<cloud_region>[0-9a-zA-Z_-]+)/(?P<tenantid>[0-9a-zA-Z_-]+)/' + r'images$', + CreateListImagesViewV1.as_view()), + url(r'^api/multicloud-vio/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)/' + r'(?P<cloud_region>[0-9a-zA-Z_-]+)/(?P<tenantid>[0-9a-zA-Z_-]+)/' + r'images/(?P<imageid>[0-9a-zA-Z_-]+)$', + GetDeleteImageViewV1.as_view()), + url(r'^api/multicloud-vio/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)/' + r'(?P<cloud_region>[0-9a-zA-Z_-]+)/(?P<tenantid>[0-9a-zA-Z_-]+)/' + r'images/file$', + CreateImageFileViewV1.as_view()), + url(r'^api/multicloud-vio/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)/' + r'(?P<cloud_region>[0-9a-zA-Z_-]+)/(?P<tenantid>[0-9a-zA-Z_-]+)/' + r'images/file/(?P<imageid>[0-9a-zA-Z_-]+)$', + GetImageFileViewV1.as_view()), + url(r'^api/multicloud-vio/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)/' + r'(?P<cloud_region>[0-9a-zA-Z_-]+)/(?P<tenantid>[0-9a-zA-Z_-]+)/' + r'volumes$', + CreateListVolumeViewV1.as_view()), + url(r'^api/multicloud-vio/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)/' + r'(?P<cloud_region>[0-9a-zA-Z_-]+)/(?P<tenantid>[0-9a-zA-Z_-]+)/' + r'volumes/(?P<volumeid>[0-9a-zA-Z_-]+)$', + GetDeleteVolumeViewV1.as_view()), + url(r'^api/multicloud-vio/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)/' + r'(?P<cloud_region>[0-9a-zA-Z_-]+)/(?P<tenantid>[0-9a-zA-Z]+)/' + r'servers$', + ListServersViewV1.as_view()), + url(r'^api/multicloud-vio/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)/' + r'(?P<cloud_region>[0-9a-zA-Z_-]+)/(?P<tenantid>[0-9a-zA-Z]+)/' + r'servers/(?P<serverid>[0-9a-zA-Z_-]+)$', + GetServerViewV1.as_view()), + url(r'^api/multicloud-vio/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)/' + r'(?P<cloud_region>[0-9a-zA-Z_-]+)/(?P<tenantid>[0-9a-zA-Z]+)/' + r'flavors$', + FlavorsViewV1.as_view()), + url(r'^api/multicloud-vio/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)/' + r'(?P<cloud_region>[0-9a-zA-Z_-]+)/(?P<tenantid>[0-9a-zA-Z]+)/' + r'flavors/(?P<flavorid>[0-9a-zA-Z_-]+)$', + FlavorViewV1.as_view()), + url(r'^api/multicloud-vio/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)/' + r'(?P<cloud_region>[0-9a-zA-Z_-]+)/(?P<tenantid>[0-9a-zA-Z]+)/' + r'limits$', + LimitsViewV1.as_view()), + url(r'^api/multicloud-vio/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)/' + r'(?P<cloud_region>[0-9a-zA-Z_-]+)/(?P<tenantid>[0-9a-zA-Z]+)/hosts$', + HostsViewV1.as_view()), + url(r'^api/multicloud-vio/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)/' + r'(?P<cloud_region>[0-9a-zA-Z_-]+)/(?P<tenantid>[0-9a-zA-Z]+)/' + r'hosts/(?P<hostname>[0-9a-zA-Z_-]+)$', + HostViewV1.as_view()), + url(r'^api/multicloud-vio/v1/(?P<cloud_owner>[0-9a-zA-Z\-\_]+)/' + r'(?P<cloud_region>[0-9a-zA-Z_-]+)/(?P<tenantid>[0-9a-zA-Z\-\_]+)/' + r'networks$', + CreateNetworkViewV1.as_view()), + url(r'^api/multicloud-vio/v1/(?P<cloud_owner>[0-9a-zA-Z\-\_]+)/' + r'(?P<cloud_region>[0-9a-zA-Z_-]+)/(?P<tenantid>[0-9a-zA-Z\-\_]+)/' + r'networks/(?P<networkid>[0-9a-zA-Z\-\_]+)$', + DeleteNetworkViewV1.as_view()), + url(r'^api/multicloud-vio/v1/(?P<cloud_owner>[0-9a-zA-Z\-\_]+)/' + r'(?P<cloud_region>[0-9a-zA-Z_-]+)/(?P<tenantid>[0-9a-zA-Z\-\_]+)/' + r'subnets$', + CreateSubnetViewV1.as_view()), + url(r'^api/multicloud-vio/v1/(?P<cloud_owner>[0-9a-zA-Z\-\_]+)/' + r'(?P<cloud_region>[0-9a-zA-Z_-]+)/(?P<tenantid>[0-9a-zA-Z\-\_]+)/' + r'subnets/(?P<subnetid>[0-9a-zA-Z\-\_]+)$', + DeleteSubnetViewV1.as_view()), + url(r'^api/multicloud-vio/v1/(?P<cloud_owner>[0-9a-zA-Z\-\_]+)/' + r'(?P<cloud_region>[0-9a-zA-Z_-]+)/(?P<tenantid>[0-9a-zA-Z\-\_]+)/' + r'ports$', + CreatePortViewV1.as_view()), + url(r'^api/multicloud-vio/v1/(?P<cloud_owner>[0-9a-zA-Z\-\_]+)/' + r'(?P<cloud_region>[0-9a-zA-Z_-]+)/(?P<tenantid>[0-9a-zA-Z\-\_]+)/' + r'ports/(?P<portid>[0-9a-zA-Z\-\_]+)$', + DeletePortViewV1.as_view()), + # fake urls - url(r'^api/multicloud-vio/v0/vmware_fake/identity/v3', + 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/v0/vmware_fake/identity/v2.0', + url(r'api/multicloud-vio/v[01]/vmware[_/]fake/identity/v2.0', FakeTokenV2.as_view()), - url(r'^api/multicloud-vio/v0/vmware_fake/identity/projects$', + url(r'^api/multicloud-vio/v[01]/vmware[_/]fake/identity/projects$', FakeProjects.as_view()), - url(r'^api/multicloud-vio/v0/vmware_fake/identity/projects/' + 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/v0/vmware_fake/identity/tenants', + url(r'api/multicloud-vio/v[01]/vmware[_/]fake/identity/tenants', FakeTenants.as_view()), - url(r'^api/multicloud-vio/v0/vmware_fake/nova/' + 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/v0/vmware_fake/nova/' + 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/v0/vmware_fake/nova/' + 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/v0/vmware_fake/nova/' + 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/v0/vmware_fake/nova/' + 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/v0/vmware_fake/nova/' + 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/v0/vmware_fake/nova/' + 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/v0/vmware_fake/nova/' + 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/v0/vmware_fake/nova/' + 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/v0/vmware_fake/nova/' + 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/v0/vmware_fake/glance/v2/schemas/image$', + url(r'^api/multicloud-vio/v[01]/vmware[_/]fake/glance/v2/schemas/image$', FakeImageSchema.as_view()), - url(r'^api/multicloud-vio/v0/vmware_fake/glance/v2/images/' + 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/v0/vmware_fake/glance/v2/images', + url(r'^api/multicloud-vio/v[01]/vmware[_/]fake/glance/v2/images', FakeImage.as_view()), - url(r'^api/multicloud-vio/v0/vmware_fake/glance/v2/image/file/' + 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/v0/vmware_fake/glance/v2/image/file$', + url(r'^api/multicloud-vio/v[01]/vmware[_/]fake/glance/v2/image/file$', FakeImageUpload.as_view()), - url(r'^api/multicloud-vio/v0/vmware_fake/glance/version', + url(r'^api/multicloud-vio/v[01]/vmware[_/]fake/glance/version', FakeImageVersion.as_view()), - url(r'^api/multicloud-vio/v0/vmware_fake/neutron$', + url(r'^api/multicloud-vio/v[01]/vmware[_/]fake/neutron$', FakeNeutron.as_view()), - url(r'api/multicloud-vio/v0/vmware_fake/heat/' + 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/v0/vmware_fake/heat/' + 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/v0/vmware_fake/heat/' + 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/v0/vmware_fake/heat/' + 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/v0/vmware_fake/heat/' + 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()), @@ -251,10 +345,19 @@ urlpatterns = [ Registry.as_view()), url(r'^api/multicloud-vio/v0/(?P<vimid>[0-9a-z-A-Z\-\_]+)$', UnRegistry.as_view()), + url(r'^api/multicloud-vio/v1/(?P<cloud_owner>[0-9a-z-A-Z\-\_]+)/' + r'(?P<cloud_region>[0-9a-z-A-Z\-\_]+)/registry$', + RegistryV1.as_view()), + url(r'^api/multicloud-vio/v1/(?P<cloud_owner>[0-9a-z-A-Z\-\_]+)/' + r'(?P<cloud_region>[0-9a-z-A-Z\-\_]+)$', + UnRegistryV1.as_view()), # CapacityCheck url(r'^api/multicloud-vio/v0/(?P<vimid>[0-9a-z-A-Z\-\_]+)/capacity_check$', CapacityCheck.as_view()), + url(r'^api/multicloud-vio/v1/(?P<cloud_owner>[0-9a-z-A-Z\-\_]+)/' + r'(?P<cloud_region>[0-9a-z-A-Z\-\_]+)/capacity_check$', + CapacityCheckV1.as_view()), # proxy url(r'^api/multicloud-vio/v0/(?P<vimid>[0-9a-z-A-Z\-\_]+)/identity/v3', @@ -318,10 +421,12 @@ urlpatterns = [ DesignateServer.as_view()), # Extensions - url( - (r'^api/multicloud-vio/v0/(?P<vimid>[0-9a-z-A-Z\-\_]+)' - r'/extensions$'), + url(r'^api/multicloud-vio/v0/(?P<vimid>[0-9a-z-A-Z\-\_]+)' + r'/extensions$', Extensions.as_view()), + url(r'^api/multicloud-vio/v1/(?P<cloud_owner>[0-9a-z-A-Z\-\_]+)/' + r'(?P<cloud_region>[0-9a-z-A-Z\-\_]+)/extensions$', + ExtensionsV1.as_view()), ] diff --git a/vio/vio/swagger/views/capacity/views.py b/vio/vio/swagger/views/capacity/views.py index 1fdc481..f679931 100644 --- a/vio/vio/swagger/views/capacity/views.py +++ b/vio/vio/swagger/views/capacity/views.py @@ -121,3 +121,9 @@ class CapacityCheck(APIView): return Response(data={'result': True}, status=status.HTTP_200_OK) return Response(data={'result': False}, status=status.HTTP_200_OK) + + +class CapacityCheckV1(CapacityCheck): + def post(self, request, cloud_owner, cloud_region): + return super(CapacityCheckV1, self).post( + request, cloud_owner + "_" + cloud_region) diff --git a/vio/vio/swagger/views/extensions/views.py b/vio/vio/swagger/views/extensions/views.py index e590615..b3c7c5c 100644 --- a/vio/vio/swagger/views/extensions/views.py +++ b/vio/vio/swagger/views/extensions/views.py @@ -23,3 +23,9 @@ class Extensions(APIView): def get(self, request, vimid): return Response(data={'extensions': []}, status=status.HTTP_200_OK) + + +class ExtensionsV1(Extensions): + def get(self, request, cloud_owner, cloud_region): + return super(ExtensionsV1, self).get( + request, cloud_owner + "_" + cloud_region) diff --git a/vio/vio/swagger/views/fakeplugin/fakeData/fakeResponse.py b/vio/vio/swagger/views/fakeplugin/fakeData/fakeResponse.py index ff9c066..20362db 100644 --- a/vio/vio/swagger/views/fakeplugin/fakeData/fakeResponse.py +++ b/vio/vio/swagger/views/fakeplugin/fakeData/fakeResponse.py @@ -1673,7 +1673,7 @@ def _serverStatus(serverid): startTime = serverMapps[serverid]['turnStatusTime'] currentTime = datetime.now() - print currentTime - startTime + print(currentTime - startTime) if currentTime - startTime >= timedelta(seconds=10): if serverMapps[serverid]['status'] == "SPAWNING" \ or serverMapps[serverid]['status'] == "BUILDING": diff --git a/vio/vio/swagger/views/flavor/views.py b/vio/vio/swagger/views/flavor/views.py index 3666301..4e871b7 100644 --- a/vio/vio/swagger/views/flavor/views.py +++ b/vio/vio/swagger/views/flavor/views.py @@ -99,6 +99,16 @@ class FlavorsView(APIView): return Response(data=rsp, status=status.HTTP_200_OK) +class FlavorsViewV1(FlavorsView): + def post(self, request, cloud_owner, cloud_region, tenantid): + return super(FlavorsViewV1, self).post( + request, cloud_owner + "_" + cloud_region, tenantid) + + def get(self, request, cloud_owner, cloud_region, tenantid): + return super(FlavorsViewV1, self).get( + request, cloud_owner + "_" + cloud_region, tenantid) + + class FlavorView(APIView): def get(self, request, vimid, tenantid, flavorid): @@ -152,3 +162,13 @@ class FlavorView(APIView): return Response(data={'error': str(e)}, status=status.HTTP_500_INTERNAL_SERVER_ERROR) return Response(status=status.HTTP_204_NO_CONTENT) + + +class FlavorViewV1(FlavorView): + def get(self, request, cloud_owner, cloud_region, tenantid, flavorid): + return super(FlavorViewV1, self).get( + request, cloud_owner + "_" + cloud_region, tenantid, flavorid) + + def delete(self, request, cloud_owner, cloud_region, tenantid, flavorid): + return super(FlavorViewV1, self).delete( + request, cloud_owner + "_" + cloud_region, tenantid, flavorid) diff --git a/vio/vio/swagger/views/hypervisor/views.py b/vio/vio/swagger/views/hypervisor/views.py index 0f7e1f9..8648784 100644 --- a/vio/vio/swagger/views/hypervisor/views.py +++ b/vio/vio/swagger/views/hypervisor/views.py @@ -69,3 +69,9 @@ class HostView(APIView): 'host': nova_utils.hypervisor_formatter(hv)} return Response(data=rsp, status=status.HTTP_200_OK) + + +class HostViewV1(HostView): + def get(self, request, cloud_owner, cloud_region, tenantid, hostname): + return super(HostViewV1, self).get( + request, cloud_owner + "_" + cloud_region, tenantid, hostname) diff --git a/vio/vio/swagger/views/image/views.py b/vio/vio/swagger/views/image/views.py index 9c6da70..6df6710 100644 --- a/vio/vio/swagger/views/image/views.py +++ b/vio/vio/swagger/views/image/views.py @@ -83,6 +83,16 @@ class GetDeleteImageView(APIView): status=status.HTTP_500_INTERNAL_SERVER_ERROR) +class GetDeleteImageViewV1(GetDeleteImageView): + def get(self, request, cloud_owner, cloud_region, tenantid, imageid): + return super(GetDeleteImageViewV1, self).get( + request, cloud_owner + '_' + cloud_region, tenantid, imageid) + + def delete(self, request, cloud_owner, cloud_region, tenantid, imageid): + return super(GetDeleteImageViewV1, self).delete( + request, cloud_owner + '_' + cloud_region, tenantid, imageid) + + class CreateListImagesView(APIView): def get(self, request, vimid, tenantid): @@ -154,6 +164,16 @@ class CreateListImagesView(APIView): status=status.HTTP_500_INTERNAL_SERVER_ERROR) +class CreateListImagesViewV1(CreateListImagesView): + def get(self, request, cloud_owner, cloud_region, tenantid): + return super(CreateListImagesViewV1, self).get( + request, cloud_owner + '_' + cloud_region, tenantid) + + def post(self, request, cloud_owner, cloud_region, tenantid): + return super(CreateListImagesViewV1, self).post( + request, cloud_owner + '_' + cloud_region, tenantid) + + class CreateImageFileView(APIView): def post(self, request, vimid, tenantid): @@ -209,6 +229,12 @@ class CreateImageFileView(APIView): status=status.HTTP_500_INTERNAL_SERVER_ERROR) +class CreateImageFileViewV1(CreateImageFileView): + def post(self, request, cloud_owner, cloud_region, tenantid): + return super(CreateImageFileViewV1, self).post( + request, cloud_owner + '_' + cloud_region, tenantid) + + class GetImageFileView(APIView): def post(self, request, vimid, tenantid, imageid): @@ -257,3 +283,9 @@ class GetImageFileView(APIView): else: return Response(data={'error': str(e)}, status=status.HTTP_500_INTERNAL_SERVER_ERROR) + + +class GetImageFileViewV1(GetImageFileView): + def post(self, request, cloud_owner, cloud_region, tenantid, imageid): + return super(GetImageFileViewV1, self).post( + request, cloud_owner + '_' + cloud_region, tenantid, imageid) diff --git a/vio/vio/swagger/views/limits/views.py b/vio/vio/swagger/views/limits/views.py index 9682a11..da037c7 100644 --- a/vio/vio/swagger/views/limits/views.py +++ b/vio/vio/swagger/views/limits/views.py @@ -51,3 +51,9 @@ class LimitsView(APIView): rsp.update(nova_utils.server_limits_formatter(server_limits)) return Response(data=rsp, status=status.HTTP_200_OK) + + +class LimitsViewV1(LimitsView): + def get(self, request, cloud_owner, cloud_region, tenantid): + return super(LimitsViewV1, self).get( + request, cloud_owner + "_" + cloud_region, tenantid) diff --git a/vio/vio/swagger/views/network/views.py b/vio/vio/swagger/views/network/views.py index 27d0f3a..6d182e2 100644 --- a/vio/vio/swagger/views/network/views.py +++ b/vio/vio/swagger/views/network/views.py @@ -74,6 +74,16 @@ class CreateNetworkView(APIView): status=status.HTTP_500_INTERNAL_SERVER_ERROR) +class CreateNetworkViewV1(CreateNetworkView): + def post(self, request, cloud_owner, cloud_region, tenantid): + return super(CreateNetworkViewV1, self).post( + request, cloud_owner + "_" + cloud_region, tenantid) + + def get(self, request, cloud_owner, cloud_region, tenantid): + return super(CreateNetworkViewV1, self).get( + request, cloud_owner + "_" + cloud_region, tenantid) + + class DeleteNetworkView(APIView): def get(self, request, vimid, tenantid, networkid): @@ -119,3 +129,13 @@ class DeleteNetworkView(APIView): else: return Response(data={'error': str(e)}, status=status.HTTP_500_INTERNAL_SERVER_ERROR) + + +class DeleteNetworkViewV1(DeleteNetworkView): + def get(self, request, cloud_owner, cloud_region, tenantid, networkid): + return super(DeleteNetworkViewV1, self).get( + request, cloud_owner + "_" + cloud_region, tenantid, networkid) + + def delete(self, request, cloud_owner, cloud_region, tenantid, networkid): + return super(DeleteNetworkViewV1, self).delete( + request, cloud_owner + "_" + cloud_region, tenantid, networkid) diff --git a/vio/vio/swagger/views/port/views.py b/vio/vio/swagger/views/port/views.py index 249e7c3..33d633d 100644 --- a/vio/vio/swagger/views/port/views.py +++ b/vio/vio/swagger/views/port/views.py @@ -75,6 +75,16 @@ class CreatePortView(APIView): status=status.HTTP_500_INTERNAL_SERVER_ERROR) +class CreatePortViewV1(CreatePortView): + def post(self, request, cloud_owner, cloud_region, tenantid): + return super(CreatePortViewV1, self).post( + request, cloud_owner + "_" + cloud_region, tenantid) + + def get(self, request, cloud_owner, cloud_region, tenantid): + return super(CreatePortViewV1, self).get( + request, cloud_owner + "_" + cloud_region, tenantid) + + class DeletePortView(APIView): def get(self, request, vimid, tenantid, portid): @@ -104,3 +114,13 @@ class DeletePortView(APIView): else: return Response(data={'error': str(e)}, status=status.HTTP_500_INTERNAL_SERVER_ERROR) + + +class DeletePortViewV1(DeletePortView): + def get(self, request, cloud_owner, cloud_region, tenantid, portid): + return super(DeletePortViewV1, self).get( + request, cloud_owner + "_" + cloud_region, tenantid, portid) + + def delete(self, request, cloud_owner, cloud_region, tenantid, portid): + return super(DeletePortViewV1, self).delete( + request, cloud_owner + "_" + cloud_region, tenantid, portid) diff --git a/vio/vio/swagger/views/registry/views.py b/vio/vio/swagger/views/registry/views.py index 6e23739..cac49e7 100644 --- a/vio/vio/swagger/views/registry/views.py +++ b/vio/vio/swagger/views/registry/views.py @@ -158,6 +158,12 @@ class Registry(APIView): return Response(data="", status=status.HTTP_200_OK) +class RegistryV1(Registry): + def post(self, request, cloud_owner, cloud_region): + return super(RegistryV1, self).post( + request, cloud_owner + "_" + cloud_region) + + class UnRegistry(APIView): def delete(self, request, vimid): @@ -170,3 +176,9 @@ class UnRegistry(APIView): return Response(data=e.message, status=status.HTTP_500_INTERNAL_SERVER_ERROR) return Response(data="", status=status.HTTP_204_NO_CONTENT) + + +class UnRegistryV1(UnRegistry): + def delete(self, request, cloud_owner, cloud_region): + return super(UnRegistryV1, self).delete( + request, cloud_owner + "_" + cloud_region) diff --git a/vio/vio/swagger/views/server/views.py b/vio/vio/swagger/views/server/views.py index 9756303..fca9cb9 100644 --- a/vio/vio/swagger/views/server/views.py +++ b/vio/vio/swagger/views/server/views.py @@ -109,6 +109,16 @@ class ListServersView(APIView): return Response(data=rsp, status=status.HTTP_200_OK) +class ListServersViewV1(ListServersView): + def post(self, request, cloud_owner, cloud_region, tenantid): + return super(ListServersViewV1, self).post( + request, cloud_owner + "_" + cloud_region, tenantid) + + def get(self, request, cloud_owner, cloud_region, tenantid): + return super(ListServersViewV1, self).get( + request, cloud_owner + "_" + cloud_region, tenantid) + + class GetServerView(APIView): def get(self, request, vimid, tenantid, serverid): @@ -163,3 +173,13 @@ class GetServerView(APIView): return Response(data={'error': str(e)}, status=status.HTTP_500_INTERNAL_SERVER_ERROR) return Response(status=status.HTTP_204_NO_CONTENT) + + +class GetServerViewV1(GetServerView): + def get(self, request, cloud_owner, cloud_region, tenantid, serverid): + return super(GetServerViewV1, self).get( + request, cloud_owner + "_" + cloud_region, tenantid, serverid) + + def delete(self, request, cloud_owner, cloud_region, tenantid, serverid): + return super(GetServerViewV1, self).delete( + request, cloud_owner + "_" + cloud_region, tenantid, serverid) diff --git a/vio/vio/swagger/views/service/views.py b/vio/vio/swagger/views/service/views.py index b632370..239e795 100644 --- a/vio/vio/swagger/views/service/views.py +++ b/vio/vio/swagger/views/service/views.py @@ -53,3 +53,9 @@ class HostsView(APIView): 'hosts': hosts} return Response(data=rsp, status=status.HTTP_200_OK) + + +class HostsViewV1(HostsView): + def get(self, request, cloud_owner, cloud_region, tenantid): + return super(HostsViewV1, self).get( + request, cloud_owner + "_" + cloud_region, tenantid) diff --git a/vio/vio/swagger/views/subnet/views.py b/vio/vio/swagger/views/subnet/views.py index 4da8842..c8c412c 100644 --- a/vio/vio/swagger/views/subnet/views.py +++ b/vio/vio/swagger/views/subnet/views.py @@ -75,6 +75,16 @@ class CreateSubnetView(APIView): status=status.HTTP_500_INTERNAL_SERVER_ERROR) +class CreateSubnetViewV1(CreateSubnetView): + def post(self, request, cloud_owner, cloud_region, tenantid): + return super(CreateSubnetViewV1, self).post( + request, cloud_owner + "_" + cloud_region, tenantid) + + def get(self, request, cloud_owner, cloud_region, tenantid): + return super(CreateSubnetViewV1, self).get( + request, cloud_owner + "_" + cloud_region, tenantid) + + class DeleteSubnetView(APIView): def get(self, request, vimid, tenantid, subnetid): @@ -104,3 +114,13 @@ class DeleteSubnetView(APIView): else: return Response(data={'error': str(e)}, status=status.HTTP_500_INTERNAL_SERVER_ERROR) + + +class DeleteSubnetViewV1(DeleteSubnetView): + def get(self, request, cloud_owner, cloud_region, tenantid, subnetid): + return super(DeleteSubnetViewV1, self).get( + request, cloud_owner + "_" + cloud_region, tenantid, subnetid) + + def delete(self, request, cloud_owner, cloud_region, tenantid, subnetid): + return super(DeleteSubnetViewV1, self).delete( + request, cloud_owner + "_" + cloud_region, tenantid, subnetid) diff --git a/vio/vio/swagger/views/tenant/views.py b/vio/vio/swagger/views/tenant/views.py index 004fbbf..0ee58df 100644 --- a/vio/vio/swagger/views/tenant/views.py +++ b/vio/vio/swagger/views/tenant/views.py @@ -60,3 +60,9 @@ class ListTenantsView(APIView): tenant['name'] = project.name rsp['tenants'].append(tenant) return Response(data=rsp, status=status.HTTP_200_OK) + + +class ListTenantsViewV1(ListTenantsView): + def get(self, request, cloud_owner, cloud_region): + return super(ListTenantsViewV1, self).get( + request, cloud_owner + "_" + cloud_region) diff --git a/vio/vio/swagger/views/volume/views.py b/vio/vio/swagger/views/volume/views.py index 4bb1ba7..6ebf624 100644 --- a/vio/vio/swagger/views/volume/views.py +++ b/vio/vio/swagger/views/volume/views.py @@ -71,6 +71,16 @@ class GetDeleteVolumeView(APIView): status=status.HTTP_500_INTERNAL_SERVER_ERROR) +class GetDeleteVolumeViewV1(GetDeleteVolumeView): + def get(self, request, cloud_owner, cloud_region, tenantid, volumeid): + return super(GetDeleteVolumeViewV1, self).get( + request, cloud_owner + '_' + cloud_region, tenantid, volumeid) + + def delete(self, request, cloud_owner, cloud_region, tenantid, volumeid): + return super(GetDeleteVolumeViewV1, self).delete( + request, cloud_owner + '_' + cloud_region, tenantid, volumeid) + + class CreateListVolumeView(APIView): def get(self, request, vimid, tenantid): @@ -146,3 +156,13 @@ class CreateListVolumeView(APIView): else: return Response(data={'error': str(e)}, status=status.HTTP_500_INTERNAL_SERVER_ERROR) + + +class CreateListVolumeViewV1(CreateListVolumeView): + def get(self, request, cloud_owner, cloud_region, tenantid): + return super(CreateListVolumeViewV1, self).get( + request, cloud_owner + '_' + cloud_region, tenantid) + + def post(self, request, cloud_owner, cloud_region, tenantid): + return super(CreateListVolumeViewV1, self).post( + request, cloud_owner + '_' + cloud_region, tenantid) |