Add discovery client infra to publish/un-publish services

Bug #1474165 reported by Nischal Sheth
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Juniper Openstack
Status tracked in Trunk
R2.20
Fix Committed
High
Nipa
Trunk
Fix Committed
High
Nipa

Bug Description

Existing implementation of discovery client provides APIs to publish and
withdraw services.

There's a requirement to publish service only if a list of conditions are
satisfied. For example, control node may like to publish xmpp service only
if the following conditions are met:

a) Connection to IFMap server is established
b) End of Rib Marker has been received/inferred on IFMap connection
c) Configuration for it's own bgp-router object has been received

Using the existing APIs is somewhat cumbersome since these daemon needs to
check all these conditions before deciding whether to publish or withdraw.

Proposal is to implement the following in the discovery client library:

1. Provide ability to register a "MayPublish" callback (returns a bool) when creating a discovery client. The library code should invoke this callback in order to decide whether to publish or withdraw the service.
The daemon code will check all conditions in the callback and return true
or false. At a minimum, this callback should be invoked periodically e.g.
sending a keep alive to discovery server. The MayPublish callback should
be invoked in the context of a well-known Task e.g bgp::Config or better
still, the task name/id should be a parameter for DiscoveryServiceClient constructor. The callback should also have a pass by reference string
parameter that the daemon fills with the reason for not publishing. This
should be used by the client library for logging purposes. It may also
be useful to pass the reason string to the discovery server so that it
can display that via introspect or UI.

2. Provide a new API ("ReEvaluatePublish") that the daemon can use to make
library invoke the MayPublish API asynchronously. The intent is for daemon
to call re-evaluate API when one of the conditions for publish or withdraw
changes. That should trigger discovery client to invoke MayPublish almost
immediately and decide whether it needs to publish/withdraw the service.
It should be possible for daemon to call re-evaluate API from an arbitrary
Task or the main thread. The client library should implement some kind of
back-off so that mutliple back to back calls to re-evaluate do not result
in multiple updates to the discovery server. One possibility could be to
react to a maximum of 1 (or some small number) of ReEvaluatePublish calls
in a keepalive interval.

Note that similar logic can be implemented by the daemon too, but it would
be much nicer to have this functionality in the client library.

Nischal Sheth (nsheth)
description: updated
Nischal Sheth (nsheth)
tags: added: quench
Nischal Sheth (nsheth)
description: updated
Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : [Review update] master

Review in progress for https://review.opencontrail.org/12465
Submitter: Nipa Kumar (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : A change has been merged

Reviewed: https://review.opencontrail.org/12465
Committed: http://github.org/Juniper/contrail-controller/commit/d51242fcc037863b9faeb9dbe7b2300327790e16
Submitter: Zuul
Branch: master

commit d51242fcc037863b9faeb9dbe7b2300327790e16
Author: Nipa Kumar <email address hidden>
Date: Fri Jul 17 00:16:58 2015 -0700

Enhance Discovery Service Client to periodically(heartbeat interval) reevaluate
admin status of published service and updating discovery server. Reevaluate is
a callback handler to be registered by the published service of the daemon.

a) Allow daemons to provide a taskname to execute reevaluate callback.
b) Callback can also provide a reason string while reevaluating published services.

Change-Id: Iff6a41b1621bd5103ecebdbce5404efd2a891b43
Closes-Bug:1474165

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : [Review update] R2.20

Review in progress for https://review.opencontrail.org/12651
Submitter: Nipa Kumar (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : A change has been merged

Reviewed: https://review.opencontrail.org/12651
Committed: http://github.org/Juniper/contrail-controller/commit/91e6a47aa30866cb23f94ee8ff38e231c2cf5912
Submitter: Zuul
Branch: R2.20

commit 91e6a47aa30866cb23f94ee8ff38e231c2cf5912
Author: Nipa Kumar <email address hidden>
Date: Fri Jul 17 00:16:58 2015 -0700

Enhance Discovery Service Client to periodically(heartbeat interval) reevaluate
admin status of published service and updating discovery server. Reevaluate is
a callback handler to be registered by the published service of the daemon.

a) Allow daemons to provide a taskname to execute reevaluate callback.
b) Callback can also provide a reason string while reevaluating published services.

Change-Id: Iff6a41b1621bd5103ecebdbce5404efd2a891b43
Closes-Bug:1474165

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : [Review update] R2.20

Review in progress for https://review.opencontrail.org/12758
Submitter: Nipa Kumar (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : [Review update] master

Review in progress for https://review.opencontrail.org/12755
Submitter: Nipa Kumar (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : [Review update] R2.20

Review in progress for https://review.opencontrail.org/12758
Submitter: Nipa Kumar (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : A change has been merged

Reviewed: https://review.opencontrail.org/12755
Committed: http://github.org/Juniper/contrail-controller/commit/6c4c3e9b59ba847f8781655faab2d346741be669
Submitter: Zuul
Branch: master

commit 6c4c3e9b59ba847f8781655faab2d346741be669
Author: Nipa Kumar <email address hidden>
Date: Thu Jul 30 12:33:30 2015 -0700

Fix compilation on trusty due to unused variable
Closes-Bug:1474165

Change-Id: Ie71767a8dc530ee133c846134d85d466266a3076

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote :

Reviewed: https://review.opencontrail.org/12758
Committed: http://github.org/Juniper/contrail-controller/commit/e882e4274b22e8557a5d884ed89ad7dc39324cfd
Submitter: Zuul
Branch: R2.20

commit e882e4274b22e8557a5d884ed89ad7dc39324cfd
Author: Nipa Kumar <email address hidden>
Date: Thu Jul 30 12:35:23 2015 -0700

Fix compilation on trusty due to unused variable
Closes-Bug:1474165

Change-Id: If32cbc5d7c356f28d0ab2c4810dc78bc97c0c9e7

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : [Review update] R2.22-dev

Review in progress for https://review.opencontrail.org/13927
Submitter: Vinay Vithal Mahuli (<email address hidden>)

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.