summaryrefslogtreecommitdiffstats
path: root/vio
diff options
context:
space:
mode:
authorliangke <lokyse@163.com>2018-01-02 15:03:08 +0800
committerliangke <lokyse@163.com>2018-01-02 15:20:24 +0800
commitc88997385a2a0172ae01fd83a6d9fbce2e653266 (patch)
tree2a336431563c0ca799efe299afa40081934fd2d0 /vio
parent75a7d3eb7a877242d62d8767ded9fd750c0cdf73 (diff)
Fix bugs of heat and pom
1 Verify stack name when query heat stack in fake-cloud. 2 Modify paren group in pom to resolve non-resolvable parent POM Change-Id: I8f6347e035c7c4343d2875f162f76504cea2b01f Issue-ID: MULTICLOUD-136 Signed-off-by: liangke <lokyse@163.com>
Diffstat (limited to 'vio')
-rw-r--r--vio/pom.xml6
-rw-r--r--vio/vio/swagger/views/fakeplugin/fakeData/fakeResponse.py51
-rw-r--r--vio/vio/swagger/views/fakeplugin/heat/views.py8
3 files changed, 43 insertions, 22 deletions
diff --git a/vio/pom.xml b/vio/pom.xml
index 5b23dfa..2198d97 100644
--- a/vio/pom.xml
+++ b/vio/pom.xml
@@ -16,9 +16,9 @@
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
- <groupId>org.onap.oparent</groupId>
- <artifactId>oparent</artifactId>
- <version>0.1.1</version>
+ <groupId>org.onap.multicloud.openstack.vmware</groupId>
+ <artifactId>multicloud-openstack-vmware</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.onap.multicloud.openstack.vmware.vio</groupId>
diff --git a/vio/vio/swagger/views/fakeplugin/fakeData/fakeResponse.py b/vio/vio/swagger/views/fakeplugin/fakeData/fakeResponse.py
index 16d33ac..0368f02 100644
--- a/vio/vio/swagger/views/fakeplugin/fakeData/fakeResponse.py
+++ b/vio/vio/swagger/views/fakeplugin/fakeData/fakeResponse.py
@@ -9,6 +9,7 @@ from datetime import timedelta
import copy
MSB_SERVER = MSB_SERVICE_IP + ":" + MSB_SERVICE_PORT
+API_NAMESPACE = "api/multicloud-vio/v0/vmware_fake/heat"
Token = "gAAAAABZmlkS3H24i7446u41QoDMMEFi49sUbYiB2fqrZq00" \
"TR92RDLxt4AWzHsBa36IeWeY_eVEnDWAjIuV" \
@@ -2276,8 +2277,10 @@ def getAllStacks(token):
"id": STACK_ID,
"links": [
{
- "href": "http://127.0.0.1:8004/v1/" + Tenantid +
- "/stacks/" + STACK_NAME + "/" + STACK_ID,
+ "href": "http://" + MSB_SERVER + "/"
+ + API_NAMESPACE + "/"
+ + Tenantid + "/stacks/" +
+ STACK_NAME + "/" + STACK_ID,
"rel": "self"
}
],
@@ -2310,7 +2313,8 @@ def createStack(stack_name, token):
"id": STACK_ID,
"links": [
{
- "href": "http://127.0.0.1:8004/v1/"
+ "href": "http://" + MSB_SERVER + "/"
+ + API_NAMESPACE + "/"
+ Tenantid + "/stacks/" +
stack_name + "/" + STACK_ID,
"rel": "self"
@@ -2341,8 +2345,9 @@ def createStackPreview(stack_name, token):
"id": "None",
"links": [
{
- "href": "http://127.0.0.1:8004/v1/" +
- Tenantid + "/stacks/" +
+ "href": "http://" + MSB_SERVER + "/" +
+ API_NAMESPACE + "/"
+ + Tenantid + "/stacks/" +
STACK_NAME + "/None",
"rel": "self"
}
@@ -2350,7 +2355,7 @@ def createStackPreview(stack_name, token):
"notification_topics": [],
"outputs": [],
"parameters": {
- "OS::project_id": "6e18cc2bdbeb48a5basad2dc499f6804",
+ "OS::project_id": Tenantid,
"OS::stack_id": "None",
"OS::stack_name": "teststack",
"admin_user": "cloud-user",
@@ -2410,7 +2415,7 @@ def createStackPreview(stack_name, token):
"path": "/resources/the_sg_res",
"stack_id": "None",
"stack_name": "teststack",
- "tenant": "6e18cc2bdbeb48a5b3cad2dc499f6804"
+ "tenant": Tenantid
},
"resource_name": "the_sg_res",
"resource_status": "COMPLETE",
@@ -2420,7 +2425,7 @@ def createStackPreview(stack_name, token):
"path": "",
"stack_id": "None",
"stack_name": "teststack",
- "tenant": "6e18cc2bdbeb48a5b3cad2dc499f6804"
+ "tenant": Tenantid
},
"stack_name": STACK_NAME,
"updated_time": "2017-10-31T15:12:36Z"
@@ -2480,7 +2485,7 @@ def createStackPreview(stack_name, token):
"path": "/resources/hello_world",
"stack_id": "None",
"stack_name": "teststack",
- "tenant": "6e18cc2bdbeb48a3433cad2dc499sdf32234"
+ "tenant": Tenantid
},
"resource_name": "hello_world",
"resource_status": "COMPLETE",
@@ -2490,13 +2495,13 @@ def createStackPreview(stack_name, token):
"path": "",
"stack_id": "None",
"stack_name": "teststack",
- "tenant": "6e18cc2bdbeb48a3433cad2dc499sdf32234"
+ "tenant": Tenantid
},
"stack_name": "teststack",
"updated_time": "2017-10-31T15:12:36Z"
}
],
- "stack_name": "test_stack",
+ "stack_name": STACK_NAME,
"stack_owner": null,
"tags": null,
"template_description":
@@ -2520,11 +2525,23 @@ def deleteStack(stack_id, token):
return ""
-def showStack(stack_id, token):
+def showStackByID(stack_id, stack_name, token):
+ if token != Token:
+ return {"error": {"message": "unauthorization", "code": 401}}
+ if stack_id != STACK_ID or stack_name != STACK_NAME:
+ return {"error": {"message": "stack not found", "code": 404}}
+ else:
+ return showStack(stack_name, token)
+
+
+def showStack(stack_name, token):
if token != Token:
return {"error": {"message": "unauthorization", "code": 401}}
+ if stack_name != STACK_NAME:
+ return {"error": {"message": "stack not found", "code": 404}}
+
data = \
{
"stack": {
@@ -2536,17 +2553,17 @@ def showStack(stack_id, token):
"id": STACK_ID,
"links": [
{
- "href": "http://127.0.0.1:8004/v1/"
- "eb1c63a4f77141548385f113a28f0f52/stacks/"
- "simple_stack/"
- "3095aefc-09fb-4bc7-b1f0-f21a304e864c",
+ "href": "http://" + MSB_SERVER + "/"
+ + API_NAMESPACE + "/"
+ + Tenantid + "/stacks/" + STACK_NAME
+ + "/"+STACK_ID,
"rel": "self"
}
],
"notification_topics": [],
"outputs": [],
"parameters": {
- "OS::project_id": "3ab5b02f-a01f-4f95-afa1-e254afc4a435",
+ "OS::project_id": Tenantid,
"OS::stack_id": STACK_ID,
"OS::stack_name": STACK_NAME
},
diff --git a/vio/vio/swagger/views/fakeplugin/heat/views.py b/vio/vio/swagger/views/fakeplugin/heat/views.py
index 243a33d..b662378 100644
--- a/vio/vio/swagger/views/fakeplugin/heat/views.py
+++ b/vio/vio/swagger/views/fakeplugin/heat/views.py
@@ -6,6 +6,7 @@ from rest_framework.response import Response
from vio.swagger.views.fakeplugin.fakeData.fakeResponse import getAllStacks
from vio.swagger.views.fakeplugin.fakeData.fakeResponse import showStack
+from vio.swagger.views.fakeplugin.fakeData.fakeResponse import showStackByID
from vio.swagger.views.fakeplugin.fakeData.fakeResponse import createStack
from vio.swagger.views.fakeplugin.fakeData.fakeResponse import deleteStack
from vio.swagger.views.fakeplugin.fakeData.fakeResponse import \
@@ -56,8 +57,11 @@ class FakeHeatService(APIView):
data = ""
if stackName is None and stackID is None:
data = getAllStacks(token=token)
- elif stackName or stackID:
- data = showStack(stack_id=stackID, token=token)
+ elif stackName and stackID:
+ data = showStackByID(stack_name=stackName,
+ stack_id=stackID, token=token)
+ elif stackName:
+ data = showStack(stack_name=stackName, token=token)
if 'error' in data:
return Response(data=data['error']['message'],