summaryrefslogtreecommitdiffstats
path: root/vio/vio/swagger/views
diff options
context:
space:
mode:
Diffstat (limited to 'vio/vio/swagger/views')
-rw-r--r--vio/vio/swagger/views/fakeplugin/fakeData/fakeResponse.py118
-rw-r--r--vio/vio/swagger/views/fakeplugin/identity/views.py9
-rw-r--r--vio/vio/swagger/views/fakeplugin/image/views.py9
-rw-r--r--vio/vio/swagger/views/proxyplugin/identity/views.py14
4 files changed, 149 insertions, 1 deletions
diff --git a/vio/vio/swagger/views/fakeplugin/fakeData/fakeResponse.py b/vio/vio/swagger/views/fakeplugin/fakeData/fakeResponse.py
index c0ca1dc..16d33ac 100644
--- a/vio/vio/swagger/views/fakeplugin/fakeData/fakeResponse.py
+++ b/vio/vio/swagger/views/fakeplugin/fakeData/fakeResponse.py
@@ -737,6 +737,25 @@ def show_project(token, projectid=""):
return data
+# used for keystonev2
+def get_tenants():
+
+ data = \
+ {
+ "tenants": [
+ {
+ "id": Tenantid,
+ "name": "admin",
+ "description": "A description ...",
+ "enabled": true
+ }
+ ],
+ "tenants_links": []
+ }
+
+ return data
+
+
def get_serverdetail(token):
data = {"servers": []}
@@ -1869,6 +1888,105 @@ def list_image():
return data
+def image_version():
+
+ data = {
+ "versions": [
+ {
+ "id": "v2.6",
+ "links": [
+ {
+ "href": "http://glance.openstack.example.org/v2/",
+ "rel": "self"
+ }
+ ],
+ "status": "EXPERIMENTAL"
+ },
+ {
+ "id": "v2.5",
+ "links": [
+ {
+ "href": "http://glance.openstack.example.org/v2/",
+ "rel": "self"
+ }
+ ],
+ "status": "CURRENT"
+ },
+ {
+ "id": "v2.4",
+ "links": [
+ {
+ "href": "http://glance.openstack.example.org/v2/",
+ "rel": "self"
+ }
+ ],
+ "status": "SUPPORTED"
+ },
+ {
+ "id": "v2.3",
+ "links": [
+ {
+ "href": "http://glance.openstack.example.org/v2/",
+ "rel": "self"
+ }
+ ],
+ "status": "SUPPORTED"
+ },
+ {
+ "id": "v2.2",
+ "links": [
+ {
+ "href": "http://glance.openstack.example.org/v2/",
+ "rel": "self"
+ }
+ ],
+ "status": "SUPPORTED"
+ },
+ {
+ "id": "v2.1",
+ "links": [
+ {
+ "href": "http://glance.openstack.example.org/v2/",
+ "rel": "self"
+ }
+ ],
+ "status": "SUPPORTED"
+ },
+ {
+ "id": "v2.0",
+ "links": [
+ {
+ "href": "http://glance.openstack.example.org/v2/",
+ "rel": "self"
+ }
+ ],
+ "status": "SUPPORTED"
+ },
+ {
+ "id": "v1.1",
+ "links": [
+ {
+ "href": "http://glance.openstack.example.org/v1/",
+ "rel": "self"
+ }
+ ],
+ "status": "DEPRECATED"
+ },
+ {
+ "id": "v1.0",
+ "links": [
+ {
+ "href": "http://glance.openstack.example.org/v1/",
+ "rel": "self"
+ }
+ ],
+ "status": "DEPRECATED"
+ }
+ ]
+ }
+ return data
+
+
def image_schema():
data = {
diff --git a/vio/vio/swagger/views/fakeplugin/identity/views.py b/vio/vio/swagger/views/fakeplugin/identity/views.py
index 0ef35d7..73f189f 100644
--- a/vio/vio/swagger/views/fakeplugin/identity/views.py
+++ b/vio/vio/swagger/views/fakeplugin/identity/views.py
@@ -14,6 +14,7 @@ from vio.swagger.views.fakeplugin.fakeData.fakeResponse import \
keystone_version2
from vio.swagger.views.fakeplugin.fakeData.fakeResponse import list_projects
from vio.swagger.views.fakeplugin.fakeData.fakeResponse import show_project
+from vio.swagger.views.fakeplugin.fakeData.fakeResponse import get_tenants
class FakeProjects(APIView):
@@ -88,3 +89,11 @@ class FakeTokenV2(APIView):
tokeninfo = keystone_tokenV2()
return Response(data=tokeninfo, status=status.HTTP_200_OK)
+
+
+class FakeTenants(APIView):
+
+ def get(self, request, projectid=None):
+
+ data = get_tenants()
+ return Response(data=data, status=status.HTTP_200_OK)
diff --git a/vio/vio/swagger/views/fakeplugin/image/views.py b/vio/vio/swagger/views/fakeplugin/image/views.py
index 560c297..6d6e242 100644
--- a/vio/vio/swagger/views/fakeplugin/image/views.py
+++ b/vio/vio/swagger/views/fakeplugin/image/views.py
@@ -6,6 +6,7 @@ from rest_framework.response import Response
from vio.swagger.views.fakeplugin.fakeData.fakeResponse import image_detail
from vio.swagger.views.fakeplugin.fakeData.fakeResponse import list_image
from vio.swagger.views.fakeplugin.fakeData.fakeResponse import image_schema
+from vio.swagger.views.fakeplugin.fakeData.fakeResponse import image_version
false = "false"
null = "null"
@@ -33,3 +34,11 @@ class FakeImageSchema(APIView):
def get(self, request):
data = image_schema()
return Response(data=data, status=status.HTTP_200_OK)
+
+
+class FakeImageVersion(APIView):
+
+ def get(self, request):
+
+ data = image_version()
+ return Response(data=data, status=status.HTTP_200_OK)
diff --git a/vio/vio/swagger/views/proxyplugin/identity/views.py b/vio/vio/swagger/views/proxyplugin/identity/views.py
index 1791c71..25c475b 100644
--- a/vio/vio/swagger/views/proxyplugin/identity/views.py
+++ b/vio/vio/swagger/views/proxyplugin/identity/views.py
@@ -51,7 +51,7 @@ class IdentityServer(BaseClient):
try:
res = self._request(url, method="GET", headers=headers)
if res.status_code != status.HTTP_200_OK:
- return Response(data={"error": res.content},
+ return Response(data={"error": res.data},
status=res.status_code)
res = res.data
# replace keystone auth url with multicloud
@@ -283,6 +283,12 @@ class TokenView(BaseClient):
adminurl = deepcopy(item['adminURL']).split('/')
internalurl = deepcopy(item['internalURL']).split('/')
publicurl = deepcopy(item['publicURL']).split('/')
+ # VIO identity url use v3 as default even got token by v2,
+ # need change to v2.0
+ if cal['type'] == 'identity':
+ adminurl[-1] = "v2.0"
+ publicurl[-1] = "v2.0"
+ internalurl[-1] = "v2.0"
adminurl = adminurl[0] + "//" + adminurl[2] + (
"/" + adminurl[3] if len(adminurl) > 3 else "")
internalurl = internalurl[0] + "//"+internalurl[2] + (
@@ -423,6 +429,12 @@ class TokenV2View(BaseClient):
adminurl = deepcopy(item['adminURL']).split('/')
internalurl = deepcopy(item['internalURL']).split('/')
publicurl = deepcopy(item['publicURL']).split('/')
+ # VIO identity url use v3 as default even got token by v2,
+ # need change to v2.0
+ if cal['type'] == 'identity':
+ adminurl[-1] = "v2.0"
+ publicurl[-1] = "v2.0"
+ internalurl[-1] = "v2.0"
adminurl = adminurl[0] + "//" + adminurl[2] + (
"/" + adminurl[3] if len(adminurl) > 3 else "")
internalurl = internalurl[0] + "//" + internalurl[2] + (