Open APIs for Open Minds
Fi-Ware :: la plataforma de Internet del Futuro
Joaquín Salvachua (jsalvachua@dit.upm.es)
Javier Cerviño (jcervino@dit.upm.es)
Alvaro Alonso (aalonso@dit.upm.es)
Juan Quemada jquemada@dit.upm.es)
viernes, 4 de abril de 14
¿Fi-que?
viernes, 4 de abril de 14
FI-PPP
• Esto tiene muchos acronimos raros.
• Intentaremos ignorarlos por ahora para no
liaros.
• Plataforma cloud con acceso a un gran
numero de componentes y datos de
diversas Ciudades inteligentes y sensores.
• FI es por Future Internet.
viernes, 4 de abril de 14
º
viernes, 4 de abril de 14
fi-cosas
• Fi-ware
• Fi-lab
• Fi-core
• fi-otros :: como el batmovil y las batcosas
pero con FI.
viernes, 4 de abril de 14
Fi-Lab
viernes, 4 de abril de 14
Información técnica
• Esta en un wiki
• http://forge.fi-ware.org/plugins/
mediawiki/wiki/fiware/index.php/
Main_Page
• Es enciclopedica y no tutorial.
• No asustarse y preguntarnos
viernes, 4 de abril de 14
Cursos Online
viernes, 4 de abril de 14
Catálogo
• Hay un catálogo con toda la información de
cada uno de ellos.
• http://catalogue.fi-ware.eu/
• Existen muchos, pero nos vamos a centrar
en los más representativos.
viernes, 4 de abril de 14
Generic Enablers
• Son Piezas de lego que podemos usar para
nuestros servicios
viernes, 4 de abril de 14
GE
• Nombre que se dan a los diversos
componentes en los proyectos.
• Son especificaciones de los API de acceso a
estos componentes y los GEi las
implementaciones que existen (Como las
clases y los objetos).
• Receta: son los componentes que
usaremos.
viernes, 4 de abril de 14
Infraestructura Cloud
• Basada en OpenStack
•
viernes, 4 de abril de 14
Infraestructura en
Europa
viernes, 4 de abril de 14
Detalles
• Acceso a la infraestructura en la fi-nube:
• Registrarse en : https://account.lab.fi-
ware.org
• Esto nos permitirá crear y acceder a una
máquina virtual.
viernes, 4 de abril de 14
Registraros
• Demo
viernes, 4 de abril de 14
Algunos detalles
técnicos
viernes, 4 de abril de 14
Iden%ty	
  Management	
  
17
viernes, 4 de abril de 14
Iden%ty	
  Management	
  in	
  FI-­‐WARE
18
viernes, 4 de abril de 14
Iden%ty	
  Management	
  in	
  FI-­‐WARE
• Management	
  of	
  users,	
  their	
  authen)ca)on	
  and	
  authoriza)on,	
  and	
  privileges	
  
within	
  organiza)ons.
• Resources	
  used:
– Users
– Organiza%ons
– Roles
– Applica%ons
• Users	
  register	
  themselves,	
  create	
  organiza%ons,	
  and	
  assign	
  roles	
  into	
  these	
  
organiza%ons.
• It	
  enables	
  applica)ons	
  to	
  access	
  user’s	
  protected	
  informa)on.
– Trusted	
  environment
– OAuth	
  2.0	
  standard
• hHp://oauth.net/2/
19
viernes, 4 de abril de 14
20
Back-­‐end	
  Apps
Account
Request	
  +
access-­‐token
Web	
  App
Oauth	
  Library
Proxy
redirect
access-­‐code
request	
  access-­‐token
access-­‐token
access-­‐token	
  +	
  path
OK	
  +	
  user	
  info
viernes, 4 de abril de 14
Architectura	
  
21
NGSI	
  IoT	
  
Adapter
IoT Backend Device
Management
Browser
Context	
  BrokerTicket	
  Management
CEP
Wirecloud	
  (javascript	
  run%me)
widgets
Object	
  Storage
History
Loca%on
Wirecloud	
  (server)
Cosmos
viernes, 4 de abril de 14
Architectura	
  
21
NGSI	
  IoT	
  
Adapter
IoT Backend Device
Management
Browser
Context	
  BrokerTicket	
  Management
CEP
Wirecloud	
  (javascript	
  run%me)
widgets
Object	
  Storage
History
Loca%on
Wirecloud	
  (server)
Cosmos
viernes, 4 de abril de 14
Reference	
  IoT	
  FI-­‐Lab	
  Scenario
22
HACKATHONs
DCA
IDAS
Context
Broker
SANTANDER
SEVILLA
App	
  Logic	
  
FI-­‐WARE	
  Cloud
User
Interface
Dashboards
UI	
  Prototyping
OAuth2.0 DCA	
  Portal,
Dashboard
viernes, 4 de abril de 14
New	
  Devices,	
  Technologies	
  &	
  Protocols:	
  
23
HW	
  
(Motes,	
  TT	
  …)
TX	
  
(BLE,	
  802.15.4…)
6LowPAN
UDP
CoAP
HW
NGSI	
  /	
  Light	
  App
viernes, 4 de abril de 14
What	
  is	
  Cosmos?
24
• Cosmos	
  is	
  Telefónica's	
  Big	
  Data	
  and	
  Open	
  Data	
  asset.
• Cosmos	
  is	
  Hadoop	
  ecosystem-­‐based
• HDFS	
  as	
  its	
  distributed	
  file	
  system
• Hadoop	
  core	
  as	
  its	
  MapReduce	
  engine
• HiveQL	
  as	
  the	
  remote	
  analysis	
  mechanism
• Oozie	
  as	
  remote	
  MapReduce	
  jobs	
  and	
  Hive	
  launcher
• Plus	
  other	
  proprietary	
  modules
• SFTP	
  server	
  for	
  HDFS
• Cygnus,	
  the	
  context	
  data	
  injector	
  coming	
  from	
  Orion
• Automa%c	
  cluster	
  deployment	
  (roadmap)
• Infinity	
  protocol	
  (roadmap)
• Plus	
  open	
  datasets
viernes, 4 de abril de 14
Storage	
  and	
  compu%ng
25
viernes, 4 de abril de 14
Orion	
  data	
  persistency	
  in	
  Cosmos
26
hHps://forge.fi-­‐ware.eu/plugins/mediawiki/wiki/fiware/index.php/How_to_persist_Orion_data_in_Cosmos
viernes, 4 de abril de 14
Open	
  Datasets	
  in	
  Cosmos
27
Source Dataset Data	
  type Notes
Smar
t	
  
Ci%es
Málaga Plagues	
  tracking HistoricalSmar
t	
  
Ci%es
Santander Smart	
  Santander Sensoring Data	
  coming	
  through	
  Orion	
  
Context	
  Broker
Smar
t	
  
Ci%es
Santander
Parque	
  de	
  las	
  Llamas Sensoring
Data	
  coming	
  through	
  Orion	
  
Context	
  Broker
Smar
t	
  
Ci%es
Sevilla Bikes	
  ren%ng Historical
Smar
t	
  
Ci%es
Sevilla
Water	
  metering Historical
Smar
t	
  
Ci%es
Sevilla
Census Historical
Smar
t	
  
Ci%es
Sevilla
Infraestructures Historical
Smar
t	
  
Ci%es
Zaragoza Air	
  quality Historical
Other TwiHer FI-­‐WARE-­‐related	
  tweets StreamingOther
AEMET Weather Historical Un%l	
  September	
  2013
hHp://forge.fi-­‐ware.eu/plugins/mediawiki/wiki/fiware/index.php/FI-­‐WARE_open_datasets_central
viernes, 4 de abril de 14
Our	
  IoT	
  Resources	
  Ecosystem	
  is	
  
28
SANTANDER
SEVILLA
MALAGA
TRENTO
viernes, 4 de abril de 14
Context	
  management
• Context	
  Management	
  in	
  FI-­‐WARE	
  is	
  about	
  management	
  of	
  Context	
  data	
  (aka	
  Context	
  Informa%on)
• Context	
  Informa%on	
  is	
  always	
  relevant	
  to	
  “en%%es”,	
  although	
  en%%es	
  can	
  be	
  anything	
  (applica%ons,	
  users,	
  
things,	
  …)
• Orion	
  Context	
  Broker	
  intermediates	
  between	
  context	
  producers	
  and	
  context	
  consumers
29
Orion	
  Context	
  
Broker Applica%ons
viernes, 4 de abril de 14
The	
  NGSI	
  informa%on	
  model
30
Meta-data
• Name
• Type
• Value
Context Element attributes
• Name
• Type
• Value
Context Element
• En%tyId
• En%tyType
1 n 1 n
“has”	
   “has”	
  
(We	
  are	
  not	
  fully	
  suppor%ng	
  metadata	
  
right	
  now)
Node	
  Lamps
Electrical	
  Regulator
Vans
Technicians
Issues
loca%on TimeInstant
severity baHeryCharge
illuminance
presence
electricPoten%al
viernes, 4 de abril de 14
Orion	
  Context	
  Broker	
  in	
  a	
  nutshell
Orion	
  Context	
  Broker
Context
Producers
Context
Consumers
subscrip%ons
update
query
no%fy
no%fy
update
update
DB
1026
1026
viernes, 4 de abril de 14
Orion	
  Context	
  Broker	
  in	
  a	
  nutshell
31
Orion	
  Context	
  Broker
Context
Producers
Context
Consumers
subscrip%ons
update
query
no%fy
no%fy
update
update
DB
1026
1026
viernes, 4 de abril de 14
NGSI	
  API
• REST	
  API	
  (XML	
  &	
  JSON	
  rendering)
• NGS10
–updateContext
–queryContext
–subscribeContext	
  /	
  updateContextSubacrip%on	
  /	
  
unsusbribeContext
• NGS9
–registerContext
–discoverContextAvailability
–subscribeContext	
  Availability/	
  
updateContextAvailabilitySubacrip%on	
  /	
  
unsusbribeContextAvailability
• Addi%onal	
  “convenience”	
  opera%ons	
  to	
  easy	
  some	
  opera%ons
32
viernes, 4 de abril de 14
What	
  is	
  Wirecloud?
33
piping
viernes, 4 de abril de 14
What	
  is	
  Wirecloud?
33
Widget
piping
viernes, 4 de abril de 14
What	
  is	
  Wirecloud?
33
Mashup
piping
viernes, 4 de abril de 14
What	
  is	
  Wirecloud?
33
data
Backend
service
Backend
service
Backend
service
operator
piping
viernes, 4 de abril de 14
What	
  is	
  Wirecloud?
33
wiring piping
viernes, 4 de abril de 14
What	
  is	
  Wirecloud?
33
Object Storage
API
NGSI API
Context
Broker
piping
viernes, 4 de abril de 14
• hHp://fi-­‐ppp.eu
• hHp://fi-­‐ware.eu
Thanks	
  !
34
viernes, 4 de abril de 14
PREGUNTARNOS
viernes, 4 de abril de 14
How	
  to	
  exploit	
  the	
  data
36
• The	
  easy	
  way:	
  Hive	
  queries
• Hive	
  queries	
  are	
  SQL-­‐like
• Hive	
  uses	
  pre-­‐defined	
  MapReduce	
  jobs	
  for	
  filtering,	
  grouping,	
  joining…
• All	
  the	
  datasets	
  are	
  loaded	
  into	
  Hive	
  tables
• Hive	
  cli	
  is	
  available	
  within	
  the	
  cluster	
  (tes%ng	
  purposes)
• Simple	
  Hive	
  remote	
  clients	
  can	
  be	
  created
• The	
  not	
  so	
  easy	
  way:	
  custom	
  MapReduce	
  jobs
• The	
  jobs	
  must	
  be	
  created	
  from	
  scratch
• Datasets	
  are	
  directly	
  read	
  from	
  HDFS
• Oozie	
  can	
  remotely	
  launch	
  the	
  MapReduce	
  jobs	
  and	
  Hive	
  tasks	
  as	
  well
• Java	
  API
• API	
  REST
viernes, 4 de abril de 14

Fi ware en Hack for good (#H4G)

  • 1.
    Open APIs forOpen Minds Fi-Ware :: la plataforma de Internet del Futuro Joaquín Salvachua (jsalvachua@dit.upm.es) Javier Cerviño (jcervino@dit.upm.es) Alvaro Alonso (aalonso@dit.upm.es) Juan Quemada jquemada@dit.upm.es) viernes, 4 de abril de 14
  • 2.
  • 3.
    FI-PPP • Esto tienemuchos acronimos raros. • Intentaremos ignorarlos por ahora para no liaros. • Plataforma cloud con acceso a un gran numero de componentes y datos de diversas Ciudades inteligentes y sensores. • FI es por Future Internet. viernes, 4 de abril de 14
  • 4.
    º viernes, 4 deabril de 14
  • 5.
    fi-cosas • Fi-ware • Fi-lab •Fi-core • fi-otros :: como el batmovil y las batcosas pero con FI. viernes, 4 de abril de 14
  • 6.
  • 7.
    Información técnica • Estaen un wiki • http://forge.fi-ware.org/plugins/ mediawiki/wiki/fiware/index.php/ Main_Page • Es enciclopedica y no tutorial. • No asustarse y preguntarnos viernes, 4 de abril de 14
  • 8.
  • 9.
    Catálogo • Hay uncatálogo con toda la información de cada uno de ellos. • http://catalogue.fi-ware.eu/ • Existen muchos, pero nos vamos a centrar en los más representativos. viernes, 4 de abril de 14
  • 10.
    Generic Enablers • SonPiezas de lego que podemos usar para nuestros servicios viernes, 4 de abril de 14
  • 11.
    GE • Nombre quese dan a los diversos componentes en los proyectos. • Son especificaciones de los API de acceso a estos componentes y los GEi las implementaciones que existen (Como las clases y los objetos). • Receta: son los componentes que usaremos. viernes, 4 de abril de 14
  • 12.
    Infraestructura Cloud • Basadaen OpenStack • viernes, 4 de abril de 14
  • 13.
  • 14.
    Detalles • Acceso ala infraestructura en la fi-nube: • Registrarse en : https://account.lab.fi- ware.org • Esto nos permitirá crear y acceder a una máquina virtual. viernes, 4 de abril de 14
  • 15.
  • 16.
  • 17.
  • 18.
    Iden%ty  Management  in  FI-­‐WARE 18 viernes, 4 de abril de 14
  • 19.
    Iden%ty  Management  in  FI-­‐WARE • Management  of  users,  their  authen)ca)on  and  authoriza)on,  and  privileges   within  organiza)ons. • Resources  used: – Users – Organiza%ons – Roles – Applica%ons • Users  register  themselves,  create  organiza%ons,  and  assign  roles  into  these   organiza%ons. • It  enables  applica)ons  to  access  user’s  protected  informa)on. – Trusted  environment – OAuth  2.0  standard • hHp://oauth.net/2/ 19 viernes, 4 de abril de 14
  • 20.
    20 Back-­‐end  Apps Account Request  + access-­‐token Web  App Oauth  Library Proxy redirect access-­‐code request  access-­‐token access-­‐token access-­‐token  +  path OK  +  user  info viernes, 4 de abril de 14
  • 21.
    Architectura   21 NGSI  IoT   Adapter IoT Backend Device Management Browser Context  BrokerTicket  Management CEP Wirecloud  (javascript  run%me) widgets Object  Storage History Loca%on Wirecloud  (server) Cosmos viernes, 4 de abril de 14
  • 22.
    Architectura   21 NGSI  IoT   Adapter IoT Backend Device Management Browser Context  BrokerTicket  Management CEP Wirecloud  (javascript  run%me) widgets Object  Storage History Loca%on Wirecloud  (server) Cosmos viernes, 4 de abril de 14
  • 23.
    Reference  IoT  FI-­‐Lab  Scenario 22 HACKATHONs DCA IDAS Context Broker SANTANDER SEVILLA App  Logic   FI-­‐WARE  Cloud User Interface Dashboards UI  Prototyping OAuth2.0 DCA  Portal, Dashboard viernes, 4 de abril de 14
  • 24.
    New  Devices,  Technologies  &  Protocols:   23 HW   (Motes,  TT  …) TX   (BLE,  802.15.4…) 6LowPAN UDP CoAP HW NGSI  /  Light  App viernes, 4 de abril de 14
  • 25.
    What  is  Cosmos? 24 •Cosmos  is  Telefónica's  Big  Data  and  Open  Data  asset. • Cosmos  is  Hadoop  ecosystem-­‐based • HDFS  as  its  distributed  file  system • Hadoop  core  as  its  MapReduce  engine • HiveQL  as  the  remote  analysis  mechanism • Oozie  as  remote  MapReduce  jobs  and  Hive  launcher • Plus  other  proprietary  modules • SFTP  server  for  HDFS • Cygnus,  the  context  data  injector  coming  from  Orion • Automa%c  cluster  deployment  (roadmap) • Infinity  protocol  (roadmap) • Plus  open  datasets viernes, 4 de abril de 14
  • 26.
  • 27.
    Orion  data  persistency  in  Cosmos 26 hHps://forge.fi-­‐ware.eu/plugins/mediawiki/wiki/fiware/index.php/How_to_persist_Orion_data_in_Cosmos viernes, 4 de abril de 14
  • 28.
    Open  Datasets  in  Cosmos 27 Source Dataset Data  type Notes Smar t   Ci%es Málaga Plagues  tracking HistoricalSmar t   Ci%es Santander Smart  Santander Sensoring Data  coming  through  Orion   Context  Broker Smar t   Ci%es Santander Parque  de  las  Llamas Sensoring Data  coming  through  Orion   Context  Broker Smar t   Ci%es Sevilla Bikes  ren%ng Historical Smar t   Ci%es Sevilla Water  metering Historical Smar t   Ci%es Sevilla Census Historical Smar t   Ci%es Sevilla Infraestructures Historical Smar t   Ci%es Zaragoza Air  quality Historical Other TwiHer FI-­‐WARE-­‐related  tweets StreamingOther AEMET Weather Historical Un%l  September  2013 hHp://forge.fi-­‐ware.eu/plugins/mediawiki/wiki/fiware/index.php/FI-­‐WARE_open_datasets_central viernes, 4 de abril de 14
  • 29.
    Our  IoT  Resources  Ecosystem  is   28 SANTANDER SEVILLA MALAGA TRENTO viernes, 4 de abril de 14
  • 30.
    Context  management • Context  Management  in  FI-­‐WARE  is  about  management  of  Context  data  (aka  Context  Informa%on) • Context  Informa%on  is  always  relevant  to  “en%%es”,  although  en%%es  can  be  anything  (applica%ons,  users,   things,  …) • Orion  Context  Broker  intermediates  between  context  producers  and  context  consumers 29 Orion  Context   Broker Applica%ons viernes, 4 de abril de 14
  • 31.
    The  NGSI  informa%on  model 30 Meta-data • Name • Type • Value Context Element attributes • Name • Type • Value Context Element • En%tyId • En%tyType 1 n 1 n “has”   “has”   (We  are  not  fully  suppor%ng  metadata   right  now) Node  Lamps Electrical  Regulator Vans Technicians Issues loca%on TimeInstant severity baHeryCharge illuminance presence electricPoten%al viernes, 4 de abril de 14
  • 32.
    Orion  Context  Broker  in  a  nutshell Orion  Context  Broker Context Producers Context Consumers subscrip%ons update query no%fy no%fy update update DB 1026 1026 viernes, 4 de abril de 14
  • 33.
    Orion  Context  Broker  in  a  nutshell 31 Orion  Context  Broker Context Producers Context Consumers subscrip%ons update query no%fy no%fy update update DB 1026 1026 viernes, 4 de abril de 14
  • 34.
    NGSI  API • REST  API  (XML  &  JSON  rendering) • NGS10 –updateContext –queryContext –subscribeContext  /  updateContextSubacrip%on  /   unsusbribeContext • NGS9 –registerContext –discoverContextAvailability –subscribeContext  Availability/   updateContextAvailabilitySubacrip%on  /   unsusbribeContextAvailability • Addi%onal  “convenience”  opera%ons  to  easy  some  opera%ons 32 viernes, 4 de abril de 14
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
    What  is  Wirecloud? 33 wiringpiping viernes, 4 de abril de 14
  • 40.
    What  is  Wirecloud? 33 ObjectStorage API NGSI API Context Broker piping viernes, 4 de abril de 14
  • 41.
  • 42.
  • 43.
    How  to  exploit  the  data 36 • The  easy  way:  Hive  queries • Hive  queries  are  SQL-­‐like • Hive  uses  pre-­‐defined  MapReduce  jobs  for  filtering,  grouping,  joining… • All  the  datasets  are  loaded  into  Hive  tables • Hive  cli  is  available  within  the  cluster  (tes%ng  purposes) • Simple  Hive  remote  clients  can  be  created • The  not  so  easy  way:  custom  MapReduce  jobs • The  jobs  must  be  created  from  scratch • Datasets  are  directly  read  from  HDFS • Oozie  can  remotely  launch  the  MapReduce  jobs  and  Hive  tasks  as  well • Java  API • API  REST viernes, 4 de abril de 14