[CONTROLLER-581] DataChangeListener unable to read created data Created: 24/Jun/14  Updated: 25/Jul/23  Resolved: 25/Jun/14

Status: Resolved
Project: controller
Component/s: mdsal
Affects Version/s: None
Fix Version/s: None

Type: Bug
Reporter: Robert Gallas Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: Windows
Platform: PC


External issue ID: 1240

 Description   

In application DataChangeListener is registered.

Upon sending POST using restconf onDataChanged method is invoked.

Following code:
public void onDataChanged(DataChangeEvent<InstanceIdentifier<?>, DataObject> change) {
logger.info("onDataChanged change.getCreatedOperationalData().entrySet().size()={}",
change.getCreatedOperationalData().entrySet().size());
logger.info("onDataChanged change.getUpdatedOperationalData().entrySet().size()={}",
change.getUpdatedOperationalData().entrySet().size());
}

Produces output:
2014-06-24 14:56:48.995 CEST [pool-14-thread-2] INFO o.o.c.i.d.a.i.h.ServiceElineListener - onDataChanged change.getCreatedOperationalData().entrySet().size()=0
2014-06-24 14:56:48.997 CEST [pool-14-thread-2] INFO o.o.c.i.d.a.i.h.ServiceElineListener - onDataChanged change.getUpdatedOperationalData().entrySet().size()=0

Subsequent GET on restconf proves POST-ed data are stored into datastore.

Since DataCommitHandler has bug registered, this second approach to read created data, is blocker for us.



 Comments   
Comment by Tony Tkacik [ 24/Jun/14 ]

You are reading from Operational DAta but you are posting to configuration
data tree. Please update your code
to change.getCreatedConfigurationData() and change.getUpdatedConfigurationData().

Operational data CAN NOT be updated via Restconf, that is why you see
this fields empty.

Marked this as Resolved - Invalid, since Data Change Listeners (using Configuration) methods are verified to be working with Restconf.

(https://jenkins.opendaylight.org/integration/job/integration-master-csit-base-of13/ - test restconf puts, components process data as data changes).

Comment by Robert Gallas [ 25/Jun/14 ]

Sorry may fault:
Of course reading configuration data an not operational data is what fails:

logger.info("onDataChanged change.getCreatedConfigurationData().entrySet().size()={}",
change.getCreatedConfigurationData().entrySet().size());
logger.info("onDataChanged change.getUpdatedConfigurationData().entrySet().size()={}",
change.getUpdatedConfigurationData().entrySet().size());

ends up with:
2014-06-25 08:49:09.190 CEST [pool-15-thread-2] INFO o.o.c.i.d.a.i.h.ServiceXXXListener - onDataChanged change.getCreatedConfigurationData().entrySet().size()=0
2014-06-25 08:49:09.191 CEST [pool-15-thread-2] INFO o.o.c.i.d.a.i.h.ServiceXXXListener - onDataChanged change.getUpdatedConfigurationData().entrySet().size()=0

As I said in bug creation data are inserted in data store but deserialization fails at data change listener.

Hovever there is a difference in output: when logger contains code to read configuration data exception is thorwn:

So the steps are:
1. init application
2. send restconf post with data
Async listener events:
if change.getCreatedConfigurationData().entrySet() is called, entry set equalls zero and deserialization exception is thrown
if change.getCreatedOperationalData().entrySet() is called entry set equalls to zero (which is correct) but not exception is thrown.
3. successful return from restconf post
4. restconf get confirms data are uploaded to store

Root cause of exception seems to be:
Caused by: java.lang.ClassNotFoundException: org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress

Meaning that even data are succesfully uploaded to datastore

1. in listener I'm unable to read change
2. exception is thrown based on reading config or operational data because of ClassNotFoundException, but missing class does not prevents data to be stored in datastore
3. fails to read (deserialize) but not to store data in data store. Seems like dual approach in handling datastore operations. (guess only of course)

Code is proprietary so I cannot post code. So only code samples

Referencig yang:

...
import ietf-yang-types

{ prefix "yang"; }

...
leaf mac-address {
type yang:mac-address;
...
}
...

In cache there are two ietf-yang-types and both of them contains:
...
typedef mac-address {
type string {
pattern '[0-9a-fA-F]

{2}(:[0-9a-fA-F]{2}

)

{5}

';
}
...

Comment by Robert Gallas [ 25/Jun/14 ]

referencing YANG needes to reference ietf-yang-types by revision as well. After adding revision listener works OK.

Generated at Wed Feb 07 19:53:23 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.