summaryrefslogtreecommitdiffstats
path: root/v3po
diff options
context:
space:
mode:
Diffstat (limited to 'v3po')
-rw-r--r--v3po/data-impl/pom.xml13
-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
-rw-r--r--v3po/data-impl/src/test/java/io/fd/honeycomb/v3po/data/impl/OperationalDataTreeTest.java18
-rw-r--r--v3po/impl/pom.xml12
-rw-r--r--v3po/impl/src/main/config/default-config.xml71
-rw-r--r--v3po/impl/src/main/config/netconf-north-config.xml290
-rw-r--r--v3po/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/NetconfMonitoringReaderModule.java28
-rw-r--r--v3po/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/NetconfMonitoringReaderModuleFactory.java13
-rw-r--r--v3po/impl/src/main/yang/v3po-impl.yang21
-rw-r--r--v3po/translate-utils/src/main/java/io/fd/honeycomb/v3po/translate/util/read/BindingBrokerReader.java67
-rw-r--r--v3po/translate-utils/src/main/java/io/fd/honeycomb/v3po/translate/util/read/NoopReaderCustomizer.java4
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/vppstate/BridgeDomainCustomizer.java7
14 files changed, 431 insertions, 168 deletions
diff --git a/v3po/data-impl/pom.xml b/v3po/data-impl/pom.xml
index 954d25c30..1d716a6d9 100644
--- a/v3po/data-impl/pom.xml
+++ b/v3po/data-impl/pom.xml
@@ -54,6 +54,19 @@
<version>1.3.0-Beryllium</version> <!-- FIXME use dependency management -->
</dependency>
+ <!-- FIXME workaround for https://git.opendaylight.org/gerrit/#/c/37499/-->
+ <dependency>
+ <groupId>org.opendaylight.netconf</groupId>
+ <artifactId>ietf-netconf-monitoring</artifactId>
+ <version>1.0.0-Beryllium</version>
+ </dependency>
+ <!-- FIXME workaround for https://git.opendaylight.org/gerrit/#/c/37499/-->
+ <dependency>
+ <groupId>org.opendaylight.netconf</groupId>
+ <artifactId>ietf-netconf-monitoring-extension</artifactId>
+ <version>1.0.0-Beryllium</version>
+ </dependency>
+
<!-- Testing Dependencies -->
<dependency>
<groupId>junit</groupId>
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
diff --git a/v3po/data-impl/src/test/java/io/fd/honeycomb/v3po/data/impl/OperationalDataTreeTest.java b/v3po/data-impl/src/test/java/io/fd/honeycomb/v3po/data/impl/OperationalDataTreeTest.java
index fbd512915..7e6abcdcd 100644
--- a/v3po/data-impl/src/test/java/io/fd/honeycomb/v3po/data/impl/OperationalDataTreeTest.java
+++ b/v3po/data-impl/src/test/java/io/fd/honeycomb/v3po/data/impl/OperationalDataTreeTest.java
@@ -34,15 +34,20 @@ import com.google.common.collect.Iterables;
import com.google.common.collect.LinkedListMultimap;
import com.google.common.collect.Multimap;
import com.google.common.util.concurrent.CheckedFuture;
+import com.google.common.util.concurrent.Futures;
import io.fd.honeycomb.v3po.translate.read.ReadContext;
import io.fd.honeycomb.v3po.translate.read.ReaderRegistry;
+import java.util.Collections;
import java.util.Map;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
-import org.opendaylight.yangtools.binding.data.codec.api.BindingNormalizedNodeSerializer;
+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.opendaylight.params.xml.ns.yang.v3po.rev150105.VppState;
+import org.opendaylight.yangtools.binding.data.codec.api.BindingNormalizedNodeSerializer;
import org.opendaylight.yangtools.yang.binding.DataObject;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.common.QName;
@@ -72,12 +77,20 @@ public class OperationalDataTreeTest {
private DataSchemaNode schemaNode;
@Mock
private ReadContext readCtx;
+ @Mock
+ private DOMDataBroker netconfMonitoringBroker;
+ @Mock
+ private DOMDataReadOnlyTransaction domDataReadOnlyTransaction;
@Before
public void setUp() {
initMocks(this);
- operationalData = new OperationalDataTree(serializer, globalContext, reader);
+ operationalData = new OperationalDataTree(serializer, globalContext, reader, netconfMonitoringBroker);
doReturn(schemaNode).when(globalContext).getDataChildByName(any(QName.class));
+
+ doReturn(domDataReadOnlyTransaction).when(netconfMonitoringBroker).newReadOnlyTransaction();
+ doReturn(Futures.immediateCheckedFuture(Optional.absent())).when(domDataReadOnlyTransaction)
+ .read(any(LogicalDatastoreType.class), any(YangInstanceIdentifier.class));
}
@Test
@@ -85,6 +98,7 @@ public class OperationalDataTreeTest {
final YangInstanceIdentifier yangId = mock(YangInstanceIdentifier.class);
final YangInstanceIdentifier.PathArgument pArg = mock(YangInstanceIdentifier.PathArgument.class);
doReturn(pArg).when(yangId).getLastPathArgument();
+ doReturn(Collections.singletonList(pArg)).when(yangId).getPathArguments();
doReturn(QName.create("namespace", "2012-12-12", "local")).when(pArg).getNodeType();
doReturn(id).when(serializer).fromYangInstanceIdentifier(yangId);
diff --git a/v3po/impl/pom.xml b/v3po/impl/pom.xml
index c00c98396..afad4b8f2 100644
--- a/v3po/impl/pom.xml
+++ b/v3po/impl/pom.xml
@@ -54,6 +54,18 @@
<artifactId>vpp-cfg-init</artifactId>
<version>${project.version}</version>
</dependency>
+ <!-- TODO used by NetconfMonitoringReaderModule, get it out of here-->
+ <dependency>
+ <groupId>org.opendaylight.netconf</groupId>
+ <artifactId>ietf-netconf-monitoring</artifactId>
+ <version>1.0.0-Beryllium</version>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.netconf</groupId>
+ <artifactId>ietf-netconf-monitoring-extension</artifactId>
+ <version>1.0.0-Beryllium</version>
+ </dependency>
+
<dependency>
<groupId>io.fd.vpp</groupId>
diff --git a/v3po/impl/src/main/config/default-config.xml b/v3po/impl/src/main/config/default-config.xml
index 518a6fa58..fac06e136 100644
--- a/v3po/impl/src/main/config/default-config.xml
+++ b/v3po/impl/src/main/config/default-config.xml
@@ -66,6 +66,48 @@
</writer-registry>
</module>
+ <!-- FIXME workaround for: https://git.opendaylight.org/gerrit/#/c/37499/ Move to netconf-north-config-->
+ <module>
+ <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:inmemory-datastore-provider">prefix:inmemory-config-datastore-provider</type>
+ <name>netconf-config-store-service</name>
+ <inmemory-config-datastore-provider xmlns="urn:opendaylight:params:xml:ns:yang:controller:inmemory-datastore-provider">
+ <schema-service>
+ <type xmlns:dom="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">dom:schema-service</type>
+ <name>yang-schema-service</name>
+ </schema-service>
+ </inmemory-config-datastore-provider>
+ </module>
+ <module>
+ <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:inmemory-datastore-provider">prefix:inmemory-operational-datastore-provider</type>
+ <name>netconf-operational-store-service</name>
+ <inmemory-operational-datastore-provider xmlns="urn:opendaylight:params:xml:ns:yang:controller:inmemory-datastore-provider">
+ <schema-service>
+ <type xmlns:dom="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">dom:schema-service</type>
+ <name>yang-schema-service</name>
+ </schema-service>
+ </inmemory-operational-datastore-provider>
+ </module>
+ <module>
+ <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:impl">prefix:dom-inmemory-data-broker</type>
+ <name>netconf-inmemory-data-broker</name>
+
+ <schema-service>
+ <type xmlns:dom="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">dom:schema-service</type>
+ <name>yang-schema-service</name>
+ </schema-service>
+
+ <config-data-store>
+ <type xmlns:config-dom-store-spi="urn:opendaylight:params:xml:ns:yang:controller:md:sal:core:spi:config-dom-store">config-dom-store-spi:config-dom-datastore</type>
+ <name>netconf-config-store-service</name>
+ </config-data-store>
+
+ <operational-data-store>
+ <type xmlns:operational-dom-store-spi="urn:opendaylight:params:xml:ns:yang:controller:md:sal:core:spi:operational-dom-store">operational-dom-store-spi:operational-dom-datastore</type>
+ <name>netconf-operational-store-service</name>
+ </operational-data-store>
+ </module>
+ <!-- FIXME end-->
+
<!-- HC operational data tree -->
<module>
<type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:data:impl">prefix:honeycomb-operational-data-tree</type>
@@ -82,6 +124,10 @@
<type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:translate:api">prefix:honeycomb-reader-registry</type>
<name>read-registry</name>
</reader-registry>
+ <netconf-monitoring-dom-data-broker>
+ <type xmlns:dom="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">dom:dom-async-data-broker</type>
+ <name>netconf-inmemory-data-broker</name>
+ </netconf-monitoring-dom-data-broker>
</module>
<!-- DOM data broker which provides transaction functionality for HC using BI format-->
@@ -212,6 +258,31 @@
</modules>
<services xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
+ <!-- FIXME workaround for: https://git.opendaylight.org/gerrit/#/c/37499/ Move to netconf-north-config -->
+
+ <service>
+ <type xmlns:config-dom-store-spi="urn:opendaylight:params:xml:ns:yang:controller:md:sal:core:spi:config-dom-store">config-dom-store-spi:config-dom-datastore</type>
+ <instance>
+ <name>netconf-config-store-service</name>
+ <provider>/modules/module[type='inmemory-config-datastore-provider'][name='netconf-config-store-service']</provider>
+ </instance>
+ </service>
+ <service>
+ <type xmlns:operational-dom-store-spi="urn:opendaylight:params:xml:ns:yang:controller:md:sal:core:spi:operational-dom-store">operational-dom-store-spi:operational-dom-datastore</type>
+ <instance>
+ <name>netconf-operational-store-service</name>
+ <provider>/modules/module[type='inmemory-operational-datastore-provider'][name='netconf-operational-store-service']</provider>
+ </instance>
+ </service>
+ <service>
+ <type xmlns:dom="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">dom:dom-async-data-broker</type>
+ <instance>
+ <name>netconf-inmemory-data-broker</name>
+ <provider>/modules/module[type='dom-inmemory-data-broker'][name='netconf-inmemory-data-broker']</provider>
+ </instance>
+ </service>
+ <!-- FIXME end-->
+
<service>
<type xmlns:dom="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">dom:dom-async-data-broker</type>
diff --git a/v3po/impl/src/main/config/netconf-north-config.xml b/v3po/impl/src/main/config/netconf-north-config.xml
index fc913fcb1..f7f0629d4 100644
--- a/v3po/impl/src/main/config/netconf-north-config.xml
+++ b/v3po/impl/src/main/config/netconf-north-config.xml
@@ -23,45 +23,7 @@
<modules xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
<!-- In memory DS dedicated to NETCONF monitoring, notifications etc. -->
- <module>
- <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:inmemory-datastore-provider">prefix:inmemory-config-datastore-provider</type>
- <name>netconf-config-store-service</name>
- <inmemory-config-datastore-provider xmlns="urn:opendaylight:params:xml:ns:yang:controller:inmemory-datastore-provider">
- <schema-service>
- <type xmlns:dom="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">dom:schema-service</type>
- <name>yang-schema-service</name>
- </schema-service>
- </inmemory-config-datastore-provider>
- </module>
- <module>
- <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:inmemory-datastore-provider">prefix:inmemory-operational-datastore-provider</type>
- <name>netconf-operational-store-service</name>
- <inmemory-operational-datastore-provider xmlns="urn:opendaylight:params:xml:ns:yang:controller:inmemory-datastore-provider">
- <schema-service>
- <type xmlns:dom="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">dom:schema-service</type>
- <name>yang-schema-service</name>
- </schema-service>
- </inmemory-operational-datastore-provider>
- </module>
- <module>
- <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:impl">prefix:dom-inmemory-data-broker</type>
- <name>netconf-inmemory-data-broker</name>
-
- <schema-service>
- <type xmlns:dom="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">dom:schema-service</type>
- <name>yang-schema-service</name>
- </schema-service>
- <config-data-store>
- <type xmlns:config-dom-store-spi="urn:opendaylight:params:xml:ns:yang:controller:md:sal:core:spi:config-dom-store">config-dom-store-spi:config-dom-datastore</type>
- <name>netconf-config-store-service</name>
- </config-data-store>
-
- <operational-data-store>
- <type xmlns:operational-dom-store-spi="urn:opendaylight:params:xml:ns:yang:controller:md:sal:core:spi:operational-dom-store">operational-dom-store-spi:operational-dom-datastore</type>
- <name>netconf-operational-store-service</name>
- </operational-data-store>
- </module>
<module>
@@ -318,31 +280,41 @@
<port xmlns="urn:opendaylight:params:xml:ns:yang:controller:netconf:northbound:tcp">7777</port>
</module>
+ <!-- Special reader for Netconf monitoring. The problem is that we store netconf monitoring in a dedicated DS.
+ However netconf is wired to our reader registry, so we need to delegate the reads of netconf-monitoring
+ through our readers to the dedicated DS-->
+ <module>
+ <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:v3po:impl">prefix:netconf-monitoring-reader</type>
+ <name>netconf-monitoring-reader</name>
+ <netconf-monitoring-binding-broker>
+ <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-async-data-broker</type>
+ <name>netconf-binding-data-broker</name>
+ </netconf-monitoring-binding-broker>
+ </module>
+ <!--FIXME disable the reader until this patch is merged and released by ODL: TODO link -->
+ <!--<module>-->
+ <!--<type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:translate:utils">prefix:delegating-reader-registry</type>-->
+ <!--<name>read-registry</name>-->
+ <!--<root-readers>-->
+ <!--<type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:translate:api">prefix:honeycomb-reader</type>-->
+ <!--<name>netconf-monitoring-reader</name>-->
+ <!--</root-readers>-->
+ <!--</module>-->
+ <!-- END: Special reader for Netconf monitoring. -->
+
</modules>
<services xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
- <!-- In memory DS dedicated to NETCONF monitoring, notifications etc. -->
- <service>
- <type xmlns:config-dom-store-spi="urn:opendaylight:params:xml:ns:yang:controller:md:sal:core:spi:config-dom-store">config-dom-store-spi:config-dom-datastore</type>
- <instance>
- <name>netconf-config-store-service</name>
- <provider>/modules/module[type='inmemory-config-datastore-provider'][name='netconf-config-store-service']</provider>
- </instance>
- </service>
- <service>
- <type xmlns:operational-dom-store-spi="urn:opendaylight:params:xml:ns:yang:controller:md:sal:core:spi:operational-dom-store">operational-dom-store-spi:operational-dom-datastore</type>
- <instance>
- <name>netconf-operational-store-service</name>
- <provider>/modules/module[type='inmemory-operational-datastore-provider'][name='netconf-operational-store-service']</provider>
- </instance>
- </service>
<service>
- <type xmlns:dom="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">dom:dom-async-data-broker</type>
+ <type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:translate:api">prefix:honeycomb-reader</type>
<instance>
- <name>netconf-inmemory-data-broker</name>
- <provider>/modules/module[type='dom-inmemory-data-broker'][name='netconf-inmemory-data-broker']</provider>
+ <name>netconf-monitoring-reader</name>
+ <provider>/modules/module[type='netconf-monitoring-reader'][name='netconf-monitoring-reader']</provider>
</instance>
</service>
+
+ <!-- In memory DS dedicated to NETCONF monitoring, notifications etc. -->
+
<service>
<type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-async-data-broker</type>
<instance>
@@ -359,108 +331,108 @@
</service>
<!-- END:In memory DS dedicated to NETCONF monitoring, notifications etc. -->
- <service>
- <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:config:netconf:northbound">
- prefix:netconf-server-monitoring
- </type>
- <instance>
- <name>vpp-server-monitor</name>
- <provider>/modules/module[type='netconf-server-monitoring-impl'][name='vpp-server-monitor']
- </provider>
- </instance>
- </service>
- <service>
- <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:netconf:north:mapper">
- prefix:netconf-northbound-mapper
- </type>
- <instance>
- <name>netconf-vpp-mapper</name>
- <provider>/modules/module[type='netconf-mdsal-mapper'][name='netconf-vpp-mapper']</provider>
- </instance>
- </service>
- <service>
- <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:netconf:north:mapper">
- prefix:netconf-northbound-mapper
- </type>
- <instance>
- <name>vpp-mapper-aggregator</name>
- <provider>/modules/module[type='netconf-mapper-aggregator'][name='vpp-mapper-aggregator']</provider>
- </instance>
- </service>
- <service>
- <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:netconf:north:mapper">
- prefix:netconf-mapper-registry
- </type>
- <instance>
- <name>vpp-mapper-aggregator-registry</name>
- <provider>/modules/module[type='netconf-mapper-aggregator'][name='vpp-mapper-aggregator']</provider>
- </instance>
- </service>
- <service>
- <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:config:netconf:northbound">
- prefix:netconf-server-dispatcher
- </type>
- <instance>
- <name>netconf-vpp-server-dispatcher</name>
- <provider>
- /modules/module[type='netconf-server-dispatcher-impl'][name='netconf-vpp-server-dispatcher']
- </provider>
- </instance>
- </service>
- <service>
- <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:netconf:north:mapper">
- prefix:netconf-northbound-mapper
- </type>
- <instance>
- <name>netconf-vpp-notification-mapper</name>
- <provider>
- /modules/module[type='netconf-mdsal-notification-mapper'][name='netconf-vpp-notification-mapper']
- </provider>
- </instance>
- </service>
- <service>
- <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:netconf:northbound:notification">
- prefix:netconf-notification-collector
- </type>
- <instance>
- <name>vpp-netconf-notification-manager</name>
- <provider>
- /modules/module[type='netconf-notification-manager'][name='vpp-netconf-notification-manager']
- </provider>
- </instance>
- </service>
- <service>
- <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:netconf:northbound:notification">
- prefix:netconf-notification-registry
- </type>
- <instance>
- <name>vpp-netconf-notification-manager</name>
- <provider>
- /modules/module[type='netconf-notification-manager'][name='vpp-netconf-notification-manager']
- </provider>
- </instance>
- </service>
- </services>
+ <service>
+ <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:config:netconf:northbound">
+ prefix:netconf-server-monitoring
+ </type>
+ <instance>
+ <name>vpp-server-monitor</name>
+ <provider>/modules/module[type='netconf-server-monitoring-impl'][name='vpp-server-monitor']
+ </provider>
+ </instance>
+ </service>
+ <service>
+ <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:netconf:north:mapper">
+ prefix:netconf-northbound-mapper
+ </type>
+ <instance>
+ <name>netconf-vpp-mapper</name>
+ <provider>/modules/module[type='netconf-mdsal-mapper'][name='netconf-vpp-mapper']</provider>
+ </instance>
+ </service>
+ <service>
+ <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:netconf:north:mapper">
+ prefix:netconf-northbound-mapper
+ </type>
+ <instance>
+ <name>vpp-mapper-aggregator</name>
+ <provider>/modules/module[type='netconf-mapper-aggregator'][name='vpp-mapper-aggregator']</provider>
+ </instance>
+ </service>
+ <service>
+ <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:netconf:north:mapper">
+ prefix:netconf-mapper-registry
+ </type>
+ <instance>
+ <name>vpp-mapper-aggregator-registry</name>
+ <provider>/modules/module[type='netconf-mapper-aggregator'][name='vpp-mapper-aggregator']</provider>
+ </instance>
+ </service>
+ <service>
+ <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:config:netconf:northbound">
+ prefix:netconf-server-dispatcher
+ </type>
+ <instance>
+ <name>netconf-vpp-server-dispatcher</name>
+ <provider>
+ /modules/module[type='netconf-server-dispatcher-impl'][name='netconf-vpp-server-dispatcher']
+ </provider>
+ </instance>
+ </service>
+ <service>
+ <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:netconf:north:mapper">
+ prefix:netconf-northbound-mapper
+ </type>
+ <instance>
+ <name>netconf-vpp-notification-mapper</name>
+ <provider>
+ /modules/module[type='netconf-mdsal-notification-mapper'][name='netconf-vpp-notification-mapper']
+ </provider>
+ </instance>
+ </service>
+ <service>
+ <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:netconf:northbound:notification">
+ prefix:netconf-notification-collector
+ </type>
+ <instance>
+ <name>vpp-netconf-notification-manager</name>
+ <provider>
+ /modules/module[type='netconf-notification-manager'][name='vpp-netconf-notification-manager']
+ </provider>
+ </instance>
+ </service>
+ <service>
+ <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:netconf:northbound:notification">
+ prefix:netconf-notification-registry
+ </type>
+ <instance>
+ <name>vpp-netconf-notification-manager</name>
+ <provider>
+ /modules/module[type='netconf-notification-manager'][name='vpp-netconf-notification-manager']
+ </provider>
+ </instance>
+ </service>
+ </services>
- </data>
- </configuration>
- <required-capabilities>
- <capability>urn:opendaylight:params:xml:ns:yang:v3po:impl?module=v3po-impl&amp;revision=2014-12-10</capability>
- <capability>urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding?module=opendaylight-md-sal-binding&amp;revision=2013-10-28</capability>
- <capability>urn:opendaylight:params:xml:ns:yang:controller:netconf:mdsal:mapper?module=netconf-mdsal-mapper&amp;revision=2015-01-14</capability>
- <capability>
- urn:opendaylight:params:xml:ns:yang:controller:netconf:mdsal:monitoring?module=netconf-mdsal-monitoring&amp;revision=2015-02-18
- </capability>
- <capability>urn:opendaylight:params:xml:ns:yang:controller:netconf:northbound:ssh?module=netconf-northbound-ssh&amp;revision=2015-01-14</capability>
- <capability>urn:opendaylight:params:xml:ns:yang:controller:netconf:northbound:tcp?module=netconf-northbound-tcp&amp;revision=2015-04-23</capability>
- <capability>
- urn:opendaylight:params:xml:ns:yang:controller:config:netconf:northbound:impl?module=netconf-northbound-impl&amp;revision=2015-01-12
- </capability>
- <capability>
- urn:opendaylight:params:xml:ns:yang:controller:threadpool:impl:scheduled?module=threadpool-impl-scheduled&amp;revision=2013-12-01
- </capability>
- <capability>
- urn:opendaylight:params:xml:ns:yang:controller:netconf:mdsal:notification?module=netconf-mdsal-notification&amp;revision=2015-08-03
- </capability>
- </required-capabilities>
+ </data>
+ </configuration>
+ <required-capabilities>
+ <capability>urn:opendaylight:params:xml:ns:yang:v3po:impl?module=v3po-impl&amp;revision=2014-12-10</capability>
+ <capability>urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding?module=opendaylight-md-sal-binding&amp;revision=2013-10-28</capability>
+ <capability>urn:opendaylight:params:xml:ns:yang:controller:netconf:mdsal:mapper?module=netconf-mdsal-mapper&amp;revision=2015-01-14</capability>
+ <capability>
+ urn:opendaylight:params:xml:ns:yang:controller:netconf:mdsal:monitoring?module=netconf-mdsal-monitoring&amp;revision=2015-02-18
+ </capability>
+ <capability>urn:opendaylight:params:xml:ns:yang:controller:netconf:northbound:ssh?module=netconf-northbound-ssh&amp;revision=2015-01-14</capability>
+ <capability>urn:opendaylight:params:xml:ns:yang:controller:netconf:northbound:tcp?module=netconf-northbound-tcp&amp;revision=2015-04-23</capability>
+ <capability>
+ urn:opendaylight:params:xml:ns:yang:controller:config:netconf:northbound:impl?module=netconf-northbound-impl&amp;revision=2015-01-12
+ </capability>
+ <capability>
+ urn:opendaylight:params:xml:ns:yang:controller:threadpool:impl:scheduled?module=threadpool-impl-scheduled&amp;revision=2013-12-01
+ </capability>
+ <capability>
+ urn:opendaylight:params:xml:ns:yang:controller:netconf:mdsal:notification?module=netconf-mdsal-notification&amp;revision=2015-08-03
+ </capability>
+ </required-capabilities>
</snapshot>
diff --git a/v3po/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/NetconfMonitoringReaderModule.java b/v3po/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/NetconfMonitoringReaderModule.java
new file mode 100644
index 000000000..feb7768a2
--- /dev/null
+++ b/v3po/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/NetconfMonitoringReaderModule.java
@@ -0,0 +1,28 @@
+package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.impl.rev141210;
+
+import io.fd.honeycomb.v3po.translate.util.read.BindingBrokerReader;
+import io.fd.honeycomb.v3po.translate.util.read.CloseableReader;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.NetconfState;
+
+public class NetconfMonitoringReaderModule extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.impl.rev141210.AbstractNetconfMonitoringReaderModule {
+ public NetconfMonitoringReaderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+ super(identifier, dependencyResolver);
+ }
+
+ public NetconfMonitoringReaderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.impl.rev141210.NetconfMonitoringReaderModule oldModule, java.lang.AutoCloseable oldInstance) {
+ super(identifier, dependencyResolver, oldModule, oldInstance);
+ }
+
+ @Override
+ public void customValidation() {
+ // add custom validation form module attributes here.
+ }
+
+ @Override
+ public java.lang.AutoCloseable createInstance() {
+ return new CloseableReader<>(new BindingBrokerReader<>(NetconfState.class, getNetconfMonitoringBindingBrokerDependency(),
+ LogicalDatastoreType.OPERATIONAL));
+ }
+
+}
diff --git a/v3po/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/NetconfMonitoringReaderModuleFactory.java b/v3po/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/NetconfMonitoringReaderModuleFactory.java
new file mode 100644
index 000000000..b8b7bec63
--- /dev/null
+++ b/v3po/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/NetconfMonitoringReaderModuleFactory.java
@@ -0,0 +1,13 @@
+/*
+* Generated file
+*
+* Generated from: yang module name: v3po-impl yang module local name: netconf-monitoring-reader
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Tue Apr 12 13:03:40 CEST 2016
+*
+* Do not modify this file unless it is present under src/main directory
+*/
+package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.impl.rev141210;
+public class NetconfMonitoringReaderModuleFactory extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.impl.rev141210.AbstractNetconfMonitoringReaderModuleFactory {
+
+}
diff --git a/v3po/impl/src/main/yang/v3po-impl.yang b/v3po/impl/src/main/yang/v3po-impl.yang
index d6fd25199..9509b02ec 100644
--- a/v3po/impl/src/main/yang/v3po-impl.yang
+++ b/v3po/impl/src/main/yang/v3po-impl.yang
@@ -127,4 +127,25 @@ module v3po-impl {
}
}
+
+ identity netconf-monitoring-reader {
+ base config:module-type;
+ config:provided-service tapi:honeycomb-reader;
+ }
+
+ augment "/config:modules/config:module/config:configuration" {
+ case netconf-monitoring-reader {
+ when "/config:modules/config:module/config:type = 'netconf-monitoring-reader'";
+
+ container netconf-monitoring-binding-broker {
+ uses config:service-ref {
+ refine type {
+ mandatory true;
+ config:required-identity md-sal-binding:binding-async-data-broker;
+ }
+ }
+ }
+
+ }
+ }
}
diff --git a/v3po/translate-utils/src/main/java/io/fd/honeycomb/v3po/translate/util/read/BindingBrokerReader.java b/v3po/translate-utils/src/main/java/io/fd/honeycomb/v3po/translate/util/read/BindingBrokerReader.java
new file mode 100644
index 000000000..58695cf8b
--- /dev/null
+++ b/v3po/translate-utils/src/main/java/io/fd/honeycomb/v3po/translate/util/read/BindingBrokerReader.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2016 Cisco and/or its affiliates.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.fd.honeycomb.v3po.translate.util.read;
+
+import com.google.common.base.Optional;
+import com.google.common.util.concurrent.CheckedFuture;
+import io.fd.honeycomb.v3po.translate.read.ReadContext;
+import io.fd.honeycomb.v3po.translate.read.ReadFailedException;
+import io.fd.honeycomb.v3po.translate.read.Reader;
+import javax.annotation.Nonnull;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+/**
+ * Simple DataBroker backed reader allowing to delegate reads to different brokers
+ */
+public final class BindingBrokerReader<D extends DataObject> implements Reader<D> {
+
+ private final InstanceIdentifier<D> instanceIdentifier;
+ private final DataBroker dataBroker;
+ private final LogicalDatastoreType datastoreType;
+
+ public BindingBrokerReader(final Class<D> managedDataObjectType, final DataBroker dataBroker,
+ final LogicalDatastoreType datastoreType) {
+ this.dataBroker = dataBroker;
+ this.datastoreType = datastoreType;
+ this.instanceIdentifier = InstanceIdentifier.create(managedDataObjectType);
+ }
+
+ @Nonnull
+ @Override
+ public Optional<? extends DataObject> read(@Nonnull final InstanceIdentifier<? extends DataObject> id,
+ @Nonnull final ReadContext ctx) throws ReadFailedException {
+ try (final ReadOnlyTransaction readOnlyTransaction = dataBroker.newReadOnlyTransaction()) {
+ final CheckedFuture<? extends Optional<? extends DataObject>, org.opendaylight.controller.md.sal.common.api.data.ReadFailedException>
+ read = readOnlyTransaction.read(datastoreType, id);
+ try {
+ return read.checkedGet();
+ } catch (org.opendaylight.controller.md.sal.common.api.data.ReadFailedException e) {
+ throw new ReadFailedException(id, e);
+ }
+ }
+ }
+
+ @Nonnull
+ @Override
+ public InstanceIdentifier<D> getManagedDataObjectType() {
+ return instanceIdentifier;
+ }
+}
diff --git a/v3po/translate-utils/src/main/java/io/fd/honeycomb/v3po/translate/util/read/NoopReaderCustomizer.java b/v3po/translate-utils/src/main/java/io/fd/honeycomb/v3po/translate/util/read/NoopReaderCustomizer.java
index 5ed033755..3b703da3f 100644
--- a/v3po/translate-utils/src/main/java/io/fd/honeycomb/v3po/translate/util/read/NoopReaderCustomizer.java
+++ b/v3po/translate-utils/src/main/java/io/fd/honeycomb/v3po/translate/util/read/NoopReaderCustomizer.java
@@ -17,6 +17,7 @@
package io.fd.honeycomb.v3po.translate.util.read;
import io.fd.honeycomb.v3po.translate.Context;
+import io.fd.honeycomb.v3po.translate.read.ReadFailedException;
import io.fd.honeycomb.v3po.translate.spi.read.RootReaderCustomizer;
import org.opendaylight.yangtools.concepts.Builder;
import org.opendaylight.yangtools.yang.binding.DataObject;
@@ -26,7 +27,8 @@ public abstract class NoopReaderCustomizer<C extends DataObject, B extends Build
RootReaderCustomizer<C, B> {
@Override
- public void readCurrentAttributes(InstanceIdentifier<C> id, final B builder, final Context context) {
+ public void readCurrentAttributes(InstanceIdentifier<C> id, final B builder, final Context context) throws
+ ReadFailedException {
// Noop
}
}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/vppstate/BridgeDomainCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/vppstate/BridgeDomainCustomizer.java
index 39f164e4b..e0c193f89 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/vppstate/BridgeDomainCustomizer.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/vppstate/BridgeDomainCustomizer.java
@@ -21,6 +21,7 @@ import io.fd.honeycomb.v3po.translate.spi.read.ListReaderCustomizer;
import io.fd.honeycomb.v3po.translate.v3po.util.VppApiCustomizer;
import io.fd.honeycomb.v3po.translate.Context;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import javax.annotation.Nonnull;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.PhysAddress;
@@ -142,6 +143,12 @@ public final class BridgeDomainCustomizer extends VppApiCustomizer
@Override
public List<BridgeDomainKey> getAllIds(@Nonnull final InstanceIdentifier<BridgeDomain> id, @Nonnull final Context context) {
final int[] bIds = getVppApi().bridgeDomainDump(-1);
+
+ if(bIds == null) {
+ // No bridge domains
+ return Collections.emptyList();
+ }
+
LOG.debug("vppstate.BridgeDomainCustomizer.getAllIds: bIds.length={}", bIds.length);
final List<BridgeDomainKey> allIds = new ArrayList<>(bIds.length);
for (int bId : bIds) {