summaryrefslogtreecommitdiffstats
path: root/share/newton_base/openoapi/subnet.py
diff options
context:
space:
mode:
authorXiaohua Zhang <xiaohua.zhang@windriver.com>2018-11-24 09:49:15 +0000
committerXiaohua Zhang <xiaohua.zhang@windriver.com>2018-11-24 09:49:15 +0000
commit370ed53582ba1da526b7cc7c52fd780eb7a5b70b (patch)
treea4a27a625aa6c637541e7a8c752cf57d4904df70 /share/newton_base/openoapi/subnet.py
parentea1d235f8232e6597d7266bb0b04d4a521eb672e (diff)
Add filter to queries
Change-Id: I8845592fa9a52ce5aac382885072dee66d664f23 Issue-ID: MULTICLOUD-417 Signed-off-by: Xiaohua Zhang <xiaohua.zhang@windriver.com>
Diffstat (limited to 'share/newton_base/openoapi/subnet.py')
-rw-r--r--share/newton_base/openoapi/subnet.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/share/newton_base/openoapi/subnet.py b/share/newton_base/openoapi/subnet.py
index a5cef9c7..06e029a8 100644
--- a/share/newton_base/openoapi/subnet.py
+++ b/share/newton_base/openoapi/subnet.py
@@ -48,7 +48,11 @@ class Subnets(APIView):
pass
try:
# prepare request resource to vim instance
- query = VimDriverUtils.get_query_part(request)
+ querystr = VimDriverUtils.get_query_part(request)
+ query = "project_id=%s" % (tenantid)
+ if querystr:
+ query += "&" + querystr
+
content, status_code = self._get_subnets(query, vimid, tenantid, subnetid)
logger.info("request returns with status %s" % status_code)
return Response(data=content, status=status_code)
@@ -117,7 +121,11 @@ class Subnets(APIView):
pass
try:
#check if created already: check name
- query = "name=%s" % request.data["name"]
+ query = "project_id=%s&name=%s" % (tenantid, request.data["name"])
+ networkid = request.data.get("networkId", None)
+ if networkid:
+ query += "&network_id=%s" % networkid
+
content, status_code = self._get_subnets(query, vimid, tenantid)
existed = False
if status_code == 200: