X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=osm_lcm%2Fns.py;h=6589e228eba894967c67392e5b1df50e7c2355fe;hb=2e2155173c047ac2acb8a626019eda2d87f785ed;hp=6148d02aeb99d272218015444a52f23ecb9589ab;hpb=e4f7e6cc71c5e81a7f58fddab055901c5bdf64db;p=osm%2FLCM.git diff --git a/osm_lcm/ns.py b/osm_lcm/ns.py index 6148d02..6589e22 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 @@ -1048,6 +1063,12 @@ class NsLcm(LcmBase): db_nsr_update["detailed-status"] = "Deleting charms" self.logger.debug(logging_text + step) self.update_db_2("nsrs", nsr_id, db_nsr_update) + # for backward compatibility + if isinstance(nsr_deployed["VCA"], dict): + nsr_deployed["VCA"] = list(nsr_deployed["VCA"].values()) + db_nsr_update["_admin.deployed.VCA"] = nsr_deployed["VCA"] + self.update_db_2("nsrs", nsr_id, db_nsr_update) + for vca_index, vca_deployed in enumerate(nsr_deployed["VCA"]): if vca_deployed: # TODO it would be desirable having a and deploy_info.get("deployed"): task = asyncio.ensure_future( @@ -1340,6 +1361,12 @@ class NsLcm(LcmBase): if pending: raise LcmException("Timeout waiting related tasks to be completed") + # for backward compatibility + if nsr_deployed and isinstance(nsr_deployed.get("VCA"), dict): + nsr_deployed["VCA"] = list(nsr_deployed["VCA"].values()) + db_nsr_update["_admin.deployed.VCA"] = nsr_deployed["VCA"] + self.update_db_2("nsrs", nsr_id, db_nsr_update) + # TODO check if ns is in a proper status primitive = db_nslcmop["operationParams"]["primitive"] primitive_params = db_nslcmop["operationParams"]["primitive_params"] @@ -1426,6 +1453,12 @@ class NsLcm(LcmBase): scaling_type = db_nslcmop["operationParams"]["scaleVnfData"]["scaleVnfType"] # scaling_policy = db_nslcmop["operationParams"]["scaleVnfData"]["scaleByStepData"].get("scaling-policy") + # for backward compatibility + if nsr_deployed and isinstance(nsr_deployed.get("VCA"), dict): + nsr_deployed["VCA"] = list(nsr_deployed["VCA"].values()) + db_nsr_update["_admin.deployed.VCA"] = nsr_deployed["VCA"] + self.update_db_2("nsrs", nsr_id, db_nsr_update) + step = "Getting vnfr from database" db_vnfr = self.db.get_one("vnfrs", {"member-vnf-index-ref": vnf_index, "nsr-id-ref": nsr_id}) step = "Getting vnfd from database"