Search in sources :

Example 1 with YangLibraryUpdate

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.library.rev190104.YangLibraryUpdate in project netconf by opendaylight.

the class YangLibraryNotificationProducerRFC8525 method onDataTreeChanged.

@Override
public void onDataTreeChanged(@NonNull Collection<DataTreeModification<YangLibrary>> changes) {
    for (DataTreeModification<YangLibrary> change : changes) {
        final DataObjectModification<YangLibrary> rootNode = change.getRootNode();
        final YangLibrary dataAfter = rootNode.getDataAfter();
        if (dataAfter != null) {
            final YangLibraryUpdate yangLibraryUpdate = new YangLibraryUpdateBuilder().setContentId(dataAfter.getContentId()).build();
            yangLibraryPublisherRegistration.onYangLibraryUpdate(yangLibraryUpdate);
        }
    }
}
Also used : YangLibraryUpdateBuilder(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.library.rev190104.YangLibraryUpdateBuilder) YangLibraryUpdate(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.library.rev190104.YangLibraryUpdate) YangLibrary(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.library.rev190104.YangLibrary)

Example 2 with YangLibraryUpdate

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.library.rev190104.YangLibraryUpdate in project netconf by opendaylight.

the class YangLibraryNotificationProducerTestRFC8525 method testOnDataTreeChanged.

@Test
public void testOnDataTreeChanged() {
    final String contentId = "1";
    YangLibrary yangLibraryAfter = new YangLibraryBuilder().setContentId(contentId).build();
    final DataTreeModification<YangLibrary> treeChange = mock(DataTreeModification.class);
    final DataObjectModification<Capabilities> objectChange = mock(DataObjectModification.class);
    doReturn(objectChange).when(treeChange).getRootNode();
    doReturn(yangLibraryAfter).when(objectChange).getDataAfter();
    YangLibraryUpdate yangLibraryUpdate = new YangLibraryUpdateBuilder().setContentId(contentId).build();
    yangLibraryNotificationProducer.onDataTreeChanged(Collections.singleton(treeChange));
    verify(yangLibraryPublisherRegistration).onYangLibraryUpdate(yangLibraryUpdate);
}
Also used : YangLibraryBuilder(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.library.rev190104.YangLibraryBuilder) YangLibraryUpdateBuilder(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.library.rev190104.YangLibraryUpdateBuilder) Capabilities(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.netconf.state.Capabilities) YangLibraryUpdate(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.library.rev190104.YangLibraryUpdate) YangLibrary(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.library.rev190104.YangLibrary) Test(org.junit.Test)

Aggregations

YangLibrary (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.library.rev190104.YangLibrary)2 YangLibraryUpdate (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.library.rev190104.YangLibraryUpdate)2 YangLibraryUpdateBuilder (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.library.rev190104.YangLibraryUpdateBuilder)2 Test (org.junit.Test)1 Capabilities (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.netconf.state.Capabilities)1 YangLibraryBuilder (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.library.rev190104.YangLibraryBuilder)1