cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Announcements

155
Views
0
Helpful
7
Replies
khgrant
Cisco Employee

CDB Subscription

 

Hi team,

 

I am working with CDB subscriptions and have couple of things that are puzzling me:

 

    • I am looking for changes in the interface configs. My original idea was to subscribe to /devices/device/config/ios:interface/. After doing some testing, I realised that I was naïve. If device gets deleted, then subscription doesn’t receive a notification even though whole sections is wiped out. Is my observation correct? Is there a cleaner/nicer way around it besides subscribing to the whole /devices/device tree?

    • Is there a workflow which I could look into, how does an entry get created? For example I can see that first it gets created and then value is set (MOP_VALUE_SET). Since I am looking for values, can I disregard some OP codes?

    • What would be the best way to see what changed, when it comes to MOP_DELETE? Based on the outputs I see just that everything got deleted, but I have no idea from that what was there in the first place…

 

Kind regards,

 

Bostjan

 

7 REPLIES 7
khgrant
Cisco Employee

 

Hi Bostjan,

 

 

Wondering if setting DiffIterateFlags.ITER_WANT_ANCESTOR_DELETE would help when you iterate in your subscription handling code.

 

 

Regarding the state transitions, perhaps add some LOGGER.trace for the various ops in your iterator and dump it all out. Then add logic to look for particular state/value of interest and perform the action that you want.

 

 

Thanks,

  Bilal

 

Hi Bilal,

 

Thanks for reply. Is that flag set during subscription? Because I don’t see iteration being triggered at all during parent deletion…

 

BR,

Bostjan

 

khgrant
Cisco Employee

 

Just before you are about to iterate on a notification.

 

 

sub.diffIterate(points[0], new Iter(modified), enumSet, sess);

 

 

Put it in enumSet.

 

 

Thanks,

 

Bilal.

 

khgrant
Cisco Employee

 

Good stuff, it works!!! Thanks! Managed to get it subscribe to interface and still receive parent deletion.

 

 

To go one step ahead, is there a way to see what was in the tree before the deletion? I guess it must be since NCS/NSO keeps track of changes…

 

 

BR,

Bostjan

 

khgrant
Cisco Employee

 

Hi Bostjan,

 

 

When you create your cdb session, before you iterate, can you try the connection type to be “pre commit”:

 

new CdbSession(cdb, CdbDBType.CDB_PRE_COMMIT_RUNNING);

 

 

See if that helps solve your problem.

 

 

Thanks,

 

Bilal.

 

khgrant
Cisco Employee

 

Thanks, found it. Somehow I can’t glue them together, probably missing a piece of a puzzle. I can create a session but I can’t seem to find a way to get subscription to use it. Also based on docs it seems that either session or subscription…

 

 

BR,

 

Bostjan

 

khgrant
Cisco Employee

 

Got an idea. In the MOP_DELETED section I create another CDB session with PRECOMMIT CDB. I see I can access pre-commit data.

 

 

Is CDB API the only one that can use it? Any example that I could use how to iterate over interfaces in CDB API?

 

 

BR,

 

Bostjan

 

Create
Recognize Your Peers
Content for Community-Ad