From: bravof Date: Mon, 15 Feb 2021 19:19:07 +0000 (-0300) Subject: fix(scaling): min instance count now from right sol006 field and condition fixed... X-Git-Tag: v9.1.0^0 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=7a174797846b23398a51e4a1568063b2bc83d481;p=osm%2FPOL.git fix(scaling): min instance count now from right sol006 field and condition fixed. Bug 1388 Change-Id: I465e0e9d53c1384bff1c64ab542f2ca5697bed6e Signed-off-by: bravof (cherry picked from commit 57f492047cb0c2f22680895d823bd729fd266185) --- diff --git a/Dockerfile b/Dockerfile index f3af477..ec336bb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,9 +20,9 @@ # contact: bdiaz@whitestack.com or glavado@whitestack.com ## -FROM ubuntu:16.04 +FROM ubuntu:20.04 RUN apt-get update && \ - DEBIAN_FRONTEND=noninteractive apt-get --yes install git tox make python-all python3 python3-pip debhelper wget && \ - DEBIAN_FRONTEND=noninteractive apt-get --yes install libmysqlclient-dev libxml2 python3-all && \ - DEBIAN_FRONTEND=noninteractive pip3 install -U setuptools setuptools-version-command stdeb + DEBIAN_FRONTEND=noninteractive apt-get --yes install git tox=3.13.2-2 make=4.2.1-1.2 python-all=2.7.17-2ubuntu4 python3=3.8.2-0ubuntu2 python3-pip=20.0.2-5ubuntu1.1 debhelper wget && \ + DEBIAN_FRONTEND=noninteractive apt-get --yes install libmysqlclient-dev=8.0.23-0ubuntu0.20.04.1 libxml2 python3-all=3.8.2-0ubuntu2 dh-python=4.20191017ubuntu7 && \ + DEBIAN_FRONTEND=noninteractive pip3 install -U setuptools==53.0.0 setuptools-version-command==2.2 stdeb==0.10.0 diff --git a/docker/Dockerfile b/docker/Dockerfile index 7045b0f..892eff1 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -25,8 +25,8 @@ FROM ubuntu:20.04 LABEL authors="Benjamín Díaz, Fabián Bravo" RUN apt-get --yes update \ - && apt-get --yes install python3 python3-pip libmysqlclient-dev git mysql-client \ - && pip3 install pip==9.0.3 + && apt-get --yes install python3=3.8.2-0ubuntu2 python3-pip=20.0.2-5ubuntu1.1 libmysqlclient-dev=8.0.23-0ubuntu0.20.04.1 git mysql-client=8.0.23-0ubuntu0.20.04.1 \ + && pip3 install pip==21.0.1 COPY requirements.txt /policy_module/requirements.txt diff --git a/osm_policy_module/autoscaling/service.py b/osm_policy_module/autoscaling/service.py index fb3ecaf..57756b7 100644 --- a/osm_policy_module/autoscaling/service.py +++ b/osm_policy_module/autoscaling/service.py @@ -73,7 +73,6 @@ class AutoscalingService: log.debug("No scaling aspect present in vnfd") continue # TODO: Change for multiple instantiation levels support - instantiation_level = df.get('instantiation-level', [{}])[0] scaling_aspects = df['scaling-aspect'] all_vnfd_monitoring_params = self._get_all_vnfd_monitoring_params(vnfd) for scaling_aspect in scaling_aspects: @@ -122,10 +121,12 @@ class AutoscalingService: if admin_scale_info["name"] == scaling_aspect["name"]: nb_scale_op = admin_scale_info.get("nb-scale-op", 0) break - for vdu_level in instantiation_level.get('vdu-level', ()): - if vdu_level.get('vdu-id') == vdu_id: - min_instance_count = int(vdu_level['number-of-instances']) - if nb_scale_op > min_instance_count: + min_instance_count = 1 + for vdu_profile in df.get('vdu-profile', ()): + if vdu_profile.get('id') == vdu_id: + min_instance_count = int(vdu_profile.get('min-number-of-instances ', 1)) + break + if nb_scale_op >= min_instance_count: alarm_uuid = await self.mon_client.create_alarm( metric_name=metric_name, ns_id=nsr_id,