X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=osm_lcm%2Fns.py;h=173ad887d1861263aa368a3283ed4195da62e55b;hb=refs%2Fheads%2Fbug-585;hp=eef3e891a1576ce876475d761bc5e8db3ea1cf64;hpb=82974b2578eeefa319cb9507b63d8f29499c85b0;p=osm%2FLCM.git diff --git a/osm_lcm/ns.py b/osm_lcm/ns.py index eef3e89..173ad88 100644 --- a/osm_lcm/ns.py +++ b/osm_lcm/ns.py @@ -1,6 +1,21 @@ -#!/usr/bin/python3 # -*- coding: utf-8 -*- +## +# Copyright 2018 Telefonica S.A. +# +# 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. +## + import asyncio import yaml import logging @@ -790,20 +805,18 @@ class NsLcm(LcmBase): # ns_name will be ignored in the current version of N2VC # but will be implemented for the next point release. - model_name = 'default' # TODO bug 581 : change to nsr_id + model_name = "default" # TODO bug 585 nsr_id if vdu_id: - vdu_id_text = vdu_id + vdu_id_text = vdu_id + "-" else: - vdu_id_text = "vnfd" # TODO bug 581 remove and add just an empty string "" + vdu_id_text = "-" application_name = self.n2vc.FormatApplicationName(nsr_name, vnf_index, vdu_id_text) - # TODO bug 581 Add "-" as a final argument vca_index = len(vca_deployed_list) # trunk name and add two char index at the end to ensure that it is unique. It is assumed no more than # 26*26 charm in the same NS - # TODO bug 581 uncoment - # application_name = application_name[0:48] - # application_name += chr(97 + vca_index / 26) + chr(97 + vca_index % 26) + application_name = application_name[0:48] + application_name += chr(97 + vca_index // 26) + chr(97 + vca_index % 26) vca_deployed_ = { "member-vnf-index": vnf_index, "vdu_id": vdu_id, @@ -1088,6 +1101,8 @@ class NsLcm(LcmBase): try: if RO_nsr_id: step = db_nsr_update["detailed-status"] = db_nslcmop_update["detailed-status"] = "Deleting ns at RO" + self.update_db_2("nslcmops", nslcmop_id, db_nslcmop_update) + self.update_db_2("nsrs", nsr_id, db_nsr_update) self.logger.debug(logging_text + step) desc = await RO.delete("ns", RO_nsr_id) RO_delete_action = desc["action_id"] @@ -1113,11 +1128,13 @@ class NsLcm(LcmBase): break else: assert False, "ROclient.check_action_status returns unknown {}".format(ns_status) - await asyncio.sleep(5, loop=self.loop) - delete_timeout -= 5 if detailed_status != detailed_status_old: - detailed_status_old = db_nslcmop_update["detailed-status"] = detailed_status + detailed_status_old = db_nslcmop_update["detailed-status"] = \ + db_nsr_update["detailed-status"] = detailed_status self.update_db_2("nslcmops", nslcmop_id, db_nslcmop_update) + self.update_db_2("nsrs", nsr_id, db_nsr_update) + await asyncio.sleep(5, loop=self.loop) + delete_timeout -= 5 else: # delete_timeout <= 0: raise ROclient.ROClientException("Timeout waiting ns deleted from VIM")