From 496bca378a06a8690d23b999b713900347ac96f2 Mon Sep 17 00:00:00 2001 From: fujinhua Date: Sun, 28 Apr 2019 15:44:40 +0800 Subject: [PATCH] Add suboperation to lcm op occ Change-Id: Idba4b5374f564d467694e7592d287ace868346a5 Issue-ID: VFC-1306 Signed-off-by: fujinhua --- lcm/lcm/nf/biz/operate_vnf_lcm_op_occ.py | 4 ++- .../0002_vnflcmopoccmodel_sub_operation.py | 32 ++++++++++++++++++++++ lcm/lcm/pub/database/models.py | 1 + 3 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 lcm/lcm/pub/database/migrations/0002_vnflcmopoccmodel_sub_operation.py diff --git a/lcm/lcm/nf/biz/operate_vnf_lcm_op_occ.py b/lcm/lcm/nf/biz/operate_vnf_lcm_op_occ.py index b8e7f50f..919a3461 100644 --- a/lcm/lcm/nf/biz/operate_vnf_lcm_op_occ.py +++ b/lcm/lcm/nf/biz/operate_vnf_lcm_op_occ.py @@ -77,11 +77,13 @@ class VnfLcmOpOcc: } })).save() - def upd(self, operation_state=None, error=None): + def upd(self, operation_state=None, sub_operation=None, error=None): occ = VNFLcmOpOccModel.objects.filter(id=self.lcm_op_id) with MUTEX_UPD_OCC: if operation_state: occ.update(operation_state=operation_state) + if sub_operation: + occ.update(sub_operation=sub_operation) if error: occ.update(error=json.dumps(error)) diff --git a/lcm/lcm/pub/database/migrations/0002_vnflcmopoccmodel_sub_operation.py b/lcm/lcm/pub/database/migrations/0002_vnflcmopoccmodel_sub_operation.py new file mode 100644 index 00000000..d0be41c2 --- /dev/null +++ b/lcm/lcm/pub/database/migrations/0002_vnflcmopoccmodel_sub_operation.py @@ -0,0 +1,32 @@ +# Copyright 2019 ZTE Corporation. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Generated by Django 1.11.9 on 2019-04-28 07:45 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('database', '0001_initial'), + ] + + operations = [ + migrations.AddField( + model_name='vnflcmopoccmodel', + name='sub_operation', + field=models.CharField(db_column=b'SUBOPERATION', max_length=30, null=True), + ), + ] diff --git a/lcm/lcm/pub/database/models.py b/lcm/lcm/pub/database/models.py index 3ac4a832..c2e00712 100644 --- a/lcm/lcm/pub/database/models.py +++ b/lcm/lcm/pub/database/models.py @@ -326,6 +326,7 @@ class VNFLcmOpOccModel(models.Model): vnf_instance_id = models.CharField(db_column='VNFINSTANCEID', null=False, max_length=255) grant_id = models.CharField(db_column='GRANTID', null=True, max_length=255) operation = models.CharField(db_column='OPERATION', null=False, max_length=30) + sub_operation = models.CharField(db_column='SUBOPERATION', null=True, max_length=30) is_automatic_invocation = models.CharField(db_column='ISAUTOMATICINVOCATION', null=False, max_length=5) operation_params = models.TextField(db_column='OPERATIONPARAMS', null=False) is_cancel_pending = models.CharField(db_column='ISCANCELPENDING', null=False, max_length=5) -- 2.16.6