SlideShare una empresa de Scribd logo
1 de 44
Orion Context Broker Exercises
(Basic)
Contact twitter
@fermingalan
@LeandroJGuillen
Contact email
fermin.galanmarquez@telefonica.com
leandro.guillen@imdea.org
daniel.moranjimenez@telefonica.com
Outline
•CB-1. Deploy your own Orion instance
•CB-2. Create entities using standard ops
•CB-3. Query entities using standard ops
•CB-4. Update entity using standard ops
•CB-5. Update two entities using standard ops
•CB-6. Update two attributes same entities
using standard ops
•CB-7. Create entities using conv ops
•CB-8. Query entities using conv ops
•CB-9. Update entity using conv ops
•CB-10. Browsing entity types
•CB-11. Basic subscription/notifications
•CB-12. Advanced subscription/notification
•CB-13. Expert subscription/notification
•CB-14. Get X-Auth-Token
•CB-15. Browse types at Orion Global instance
•CB-16. Query entities at Orion Global instance
•CB-17. Subscribe to public information
2
CB-1. Deploy your own Orion instance
•Prerequisite
–To have a FIWARE Lab account
•Steps
–Go to Orion catalogue page
–Follow the steps in “Deploying a dedicated GE instance
based on an image” in the “Creating Instances tab”
–Check Orion is working using the “/version” operation
from your local computer
•Hints
–Image should be orion-psb-image-R4.2, installed in all
FIWARE Lab regions. If you don’t find it ask us
–Minimum recommended size: m1.small
–Remember to set the security group properly (typically to
port 1026)
Easy
CB-1(b). Deploy your own Orion instance
•Alternative in the case you already have a
VM in FIWARE Lab and don’t want to deploy
another one
•Prerequisite
–CentOS 6.x VM
•Steps
–Set FIWARE yum repository
–Install Context Broker and MongoDB using yum
•Hints
–See Orion Admin Guide
–Remember to set the security group properly
(typically to port 1026)
Medium
CB-1(c). Deploy your own Orion instance
•Alternative, you can install in your local
computer using a pre-created VirtualBox
image
•Prerequisite
–VirtualBox installed in your computer
•Steps
–Download from bit.ly/fiware-orion-vbox
–Install the image in your VirtualBox
Easy
CB-1(d). Deploy your own Orion instance
•You can also deploy using Docker
•Prerequisite
–Docker installed in your computer
–(Optional) Docker-compose
•Steps
–Follow the instructions provided in this link.
Medium
CB-2. Create entities using standard ops
•Prerequisites
–Exercise CB-1
•Steps
–Create the following entities in your Orion
instance
•See table in next slide
•Hints
–Orion User Manual section Entity Creation
Easy
CB-2. Create entities using standard ops Easy
Entity Entity Type
Bedroom1 Room
Bedroom2 Room
Kitchen Room
Frontdoor Door
Backdoor Door
Entity Type Attr. Name Attr. Type Example value
Room Temperature float 27.8
Presence boolean true
Status string OK
Door Locked boolean false
Closed boolean false
CB-3. Query entities using standard ops
•Prerequisites
–Exercise CB-2
•Steps
–Write a program (or web/mobile application) that does
the following queries and prints the result
•Obtain all attributes of Bedroom1 entity
•Obtain only the Temperature attribute of Kitchen entity
•Obtain all attributes of Kitchen and Bedroom2 entities in
one query
•Obtain all attributes of entities that match the pattern
Bedroom.*
•Find out whether the doors are closed using the pattern
.*door and the Closed attribute
–Run and test your program/application
•Hints
–Orion User Manual section Query Context.
Easy
CB-4. Update entity using standard ops
•Prerequisites
–Exercise CB-2
•Steps
–Write a program (or web/mobile application) that
•Asks for user input (one value)
•Updates Locked attribute of Frontdoor entity using that
input
•Queries the entity and check the result
–Run and test your program/application
•Hints
–Orion User Manual section Update Context.
Easy
CB-5. Update two entities using standard ops
•Prerequisites
–Exercise CB-2
•Steps
–Write a program (or web/mobile application) that
•Asks for user input (two values)
•Updates the Temperature attribute of Beedroom1 and
Bedroom2 entities using that input with a single update
operation
•Queries the entities and check the result
–Run and test your program/application
•Hints
–Orion User Manual sections Query Context and Update
Context
Medium
CB-6. Update two attributes same entities using
standard ops
•Prerequisites
–Exercise CB-2
•Steps
–Write a program (or web/mobile application) that
•Asks for user input (two values)
•Updates the Locked and Closed attributes of Frontdoor
entity using that input with a single update operation
•Queries the entities and check the result
–Run and test your program/application
•Hints
–Orion User Manual sections Query Context and Update
Context
Medium
CB-7. Create entities using conv ops
•Prerequisites
–Exercise CB-1
•Steps
–Create the following entities in your Orion instance
•See table in next slide
•Hints
–Similar to exercise CB-2 in the standard ops set
–Orion User Manual section Convenience Entity Creation.
Easy
CB-7. Create entities using conv ops Easy
Entity Entity Type
Garage Room
Bathroom Room
Light1 Light
Light2 Light
Light3 Light
Entity Type Attr. Name Attr. Type Example value
Room Temperature float 27.8
Presence boolean true
Status string OK
Light Intensity Percent 0.25
CB-8. Query entities using conv ops
•Prerequisites
–Exercise CB-7
•Steps
–Write a program that does the following queries using
convenience operations and print the result
•Obtain all attributes of the Garage entity
•Find out whether there is anyone in the Bathroom entity
•Obtain all entities created so far
•Obtain all entities of type Room
•Obtain the temperature attribute of all entities of type
Room
–Run and test your program/application
•Hints
–Similar to exercise CB-3 in the standard ops set
–Orion User Manual section Convenience Query Context
–To get all entities of a given type, you can use the
“contextEntityType” resource
Easy
CB-9. Update entity using conv ops
•Prerequisites
–Exercise CB-7
•Steps
–Write a program (or web/mobile application) that
•Asks for user input (one value)
•Updates Intensity attribute of Light1 entity using that
input using a convenience operation
•Queries the entity and check the result
–Run and test your program/application
•Hints
–Similar to exercise CB-4 in the std ops set
–Orion User Manual sections Convenience Query Context
and Getting all entities.
Easy
CB-10. Browsing entity types
•Prerequisites
–Exercise CB-7
•Steps
–Write a program (or web/mobile application) that
•Lists all entity types
•Provides detailed information of type Door
–Run and test your program/application
•Hints
–Orion User Manual section Browsing all types and detailed
information on a type.
Easy
CB-11. Basic subscription/notifications
•Prerequisites
–Exercise CB-2
•Steps
–Write a program that
•Starts a REST server to receive notifications from Orion
•Prints the value of the Temperature attribute of
Bedroom1 entity each time a notification is received
–Subscribe your program to changes in the Temperature
attribute of Bedroom1 entity
–Update the Temperature attribute of Bedroom1 entity
and check that your program prints the updated value
•Hints
–Orion User Manual section Context Subscriptions (especially
subsection on ONCHANGE)
–Your program has to run in a machine with network access to
Orion’s to be able to send notifications
Medium
CB-12. Advanced subscription/notification
•Prerequisites
–Exercise CB-11
•Steps
–Write a program that
•Starts a REST server to receive notifications from Orion
•If the Temperature attribute of Kitchen entity is equal or greater than 30
then update the Status attribute of Kitchen entity with string TEMP_ALARM
•If the Temperature attribute of Kitchen entity is lower than 30 then update
the Status attribute of Kitchen entity with string OK
–Subscribe your program to changes in the Temperature attribute of
Kitchen entity
–Update the Temperature attribute of Kitchen entity with 20, 30, 32,
25, etc. and checks that the Status attribute is modified accordingly
•Hints
–This exercises combines subscriptions/notifications with updates
–Modify the program already developed in Exercise CB-11
–Check exercise CB-4 and/or CB-9 about updating entities
Hard
CB-13. Expert subscription/notification
•Prerequisites
–Exercise CB-11
•Steps
–Write a program that
•Starts a REST server to receive notifications from Orion
•If the Temperature attribute of Kitchen entity is greater than 30 then update the
Intensity attribute of Ligth3 entity with the current value of Intensity plus 0.10 (with a
maximum value of 1.0)
–Subscribe your program to changes in the Temperature attribute of Kitchen
entity
–Update the Temperature attribute of Kitchen entity with 20, 30, 32, 25, etc. and
checks that the Intensity attribute of Ligth3 is modified accordingly
•Hints
–This exercises combines subscriptions/notifications with queries and updates
–Modify the program already developed in Exercise CB-11
–To get the current value of Intensity attribute of Light3 your program has to do a
query operation. Check exercise CB-3 or CB-8 about querying entities
–Check exercise CB-4 and/or CB-9 about updating entities
Hard
CB-14. Get X-Auth-Token
•Prerequisites:
–To have a FIWARE Lab account
•Steps
–Use your login/password to get the token
•Hints
–Use the script described and available at Orion Quick Start.
Easy
CB-15. Browse types at Orion Global instance
•Prerequisites:
–Auth token obtained in exercise CB-14
•Steps
–Write a program (or web/mobile application) that
•Lists all entity types
•Provides detailed information of type Taxi
–Run and test your program/application
•Hints
–Orion global instance runs at orion.lab.fiware.org port 1026
–Similar to exercise CB-10 but adding the “X-Auth-Token” HTTP
header (set with the auth token)
Easy
CB-16. Query entities at Orion Global instance
•Prerequisites:
–Auth token obtained in exercise CB-14
•Steps
–Write a program (or web/mobile application) that does the
following queries and print the result
•All the attribute of entity MeteoLo (type MeteoLo)
•All the entities of type Node
•Attribute batteryCharge of entity OUTSMART.NODE_3506 (type
Node)
•All the entities of type Taxi which id ends in 7
–Run and test your program/application
•Hints
–Orion global instance runs at orion.lab.fiware.org port 1026
–Similar to exercise CB-3 and/or CB-8 but adding the “X-Auth-Token”
HTTP header (set with the auth token)
Easy
CB-17. Subscribe to public information
•Prerequisites
–Auth token obtained in exercise CB-14
•Steps
–Write a program that
•Starts a REST server to receive notifications from Orion
•Prints all the attributes of entities of type santander:device each time a notification is
received
–Subscribe your program to all attributes of every entity of type santander:device
each time TimeInstant attribute changes using throttling of 10 seconds
–Check that entities information arrives each 10 seconds and you program prints it
•Hints
–Orion global instance runs at orion.lab.fiware.org port 1026
–Orion User Manual section Context Subscriptions
–Your program has to run in a VM/machine reachable from orion.lab.fiware.org.
The port you use in the reference field in the subscription has to be open in your
security group
–Differently from exercises CB-11/12/13, you don’t need to update the subscribed
entities, as santander:devices entities are automatically update by IoT devices
interacting with the Orion global instance
Hard
Orion Context Broker Exercises
(Advanced)
Contact twitter
@fermingalan
Contact email
fermin.galanmarquez@telefonica.com
leandro.guillen@imdea.org
daniel.moranjimenez@telefonica.com
Outline
•CB-18. Pagination
•CB-19. Geolocation (factory)
•CB-20. Geolocation (cities)
•CB-21. Compound attributes
•CB-22. Query entities with compound attributes
•CB-23. Update entities with compound attributes
•CB-24. Custom metadata
•CB-25. Dynamic attributes addition/deletion
•CB-26. Multitenancy
•CB-27. Service Paths (create)
•CB-28. Service Paths (query)
•CB-29. Service Paths (update)
26
CB-18. Pagination
•Prerequisites
–Access to Orion instance running in 130.206.81.86 port
1026
•Steps
–Check how many entities of type Sensor are stored in
that Orion instance
–Write a program (or web/mobile application) that
•Asks for a limit and a page number
•Returns the name IDs the entities of type Sensor in the
corresponding page
–Run and test your program/application
•Hints
–Orion User Manual section Pagination
Medium
CB-19. Geolocation (factory)
•Prerequisites
–Access to Orion instance running in 130.206.81.86 port
1026
•Steps
–Write a program (or web/mobile application) that
•Gets all existing types
•Gets all entities of each type in areas Red, Green and Blue
(see next slide), printing entity IDs and their attributes which
their values
–Run and test your program/application
•Hints
–Orion User Manual section Geolocation
Medium
29
-33.596620, -70.666825
-33.607682, -70.670730
-33.6100089, -70.643231
-33.599194, -70.640200
CB-19. Geolocation (factory) Medium
30
-33.596620, -70.666825
-33.607682, -70.670730
-33.6100089, -70.643231
-33.599194, -70.640200
-33.603458,
-70.652788
-33.606123,
-70.653790
-33.604231,
-70.646032
-33.607108,
-70.646781
-33.602391,
-70.661781
x
200m
CB-19. Geolocation (factory) Medium
CB-20. Geolocation (cities)
•Prerequisites
–Exercise CB-1
•Steps
–Chose 2 European countries (let’s name them A and B)
–Chose 3 cities in each country
–Create one entity for each city, in the following way
•Entity ID: the name of the city
•Entity type: “City”
•The attribute “location” represent the city location (coordinates)
–Write a program (or web/mobile application) that
•Does a query to get all cities
•Does a query to get all cities in country A
•Does a query to get all cities in country B
–Run and test your program/application
•Hints
–Orion User Manual section Geolocation
–This page may help to get city coordinates: http://www.gps-
coordinates.net/
–Use polygons to model countries (the model doesn’t need to be very
precise). Google Maps may help (http://maps.google.com/)
Medium
CB-21. Compound attributes
•Prerequisites
–Exercise CB-1
•Steps
–Create the following entities in your Orion instance
•See table in next slide
•Hints
–Orion User Manual section Structure Attribute Values
Medium
CB-21. Compound attributes
Entity Type Attr. Name Attr. Type Example value
Character Name string Fooy
Hitpoints integer 110
Class string Barbarian
Abilities compound {
"STR": "2",
"DEX": "4",
"CON": "3",
"INT": "1",
"WIS": "1",
"CHA": "2"
}
Inventory compound {
"weapons": [ "sword", "dagger" ],
"potions": { "life": "1", "mana": "0" },
"other": ["shield"]
}
Entity name Entity Type
Gandalf Character
Aragorn Character
Frodo Character
Medium
CB-22. Query entities with compound attributes
•Prerequisites
–Exercise CB-21
•Steps
–Write a program (or web/mobile application) that does
the following queries and print the result
•Obtain all attributes of Aragorn entity
•Obtain only the Abilities attribute of Frodo entity
–Run and test your program/application
•Hints
–Orion User Manual section Structure Attribute Values
Medium
CB-23. Update entities with compound attributes
•Prerequisites
–Exercise CB-21
•Steps
–Write a program (or web/mobile application) that
•Asks for an object name (e.g. “staff”, “hat”, etc.)
•Updates Gandalf's Inventory attribute to reflect that he
now has a that object test your program
–Run and test your program/application
•Query the Gandalf's Inventory after that, in order to check
that the object has been successfully added
•Hints
–Orion User Manual section Structure Attribute Values
Medium
CB-24. Custom metadata Medium
•Prerequisites
–Exercise CB-21
•Steps
–Update the Gandalf entity so that the inventory
attribute has two new metadatas:
•name="Weight", type="float", value="1.2"
•name="MaxWeight", type="float", value="20"
–Query Gandalf again to see the new metadata atached
to the corresponding attribute
•Hints
–Orion User Manual section Attribute metadata
CB-25. Dynamic attributes addition/deletion
•Prerequisites
–Exercise CB-1
•Steps
–Create the following initial entity
•Entity ID: Car1
•Entity Type: Car
•Initial attribute: name=Speed, type=integer, value=70
–Write a program (or web/mobile application) that
•Asks for an operation type (ADD or DELETE)
•If user chose ADD
–Ask for an attribute name, type and value
–Do a query to Orion to check that no other attributes with the same name exists in the entity
(in positive case, exit informing the user about the problem)
–Create the new attribute at the entity
•If user chose DELETE
–Ask for an attribute name
–Do a query to Orion to check that an attributes with that name exists in the entity (in
negative case, exit informing the user about the problem)
–Delete the attribute at the entity
–Run and test your program/application
•Query your entity to check that the attributes are added and deleted as expected
•Hints
–Orion User Manual section Adding and removing attributes and entities
Hard
CB-26. Multitenancy
•Prerequisites
–Exercise CB-1
•Steps
–Write a program (or web/mobile application) that
•Creates the following entities in your Orion instance at tenant
"Customer1"
–See table in next slide
•Creates the following entities in your Orion instance at tenant
"Customer2"
–See table in next slide
–Query for the Hammer entity using Customer1 and Customer2
as Fiware-Service alternatively, checking that the result is the
right one for the given tenant
•Hints
–Orion User Manual section Multitenancy
–Orion has to be configured to run with multitenancy enabled
•BROKER_EXTRA_OPS="-multiservice" at
/etc/sysconfig/contextBroker
Medium
CB-26. Multitenancy
Entity Type Attr. Name Attr. Type Example value
Tool stock integer 1234
Tenant Entity Name Stock attribute value
Customer1 Hammer 40
Screwdriver 23
Pliers 12
Ducktape 13
Customer2 HeatGun 109
Pliers 832
Hammer 646
Screwdriver 301
Hard
CB-27. Service Paths (create)
•Prerequisites
–Exercise CB-1
•Steps
–Create the following entities
•See table in next page
•Keep in mind that they have to use Service Paths according to the
figure
•Hints
–Orion User Manual section Entity Service Paths
Hard
CB-27. Service Paths (create)
Entity Type Attr. Name Attr. Type Example value
Laptop owner string Bob
MobilePhone owner string Alice
Company
Sales Dept.
phone1
owner: Dave
phone2
owner: Alice
laptop1
owner: Alice
TechSupport
Dept.
laptop2
owner: Charlie
laptop3
owner: Bob
phone3
owner: Bob
Service Path ¨Fiware-ServicePath¨ header value
Company /company
Sales Department /company/sales
Tech Support Department /company/tech
Hard
CB-28. Service Paths (query)
•Prerequisites
–Exercise CB-27
•Steps
–Write a program (or web/mobile application) that does the
following queries and prints the result
•Query all phones in the company
•Query all laptops in the Tech Support department
–Run and test your program/application
•Hints
–Orion User Manual section Entity Service Paths
Medium
CB-29. Service Paths (update)
•Prerequisites
–Exercise CB-27
•Steps
–Write a program (or web/mobile application) that does the
following
•Since Charlie left the Company he has to give back his laptop.
Update entity laptop2's owner attribute and set it to "nobody".
•Create a new entity phone3 of type MobilePhone in the sales
department and set the owner attribute to "Alice" (she needs two
phones, she works a lot). Notice that as a result of this there will be
two entities with the same id in different Service Paths.
–Run and test your program/application
•Query entity phone3 and see which one you get when querying
with the following service paths
–The Sales department
–the Tech Support department
–All the company
•Hints
–Orion User Manual section Entity Service Paths
Hard
Thanks!Thanks!
(Number to manuals sections in this presentation are valid at time of writing this –March 9th 2015-, but they may
change along time)

Más contenido relacionado

La actualidad más candente

Windows iot barone
Windows iot baroneWindows iot barone
Windows iot barone
DotNetCampus
 

La actualidad más candente (20)

Part 5 of the REAL Webinars on Oracle Cloud Native Application Development - ...
Part 5 of the REAL Webinars on Oracle Cloud Native Application Development - ...Part 5 of the REAL Webinars on Oracle Cloud Native Application Development - ...
Part 5 of the REAL Webinars on Oracle Cloud Native Application Development - ...
 
Durable Functions vs Logic App : la guerra dei workflow!!
Durable Functions vs Logic App : la guerra dei workflow!!Durable Functions vs Logic App : la guerra dei workflow!!
Durable Functions vs Logic App : la guerra dei workflow!!
 
Stateful patterns in Azure Functions
Stateful patterns in Azure FunctionsStateful patterns in Azure Functions
Stateful patterns in Azure Functions
 
FIWARE Developers Week_Kurent_exercises
FIWARE Developers Week_Kurent_exercisesFIWARE Developers Week_Kurent_exercises
FIWARE Developers Week_Kurent_exercises
 
Federating new FIWARE Lab nodes
Federating new FIWARE Lab nodesFederating new FIWARE Lab nodes
Federating new FIWARE Lab nodes
 
Microservices Platform with Spring Boot, Spring Cloud Config, Spring Cloud Ne...
Microservices Platform with Spring Boot, Spring Cloud Config, Spring Cloud Ne...Microservices Platform with Spring Boot, Spring Cloud Config, Spring Cloud Ne...
Microservices Platform with Spring Boot, Spring Cloud Config, Spring Cloud Ne...
 
FIWARE Developers Week_BootcampWeBUI_presentation1
FIWARE Developers Week_BootcampWeBUI_presentation1FIWARE Developers Week_BootcampWeBUI_presentation1
FIWARE Developers Week_BootcampWeBUI_presentation1
 
Building and running Spring Cloud-based microservices on AWS ECS
Building and running Spring Cloud-based microservices on AWS ECSBuilding and running Spring Cloud-based microservices on AWS ECS
Building and running Spring Cloud-based microservices on AWS ECS
 
Flare: an overview
Flare: an overviewFlare: an overview
Flare: an overview
 
Windows iot barone
Windows iot baroneWindows iot barone
Windows iot barone
 
Spring cloud Service-Discovery
Spring cloud Service-DiscoverySpring cloud Service-Discovery
Spring cloud Service-Discovery
 
Using fiware lab cloud
Using fiware lab cloudUsing fiware lab cloud
Using fiware lab cloud
 
2016 - Easing Your Way Into Docker: Lessons From a Journey to Production
2016 - Easing Your Way Into Docker: Lessons From a Journey to Production2016 - Easing Your Way Into Docker: Lessons From a Journey to Production
2016 - Easing Your Way Into Docker: Lessons From a Journey to Production
 
It depends: Loving .NET Core dependency injection or not
It depends: Loving .NET Core dependency injection or notIt depends: Loving .NET Core dependency injection or not
It depends: Loving .NET Core dependency injection or not
 
IoT in salsa Serverless
IoT in salsa ServerlessIoT in salsa Serverless
IoT in salsa Serverless
 
Evolution of the REST API
Evolution of the REST APIEvolution of the REST API
Evolution of the REST API
 
Azure Durable Functions (2018-06-13)
Azure Durable Functions (2018-06-13)Azure Durable Functions (2018-06-13)
Azure Durable Functions (2018-06-13)
 
Logging, tracing and metrics: Instrumentation in .NET 5 and Azure
Logging, tracing and metrics: Instrumentation in .NET 5 and AzureLogging, tracing and metrics: Instrumentation in .NET 5 and Azure
Logging, tracing and metrics: Instrumentation in .NET 5 and Azure
 
OSMC 2021 | Contributing to open source with the example of icinga (1)
OSMC 2021 | Contributing to open source with the example of icinga (1)OSMC 2021 | Contributing to open source with the example of icinga (1)
OSMC 2021 | Contributing to open source with the example of icinga (1)
 
FIWARE and FIWARE Lab service offer
FIWARE and FIWARE Lab service offerFIWARE and FIWARE Lab service offer
FIWARE and FIWARE Lab service offer
 

Destacado

Orion Context Broker workshop (CPMX5)
Orion Context Broker workshop (CPMX5)Orion Context Broker workshop (CPMX5)
Orion Context Broker workshop (CPMX5)
Fermin Galan
 
Conecta con la Internet de las Cosas desde FI-WARE, mención 1
Conecta con la Internet de las Cosas desde FI-WARE, mención 1Conecta con la Internet de las Cosas desde FI-WARE, mención 1
Conecta con la Internet de las Cosas desde FI-WARE, mención 1
Fermin Galan
 
Setting up your virtual infrastructure using fi lab cloud
Setting up your virtual infrastructure using fi lab cloudSetting up your virtual infrastructure using fi lab cloud
Setting up your virtual infrastructure using fi lab cloud
Henar Muñoz Frutos
 
Developing your first application using FI-WARE
Developing your first application using FI-WAREDeveloping your first application using FI-WARE
Developing your first application using FI-WARE
Fermin Galan
 
context aware computing
context aware computingcontext aware computing
context aware computing
swati sonawane
 

Destacado (20)

Orion Context Broker Webminar
Orion Context Broker WebminarOrion Context Broker Webminar
Orion Context Broker Webminar
 
Introduction to FIWARE Cloud & Context Broker
Introduction to FIWARE Cloud & Context BrokerIntroduction to FIWARE Cloud & Context Broker
Introduction to FIWARE Cloud & Context Broker
 
FIWARE: Managing Context Information at large scale
FIWARE: Managing Context Information at large scaleFIWARE: Managing Context Information at large scale
FIWARE: Managing Context Information at large scale
 
Orion Context Broker
Orion Context Broker Orion Context Broker
Orion Context Broker
 
FIWARE Context Broker
FIWARE Context BrokerFIWARE Context Broker
FIWARE Context Broker
 
Orion Context Broker workshop (CPMX5)
Orion Context Broker workshop (CPMX5)Orion Context Broker workshop (CPMX5)
Orion Context Broker workshop (CPMX5)
 
FIWARE Developers Week_IoT basic exercises
FIWARE Developers Week_IoT basic exercisesFIWARE Developers Week_IoT basic exercises
FIWARE Developers Week_IoT basic exercises
 
Fi ware, fi-lab e il trentino
Fi ware, fi-lab e il trentinoFi ware, fi-lab e il trentino
Fi ware, fi-lab e il trentino
 
Conecta con la Internet de las Cosas desde FI-WARE, mención 1
Conecta con la Internet de las Cosas desde FI-WARE, mención 1Conecta con la Internet de las Cosas desde FI-WARE, mención 1
Conecta con la Internet de las Cosas desde FI-WARE, mención 1
 
FIWARE: Managing Context Information at Large Scale (NGSIv1)
FIWARE: Managing Context Information at Large Scale (NGSIv1)FIWARE: Managing Context Information at Large Scale (NGSIv1)
FIWARE: Managing Context Information at Large Scale (NGSIv1)
 
Setting up your virtual infrastructure using fi lab cloud
Setting up your virtual infrastructure using fi lab cloudSetting up your virtual infrastructure using fi lab cloud
Setting up your virtual infrastructure using fi lab cloud
 
NGSIv2 Overview for Developers That Already Know NGSIv1
NGSIv2 Overview for Developers That Already Know NGSIv1NGSIv2 Overview for Developers That Already Know NGSIv1
NGSIv2 Overview for Developers That Already Know NGSIv1
 
Fiware IoT_intro&scenarios
Fiware IoT_intro&scenariosFiware IoT_intro&scenarios
Fiware IoT_intro&scenarios
 
Context-aware application development with FIWARE #CPBR8
Context-aware application development with FIWARE #CPBR8Context-aware application development with FIWARE #CPBR8
Context-aware application development with FIWARE #CPBR8
 
Developing your first application using FI-WARE
Developing your first application using FI-WAREDeveloping your first application using FI-WARE
Developing your first application using FI-WARE
 
Welcome to the 1st FIWARE Summit
Welcome to the 1st FIWARE SummitWelcome to the 1st FIWARE Summit
Welcome to the 1st FIWARE Summit
 
Aplicación práctica de FIWARE al Internet de las Cosas
Aplicación práctica de FIWARE al Internet de las CosasAplicación práctica de FIWARE al Internet de las Cosas
Aplicación práctica de FIWARE al Internet de las Cosas
 
Fiware IoT_IDAS_intro_ul20_v2
Fiware IoT_IDAS_intro_ul20_v2Fiware IoT_IDAS_intro_ul20_v2
Fiware IoT_IDAS_intro_ul20_v2
 
FIWARE: Enabling innovative business models and the economy of data in cities
FIWARE: Enabling innovative business models and the economy of data in citiesFIWARE: Enabling innovative business models and the economy of data in cities
FIWARE: Enabling innovative business models and the economy of data in cities
 
context aware computing
context aware computingcontext aware computing
context aware computing
 

Similar a Orion Context Broker Exercises

Divide and stress: the journey to component load test
Divide and stress: the journey to component load testDivide and stress: the journey to component load test
Divide and stress: the journey to component load test
Juan Pedro Escalona Rueda
 
Oracle forms les16
Oracle forms  les16Oracle forms  les16
Oracle forms les16
Abed Othman
 

Similar a Orion Context Broker Exercises (20)

Orion Context Broker Exercises (Part 1)
Orion Context Broker Exercises (Part 1)Orion Context Broker Exercises (Part 1)
Orion Context Broker Exercises (Part 1)
 
Build a bot hands on snowforce19
Build a bot hands on snowforce19Build a bot hands on snowforce19
Build a bot hands on snowforce19
 
Divide and stress: the journey to component load test
Divide and stress: the journey to component load testDivide and stress: the journey to component load test
Divide and stress: the journey to component load test
 
Android pro tips trilogy
Android  pro tips trilogyAndroid  pro tips trilogy
Android pro tips trilogy
 
Fiware Developers Week Iot exercises (Advanced)
Fiware Developers Week Iot exercises (Advanced)Fiware Developers Week Iot exercises (Advanced)
Fiware Developers Week Iot exercises (Advanced)
 
觀察者模式
觀察者模式 觀察者模式
觀察者模式
 
Oracle forms les16
Oracle forms  les16Oracle forms  les16
Oracle forms les16
 
Continuous delivery for native apps
Continuous delivery for native appsContinuous delivery for native apps
Continuous delivery for native apps
 
API Testing Presentations.pptx
API Testing Presentations.pptxAPI Testing Presentations.pptx
API Testing Presentations.pptx
 
React Native Firebase
React Native FirebaseReact Native Firebase
React Native Firebase
 
4Developers 2018: Zero-Downtime deployments with Kubernetes (Mateusz Dymiński)
4Developers 2018: Zero-Downtime deployments with Kubernetes (Mateusz Dymiński)4Developers 2018: Zero-Downtime deployments with Kubernetes (Mateusz Dymiński)
4Developers 2018: Zero-Downtime deployments with Kubernetes (Mateusz Dymiński)
 
Deploy, Scale and Manage your Application with AWS Elastic Beanstalk
Deploy, Scale and Manage your Application with AWS Elastic BeanstalkDeploy, Scale and Manage your Application with AWS Elastic Beanstalk
Deploy, Scale and Manage your Application with AWS Elastic Beanstalk
 
Kubernetes deep dive - - Huawei 2015-10
Kubernetes deep dive - - Huawei 2015-10Kubernetes deep dive - - Huawei 2015-10
Kubernetes deep dive - - Huawei 2015-10
 
[Advantech] WebOP designer Tutorial step by step
[Advantech] WebOP designer Tutorial step by step [Advantech] WebOP designer Tutorial step by step
[Advantech] WebOP designer Tutorial step by step
 
Migrating IBM Cloud Orchestrator environment from v2.4.0.2 to v2.5.0.1
Migrating IBM Cloud Orchestrator environment from v2.4.0.2 to v2.5.0.1Migrating IBM Cloud Orchestrator environment from v2.4.0.2 to v2.5.0.1
Migrating IBM Cloud Orchestrator environment from v2.4.0.2 to v2.5.0.1
 
Better Data with Machine Learning and Serverless
Better Data with Machine Learning and ServerlessBetter Data with Machine Learning and Serverless
Better Data with Machine Learning and Serverless
 
Uncovering breaking changes behind UI on mobile applications
Uncovering breaking changes behind UI on mobile applicationsUncovering breaking changes behind UI on mobile applications
Uncovering breaking changes behind UI on mobile applications
 
Functional_Testing_Part-1
Functional_Testing_Part-1Functional_Testing_Part-1
Functional_Testing_Part-1
 
AWS re:Invent 2013 - MBL303 Gaming Ops - Running High-performance Ops for Mob...
AWS re:Invent 2013 - MBL303 Gaming Ops - Running High-performance Ops for Mob...AWS re:Invent 2013 - MBL303 Gaming Ops - Running High-performance Ops for Mob...
AWS re:Invent 2013 - MBL303 Gaming Ops - Running High-performance Ops for Mob...
 
React-Native Lecture 11: In App Storage
React-Native Lecture 11: In App StorageReact-Native Lecture 11: In App Storage
React-Native Lecture 11: In App Storage
 

Más de Fermin Galan

Más de Fermin Galan (20)

Orion Context Broker introduction 20240227
Orion Context Broker introduction 20240227Orion Context Broker introduction 20240227
Orion Context Broker introduction 20240227
 
Orion Context Broker introduction 20240115
Orion Context Broker introduction 20240115Orion Context Broker introduction 20240115
Orion Context Broker introduction 20240115
 
Orion Context Broker 20230606
Orion Context Broker 20230606Orion Context Broker 20230606
Orion Context Broker 20230606
 
Orion Context Broker 20230602
Orion Context Broker 20230602Orion Context Broker 20230602
Orion Context Broker 20230602
 
Orion Context Broker 20221220
Orion Context Broker 20221220Orion Context Broker 20221220
Orion Context Broker 20221220
 
Orion Context Broker NGSI-v2 Overview for Developers That Already Know NGSI-v...
Orion Context Broker NGSI-v2 Overview for Developers That Already Know NGSI-v...Orion Context Broker NGSI-v2 Overview for Developers That Already Know NGSI-v...
Orion Context Broker NGSI-v2 Overview for Developers That Already Know NGSI-v...
 
Orion Context Broker 20220526
Orion Context Broker 20220526Orion Context Broker 20220526
Orion Context Broker 20220526
 
Orion Context Broker NGSI-v2 Overview for Developers That Already Know NGSI-v...
Orion Context Broker NGSI-v2 Overview for Developers That Already Know NGSI-v...Orion Context Broker NGSI-v2 Overview for Developers That Already Know NGSI-v...
Orion Context Broker NGSI-v2 Overview for Developers That Already Know NGSI-v...
 
Orion Context Broker 20220301
Orion Context Broker 20220301Orion Context Broker 20220301
Orion Context Broker 20220301
 
Orion Context Broker 20220127
Orion Context Broker 20220127Orion Context Broker 20220127
Orion Context Broker 20220127
 
Orion Context Broker NGSI-v2 Overview for Developers That Already Know NGSI-v...
Orion Context Broker NGSI-v2 Overview for Developers That Already Know NGSI-v...Orion Context Broker NGSI-v2 Overview for Developers That Already Know NGSI-v...
Orion Context Broker NGSI-v2 Overview for Developers That Already Know NGSI-v...
 
Orion Context Broker NGSI-v2 Overview for Developers That Already Know NGSI-v...
Orion Context Broker NGSI-v2 Overview for Developers That Already Know NGSI-v...Orion Context Broker NGSI-v2 Overview for Developers That Already Know NGSI-v...
Orion Context Broker NGSI-v2 Overview for Developers That Already Know NGSI-v...
 
Orion Context Broker 20211209
Orion Context Broker 20211209Orion Context Broker 20211209
Orion Context Broker 20211209
 
Orion Context Broker NGSI-v2 Overview for Developers That Already Know NGSI-v...
Orion Context Broker NGSI-v2 Overview for Developers That Already Know NGSI-v...Orion Context Broker NGSI-v2 Overview for Developers That Already Know NGSI-v...
Orion Context Broker NGSI-v2 Overview for Developers That Already Know NGSI-v...
 
Orion Context Broker 20211022
Orion Context Broker 20211022Orion Context Broker 20211022
Orion Context Broker 20211022
 
Orion Context Broker NGSI-v2 Overview for Developers That Already Know NGSI-v...
Orion Context Broker NGSI-v2 Overview for Developers That Already Know NGSI-v...Orion Context Broker NGSI-v2 Overview for Developers That Already Know NGSI-v...
Orion Context Broker NGSI-v2 Overview for Developers That Already Know NGSI-v...
 
Orion Context Broker 20210907
Orion Context Broker 20210907Orion Context Broker 20210907
Orion Context Broker 20210907
 
Orion Context Broker NGSI-v2 Overview for Developers That Already Know NGSI-v...
Orion Context Broker NGSI-v2 Overview for Developers That Already Know NGSI-v...Orion Context Broker NGSI-v2 Overview for Developers That Already Know NGSI-v...
Orion Context Broker NGSI-v2 Overview for Developers That Already Know NGSI-v...
 
Orion Context Broker 20210602
Orion Context Broker 20210602Orion Context Broker 20210602
Orion Context Broker 20210602
 
Orion Context Broker NGSI-v2 Overview for Developers That Already Know Ngsi-v...
Orion Context Broker NGSI-v2 Overview for Developers That Already Know Ngsi-v...Orion Context Broker NGSI-v2 Overview for Developers That Already Know Ngsi-v...
Orion Context Broker NGSI-v2 Overview for Developers That Already Know Ngsi-v...
 

Último

ppt your views.ppt your views of your college in your eyes
ppt your views.ppt your views of your college in your eyesppt your views.ppt your views of your college in your eyes
ppt your views.ppt your views of your college in your eyes
ashishpaul799
 
IATP How-to Foreign Travel May 2024.pdff
IATP How-to Foreign Travel May 2024.pdffIATP How-to Foreign Travel May 2024.pdff
IATP How-to Foreign Travel May 2024.pdff
17thcssbs2
 
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
中 央社
 

Último (20)

An Overview of the Odoo 17 Discuss App.pptx
An Overview of the Odoo 17 Discuss App.pptxAn Overview of the Odoo 17 Discuss App.pptx
An Overview of the Odoo 17 Discuss App.pptx
 
Features of Video Calls in the Discuss Module in Odoo 17
Features of Video Calls in the Discuss Module in Odoo 17Features of Video Calls in the Discuss Module in Odoo 17
Features of Video Calls in the Discuss Module in Odoo 17
 
Operations Management - Book1.p - Dr. Abdulfatah A. Salem
Operations Management - Book1.p  - Dr. Abdulfatah A. SalemOperations Management - Book1.p  - Dr. Abdulfatah A. Salem
Operations Management - Book1.p - Dr. Abdulfatah A. Salem
 
ppt your views.ppt your views of your college in your eyes
ppt your views.ppt your views of your college in your eyesppt your views.ppt your views of your college in your eyes
ppt your views.ppt your views of your college in your eyes
 
REPRODUCTIVE TOXICITY STUDIE OF MALE AND FEMALEpptx
REPRODUCTIVE TOXICITY  STUDIE OF MALE AND FEMALEpptxREPRODUCTIVE TOXICITY  STUDIE OF MALE AND FEMALEpptx
REPRODUCTIVE TOXICITY STUDIE OF MALE AND FEMALEpptx
 
Post Exam Fun(da) Intra UEM General Quiz 2024 - Prelims q&a.pdf
Post Exam Fun(da) Intra UEM General Quiz 2024 - Prelims q&a.pdfPost Exam Fun(da) Intra UEM General Quiz 2024 - Prelims q&a.pdf
Post Exam Fun(da) Intra UEM General Quiz 2024 - Prelims q&a.pdf
 
IATP How-to Foreign Travel May 2024.pdff
IATP How-to Foreign Travel May 2024.pdffIATP How-to Foreign Travel May 2024.pdff
IATP How-to Foreign Travel May 2024.pdff
 
Removal Strategy _ FEFO _ Working with Perishable Products in Odoo 17
Removal Strategy _ FEFO _ Working with Perishable Products in Odoo 17Removal Strategy _ FEFO _ Working with Perishable Products in Odoo 17
Removal Strategy _ FEFO _ Working with Perishable Products in Odoo 17
 
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
 
Morse OER Some Benefits and Challenges.pptx
Morse OER Some Benefits and Challenges.pptxMorse OER Some Benefits and Challenges.pptx
Morse OER Some Benefits and Challenges.pptx
 
How to Manage Notification Preferences in the Odoo 17
How to Manage Notification Preferences in the Odoo 17How to Manage Notification Preferences in the Odoo 17
How to Manage Notification Preferences in the Odoo 17
 
Open Educational Resources Primer PowerPoint
Open Educational Resources Primer PowerPointOpen Educational Resources Primer PowerPoint
Open Educational Resources Primer PowerPoint
 
Navigating the Misinformation Minefield: The Role of Higher Education in the ...
Navigating the Misinformation Minefield: The Role of Higher Education in the ...Navigating the Misinformation Minefield: The Role of Higher Education in the ...
Navigating the Misinformation Minefield: The Role of Higher Education in the ...
 
Capitol Tech Univ Doctoral Presentation -May 2024
Capitol Tech Univ Doctoral Presentation -May 2024Capitol Tech Univ Doctoral Presentation -May 2024
Capitol Tech Univ Doctoral Presentation -May 2024
 
Essential Safety precautions during monsoon season
Essential Safety precautions during monsoon seasonEssential Safety precautions during monsoon season
Essential Safety precautions during monsoon season
 
Application of Matrices in real life. Presentation on application of matrices
Application of Matrices in real life. Presentation on application of matricesApplication of Matrices in real life. Presentation on application of matrices
Application of Matrices in real life. Presentation on application of matrices
 
Behavioral-sciences-dr-mowadat rana (1).pdf
Behavioral-sciences-dr-mowadat rana (1).pdfBehavioral-sciences-dr-mowadat rana (1).pdf
Behavioral-sciences-dr-mowadat rana (1).pdf
 
How to Manage Closest Location in Odoo 17 Inventory
How to Manage Closest Location in Odoo 17 InventoryHow to Manage Closest Location in Odoo 17 Inventory
How to Manage Closest Location in Odoo 17 Inventory
 
MichaelStarkes_UncutGemsProjectSummary.pdf
MichaelStarkes_UncutGemsProjectSummary.pdfMichaelStarkes_UncutGemsProjectSummary.pdf
MichaelStarkes_UncutGemsProjectSummary.pdf
 
Basic Civil Engineering notes on Transportation Engineering, Modes of Transpo...
Basic Civil Engineering notes on Transportation Engineering, Modes of Transpo...Basic Civil Engineering notes on Transportation Engineering, Modes of Transpo...
Basic Civil Engineering notes on Transportation Engineering, Modes of Transpo...
 

Orion Context Broker Exercises

  • 1. Orion Context Broker Exercises (Basic) Contact twitter @fermingalan @LeandroJGuillen Contact email fermin.galanmarquez@telefonica.com leandro.guillen@imdea.org daniel.moranjimenez@telefonica.com
  • 2. Outline •CB-1. Deploy your own Orion instance •CB-2. Create entities using standard ops •CB-3. Query entities using standard ops •CB-4. Update entity using standard ops •CB-5. Update two entities using standard ops •CB-6. Update two attributes same entities using standard ops •CB-7. Create entities using conv ops •CB-8. Query entities using conv ops •CB-9. Update entity using conv ops •CB-10. Browsing entity types •CB-11. Basic subscription/notifications •CB-12. Advanced subscription/notification •CB-13. Expert subscription/notification •CB-14. Get X-Auth-Token •CB-15. Browse types at Orion Global instance •CB-16. Query entities at Orion Global instance •CB-17. Subscribe to public information 2
  • 3. CB-1. Deploy your own Orion instance •Prerequisite –To have a FIWARE Lab account •Steps –Go to Orion catalogue page –Follow the steps in “Deploying a dedicated GE instance based on an image” in the “Creating Instances tab” –Check Orion is working using the “/version” operation from your local computer •Hints –Image should be orion-psb-image-R4.2, installed in all FIWARE Lab regions. If you don’t find it ask us –Minimum recommended size: m1.small –Remember to set the security group properly (typically to port 1026) Easy
  • 4. CB-1(b). Deploy your own Orion instance •Alternative in the case you already have a VM in FIWARE Lab and don’t want to deploy another one •Prerequisite –CentOS 6.x VM •Steps –Set FIWARE yum repository –Install Context Broker and MongoDB using yum •Hints –See Orion Admin Guide –Remember to set the security group properly (typically to port 1026) Medium
  • 5. CB-1(c). Deploy your own Orion instance •Alternative, you can install in your local computer using a pre-created VirtualBox image •Prerequisite –VirtualBox installed in your computer •Steps –Download from bit.ly/fiware-orion-vbox –Install the image in your VirtualBox Easy
  • 6. CB-1(d). Deploy your own Orion instance •You can also deploy using Docker •Prerequisite –Docker installed in your computer –(Optional) Docker-compose •Steps –Follow the instructions provided in this link. Medium
  • 7. CB-2. Create entities using standard ops •Prerequisites –Exercise CB-1 •Steps –Create the following entities in your Orion instance •See table in next slide •Hints –Orion User Manual section Entity Creation Easy
  • 8. CB-2. Create entities using standard ops Easy Entity Entity Type Bedroom1 Room Bedroom2 Room Kitchen Room Frontdoor Door Backdoor Door Entity Type Attr. Name Attr. Type Example value Room Temperature float 27.8 Presence boolean true Status string OK Door Locked boolean false Closed boolean false
  • 9. CB-3. Query entities using standard ops •Prerequisites –Exercise CB-2 •Steps –Write a program (or web/mobile application) that does the following queries and prints the result •Obtain all attributes of Bedroom1 entity •Obtain only the Temperature attribute of Kitchen entity •Obtain all attributes of Kitchen and Bedroom2 entities in one query •Obtain all attributes of entities that match the pattern Bedroom.* •Find out whether the doors are closed using the pattern .*door and the Closed attribute –Run and test your program/application •Hints –Orion User Manual section Query Context. Easy
  • 10. CB-4. Update entity using standard ops •Prerequisites –Exercise CB-2 •Steps –Write a program (or web/mobile application) that •Asks for user input (one value) •Updates Locked attribute of Frontdoor entity using that input •Queries the entity and check the result –Run and test your program/application •Hints –Orion User Manual section Update Context. Easy
  • 11. CB-5. Update two entities using standard ops •Prerequisites –Exercise CB-2 •Steps –Write a program (or web/mobile application) that •Asks for user input (two values) •Updates the Temperature attribute of Beedroom1 and Bedroom2 entities using that input with a single update operation •Queries the entities and check the result –Run and test your program/application •Hints –Orion User Manual sections Query Context and Update Context Medium
  • 12. CB-6. Update two attributes same entities using standard ops •Prerequisites –Exercise CB-2 •Steps –Write a program (or web/mobile application) that •Asks for user input (two values) •Updates the Locked and Closed attributes of Frontdoor entity using that input with a single update operation •Queries the entities and check the result –Run and test your program/application •Hints –Orion User Manual sections Query Context and Update Context Medium
  • 13. CB-7. Create entities using conv ops •Prerequisites –Exercise CB-1 •Steps –Create the following entities in your Orion instance •See table in next slide •Hints –Similar to exercise CB-2 in the standard ops set –Orion User Manual section Convenience Entity Creation. Easy
  • 14. CB-7. Create entities using conv ops Easy Entity Entity Type Garage Room Bathroom Room Light1 Light Light2 Light Light3 Light Entity Type Attr. Name Attr. Type Example value Room Temperature float 27.8 Presence boolean true Status string OK Light Intensity Percent 0.25
  • 15. CB-8. Query entities using conv ops •Prerequisites –Exercise CB-7 •Steps –Write a program that does the following queries using convenience operations and print the result •Obtain all attributes of the Garage entity •Find out whether there is anyone in the Bathroom entity •Obtain all entities created so far •Obtain all entities of type Room •Obtain the temperature attribute of all entities of type Room –Run and test your program/application •Hints –Similar to exercise CB-3 in the standard ops set –Orion User Manual section Convenience Query Context –To get all entities of a given type, you can use the “contextEntityType” resource Easy
  • 16. CB-9. Update entity using conv ops •Prerequisites –Exercise CB-7 •Steps –Write a program (or web/mobile application) that •Asks for user input (one value) •Updates Intensity attribute of Light1 entity using that input using a convenience operation •Queries the entity and check the result –Run and test your program/application •Hints –Similar to exercise CB-4 in the std ops set –Orion User Manual sections Convenience Query Context and Getting all entities. Easy
  • 17. CB-10. Browsing entity types •Prerequisites –Exercise CB-7 •Steps –Write a program (or web/mobile application) that •Lists all entity types •Provides detailed information of type Door –Run and test your program/application •Hints –Orion User Manual section Browsing all types and detailed information on a type. Easy
  • 18. CB-11. Basic subscription/notifications •Prerequisites –Exercise CB-2 •Steps –Write a program that •Starts a REST server to receive notifications from Orion •Prints the value of the Temperature attribute of Bedroom1 entity each time a notification is received –Subscribe your program to changes in the Temperature attribute of Bedroom1 entity –Update the Temperature attribute of Bedroom1 entity and check that your program prints the updated value •Hints –Orion User Manual section Context Subscriptions (especially subsection on ONCHANGE) –Your program has to run in a machine with network access to Orion’s to be able to send notifications Medium
  • 19. CB-12. Advanced subscription/notification •Prerequisites –Exercise CB-11 •Steps –Write a program that •Starts a REST server to receive notifications from Orion •If the Temperature attribute of Kitchen entity is equal or greater than 30 then update the Status attribute of Kitchen entity with string TEMP_ALARM •If the Temperature attribute of Kitchen entity is lower than 30 then update the Status attribute of Kitchen entity with string OK –Subscribe your program to changes in the Temperature attribute of Kitchen entity –Update the Temperature attribute of Kitchen entity with 20, 30, 32, 25, etc. and checks that the Status attribute is modified accordingly •Hints –This exercises combines subscriptions/notifications with updates –Modify the program already developed in Exercise CB-11 –Check exercise CB-4 and/or CB-9 about updating entities Hard
  • 20. CB-13. Expert subscription/notification •Prerequisites –Exercise CB-11 •Steps –Write a program that •Starts a REST server to receive notifications from Orion •If the Temperature attribute of Kitchen entity is greater than 30 then update the Intensity attribute of Ligth3 entity with the current value of Intensity plus 0.10 (with a maximum value of 1.0) –Subscribe your program to changes in the Temperature attribute of Kitchen entity –Update the Temperature attribute of Kitchen entity with 20, 30, 32, 25, etc. and checks that the Intensity attribute of Ligth3 is modified accordingly •Hints –This exercises combines subscriptions/notifications with queries and updates –Modify the program already developed in Exercise CB-11 –To get the current value of Intensity attribute of Light3 your program has to do a query operation. Check exercise CB-3 or CB-8 about querying entities –Check exercise CB-4 and/or CB-9 about updating entities Hard
  • 21. CB-14. Get X-Auth-Token •Prerequisites: –To have a FIWARE Lab account •Steps –Use your login/password to get the token •Hints –Use the script described and available at Orion Quick Start. Easy
  • 22. CB-15. Browse types at Orion Global instance •Prerequisites: –Auth token obtained in exercise CB-14 •Steps –Write a program (or web/mobile application) that •Lists all entity types •Provides detailed information of type Taxi –Run and test your program/application •Hints –Orion global instance runs at orion.lab.fiware.org port 1026 –Similar to exercise CB-10 but adding the “X-Auth-Token” HTTP header (set with the auth token) Easy
  • 23. CB-16. Query entities at Orion Global instance •Prerequisites: –Auth token obtained in exercise CB-14 •Steps –Write a program (or web/mobile application) that does the following queries and print the result •All the attribute of entity MeteoLo (type MeteoLo) •All the entities of type Node •Attribute batteryCharge of entity OUTSMART.NODE_3506 (type Node) •All the entities of type Taxi which id ends in 7 –Run and test your program/application •Hints –Orion global instance runs at orion.lab.fiware.org port 1026 –Similar to exercise CB-3 and/or CB-8 but adding the “X-Auth-Token” HTTP header (set with the auth token) Easy
  • 24. CB-17. Subscribe to public information •Prerequisites –Auth token obtained in exercise CB-14 •Steps –Write a program that •Starts a REST server to receive notifications from Orion •Prints all the attributes of entities of type santander:device each time a notification is received –Subscribe your program to all attributes of every entity of type santander:device each time TimeInstant attribute changes using throttling of 10 seconds –Check that entities information arrives each 10 seconds and you program prints it •Hints –Orion global instance runs at orion.lab.fiware.org port 1026 –Orion User Manual section Context Subscriptions –Your program has to run in a VM/machine reachable from orion.lab.fiware.org. The port you use in the reference field in the subscription has to be open in your security group –Differently from exercises CB-11/12/13, you don’t need to update the subscribed entities, as santander:devices entities are automatically update by IoT devices interacting with the Orion global instance Hard
  • 25. Orion Context Broker Exercises (Advanced) Contact twitter @fermingalan Contact email fermin.galanmarquez@telefonica.com leandro.guillen@imdea.org daniel.moranjimenez@telefonica.com
  • 26. Outline •CB-18. Pagination •CB-19. Geolocation (factory) •CB-20. Geolocation (cities) •CB-21. Compound attributes •CB-22. Query entities with compound attributes •CB-23. Update entities with compound attributes •CB-24. Custom metadata •CB-25. Dynamic attributes addition/deletion •CB-26. Multitenancy •CB-27. Service Paths (create) •CB-28. Service Paths (query) •CB-29. Service Paths (update) 26
  • 27. CB-18. Pagination •Prerequisites –Access to Orion instance running in 130.206.81.86 port 1026 •Steps –Check how many entities of type Sensor are stored in that Orion instance –Write a program (or web/mobile application) that •Asks for a limit and a page number •Returns the name IDs the entities of type Sensor in the corresponding page –Run and test your program/application •Hints –Orion User Manual section Pagination Medium
  • 28. CB-19. Geolocation (factory) •Prerequisites –Access to Orion instance running in 130.206.81.86 port 1026 •Steps –Write a program (or web/mobile application) that •Gets all existing types •Gets all entities of each type in areas Red, Green and Blue (see next slide), printing entity IDs and their attributes which their values –Run and test your program/application •Hints –Orion User Manual section Geolocation Medium
  • 29. 29 -33.596620, -70.666825 -33.607682, -70.670730 -33.6100089, -70.643231 -33.599194, -70.640200 CB-19. Geolocation (factory) Medium
  • 30. 30 -33.596620, -70.666825 -33.607682, -70.670730 -33.6100089, -70.643231 -33.599194, -70.640200 -33.603458, -70.652788 -33.606123, -70.653790 -33.604231, -70.646032 -33.607108, -70.646781 -33.602391, -70.661781 x 200m CB-19. Geolocation (factory) Medium
  • 31. CB-20. Geolocation (cities) •Prerequisites –Exercise CB-1 •Steps –Chose 2 European countries (let’s name them A and B) –Chose 3 cities in each country –Create one entity for each city, in the following way •Entity ID: the name of the city •Entity type: “City” •The attribute “location” represent the city location (coordinates) –Write a program (or web/mobile application) that •Does a query to get all cities •Does a query to get all cities in country A •Does a query to get all cities in country B –Run and test your program/application •Hints –Orion User Manual section Geolocation –This page may help to get city coordinates: http://www.gps- coordinates.net/ –Use polygons to model countries (the model doesn’t need to be very precise). Google Maps may help (http://maps.google.com/) Medium
  • 32. CB-21. Compound attributes •Prerequisites –Exercise CB-1 •Steps –Create the following entities in your Orion instance •See table in next slide •Hints –Orion User Manual section Structure Attribute Values Medium
  • 33. CB-21. Compound attributes Entity Type Attr. Name Attr. Type Example value Character Name string Fooy Hitpoints integer 110 Class string Barbarian Abilities compound { "STR": "2", "DEX": "4", "CON": "3", "INT": "1", "WIS": "1", "CHA": "2" } Inventory compound { "weapons": [ "sword", "dagger" ], "potions": { "life": "1", "mana": "0" }, "other": ["shield"] } Entity name Entity Type Gandalf Character Aragorn Character Frodo Character Medium
  • 34. CB-22. Query entities with compound attributes •Prerequisites –Exercise CB-21 •Steps –Write a program (or web/mobile application) that does the following queries and print the result •Obtain all attributes of Aragorn entity •Obtain only the Abilities attribute of Frodo entity –Run and test your program/application •Hints –Orion User Manual section Structure Attribute Values Medium
  • 35. CB-23. Update entities with compound attributes •Prerequisites –Exercise CB-21 •Steps –Write a program (or web/mobile application) that •Asks for an object name (e.g. “staff”, “hat”, etc.) •Updates Gandalf's Inventory attribute to reflect that he now has a that object test your program –Run and test your program/application •Query the Gandalf's Inventory after that, in order to check that the object has been successfully added •Hints –Orion User Manual section Structure Attribute Values Medium
  • 36. CB-24. Custom metadata Medium •Prerequisites –Exercise CB-21 •Steps –Update the Gandalf entity so that the inventory attribute has two new metadatas: •name="Weight", type="float", value="1.2" •name="MaxWeight", type="float", value="20" –Query Gandalf again to see the new metadata atached to the corresponding attribute •Hints –Orion User Manual section Attribute metadata
  • 37. CB-25. Dynamic attributes addition/deletion •Prerequisites –Exercise CB-1 •Steps –Create the following initial entity •Entity ID: Car1 •Entity Type: Car •Initial attribute: name=Speed, type=integer, value=70 –Write a program (or web/mobile application) that •Asks for an operation type (ADD or DELETE) •If user chose ADD –Ask for an attribute name, type and value –Do a query to Orion to check that no other attributes with the same name exists in the entity (in positive case, exit informing the user about the problem) –Create the new attribute at the entity •If user chose DELETE –Ask for an attribute name –Do a query to Orion to check that an attributes with that name exists in the entity (in negative case, exit informing the user about the problem) –Delete the attribute at the entity –Run and test your program/application •Query your entity to check that the attributes are added and deleted as expected •Hints –Orion User Manual section Adding and removing attributes and entities Hard
  • 38. CB-26. Multitenancy •Prerequisites –Exercise CB-1 •Steps –Write a program (or web/mobile application) that •Creates the following entities in your Orion instance at tenant "Customer1" –See table in next slide •Creates the following entities in your Orion instance at tenant "Customer2" –See table in next slide –Query for the Hammer entity using Customer1 and Customer2 as Fiware-Service alternatively, checking that the result is the right one for the given tenant •Hints –Orion User Manual section Multitenancy –Orion has to be configured to run with multitenancy enabled •BROKER_EXTRA_OPS="-multiservice" at /etc/sysconfig/contextBroker Medium
  • 39. CB-26. Multitenancy Entity Type Attr. Name Attr. Type Example value Tool stock integer 1234 Tenant Entity Name Stock attribute value Customer1 Hammer 40 Screwdriver 23 Pliers 12 Ducktape 13 Customer2 HeatGun 109 Pliers 832 Hammer 646 Screwdriver 301 Hard
  • 40. CB-27. Service Paths (create) •Prerequisites –Exercise CB-1 •Steps –Create the following entities •See table in next page •Keep in mind that they have to use Service Paths according to the figure •Hints –Orion User Manual section Entity Service Paths Hard
  • 41. CB-27. Service Paths (create) Entity Type Attr. Name Attr. Type Example value Laptop owner string Bob MobilePhone owner string Alice Company Sales Dept. phone1 owner: Dave phone2 owner: Alice laptop1 owner: Alice TechSupport Dept. laptop2 owner: Charlie laptop3 owner: Bob phone3 owner: Bob Service Path ¨Fiware-ServicePath¨ header value Company /company Sales Department /company/sales Tech Support Department /company/tech Hard
  • 42. CB-28. Service Paths (query) •Prerequisites –Exercise CB-27 •Steps –Write a program (or web/mobile application) that does the following queries and prints the result •Query all phones in the company •Query all laptops in the Tech Support department –Run and test your program/application •Hints –Orion User Manual section Entity Service Paths Medium
  • 43. CB-29. Service Paths (update) •Prerequisites –Exercise CB-27 •Steps –Write a program (or web/mobile application) that does the following •Since Charlie left the Company he has to give back his laptop. Update entity laptop2's owner attribute and set it to "nobody". •Create a new entity phone3 of type MobilePhone in the sales department and set the owner attribute to "Alice" (she needs two phones, she works a lot). Notice that as a result of this there will be two entities with the same id in different Service Paths. –Run and test your program/application •Query entity phone3 and see which one you get when querying with the following service paths –The Sales department –the Tech Support department –All the company •Hints –Orion User Manual section Entity Service Paths Hard
  • 44. Thanks!Thanks! (Number to manuals sections in this presentation are valid at time of writing this –March 9th 2015-, but they may change along time)

Notas del editor

  1. 1
  2. 3
  3. 4
  4. 5
  5. 6
  6. 7
  7. 9
  8. 10
  9. 11
  10. 12
  11. 13
  12. 15
  13. 16
  14. 17
  15. 18
  16. 19
  17. 20
  18. 21
  19. 22
  20. 23
  21. 24
  22. 25
  23. 27
  24. 28
  25. 29
  26. 30
  27. 31
  28. 32
  29. 34
  30. 35
  31. 36
  32. 37
  33. 38
  34. 40
  35. 42
  36. 43