summaryrefslogtreecommitdiffstats
path: root/v3po/data-impl/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'v3po/data-impl/src/main')
-rw-r--r--v3po/data-impl/src/main/java/io/fd/honeycomb/v3po/data/impl/OperationalDataTree.java43
-rw-r--r--v3po/data-impl/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/data/impl/rev160411/OperationalDataTreeModule.java2
-rw-r--r--v3po/data-impl/src/main/yang/data-impl.yang10
3 files changed, 49 insertions, 6 deletions
diff --git a/v3po/data-impl/src/main/java/io/fd/honeycomb/v3po/data/impl/OperationalDataTree.java b/v3po/data-impl/src/main/java/io/fd/honeycomb/v3po/data/impl/OperationalDataTree.java
index de737c729..5d3b00646 100644
--- a/v3po/data-impl/src/main/java/io/fd/honeycomb/v3po/data/impl/OperationalDataTree.java
+++ b/v3po/data-impl/src/main/java/io/fd/honeycomb/v3po/data/impl/OperationalDataTree.java
@@ -35,6 +35,10 @@ import java.util.Collection;
import java.util.Map;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
+import org.opendaylight.controller.md.sal.dom.api.DOMDataReadOnlyTransaction;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.NetconfState;
import org.opendaylight.yangtools.binding.data.codec.api.BindingNormalizedNodeSerializer;
import org.opendaylight.yangtools.yang.binding.DataObject;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
@@ -64,17 +68,20 @@ public final class OperationalDataTree implements ReadableDataTree {
private final BindingNormalizedNodeSerializer serializer;
private final ReaderRegistry readerRegistry;
private final SchemaContext globalContext;
+ private final DOMDataBroker netconfMonitoringDomDataBrokerDependency;
/**
* Creates operational data tree instance.
- *
- * @param serializer service for serialization between Java Binding Data representation and NormalizedNode
+ * @param serializer service for serialization between Java Binding Data representation and NormalizedNode
* representation.
* @param globalContext service for obtaining top level context data from all yang modules.
* @param readerRegistry service responsible for translation between DataObjects and data provider.
+ * @param netconfMonitoringDomDataBrokerDependency
*/
public OperationalDataTree(@Nonnull BindingNormalizedNodeSerializer serializer,
- @Nonnull final SchemaContext globalContext, @Nonnull ReaderRegistry readerRegistry) {
+ @Nonnull final SchemaContext globalContext, @Nonnull ReaderRegistry readerRegistry,
+ final DOMDataBroker netconfMonitoringDomDataBrokerDependency) {
+ this.netconfMonitoringDomDataBrokerDependency = netconfMonitoringDomDataBrokerDependency;
this.globalContext = checkNotNull(globalContext, "globalContext should not be null");
this.serializer = checkNotNull(serializer, "serializer should not be null");
this.readerRegistry = checkNotNull(readerRegistry, "reader should not be null");
@@ -99,8 +106,14 @@ public final class OperationalDataTree implements ReadableDataTree {
}
private Optional<NormalizedNode<?, ?>> readNode(final YangInstanceIdentifier yangInstanceIdentifier,
- final ReadContext ctx)
- throws ReadFailedException {
+ final ReadContext ctx) throws ReadFailedException {
+
+ // FIXME workaround for: https://git.opendaylight.org/gerrit/#/c/37499/
+ if(yangInstanceIdentifier.getPathArguments().size() > 0 &&
+ yangInstanceIdentifier.getPathArguments().get(0).getNodeType().equals(NetconfState.QNAME)) {
+ return readFromNetconfDs(yangInstanceIdentifier);
+ }
+
LOG.debug("OperationalDataTree.readNode(), yangInstanceIdentifier={}", yangInstanceIdentifier);
final InstanceIdentifier<?> path = serializer.fromYangInstanceIdentifier(yangInstanceIdentifier);
checkNotNull(path, "Invalid instance identifier %s. Cannot create BA equivalent.", yangInstanceIdentifier);
@@ -117,6 +130,19 @@ public final class OperationalDataTree implements ReadableDataTree {
}
}
+ // FIXME workaround for: https://git.opendaylight.org/gerrit/#/c/37499/
+ private Optional<NormalizedNode<?, ?>> readFromNetconfDs(final YangInstanceIdentifier yangInstanceIdentifier)
+ throws ReadFailedException {
+ try(final DOMDataReadOnlyTransaction domDataReadOnlyTransaction =
+ netconfMonitoringDomDataBrokerDependency.newReadOnlyTransaction()) {
+ try {
+ return domDataReadOnlyTransaction.read(LogicalDatastoreType.OPERATIONAL, yangInstanceIdentifier).checkedGet();
+ } catch (org.opendaylight.controller.md.sal.common.api.data.ReadFailedException e) {
+ throw new ReadFailedException(InstanceIdentifier.create(NetconfState.class), e);
+ }
+ }
+ }
+
private Optional<NormalizedNode<?, ?>> readRoot(final ReadContext ctx) throws ReadFailedException {
LOG.debug("OperationalDataTree.readRoot()");
@@ -134,6 +160,13 @@ public final class OperationalDataTree implements ReadableDataTree {
dataNodeBuilder.withChild((DataContainerChild<?, ?>) node);
}
+ // FIXME workaround for: https://git.opendaylight.org/gerrit/#/c/37499/
+ final Optional<NormalizedNode<?, ?>> normalizedNodeOptional =
+ readFromNetconfDs(YangInstanceIdentifier.builder().node(NetconfState.QNAME).build());
+ if(normalizedNodeOptional.isPresent()) {
+ dataNodeBuilder.withChild((DataContainerChild<?, ?>) normalizedNodeOptional.get());
+ }
+
return Optional.<NormalizedNode<?, ?>>of(dataNodeBuilder.build());
}
diff --git a/v3po/data-impl/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/data/impl/rev160411/OperationalDataTreeModule.java b/v3po/data-impl/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/data/impl/rev160411/OperationalDataTreeModule.java
index 24a1ca519..2fbba75fa 100644
--- a/v3po/data-impl/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/data/impl/rev160411/OperationalDataTreeModule.java
+++ b/v3po/data-impl/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/data/impl/rev160411/OperationalDataTreeModule.java
@@ -38,7 +38,7 @@ public class OperationalDataTreeModule extends
LOG.debug("OperationalDataTreeModule.createInstance()");
return new CloseableOperationalDataTree(
new OperationalDataTree(getSerializerDependency(), getSchemaServiceDependency().getGlobalContext(),
- getReaderRegistryDependency()));
+ getReaderRegistryDependency(), getNetconfMonitoringDomDataBrokerDependency()));
}
private static final class CloseableOperationalDataTree implements ReadableDataTree, AutoCloseable {
diff --git a/v3po/data-impl/src/main/yang/data-impl.yang b/v3po/data-impl/src/main/yang/data-impl.yang
index 43201a084..5275e6556 100644
--- a/v3po/data-impl/src/main/yang/data-impl.yang
+++ b/v3po/data-impl/src/main/yang/data-impl.yang
@@ -121,6 +121,16 @@ module data-impl {
}
}
+ // FIXME workaround for: https://git.opendaylight.org/gerrit/#/c/37499/
+ container netconf-monitoring-dom-data-broker {
+ uses config:service-ref {
+ refine type {
+ mandatory true;
+ config:required-identity dom:dom-async-data-broker;
+ }
+ }
+ }
+
}
}
} \ No newline at end of file