summaryrefslogtreecommitdiffstats
path: root/lcm
diff options
context:
space:
mode:
Diffstat (limited to 'lcm')
-rw-r--r--lcm/lcm/nf/biz/query_vnf.py11
-rw-r--r--lcm/lcm/nf/serializers/instantiated_vnf_info.py4
-rw-r--r--lcm/lcm/nf/tests/test_query_vnf.py60
3 files changed, 54 insertions, 21 deletions
diff --git a/lcm/lcm/nf/biz/query_vnf.py b/lcm/lcm/nf/biz/query_vnf.py
index 1dd7c2d1..d460c03b 100644
--- a/lcm/lcm/nf/biz/query_vnf.py
+++ b/lcm/lcm/nf/biz/query_vnf.py
@@ -98,9 +98,13 @@ class QueryVnf:
resp_data = {
"id": vnf.nfinstid,
"vnfInstanceName": vnf.nf_name,
- "vnfPkgId": vnf.package_id,
- "vnfdVersion": vnf.version,
+ "vnfInstanceDescription": vnf.nf_desc,
+ "vnfdId": vnf.vnfdid,
"vnfProvider": vnf.vendor,
+ "vnfProductName": vnf.netype,
+ "vnfSoftwareVersion": vnf.vnfSoftwareVersion,
+ "vnfdVersion": vnf.version,
+ "vnfPkgId": vnf.package_id,
"instantiationState": vnf.status,
"instantiatedVnfInfo": {
"flavourId": vnf.flavour_id,
@@ -108,10 +112,11 @@ class QueryVnf:
"scaleStatus": [],
"extCpInfo": [],
"extVirtualLinkInfo": [],
- "monitoringParameters": {},
+ "monitoringParameters": [],
"vnfcResourceInfo": vnfc_arr,
"vnfVirtualLinkResourceInfo": vl_arr,
"virtualStorageResourceInfo": arr
}
}
+ logger.debug("vnf instance: %s", resp_data)
return resp_data
diff --git a/lcm/lcm/nf/serializers/instantiated_vnf_info.py b/lcm/lcm/nf/serializers/instantiated_vnf_info.py
index 82c2ec5b..cd6c93ec 100644
--- a/lcm/lcm/nf/serializers/instantiated_vnf_info.py
+++ b/lcm/lcm/nf/serializers/instantiated_vnf_info.py
@@ -57,9 +57,9 @@ class InstantiatedVnfInfoSerializer(serializers.Serializer):
many=True,
required=False,
allow_null=True)
- monitoringParameters = serializers.DictField(
+ monitoringParameters = serializers.ListSerializer(
help_text="Active monitoring parameters.",
- child=serializers.CharField(help_text="KeyValue Pairs", allow_blank=True),
+ child=serializers.CharField(help_text="monitoring parameter", allow_blank=True),
required=False,
allow_null=True)
localizationLanguage = serializers.CharField(
diff --git a/lcm/lcm/nf/tests/test_query_vnf.py b/lcm/lcm/nf/tests/test_query_vnf.py
index 25824239..88d4402b 100644
--- a/lcm/lcm/nf/tests/test_query_vnf.py
+++ b/lcm/lcm/nf/tests/test_query_vnf.py
@@ -27,7 +27,13 @@ class ResourceTest(TestCase):
self.test_data_single_vnf = {
"id": "1",
"vnfInstanceName": "VNF1",
- "vnfProvider": None,
+ "vnfInstanceDescription": "VNF DESC",
+ "vnfdId": "1",
+ "vnfProvider": "ZTE",
+ "vnfProductName": "XGW",
+ "vnfSoftwareVersion": "V1",
+ "vnfdVersion": "V1",
+ "vnfPkgId": "2",
"instantiationState": "INSTANTIATED",
"instantiatedVnfInfo": {
"vnfState": "STARTED",
@@ -43,19 +49,23 @@ class ResourceTest(TestCase):
],
"extVirtualLinkInfo": [],
"vnfcResourceInfo": [],
- "monitoringParameters": {},
+ "monitoringParameters": [],
"flavourId": None,
"vnfVirtualLinkResourceInfo": [],
"scaleStatus": []
- },
- "vnfdVersion": None,
- "vnfPkgId": None
+ }
}
self.test_data_multi_vnf = [
{
"id": "1",
"vnfInstanceName": "VNF1",
- "vnfProvider": None,
+ "vnfInstanceDescription": "VNF DESC",
+ "vnfdId": "1",
+ "vnfProvider": "ZTE",
+ "vnfProductName": "XGW",
+ "vnfSoftwareVersion": "V1",
+ "vnfdVersion": "V1",
+ "vnfPkgId": "2",
"instantiationState": "INSTANTIATED",
"instantiatedVnfInfo": {
"vnfState": "STARTED",
@@ -71,18 +81,22 @@ class ResourceTest(TestCase):
],
"extVirtualLinkInfo": [],
"vnfcResourceInfo": [],
- "monitoringParameters": {},
+ "monitoringParameters": [],
"flavourId": None,
"vnfVirtualLinkResourceInfo": [],
"scaleStatus": []
- },
- "vnfdVersion": None,
- "vnfPkgId": None
+ }
},
{
"id": "2",
"vnfInstanceName": "VNF2",
- "vnfProvider": None,
+ "vnfInstanceDescription": "VNF DESC",
+ "vnfdId": "1",
+ "vnfProvider": "ZTE",
+ "vnfProductName": "XGW",
+ "vnfSoftwareVersion": "V1",
+ "vnfdVersion": "V1",
+ "vnfPkgId": "2",
"instantiationState": "INSTANTIATED",
"instantiatedVnfInfo": {
"vnfState": "STARTED",
@@ -98,13 +112,11 @@ class ResourceTest(TestCase):
],
"extVirtualLinkInfo": [],
"vnfcResourceInfo": [],
- "monitoringParameters": {},
+ "monitoringParameters": [],
"flavourId": None,
"vnfVirtualLinkResourceInfo": [],
"scaleStatus": []
- },
- "vnfdVersion": None,
- "vnfPkgId": None
+ }
}
]
@@ -113,7 +125,16 @@ class ResourceTest(TestCase):
def test_get_vnf(self):
vnf_inst_id = "1"
- NfInstModel(nfinstid=vnf_inst_id, nf_name='VNF1', status='INSTANTIATED').save()
+ NfInstModel(nfinstid=vnf_inst_id,
+ nf_name='VNF1',
+ nf_desc="VNF DESC",
+ vnfdid="1",
+ netype="XGW",
+ vendor="ZTE",
+ vnfSoftwareVersion="V1",
+ version="V1",
+ package_id="2",
+ status='INSTANTIATED').save()
StorageInstModel(storageid='s02',
vimid='vim01',
resourceid='resource01',
@@ -157,6 +178,13 @@ class ResourceTest(TestCase):
for i in range(1, 3):
NfInstModel(nfinstid='%s' % i,
nf_name='VNF%s' % i,
+ nf_desc="VNF DESC",
+ vnfdid="1",
+ netype="XGW",
+ vendor="ZTE",
+ vnfSoftwareVersion="V1",
+ version="V1",
+ package_id="2",
status='INSTANTIATED').save()
StorageInstModel(storageid='s0%s' % i,
vimid='vim0%s' % i,