Adding VIM refresh period to RO charm config 30/12430/2
authoraticig <gulsum.atici@canonical.com>
Mon, 8 Aug 2022 12:43:49 +0000 (15:43 +0300)
committeraticig <gulsum.atici@canonical.com>
Mon, 8 Aug 2022 21:25:10 +0000 (00:25 +0300)
Refresh period is allowed >=60 or -1. Setting it -1
will disable the updating VM status.

Change-Id: I18a8cd8fd39da16d2d0221dac15324a08da76c2a
Signed-off-by: aticig <gulsum.atici@canonical.com>
installers/charm/osm-ro/config.yaml
installers/charm/osm-ro/src/charm.py
installers/charm/osm-ro/tox.ini

index 9638a77..036eecd 100644 (file)
@@ -90,4 +90,14 @@ options:
         $ git clone "https://osm.etsi.org/gerrit/osm/common" /home/ubuntu/common
         $ juju config ro common-hostpath=/home/ubuntu/common
 
-      This configuration only applies if option `debug-mode` is set to true. 
+      This configuration only applies if option `debug-mode` is set to true.
+
+  period_refresh_active:
+    type: int
+    description: |
+      Updates the VNF status from VIM for every given period of time seconds.
+      Values equal or greater than 60 is allowed.
+      Disable the updates from VIM by setting -1.
+      Example:
+        $ juju config ro period_refresh_active=-1
+        $ juju config ro period_refresh_active=100
index 8b45191..c19281e 100755 (executable)
@@ -203,6 +203,12 @@ class OsmRoCharm(CharmBase):
         ]:
             raise CharmError("invalid value for log-level option")
 
+        refresh_period = self.config.get("period_refresh_active")
+        if refresh_period and refresh_period < 60 and refresh_period != -1:
+            raise ValueError(
+                "Refresh Period is too tight, insert >= 60 seconds or disable using -1"
+            )
+
     def _check_relations(self) -> None:
         """Validate charm relations.
 
@@ -290,6 +296,8 @@ class OsmRoCharm(CharmBase):
                         "OSMRO_STORAGE_PATH": "/app/storage",
                         "OSMRO_STORAGE_COLLECTION": "files",
                         "OSMRO_STORAGE_URI": self.mongodb_client.connection_string,
+                        "OSMRO_PERIOD_REFRESH_ACTIVE": self.config.get("period_refresh_active")
+                        or 60,
                     },
                 }
             },
index b5f809e..90adfe2 100644 (file)
@@ -52,7 +52,7 @@ commands =
 description = Check code against coding style standards
 deps =
     black
-    flake8
+    flake8==4.0.1
     flake8-docstrings
     flake8-copyright
     flake8-builtins