From: aticig Date: Thu, 30 Jun 2022 00:50:07 +0000 (+0300) Subject: Adding VIM refresh period to RO charm config X-Git-Tag: release-v13.0-start~56 X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2Fdevops.git;a=commitdiff_plain;h=bd32485a35589a6ebb7dba837d4c9bfe1b78de26 Adding VIM refresh period to RO charm config Refresh period is allowed >=60 or -1. Setting it -1 will disable the updating VM status. Change-Id: I94ec37f68303128ba7af67f14121436005fd9259 Signed-off-by: aticig --- diff --git a/installers/charm/ro/config.yaml b/installers/charm/ro/config.yaml index 8c5740a6..31bf8cb0 100644 --- a/installers/charm/ro/config.yaml +++ b/installers/charm/ro/config.yaml @@ -35,6 +35,15 @@ options: description: "Log Level" type: string default: "INFO" + 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 mysql_host: type: string description: MySQL Host (external database) diff --git a/installers/charm/ro/src/charm.py b/installers/charm/ro/src/charm.py index b196b195..b76fba7e 100755 --- a/installers/charm/ro/src/charm.py +++ b/installers/charm/ro/src/charm.py @@ -81,6 +81,7 @@ class ConfigModel(ModelValidator): image_pull_policy: str debug_mode: bool security_context: bool + period_refresh_active: Optional[int] @validator("log_level") def validate_log_level(cls, v): @@ -122,6 +123,14 @@ class ConfigModel(ModelValidator): def certificates_dict(cls): return _extract_certificates(cls.certificates) if cls.certificates else {} + @validator("period_refresh_active") + def validate_vim_refresh_period(cls, v): + if v and v < 60 and v != -1: + raise ValueError( + "Refresh Period is too tight, insert >= 60 seconds or disable using -1" + ) + return v + class RoCharm(CharmedOsmBase): """GrafanaCharm Charm.""" @@ -271,7 +280,12 @@ class RoCharm(CharmedOsmBase): "OSMRO_LOG_LEVEL": config.log_level, } ) - + if config.period_refresh_active: + container_builder.add_envs( + { + "OSMRO_PERIOD_REFRESH_ACTIVE": config.period_refresh_active, + } + ) if config.enable_ng_ro: # Add secrets to the pod mongodb_secret_name = f"{self.app.name}-mongodb-secret"