osm/POL.git
5 years agoAdds migration engine for peewee ORM 44/7244/5
Benjamin Diaz [Tue, 5 Feb 2019 20:44:42 +0000 (17:44 -0300)]
Adds migration engine for peewee ORM

bug 590

Change-Id: If6752715d455cbeb3dc2633e9b62f79360fef767
Signed-off-by: Benjamin Diaz <bdiaz@whitestack.com>
5 years agoReplaces direct use of aiokafka with osm_common message bus in agent and 76/7176/4
Benjamin Diaz [Fri, 1 Feb 2019 16:31:47 +0000 (13:31 -0300)]
Replaces direct use of aiokafka with osm_common message bus in agent and
lcmclient

Changes config handling to comply with the way it is handled in other modules,
by using a config file and overriding it with env vars.

Adds unit tests for message_bus_client.

Mon client remains using aiokafka directly, as there is no support yet for
auto_offset_reset configuration in osm_common.

Change-Id: I99615287cc934ce310105e86544a6bfe26bc0673
Signed-off-by: Benjamin Diaz <bdiaz@whitestack.com>
5 years agoExits process when encountered by a database exception 69/7169/1
Benjamin Diaz [Fri, 25 Jan 2019 17:30:20 +0000 (14:30 -0300)]
Exits process when encountered by a database exception

Database errors could mean database node failure. In this cases, the process
should exit so it could be automatically restarted (when handled by Docker Swarm, K8s, etc)
so it can obtain a new DB connection to an alive node.

Change-Id: I42a3954fe238a0445101eb71add79aaef4315c2e
Signed-off-by: Benjamin Diaz <bdiaz@whitestack.com>
5 years agoRemoves try except block from creation of database tables 68/7168/1
Benjamin Diaz [Thu, 3 Jan 2019 02:13:32 +0000 (23:13 -0300)]
Removes try except block from creation of database tables

In case there is an error connecting to the database engine, or the database
is not yet created, POL should fail. This is specially relevant to avoid race
conditions in Docker and K8s deployments using MySQL/MariaDB, because peewee
needs the database to already exist.

Change-Id: Iabe46c1c4f718919e10fc65271d0e814c5f9a146
Signed-off-by: Benjamin Diaz <bdiaz@whitestack.com>
5 years agoAdds pymysql to requirements.txt 67/7167/1
Benjamin Diaz [Thu, 27 Dec 2018 21:25:43 +0000 (18:25 -0300)]
Adds pymysql to requirements.txt

Allows using a mysql database as peewee backend

Change-Id: If0c408d57f9d20d36a04e5cf8421a0a9f9c1d0b9
Signed-off-by: Benjamin Diaz <bdiaz@whitestack.com>
5 years agoAdds deletion of orphaned alarms after an scalein operation 81/6981/1 v5.0 v5.0.0 v5.0.1 v5.0.2 v5.0.3 v5.0.4 v5.0.5
Benjamin Diaz [Tue, 27 Nov 2018 20:40:30 +0000 (17:40 -0300)]
Adds deletion of orphaned alarms after an scalein operation

Change-Id: Ic461abb88d5514367c284ae79b4ed8914bc0281e
Signed-off-by: Benjamin Diaz <bdiaz@whitestack.com>
5 years agoMerge "Adds use of alarm response topics based on cor_id"
lavado [Tue, 27 Nov 2018 14:00:26 +0000 (15:00 +0100)]
Merge "Adds use of alarm response topics based on cor_id"

5 years agoMerge "added env vars for mongo ha"
lavado [Tue, 27 Nov 2018 14:00:13 +0000 (15:00 +0100)]
Merge "added env vars for mongo ha"

5 years agoAdds use of alarm response topics based on cor_id 67/6967/1
Benjamin Diaz [Mon, 26 Nov 2018 21:05:53 +0000 (18:05 -0300)]
Adds use of alarm response topics based on cor_id

Change-Id: I6cde487c95c55e6b9b0e021d058d95fcec8881ba
Signed-off-by: Benjamin Diaz <bdiaz@whitestack.com>
5 years agoAdds support for autoscaling based on vnf-metric 56/6956/2
Benjamin Diaz [Fri, 23 Nov 2018 18:34:24 +0000 (15:34 -0300)]
Adds support for autoscaling based on vnf-metric

Change-Id: I179395ce1390f9031b15d141ff3b37839943368e
Signed-off-by: Benjamin Diaz <bdiaz@whitestack.com>
6 years agoAdds deletion of scaling alarms in POL and MON after ns termination 44/6944/4
Benjamin Diaz [Wed, 21 Nov 2018 21:53:18 +0000 (18:53 -0300)]
Adds deletion of scaling alarms in POL and MON after ns termination

Signed-off-by: Benjamin Diaz <bdiaz@whitestack.com>
Change-Id: Iefe8de25061cfffa0220671a8072c2bc155332eb

6 years agoadded env vars for mongo ha 37/6937/2
Juan [Wed, 21 Nov 2018 15:21:34 +0000 (12:21 -0300)]
added env vars for mongo ha

Change-Id: Ied541f300e819eacbc31426089eb7ca547b59f34
Signed-off-by: Juan <jquiroga@whitestack.com>
6 years agoRefactor scaling group config and adds partial support for vnf metrics 09/6909/2
Benjamin Diaz [Fri, 16 Nov 2018 22:46:50 +0000 (19:46 -0300)]
Refactor scaling group config and adds partial support for vnf metrics

Adds support for scaling groups based on vdu-metric corresponding to a juju
metric. It also includes modifications to support MON modifications regarding
vnf-monitoring-params.

Signed-off-by: Benjamin Diaz <bdiaz@whitestack.com>
Change-Id: I1a1604f965c077fa14a19ad7a26da0facc4818ba

6 years agoFixes discrepancies with IM related to monitoring params 03/6803/3
Benjamin Diaz [Wed, 31 Oct 2018 03:58:22 +0000 (20:58 -0700)]
Fixes discrepancies with IM related to monitoring params

Signed-off-by: Benjamin Diaz <bdiaz@whitestack.com>
Change-Id: Ie57107550b229292fad7ecb9ed154dd51bf5985e

6 years agoRenames DbClient to CommonDbClient to avoid confusion 53/6653/8
Benjamin Diaz [Mon, 8 Oct 2018 19:26:32 +0000 (16:26 -0300)]
Renames DbClient to CommonDbClient to avoid confusion

POL comunicates with two different databases, a relational
one, that stores records for alarms, scaling groups and more,
and a nonrelational one, that is common to all OSM modules,
which we call CommonDB, that currently corrsponds to a MongoDB
instance and stores nsds, vnfds, etc.
The name db_client and DbClient used in the file and
class that comunicates with CommonDB may be open to confussion,
so it has been renamed as common_db_client and CommonDbClient.

Signed-off-by: Benjamin Diaz <bdiaz@whitestack.com>
Change-Id: I8209cbc23b5ab129221d1c928703929e4f405a4c

6 years agoImplements aiokafka and modifies code to support asyncio 89/6689/11
Benjamin Diaz [Thu, 11 Oct 2018 15:34:20 +0000 (12:34 -0300)]
Implements aiokafka and modifies code to support asyncio

Replaces multithreading with asyncronous calls to kafka.
Implements the async/await keywords in methods that needed
it.

Signed-off-by: Benjamin Diaz <bdiaz@whitestack.com>
Change-Id: Ic93054dc9a6b3835e2eaf1a480e5081c5eb9d4f5

6 years agoAdds use of OSMPOL_SQL_DATABASE_URI config param to connect to DB 54/6654/4
Benjamin Diaz [Mon, 8 Oct 2018 19:34:17 +0000 (16:34 -0300)]
Adds use of OSMPOL_SQL_DATABASE_URI config param to connect to DB

The OSMPOL_SQL_DATABASE_URI was not being used by POL to connect
to the database. There was a hardcoded sqlite database name.
This change should now provide capability to the user to use any
SQL database engine supported by the peewee ORM (mysql/mariadb,
postgres, sqlite).

Signed-off-by: Benjamin Diaz <bdiaz@whitestack.com>
Change-Id: Iff406862fb3dfeb4453fb3213c94db6d62385d96

6 years agoAdds deletion of alarms in case exception is thrown during scaling config 52/6652/4
Benjamin Diaz [Mon, 8 Oct 2018 19:25:36 +0000 (16:25 -0300)]
Adds deletion of alarms in case exception is thrown during scaling config

If a exception is thrown during the configuration of a scaling group, POL
will check if there have been alarms created through MON, and if that is
the case, it will delete them.
Also, it adds validation of the MON alarm responses. It throws an exception
if MON returns status: False, meaning there was an error creating the alarm.

Signed-off-by: Benjamin Diaz <bdiaz@whitestack.com>
Change-Id: I4f5f0c95ae2cce0c71efb73ff2e06cdf8ea08864

6 years agoMerge "Added LICENSE file to root folder" netslice
lavado [Sat, 13 Oct 2018 12:08:08 +0000 (14:08 +0200)]
Merge "Added LICENSE file to root folder"

6 years agoAdds vnf_member_index attribute to ScalingGroup model 74/6674/1
Benjamin Diaz [Wed, 10 Oct 2018 13:53:49 +0000 (10:53 -0300)]
Adds vnf_member_index attribute to ScalingGroup model

Changes default last_scale attribute in ScalingPolicy
to datetime.datetime.now.
Adds some debug logs.

Signed-off-by: Benjamin Diaz <bdiaz@whitestack.com>
6 years agoAdds unique group_id to KafkaConsumer used in MonClient 71/6671/1
Benjamin Diaz [Tue, 9 Oct 2018 23:07:43 +0000 (20:07 -0300)]
Adds unique group_id to KafkaConsumer used in MonClient

Signed-off-by: Benjamin Diaz <bdiaz@whitestack.com>
6 years agoModifies version_command to use pep440-git-full 66/6666/3
Benjamin Diaz [Tue, 9 Oct 2018 18:56:22 +0000 (15:56 -0300)]
Modifies version_command to use pep440-git-full

Signed-off-by: Benjamin Diaz <bdiaz@whitestack.com>
6 years agoAdds support for cooldown-time variable in scaling-policy 65/6665/3
Benjamin Diaz [Tue, 9 Oct 2018 18:04:24 +0000 (15:04 -0300)]
Adds support for cooldown-time variable in scaling-policy

Cooldown time defines the minimum time that needs to happen between
each scaling action. If an alarm triggers before this has happened,
no action should be executed. When POL receives an alarm notification
it will check that the difference between the current time and the
last scaling action of the alarm's scaling policy is bigger than the
cooldown time.
During configuration of the scaling groups, POL will now store the
cooldown time of the scaling policy. Also, it adds a new last_scale
var to ScalingPolicy, which has as default the oldest time supported
by Python datetime.

Signed-off-by: Benjamin Diaz <bdiaz@whitestack.com>
Change-Id: I6d110ccc7f89af29500c602d05054e7ba78808a0

6 years agoFixes StopIteration error in multi scaling group descriptor scenarios 59/6659/8
Benjamin Diaz [Mon, 8 Oct 2018 22:38:49 +0000 (19:38 -0300)]
Fixes StopIteration error in multi scaling group descriptor scenarios

The code was iterating over all vdus in a vnfd, instead of doing
so over the vdu refs inside the scaling-group. This lead to errors
when there was a vdu without the metric declared in the criteria.
It has been replaced to iterate over the vdus in the scaling group
descriptor, which is the correct behaviour.
This commit also fixes an error in the scale function, which was
still using the old db structure.

Signed-off-by: Benjamin Diaz <bdiaz@whitestack.com>
Change-Id: I8b8450534f739e6afecc2602086c868ffaee79bc

6 years agoRemoves filter param from osm-common function calls 62/6662/1
Benjamin Diaz [Tue, 9 Oct 2018 14:44:53 +0000 (11:44 -0300)]
Removes filter param from osm-common function calls

The filter argument was replaced to q_filter. Instead of
renaming the keyword arg, now functions are called using
only positional args.

Signed-off-by: Benjamin Diaz <bdiaz@whitestack.com>
6 years agoAdds handling of scaled life cycle operation 20/6620/2
Benjamin Diaz [Wed, 3 Oct 2018 18:52:47 +0000 (15:52 -0300)]
Adds handling of scaled life cycle operation

Configures alarms on vdus created after a scaling operation, which
correspond to the 'scaled' message, using the same handler used with
the 'instantiated' message, in which a check has been added to avoid
duplicate alarms.
It also fixes the vdu name used when creating the alarm through MON,
which is now the vdur name and not the vdu-id-ref used in the vnfd.
Finally, it adds a check for the scaling-type param in the scaling policy,
only executing the autoscaling logic if it is set to 'automatic'.

Signed-off-by: Benjamin Diaz <bdiaz@whitestack.com>
Change-Id: I3499ebdb5605f80ff73d905fbe3ac61d0d806687

6 years agoRefactor common_db client code 19/6619/2
Benjamin Diaz [Wed, 3 Oct 2018 17:36:49 +0000 (14:36 -0300)]
Refactor common_db client code

Creates DbClient which exposes methods to interact with the common
database, using osm_common module.

Signed-off-by: Benjamin Diaz <bdiaz@whitestack.com>
Change-Id: Ib81bb44e5f2c6ffd289380936b089af2f9e76e63

6 years agoAdds pip installation of python deps in deb package install 41/6541/25
Benjamin Diaz [Wed, 26 Sep 2018 23:12:58 +0000 (20:12 -0300)]
Adds pip installation of python deps in deb package install

Adds postinst script
Adds Makefile (there is an issue when using postinst with tox)
Adds stdeb.cfg declaring binary dependencies
Reenables flake8 in tox
Removes consumer timeout that should have never been there
Readds group_id in kafka consumer

Signed-off-by: Benjamin Diaz <bdiaz@whitestack.com>
Change-Id: Ied0cb6135aee5f08cfd36c9cbaafa4c174b7434f

6 years agoAdded LICENSE file to root folder 69/6569/1
garciadeblas [Thu, 27 Sep 2018 08:29:33 +0000 (10:29 +0200)]
Added LICENSE file to root folder

Change-Id: I411ad72697d614558e9bed2b20e750b1725c6e2e
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
6 years agoFixup name of MON -> POL 32/6532/1
Mike Marchetti [Thu, 20 Sep 2018 18:51:45 +0000 (14:51 -0400)]
Fixup name of MON -> POL

Signed-off-by: Mike Marchetti <mmarchetti@sandvine.com>
6 years agoFixes dependency error in setup.py 30/6530/1
Benjamin Diaz [Thu, 20 Sep 2018 17:12:52 +0000 (14:12 -0300)]
Fixes dependency error in setup.py

Signed-off-by: Benjamin Diaz <bdiaz@whitestack.com>
6 years agoMigrates POL code from MON repo 87/6487/2 v4.0.1
Benjamin Diaz [Fri, 14 Sep 2018 15:03:38 +0000 (12:03 -0300)]
Migrates POL code from MON repo

Adds support for VDU metric autoscaling
Modifies env var names

Signed-off-by: Benjamin Diaz <bdiaz@whitestack.com>
Change-Id: If9587e1b8eacaf6fb297306050a97d33c8a63ead

6 years agoInitial empty repository
garciadeblas [Fri, 31 Aug 2018 10:53:37 +0000 (12:53 +0200)]
Initial empty repository