mdsal.git
7 years agoBug 8303: BP odl:clustered-app-config initial/*-config.xml testability
Michael Vorburger [Tue, 25 Apr 2017 22:32:15 +0000 (00:32 +0200)]
Bug 8303: BP odl:clustered-app-config initial/*-config.xml testability

DataStoreAppConfigDefaultXMLReaderTest illustrates usage.

Change-Id: I342fca4583c90802238e63262871e33b4b713438
Signed-off-by: Michael Vorburger <vorburger@redhat.com>
7 years agoBump versions by x.(y+1).z for next dev cycle
Anil Belur [Tue, 11 Apr 2017 01:45:30 +0000 (11:45 +1000)]
Bump versions by x.(y+1).z for next dev cycle

Change-Id: Ife090ef2c9bb25e515b2fb06e2766c56d8174d76
Signed-off-by: Anil Belur <abelur@linuxfoundation.org>
7 years agoDo not scan transitive dependencies
Robert Varga [Sun, 5 Feb 2017 20:52:08 +0000 (21:52 +0100)]
Do not scan transitive dependencies

Doing so pulls in aries, which is provided by karaf, causing reactivation
of the platform, breaking pax-exam tests. This fixes the issue partially,
as blueprint is not being directly reactivated.

This is true for odl-mdsal-broker-local and odl-mdsal-xsql. Also the sample
test app should not be pulling tycho into an OSGi container, make sure the
dependency is only for test.

Change-Id: I5b08e19e39347fe6e5c03bf6dbe1cb05e36274e3
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoBUG-7608: activate action-service element
Robert Varga [Fri, 27 Jan 2017 12:39:53 +0000 (13:39 +0100)]
BUG-7608: activate action-service element

With downstream users fixed up, we can activate the action-service
element to actually require a promise of instantiation of actions.

Change-Id: I3f87acfd713936a4877822b2f62b5a7d2be46107
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoAdd Karaf 4 features
Stephen Kitt [Thu, 19 Jan 2017 14:19:17 +0000 (15:19 +0100)]
Add Karaf 4 features

This moves the Karaf 3 features and adds matching Karaf 4 features for
all the controller features.

Blueprint is upgraded to match the version used in Karaf 4.

Bug: 7526
Change-Id: Ie41cd727942ad2083ef0ca33e03f0d08003c546d
Signed-off-by: Stephen Kitt <skitt@redhat.com>
7 years agoBUG-7608: Add ActionServiceMetadata and ActionProviderBean
Robert Varga [Fri, 20 Jan 2017 21:04:11 +0000 (22:04 +0100)]
BUG-7608: Add ActionServiceMetadata and ActionProviderBean

This patch add the new concepts of action-provider and
action-service.

The implementation does nothing, as we are transitioning from
a run-time logic being coupled with sal-remoterpc-connector.

This allows us to migrate users, while retaining behavior indepent
of sal-remoterpc-connector's actions. This will allow us to fix
BUG-3128.

Once it is fixed, and DOMRpcRouter can express the action-provider
advertisement, we are going to actiovate the commented-out code
ActionServiceMetadata.acceptableStrategy().

Change-Id: I3f412d092c10b51a198721f288fdefdfc907f0b7
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoBUG-7506: use common DocumentBuilderFactory
Robert Varga [Fri, 20 Jan 2017 10:51:18 +0000 (11:51 +0100)]
BUG-7506: use common DocumentBuilderFactory

Yangtools exports UntrustedXML utility class, which contains pre-configured
document builder factories for dealing with XMLs which are not completely
trusted. Reuse that instead of rolling our own, especially in the XML parse
path.

Change-Id: I83d0ea60104f2266669493548e2d40b5ab6e4772
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoBUG-7608: OpendaylightNamespaceHandler methods can be static
Robert Varga [Fri, 20 Jan 2017 10:46:10 +0000 (11:46 +0100)]
BUG-7608: OpendaylightNamespaceHandler methods can be static

Eclipse emits warnings about methods being potentially static,
clean that up.

Change-Id: I4b5fb6d12486ea20d4a47429eafebe3f8b559c40
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoBUG-7608: restructure exception throws
Robert Varga [Fri, 20 Jan 2017 10:45:18 +0000 (11:45 +0100)]
BUG-7608: restructure exception throws

This cleans up the try-catch block so that we do not have
to re-throw exceptions.

Change-Id: I8c876f12b7a9e9108eb8dcca7a602927a78bec2c
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoUpdate dependendency desc properly in RpcServiceMetadata
Tom Pantelis [Thu, 19 Jan 2017 17:02:57 +0000 (12:02 -0500)]
Update dependendency desc properly in RpcServiceMetadata

When it transitions to waiting for available DOM RPCs, the
dependendency desc is now updated appropriately to reflect
the correct context.

Change-Id: Iaf7108dd664c9ed78444b0f3dfa4e14be431f35f
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
7 years agoBug 7326: Fix ConcurrentModificationException in Blueprint
Tom Pantelis [Fri, 9 Dec 2016 15:35:51 +0000 (10:35 -0500)]
Bug 7326: Fix ConcurrentModificationException in Blueprint

in AbstractDependentComponentFactoryMetadata.stopServiceRecipes()

tpantelis: "This is an edge case where the container is destroyed
immediately after and while it's starting up. This isn't likely to
happen in production but can happen during feature tests. I had assumed
the container would provide the protection but apparently it doesn't."

Change-Id: Id7532d30cb0a5f67fd907cb15372069d8769b247
Signed-off-by: Michael Vorburger <vorburger@redhat.com>
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
7 years agoFix FindBugs warnings in blueprint and enable enforcement
Tom Pantelis [Wed, 26 Oct 2016 16:58:05 +0000 (12:58 -0400)]
Fix FindBugs warnings in blueprint and enable enforcement

Warnings fixed:
- OpendaylightNamespaceHandler(line 83): "Usage of GetResource may be unsafe
  if class is extended". Made the class final so it can't be extended.

- BlueprintContainerRestartServiceImpl(line 140): "return value of this method
  should be checked". Log warning if 'await' returns false.

Change-Id: I1473acabd0a4126f5e5d2745292fcbff9a308462
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
7 years agoCheckstyle compliant src/main|test/resources
Michael Vorburger [Fri, 25 Nov 2016 18:24:36 +0000 (19:24 +0100)]
Checkstyle compliant src/main|test/resources

Change-Id: Ic7dc38ddedb3ed642eb8581cc223269c1bf36408
Signed-off-by: Michael Vorburger <vorburger@redhat.com>
7 years agoBug 6969 - Memory leak during bundle tree restart
Alexis de Talhouët [Tue, 15 Nov 2016 18:55:33 +0000 (13:55 -0500)]
Bug 6969 - Memory leak during bundle tree restart

There are two root causes for that memory leak:

-  Retention on BlueprintContainer when desotrying them before "quiescing"
them:
Restarting a set of bundles requires cooperation between them to avoid
having retention on services due to on-going call, processing.
As OSGi APIs don't provide such functionality, the Quiesce APIs where
created, ensuring all calls to be finished before actually shutting down
the bundle. Once the set of bundles are quiesced, e.g. shut down, they
can safely be destroyed.

- Retention on the TopoProcessingProviderImpl due to unreleased resources:
https://git.opendaylight.org/gerrit/#/c/48283/

Change-Id: I0af4a27ac7c87f1cc158313f0497158733a045a5
Signed-off-by: Alexis de Talhouët <adetalhouet@inocybe.com>
7 years agoFix CS warnings in blueprint and enable enforcement
Tom Pantelis [Wed, 26 Oct 2016 12:25:33 +0000 (08:25 -0400)]
Fix CS warnings in blueprint and enable enforcement

Fixed checkstyle warnings and enabled enforcement. Most of the
warnings/changes were for:
 - white space before if/for/while/catch
 - variable name too short
 - line too long
 - illegal catching of Exception

Change-Id: I2a9eb1dc47f46a2c56dc2415ee9ebb73ec7d18c4
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
7 years agoDo not use opendaylight/commons/opendaylight as parent
Alexis de Talhouët [Thu, 27 Oct 2016 03:13:26 +0000 (23:13 -0400)]
Do not use opendaylight/commons/opendaylight as parent

Change-Id: I9a858c90274c7c82bac75fc7931a10c1ff707ef8
Signed-off-by: Alexis de Talhouët <adetalhouet@inocybe.com>
7 years agoRevert "Clean-up pom.xml layout"
Alexis de Talhouët [Mon, 24 Oct 2016 23:48:05 +0000 (19:48 -0400)]
Revert "Clean-up pom.xml layout"

Since this got merged, I'm facing issue building the project correctly, it's
failing in samples/toaster-it and runtime is broken because of mess-up classpath.
If others are facing the same issue, this should be merged.

I'll rework the overall patch later.

This reverts commit 8a637013c102c11323230dae08fa4407863945d6.

Change-Id: I61aae87439736d0163e6b4c49d8753052b28bac0
Signed-off-by: Alexis de Talhouët <adetalhouet@inocybe.com>
7 years agoClean-up pom.xml layout
Alexis de Talhouët [Fri, 7 Oct 2016 21:26:17 +0000 (17:26 -0400)]
Clean-up pom.xml layout

Do not depend on opendaylight/commons/opendaylight/pom.xml

Change-Id: Ic7313dc6b703739a6c14b1f0cd1a37ba3b7827af
Signed-off-by: Alexis de Talhouët <adetalhouet@inocybe.com>
7 years agoConfigurable update-strategy for clusteredAppConfig
Vishal Thapar [Fri, 19 Aug 2016 10:00:43 +0000 (15:30 +0530)]
Configurable update-strategy for clusteredAppConfig

Any change to application's config data results in restart of the
blueprint container. This change adds an attribute that allows different
applications to disable this restart.

Attribute added: update-strategy
Values: reload, none.
Default: reload

Change-Id: Ie0c7501f8b5c84970a46ca8f02d7f77caf913a0a
Signed-off-by: Vishal Thapar <vishal.thapar@ericsson.com>
7 years agoMechanical code cleanup (blueprint)
Stephen Kitt [Thu, 22 Sep 2016 15:06:14 +0000 (17:06 +0200)]
Mechanical code cleanup (blueprint)

* Remove unnecessary type specifiers (use Java 7 <>)
* Remove unnecessary "extends Object" declarations
* Remove unnecessary semi-colons
* Merge identical catch blocks
* Remove redundant modifiers:
  - enum constructors are private by default
  - interface properties are public static final by default
  - interface methods are public abstract by default
  - interfaces are abstract by default
  - inner interfaces are static by default
  - inner classes in interfaces are public static by default

Change-Id: Iec9055685d1e4f1bba29f20de6da1cd6e14d5503
Signed-off-by: Stephen Kitt <skitt@redhat.com>
7 years agoBump versions by 0.1.0 for next dev cycle
Thanh Ha [Mon, 8 Aug 2016 21:50:13 +0000 (17:50 -0400)]
Bump versions by 0.1.0 for next dev cycle

Change-Id: I9c4a4b1e6d0e101392fb19dc68f814e30de4fa5c
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
7 years agoRestart BP container after dependency wait time out
Tom Pantelis [Fri, 22 Jul 2016 04:11:44 +0000 (00:11 -0400)]
Restart BP container after dependency wait time out

The blueprint container first waits for all dependencies (ie OSGi
services, clustered app config etc). By default it waits 5 min after
which it fails the container. For a missing OSGi service this is
probably OK but it could take longer for a clustered-app-config if the
data store isn't available. Ideally we would use an infinite timeout but
unfortunately the timeout can't be configured globally - it can only be set
at the bundle level in the manifest and we don't want to have to
configure it in every bundle (although it may be possible with some maven
magic in odlparent). Therefore I added code in BlueprintBundleTracker to
listen for container FAILURE events and restart the container if it's
due to missing dependencies.

Change-Id: Ib8ebb1a02dfd601e48722f9fc3011df7391432cb
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
7 years agoEnsure CSS modules are closed before blueprint containers on shutdown
Tom Pantelis [Thu, 23 Jun 2016 14:35:07 +0000 (10:35 -0400)]
Ensure CSS modules are closed before blueprint containers on shutdown

Change-Id: I9be36a819423e904030540b161437b6f2ffd091d
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
7 years agoExtend clustered-app-config to read default data from XML file
Tom Pantelis [Fri, 15 Jul 2016 15:28:48 +0000 (11:28 -0400)]
Extend clustered-app-config to read default data from XML file

The default data can be specified in the clustered-app-config element
but it's also useful for scripting/automation or convenience to be able
to specify the default data in external XML file. The
clustered-app-config will now look for a file of the form

  <yang module name>_<container name>.xml

in a well-known location, etc/opendaylight/datastore/initial/config.

The XML file name can also be explicitly specified via the
"default-config-file-name" attribute.

Change-Id: Id310ef5ae121b8b9444a2102b93c3e382e421687
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
7 years agoSwitch to StandardCharsets
Robert Varga [Mon, 18 Jul 2016 14:40:07 +0000 (16:40 +0200)]
Switch to StandardCharsets

Guava's Charsets should not be used when StandardCharsets are
available.

Change-Id: I7c52bd3070bb48857cbba82e8d4bc5993d7aea9d
Signed-off-by: Robert Varga <rovarga@cisco.com>
7 years agoAdd "static-reference" blueprint extension
Tom Pantelis [Wed, 22 Jun 2016 17:11:50 +0000 (13:11 -0400)]
Add "static-reference" blueprint extension

Added a blueprint extension, "static-reference", that obtains an OSGi
service and returns the actual instance. This differs from the standard
"reference" element that returns a dynamic proxy whose underlying
service instance can come and go. This is useful especially in cases
where the service exists for the life of the karaf container and you
don't need/want the overhead of the proxy.

Change-Id: I4cbcc7e2b5a85b0a22e50e12f3946d29bfb36c7d
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
7 years agoAdd "specific-reference-list" blueprint extension
Tom Pantelis [Mon, 13 Jun 2016 22:37:58 +0000 (18:37 -0400)]
Add "specific-reference-list" blueprint extension

Added a blueprint extension, "specific-reference-list", that obtains a specific
list of service instances from the OSGi registry for a given interface. The
specific list is learned by first extracting the list of expected service types
by inspecting RESOLVED bundles for a resource file under META-INF/services with
the same name as the given interface. The type(s) listed in the resource file
must match the "type" property of the advertised service(s). In this manner, an
app bundle announces the service type(s) that it will advertise so that the
extension knows which services to expect up front. Once all the expected services
are obtained, the container is notified that all dependencies are satisfied.

This new extension will initially be used by the bgpcep project.

Change-Id: I3bc6a72134b33c744fbb48fd645dd3a0ca54673d
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
7 years agoRestart config Modules when blueprint container restarted
Tom Pantelis [Fri, 15 Apr 2016 20:50:10 +0000 (16:50 -0400)]
Restart config Modules when blueprint container restarted

Modified the BlueprintContainerRestartServiceImpl to recreate/restart
associated config system Modules when a blueprint container is
restarted. A config Module is associated to a service instance that is
advertised via blueprint via adding certain service properties that
identifies the module namespace, module name and instance name. When
these properties are encountered for a service while traversing the
service usage tree, the module info is queued. After all blueprint
containers are restarted, the config Modules are recreated/restarted.

Change-Id: Ia16830620bfb54896ebf54d0542d31a51d4b067a
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
7 years agoWait for RPCService registered in RpcServiceMetadata
Tom Pantelis [Tue, 7 Jun 2016 18:04:50 +0000 (14:04 -0400)]
Wait for RPCService registered in RpcServiceMetadata

When obtaining an RpcService via the RpcProviderRegistry, the returned
instance is actually a proxy and the underlying DOM service instance may
not be registered yet. So if the caller tries to invoke an RPC it will
fail due to no implementation available. This is seen with the
ToasterTest with the switch to blueprint.

To alleviate I modified the RpcServiceMetadata to wait (asycnhronously)
for the underlying DOM RPC service implementation by registering a
DOMRpcAvailabilityListener with the DOMRpcService. In the callback, once
one of the RPCs is seen then it notifies the blueprint container that
its dependencies are satisfied so it can proceed.

Change-Id: I9f35afdd69ad069654a895239654a2ddc1ce1ee0
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
8 years agoAdd clustered-app-config blueprint extension
Tom Pantelis [Wed, 4 May 2016 02:20:06 +0000 (22:20 -0400)]
Add clustered-app-config blueprint extension

Added an extension that obtains a given binding DataObject type from the data
store and provides the DataObject instance to the Blueprint container as a
bean that can be injected into oher beans. In addition it registers a
ClusteredDataTreeChangeListener to restart the Blueprint container when the
data is changed. If no DataObject instance exists, an instance is created
with any defaults values populated. Default data may be specified via
the "default-config" child element which must contain the XML representation
of the yang data, including namespace, wrapped in a CDATA section to prevent
the blueprint container from treating it as markup.

It is assumed the given "binding-class" is a top-level yang container or
list, which seems reasonable. If it's nested then the full path would
have to be specified via XML which is doable but not worth the added
work if not necessary. We'll see if there's a use case for a nested app
config (I doubt it).

A list agg config would be used if there's multiple instances of the
app/module (eg "openflow-switch-connection-provider-impl" in the
openflowplugin). The "list-key-value" must be specified. It is assumed
there's only one list key and that it's a string, ie the yang list is
keyed by the name of app/module.

Change-Id: Ib970b003526d42c2a3db085036174967f055cbba
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
8 years agoAddress comments in prior patches
Tom Pantelis [Thu, 14 Apr 2016 15:56:01 +0000 (11:56 -0400)]
Address comments in prior patches

Follow-up patch to address comments in
https://git.opendaylight.org/gerrit/#/c/36476/ and
https://git.opendaylight.org/gerrit/#/c/36485/.

Change-Id: Ic4e9c4957a3440c8772fe814a3f4732c054b3271
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
8 years agoDepend on odlparent version of blueprint
Ryan Goulding [Thu, 7 Apr 2016 18:57:10 +0000 (14:57 -0400)]
Depend on odlparent version of blueprint

Inherit the common version of blueprint core from odlparent.

Change-Id: I98cee88b2c43929cec82a714d6a7530bd1b8064e
Signed-off-by: Ryan Goulding <ryandgoulding@gmail.com>
8 years agoAdd blueprint extension to register notification listener
Tom Pantelis [Mon, 21 Mar 2016 11:27:36 +0000 (07:27 -0400)]
Add blueprint extension to register notification listener

Added a blueprint extension element <notification-listener> that
registers a NotificationListener implementation with the MD-SAL
NotificationService.

Change-Id: I5ba9b1124ccba4d5c0f8d2e323eb3dd0e918cd94
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
8 years agoAdd blueprint extensions to get and register RPC services
Tom Pantelis [Mon, 21 Mar 2016 08:41:47 +0000 (04:41 -0400)]
Add blueprint extensions to get and register RPC services

Added several blueprint extension elements to support RPCs:

<rpc-implementation> - registers a global RPC implementation. If
"interface" isn't specified, it registers all RpcService interfaces
implemented by the ref'ed instance.

<routed-rpc-implementation> - registers a routed RPC implementation
and returns a RoutedRpcRegistration instance for injection into other
beans via the specified "id. If "interface" isn't specified, it looks
for a single RpcService interface implemented by the ref'ed instance.
If multiple are found it fails since only one RoutedRpcRegistration
instance can be returned.

<rpc-service> - finds the registered RpcService corresponding to the
specified "interface" and makes it available for injection into other
beans via the specified "id".

Internally the bean implementations obtain the binding
RpcServiceRegistry.

Change-Id: I432dfb5378ca8368e41fb5375c9d5515dd3e714d
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
8 years agoAdd decorating "type" attr extension for service refs
Tom Pantelis [Sun, 20 Mar 2016 04:06:08 +0000 (00:06 -0400)]
Add decorating "type" attr extension for service refs

Added an attribute extension to the <service> element that adds an
OSGi service property of the form "type=<value>". This allows providers
of a service to advertise the type of the service to distinguish it from
other services provided for the same interface.

Conversely, the extension can also be used in <reference> elements to allow
consumers of the service to specify which service implementation they
want.

As a convention, the "default" type should be used for the default
implementation of the service with other types being specialized
implementations. This allows consumers to obtain whichever
implementation the provider deems as the default without having to
explicitly know it and allows the provider to switch to a new
implementation without requiring all consumers to change their
referenced type.

If a consumer doesn't specify the "type" attribute, it may be ambiguous
as to which service is obtained. Rather than requiring that the "type"
attribute be specfied for every <reference> element, I added an attribute
extension attribute, "use-default-for-reference-types", to the <blueprint>
element that automatically adds a filter to all <reference> elements where
the "type" property is either not set or set to "default" if the "type"
attribute isn't explicitly specified. This ensures the default implementation
is imported if there are other implementations advertised with other types.

Change-Id: Ie61bb45da1c7539732cd31ab0f8130233c9696fc
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
8 years agoAdd restart-dependents-on-update blueprint extension
Tom Pantelis [Sat, 19 Mar 2016 20:51:29 +0000 (16:51 -0400)]
Add restart-dependents-on-update blueprint extension

Added an attribute extension to the <blueprint> element that adds a bean
processor that scans for any "property-placeholder" elements and reacts to
changes to the corresponding cfg file by restarting this blueprint
container and any dependent containers that consume OSGi services provided by
this container in an atomic and orderly manner. This mimics the module
restart functionality provided by the CSS.

A new OSGi service, BlueprintContainerRestartService, was added that
performs the orderly restart. This service is created and registered by
the BlueprintBundleTracker.

Change-Id: I5f463303c3a8aba35b3ed914268bdc67ac795a5a
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
8 years agoAdd Blueprint bundle tracker
Tom Pantelis [Tue, 5 Apr 2016 04:30:37 +0000 (00:30 -0400)]
Add Blueprint bundle tracker

Added an initial blueprint bundle and BlueprintBundleTracker which
scans ACTIVE bundles for blueprint XML files located under the well-known
org/opendaylight/blueprint/ path and deploys the XML files via the
Aries BlueprintExtenderService. This path differs from the standard
OSGI-INF/blueprint path to allow for controlled deployment of
blueprint containers in an orderly manner.

Change-Id: I21fd5aeb1d9ccd609caa8ea89bd66648fee5ad97
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>