Created

Nov 12, 2012

How to sanity check OSGi bundles across environments

Posted by Sham HC

I would like to thank all for feedback and encouraging words on my earlier article "Unit Testing Email Notification" [0] & like to share another custom tool called OSGi Diff. This tool help to address some of frequent question I hear from the most customers like

  1. How to verify the system (OSGi bundles) is in order across various environments (DEV, QA, Pre-prod, DR, PROD ...)
  2. Some functionality no longer work in another environment, 
  3. How to ensure after upgrade all my bundles are updated.
  4. How to ensure service pack is installed correctly.
  5. Some times restoring the instance is not functional. etc...

On debugging found one of cause is difference in bundle missing or versions. This tool helps to show the difference by following three simple steps. In the results if you find any mismatch you will know the cause & take appropriate steps. Hope you might find this tool handy.

Introduction

OSGi is a fundamental element in the technology stack of CQ5. The Felix Framework is an implementation of the OSGi  core framework specification, provides an interface to retrieve information on the bundles (or bundle) available in the framework. OSGi Diff tool is a simple custom Cross-platform online application developed using java script which utilize the felix bundles information to compare against environments to show the conflicts & similarities.
  • With 3 simple steps makes it easier than ever for you to compare sanity check across environments the OSGi bundles that do what you intend, without any guesswork. The results shows you uniqueness, difference, addition, deletion and similarities in bundles.  This makes verification practical and safe.
  • Global presence 24/7 to check online OR Save the html source file for Offline usage.
  • There are two flavors of tool.
    • One is Standard version:-  To compare against any of your two environments.
    • Another is OOB (Out of the box) version:-  To compare against CQ Default bundles. (This will help to verify when you upgrade OR install service pack)

Advantages

  • Gives the IT team a means to verify the system (OSGI) is in order across environments.
  • The reports help IT team like support to diagnose issues & take quicker action to install the conflict bundles.
  • Provide means for implementation team to assert their setup should work
  • During package Installation you can be sure to verify the required OSGi bundle are installed.

Installation

  • Online Type:- Bookmark the below urls and check in your favorite browser. No need to install. 
    • Standard version:- [1]
    • OOB version:- [2] 
  • Offline Type:- If you do not have internet connection and want to use the tool offline. Save the html source file [1] & [2] for Offline usage OR download the attached zip and extract to your convenient folder.  The disadvantage with this when ever new service pack is installed. You might not get the OOB version updated. 

My plan is when ever new service pack is released I will update the online OOB version to include the new service pack bundles details. So using online version always have the latest service pack bundle information.

How to use the tool

The three simple steps to use is

Standard version:-

  • Paste complete JSON from two of environments you want to compare in each of the text fields at [1].  Example with standard cq installation without different context root the url would be http://<host>:<port>/system/console/bundles/.json
  • Click Compare
  • All the results of uniqueness, similarities in bundles are displayed with various colors & an option to filter.

OOB version:- 

Same as Standard version with an difference you select against default cq instance and service pack version. So you copy JSON from one environment. The steps are
  • Paste complete JSON from one of environments you want to compare against CQ default bundles in the text fields at [2].  Example with standard cq installation without different context route the url for json would be http://<host>:<port>/system/console/bundles/.json
  • Click Compare
  • All the results of uniqueness, similarities in bundles are displayed with various colors & an option to filter.

NOTE:-   I have checked both version of tools against popular browsers like IE, Firefox, Safari, Chrome but not with all versions of browser. It might not work in all browser version. 

Sample usecase for the tool

Few scenarios it can be helpful are
  • During code movement to ensure it matches against the lower environment.Ex:- QA against production after code deployment. 
  • When you find a scenario the functionality is behaving different in other environments.
  • After service pack Installation.
  • When you restore the instance from backup.

Download

HTML Source code Click Here .  

[0]    http://experiencedelivers.adobe.com/cemblog/en/experiencedelivers/2012/07/unit_testing_theemailnotification.html

[1]    http://dev.day.com/content/dam/day/onlinetool/CTI.html

[2]    http://dev.day.com/content/dam/day/onlinetool/COI.html

Abbreviation

  • OOB  :-  Out of the box
  • OSGi :-  Open Services Gateway initiative
  • JSON :-  JavaScript Object Notation

Reference

  • http://felix.apache.org/
  • http://stackoverflow.com/questions/3394770/how-to-store-key-value-pair-in-two-dimensional-array-and-hashtable-using-jquer
  • http://tlrobinson.net/projects/javascript-fun/jsondiff
  • http://www.vonloesch.de/node/23?filt=online

 

Note:- Information provided in this blog is for test purpose only and express my personal view.