From 552bc9d3c4b3e5d01d9ddd687fb2f40f8eac4d10 Mon Sep 17 00:00:00 2001 From: Tommy Carpenter Date: Wed, 22 Jan 2020 13:53:34 -0500 Subject: [PATCH] Add sdl healthcheck to a1's healthcheck Change-Id: If70e723c32ff7040f8eec71f0bd8bdf078aa5383 Signed-off-by: Tommy Carpenter --- a1/controller.py | 11 ++++++----- a1/data.py | 4 ++++ container-tag.yaml | 2 +- docs/release-notes.rst | 9 +++++++++ integration_tests/a1mediator/Chart.yaml | 2 +- setup.py | 4 ++-- 6 files changed, 23 insertions(+), 9 deletions(-) diff --git a/a1/controller.py b/a1/controller.py index b4d85df..4210266 100644 --- a/a1/controller.py +++ b/a1/controller.py @@ -60,12 +60,13 @@ def get_healthcheck(): Currently, this checks: 1. whether the a1 webserver is up (if it isn't, this won't even be called, so even entering this function confirms it is) 2. checks whether the rmr thread is running and has completed a loop recently - TODO: make "seconds" to pass in a configurable parameter? - TODO: I've requested that SDL provide a "I'm connected to the backend" healthcheck that can be integrated here + 3. checks that our SDL connection is healthy """ - if a1rmr.healthcheck_rmr_thread(): - return "", 200 - return "rmr thread is unhealthy", 500 + if not a1rmr.healthcheck_rmr_thread(): + return "rmr thread is unhealthy", 500 + if not data.SDL.healthcheck(): + return "sdl connection is unhealthy", 500 + return "", 200 # Policy types diff --git a/a1/data.py b/a1/data.py index 300f19d..d537d54 100644 --- a/a1/data.py +++ b/a1/data.py @@ -68,6 +68,10 @@ class SDLWrapper: """ delete a key""" self.sdl.remove(A1NS, {key}) + def healthcheck(self): + """checks if the sdl connection is healthy""" + return self.sdl.is_active() + SDL = SDLWrapper() diff --git a/container-tag.yaml b/container-tag.yaml index b34dfd8..5c4cc74 100644 --- a/container-tag.yaml +++ b/container-tag.yaml @@ -1,4 +1,4 @@ # The Jenkins job uses this string for the tag in the image name # for example nexus3.o-ran-sc.org:10004/my-image-name:my-tag --- -tag: 2.1.1 +tag: 2.1.2 diff --git a/docs/release-notes.rst b/docs/release-notes.rst index ac3ad1d..fe3c1c9 100644 --- a/docs/release-notes.rst +++ b/docs/release-notes.rst @@ -14,6 +14,15 @@ and this project adheres to `Semantic Versioning `__. :depth: 3 :local: +[2.1.2] - 1/22/2020 +------------------- + +:: + + * Upgrades from sdl 2.0.2 to 2.0.3 + * Integrates an sdl healthcheck into a1's healthcheck + + [2.1.1] - 1/14/2020 ------------------- diff --git a/integration_tests/a1mediator/Chart.yaml b/integration_tests/a1mediator/Chart.yaml index d8c63c7..e1ed636 100644 --- a/integration_tests/a1mediator/Chart.yaml +++ b/integration_tests/a1mediator/Chart.yaml @@ -1,4 +1,4 @@ apiVersion: v1 description: A1 Helm chart for Kubernetes name: a1mediator -version: 2.1.1 +version: 2.1.2 diff --git a/setup.py b/setup.py index 0179fb0..4401c10 100644 --- a/setup.py +++ b/setup.py @@ -18,7 +18,7 @@ from setuptools import setup, find_packages setup( name="a1", - version="2.1.1", + version="2.1.2", packages=find_packages(exclude=["tests.*", "tests"]), author="Tommy Carpenter", description="RIC A1 Mediator for policy/intent changes", @@ -33,7 +33,7 @@ setup( "msgpack", "rmr>=2.2.0", "mdclogpy", - "ricsdl>=2.0.2,<3.0.0", + "ricsdl>=2.0.3,<3.0.0", ], package_data={"a1": ["openapi.yaml"]}, ) -- 2.16.6