summaryrefslogtreecommitdiffstats
path: root/lcm
diff options
context:
space:
mode:
authorFu Jinhua <fu.jinhua@zte.com.cn>2018-08-10 01:33:37 +0000
committerGerrit Code Review <gerrit@onap.org>2018-08-10 01:33:37 +0000
commita489d17eed5ffb2d8c2f60d959f868934b377977 (patch)
tree1c764bc29e7330052744fda671df31dc32a2fb1a /lcm
parentba281e6e2df5498fadbcb51291068786ddeff8d3 (diff)
parent6249f6864d9c5a3711d48b432810f2accf41f56a (diff)
Merge "Modify vnf query related stuffs in vnflcm."
Diffstat (limited to 'lcm')
-rw-r--r--lcm/lcm/nf/biz/query_vnf.py3
-rw-r--r--lcm/lcm/nf/serializers/vnf_instance.py6
-rw-r--r--lcm/lcm/nf/tests/test_query_vnf.py14
3 files changed, 14 insertions, 9 deletions
diff --git a/lcm/lcm/nf/biz/query_vnf.py b/lcm/lcm/nf/biz/query_vnf.py
index f3b2997e..bd4a1e3a 100644
--- a/lcm/lcm/nf/biz/query_vnf.py
+++ b/lcm/lcm/nf/biz/query_vnf.py
@@ -99,9 +99,10 @@ class QueryVnf:
"vnfPkgId": vnf.package_id,
"vnfdVersion": vnf.version,
"vnfProvider": vnf.vendor,
+ "instantiationState": vnf.status,
"instantiatedVnfInfo": {
"flavourId": vnf.flavour_id,
- "vnfState": vnf.status,
+ "vnfState": "STARTED",
"scaleStatus": [],
"extCpInfo": [],
"extVirtualLinkInfo": [],
diff --git a/lcm/lcm/nf/serializers/vnf_instance.py b/lcm/lcm/nf/serializers/vnf_instance.py
index bd453629..c7ff8890 100644
--- a/lcm/lcm/nf/serializers/vnf_instance.py
+++ b/lcm/lcm/nf/serializers/vnf_instance.py
@@ -95,9 +95,9 @@ class VnfInstanceSerializer(serializers.Serializer):
instantiationState = serializers.ChoiceField(
help_text="The instantiation state of the VNF.",
choices=["NOT_INSTANTIATED", "INSTANTIATED"],
- required=False,
- allow_null=True,
- allow_blank=True)
+ required=True,
+ allow_null=False,
+ allow_blank=False)
instantiatedVnfInfo = InstantiatedVnfInfoSerializer(
help_text="Information specific to an instantiated VNF instance. \
This attribute shall be present if the instantiateState attribute value is INSTANTIATED",
diff --git a/lcm/lcm/nf/tests/test_query_vnf.py b/lcm/lcm/nf/tests/test_query_vnf.py
index e092223b..ccb40c05 100644
--- a/lcm/lcm/nf/tests/test_query_vnf.py
+++ b/lcm/lcm/nf/tests/test_query_vnf.py
@@ -27,8 +27,9 @@ class ResourceTest(TestCase):
"id": "1",
"vnfInstanceName": "VNF1",
"vnfProvider": None,
+ "instantiationState": "INSTANTIATED",
"instantiatedVnfInfo": {
- "vnfState": None,
+ "vnfState": "STARTED",
"extCpInfo": [],
"virtualStorageResourceInfo": [
{
@@ -54,8 +55,9 @@ class ResourceTest(TestCase):
"id": "1",
"vnfInstanceName": "VNF1",
"vnfProvider": None,
+ "instantiationState": "INSTANTIATED",
"instantiatedVnfInfo": {
- "vnfState": None,
+ "vnfState": "STARTED",
"extCpInfo": [],
"virtualStorageResourceInfo": [
{
@@ -80,8 +82,9 @@ class ResourceTest(TestCase):
"id": "2",
"vnfInstanceName": "VNF2",
"vnfProvider": None,
+ "instantiationState": "INSTANTIATED",
"instantiatedVnfInfo": {
- "vnfState": None,
+ "vnfState": "STARTED",
"extCpInfo": [],
"virtualStorageResourceInfo": [
{
@@ -109,7 +112,7 @@ class ResourceTest(TestCase):
def test_get_vnf(self):
vnf_inst_id = "1"
- NfInstModel(nfinstid=vnf_inst_id, nf_name='VNF1').save()
+ NfInstModel(nfinstid=vnf_inst_id, nf_name='VNF1', status='INSTANTIATED').save()
StorageInstModel(storageid='s02',
vimid='vim01',
resouceid='resource01',
@@ -122,7 +125,8 @@ class ResourceTest(TestCase):
def test_get_vnfs(self):
for i in range(1, 3):
NfInstModel(nfinstid='%s' % i,
- nf_name='VNF%s' % i).save()
+ nf_name='VNF%s' % i,
+ status='INSTANTIATED').save()
StorageInstModel(storageid='s0%s' % i,
vimid='vim0%s' % i,
resouceid='resource0%s' % i,