summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhewei-cmss <hewei@cmss.chinamobile.com>2019-07-12 14:17:29 +0800
committerhewei-cmss <hewei@cmss.chinamobile.com>2019-07-12 14:32:30 +0800
commit2f0501d091b2d4bcfbc03edebbb30160ea139548 (patch)
treee611dee5f9ff74f2c8d253c13ff375c51172fcd1
parentd9949426185df3323dea4db239293328c5395808 (diff)
Refactor get ns
Issue-ID: VFC-1445 Signed-off-by: hewei-cmss <hewei@cmss.chinamobile.com> Change-Id: Ib6c284a89c610e7dc0707d9ee0c33e33aba7bf23
-rw-r--r--lcm/ns/biz/ns_get.py15
-rw-r--r--lcm/ns/serializers/sol/ns_instance.py3
2 files changed, 8 insertions, 10 deletions
diff --git a/lcm/ns/biz/ns_get.py b/lcm/ns/biz/ns_get.py
index ce91e785..e023a1b1 100644
--- a/lcm/ns/biz/ns_get.py
+++ b/lcm/ns/biz/ns_get.py
@@ -44,20 +44,15 @@ class GetNSInfoService(object):
if is_sol:
nsInstance = {}
nsInstance['id'] = ns_inst.id
- if ns_inst.name:
- nsInstance['nsInstanceName'] = ns_inst.name
- if ns_inst.description:
- nsInstance['nsInstanceDescription'] = ns_inst.description
- if ns_inst.nsd_id:
- nsInstance['nsdId'] = ns_inst.nsd_id
+ nsInstance['nsInstanceName'] = ns_inst.name
+ nsInstance['nsInstanceDescription'] = ns_inst.description
+ nsInstance['nsdId'] = ns_inst.nsd_id
+ nsInstance['nsdInfoId'] = ns_inst.nspackage_id
+ nsInstance['nsState'] = ns_inst.status
if ns_inst.nsd_invariant_id:
nsInstance['nsdInvariantId'] = ns_inst.nsd_invariant_id
- if ns_inst.nspackage_id:
- nsInstance['nsdInfoId'] = ns_inst.nspackage_id
if ns_inst.flavour_id:
nsInstance['flavourId'] = ns_inst.flavour_id
- if ns_inst.status:
- nsInstance['nsState'] = ns_inst.status
# todo 'nsScaleStatus':{}
# todo 'additionalAffinityOrAntiAffinityRule':{}
logger.debug(" test ")
diff --git a/lcm/ns/serializers/sol/ns_instance.py b/lcm/ns/serializers/sol/ns_instance.py
index b8024d57..c5ccb88a 100644
--- a/lcm/ns/serializers/sol/ns_instance.py
+++ b/lcm/ns/serializers/sol/ns_instance.py
@@ -681,6 +681,9 @@ class NsInstanceSerializer(serializers.Serializer):
nsdId = serializers.CharField(
help_text="Identifier of the NSD on which the NS instance is based.",
required=True)
+ nsdInvariantId = serializers.CharField(
+ help_text="Identifier of the NSD in a version independent manner.",
+ required=False)
nsdInfoId = serializers.CharField(
help_text="Identifier of the NSD information object on which the NS instance is based.",
required=True)