APPC ConfigurationManager

APPC Core appc-common-bundle now includes a managed configuration that allows for APPC components to be configured or reconfigured dynamically without the need to restart the ODL instance.

Previous APPC configuration:

When a bundle or class required APPC configuration information (properties) it would request the configuration through the org.onap.appc ConfigurationFactory.getConfiguration method provided by appc-common. The first time this method is called a configuration is built from the system properties, default properties and appc.properties file and returned. Subsequent calls return the same configuration. While a mechanism exists allowing for the configuration to be updated, it has never been used. The end result is all APPC bundles use a static set of properties. In order to update a bundles configuration the appc.properties file would have to be modified and the bundle/s restarted. In some instances the entire ODL instance to would need to be shutdown and started in order for property changes to take effect.


New APPC configuration:

With the ODL and Karaf4 upgrades appc-common has been replaced with appc-common-bundle and all APPC projects should import (not embed) the appc-common-bundle.

The org.onap.appc ConfigurationFactory.getConfiguration still functions as it did before. The properties provided by ConfigurationFactory will remain as before e.g. not be updated.  The only modification is the location and filename used for the properties file, see below. Use of the ConfigurationFactory.getConfiguration should be deprecated in favor of using the AppcConfigurationManager.

appc.properties replaced with org.onap.appc.cfg

  • In order to use a single properties file all deployments should be updated to set system properties. The same file will then be use by ConfigurationFactory and AppcConfigurationManager. The following system properties should be set:
    • org_onap_appc_bootstrap_file=org.onap.appc.cfg
    • org_onap_appc_bootstrap_path=/opt/opendaylight/current/etc

AppcConfigurationManager added using OSGI configuration Admin to provide dynamic configuration updates.

How it works:

The AppcConfigurationManager uses a file backed configuration registered with OSGI Configuration Admin. The configuration file used is {ODL-HOME}/etc/org.onap.appc.cfg. This file replaces the appc.properties file used previously. On Feature install of the onap-appc-common feature, if the org.onap.appc.cfg file does NOT exist it will be created with default properties.


The AppcConfigurationManager is started with appc-common-bundle. It registers as a managed service with OSGI Configuration Admin to listen for updates from Configuration Admin. The configuration can be modified in three ways.

  1. Modifying the org.onap.appc.cfg file: The org.onap.appc.cfg file is a tracked file, any modification to the configuration file by editing or replacing notifies Configuration Admin of the changes which in turn notifies AppcConfigurationManager.
  2. Through the Karaf console: configurations can be viewed and updated in the karaf console
    1. config:edit org.onap.appc.cfg – begins editing the APPC configuration
    2. config:property-list – list the current properties
    3. config:property-set {prop} {value} – sets the property prop to the value
    4. config:update – applies the changes notifying Configuration Admin to update
  3. Programmatically: it is possible to get and update the configuration through the ConfigurationAdmin API however that is beyond the scope of this document.

When the AppcConfigurationManager is updated by ConfigurationAdmin it creates an updated instance of the APPC Configuration and updates all AppcConfigurationListener instances registered as an OSGI service with the new configuration.

Listening for changes:

For a service or bundle to take advantage of the new AppcConfigurationManger it must implement the AppcConfigurationListener and register with OSGI as AppcConfigurationListener Service.

Upon registration the AppcConfigurationManger will call the updateConfig method with the current configuration. The service/bundle can then continue with initialization using the configuration.

When the configuration is updated the AppcConfigurationManager will call the updateConfig method with the new configuration. The service/bundle can then determine what if any changes to make based upon the new configuration.

See the appc-event-listener-bundle org.onap.appc.listener.impl.EventListenerManagerImpl and blueprint for an example.

  • No labels