summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBin Sun <bins@vmware.com>2018-03-29 16:31:56 +0800
committerBin Sun <bins@vmware.com>2018-03-29 16:31:56 +0800
commit5475e4d8cb1ce4e7c19c4301397c7362d7037754 (patch)
tree3505b02317edbdfe1f31a1e7c425b8f551e0b3da
parent1cebf6e68e06ef6a327b1e829f1a226ce243e7e1 (diff)
Add fake data for csit
Change-Id: Icec43d93b68e10cb7b15dc04eb1f0370007311b2 Issue-ID: MULTICLOUD-152 Signed-off-by: Bin Sun <bins@vmware.com>
-rw-r--r--vio/vio/swagger/views/hypervisor/views.py11
-rw-r--r--vio/vio/swagger/views/image/views.py14
-rw-r--r--vio/vio/swagger/views/network/views.py16
3 files changed, 41 insertions, 0 deletions
diff --git a/vio/vio/swagger/views/hypervisor/views.py b/vio/vio/swagger/views/hypervisor/views.py
index a027d7c..0f7e1f9 100644
--- a/vio/vio/swagger/views/hypervisor/views.py
+++ b/vio/vio/swagger/views/hypervisor/views.py
@@ -27,6 +27,17 @@ from vio.swagger import nova_utils
class HostView(APIView):
def get(self, request, vimid, tenantid, hostname):
+ if vimid == "vmware_fake":
+ return Response(data={
+ 'vimid': vimid,
+ 'vimName': vimid,
+ 'tenantId': tenantid,
+ 'memory_mb': 196516,
+ 'name': "domain-c202.22bfc05c-da55-4ba6-ba93-08d9a067138e",
+ 'disk_gb': 6143,
+ 'cpu': 48
+ }, status=status.HTTP_200_OK)
+
try:
vim_info = extsys.get_vim_by_id(vimid)
except VimDriverVioException as e:
diff --git a/vio/vio/swagger/views/image/views.py b/vio/vio/swagger/views/image/views.py
index 62770c7..a876529 100644
--- a/vio/vio/swagger/views/image/views.py
+++ b/vio/vio/swagger/views/image/views.py
@@ -28,6 +28,20 @@ from vio.pub.exceptions import VimDriverVioException
class GetDeleteImageView(APIView):
def get(self, request, vimid, tenantid, imageid):
+ if vimid == "vmware_fake":
+ return Response(data={
+ "vimid": vimid,
+ "vimName": vimid,
+ "tenantId": tenantid,
+ "status": "active",
+ "name": "ubuntu-16.04-server-cloudimg-amd64",
+ "visibility": "public",
+ "id": "170641db-78cd-49a3-8bab-4cfa3d6ef131",
+ "size": 10737418240,
+ "imageType": "vmdk",
+ "containerFormat": "bare"
+ }, status=status.HTTP_200_OK)
+
try:
vim_info = extsys.get_vim_by_id(vimid)
vim_info['tenant'] = tenantid
diff --git a/vio/vio/swagger/views/network/views.py b/vio/vio/swagger/views/network/views.py
index 229e9a3..27d0f3a 100644
--- a/vio/vio/swagger/views/network/views.py
+++ b/vio/vio/swagger/views/network/views.py
@@ -77,6 +77,22 @@ class CreateNetworkView(APIView):
class DeleteNetworkView(APIView):
def get(self, request, vimid, tenantid, networkid):
+ if vimid == "vmware_fake":
+ return Response(data={
+ "vimid": vimid,
+ "vimName": vimid,
+ "tenantId": tenantid,
+ "status": "ACTIVE",
+ "segmentationId": None,
+ "name": "oam_onap_AQYG",
+ "physicalNetwork": None,
+ "shared": False,
+ "routerExternal": False,
+ "networkType": None,
+ "vlanTransparent": False,
+ "id": "0085970f-a214-4da2-a449-75acfb813fec"
+ }, status=status.HTTP_200_OK)
+
logger.info("Enter %s, method is %s, vim_id is %s",
syscomm.fun_name(), request.method, vimid)
net = OperateNetwork.OperateNetwork()