aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhongyuzhao <zhao.hongyu@zte.com.cn>2019-12-19 15:00:04 +0800
committerhongyuzhao <zhao.hongyu@zte.com.cn>2020-01-04 11:34:38 +0800
commit19699104d4cacbf4eb0202aecbe4fcf377bcc157 (patch)
tree390b6ea685eb44a0adb307c9047d04bc5145deba
parent975f35644dca14ce3768187a2e3c8675273f8d44 (diff)
Fix bug for delete subscription in ns termination
Change-Id: I4a0b90c6947a99a120fa6aa3a28482cf4fc981e2 Issue-ID: VFC-1594 Signed-off-by: hongyuzhao <zhao.hongyu@zte.com.cn>
-rw-r--r--lcm/ns/views/deprecated/term_ns_view.py2
-rw-r--r--lcm/ns_vnfs/biz/subscribe.py3
-rw-r--r--lcm/ns_vnfs/biz/terminate_nfs.py2
-rw-r--r--tox.ini2
4 files changed, 5 insertions, 4 deletions
diff --git a/lcm/ns/views/deprecated/term_ns_view.py b/lcm/ns/views/deprecated/term_ns_view.py
index 6d37f30d..0e3a485f 100644
--- a/lcm/ns/views/deprecated/term_ns_view.py
+++ b/lcm/ns/views/deprecated/term_ns_view.py
@@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import logging
+import time
from drf_yasg.utils import swagger_auto_schema
from rest_framework import status
@@ -47,6 +48,7 @@ class NSTerminateView(APIView):
raise BadRequestException(req_serializer.errors)
job_id = JobUtil.create_job(JOB_TYPE.NS, JOB_ACTION.TERMINATE, ns_instance_id)
+ time.sleep(2)
TerminateNsService(ns_instance_id, job_id, request.data).start()
resp_serializer = _NsOperateJobSerializer(data={'jobId': job_id})
diff --git a/lcm/ns_vnfs/biz/subscribe.py b/lcm/ns_vnfs/biz/subscribe.py
index 2de67ca7..40f40591 100644
--- a/lcm/ns_vnfs/biz/subscribe.py
+++ b/lcm/ns_vnfs/biz/subscribe.py
@@ -19,7 +19,6 @@ from lcm.pub.database.models import SubscriptionModel
from lcm.pub.exceptions import NSLCMException
from lcm.pub.msapi.extsys import get_vnfm_by_id
from lcm.pub.utils.restcall import req_by_msb
-from lcm.pub.utils.values import ignore_case_get
from lcm.pub.config import config as pub_config
logger = logging.getLogger(__name__)
@@ -130,7 +129,7 @@ class SubscriptionDeletion(object):
def send_subscription_deletion_request(self):
if self.subscription:
- self.subscription_id = ignore_case_get(self.subscription.__dict__, 'id')
+ self.subscription_id = self.subscription.subscription_id
ret = req_by_msb('api/gvnfmdriver/v1/%s/subscriptions/%s' % (self.vnfm_id, self.subscription_id), 'DELETE')
if ret[0] != 0:
logger.error('Status code is %s, detail is %s.', ret[2], ret[1])
diff --git a/lcm/ns_vnfs/biz/terminate_nfs.py b/lcm/ns_vnfs/biz/terminate_nfs.py
index 1dec71d2..0205535b 100644
--- a/lcm/ns_vnfs/biz/terminate_nfs.py
+++ b/lcm/ns_vnfs/biz/terminate_nfs.py
@@ -140,7 +140,7 @@ class TerminateVnfs(threading.Thread):
def delete_subscription(self):
try:
- SubscriptionDeletion(self.vnfm_inst_id, self.vnf_inst_id).do_biz()
+ SubscriptionDeletion(self.vnfm_inst_id, self.vnf_uuid).do_biz()
except Exception as e:
logger.error("delete_subscription failed: %s", e.args[0])
diff --git a/tox.ini b/tox.ini
index cd624430..fb27ec5a 100644
--- a/tox.ini
+++ b/tox.ini
@@ -23,5 +23,5 @@ commands =
{[testenv]commands}
[testenv:cov]
-deps = coverage
+deps = coverage==4.2
commands = coverage xml --omit="*test_*,*__init__.py,*site-packages*"