Skip to content

Commit

Permalink
Add documentation
Browse files Browse the repository at this point in the history
Signed-off-by: Irene Bandera <irenebandera@eprosima.com>
  • Loading branch information
irenebm committed Jul 15, 2024
1 parent 800f7b8 commit 7a0b388
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 4 deletions.
38 changes: 38 additions & 0 deletions amlip_docs/rst/user_manual/nodes/fiware.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
.. include:: ../../exports/alias.include

.. _user_manual_nodes_fiware:

###########
Fiware Node
###########

This kind of node performs interaction with a `FIWARE context broker <https://fiware-orion.readthedocs.io/en/master/>`__ for handling inference data.
It provides mechanisms to read data from a context broker entity and request inference of this data from an :ref:`user_manual_nodes_inference`.
It also post the received inference to the context broker entity.
To facilitate the inference requests, the Fiware Node includes an :ref:`user_manual_nodes_edge`.

Steps
-----

* Create a new :code:`FiwareNode` object with at least a name, a server IP and a server port.
* Start the Flask server.

.. code-block:: python
server_ip = '192.168.1.1'
server_port = 1028
# Create a new Fiware Node
node = FiwareNode(name='My_Fiware_Node',
server_ip=server_ip,
server_port=server_port,
context_broker_ip='localhost',
context_broker_port=1026,
entity_id='ID_entity',
entity_data='data',
entity_solution='inference',
domain=0,
logger=CustomLogger(logger_name='FiwareNode', log_level=logging.WARNING))
# Start the Flask server
node.app.run(host=server_ip, port=server_port)
5 changes: 3 additions & 2 deletions amlip_docs/rst/user_manual/nodes/nodes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,11 @@ Node Kinds
:maxdepth: 1

agent
status
main
computing
edge
fiware
inference
main
model_manager_receiver
model_manager_sender
status
2 changes: 1 addition & 1 deletion amlip_py/amlip_py/node/FiwareNode.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def __init__(
self,
name: str,
server_ip: str,
server_port: int = 1028,
server_port: int,
context_broker_ip: str = 'localhost',
context_broker_port: int = 1026,
entity_id: str = 'ID_0',
Expand Down
5 changes: 4 additions & 1 deletion amlip_py/test/manual/fiware_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ def main():
# Get IP
hostname = socket.gethostname()
ip = socket.gethostbyname(hostname)
# Set port
port = 1028

# Create node
logger.info('Starting Manual Test Fiware Node Py execution. Creating Node...')
Expand All @@ -41,12 +43,13 @@ def main():
ip = '192.168.1.74'
fiware_node = FiwareNode(name='PyTestFiwareNode',
server_ip=ip,
server_port=port,
entity_id='ID_test',
logger=logger)
logger.info(f'FiwareNode started at ip : {ip}')

# start the Flask server
fiware_node.app.run(host=ip, port=1028)
fiware_node.app.run(host=ip, port=port)

except requests.exceptions.RequestException as e:
logger.error(f'Failed to initialize subscriptions: {e}')
Expand Down

0 comments on commit 7a0b388

Please sign in to comment.