Skip to content

Commit

Permalink
Merge 12734d3 into 832626f
Browse files Browse the repository at this point in the history
  • Loading branch information
pratid committed Nov 17, 2015
2 parents 832626f + 12734d3 commit 0bded3a
Show file tree
Hide file tree
Showing 28 changed files with 936 additions and 437 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ which bumpversion >/dev/null || {
}

# Ask for new FIWARE release
CUR_RELEASE=4.4.2
CUR_RELEASE=5.1.2
PROMPT="Please specify new FIWARE release (current is $CUR_RELEASE): "
read -p "$PROMPT" NEW_RELEASE
test -n "$(expr "$NEW_RELEASE" : '\([0-9]\+\.[0-9]\+\.[0-9]\+\)$')" || {
Expand Down
23 changes: 12 additions & 11 deletions ContributionPolicy.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ and Telefónica I+D, contributors must send this policy signed in order to
express the acceptance of all its sections.
Contributor Contact Information
Name (Contributor):__________________________________________________
E-mail:_____________________________________________________________
Phone:_____________________________________________________________
E-mail:______________________________________________________________
Phone:_______________________________________________________________
Mailing Address:_____________________________________________________

1. Contributor declare to own all the rights necessary to contribute with any
Expand All @@ -18,27 +18,28 @@ Telefónica I+D after the acceptance of this policy by Telefónica I+D.
the ownership of the Contribution in all worldwide common law and statutory
rights associated with the copyrights, copyright application, copyright
registration and moral rights in the Contribution to the extent allowable under
applicable local laws and copyright conventions.
applicable local laws and copyright conventions.

3. The Contributor will keep the moral rights and the authorship of the
Contribution,
Contribution.

4. The contributor agrees that the contribution given by this joint copyright
assignment can be used by Telefónica I+D to establish and create privative
versions of the contribution or to include it in privative products. The
contributor will be mandatory mentioned as the author of the contribution,
but all the rights and revenues of this privative version, will be owned by
Telefónica I+D.
assignment can be used by Telefónica I+D to establish and create privative
versions of the contribution or to include it in privative products. The
contributor will be mandatory mentioned as the author of the contribution,
but all the rights and revenues of this privative version, will be owned by
Telefónica I+D.

5. This policy supersedes and replaces all prior copyrights assignments or
agreements made by the contributor to Telefónica I+D under this project.

6. This policy will apply to all contributions of the contributor, until one of
the parties cancel or modify it by a written declaration or if a new one is signed.
the parties cancel or modify it by a written declaration or if a new one is
signed.

7. Contributor is legally entitled to grant the above policy and agrees not to
provide any Contribution that violates any law or breaches any contract.

Signed: ____________________________________________Date:________________
Signed:____________________________________________Date:________________

Please send a signed original to opensource at tid dot es
5 changes: 4 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,8 @@ The configuration used by the adapter service is optionally read from the file
# ADAPTER_LISTEN_PORT - The port where NGSI Adapter listens to requests
ADAPTER_LISTEN_PORT=1337

# ADAPTER_UDP_ENDPOINTS - UDP listen endpoints (host:port:parser,...)

# ADAPTER_BROKER_URL - The endpoint where Context Broker is listening
ADAPTER_BROKER_URL=http://127.0.0.1:1026/

Expand All @@ -226,10 +228,11 @@ Most of these attributes map to options of the `command line interface
- ``ADAPTER_LOGLEVEL`` maps to ``-l`` or ``--logLevel`` option
- ``ADAPTER_LISTEN_HOST`` maps to ``-H`` or ``--listenHost`` option
- ``ADAPTER_LISTEN_PORT`` maps to ``-p`` or ``--listenPort`` option
- ``ADAPTER_UDP_ENDPOINTS`` maps to ``-u`` or ``--udpEndpoints`` option
- ``ADAPTER_BROKER_URL`` maps to ``-b`` or ``--brokerUrl`` option
- ``ADAPTER_RETRIES`` maps to ``-r`` or ``--retries`` option

Default values are found in ``/opt/fiware/ngsi_adapter/config/options.js``.
Default values are found in ``/opt/fiware/ngsi_adapter/lib/common.js``.


Checking status
Expand Down
5 changes: 5 additions & 0 deletions doc/manuals/admin/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ You can use these command line options (available typing ``adapter --help``):
The hostname or address at which NGSI Adapter listens
-p, --listenPort
The port number at which NGSI Adapter listens
-u, --udpEndpoints
Optional list of UDP endpoints (host:port:parser)
-b, --brokerUrl
The URL of the Context Broker instance to publish data to
-r, --retries
Expand Down Expand Up @@ -233,6 +235,9 @@ Network interfaces Up & Open
NGSI Adapter uses TCP 1337 as default port, although it can be changed using
the ``--listenPort`` command line option.

Additionally, a list of UDP listen ports may be specified by ``--udpEndpoints``
command line option.


Databases
---------
Expand Down
52 changes: 42 additions & 10 deletions doc/manuals/user/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,14 @@ Programmer Guide
According to the architecture aforementioned, there are several APIs involved
in the monitoring process:

- NGSI Adapter API
- NGSI Adapter API (HTTP)
- NGSI Adapter API (UDP)
- Context Broker API
- Monitoring (*Query Manager*) API


NGSI Adapter API
----------------
NGSI Adapter API (HTTP)
-----------------------

Probe raw data should be sent as body of a POST request to the adapter,
identifying the source entity being monitored in the query parameters.
Expand Down Expand Up @@ -79,13 +80,22 @@ of **monitoring collector**) to automatically forward such data to the
adaptation layer.


NGSI Adapter API (UDP)
----------------------

In case UDP endpoints are defined (specifying the target parser to be loaded),
probe raw data should be sent as UDP request to the adapter. Such message is
expected to include both the id and the type of the NGSI Entity whose data is
about to be parsed.


NGSI Adapter parsers
--------------------

NGSI Adapter processes requests asynchronously, trying to locate a valid parser
named after the originating probe, located at ``lib/parsers/``. If probe is
unknown, response status will be ``404``; otherwise, response status will be
``200``, parser will be dynamically loaded, and then its ``parseRequest()``
unknown, HTTP response status will be ``404``; otherwise, response status will
be ``200``, parser will be dynamically loaded, and then its ``parseRequest()``
and ``getContextAttrs()`` methods will be invoked. With the attribute list
returned by the latter, Context Broker will be invoked.

Expand All @@ -102,23 +112,45 @@ comma-separated list of values of two attributes *myAttr0* and *myAttr1*:

.. code:: javascript
// module "lib.parsers.myProbe"
/**
* module "lib.parsers.myProbe"
*/
var baseParser = require('./common/base').parser,
myParser = Object.create(baseParser);
myParser.parseRequest = function(request) {
return { data: request.body };
// @param Domain object including context, timestamp, id, type & body
myParser.parseRequest = function (reqDomain) {
var reqDataContent = this.doSomeParsing(reqDomain.body);
return { data: reqDataContent };
};
myParser.getContextAttrs = function(probeData) {
var items = probeData.data.split(',');
// @param EntityData object including data attribute
myParser.getContextAttrs = function (entityData) {
var items = this.doMoreParsing(entityData.data);
return { myAttr0: items[0], myAttr1: items[1] };
};
exports.parser = myParser;
Custom parsers for UDP request **must** also set the attributes ``entityId`` and
``entityType`` of the input object ``reqDomain`` on return, given that such
information is part of the UDP message itself being parsed:

.. code:: javascript
// @param Domain object
myParser.parseRequest = function (reqDomain) {
var identification = this.doSomeParsing(reqDomain.body),
reqDataContent = this.doMoreParsing(reqDomain.body);
reqDomain.entityId = identification['id'];
reqDomain.entityType = identification['type'];
return { data: reqDataContent };
};
Context Broker API
------------------

Expand Down
4 changes: 4 additions & 0 deletions ngsi_adapter/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ Please refer to `this document </README.rst#running>`_ for details.
Changelog
=========

Version 1.3.0

- Add support to UDP requests

Version 1.2.4

- Add service configuration file
Expand Down
6 changes: 6 additions & 0 deletions ngsi_adapter/script/build/files/debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
fiware-monitoring-ngsi-adapter (1.3.0) precise; urgency=low

* Add support to UDP requests

-- Telefónica I+D <opensource@tid.es> Wed, 11 Nov 2015 18:00:00 +0200

fiware-monitoring-ngsi-adapter (1.2.4) precise; urgency=low

* Add service configuration file
Expand Down
2 changes: 2 additions & 0 deletions ngsi_adapter/script/build/files/debian/ngsi_adapter.default
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ ADAPTER_LISTEN_HOST=0.0.0.0
# ADAPTER_LISTEN_PORT - The port where NGSI Adapter listens to requests
ADAPTER_LISTEN_PORT=1337

# ADAPTER_UDP_ENDPOINTS - UDP listen endpoints (host:port:parser,...)

# ADAPTER_BROKER_URL - The endpoint where Context Broker is listening
ADAPTER_BROKER_URL=http://127.0.0.1:1026/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ ADAPTER_LISTEN_HOST=0.0.0.0
# ADAPTER_LISTEN_PORT - The port where NGSI Adapter listens to requests
ADAPTER_LISTEN_PORT=1337

# ADAPTER_UDP_ENDPOINTS - UDP listen endpoints (host:port:parser,...)

# ADAPTER_BROKER_URL - The endpoint where Context Broker is listening
ADAPTER_BROKER_URL=http://127.0.0.1:1026/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,9 @@ if [ $1 -eq 0 ]; then
fi

%changelog
* Wed Nov 11 2015 Telefónica I+D <opensource@tid.es> 1.3.0-1
- Add support to UDP requests

* Fri Aug 14 2015 Telefónica I+D <opensource@tid.es> 1.2.4-1
- Add service configuration file

Expand Down
4 changes: 2 additions & 2 deletions ngsi_adapter/src/.gjslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
--nomultiprocess
--debug_indentation
--time
--disable=110,212,217
--custom_jsdoc_tags=module,function,callback,abstract,constant,augments,memberof,returns
--disable=1,110,212,217
--custom_jsdoc_tags=module,namespace,property,function,callback,abstract,constant,augments,memberof,returns
Loading

0 comments on commit 0bded3a

Please sign in to comment.