From 7238d50784e8f08ae41297a0929dad72c63d1aab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Rodr=C3=ADguez?= Date: Mon, 12 Jan 2015 16:42:48 +0000 Subject: [PATCH 1/3] Change versions for next release --- ngsi_adapter/script/build/jenkins.sh | 22 +++++++++++------ ngsi_adapter/src/package.json | 29 +++++++++++++--------- ngsi_event_broker/configure.ac | 13 ++++++++-- ngsi_event_broker/script/build/jenkins.sh | 30 +++++++++++++---------- 4 files changed, 59 insertions(+), 35 deletions(-) diff --git a/ngsi_adapter/script/build/jenkins.sh b/ngsi_adapter/script/build/jenkins.sh index c145a4b..d81f7fd 100755 --- a/ngsi_adapter/script/build/jenkins.sh +++ b/ngsi_adapter/script/build/jenkins.sh @@ -27,8 +27,8 @@ # -h, --help show this help message # # Actions: -# build build, reports generation and SonarQube processing -# release distribution package generation +# build build, generate reports and publish to SonarQube +# release generate distribution package # OPTS='h(help)' @@ -86,8 +86,14 @@ COVERAGE_REPORT_DIR=$PROJECT_BASE_DIR/report/coverage COVERAGE_SITE_DIR=$PROJECT_BASE_DIR/site/coverage/lcov-report # Properties -PROJECT_VERSION=$(sed -n '/"version"/ {s/.*:.*"\(.*\)".*/\1/; p}' $PROJECT_BASE_DIR/package.json) -PRODUCT_RELEASE=4.1.1 +PRODUCT_INFO=$(awk '/"product"/,/\}/' $PROJECT_BASE_DIR/package.json) +PRODUCT_AREA=$(echo "$PRODUCT_INFO" | sed -n '/"area"/ {s/.*:.*"\(.*\)".*/\1/; p; q}') +PRODUCT_NAME=$(echo "$PRODUCT_INFO" | sed -n '/"name"/ {s/.*:.*"\(.*\)".*/\1/; p; q}') +PRODUCT_RELEASE=$(echo "$PRODUCT_INFO" | sed -n '/"release"/ {s/.*:.*"\(.*\)".*/\1/; p; q}') +PROJECT_NAME=$(sed -n '/"name"/ {s/.*:.*"\(.*\)".*/\1/; p; q}' $PROJECT_BASE_DIR/package.json) +PROJECT_VERSION=$(sed -n '/"version"/ {s/.*:.*"\(.*\)".*/\1/; p; q}' $PROJECT_BASE_DIR/package.json) +SONAR_PROJECT_NAME=$(echo "$PRODUCT_NAME-$PROJECT_NAME" | tr '_' '-') +SONAR_PROJECT_KEY=com.telefonica.fiware:$SONAR_PROJECT_NAME # Change to project directory cd $PROJECT_BASE_DIR @@ -104,11 +110,11 @@ build) # Prepare properties file for SonarQube (awk to remove leading spaces) awk '$1=$1' > $PROJECT_BASE_DIR/sonar-project.properties <<-EOF - product.area.name=iotplatform - product.name=fiware-monitoring + product.area.name=$PRODUCT_AREA + product.name=$PRODUCT_NAME product.release=$PRODUCT_RELEASE - sonar.projectName=fiware-monitoring-ngsi-adapter - sonar.projectKey=com.telefonica.fiware:fiware-monitoring-ngsi-adapter + sonar.projectName=$SONAR_PROJECT_NAME + sonar.projectKey=$SONAR_PROJECT_KEY sonar.projectVersion=$PROJECT_VERSION sonar.language=js sonar.sourceEncoding=UTF-8 diff --git a/ngsi_adapter/src/package.json b/ngsi_adapter/src/package.json index d35c021..acd8572 100644 --- a/ngsi_adapter/src/package.json +++ b/ngsi_adapter/src/package.json @@ -1,14 +1,28 @@ { - "version": "1.2.0", + "version": "1.2.1", "name": "ngsi_adapter", - "main": "lib/adapter.js", "description": "Generic NGSI Probe Adapter", + "product": { + "name": "fiware-monitoring", + "area": "iotplatform", + "release": "4.2.1" + }, "keywords": [ "FIWARE", "Monitoring", "NGSI" ], "author": "Telefónica I+D", + "license": "Apache License 2.0", + "repository": { + "type": "git", + "url": "https://github.com/telefonicaid/fiware-monitoring.git" + }, + "main": "lib/adapter.js", + "scripts": { + "start": "adapter", + "test": "grunt test" + }, "engines": { "node": ">=0.10.18" }, @@ -39,14 +53,5 @@ "istanbul": "~0.1.34", "proxyquire": "0.5.1", "dev-null": "0.1.1" - }, - "scripts": { - "start": "adapter", - "test": "grunt test" - }, - "repository": { - "type": "git", - "url": "https://github.com/telefonicaid/fiware-monitoring.git" - }, - "license": "Apache License 2.0" + } } diff --git a/ngsi_event_broker/configure.ac b/ngsi_event_broker/configure.ac index 34b6b1c..f81fcbb 100644 --- a/ngsi_event_broker/configure.ac +++ b/ngsi_event_broker/configure.ac @@ -1,5 +1,8 @@ # Autoconf initialization. -AC_INIT(fiware-monitoring-ngsi-event-broker, 1.4.0) +m4_define([PRODUCT_NAME], [fiware-monitoring]) +m4_define([PRODUCT_AREA], [iotplatform]) +m4_define([PRODUCT_RELEASE], [4.2.1]) +AC_INIT([PRODUCT_NAME-ngsi-event-broker], 1.4.1) AC_LANG(C) if test -z "$CFLAGS"; then # prevent configure from assigning default flags @@ -56,6 +59,10 @@ AC_ARG_WITH(nagios-srcdir, nagios_srcdir=/usr/local/src/nagios) AC_SUBST([NAGIOS_SRCDIR],[$nagios_srcdir]) if test -d $nagios_srcdir/include; then + # Current and required Nagios versions + nagios_common=$nagios_srcdir/include/common.h + nagios_curver=$(awk -F'"' '/PROGRAM_VERSION/ {print $2}' $nagios_common) + nagios_reqver=3.4.1 # Directory where Nagios headers are copied nagios_incdir=contrib/nagios/include mkdir -p $nagios_incdir @@ -66,7 +73,7 @@ if test -d $nagios_srcdir/include; then fi # Library version spec (major:minor:revision). -VERSION_SPEC=$(echo $VERSION | sed 's/\./:/g') +VERSION_SPEC=$(echo $PACKAGE_VERSION | sed 's/\./:/g') AC_SUBST([VERSION_SPEC]) # Package specification attributes. @@ -94,6 +101,8 @@ AC_CACHE_CHECK([for Nagios sources], my_cv_nagios_sources=$nagios_srcdir, my_cv_nagios_sources=no)]) if test "$my_cv_nagios_sources" = "no"; then AC_MSG_ERROR([cannot find sources (use --with-nagios-srcdir option)]) +elif test $(printf "$nagios_reqver\n$nagios_curver" | sort -V | head -1) != $nagios_reqver; then + AC_MSG_ERROR([Nagios sources of version $nagios_reqver or greater required]) fi # Checks for header files. diff --git a/ngsi_event_broker/script/build/jenkins.sh b/ngsi_event_broker/script/build/jenkins.sh index 915ce74..f63ae8d 100755 --- a/ngsi_event_broker/script/build/jenkins.sh +++ b/ngsi_event_broker/script/build/jenkins.sh @@ -27,8 +27,8 @@ # -h, --help show this help message # # Actions: -# build build, reports generation and SonarQube processing -# release distribution package generation +# build build, generate reports and publish to SonarQube +# release generate distribution package # OPTS='h(help)' @@ -86,16 +86,22 @@ COVERAGE_REPORT_DIR=$PROJECT_DIR/report/coverage COVERAGE_SITE_DIR=$PROJECT_DIR/site/coverage/lcov-report # Properties +PRODUCT_AREA=$(sed -n '/\[PRODUCT_AREA\]/ {s/.*\[.*\].*\[\(.*\)\].*/\1/; p}' $PROJECT_DIR/configure.ac) +PRODUCT_NAME=$(sed -n '/\[PRODUCT_NAME\]/ {s/.*\[.*\].*\[\(.*\)\].*/\1/; p}' $PROJECT_DIR/configure.ac) +PRODUCT_RELEASE=$(sed -n '/\[PRODUCT_RELEASE\]/ {s/.*\[.*\].*\[\(.*\)\].*/\1/; p}' $PROJECT_DIR/configure.ac) +PROJECT_NAME=$(sed -n '/AC_INIT/ {s/.*\[PRODUCT_NAME-\(.*\)].*/\1/; p}' $PROJECT_DIR/configure.ac) PROJECT_VERSION=$(sed -n '/AC_INIT/ {s/.*,[ \t]*\(.*\))/\1/; p}' $PROJECT_DIR/configure.ac) -PRODUCT_RELEASE=4.1.1 +SONAR_PROJECT_NAME=$(echo "$PRODUCT_NAME-$PROJECT_NAME" | tr '_' '-') +SONAR_PROJECT_KEY=com.telefonica.fiware:$SONAR_PROJECT_NAME # Dependencies RPM_DEPENDENCIES="wget gcc-c++ make autoconf automake libtool cppunit-devel libcurl-devel" DEB_DEPENDENCIES="wget g++ build-essential autoconf automake autotools-dev libtool libcppunit-dev libcurl4-openssl-dev" -NAGIOS_SRC_URL=http://sourceforge.net/projects/nagios/files NAGIOS_SRC_DIR=$PROJECT_DIR/nagios NAGIOS_INC_DIR=$PROJECT_DIR/$(awk -F= '/nagios_incdir=/ { print $2 }' $PROJECT_DIR/configure.ac) -NAGIOS_VERSION=3.4.1 +NAGIOS_VERSION=$(awk -F= '/nagios_reqver=/ { print $2 }' $PROJECT_DIR/configure.ac) +NAGIOS_FILES=http://sourceforge.net/projects/nagios/files +NAGIOS_URL=$NAGIOS_FILES/nagios-${NAGIOS_VERSION%%.*}.x/nagios-$NAGIOS_VERSION/nagios-$NAGIOS_VERSION.tar.gz/download # Change to project directory cd $PROJECT_DIR @@ -113,8 +119,7 @@ build) fi sudo pip install -q gcovr if ! test -d $NAGIOS_SRC_DIR; then - URL=$NAGIOS_SRC_URL/nagios-${NAGIOS_VERSION%%.*}.x/nagios-${NAGIOS_VERSION}/nagios-${NAGIOS_VERSION}.tar.gz/download - wget $URL -q -O nagios-${NAGIOS_VERSION}.tar.gz + wget $NAGIOS_URL -q -O nagios-${NAGIOS_VERSION}.tar.gz tar xzf nagios-${NAGIOS_VERSION}.tar.gz (cd nagios && ./configure && make nagios) fi @@ -136,11 +141,11 @@ build) # Prepare properties file for SonarQube (awk to remove leading spaces) awk '$1=$1' > $PROJECT_DIR/sonar-project.properties <<-EOF - product.area.name=iotplatform - product.name=fiware-monitoring + product.area.name=$PRODUCT_AREA + product.name=$PRODUCT_NAME product.release=$PRODUCT_RELEASE - sonar.projectName=fiware-monitoring-ngsi-event-broker - sonar.projectKey=com.telefonica.fiware:fiware-monitoring-ngsi-event-broker + sonar.projectName=$SONAR_PROJECT_NAME + sonar.projectKey=$SONAR_PROJECT_KEY sonar.projectVersion=$PROJECT_VERSION sonar.language=c++ sonar.sourceEncoding=UTF-8 @@ -181,8 +186,7 @@ release) sudo apt-get -y -q install $DEB_DEPENDENCIES dpkg-dev debhelper fi if ! test -d $NAGIOS_SRC_DIR; then - URL=$NAGIOS_SRC_URL/nagios-${NAGIOS_VERSION%%.*}.x/nagios-${NAGIOS_VERSION}/nagios-${NAGIOS_VERSION}.tar.gz/download - wget $URL -q -O nagios-${NAGIOS_VERSION}.tar.gz + wget $NAGIOS_URL -q -O nagios-${NAGIOS_VERSION}.tar.gz tar xzf nagios-${NAGIOS_VERSION}.tar.gz (cd nagios && ./configure && make nagios) fi From 60b4ce00c655fb039cdfd10938bef118ba5ad4db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Rodr=C3=ADguez?= Date: Mon, 12 Jan 2015 16:49:07 +0000 Subject: [PATCH 2/3] Remove unused component nova_event_listener --- nova_event_listener/.gitignore | 1 - nova_event_listener/README.md | 60 ---- .../conf/nova_event_listener.cfg | 50 ---- nova_event_listener/nova_event_listener.py | 279 ------------------ nova_event_listener/requirements.txt | 4 - 5 files changed, 394 deletions(-) delete mode 100644 nova_event_listener/.gitignore delete mode 100644 nova_event_listener/README.md delete mode 100644 nova_event_listener/conf/nova_event_listener.cfg delete mode 100644 nova_event_listener/nova_event_listener.py delete mode 100644 nova_event_listener/requirements.txt diff --git a/nova_event_listener/.gitignore b/nova_event_listener/.gitignore deleted file mode 100644 index 7c18c6b..0000000 --- a/nova_event_listener/.gitignore +++ /dev/null @@ -1 +0,0 @@ -.pydevproject diff --git a/nova_event_listener/README.md b/nova_event_listener/README.md deleted file mode 100644 index 97e6f38..0000000 --- a/nova_event_listener/README.md +++ /dev/null @@ -1,60 +0,0 @@ -# OpenStack Nova Event Listener - -AMQP client listening for Nova [compute.instance][event_ref] notification events -to register newly created instances as entities in a NGSI Context Broker. - -## Installation - -Dependencies must be resolved prior running the listener. Be sure Python and pip -are installed, and then run: - - $ pip install -r requirements.txt - -## Usage - -Listener runs as a standalone process listening to AMQP queues, which responds -to instance creation by sending a request to Context Broker (whose URL must be -given at command line or in configuration file *conf/nova_event_listener.cfg*) - -The requests to Context Broker are asynchronously processed by [Celery][celery] -using the local AMQP as tasks queue. Therefore, a Celery worker must be started -in addition to event listener: - - $ celery --app=nova_event_listener worker --loglevel=info & - $ nova_event_listener.py --brokerUrl http://{host}:{port}/ - -For detailed information about command line options and default values, -please run: - - $ nova_event_listener.py --help - -Logging options (such as level, console, rolling files, etc.) may be -configured editing *conf/nova_event_listener.cfg* file. - - -## Entities - -New instances created by OpenStack Nova service are registered as NGSI entities, -with the following considerations: - -* *{entityId}* = *{regionId}*:*{instanceUUID}* - -* *{entityType}* = "vm" - -## Changelog - -Version 1.0.0 - -* Initial release of the component - -## License - -(c) 2013 Telefónica I+D, Apache License 2.0 - -[event_ref]: -https://wiki.openstack.org/wiki/SystemUsageData -"Nova notification system events" - -[celery]: -http://www.celeryproject.org/ -"Celery: Distributed Task Queue" diff --git a/nova_event_listener/conf/nova_event_listener.cfg b/nova_event_listener/conf/nova_event_listener.cfg deleted file mode 100644 index 89838ec..0000000 --- a/nova_event_listener/conf/nova_event_listener.cfg +++ /dev/null @@ -1,50 +0,0 @@ -[common] -brokerUrl: http://127.0.0.1:1338/ ; context broker URL -retries: 2 ; number of retries (exponential backoff) -factor: 2 ; factor for exponential backoff -randomize: False ; enable randomization for exponential backoff -minRetryTime: 1000 ; minimum time for exponential backoff (millis) -maxRetryTime: sys.maxint ; maximum time for exponential backoff (millis) -registerAppUrl: http://fiware/vm/ ; NGSI register providing application (ignored) -registerDuration: P99Y ; NGSI register duration (99 years ~ infinity) -registerAttributes: { - 'vm': [ - 'cpuLoadPct', - 'freeSpacePct', - 'usedMemPct', - 'procs', - 'users' - ] - } - -[loggers] -keys: root - -[handlers] -keys: console, file - -[formatters] -keys: standard - -[formatter_standard] -class: logging.Formatter -format: %(asctime)s [%(levelname)s] %(message)s - -[logger_root] -level: INFO -handlers: console, file - -[handler_console] -level: DEBUG -class: StreamHandler -formatter: standard -args: (sys.stdout,) - -[handler_file] -level: DEBUG -class: handlers.RotatingFileHandler -formatter: standard -logFileName: nova_event_listener.log -logMaxFiles: 3 -logMaxSize: 5*1024*1024 ; 5 MB -args: ('%(logFileName)s', 'a', %(logMaxSize)s, %(logMaxFiles)s) diff --git a/nova_event_listener/nova_event_listener.py b/nova_event_listener/nova_event_listener.py deleted file mode 100644 index 85d1ee0..0000000 --- a/nova_event_listener/nova_event_listener.py +++ /dev/null @@ -1,279 +0,0 @@ -#!/usr/bin/env python -# -*- encoding: utf-8 -*- -# -# Copyright 2013 Telefónica I+D -# All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# - - -__version__ = '1.0.0' -__version_info__ = tuple([int(num) for num in __version__.split('.')]) -__description__ = 'OpenStack Nova Event Listener' - - -from celery import Celery -from ceilometer.openstack.common import rpc -from ConfigParser import SafeConfigParser -from optparse import OptionParser -from urllib2 import Request, URLError, urlopen -import logging.config -import os.path -import httplib -import random -import sys - - -"""NGSI entity type for OpenStack's servers""" -SERVER_ENTITY_TYPE = 'vm' - - -"""Default attributes for NGSI entities. - -A dictionary whose keys are the different entity types. Values are lists of valid entity attributes for that type. The -set of types and/or attributes may be modified or extended via configuration file (see below). -""" -ENTITY_ATTRIBUTES = { - 'vm': [ # entityType='vm' - 'cpuLoadPct', # percentage of CPU load - 'freeSpacePct', # percentage of free physical or virtual host disk - 'usedMemPct', # percentage of RAM memory in use - 'procs', # number of running processes - 'users' # number of users logged in - ] -} - - -"""Default configuration. - -The configuration `cfg_defaults` can be superseded with that read from `cfg_filename` (at path `conf/.cfg`), -if file exists. -""" -name = os.path.splitext(os.path.basename(__file__))[0] -cfg_filename = os.path.join(os.path.dirname(__file__), 'conf', '%s.cfg' % name) -cfg_defaults = { - 'brokerUrl': 'http://127.0.0.1:1338/', # context broker URL - 'registerAppUrl': 'http://fiware/vm/', # NGSI register providing application (ignored) - 'registerDuration': 'P99Y', # NGSI register duration (99 years ~ infinity) - 'registerAttributes': str(ENTITY_ATTRIBUTES), # NGSI register entity attributes - 'retries': 2, # number of retries (exponential backoff) - 'factor': 2, # factor for exponential backoff - 'randomize': False, # enable randomization for exponential backoff - 'minRetryTime': 1000, # minimum time for exponential backoff (millis) - 'maxRetryTime': sys.maxint, # maximum time for exponential backoff (millis) - 'logLevel': 'INFO', - 'logFormat': '%(asctime)s [%(level)s] %(message)s' -} - - -"""Celery application initialization. - -Uses local RabbitMQ server as message broker and result backend. -""" -app = Celery(name, broker='amqp://', backend='amqp') - - -def get_register_context_xml(entity_id, entity_type, register_app_url, register_duration, register_attributes): - """Generate a XML `registerContext` request body. - - :param string entity_id: the identifier of the entity being registered. - :param string entity_type: the type of the entity being registered. - :param string register_app_url: the providing application URL. - :param string register_duration: the duration of the registration. - :param dict register_attributes: the attribute list of each type of entity being registered. - :returns: the body in XML format for the registerContext NGSI9 request. - """ - format_args = locals() - format_args.update({ - 'register_attrs_xml': '\n'.join([''' - - {0} - string - false - - '''.format(attr) for attr in register_attributes.get(entity_type)]) - }) - result = ''' - - - - - - - {entity_id} - - - - {register_attrs_xml} - - {register_app_url} - - - {register_duration} - - '''.format(**format_args) - return result; - - -def listen(connection, config): - """Listen a RPC connection for events. - - When an event of instance creation or deletion is received, this function schedules an asynchronous, retriable task - consisting of sending a NSGI registration request to Context Broker. - - :param connection: the RPC connection to listen to. - :param config: the `ConfigParser` object with the configuration parameters. - """ - topic = 'notifications.info' - def process_event(msg): - event_type = msg.get('event_type') - event_creation = False - event_deletion = False - if event_type == 'compute.instance.create.end': - event_creation = True - elif event_type == 'compute.instance.delete.end': - event_deletion = True - elif event_type == 'compute.instance.update': - state = msg.get('payload').get('state') - transition = msg.get('payload').get('state_description') - if transition == '': - if state == 'active': - event_creation = True - elif state == 'deleted': - event_deletion = True - # schedule asynchronous processing of creation events - if event_creation: - logging.debug('Instance %s created (%s)', msg.get('payload').get('instance_id'), event_type) - ngsi_request.delay(event_msg=msg, - broker_url=config.get('common', 'brokerUrl'), - max_retries=int(eval(config.get('common', 'retries'))), - factor=int(eval(config.get('common', 'factor'))), - randomize=bool(eval(config.get('common', 'randomize'))), - min_time_millis=int(eval(config.get('common', 'minRetryTime'))), - max_time_millis=int(eval(config.get('common', 'maxRetryTime'))), - register_app_url=config.get('common', 'registerAppUrl'), - register_duration=config.get('common', 'registerDuration'), - register_attributes=config.get('common', 'registerAttributes')) - elif event_deletion: - logging.debug('Instance %s deleted (%s)', msg.get('payload').get('instance_id'), event_type) - - connection.declare_topic_consumer(topic, process_event) - try: - connection.consume() - except KeyboardInterrupt: - pass - - -@app.task(bind=True) -def ngsi_request(self, event_msg, - broker_url=cfg_defaults['brokerUrl'], - max_retries=cfg_defaults['retries'], - factor=cfg_defaults['factor'], - randomize=cfg_defaults['randomize'], - min_time_millis=cfg_defaults['minRetryTime'], - max_time_millis=cfg_defaults['maxRetryTime'], - register_app_url=cfg_defaults['registerAppUrl'], - register_duration=cfg_defaults['registerDuration'], - register_attributes=cfg_defaults['registerAttributes']): - - """Process an instance creation event message (asynchronously) by sending a NGSI9 request to Context Broker. - - :param task self: the asynchronous task being processed. - :param dict event_msg: the event message that triggered the task. - :param string broker_url: the URL of the Context Broker to send requests to. - :param integer max_retries: the maximum number of retries (in case the request fails). - :param integer factor: the factor of the exponential backoff retrial policy. - :param boolean randomize: enable randomization in exponential backoff retrial policy. - :param integer min_time_millis: the minimum delay of the exponential backoff retrial policy. - :param integer max_time_millis: the maximum delay of the exponential backoff retrial policy. - :param string register_app_url: the providing application URL. - :param string register_duration: the duration of the registration. - :param string register_attributes: the stringified dictionary of entity types and their attribute list. - :raises URLError: when an error occurs and maximum number of retries is exceeded. - """ - def count_exponential_backoff(attempts): - rnd = random.uniform(1,2) if randomize else 1 - return min(int(rnd * min_time_millis/1000 * (factor**attempts)), max_time_millis/1000) - - try: - region = event_msg.get('_context_service_catalog')[0].get('endpoints')[0].get('region') - instance_id = event_msg.get('payload').get('instance_id') - hostname = event_msg.get('payload').get('hostname') - tenant_id = event_msg.get('_context_tenant') - project = event_msg.get('_context_project_name') - user = event_msg.get('_context_user_name') - logging.debug('New instance %s', { - 'region': region, - 'instance_id': instance_id, - 'hostname': hostname, - 'tenant_id': tenant_id, - 'project': project, - 'user': user - }) - entity_id = '{0}:{1}'.format(region, instance_id) - request_data = get_register_context_xml( - entity_id=entity_id, - entity_type=SERVER_ENTITY_TYPE, - register_app_url=register_app_url, - register_duration=register_duration, - register_attributes=eval(register_attributes)) - response = urlopen(Request( - url=broker_url, - data=request_data, - headers={ - 'Content-Type': 'application/xml; charset=utf8', - 'Content-Length': len(request_data) - } - )) - status = response.getcode() - logging.info('Registration of %s into %s: %s %s', entity_id, broker_url, status, httplib.responses[status]) - except (URLError) as exc: - error = RuntimeError('urlopen({0}): {1}'.format(broker_url, exc.reason.strerror)) - raise self.retry(exc=error, countdown=count_exponential_backoff(self.request.retries), max_retries=max_retries) - - -def main(): - # process configuration file (if exists) and setup logging - config = SafeConfigParser(cfg_defaults) - config.add_section('common') - for key, value in cfg_defaults.items(): config.set('common', key, str(value)) - if config.read(cfg_filename): - logging.config.fileConfig(cfg_filename) - else: - logging.basicConfig(stream=sys.stdout, level=cfg_defaults['logLevel'], format=cfg_defaults['logFormat']) - - # process command line arguments - parser = OptionParser(version='{0} {1}'.format(__description__, __version__), description=__description__) - parser.add_option('-b', '--brokerUrl', dest='brokerUrl', metavar='URL', type='string', - default=config.get('common', 'brokerUrl'), help='context broker URL [default=%default]'), - parser.add_option('-l', '--logLevel', dest='logLevel', metavar='LEVEL', - choices=[level for level in logging._levelNames.keys() if isinstance(level, str)], - default=config.get('common', 'logLevel'), help='logging level [default=%default]') - (opts, args) = parser.parse_args() # @UnusedVariable - config.set('common', 'brokerUrl', opts.brokerUrl) - config.set('common', 'logLevel', opts.logLevel) - logging.root.setLevel(opts.logLevel) - - # rpc connection - connection = rpc.create_connection() - try: - logging.info('Context Broker URL: %s', config.get('common', 'brokerUrl')) - listen(connection, config) - finally: - connection.close() - return 0 - - -if __name__ == '__main__': - main() diff --git a/nova_event_listener/requirements.txt b/nova_event_listener/requirements.txt deleted file mode 100644 index ec84afe..0000000 --- a/nova_event_listener/requirements.txt +++ /dev/null @@ -1,4 +0,0 @@ -# Celery -celery==3.1.5 -# Ceilometer 2013.1.4 -https://launchpad.net/ceilometer/grizzly/2013.1.4/+download/ceilometer-2013.1.4.tar.gz From dbe067f5ed0aac964fb59324b030ca8bf713684c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Rodr=C3=ADguez?= Date: Mon, 12 Jan 2015 17:00:16 +0000 Subject: [PATCH 3/3] Add configuration of Jenkins jobs --- .../fiware-monitoring-ngsi-adapter-build.xml | 170 +++++++++++++++++ ...are-monitoring-ngsi-adapter-deploy-deb.xml | 93 +++++++++ ...are-monitoring-ngsi-event-broker-build.xml | 180 ++++++++++++++++++ ...onitoring-ngsi-event-broker-deploy-deb.xml | 97 ++++++++++ 4 files changed, 540 insertions(+) create mode 100644 ngsi_adapter/script/build/files/jenkins/fiware-monitoring-ngsi-adapter-build.xml create mode 100644 ngsi_adapter/script/build/files/jenkins/fiware-monitoring-ngsi-adapter-deploy-deb.xml create mode 100644 ngsi_event_broker/script/build/files/jenkins/fiware-monitoring-ngsi-event-broker-build.xml create mode 100644 ngsi_event_broker/script/build/files/jenkins/fiware-monitoring-ngsi-event-broker-deploy-deb.xml diff --git a/ngsi_adapter/script/build/files/jenkins/fiware-monitoring-ngsi-adapter-build.xml b/ngsi_adapter/script/build/files/jenkins/fiware-monitoring-ngsi-adapter-build.xml new file mode 100644 index 0000000..90c1981 --- /dev/null +++ b/ngsi_adapter/script/build/files/jenkins/fiware-monitoring-ngsi-adapter-build.xml @@ -0,0 +1,170 @@ + + + + <a href="https://github.com/telefonicaid/fiware-monitoring/tree/develop/ngsi_adapter"> +FIWARE Monitoring GE: NGSI Adapter +</a> +<br><br><img src="/../jenkins/job/fiware-monitoring-ngsi-adapter-build/badge/icon"> +<a href="/../jenkins/job/metrics-queue-consumer">Metrics</a> +<img src="/../jenkins/job/metrics-queue-consumer/lastBuild/buildStatus" width="16"> + + false + + + + + + REPOSITORY + + + + https://github.com/telefonicaid/fiware-monitoring.git + https://github.com/fiware/fiware-monitoring.git + + + + + BRANCH + + develop + + + + + + + /../sonar/dashboard/index/com.telefonica.fiware:fiware-monitoring-ngsi-adapter + Sonar + gear2.gif + + + + + 87885021 + + + + + + /home/develenv/app/hudson/jobs/fiware-monitoring-ngsi-adapter-build/workspace + 37448083 + + + + + + + + 2 + + + $REPOSITORY + + + + + $BRANCH + + + false + + + + true + false + false + false + + + @midnight + + + false + + + ngsi_adapter/script/build/jenkins.sh build + + + + + + **/report/coverage/cobertura-coverage.xml + false + false + false + false + false + false + 0 + true + + + + METHOD + 8000000 + + + LINE + 8000000 + + + CONDITIONAL + 7000000 + + + + + + + METHOD + 0 + + + LINE + 0 + + + CONDITIONAL + 0 + + + + + + + METHOD + 0 + + + LINE + 0 + + + CONDITIONAL + 0 + + + + ASCII + + + **/report/test/TEST-xunit.xml + false + + + + fiware-monitoring-ngsi-adapter-deploy-deb + + SUCCESS + 0 + BLUE + true + + + + + + xterm + + + \ No newline at end of file diff --git a/ngsi_adapter/script/build/files/jenkins/fiware-monitoring-ngsi-adapter-deploy-deb.xml b/ngsi_adapter/script/build/files/jenkins/fiware-monitoring-ngsi-adapter-deploy-deb.xml new file mode 100644 index 0000000..8771ef1 --- /dev/null +++ b/ngsi_adapter/script/build/files/jenkins/fiware-monitoring-ngsi-adapter-deploy-deb.xml @@ -0,0 +1,93 @@ + + + + <a href="https://github.com/telefonicaid/fiware-monitoring/tree/develop/ngsi_adapter"> +FIWARE Monitoring GE: NGSI Adapter (Ubuntu package) +</a> +<br><br><img src="/../jenkins/job/fiware-monitoring-ngsi-adapter-deploy-deb/badge/icon"> + + + -1 + 10 + -1 + -1 + + false + + + + + + REPOSITORY + + + + https://github.com/telefonicaid/fiware-monitoring.git + https://github.com/fiware/fiware-monitoring.git + + + + + BRANCH + + develop + + + + + 4719774 + + + ci-fiware-ubunt-01.hi.inet + + + /home/develenv/workspace/fiware-monitoring-ngsi-adapter-deploy-deb + 1328501 + + + + + + + + 2 + + + $REPOSITORY + + + + + $BRANCH + + + false + + + + ci-fiware-ubunt-01.hi.inet + false + false + false + false + + false + + + ngsi_adapter/script/build/jenkins.sh release + + + + + + **/*.deb + false + false + + + + + xterm + + + \ No newline at end of file diff --git a/ngsi_event_broker/script/build/files/jenkins/fiware-monitoring-ngsi-event-broker-build.xml b/ngsi_event_broker/script/build/files/jenkins/fiware-monitoring-ngsi-event-broker-build.xml new file mode 100644 index 0000000..0fceada --- /dev/null +++ b/ngsi_event_broker/script/build/files/jenkins/fiware-monitoring-ngsi-event-broker-build.xml @@ -0,0 +1,180 @@ + + + + <a href="https://github.com/telefonicaid/fiware-monitoring/tree/develop/ngsi_event_broker"> +FIWARE Monitoring GE: NGSI Event Broker +</a> +<br><br><img src="/../jenkins/job/fiware-monitoring-ngsi-event-broker-build/badge/icon"> +<a href="/../jenkins/job/metrics-queue-consumer">Metrics</a> +<img src="/../jenkins/job/metrics-queue-consumer/lastBuild/buildStatus" width="16"> + + + -1 + 10 + -1 + -1 + + false + + + + + + REPOSITORY + + + + https://github.com/telefonicaid/fiware-monitoring.git + https://github.com/fiware/fiware-monitoring.git + + + + + BRANCH + + develop + + + + + + + /../sonar/dashboard/index/com.telefonica.fiware:fiware-monitoring-ngsi-event-broker + Sonar + gear2.gif + + + + + 56171740 + + + + + + /home/develenv/app/hudson/jobs/fiware-monitoring-ngsi-event-broker-build/workspace + 36259644 + + + + + + + + 2 + + + $REPOSITORY + + + + + $BRANCH + + + false + + + + true + false + false + false + + + @midnight + + + false + + + ngsi_event_broker/script/build/jenkins.sh build + + + + + + + + + ngsi_event_broker/jenkins-cobertura-coverage.xml + false + false + false + false + false + false + 0 + true + + + + METHOD + 8000000 + + + LINE + 8000000 + + + CONDITIONAL + 7000000 + + + + + + + METHOD + 0 + + + LINE + 0 + + + CONDITIONAL + 0 + + + + + + + METHOD + 0 + + + LINE + 0 + + + CONDITIONAL + 0 + + + + ASCII + + + ngsi_event_broker/report/test/TEST-xunit-*.xml + false + + + + + fiware-monitoring-ngsi-event-broker-deploy-deb + + SUCCESS + 0 + BLUE + true + + + + + + xterm + + + \ No newline at end of file diff --git a/ngsi_event_broker/script/build/files/jenkins/fiware-monitoring-ngsi-event-broker-deploy-deb.xml b/ngsi_event_broker/script/build/files/jenkins/fiware-monitoring-ngsi-event-broker-deploy-deb.xml new file mode 100644 index 0000000..7bc80f8 --- /dev/null +++ b/ngsi_event_broker/script/build/files/jenkins/fiware-monitoring-ngsi-event-broker-deploy-deb.xml @@ -0,0 +1,97 @@ + + + + <a href="https://github.com/telefonicaid/fiware-monitoring/tree/develop/ngsi_event_broker"> +FIWARE Monitoring GE: NGSI Event Broker (Ubuntu package) +</a> +<br><br><img src="/../jenkins/job/fiware-monitoring-ngsi-event-broker-deploy-deb/badge/icon"> + + + -1 + 10 + -1 + -1 + + false + + + + + + REPOSITORY + + + + https://github.com/telefonicaid/fiware-monitoring.git + https://github.com/fiware/fiware-monitoring.git + + + + + BRANCH + + develop + + + + + 46646571 + + + ci-fiware-ubunt-01.hi.inet + + + /home/develenv/workspace/fiware-monitoring-ngsi-event-broker-deploy-deb + 41790349 + + + + + + + + 2 + + + $REPOSITORY + + + + + $BRANCH + + + false + + + + ci-fiware-ubunt-01.hi.inet + false + false + false + false + + false + + + ngsi_event_broker/script/build/jenkins.sh release + + + + + + + + + **/*.deb, **/*.src.tar.gz + false + false + + + + + + xterm + + + \ No newline at end of file