This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

Introduction

This is the code repository for FIWARE Policy Manager GE - Cloto, a server that provides a REST API to create rules associated to servers, subscribe servers to Context Broker to get information about resources consumption of those servers and launch actions described in rules when conditions are met.

This project is part of FIWARE. Check also the FIWARE Catalogue entry for Policy Manager

Any feedback on this documentation is highly welcome, including bugs, typos or things you think should be included but aren’t. You can use github issues to provide feedback.

Top.

GEi overall description

Bosun GEri is the reference implementation of Policy Manager GE.

Bosun offers decision-making ability, independently of the type of resource (physical/virtual resources, network, service, etc.) being able to solve complex problems within the Cloud field by reasoning about the knowledge base, represented by facts and rules. Bosun GEri provides the basic management of cloud resources based on rules, as well as management of the corresponding resources within FIWARE Cloud instances based on infrastructure physical monitoring, resources and services security monitoring or whatever that could be defined by facts, actions and rules.

The baseline for the Bosun GEri is PyCLIPS, which is a module to interact with CLIPS expert system implemented in Python language. The reason to take PyCLIPS is to extend the OpenStack ecosystem with an expert system, written in the same language as the rest of the OpenStack services. Besides, It provides notification service to your own HTTP server where you can define your own actions based on the notifications launched by Policy Manager. Last but not least, Bosun is integrated with the Monitoring GEri in order to recover the information of the (virtual) system and calculate any possible change on it based on the knowledge database defined for it.

Top.

Components

Fiware-Cloto
Fiware-Cloto is part of FIWARE Policy Manager. It provides a REST API to create rules associated to servers, subscribe servers to Context Broker to get information about resources consumption of that servers and launch actions described in rules when conditions are met.
Fiware-Facts
Server to process the incoming facts from Orion Context Broker and publish the result into a RabbitMQ queue to be analysed by Fiware-Cloto. The facts are the result of the server resources consumption.

For more information, please refer to the documentation.

Top.

Build and Install

Requirements

Operating systems:

  • CentOS (RedHat) and Ubuntu (Debian), being CentOS 7 the reference operating system.

Software dependencies:

This module also needs the installation of these other components:

Top.

Pre-Installation

You must create a database named cloto in your MySQL server before installing this component.

In addition, be sure you have installed MySQL development libraries and tools (using package managers such as yum or apt-get):

centos$ sudo yum install mysql-devel
ubuntu$ sudo apt-get install mysql-client libmysqlclient-dev

Top.

Configuration file

The configuration used by this component is read from the file located at /etc/fiware.d/fiware-cloto.cfg, unless otherwise specified by environment variable CLOTO_SETTINGS_FILE.

MySQL settings of this configuration must be adjusted before starting the fiware-facts component (for instance, user and password are empty by default): please check section [mysql].

A sample configuration file may include the following (see default here):

[openstack]
# OPENSTACK information about KEYSTONE to validate tokens received
OPENSTACK_URL: http://cloud.lab.fi-ware.org:4731/v2.0
ADM_USER:
ADM_PASS:
ADM_TENANT_ID:
ADM_TENANT_NAME:
USER_DOMAIN_NAME: Default
AUTH_API: v2.0

[policy_manager]
SECURITY_LEVEL: LOW
SETTINGS_TYPE: production
DEFAULT_WINDOW_SIZE: 5
MAX_WINDOW_SIZE: 10
LOGGING_PATH: /var/log/fiware-cloto

[context_broker]
CONTEXT_BROKER_URL: http://130.206.115.92:1026/v1
# Public IP of fiware-facts module
NOTIFICATION_URL: http://127.0.0.1:5000/v1.0
NOTIFICATION_TYPE: ONTIMEINTERVAL
NOTIFICATION_TIME: PT5S

[rabbitmq]
# URL Where RabbitMQ is listening (no port needed, it uses default port)
RABBITMQ_URL: localhost

[mysql]
DB_CHARSET: utf8
DB_HOST: localhost
DB_NAME: cloto
DB_USER:
DB_PASSWD:

[django]
DEBUG: False
DATABASE_ENGINE: django.db.backends.mysql
ALLOWED_HOSTS: ['127.0.0.1', 'localhost']
### Must be a unique generated value. keep that key safe.
SECRET_KEY: TestingKey+faeogfjksrjgpjaspigjiopsjgvopjsopgvj

[logging]
level: INFO

Top.

Installation

Once pre-installation requirements are satisfied, please install fiware-cloto package from PyPI repository:

$ sudo pip install fiware-cloto

Running

To run fiware-cloto, just execute:

$ gunicorn fiware_cloto.cloto.wsgi -b BIND_ADDRESS

To stop fiware-cloto, you can stop gunicorn server, or kill it

NOTE: to enable writing gunicorn log messages to console, please add the option --log-file=-; otherwise, if you prefer to write them into a file, just add --log-file=<log file name>. By default, logs will be written in the folder /var/log/fiware-cloto/: please ensure its permissions and owner are valid.

Running with supervisor

Optionally you can add a new layer to manage gunicorn process with a supervisor. Just install supervisor on your system:

centos$ sudo yum install supervisor
ubuntu$ sudo apt-get install supervisor

Copy the file utils/cloto_start to /etc/fiware.d and ensure it has execution permissions:

$ sudo chmod a+x /etc/fiware.d/cloto_start

Then copy the file utils/fiware-cloto.conf to /etc/supervisor/conf.d and start fiware-cloto using supervisor:

$ sudo supervisorctl reread
$ sudo supervisorctl update
$ sudo supervisorctl start fiware-cloto

To stop fiware-cloto just execute:

$ sudo supervisorctl stop fiware-cloto

NOTE: Supervisor provides an “event listener” to subscribe to the so-called “event notifications”. The purpose of the event notification/subscription system is to provide a mechanism for arbitrary code to be run (e.g. send an email, make an HTTP request, etc) when some condition is satisfied. That condition usually has to do with subprocess state. For instance, you may want to notify someone via email when a process crashes and is restarted by Supervisor. For more information check also the Supervisor Documentation.

Top.

API Overview

To create a new rule for a server, user should send the rule as body of a POST request to the Cloto server, with the condition and action that should be performed.

For example, this operation allows to create a specific rule associate to a server:

$ curl -v -H 'X-Auth-Token: 86e096cd4de5490296fd647e21b7f0b4' -X POST
http://130.206.81.71:8000/v1.0/6571e3422ad84f7d828ce2f30373b3d4/servers
/32c23ac4-230d-42b6-81f2-db9bd7e5b790/rules/
-d '{"action": {"actionName": "notify-scale", "operation": "scaleUp"},
"name": "ScaleUpRule", "condition": { "cpu": { "value": 98, "operand": "greater" },
"mem": { "value": 95, "operand": "greater equal"}}}'

The result of this operation is a JSON with the Id of the server affected and the ruleId of the created rule:

{
    "serverId": "32c23ac4-230d-42b6-81f2-db9bd7e5b790",
    "ruleId": "68edb416-bfc6-11e3-a8b9-fa163e202949"
}

Then user could perform a subscription to that rule with a new operation.

Please have a look at the API Reference Documentation section below and at the user and programmer guide for more description of the possibilities and operations.

Note: Please keep in mind that the server (whose serverId in the previous example is 32c23ac4-230d-42b6-81f2-db9bd7e5b790 and tenantID is 6571e3422ad84f7d828ce2f30373b3d4) has to be created in FIWARE Lab. Policy Manager does not take care about this instance creation.

Top.

Testing

Unit tests

Download source code from github

$ git clone https://github.com/telefonicaid/fiware-cloto.git

To execute the unit tests, you must set the environment variable pointing to the settings_test file. Then you can use coverage to execute the tests and obtain the percentage of lines coveved by the tests. You must execute the tests from project folder fiware-cloto. Once you were inside the right location, execute the required commands:

$ export DJANGO_SETTINGS_MODULE=fiware_cloto.cloto_settings.settings_tests
$ export CLOTO_SETTINGS_FILE=$PWD/fiware_cloto/cloto_settings/fiware-cloto.cfg
$ python fiware_cloto/manage.py test

Top.

End-to-end tests

There are two ways to check that fiware-cloto is up and running:

The first one does not need authentication and you will get the server details:

$ curl -v -H 'X-Auth-Token: $AUTH_TOKEN' http://$HOST:8000/v1.0/$TENANT_ID/

Response should be similar to:

{
    "owner": "Telefonica I+D",
    "doc": "http://docs.policymanager.apiary.io",
    "runningfrom": "16/02/03 16:16:27",
    "version": "2.3.0"
}

The second one need authentication. You can execute a GET request similar to:

$ curl -v -H 'X-Auth-Token: $AUTH_TOKEN' http://$HOST:8000/v1.0/$TENANT_ID/

Where:

  • $AUTH_TOKEN: is a valid token owned by the user. You can request this token from keystone.
  • $HOST: is the url/IP of the machine where fiware facts is installed, for example: (policymanager-host.org, 127.0.0.1, etc)
  • $TENANT_ID: is a tenantId of the user, for example: 6571e3422ad84f7d828ce2f30373b3d4

The response should be similar to:

{
    "owner": "Telefonica I+D",
    "doc": "http://docs.policymanager.apiary.io",
    "runningfrom": "16/02/03 16:16:27",
    "version": "2.3.0"
    "windowsize": 10
}

Please refer to the Installation and administration guide for details.

Top.

Acceptance tests

Requirements

Environment preparation:

  • Create a virtual environment somewhere, e.g. in ENV (virtualenv ENV)
  • Activate the virtual environment (source ENV/bin/activate)
  • Change to the test/acceptance folder of the project
  • Install the requirements for the acceptance tests in the virtual environment (pip install -r requirements.txt –allow-all-external).
  • Configure file in fiware_cloto/cloto/tests/acceptance/commons/configuration.py adding the keystone url, and a valid, user, password and tenant ID.

Tests execution

Change to the fiware_cloto/cloto/tests/acceptance folder of the project if not already on it and execute:

$ behave

In the following document you will find the steps to execute automated tests for the Policy Manager GE:

Top.

Support

Ask your thorough programming questions using stackoverflow and your general questions on FIWARE Q&A. In both cases please use the tag fiware-bosun.

Top.

License

(c) 2013-2016 Telefónica I+D, Apache License 2.0

Release History

Release History

2.8.0

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

2.6.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

2.5.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

2.4.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

2.3.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

2.2.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

2.1.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

2.0.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.8.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.6.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.4.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.2.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.1.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
fiware-cloto-2.8.0.tar.gz (60.3 kB) Copy SHA256 Checksum SHA256 Source Oct 13, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting