Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Ticket to Ride - Bus Fleet Operated and Managed with OSGi - C Larsson

96 views

Published on

OSGi Community Event 2017 Presentation by Christer Larsson [Makewave]

This talk will explain how OSGi is used in a large bus fleet
system. Every bus has one or more on-board computers running an
embedded OSGi platform (Knopflerfish) performing services such as
ticketing, driver console, and passenger information. The system is
remotely managed by Makewave's Ubicore system, responsible for
provisioning new or updated services to the embedded OSGi
platforms. The talk will present an overview of the overall software
architecture, some of the challenges we faced and the benefits gained
by using OSGi.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Ticket to Ride - Bus Fleet Operated and Managed with OSGi - C Larsson

  1. 1. Christer Larsson Makewave AB Ticket to Ride Bus Fleet Operated and Managed with OSGi Christer Larsson CEO Makewave
  2. 2. Christer Larsson Makewave AB Ticket to Ride • Quick introduction to Makewave • Introduction to aVehicle Fleet System • Managing a fleet of IoT Gateways with Ubicore • System Architecture for a fleet of moving gateways • Lessons learnt 2
  3. 3. Christer Larsson Makewave AB 3 Industrial M2M IoT Equipment 
 monitoring Vehicle Fleet Maintenance Diagnostics Residential DSL Set-top IPTV HomeHub OSGi Platform – (Knopflerfish, Java, Ubicore), License Management – (Lime) Design, Implementation & Integration,Workshops, Seminars and Training Expertise in Java, Embedded Systems, Compilers, License Mgmt Universal Middleware Global Services Makewave - OSGi Middleware
  4. 4. Christer Larsson Makewave AB 4 Company Spotlight • Makewave is one of the leading OSGi middleware companies • Been involved in the business since the inception of OSGi in 1999 • Developed the first commercial platform for Ericsson’s e-box in – 1998/2000 • Makewave is working actively in the OSGi Alliance. CEO Christer Larsson is the appointedVP EMEA • Located in Göteborg, Sweden. • We are the company maintaining Knopflerfish OSGi • We also make Ubicore - a remote management system for edge devices
  5. 5. Christer Larsson Makewave AB Ticket to Ride • Quick introduction to Makewave • Introduction to a Vehicle Fleet System • Managing a fleet of IoT Gateways with Ubicore • An actual System Architecture • Lessons learnt 5
  6. 6. Christer Larsson Makewave AB Introduction to aVehicle Fleet System 6 Server(s) / Cloud
  7. 7. Christer Larsson Makewave AB Characteristics of a Fleet System • What makes a fleet system different compared to other IoT systems are: • The edge devices move around • The edge devices are not always-on • The edge devices are not always connected. • When the devices are connected the speed of the connection may vary as well as the data transmission cost (Wifi vs Edge/3G/4G) • Often there are several edge devices within one vehicle • But only one may have a WAN connection • They need to easily find each other / use each other 7
  8. 8. Back-end Christer Larsson Makewave AB Multiple gateways in each vehicle 8 OSGi on-board OSGi on-board OSGi on-board OSGi on-board Driver Console Validators Communication gateway Ubicore Server Validation Server FMS
  9. 9. Christer Larsson Makewave AB Common Requirements for a fleet of moving IoT gateways • Software updates / Software reconfigurations are common • New time table, changed bus stops, new tariffs. • Always verify the software came from the right source • A software update should never fail • Pre-resolve in advance. • What is downloaded has been tested and verified • In case of problems, always have a fallback. • Updates should happen at a fixed time on all gateways. E.g. on the morning Nov 1st the new time table and new tariff plan should be active. • All gateways are prepared by having all new versions of bundles and configurations INSTALLED beforehand. 9
  10. 10. Christer Larsson Makewave AB Common Requirements for a fleet of moving IoT gateways • Provisioning should only happen when connected to wifi at hot spots, not 3G/4G • Updating thousands of gateways over 3G/4G may be expensive depending on the mobile subscription price plan. • Use a local vehicle download cache for bundles. • E.g. there are 5 gateways in one vehicle.To deploy a new bundle download it once per vehicle and distribute the bundle on the local network. Do not make 5 downloads from Ubicore. 10
  11. 11. Christer Larsson Makewave AB Typical Bus Fleet Services • Validation (ticket machines) • Ticket purchasing • Driver Console • Maintenance & Monitoring • Tracking • Passenger Information 11
  12. 12. Christer Larsson Makewave AB Ticket to Ride • Quick introduction to Makewave • Introduction to aVehicle Fleet System • Managing a fleet of IoT Gateways with Ubicore • An actual System Architecture • Lessons learnt 12
  13. 13. Christer Larsson Makewave AB Ubicore TR-69, OMA-DM Administrator Ubicore Agent Ubicore Agent Ubicore Agent Admin / User Portal Device Mgmt Service Mgmt REST User Mgmt Provisioning Protocol Adapters CRM Billing Legacy Systems Service Centers Ubicore Overview 13 Config Mgmt
  14. 14. Security Co. End User Management Servers. Managed and Maintained by a Gateway Operator ACME Telecom My Services Energy Consumption Welcome Anders My Apartment Mode - Home - Away - Night Alarm Service OK. Nothing to report health Monitoring Heart Rate 56 Home Devices Camera 1 Camera 2 TV Power Meter OK OK Off OK Power Co Ubicore Service Centers Operated by 3rd party service providers JVM / OS / HW OSGi Framework Home Security Energy Mgmt Health Monitoring A g e n t L o g C o n f H T T P P r e f s UP n P Z i g B e Energy Mgmt Makewave’s Edge and Enterprise Cloud servers OSGi inside Knopflerfish Pro Hospital Home Security Health Monitoring The OSGi App Store Powered by Makewave’s OSGi Technology
  15. 15. Christer Larsson Makewave AB Ubicore Design Principles • Ubicore is designed for managing embedded edge devices • With an end-user logged on / interacting via a display • Without any end-user, just a black box out in the field • The Ubicore server knows exactly which bundles are installed & started in which edge device. • Ubicore pre-resolves and defines what needs to be installed => software packages for deployment are created • can be tested, verified and signed before deploying. 15
  16. 16. Christer Larsson Makewave AB Ubicore is in control 16 Edge Device with OSGi Container Protocol Handler framework-1.2.3 DMT Ubicore Server Sends a recipe & receives status updates •Ubicore send a recipe - you need these bundles and bundle configurations. •The mgmt agent will take the recipe and make sure the platform takes its medicine. •The agent then report back to status to Ubicore ./Bundles framework-1.2.3 event-4.3.2 log-6.7.7 (U) Ubicore Mgmt Agent event-4.3.2 log-6.7.6 framework.update(log)
  17. 17. Christer Larsson Makewave AB Ubicore Concepts • OSGi Firmware • The framework and a core set of bundles, including the management agent. • The functions needed to make a platform “remotely manageable” • Service Applications • A group of bundles that typically is performing some logical function or service • A gateway or user subscribes to Service Applications. • Pre-resolve on the server • Signing firmwares / bundles / configurations 17
  18. 18. Christer Larsson Makewave AB Ubicore Concepts • Management Agent on the edge device • Is responsible for all management operations. • It’s the field agent for Ubicore • Local edge device bundle cache (repo) • It is normally the management agent that initiates and establish the connection.Typically at fixed intervals, e.g. every N minutes. • There is a Management Agent API • Edge device business logic may want to take decisions on when to upgrade / downgrade • Local installation / local management 18
  19. 19. Christer Larsson Makewave AB OSGi Firmware Gateway Ubicore 19 OSGi Firmware v.1.0.0 OSGi Firmware v.1.0.0 <firmware> <version=”1.0.0”> <components> <component id=”framework-6.1.1.jar”/> <component id=”log-1.2.3.jar”/> <component id=”eventadmin-1.1.0.jar”/> <component id=”cm-2.0.0.jar”/> ...... The OSGi firmware makes the gateway manageable by Ubicore and typically also provides a basic set of OSGi services, e.g. Log, Event Admin, CM, DS. The OSGi Firmware is a core set of bundles and bundle configurations. Packaged as single JAR. log-1.2.3 eventadmin-1.1.0 cm-2.0.0 framework-6.1.1
  20. 20. Gateway OSGi Firmware v.1.0.1 Christer Larsson Makewave AB OSGi Firmware Update Ubicore 20 OSGi Firmware v.1.0.0 <firmware> <version=”1.0.0”> <components> <component id=”framework-6.1.1.jar”/> <component id=”log-1.2.3.jar”/> <component id=”eventadmin-1.1.0.jar”/> <component id=”cm-2.0.0.jar”/> ...... Firmware Update Operation. Switches to a new version. New / changed components are downloaded, installed/updated and started. Restarts the framework and/or the JVM if required. New version of the firmware. Components may have been added, removed or updated. Only deltas will be provisioned. cm-2.0.1 framework-6.1.2 <firmware> <version=”1.0.1”> <components> <component id=”framework-6.1.2.jar”/> <component id=”log-1.2.3.jar”/> <component id=”eventadmin-1.1.0.jar”/> <component id=”cm-2.0.1.jar”/> ...... OSGi Firmware v.1.0.0 OSGi Firmware v.1.0.1 Provisioning
  21. 21. Christer Larsson Makewave AB OSGi Firmware Update • Firmware versions can be INSTALLED, RUNNING and FAILED. • When starting a new OSGi firmware it will be marked as FAILED if any of the bundle start methods throw an exception. In this case the mgmt agent will automatically revert to the previous “good” version. • There is always a basic initial version, e.g. a “Factory Settings” versions. • Any number of firmware versions may be kept but typically there is: Factory Settings, PreviousVersion, CurrentVersion. • The bundles are stored locally in a bundle cache and there is only one JAR-file for each version of the bundles 21
  22. 22. Gateway OSGi Firmware v.1.0.0 Christer Larsson Makewave AB Service Applications • A Service Application is a grouping of bundles • Typically grouped as a functional unit / logical unit, e.g. an “app” • The Service Applications are subscribed to by a user or the edge device itself. • The Service Application run on top of the firmware. 22 Service App XYX v.1.0.0 bundleA-1.2.3 bundleB-1.1.0 bundleC-2.0.0 cm-2.0.0 framework-6.1.1 cm-2.0.0 cm-2.0.0 Service App XYX v.1.0.0 bundleA-1.2.3 bundleB-1.1.0 bundleC-2.0.0
  23. 23. Christer Larsson Makewave AB Service Applications • A bundle can exist in multiple Service Applications so Service Applications can “overlap” • There will be only one instance of the bundle installed / started 23 Service App XYZ v.1.0.0 bundleX-1.2.3 bundleZ-1.1.0bundleY-2.0.0 Service App ABC v.2.0.0 bundleA-1.2.3 bundleB-1.1.0 bundleZ-1.1.0
  24. 24. Christer Larsson Makewave AB Bundle Cache 24 Bundle Cache OSGi Firmware v.1.0.0 OSGi Firmware v.1.0.1 bundleA-1.2.3 bundleB-1.1.1 bundleC-2.0.1 bundleB-1.1.0 bundleC-2.0.0 bundleA-1.2.3 bundleB-1.1.0 bundleZ-1.1.0 bundleX-1.2.3 bundleY-2.0.0 Service App XYZ v.1.0.0 Service App ABC v.2.0.0 • There is a local cache (repo) on the edge device which contain the union of all bundles referenced by all OSGi Firmwares and Service Applications. • The definitions point into the cache, which is shared between versions to avoid duplication of data. • The Service definition and Bundle Cache are both stored in the DMT (Device Management Tree), an OSGi defined service.
  25. 25. Christer Larsson Makewave AB Ticket to Ride • Quick introduction to Makewave • Introduction to aVehicle Fleet System • Managing a fleet of IoT Gateways with Ubicore • An Actual System Architecture • Lessons learnt 25
  26. 26. Back-end Operator Christer Larsson Makewave AB System Architecture - bus fleet 26 Bus OSGi on-board - Driver Console Agent All buses are equipped with one or more OSGi based on-board computers / devices. Each OSGi platform has a management agent which connects it to Ubicore Vehicle network BundlesBundlesBundles OSGi on-board - Ticket AgentBundlesBundlesBundles OSGi on-board - Ticket AgentBundlesBundlesBundles Bus OSGi on-board Bus OSGi Gateways Ubicore Agent Agent Ticket Server Driver Server
  27. 27. Christer Larsson Makewave AB System Architecture - bus fleet • Every bus has one or more on-board computers that has an embedded OSGi platform (Knopflerfish) • The on-board computers are connected to the in-vehicle network (FMS) • The on-board computers are connected to each other (in-vehicle IP) • Every on-board computer has an OSGi management agent.The agent is responsible for the connection to Ubicore and performs mgmt tasks decided by Ubicore. • All business logic is implemented as OSGi bundles.The business logic bundles are all managed via Ubicore. • The business logic bundles sends / receives data directly to/from its corresponding back-end server. I.e. the IP traffic is not routed via Ubicore • The Ubicore server is part of the complete back-end server infrastructure. It is integrated with other parts via a REST API. 27
  28. 28. Christer Larsson Makewave AB OSGi is an embedded integration platform 28 JavaVirtual Machine (JVM) OSGi platform Operating System • OSGi provides a sandbox in which bundles exist and exchange data. • An API layer is provided to the Application Logic • The Service is logically using a device, but physically abstracted Local network Devices Temp Sens Temp Meter Temp Temp Controller WebCam Web Cam Service My App Bundle
  29. 29. Christer Larsson Makewave AB System Architecture - bus fleet • A typical fleet would include ~5000 buses. • Each bus having ~5 edge devices. Most of them being validators. • An in-vehicle edge device would typically run between 150/200 bundles • Most business logic was developed using DS 29
  30. 30. Back-end / Cloud Christer Larsson Makewave AB Inside one vehicle 30 OSGi on-board Knopflerfish OSGi on-board Knopflerfish Driver Console Validators Communication gateway Ubicore Validation Server FMS Tracking Server Agent Agent OSGi on-board Knopflerfish Agent OSGi on-board Knopflerfish Bundle Cache Agent
  31. 31. Christer Larsson Makewave AB Ticket to Ride • Quick introduction to Makewave • Introduction to aVehicle Fleet System • Managing a fleet of IoT Gateways with Ubicore • An Actual System Architecture • Lessons learnt 31
  32. 32. Christer Larsson Makewave AB Benefits with an OSGi solution • Clear separation between business logic (implemented as OSGi bundles) and lower lever parts device code (C/ C++). • Uniform architecture - exactly the same business logic bundles can be used regardless of on-board computer architecture (ARM, X86). No need to recompile, or support different versions. • Remotely Managed and Flexible - it is very easy to add, remove or update functionality in the business logic layer over time. 32
  33. 33. Christer Larsson Makewave AB Use Declarative Services • Base the design on Declarative Services • It will force the developers to design well defined, services performing well defined tasks. • Even if there are hundred of services, by keeping them well defined and task specific, large and complex systems become manageable. • But bare in mind the declarative and dynamic behaviour. If not careful, component or service jo-jos can be created. • Don’t use Component Factories. Instead use a single component with multiple configurations 33
  34. 34. Christer Larsson Makewave AB And yes, there were problems • OSGi is a very powerful tool.This fantastic capability can also be the worst enemy. • In the hands of the crazy or incompetent developer really bad designs can be made. • Dynamic & multi-threaded • Using 3rd party libraries can be troublesome. • Many claim they support OSGi. Often they do, but sometimes they don’t. • Debugging DS can be a challenge • Tooling for introspection.Weak in the first DS releases 34
  35. 35. Christer Larsson Makewave AB Remote in-vehicle services 35 OSGi on-board OSGi on-board OSGi on-board OSGi on-board Driver Console Validators Communication gateway FMS Agent Agent Agent Agent Bundle Cache • Remote Services between devices inside the vehicle • Good discovery mechanisms required • Vehicle Service Registry • Good remote services implementation Remote Services
  36. 36. Christer Larsson Makewave AB Thank you! 36 Christer Larsson CEO Makewave www.makewave.com VP EMEA OSGi www.osgi.org Knopflerfish OSGi www.knopflerfish.org

×