diff options
-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/urls.py | 34 | ||||
-rw-r--r-- | vio/vio/swagger/views/fakeplugin/fakeData/fakeResponse.py | 2 | ||||
-rw-r--r-- | vio/vio/swagger/views/image/views.py | 32 | ||||
-rw-r--r-- | vio/vio/swagger/views/volume/views.py | 20 |
6 files changed, 89 insertions, 3 deletions
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/urls.py b/vio/vio/swagger/urls.py index c68c297..a4ed9a0 100644 --- a/vio/vio/swagger/urls.py +++ b/vio/vio/swagger/urls.py @@ -31,6 +31,14 @@ 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 + # proxy from vio.swagger.views.proxyplugin.identity.views import TokenView from vio.swagger.views.proxyplugin.identity.views import TokenV2View @@ -161,6 +169,32 @@ 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_-]+)/(?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()), + # fake urls url(r'^api/multicloud-vio/v0/vmware_fake/identity/v3', FakeToken.as_view()), 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/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/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) |