diff options
-rw-r--r-- | lcm/lcm/nf/biz/query_vnf.py | 3 | ||||
-rw-r--r-- | lcm/lcm/nf/serializers/vnf_instance.py | 6 | ||||
-rw-r--r-- | lcm/lcm/nf/tests/test_query_vnf.py | 14 |
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, |