1 # Copyright 2017 ZTE Corporation.
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14 from django.test import TestCase, Client
15 from rest_framework import status
17 from lcm.pub.database.models import NfInstModel, StorageInstModel
20 class ResourceTest(TestCase):
22 self.client = Client()
23 self.nf_inst_id = "01"
24 NfInstModel.objects.all().delete()
27 "vnfInstanceName": "VNF1",
29 "instantiatedVnfInfo": {
32 "virtualStorageResourceInfo": [
34 "virtualStorageInstanceId": "s02",
36 "resourceId": "resource01",
42 "vnfcResourceInfo": [],
43 "monitoringParameters": {},
46 "virtualLinkResourceInfo": [],
50 "onboardedVnfPkgInfoId": None
56 def test_get_vnf(self):
58 NfInstModel(nfinstid=vnf_inst_id, nf_name='VNF1').save()
59 StorageInstModel(storageid='s02', vimid='vim01', resouceid='resource01', insttype=1, \
60 instid=vnf_inst_id).save()
61 response = self.client.get("/openoapi/vnflcm/v1/vnf_instances/%s" % vnf_inst_id, format='json')
62 self.assertEqual(response.status_code, status.HTTP_200_OK)
63 self.assertEqual(self.test_data, response.data)