summaryrefslogtreecommitdiffstats
path: root/vio
diff options
context:
space:
mode:
Diffstat (limited to 'vio')
-rw-r--r--vio/docker/Dockerfile2
-rw-r--r--vio/vio/swagger/urls.py8
-rw-r--r--vio/vio/swagger/views/proxyplugin/dns/__init__.py0
-rw-r--r--vio/vio/swagger/views/proxyplugin/dns/views.py45
-rw-r--r--vio/vio/swagger/views/proxyplugin/heat/views.py6
-rw-r--r--vio/vio/swagger/views/proxyplugin/httpclient.py15
-rw-r--r--vio/vio/swagger/views/proxyplugin/identity/views.py18
-rw-r--r--vio/vio/swagger/views/proxyplugin/image/views.py13
-rw-r--r--vio/vio/swagger/views/proxyplugin/neutron/views.py6
-rw-r--r--vio/vio/swagger/views/proxyplugin/nova/views.py11
-rw-r--r--vio/vio/swagger/views/proxyplugin/volumn/views.py6
11 files changed, 90 insertions, 40 deletions
diff --git a/vio/docker/Dockerfile b/vio/docker/Dockerfile
index 80fa427..c437492 100644
--- a/vio/docker/Dockerfile
+++ b/vio/docker/Dockerfile
@@ -17,7 +17,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.vio&a=multicloud-vio-plugin&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/swagger/urls.py b/vio/vio/swagger/urls.py
index fc1b02e..d768333 100644
--- a/vio/vio/swagger/urls.py
+++ b/vio/vio/swagger/urls.py
@@ -38,6 +38,7 @@ from vio.swagger.views.proxyplugin.image.views import ImageServer
from vio.swagger.views.proxyplugin.neutron.views import NetWorkServer
from vio.swagger.views.proxyplugin.volumn.views import VolumeServer
from vio.swagger.views.proxyplugin.heat.views import HeatServer
+from vio.swagger.views.proxyplugin.dns.views import DesignateServer
# Registry
from vio.swagger.views.registry.views import Registry
@@ -275,6 +276,13 @@ urlpatterns = [
r'nova/(?P<tenantid>[0-9a-z-A-Z\-\_]+)/(?P<other>(.*))$',
ComputeServer.as_view()),
+ url(r'^api/multicloud-vio/v0/(?P<vimid>[0-9a-z-A-Z\-\_]+)/designate$',
+ DesignateServer.as_view()),
+
+ url(r'^api/multicloud-vio/v0/(?P<vimid>[0-9a-z-A-Z\-\_]+)/'
+ r'designate/(?P<other>(.*))$',
+ DesignateServer.as_view()),
+
# Extensions
url(
(r'^api/multicloud-vio/v0/(?P<vimid>[0-9a-z-A-Z\-\_]+)'
diff --git a/vio/vio/swagger/views/proxyplugin/dns/__init__.py b/vio/vio/swagger/views/proxyplugin/dns/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/vio/vio/swagger/views/proxyplugin/dns/__init__.py
diff --git a/vio/vio/swagger/views/proxyplugin/dns/views.py b/vio/vio/swagger/views/proxyplugin/dns/views.py
new file mode 100644
index 0000000..60914b0
--- /dev/null
+++ b/vio/vio/swagger/views/proxyplugin/dns/views.py
@@ -0,0 +1,45 @@
+# Copyright (c) 2017 VMware, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at:
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+
+from vio.swagger.views.proxyplugin.httpclient import BaseClient
+
+
+class DesignateServer(BaseClient):
+
+ serverType = "designate"
+
+ def get(self, request, vimid, other=None):
+
+ (url, headers, _) = self.buildRequest(request, vimid, tail=other,
+ method="GET")
+
+ return self._request(url, method="GET", headers=headers)
+
+ def post(self, request, vimid, other):
+
+ return self.send(request=request, method="POST",
+ vimid=vimid, other=other)
+
+ def patch(self, request, vimid, other):
+
+ return self.send(request=request, method="PATCH",
+ vimid=vimid, other=other)
+
+ def put(self, request, vimid, other):
+
+ return self.send(request=request, method="PUT",
+ vimid=vimid, other=other)
+
+ def delete(self, request, vimid, other):
+
+ return self.send(request=request, method="DELETE",
+ vimid=vimid, other=other)
diff --git a/vio/vio/swagger/views/proxyplugin/heat/views.py b/vio/vio/swagger/views/proxyplugin/heat/views.py
index f70bccf..7945aea 100644
--- a/vio/vio/swagger/views/proxyplugin/heat/views.py
+++ b/vio/vio/swagger/views/proxyplugin/heat/views.py
@@ -19,8 +19,10 @@ class HeatServer(BaseClient):
def get(self, request, vimid, tenantid, other):
- return self.send(request=request, method="GET",
- vimid=vimid, tenantid=tenantid, other=other)
+ (url, headers, _) = self.buildRequest(
+ request, vimid, tenantid=tenantid, tail=other, method="GET")
+
+ return self._request(url, method="GET", headers=headers)
def post(self, request, vimid, tenantid, other):
diff --git a/vio/vio/swagger/views/proxyplugin/httpclient.py b/vio/vio/swagger/views/proxyplugin/httpclient.py
index bf1bc17..37d8e7a 100644
--- a/vio/vio/swagger/views/proxyplugin/httpclient.py
+++ b/vio/vio/swagger/views/proxyplugin/httpclient.py
@@ -67,7 +67,8 @@ class BaseClient(APIView):
for schema in list(self.session.adapters):
self.session.mount(schema, TCPKeepAliveAdapter())
- def buildRequest(self, request, vimid, tenantid="", tail=None):
+ def buildRequest(self, request, vimid, tenantid="", tail=None,
+ method=None):
headers = {}
preUrl = catalog.getEndpointBy(
@@ -80,6 +81,18 @@ class BaseClient(APIView):
headers["X-Subject-Token"] = token
headers['Content-Type'] = request.META.get(
"CONTENT_TYPE", "application/json")
+
+ if method == "GET":
+ # append parameters in url path
+ query = ""
+ for k, v in request.GET.items():
+ query += (k + "=" + v)
+ query += "&"
+
+ if query != "":
+ query = query[:-1]
+ endPointURL += "?" + query
+
try:
json_req = json.loads(request.body)
except Exception:
diff --git a/vio/vio/swagger/views/proxyplugin/identity/views.py b/vio/vio/swagger/views/proxyplugin/identity/views.py
index ea5ef44..6652c3e 100644
--- a/vio/vio/swagger/views/proxyplugin/identity/views.py
+++ b/vio/vio/swagger/views/proxyplugin/identity/views.py
@@ -38,16 +38,8 @@ class IdentityServer(BaseClient):
def get(self, request, vimid, other=None):
- (url, headers, _) = self.buildRequest(request, vimid, tail=other)
-
- query = ""
- for k, v in request.GET.items():
- query += (k + "=" + v)
- query += "&"
-
- if query != "":
- query = query[:-1]
- url += "/?" + query
+ (url, headers, _) = self.buildRequest(request, vimid, tail=other,
+ method="GET")
try:
res = self._request(url, method="GET", headers=headers)
@@ -207,7 +199,7 @@ class TokenView(BaseClient):
vimEndpoints[i['name']][j['interface']] = ends
res = tmp.split("/")
if i['type'] in ['image', 'network',
- 'cloudformation', 'identity']:
+ 'cloudformation', 'identity', 'dns']:
if i['type'] != 'identity':
res[2] = MSB_ADDRESS + "/multicloud-vio/v0/" + \
vimid + "/" + i['name']
@@ -296,7 +288,7 @@ class TokenView(BaseClient):
vimEndpoints[cal['name']][key] = urlname
if cal['type'] in ['image', 'network',
- 'cloudformation', 'identity']:
+ 'cloudformation', 'identity', 'dns']:
name = cal['name'] if cal['type'] != 'identity' \
else cal['type']
for i in ("adminURL", "internalURL", "publicURL"):
@@ -435,7 +427,7 @@ class TokenV2View(BaseClient):
vimEndpoints[cal['name']][key] = urlname
if cal['type'] in ['image', 'network',
- 'cloudformation', 'identity']:
+ 'cloudformation', 'identity', 'dns']:
name = cal['name'] if cal['type'] != 'identity' \
else cal['type']
for i in ("adminURL", "internalURL", "publicURL"):
diff --git a/vio/vio/swagger/views/proxyplugin/image/views.py b/vio/vio/swagger/views/proxyplugin/image/views.py
index 22b5b12..67a45c4 100644
--- a/vio/vio/swagger/views/proxyplugin/image/views.py
+++ b/vio/vio/swagger/views/proxyplugin/image/views.py
@@ -17,18 +17,11 @@ class ImageServer(BaseClient):
serverType = "glance"
- def get(self, request, vimid, other):
+ def get(self, request, vimid, other=None):
- (url, headers, _) = self.buildRequest(request, vimid, tail=other)
+ (url, headers, _) = self.buildRequest(request, vimid, tail=other,
+ method="GET")
- query = ""
- for k, v in request.GET.items():
- query += (k + "=" + v)
- query += "&"
-
- if query != "":
- query = query[:-1]
- url += "?" + query
return self._request(url, method="GET", headers=headers)
def post(self, request, vimid, other):
diff --git a/vio/vio/swagger/views/proxyplugin/neutron/views.py b/vio/vio/swagger/views/proxyplugin/neutron/views.py
index 3f42a14..fc52dcc 100644
--- a/vio/vio/swagger/views/proxyplugin/neutron/views.py
+++ b/vio/vio/swagger/views/proxyplugin/neutron/views.py
@@ -19,8 +19,10 @@ class NetWorkServer(BaseClient):
def get(self, request, vimid, other=None):
- return self.send(request=request, method="GET",
- vimid=vimid, other=other)
+ (url, headers, _) = self.buildRequest(request, vimid, tail=other,
+ method="GET")
+
+ return self._request(url, method="GET", headers=headers)
def post(self, request, vimid, other):
diff --git a/vio/vio/swagger/views/proxyplugin/nova/views.py b/vio/vio/swagger/views/proxyplugin/nova/views.py
index 83cb92c..15c2ef9 100644
--- a/vio/vio/swagger/views/proxyplugin/nova/views.py
+++ b/vio/vio/swagger/views/proxyplugin/nova/views.py
@@ -20,15 +20,8 @@ class ComputeServer(BaseClient):
def get(self, request, vimid, tenantid, other):
(url, headers, _) = self.buildRequest(
- request, vimid, tenantid=tenantid, tail=other)
- query = ""
- for k, v in request.GET.items():
- query += (k + "=" + v)
- query += "&"
-
- if query != "":
- query = query[:-1]
- url += "?" + query
+ request, vimid, tenantid=tenantid, tail=other, method="GET")
+
return self._request(url, method="GET", headers=headers)
def post(self, request, vimid, tenantid, other):
diff --git a/vio/vio/swagger/views/proxyplugin/volumn/views.py b/vio/vio/swagger/views/proxyplugin/volumn/views.py
index 569a083..5b61c29 100644
--- a/vio/vio/swagger/views/proxyplugin/volumn/views.py
+++ b/vio/vio/swagger/views/proxyplugin/volumn/views.py
@@ -19,8 +19,10 @@ class VolumeServer(BaseClient):
def get(self, request, vimid, tenantid, other):
- return self.send(request=request, method="GET", vimid=vimid,
- tenantid=tenantid, other=other)
+ (url, headers, _) = self.buildRequest(
+ request, vimid, tenantid=tenantid, tail=other, method="GET")
+
+ return self._request(url, method="GET", headers=headers)
def post(self, request, vimid, tenantid, other):