ric-plt/sdlgo.git
21 hours agoMerge "RIC:1060: Change in PTL" master
Timo Tietavainen [Thu, 2 May 2024 08:01:13 +0000 (08:01 +0000)]
Merge "RIC:1060: Change in PTL"

2 days agoCI: Migrate Sonar Scan job to GHA 68/12868/1
Jessica Wagantall [Tue, 30 Apr 2024 20:29:09 +0000 (13:29 -0700)]
CI: Migrate Sonar Scan job to GHA

Change-Id: I1cc8ba71aa07abca719d7cfce3e3d90d2ea8a6f3
Signed-off-by: Jessica Wagantall <jwagantall@linuxfoundation.org>
2 days agoRIC:1060: Change in PTL 36/12836/1
Abdulwahid W [Tue, 30 Apr 2024 13:23:55 +0000 (18:53 +0530)]
RIC:1060: Change in PTL

Change-Id: I89d25a83240d8856e3b7b5949c147d6603582b66
Signed-off-by: Abdulwahid W <abdulwahid.w@nokia.com>
9 days agoCI: Add silent prescan SonarCloud job 94/12694/2
Jessica Wagantall [Tue, 9 Apr 2024 00:21:24 +0000 (17:21 -0700)]
CI: Add silent prescan SonarCloud job

Change-Id: Ie2852b72c7029fd8705bf59523786c1f26d2c308
Signed-off-by: Jessica Wagantall <jwagantall@linuxfoundation.org>
4 months agoreleasing 0.10.4 60/12260/1 i-release v0.10.4
czichy [Wed, 13 Dec 2023 10:39:49 +0000 (12:39 +0200)]
releasing 0.10.4

Change-Id: I16ab85db67080a90006f2c52c6684df0ecef1ceb
Signed-off-by: czichy <thoralf.czichy@nokia.com>
5 months agoGo version changed 00/11900/1
Rimjhim Verma [Wed, 29 Nov 2023 08:57:00 +0000 (14:27 +0530)]
Go version changed

Change-Id: I03dc4083edd0f01ec6a0f1f49b9f786f8fe5d29f
Signed-off-by: Rimjhim Verma <rimjhim.verma@nokia.com>
10 months agoUpdate version 0.10.2 and 0.10.3 release notes 05/11305/2 h-release v0.10.3
czichy [Thu, 8 Jun 2023 12:18:25 +0000 (15:18 +0300)]
Update version 0.10.2 and 0.10.3 release notes

Change-Id: Icd790224ad4e71dac4535e5a221f14bde9cdc292
Signed-off-by: czichy <thoralf.czichy@nokia.com>
13 months agogo version update 06/10806/1
anbalan [Mon, 27 Mar 2023 12:18:34 +0000 (17:48 +0530)]
go version update

Signed-off-by: anbalan <abdulwahid.w@nokia.com>
Change-Id: Idc55b7f7733c6e68788482c08938ff097fab49c8

17 months agoReplacing committers with new ones 26/9926/1 g-release
czichy [Fri, 2 Dec 2022 11:55:50 +0000 (13:55 +0200)]
Replacing committers with new ones

Signed-off-by: czichy <thoralf.czichy@nokia.com>
Change-Id: I9dc740187776bf7ef710089676bf1859f4ef2515

19 months agoUpdate version 0.10.1 and 0.10.2 release notes 50/9150/1 v0.10.2
Timo Tietavainen [Fri, 30 Sep 2022 10:26:32 +0000 (13:26 +0300)]
Update version 0.10.1 and 0.10.2 release notes

Issue-Id: RIC-942

Signed-off-by: Timo Tietavainen <timo.tietavainen@nokia.com>
Change-Id: Icbff7ad092eef961f6498d97f8652ba69dca050e

19 months agoHandle net.SplitHostPort() error 49/9149/1
Timo Tietavainen [Fri, 30 Sep 2022 10:24:59 +0000 (13:24 +0300)]
Handle net.SplitHostPort() error

Add handling of net.SplitHostPort() function error return value.

Issue-Id: RIC-942

Signed-off-by: Timo Tietavainen <timo.tietavainen@nokia.com>
Change-Id: Ief30f269fe67451144652ba740bb72f3e962799f

19 months agoHandle CloseDB() error in statistics query 48/9148/1
Timo Tietavainen [Fri, 30 Sep 2022 10:22:46 +0000 (13:22 +0300)]
Handle CloseDB() error in statistics query

Add handling of Redis connection close function CloseDB() return value
after sentinel statistics were queried.

Issue-Id: RIC-942

Signed-off-by: Timo Tietavainen <timo.tietavainen@nokia.com>
Change-Id: I632b112a085c95bf0dbe80035308ffcc799bfa10

19 months agoMissing log Output() error handling 47/9147/1
Timo Tietavainen [Fri, 30 Sep 2022 10:20:01 +0000 (13:20 +0300)]
Missing log Output() error handling

Replace log package Output() function usage with Printf() function,
which do not return error status and hence suites better for SDL logger
module use case.

Issue-Id: RIC-942

Signed-off-by: Timo Tietavainen <timo.tietavainen@nokia.com>
Change-Id: I0f0e0e654d87f8da3f074e52a0ae25fef8d76159

19 months agoHandle Subscribe() and Unsubscribe() error 46/9146/1
Timo Tietavainen [Fri, 30 Sep 2022 10:17:19 +0000 (13:17 +0300)]
Handle Subscribe() and Unsubscribe() error

Add handling of Redis channel Subscribe() and Unsubscribe() function
calls error status. Error status is returned back to the caller of SDL
APIs SubscribeChannel() and UnsubscribeChannel().

Issue-Id: RIC-942

Signed-off-by: Timo Tietavainen <timo.tietavainen@nokia.com>
Change-Id: I2442e3ef78cdddabc2b983f59b0b05f5932c45c0

20 months agoUpgrade Golang version to fix CVE-2022-32189 vulnerability 85/8885/1 v0.10.1
Timo Tietavainen [Fri, 12 Aug 2022 12:49:53 +0000 (15:49 +0300)]
Upgrade Golang version to fix CVE-2022-32189 vulnerability

A too-short encoded message can cause a panic in Float.GobDecode and Rat
GobDecode in math/big in Go before 1.17.13 and 1.18.5, potentially
allowing a denial of service. Upgrade Golang to the latest 1.18 version,
that is for the time being 1.18.5.
Issue-Id: RIC-934

Signed-off-by: Timo Tietavainen <timo.tietavainen@nokia.com>
Change-Id: I9498217634fc9b78a5d1ef814e1a3c8dd251d758

2 years agoRevert previous sdlgo example change 75/7975/1 f-release
Timo Tietavainen [Tue, 22 Mar 2022 13:39:04 +0000 (15:39 +0200)]
Revert previous sdlgo example change

Revert example.go change done by the commit 6ffe956f91, because that
change was a mishap.

Issue-Id: RIC-893

Signed-off-by: Timo Tietavainen <timo.tietavainen@nokia.com>
Change-Id: I0566eba4ca70f735a2bf5da755c44752618e98d3

2 years agoRead list type of environment variables 44/7944/2 v0.10.0
Timo Tietavainen [Mon, 14 Mar 2022 05:19:47 +0000 (07:19 +0200)]
Read list type of environment variables

DBAAS Helm Charts appconfig has been changed to have individual ports
and master names for each SDL cluster due to problems seen with DBAAS
upgrade and rollback caused by re-allocation of the same address/port
of Redis to some other SDL cluster. Implement support for new list type
environment variables reading in SDL:
 * DBAAS_SERVICE_PORT
 * DBAAS_SERVICE_SENTINEL_PORT
 * DBAAS_MASTER_NAME

Issue-Id: RIC-698

Signed-off-by: Timo Tietavainen <timo.tietavainen@nokia.com>
Change-Id: I9a9d94e536e0e4e2a174ef0b6fb2beb4c73ef4f5

2 years agoFix multi-namespace SDL event subscribe 92/7692/2 v0.9.6
Timo Tietavainen [Mon, 7 Feb 2022 11:16:51 +0000 (13:16 +0200)]
Fix multi-namespace SDL event subscribe

SDL event channel internal format was wrongly showed to application
when the same application instance was subscribing to receive SDL
events from multiple namespaces. In that case subscribes were all
registered to the first namespace in SDL and hence when an event in a
channel belonging to another namespace was triggered, namespace internal
format '{other-namespace},' was showed in front of channel name. With
this commit change namespace lookup from channel name to search from
left to right the first comma ',' character. String after comma is
a channel name what should be showed to an application and all before
the comma ',' character can be silently parsed away in SDL.

Issue-Id: RIC-885

Signed-off-by: Timo Tietavainen <timo.tietavainen@nokia.com>
Change-Id: I90b94862670e1e529381112e385b65250e7cb275

2 years agoBump Redis client version to v8.11.4 87/7587/6 v0.9.5
Timo Tietavainen [Thu, 20 Jan 2022 06:10:20 +0000 (08:10 +0200)]
Bump Redis client version to v8.11.4

Bump Redis client version to the latest v8.11.4 version. Fix calling of Redis
client APIs, because Redis client APIs have been changed in version 8 to have
Golang Context type of argument.
SDLGO version: 0.9.5

Issue-Id: RIC-698

Signed-off-by: Timo Tietavainen <timo.tietavainen@nokia.com>
Change-Id: If551864081c3fddb0ecba95eb46600984d4f5a66

2 years agoMerge "SDL CLI command to generate sdlcli shell completion file for bash" v0.9.4
Petri Ovaska [Thu, 13 Jan 2022 14:12:17 +0000 (14:12 +0000)]
Merge "SDL CLI command to generate sdlcli shell completion file for bash"

2 years agoMove SDL usage code example 56/7556/2
Timo Tietavainen [Thu, 13 Jan 2022 08:41:59 +0000 (10:41 +0200)]
Move SDL usage code example

Move SDL usage code example from sdlgo repo's root to example
sub-directory and change it to be a runnable application. Earlier
example was belonging to the Golang test package what caused it to be
ran when 'go test ./...' -command was executed and execution of the
example was failing if DBAAS connection was missing. Execution failure
is also visible in the sdlgo coverage test of the sonarcloud.io.

Issue-Id: RIC-875

Signed-off-by: Timo Tietavainen <timo.tietavainen@nokia.com>
Change-Id: I6d980e0730d4a6f768448134bc7efece050a6d89

2 years agoSDL CLI command to generate sdlcli shell completion file for bash 20/7520/4
Petri Ovaska [Mon, 10 Jan 2022 13:56:47 +0000 (15:56 +0200)]
SDL CLI command to generate sdlcli shell completion file for bash

Output shell completion code for the bash shell.

 Usage:
   sdlcli completion bash

Added a new SDL CLI 'completion' command to generate auto-complete
file for the bash shells.

Version: 0.9.4

Issue-Id: RIC-874
Change-Id: Id5a5d14cfe3c5eb2a7815439c5b2a9b94271a2bd
Signed-off-by: Petri Ovaska <petri.ovaska@nokia.com>
2 years agoFix sdlcli get -command result stdout write 86/7486/1 v0.9.3
Timo Tietavainen [Thu, 30 Dec 2021 10:40:57 +0000 (12:40 +0200)]
Fix sdlcli get -command result stdout write

Sdlcli get -command writes wrongly results to stderr stream. Fix sdlcli
get -command to write results to stdout stream when command execution
has succeeded. In addition add similar stdout redirect also to sdlcli
statistics -command just to keep the code look the same, even thought
there wasn't any real issue with sdlcli statistics -command's results
visibility.

Version: 0.9.3

Issue-Id: RIC-873

Signed-off-by: Timo Tietavainen <timo.tietavainen@nokia.com>
Change-Id: Icc7d42d9200bdcc74bf1da6ceab341dd6b69c16e

2 years agoFix SDLCLI healthcheck to ignore ghost Sentinels 47/7447/2 v0.9.2
Timo Tietavainen [Tue, 21 Dec 2021 22:46:03 +0000 (00:46 +0200)]
Fix SDLCLI healthcheck to ignore ghost Sentinels

Fix SDLCLI 'healthcheck' command to ignore Redis Sentinel entries what
have a zero port numbers, because these extra entries are not valid
entries but instead are caused by a bug (#9240) in Redis server. Until
there is a fix for the Redis server issue available, we ignore these
ghost Redis Sentinel entries from SDLCLI 'healthcheck' command's
validation.

Version: 0.9.2

Issue-Id: RIC-869

Signed-off-by: Timo Tietavainen <timo.tietavainen@nokia.com>
Change-Id: I4ba075cf66af98a59da8c558e9602ba1427fb8d9

2 years agoRefactor long readRedisInfoReplyFields() function 28/7428/2 v0.9.1
Petri Ovaska [Mon, 20 Dec 2021 11:20:29 +0000 (13:20 +0200)]
Refactor long readRedisInfoReplyFields() function

Split very long readRedisInfoReplyFields() function to multiple
functions to reduce complexity.

Version: 0.9.1

Issue-Id: RIC-113
Change-Id: I63858c9c5d8bd99db464209043f5d23ca0109e38
Signed-off-by: Petri Ovaska <petri.ovaska@nokia.com>
2 years agoDo not allow '*' character in namespace argument 21/7421/2
Petri Ovaska [Fri, 17 Dec 2021 12:35:07 +0000 (14:35 +0200)]
Do not allow '*' character in namespace argument

Validate namespace argument in 'sdlcli get keys' -command.
The command gets an unexpected error when namespace argument
contains '*' asterisk character:

  sdlcli get keys '*' ...
  panic: runtime error: index out of range [1] with length 1

Issue-Id: RIC-113
Change-Id: Ie8b292c4c40801bf9fbfe65274f86485c7085865
Signed-off-by: Petri Ovaska <petri.ovaska@nokia.com>
2 years agoNew 'statistics' SDL CLI command 98/7398/3 e-release v0.9.0
Petri Ovaska [Thu, 25 Nov 2021 13:07:17 +0000 (15:07 +0200)]
New 'statistics' SDL CLI command

Display SDL resource usage statistics.

 Usage:
  sdlcli statistics [flags]

Update also the release-notes.
Version: 0.9.0

Issue-Id: RIC-113
Change-Id: I653d5325a8ff4a989f3cb7d9ab35c0fe9987392e
Signed-off-by: Petri Ovaska <petri.ovaska@nokia.com>
2 years agoFix sdlcli healthcheck DBAAS status in SEP install 52/7152/3
Timo Tietavainen [Sun, 28 Nov 2021 21:05:08 +0000 (23:05 +0200)]
Fix sdlcli healthcheck DBAAS status in SEP install

Implement reading of the new environment variable 'DBAAS_NODE_COUNT'
what defines how many DBAAS nodes there has been configured to be in
one SDL cluster group. For the time being in HA deployment value is 3
and in standalone deployment 1. With help of this variable sdlcli
'healthcheck' -command is able to show NOK status in case any configured
DBAAS pod is not present.
Refactor also output writing of the sdlcli 'healthcheck' -command to
show health status in a table layout.

Issue-Id: RIC-113

Signed-off-by: Timo Tietavainen <timo.tietavainen@nokia.com>
Change-Id: I1d677c6a78eda67e3bcfdf814654710b00dac270

2 years agoRename Master and Slave to Primary and Replica 51/7151/1
Timo Tietavainen [Sun, 28 Nov 2021 09:02:07 +0000 (11:02 +0200)]
Rename Master and Slave to Primary and Replica

Refactor SDL code not to use 'Master' and 'Slave' words in function
nor variable names due to their negative connotations.

Issue-Id: RIC-113

Signed-off-by: Timo Tietavainen <timo.tietavainen@nokia.com>
Change-Id: I3ecdcab4d8d36a6b8311fa34316d8ddbf71ae5a4

2 years agoSDL CLI 'remove' -command key search pattern 29/7129/2
Timo Tietavainen [Fri, 26 Nov 2021 01:51:31 +0000 (03:51 +0200)]
SDL CLI 'remove' -command key search pattern

Implement a key search pattern support for the sdlcli 'remove' -command.
With this command keys can be removed from SDL DB, removed keys can be
defined for the command either as key name or key search pattern
arguments. Command removes all the SDL DB keys by default, if key or key
search pattern argument is not given for the command.
Command syntax is:
  sdlcli remove <namespace> [<key|pattern>... <keyN|patternN>] [flags]

Issue-Id: RIC-113

Signed-off-by: Timo Tietavainen <timo.tietavainen@nokia.com>
Change-Id: I2cbe20a45aa21a15ee8a8b79abb7667b0307a93f

2 years agoSDL CLI 'get namespaces' -command key count 28/7128/2
Timo Tietavainen [Thu, 25 Nov 2021 22:57:59 +0000 (00:57 +0200)]
SDL CLI 'get namespaces' -command key count

Change existing -g,--group flag to -w,--wide flag. When the flag has
been set, command shows DB namespaces per SDL cluster group address
and how many DB keys there are per namespace.
New command syntax is:
    sdlcli get namespaces [flags]
Where supported flags are: -w, --wide, -h and --help.

Issue-Id: RIC-113

Signed-off-by: Timo Tietavainen <timo.tietavainen@nokia.com>
Change-Id: Iae0b044257a5e26e6cfaa48e2a5dca8441c23d5c

2 years agoShow help when no sdlcli arguments 27/7127/1
Timo Tietavainen [Thu, 25 Nov 2021 17:44:53 +0000 (19:44 +0200)]
Show help when no sdlcli arguments

Implement showing of the help text also when sdlcli tool is called
without any arguments.

Issue-Id: RIC-113

Signed-off-by: Timo Tietavainen <timo.tietavainen@nokia.com>
Change-Id: I6ebd9844fe09debeeb24946ba55ebfb2d7b807c3

2 years agoImplement SDL CLI 'get namespaces' -command 03/7103/2
Timo Tietavainen [Tue, 23 Nov 2021 06:32:04 +0000 (08:32 +0200)]
Implement SDL CLI 'get namespaces' -command

Implement a new 'get namespaces' -command for 'sdlcli' -tool. With this
command user can list all the namespaces found in database. Command
syntax is:
  sdlcli get namespaces [flags]
Supported flags are -g, --group, -h and --help flags. With -g,--group
flag user can get a list of namespace per SDL cluster group address and
-h, --help flags shows the command help.

Issue-Id: RIC-113

Signed-off-by: Timo Tietavainen <timo.tietavainen@nokia.com>
Change-Id: If4d66497eeec94d479748c81cf0898c2fbc78364

2 years agoSDL CLI 'get' reads keys data in the given namespace 76/7076/3
Petri Ovaska [Tue, 16 Nov 2021 06:36:13 +0000 (08:36 +0200)]
SDL CLI 'get' reads keys data in the given namespace

Implement SDL CLI 'get' command that reads keys data in the given
namespace. The 'get' reads one or multiple keys data:

 sdlcli get <namespace> <key> [<key2> <key3>... <keyN>]

Issue-Id: RIC-113
Change-Id: Ibe2cad1a986fa48bee4dba20eb4e886f62b09bf0
Signed-off-by: Petri Ovaska <petri.ovaska@nokia.com>
2 years agoImplement SDL CLI 'remove' -command 68/7068/3
Timo Tietavainen [Mon, 15 Nov 2021 19:33:15 +0000 (21:33 +0200)]
Implement SDL CLI 'remove' -command

Implement a new 'remove' -command for 'sdlcli' -tool. With this
command single or many keys under given namespace can be removed
from SDL DB. Command syntax is:
  sdlcli remove <namespace> <key> [<key2>... <keyN>] [flags]
For the time being only -h and --help flags are supported with the
'remove' -command.

Issue-Id: RIC-113

Signed-off-by: Timo Tietavainen <timo.tietavainen@nokia.com>
Change-Id: I4b68689ae9ec388372298f0445f714a5bdb23f3b

2 years agoImplement SDL CLI 'set' -command 35/7035/6
Timo Tietavainen [Thu, 11 Nov 2021 13:51:39 +0000 (15:51 +0200)]
Implement SDL CLI 'set' -command

Implement a new set -command to 'sdlcli' -tool. With this command one
string key-value pair can be set to SDL DB under given namespace.
Command syntax is:
  sdlcli set <namespace> <key> <value> [flags]
For the time being only -h and --help flags are supported with the
set -command.

Issue-Id: RIC-113

Signed-off-by: Timo Tietavainen <timo.tietavainen@nokia.com>
Change-Id: Ie124b93ded03600ed8eb3b7a31b407af0f60a18e

2 years agoHarmonize SDL CLI 'healthcheck' -command 65/7065/1
Timo Tietavainen [Mon, 15 Nov 2021 14:48:30 +0000 (16:48 +0200)]
Harmonize SDL CLI 'healthcheck' -command

Harmonize 'healthcheck' -command help and error log not to have
'SDL CLI error' prefix as there is no such a prefix in 'set' and 'get'
-commands either.
Add 'healthcheck' -command line arguments count check.

Issue-Id: RIC-113

Signed-off-by: Timo Tietavainen <timo.tietavainen@nokia.com>
Change-Id: I5e039edd9cdd3d70a9a13a1f116d7f0309618ef5

2 years agoImplement 'get' and 'get keys' -SDL CLI commands 17/7017/4
Petri Ovaska [Tue, 9 Nov 2021 06:28:48 +0000 (08:28 +0200)]
Implement 'get' and 'get keys' -SDL CLI commands

sdlcli get -command is used to display one or many resources.

 Usage:
   sdlcli get [command]

sdlcli get keys -subcommand is used to list keys in the given
namespace matching key search pattern.

 Usage:
   sdlcli get keys <namespace> [pattern|default '*'] [flags]

Issue-Id: RIC-113
Change-Id: I86b81ff8d8d2cdc0e959e285b19f93696ebe377e
Signed-off-by: Petri Ovaska <petri.ovaska@nokia.com>
2 years agoSentinel check to SDL CLI 'healthcheck' -command 06/7006/3
Timo Tietavainen [Sun, 7 Nov 2021 20:25:46 +0000 (22:25 +0200)]
Sentinel check to SDL CLI 'healthcheck' -command

In addition to the existing Redis master and slave healthiness
validation, add Redis sentinel healthiness validation to be done when
SDL CLI 'healthcheck' -command is ran. Validation is done by calling
Redis client's 'Sentinels' API call and parsing 'flags' field from its
output. In SDL CLI sentinel healthiness status is shown only if status
is not ok. This is done not to show too much information in CLI
interface for users.

Issue-Id: RIC-113

Signed-off-by: Timo Tietavainen <timo.tietavainen@nokia.com>
Change-Id: I8960ec9813e06aa88217c29bac56707b38052ae7

2 years agoImplement SDL CLI 'healthcheck' -command 58/6958/10
Timo Tietavainen [Tue, 26 Oct 2021 06:11:53 +0000 (09:11 +0300)]
Implement SDL CLI 'healthcheck' -command

Implement a new 'healthcheck' -command for SDL CLI to validate
healthiness of the SDL database. Under the hood 'healthcheck' -command
calls Redis client's 'Master' and 'Slaves' APIs and parses from the
responses master and slave Redis servers related fields to show the
overall healthiness of the SDL database backend.

Redis client's version was upgraded from v6.15.9 to v7 v7.4.1,
because old client didn't support 'Master' and 'Slaves' Redis
sentinel APIs. Also implement usage of Redis client's
'NewSentinelClient' client connection to read state information via
'Master' and 'Slaves' APIs. In case of standalone Redis server
deployment state information is read via Redis client's 'Info' API.

Issue-Id: RIC-113

Signed-off-by: Timo Tietavainen <timo.tietavainen@nokia.com>
Change-Id: I7d964ac5c3d10cc90075977e2b11da7a9c11949d

2 years agoDraft version of SDLCLI command line tool 87/6887/2
Timo Tietavainen [Tue, 19 Oct 2021 10:22:06 +0000 (13:22 +0300)]
Draft version of SDLCLI command line tool

Add SDLCLI source codes to build command line tool, which can be used
for troubleshooting SDL/DB. With this commit draft version of the tool
has been implemented, shows only help.

Issue-Id: RIC-113

Signed-off-by: Timo Tietavainen <timo.tietavainen@nokia.com>
Change-Id: Ied47ce68bcbc065c21c53fd2a326b91c32506204

2 years agoMerge "New ListKeys API in syncstorage"
Timo Tietavainen [Mon, 4 Oct 2021 10:41:41 +0000 (10:41 +0000)]
Merge "New ListKeys API in syncstorage"

2 years agoNew ListKeys API in syncstorage 65/6765/3 v0.8.0
Petri Ovaska [Wed, 22 Sep 2021 05:09:53 +0000 (08:09 +0300)]
New ListKeys API in syncstorage

The ListKeys API returns all keys in the given namespace matching
key search pattern.

Also update sdltester -tool to test ListKeys api:
  listkeys
    - List keys in the given namespace matching key search pattern.

Upgraded ci/Dockerfile golang image version tag to 1.16. This is
due to expired Root CA certificates in golang:1.12 image which
result an error when building docker image:
  fatal: unable to access 'https://gopkg.in/tomb.v1/': server
  certificate verification failed. CAfile: none CRLfile: none

Version: 0.8.0

Issue-Id: RIC-110
Signed-off-by: Petri Ovaska <petri.ovaska@nokia.com>
Change-Id: Ic02a3f127934a1e02e01a36c573d035db34dbd6f

2 years agoAdd Ovaska and Maki-aijala, remove Badorek and Tallskog 40/6740/2
Timo Tietavainen [Thu, 23 Sep 2021 08:45:15 +0000 (11:45 +0300)]
Add Ovaska and Maki-aijala, remove Badorek and Tallskog

Signed-off-by: Timo Tietavainen <timo.tietavainen@nokia.com>
Change-Id: Id416062bc78873f738b1b1bbf3c1e8e657610bb1

2 years agoAdd deprecation warnings for SdlInstance APIs 90/6690/3
Timo Tietavainen [Tue, 14 Sep 2021 12:10:03 +0000 (15:10 +0300)]
Add deprecation warnings for SdlInstance APIs

Add 'Deprecated:' warning texts to SdlInstance struct type and all
of its receiver API functions. SDL repository contains SyncStorage
struct type with its receiver API functions and it should be used
instead of SdlInstance. With this commit there is added deprecation
warnings and these warnings should be a heads up for SDL API users not
to use anymore  SdlInstance API. After some reasonable time has passed
SdlInstance will be removed completely from the SDL repository.

Issue-Id: RIC-805

Signed-off-by: Timo Tietavainen <timo.tietavainen@nokia.com>
Change-Id: I69d2e9fcfc42111c2e660cc451026c6d713cff70

2 years agoImplement sentinel based DB capacity scaling 62/6062/1 dawn v0.7.0
Timo Tietavainen [Tue, 11 May 2021 13:38:33 +0000 (16:38 +0300)]
Implement sentinel based DB capacity scaling

For time being SDL has supported standalone DBAAS DB and DBAAS HA DB deployment
with Redis sentinel. With this commit extent SDL functionality to support Redis
sentinel based DB cluster where we have multiple DBAAS Redis sentinel groups
and these groups can be used to spread out SDL DB write and read operations to
different DB instances.
Implement cluster DBAAS DB service addresses reading from environment variable
'DBAAS_CLUSTER_ADDR_LIST'.
Implement crc32 hash value calculation from namespace string and selection of
a DB instance from DB cluster based on calculated hash.

Issue-ID: RIC-699

Signed-off-by: Timo Tietavainen <timo.tietavainen@nokia.com>
Change-Id: I8999c3c03d2d80d32a57d8ec051632b975bf9dc2

2 years agoImplement SDL multi-namespace API 61/6061/2 v0.6.0
Timo Tietavainen [Tue, 11 May 2021 12:28:57 +0000 (15:28 +0300)]
Implement SDL multi-namespace API

Add 'SyncStorage' with its write and read APIs to support multi-namespace API
what has been implemented already in Python and C++ SDL APIs. In Multi-
namespace API, at SyncStorage' creation time, connection to database backend is
created but namespace is not defined. Namespace is given later as a parameter
to every SDL read and write API calls what makes it easy to write and read from
different namespaces in single SDL instance of type 'SyncStorage'.

This multi-namespace implementation is a prerequisite to have before sentinel
based DB capacity scaling feature RIC-699 can be implemented properly.

Issue-ID: RIC-699

Signed-off-by: Timo Tietavainen <timo.tietavainen@nokia.com>
Change-Id: I018dde1f016630d6b6e44e66a2f276a04e38505a

3 years agoTake DBAAS multi-channel publishing Redis modules into use 45/5745/1 v0.5.5
Timo Tietavainen [Tue, 9 Mar 2021 14:17:31 +0000 (16:17 +0200)]
Take DBAAS multi-channel publishing Redis modules into use

Following SDL APIs are defined so that multiple channel-event pairs can be
given as function argument but actual SDL implementation utilized such a DBAAS
(Redis) module what expect to get only one channel-event pair. Fix the
implementation of these SDL APIs to use the correct DBAAS module what support
multiple channel-event pairs:
* SetIfAndPublish()
* SetIfNotExistsAndPublish()
* RemoveIfAndPublish()

Please note that in runtime environment DBAAS service needs to run on DBAAS
image version 0.4.0 or newer. Older images do not have multiple channel-event
pairs support as a Redis module.

Fixed also potential type conversion issue in SDL APIs RemoveIf() and
RemoveIfAndPublish() what can lead to SDL application crash.

Issue-ID: RIC-759

Signed-off-by: Timo Tietavainen <timo.tietavainen@nokia.com>
Change-Id: I74f483bb31e0c6aed10983a83d70a45272d71fa4

3 years agoFix Go routine race condition in DB notification map 15/4815/3 cherry v0.5.4
Timo Tietavainen [Wed, 7 Oct 2020 04:07:24 +0000 (07:07 +0300)]
Fix Go routine race condition in DB notification map

Map cbMap was accessible by the main Go routine and also by a Go routine, which
handled incoming notifications from database (Redis). Problem was visible, when
unit tests were run with '-race' flag. Fix the issue by adding a mutex lock to
guard cbMap accesses. Go routine what handles incoming notification has a local
lockless copy of the cbMap to make sure that notification handling speed won't
be suffering from mutex locks. Local copy of cbMap is updated whenever the
cbMap has been updated.

Signed-off-by: Timo Tietavainen <timo.tietavainen@nokia.com>
Change-Id: I066ff1d71340db2240a7ea6aeeb575f098488608

3 years agoTake Redis client version 6.15.9 into use 53/4553/2 v0.5.3
Timo Tietavainen [Mon, 17 Aug 2020 11:48:06 +0000 (14:48 +0300)]
Take Redis client version 6.15.9 into use

Take newer Redis client version 6.15.9 into use from:
https://github.com/go-redis/redis

Reasoning was to get bug fixes, especially fix for this one:
https://github.com/go-redis/redis/issues/1149

Updated also go.sum file after running 'go mod tidy' command.

Signed-off-by: Timo Tietavainen <timo.tietavainen@nokia.com>
Change-Id: I694282e669a9ae70040e9d95ea0c19d8c94bceea

3 years agoRephrase release notes introduction 38/4138/1 bronze
Timo Tietavainen [Tue, 16 Jun 2020 17:01:18 +0000 (20:01 +0300)]
Rephrase release notes introduction

Remove release name from introduction section to make it
unaltered for release changes.

Signed-off-by: Timo Tietavainen <timo.tietavainen@nokia.com>
Change-Id: If5dcb2c18b8568b670bd1198c72e1753b350bb70

4 years agoAdd extra line about src files are part of RIC platform project 31/1831/1 Amber v0.5.2
Timo Tietavainen [Thu, 28 Nov 2019 07:58:48 +0000 (09:58 +0200)]
Add extra line about src files are part of RIC platform project

Signed-off-by: Timo Tietavainen <timo.tietavainen@nokia.com>
Change-Id: Id38667ce1a1f109db284802d50baf28f1780bc58

4 years agoMerge "Add documentation files"
Timo Tietavainen [Wed, 13 Nov 2019 10:18:10 +0000 (10:18 +0000)]
Merge "Add documentation files"

4 years agoAdd documentation files 42/1542/1
Timo Tietavainen [Wed, 13 Nov 2019 06:01:10 +0000 (08:01 +0200)]
Add documentation files

Added mandatory documentation files for the RIC Amber release.

Change-Id: Ib61949c1dc6b7302de7adb907158caf1ca905dea
Signed-off-by: Timo Tietavainen <timo.tietavainen@nokia.com>
4 years agoAutomation adds INFO.yaml 42/1442/2
Aric Gardner [Fri, 8 Nov 2019 16:02:22 +0000 (16:02 +0000)]
Automation adds INFO.yaml

Change-Id: I9134d022dce524eac8b49afb5bc740fd7957cdae
Signed-off-by: Aric Gardner <agardner@linuxfoundation.org>
4 years agoAdd support for CI jobs 16/1316/1 v0.5.1
Marco Tallskog [Fri, 1 Nov 2019 14:23:12 +0000 (16:23 +0200)]
Add support for CI jobs

Ad ci directory containing a Dockerfile where unit tests shall be
executed.

Change-Id: Ica50888d24b7cdd4326a632a408619ed17be08c0
Signed-off-by: Marco Tallskog <marco.tallskog@nokia.com>
4 years agoMake DB instance visible 39/1139/5 v0.5.0
Marco Tallskog [Fri, 11 Oct 2019 10:24:04 +0000 (13:24 +0300)]
Make DB instance visible

Make underlying DB instance visible to clients. This change makes it
easier for the clients to e.g. share the same DB instance between
multiple SDL instances (multiple namespaces is used). The DB instance
can be created once and reuse it every time a new SDL instance is
created. The DB instance is created with Newdatabase() method.

Update the documentation so that it is mentioned that subscribing the
channels is not safe for concurrent usage.

Change-Id: I1b09500eda44b6b095a3bf564c38e794d02f9d95
Signed-off-by: Marco Tallskog <marco.tallskog@nokia.com>
4 years agoSupport redis sentinel configuration 18/1018/1 v0.4.0
Marco Tallskog [Thu, 26 Sep 2019 12:51:29 +0000 (15:51 +0300)]
Support redis sentinel configuration

Based on environment variables set, sdl will select either to connect to
standalone redis or sentinel redis. The underlying redis-go
implementation takes care of how connection to master is handled and
what happens if there is a switcover in redis.

Change-Id: Ib413b61e6a7e26e8ad2bd7f83331554271a93c69
Signed-off-by: Marco Tallskog <marco.tallskog@nokia.com>
4 years agoSet MaxRetries count 35/935/2 v0.3.1
Marco Tallskog [Wed, 11 Sep 2019 09:53:04 +0000 (12:53 +0300)]
Set MaxRetries count

When redis client is created, set the MaxRetries count to 2. This
defines the number of times the command is tried to execute. In cases
where redis server is dead but the client hasn't noticed that yet, an
EOF error is returned from the first try. With the second attempt, a
proper error is returned indicating that the connection was refused.

Change-Id: I28ffcf83666edda9b715dafe6055cef4c633f757
Signed-off-by: Marco Tallskog <marco.tallskog@nokia.com>
4 years agoAdd resource locking 06/706/1 v0.3.0
Marco Tallskog [Wed, 14 Aug 2019 11:50:23 +0000 (14:50 +0300)]
Add resource locking

Implement methods that enable applications to create locks for
a resources. Resource locks are plain keys with a random value
with an expiration time. Only the holder of a lock can release it either
by removing the lock or by letting it expire (after it will be
automatically removed). By using a random value (that only lock holder
knows), it can be ensured that others can't remove it. Resource locks
are per namespace.

Implemented methods are:
LockResource: this method will check if the lock already exists and if
not, it will create it with an expiration time. It is possible for the
client to define with options how many times the lock will be tried and
the interval how often it is tried. If retry is used, this method will
block.
ReleaseResource: remove the lock. If removing is tried after the
expiration, an error will be returned.
RefreshResource: with this method, it is possible to set a new
expiration time for the lock. If the lock has already expired, an error
will be returned.
CheckResource: application can query the remaining expiration time with
this method, regardless it is the owner of the lock or not.

Change-Id: Ic6f5274c1740c7e36ddaba564024cffcc4c5de3d
Signed-off-by: Marco Tallskog <marco.tallskog@nokia.com>
4 years agoSupport multiple event publishing 57/457/4 v0.2.1
Marco Tallskog [Wed, 3 Jul 2019 07:25:20 +0000 (10:25 +0300)]
Support multiple event publishing

Support for publishing multiple events at once.
Originally it was possible to give multiple channels and
events as parameter to SetAndPublish() and RemoveAndPublish() API
functions. However, only the first event was published as
used Redis didn't support multiple event publishing. This
commit takes new Redis commands into use enabling the
support for multiple event publishing.

Add unit tests for internal sdlgoredis package. To be able
to stub external redisgo module, the Create() function is
splitted so that in unit tests it is possible to provide
a stub interface instead of the real one when building
the redisgo instance. Also Subscribe() function is wrapped,
and wrapper function is provided during setup as calling
the Subscribe() for the first time in code execution,
a new interface is provided that needs to be able to mock
in unit tests.

Improve documentation. Add doc.go which provides a better
documentation how to use SDL.

Change-Id: Id072d9397fa92ea37bcc78df7db54edadf4d9e7c
Signed-off-by: Marco Tallskog <marco.tallskog@nokia.com>
4 years agoAdd support for SDL groups 94/194/3 v0.2.0
Marco Tallskog [Fri, 24 May 2019 13:17:02 +0000 (16:17 +0300)]
Add support for SDL groups

SDL group is an unordered collection of members where each member is
unique.

Add the following methods to do operations with groups:
-AddMember: adds number of members into a given group. It is possible to
give already existing members to be added but that doesn't have an
effect to group.
-RemoveMember: Remove number of members from a group. It is possible to
try to remove non-existing members from a group without an error.
-RemoveGroup: Remove the whole group along with its members.
-GetMembers: Get all members from a group.
-IsMember: Check if a specific member is part of the group.
-GroupSize: Return the number of members in group.

Change-Id: I9005ffe584aa0872c5a3fab170d0ac37d9b9f30a
Signed-off-by: Marco Tallskog <marco.tallskog@nokia.com>
4 years agoAllow byte array/slice be given as value 71/171/3 v0.1.1
Marco Tallskog [Fri, 17 May 2019 10:05:00 +0000 (13:05 +0300)]
Allow byte array/slice be given as value

An error was given if byte slice or array was given as a value, now they
are allowed. However, other types or slices are not allowed as value.

Change-Id: Ia0c4515498a1b0e03a002a7d4357adb6d262213a
Signed-off-by: Marco Tallskog <marco.tallskog@nokia.com>
4 years agoAdd support for notifications 49/149/5 v0.1.0
Marco Tallskog [Tue, 14 May 2019 12:09:19 +0000 (15:09 +0300)]
Add support for notifications

Add new API function to subscribe/unsubscribe  notifications
from a channel. With SubscribeChannel function it is possible to
subscribe one or many channels and attach a callback function taht will
be called when the notification (event) is received from a channel. It
is possible to have separate callback functions to different channels
but then subscription must be done separately. With UnsubscribeChannel
one can unsubscribe one or many subsribed channels.

Each function, that modifies database (sets or removes) will have
another API function that will cause an event to be sent to given
channel. E.g. the following two functions:

Set(pairs ...interface{})
SetAndPublish(channelsAndEvents []string, pairs ...interface{})

The first function just sets a value to key, whereas the second function
does the same thing and also sends an event to channel. The channels and
events are given as pairs in channelsAndEvents slice e.g.
[]string{"channel", "event"}
Although it is possible to give several channel event pairs, only
sending an event to one channel is supported at the moment due to
missing support in Redis DB.

Change-Id: I4fc96cd4c8a59410700f670ad5588fe71509fd03
Signed-off-by: Marco Tallskog <marco.tallskog@nokia.com>
5 years agoFix Close API call 05/105/1 v0.0.2
Marco Tallskog [Fri, 3 May 2019 08:45:22 +0000 (11:45 +0300)]
Fix Close API call

Calling Close function from API caused a recursive call to itself as the
underlying module was using a function with same name. Rename the
internal close function to avoid this.

Change-Id: I05c3ca8e79fb5f30cae81917f56efacbd1797768
Signed-off-by: Marco Tallskog <marco.tallskog@nokia.com>
5 years agoInitial commit 55/55/2 v0.0.1
Marco Tallskog [Wed, 17 Apr 2019 10:19:22 +0000 (13:19 +0300)]
Initial commit

Change-Id: Iaf5456d3f1b8b59a727d7df46fe556fe00ac4c0e
Signed-off-by: Marco Tallskog <marco.tallskog@nokia.com>
5 years agoInitial empty repository
Andrew Grimberg [Mon, 8 Apr 2019 19:44:49 +0000 (19:44 +0000)]
Initial empty repository