diff options
52 files changed, 253 insertions, 229 deletions
diff --git a/common/honeycomb-parent/pom.xml b/common/honeycomb-parent/pom.xml index 1ba2f6b01..3fa192340 100644 --- a/common/honeycomb-parent/pom.xml +++ b/common/honeycomb-parent/pom.xml @@ -46,21 +46,21 @@ <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <!-- ODL dependencies --> - <odl.yangtools.version>1.2.2</odl.yangtools.version> - <odl.mdsal.version>2.3.2</odl.mdsal.version> - <odl.mdsal.controller.version>1.6.2</odl.mdsal.controller.version> - <odl.mdsalmodel.version>0.11.2</odl.mdsalmodel.version> - <odl.netconf.version>1.3.2</odl.netconf.version> - <odl.restconf.version>1.6.2</odl.restconf.version> - <odl.salGenerator.version>0.11.2</odl.salGenerator.version> - <odl.bgpcep.version>0.8.2</odl.bgpcep.version> + <odl.yangtools.version>2.0.1</odl.yangtools.version> + <odl.mdsal.version>2.4.0</odl.mdsal.version> + <odl.mdsal.controller.version>1.7.0</odl.mdsal.controller.version> + <odl.mdsalmodel.version>0.12.0</odl.mdsalmodel.version> + <odl.netconf.version>1.4.0</odl.netconf.version> + <odl.restconf.version>1.7.0</odl.restconf.version> + <odl.salGenerator.version>0.12.0</odl.salGenerator.version> + <odl.bgpcep.version>0.9.0</odl.bgpcep.version> <salGeneratorPath>target/generated-sources/mdsal-binding</salGeneratorPath> <!-- common dependencies --> <junit.version>4.11</junit.version> <mockito.version>2.2.9</mockito.version> <hamcrest.version>1.3</hamcrest.version> - <guava.version>22.0</guava.version> + <guava.version>23.6-jre</guava.version> <jsr305.version>3.0.0</jsr305.version> <slf4j.version>1.7.21</slf4j.version> diff --git a/common/scripts-parent/pom.xml b/common/scripts-parent/pom.xml index 1aeb8d662..64fce3335 100644 --- a/common/scripts-parent/pom.xml +++ b/common/scripts-parent/pom.xml @@ -32,7 +32,7 @@ <groovy.version>2.4.7</groovy.version> <groovy.eclipse.compiler.version>2.9.2-01</groovy.eclipse.compiler.version> <groovy.eclipse.batch.version>2.4.3-01</groovy.eclipse.batch.version> - <odl.yang-binding.version>0.11.2</odl.yang-binding.version> + <odl.yang-binding.version>0.12.0</odl.yang-binding.version> </properties> <dependencyManagement> diff --git a/infra/bgp-translate-api/src/main/java/io/fd/honeycomb/translate/bgp/RouteWriter.java b/infra/bgp-translate-api/src/main/java/io/fd/honeycomb/translate/bgp/RouteWriter.java index 31e1e3fa1..a88d149ad 100644 --- a/infra/bgp-translate-api/src/main/java/io/fd/honeycomb/translate/bgp/RouteWriter.java +++ b/infra/bgp-translate-api/src/main/java/io/fd/honeycomb/translate/bgp/RouteWriter.java @@ -21,7 +21,7 @@ import io.fd.honeycomb.translate.SubtreeManager; import io.fd.honeycomb.translate.write.WriteFailedException; import javax.annotation.Nonnull; import javax.annotation.Nullable; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.Route; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.Route; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; /** diff --git a/infra/bgp-translate-impl/src/main/java/io/fd/honeycomb/bgp/translate/impl/LocRibChangeListener.java b/infra/bgp-translate-impl/src/main/java/io/fd/honeycomb/bgp/translate/impl/LocRibChangeListener.java index 7e9a3c1e8..5d4ec4f7b 100644 --- a/infra/bgp-translate-impl/src/main/java/io/fd/honeycomb/bgp/translate/impl/LocRibChangeListener.java +++ b/infra/bgp-translate-impl/src/main/java/io/fd/honeycomb/bgp/translate/impl/LocRibChangeListener.java @@ -25,7 +25,7 @@ import org.opendaylight.controller.md.sal.binding.api.DataObjectModification; import org.opendaylight.controller.md.sal.binding.api.DataTreeChangeListener; import org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier; import org.opendaylight.controller.md.sal.binding.api.DataTreeModification; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.Route; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.Route; import org.opendaylight.yangtools.yang.binding.DataObject; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.slf4j.Logger; diff --git a/infra/bgp-translate-impl/src/main/java/io/fd/honeycomb/bgp/translate/impl/LocRibWriter.java b/infra/bgp-translate-impl/src/main/java/io/fd/honeycomb/bgp/translate/impl/LocRibWriter.java index ce3c0c7b8..95fe1b40c 100644 --- a/infra/bgp-translate-impl/src/main/java/io/fd/honeycomb/bgp/translate/impl/LocRibWriter.java +++ b/infra/bgp-translate-impl/src/main/java/io/fd/honeycomb/bgp/translate/impl/LocRibWriter.java @@ -23,8 +23,8 @@ import javax.annotation.Nonnull; import org.opendaylight.controller.md.sal.binding.api.DataBroker; import org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier; import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.Route; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.bgp.rib.rib.LocRib; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.Route; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.bgp.rib.rib.LocRib; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; /** diff --git a/infra/bgp-translate-impl/src/main/test/java/io/fd/honeycomb/bgp/translate/impl/LocRibChangeListenerTest.java b/infra/bgp-translate-impl/src/main/test/java/io/fd/honeycomb/bgp/translate/impl/LocRibChangeListenerTest.java index 8418f01da..6ebe6345a 100644 --- a/infra/bgp-translate-impl/src/main/test/java/io/fd/honeycomb/bgp/translate/impl/LocRibChangeListenerTest.java +++ b/infra/bgp-translate-impl/src/main/test/java/io/fd/honeycomb/bgp/translate/impl/LocRibChangeListenerTest.java @@ -31,7 +31,7 @@ import org.mockito.MockitoAnnotations; import org.opendaylight.controller.md.sal.binding.api.DataObjectModification; import org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier; import org.opendaylight.controller.md.sal.binding.api.DataTreeModification; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.Route; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.Route; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; public class LocRibChangeListenerTest { diff --git a/infra/bgp-translate-impl/src/main/test/java/io/fd/honeycomb/bgp/translate/impl/LocRibWriterTest.java b/infra/bgp-translate-impl/src/main/test/java/io/fd/honeycomb/bgp/translate/impl/LocRibWriterTest.java index 391ee4c56..754264dac 100644 --- a/infra/bgp-translate-impl/src/main/test/java/io/fd/honeycomb/bgp/translate/impl/LocRibWriterTest.java +++ b/infra/bgp-translate-impl/src/main/test/java/io/fd/honeycomb/bgp/translate/impl/LocRibWriterTest.java @@ -31,21 +31,21 @@ import org.mockito.MockitoAnnotations; import org.opendaylight.controller.md.sal.binding.api.DataBroker; import org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.ipv4.routes.Ipv4Routes; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.ipv4.routes.ipv4.routes.Ipv4Route; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.ipv4.routes.ipv4.routes.Ipv4RouteKey; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev150525.labeled.unicast.routes.LabeledUnicastRoutes; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev150525.labeled.unicast.routes.list.LabeledUnicastRoute; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.PathId; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.path.attributes.Attributes; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.BgpRib; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.RibId; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.Route; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.bgp.rib.Rib; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.bgp.rib.RibKey; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.bgp.rib.rib.LocRib; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.rib.Tables; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.rib.TablesKey; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207.ipv4.routes.Ipv4Routes; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207.ipv4.routes.ipv4.routes.Ipv4RouteKey; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207.ipv4.routes.ipv4.routes.Ipv4Route; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev171207.labeled.unicast.routes.LabeledUnicastRoutes; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev171207.labeled.unicast.routes.list.LabeledUnicastRoute; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.PathId; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.Attributes; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.BgpRib; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.RibId; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.Route; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.bgp.rib.Rib; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.bgp.rib.RibKey; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.bgp.rib.rib.LocRib; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.rib.Tables; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.rib.TablesKey; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.Ipv4AddressFamily; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.UnicastSubsequentAddressFamily; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; diff --git a/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/ModifiableDataTreeManager.java b/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/ModifiableDataTreeManager.java index 48b9e7913..8dcca2762 100644 --- a/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/ModifiableDataTreeManager.java +++ b/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/ModifiableDataTreeManager.java @@ -75,7 +75,8 @@ public class ModifiableDataTreeManager implements ModifiableDataManager { @Override public CheckedFuture<Optional<NormalizedNode<?, ?>>, ReadFailedException> read( @Nonnull final YangInstanceIdentifier path) { - final Optional<NormalizedNode<?, ?>> node = modification.readNode(path); + // FIXME switch to java.util.Optional when rest of ODL infra does + final Optional<NormalizedNode<?, ?>> node = Optional.fromNullable(modification.readNode(path).orElse(null)); if (LOG.isTraceEnabled() && node.isPresent()) { LOG.trace("ConfigSnapshot.read: {}", node.get()); } diff --git a/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/Modification.java b/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/Modification.java index 88823c53d..45a207cec 100644 --- a/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/Modification.java +++ b/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/Modification.java @@ -29,7 +29,7 @@ import org.opendaylight.yangtools.yang.data.api.schema.MixinNode; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateNode; import org.opendaylight.yangtools.yang.data.api.schema.tree.ModificationType; -import org.opendaylight.yangtools.yang.model.api.AugmentationSchema; +import org.opendaylight.yangtools.yang.model.api.AugmentationSchemaNode; import org.opendaylight.yangtools.yang.model.api.AugmentationTarget; import org.opendaylight.yangtools.yang.model.api.ChoiceSchemaNode; import org.opendaylight.yangtools.yang.model.api.DataNodeContainer; @@ -89,11 +89,13 @@ final class Modification { } com.google.common.base.Optional<NormalizedNode<?, ?>> getDataBefore() { - return dataCandidate.getDataBefore(); + // FIXME switch to java.util.Optional when rest of ODL infra does + return com.google.common.base.Optional.fromNullable(dataCandidate.getDataBefore().orElse(null)); } com.google.common.base.Optional<NormalizedNode<?, ?>> getDataAfter() { - return dataCandidate.getDataAfter(); + // FIXME switch to java.util.Optional when rest of ODL infra does + return com.google.common.base.Optional.fromNullable(dataCandidate.getDataAfter().orElse(null)); } Object getSchemaNode() { @@ -107,25 +109,25 @@ final class Modification { boolean isMixin() { // Checking whether node is a mixin is not performed on schema, but on data since mixin is // only a NormalizedNode concept, not a schema concept - return dataCandidate.getDataBefore().orNull() instanceof MixinNode || - dataCandidate.getDataAfter().orNull() instanceof MixinNode; + return dataCandidate.getDataBefore().orElse(null) instanceof MixinNode || + dataCandidate.getDataAfter().orElse(null) instanceof MixinNode; } boolean isBeforeAndAfterDifferent() { if (dataCandidate.getDataBefore().isPresent()) { - return !dataCandidate.getDataBefore().get().equals(dataCandidate.getDataAfter().orNull()); + return !dataCandidate.getDataBefore().get().equals(dataCandidate.getDataAfter().orElse(null)); } // considering not a modification if data after is also null return dataCandidate.getDataAfter().isPresent(); } - private AugmentationSchema findAugmentation(Object currentNode, - final YangInstanceIdentifier.AugmentationIdentifier identifier) { + private AugmentationSchemaNode findAugmentation(Object currentNode, + final YangInstanceIdentifier.AugmentationIdentifier identifier) { if (currentNode != null) { // check if identifier points to some augmentation of currentNode if (currentNode instanceof AugmentationTarget) { - Optional<AugmentationSchema> augmentationSchema = + Optional<AugmentationSchemaNode> augmentationSchema = ((AugmentationTarget) currentNode).getAvailableAugmentations().stream() .filter(aug -> identifier.equals(new YangInstanceIdentifier.AugmentationIdentifier( aug.getChildNodes().stream() @@ -142,7 +144,7 @@ final class Modification { if (currentNode instanceof DataNodeContainer) { childNodes = ((DataNodeContainer) currentNode).getChildNodes(); } else if (currentNode instanceof ChoiceSchemaNode) { - childNodes = ((ChoiceSchemaNode) currentNode).getCases().stream() + childNodes = ((ChoiceSchemaNode) currentNode).getCases().values().stream() .flatMap(cas -> cas.getChildNodes().stream()).collect(Collectors.toList()); } return childNodes.stream().map(n -> findAugmentation(n, identifier)).filter(n -> n != null).findFirst() @@ -161,7 +163,7 @@ final class Modification { // An augment cannot change other augment, so we do not update parent node if we are streaming // children of AugmentationSchema (otherwise we would fail to find schema for nested augmentations): if (updateParentNode) { - if (schemaNode instanceof AugmentationSchema) { + if (schemaNode instanceof AugmentationSchemaNode) { // child nodes would not have nested augmentations, so we stop moving parentNode: return new Modification(childId, child, parentNode, schemaChild, false); } else { @@ -218,7 +220,7 @@ final class Modification { } } else if (schemaNode instanceof ChoiceSchemaNode) { // For choices, iterate through all the cases - final Optional<DataSchemaNode> maybeChild = ((ChoiceSchemaNode) schemaNode).getCases().stream() + final Optional<DataSchemaNode> maybeChild = ((ChoiceSchemaNode) schemaNode).getCases().values().stream() .flatMap(cas -> cas.getChildNodes().stream()) .filter(child -> child.getQName().equals(identifier.getNodeType())) .findFirst(); diff --git a/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/ModificationDiff.java b/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/ModificationDiff.java index 9d97d9141..98950b243 100644 --- a/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/ModificationDiff.java +++ b/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/ModificationDiff.java @@ -33,7 +33,7 @@ import org.opendaylight.yangtools.yang.data.api.schema.MixinNode; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateNode; import org.opendaylight.yangtools.yang.data.impl.schema.nodes.AbstractImmutableDataContainerNode; -import org.opendaylight.yangtools.yang.model.api.AugmentationSchema; +import org.opendaylight.yangtools.yang.model.api.AugmentationSchemaNode; import org.opendaylight.yangtools.yang.model.api.ChoiceSchemaNode; import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode; import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode; @@ -176,7 +176,7 @@ final class ModificationDiff { // APPEAR/DISAPPEAR are not valid modifications, but some of the children can be modified // aka. list entry added to nested list under non-presence container, which would be resolved as APPEAR for // that container, but MERGE for nested list - if (modification.isMixin() && !modification.is(AugmentationSchema.class)) { + if (modification.isMixin() && !modification.is(AugmentationSchemaNode.class)) { return false; } else { return isCurrentModified(modification); diff --git a/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/NormalizedNodeRewriteDeleteRegistry.java b/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/NormalizedNodeRewriteDeleteRegistry.java index c7832ac0e..9cd14063d 100644 --- a/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/NormalizedNodeRewriteDeleteRegistry.java +++ b/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/NormalizedNodeRewriteDeleteRegistry.java @@ -28,7 +28,7 @@ import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild; import org.opendaylight.yangtools.yang.data.api.schema.LeafNode; import org.opendaylight.yangtools.yang.data.api.schema.LeafSetNode; import org.opendaylight.yangtools.yang.data.api.schema.MapNode; -import org.opendaylight.yangtools.yang.model.api.ChoiceCaseNode; +import org.opendaylight.yangtools.yang.model.api.CaseSchemaNode; import org.opendaylight.yangtools.yang.model.api.SchemaContext; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -86,7 +86,7 @@ final class NormalizedNodeRewriteDeleteRegistry implements RewriteDeleteProducer return choiceDeleteProducer.normalizedUpdates(topLevelIdentifier, entry); } - if (entry.getValue() instanceof ChoiceCaseNode) { + if (entry.getValue() instanceof CaseSchemaNode) { LOG.debug("Processing case {}", topLevelIdentifier); return caseDeleteProducer.normalizedUpdates(topLevelIdentifier, entry); } diff --git a/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/PersistingDataTreeAdapter.java b/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/PersistingDataTreeAdapter.java index 3c356c256..d779e6258 100644 --- a/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/PersistingDataTreeAdapter.java +++ b/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/PersistingDataTreeAdapter.java @@ -21,19 +21,20 @@ import static com.google.common.base.Preconditions.checkNotNull; import com.google.common.annotations.VisibleForTesting; import com.google.common.base.MoreObjects; -import com.google.common.base.Optional; import io.fd.honeycomb.translate.util.JsonUtils; import java.io.IOException; import java.io.OutputStream; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.StandardOpenOption; +import java.util.Optional; import javax.annotation.Nonnull; import org.opendaylight.controller.sal.core.api.model.SchemaService; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTree; import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidate; +import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateTip; import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification; import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeSnapshot; import org.opendaylight.yangtools.yang.data.api.schema.tree.DataValidationFailedException; @@ -163,7 +164,7 @@ public class PersistingDataTreeAdapter implements DataTree { } @Override - public DataTreeCandidate prepare( + public DataTreeCandidateTip prepare( final DataTreeModification dataTreeModification) { return delegateDependency.prepare(dataTreeModification); } diff --git a/infra/data-impl/src/test/java/io/fd/honeycomb/data/impl/ModifiableDataTreeDelegatorTest.java b/infra/data-impl/src/test/java/io/fd/honeycomb/data/impl/ModifiableDataTreeDelegatorTest.java index 56c0c610f..3065a94ff 100644 --- a/infra/data-impl/src/test/java/io/fd/honeycomb/data/impl/ModifiableDataTreeDelegatorTest.java +++ b/infra/data-impl/src/test/java/io/fd/honeycomb/data/impl/ModifiableDataTreeDelegatorTest.java @@ -63,7 +63,8 @@ public class ModifiableDataTreeDelegatorTest extends ModifiableDataTreeDelegator assertEquals(normalizedNodeOptional, normalizedNodeOptional2); assertTrue(normalizedNodeOptional.isPresent()); assertEquals(topContainer, normalizedNodeOptional.get()); - assertEquals(dataTree.takeSnapshot().readNode(TOP_CONTAINER_ID), normalizedNodeOptional); + // FIXMe use toJavaUtil everywhere + assertEquals(dataTree.takeSnapshot().readNode(TOP_CONTAINER_ID), Optional.toJavaUtil(normalizedNodeOptional)); } @Test diff --git a/infra/data-impl/src/test/java/io/fd/honeycomb/data/impl/ModificationBaseTest.java b/infra/data-impl/src/test/java/io/fd/honeycomb/data/impl/ModificationBaseTest.java index 7e9c34dfa..666386d43 100644 --- a/infra/data-impl/src/test/java/io/fd/honeycomb/data/impl/ModificationBaseTest.java +++ b/infra/data-impl/src/test/java/io/fd/honeycomb/data/impl/ModificationBaseTest.java @@ -36,11 +36,10 @@ import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTree; import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidate; import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateTip; +import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeConfiguration; import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification; import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeSnapshot; import org.opendaylight.yangtools.yang.data.api.schema.tree.DataValidationFailedException; -import org.opendaylight.yangtools.yang.data.api.schema.tree.TipProducingDataTree; -import org.opendaylight.yangtools.yang.data.api.schema.tree.TreeType; import org.opendaylight.yangtools.yang.data.impl.schema.Builders; import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes; import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.ListNodeBuilder; @@ -63,8 +62,8 @@ abstract class ModificationBaseTest extends ModificationMetadata { dataTree.commit(prepare); } - protected TipProducingDataTree getDataTree() throws ReactorException { - final TipProducingDataTree dataTree = InMemoryDataTreeFactory.getInstance().create(TreeType.CONFIGURATION); + protected DataTree getDataTree() throws ReactorException { + final DataTree dataTree = new InMemoryDataTreeFactory().create(DataTreeConfiguration.DEFAULT_CONFIGURATION); dataTree.setSchemaContext(getSchemaCtx()); return dataTree; } @@ -126,16 +125,16 @@ abstract class ModificationBaseTest extends ModificationMetadata { } SchemaContext getSchemaCtx() throws ReactorException { - return YangParserTestUtils.parseYangSources(Collections.singletonList("/test-diff.yang")); + return YangParserTestUtils.parseYangResource("/test-diff.yang"); } - DataTreeModification getModification(final TipProducingDataTree dataTree) { + DataTreeModification getModification(final DataTree dataTree) { final DataTreeSnapshot dataTreeSnapshot = dataTree.takeSnapshot(); return dataTreeSnapshot.newModification(); } - DataTreeCandidateTip prepareModification(final TipProducingDataTree dataTree, + DataTreeCandidateTip prepareModification(final DataTree dataTree, final DataTreeModification dataTreeModification) throws DataValidationFailedException { dataTreeModification.ready(); @@ -329,9 +328,9 @@ abstract class ModificationBaseTest extends ModificationMetadata { .build()).build()).build(); } - TipProducingDataTree prepareStateBeforeWithTopContainer(final NormalizedNode<?, ?> topContainerData) + DataTree prepareStateBeforeWithTopContainer(final NormalizedNode<?, ?> topContainerData) throws ReactorException, DataValidationFailedException { - final TipProducingDataTree dataTree = getDataTree(); + final DataTree dataTree = getDataTree(); final DataTreeModification dataTreeModificationOriginal = getModification(dataTree); // non presence, but with valid child list dataTreeModificationOriginal.write(TOP_CONTAINER_ID, topContainerData); @@ -340,7 +339,7 @@ abstract class ModificationBaseTest extends ModificationMetadata { return dataTree; } - DataTreeCandidateTip prepareStateAfterEmpty(final TipProducingDataTree dataTree) + DataTreeCandidateTip prepareStateAfterEmpty(final DataTree dataTree) throws DataValidationFailedException { final NormalizedNode<?, ?> topContainerModified = Builders.containerBuilder() .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TOP_CONTAINER_QNAME)) diff --git a/infra/data-impl/src/test/java/io/fd/honeycomb/data/impl/ModificationDiffAugRewriteDeleteTest.java b/infra/data-impl/src/test/java/io/fd/honeycomb/data/impl/ModificationDiffAugRewriteDeleteTest.java index c2b959809..eeef85ecc 100644 --- a/infra/data-impl/src/test/java/io/fd/honeycomb/data/impl/ModificationDiffAugRewriteDeleteTest.java +++ b/infra/data-impl/src/test/java/io/fd/honeycomb/data/impl/ModificationDiffAugRewriteDeleteTest.java @@ -22,9 +22,9 @@ import static org.hamcrest.MatcherAssert.assertThat; import com.google.common.collect.ImmutableSet; import org.junit.Test; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; +import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTree; import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateTip; import org.opendaylight.yangtools.yang.data.api.schema.tree.DataValidationFailedException; -import org.opendaylight.yangtools.yang.data.api.schema.tree.TipProducingDataTree; import org.opendaylight.yangtools.yang.data.impl.schema.Builders; import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException; import org.slf4j.Logger; @@ -37,7 +37,7 @@ public class ModificationDiffAugRewriteDeleteTest extends ModificationBaseTest { @Test public void testWriteNonPresenceNonEmptyContainerAugWithLeaf() throws ReactorException, DataValidationFailedException { - final TipProducingDataTree dataTree = prepareStateBeforeWithTopContainer(Builders.containerBuilder() + final DataTree dataTree = prepareStateBeforeWithTopContainer(Builders.containerBuilder() .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TOP_CONTAINER_QNAME)) .withChild(getNestedContWithLeafUnderAug("val")) .build()); @@ -58,7 +58,7 @@ public class ModificationDiffAugRewriteDeleteTest extends ModificationBaseTest { @Test public void testWriteNonPresenceNonEmptyContainerAugWithList() throws ReactorException, DataValidationFailedException { - final TipProducingDataTree dataTree = prepareStateBeforeWithTopContainer(Builders.containerBuilder() + final DataTree dataTree = prepareStateBeforeWithTopContainer(Builders.containerBuilder() .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TOP_CONTAINER_QNAME)) .withChild(getNestedContWithListUnderAug("val")) .build()); @@ -79,7 +79,7 @@ public class ModificationDiffAugRewriteDeleteTest extends ModificationBaseTest { @Test public void testWriteNonPresenceNonEmptyContainerAugWithNonPresenceContainer() throws ReactorException, DataValidationFailedException { - final TipProducingDataTree dataTree = prepareStateBeforeWithTopContainer(Builders.containerBuilder() + final DataTree dataTree = prepareStateBeforeWithTopContainer(Builders.containerBuilder() .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TOP_CONTAINER_QNAME)) .withChild(getNestedContWithContUnderAug("val")) .build()); @@ -100,7 +100,7 @@ public class ModificationDiffAugRewriteDeleteTest extends ModificationBaseTest { @Test public void testWriteNonPresenceNonEmptyContainerAugWithLeafList() throws ReactorException, DataValidationFailedException { - final TipProducingDataTree dataTree = prepareStateBeforeWithTopContainer(Builders.containerBuilder() + final DataTree dataTree = prepareStateBeforeWithTopContainer(Builders.containerBuilder() .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TOP_CONTAINER_QNAME)) .withChild(getNestedContWithLeafListUnderAug("val")) .build()); diff --git a/infra/data-impl/src/test/java/io/fd/honeycomb/data/impl/ModificationDiffNestedAugRewriteDeleteTest.java b/infra/data-impl/src/test/java/io/fd/honeycomb/data/impl/ModificationDiffNestedAugRewriteDeleteTest.java index 9c92b4f85..071701d94 100644 --- a/infra/data-impl/src/test/java/io/fd/honeycomb/data/impl/ModificationDiffNestedAugRewriteDeleteTest.java +++ b/infra/data-impl/src/test/java/io/fd/honeycomb/data/impl/ModificationDiffNestedAugRewriteDeleteTest.java @@ -22,9 +22,9 @@ import static org.hamcrest.MatcherAssert.assertThat; import com.google.common.collect.ImmutableSet; import org.junit.Test; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; +import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTree; import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateTip; import org.opendaylight.yangtools.yang.data.api.schema.tree.DataValidationFailedException; -import org.opendaylight.yangtools.yang.data.api.schema.tree.TipProducingDataTree; import org.opendaylight.yangtools.yang.data.impl.schema.Builders; import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException; import org.slf4j.Logger; @@ -37,7 +37,7 @@ public class ModificationDiffNestedAugRewriteDeleteTest extends ModificationBase @Test public void testWriteNonPresenceNonEmptyContainerNestedAugWithContainer() throws DataValidationFailedException, ReactorException { - final TipProducingDataTree dataTree = prepareStateBeforeWithTopContainer(Builders.containerBuilder() + final DataTree dataTree = prepareStateBeforeWithTopContainer(Builders.containerBuilder() .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TOP_CONTAINER_QNAME)) .withChild(getNestedContWithContainerUnderNestedAug("val")) .build()); @@ -58,7 +58,7 @@ public class ModificationDiffNestedAugRewriteDeleteTest extends ModificationBase @Test public void testWriteNonPresenceNonEmptyContainerNestedAugWithLeafList() throws DataValidationFailedException, ReactorException { - final TipProducingDataTree dataTree = prepareStateBeforeWithTopContainer(Builders.containerBuilder() + final DataTree dataTree = prepareStateBeforeWithTopContainer(Builders.containerBuilder() .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TOP_CONTAINER_QNAME)) .withChild(getNestedContWithLeafListUnderNestedAug("val")) .build()); @@ -79,7 +79,7 @@ public class ModificationDiffNestedAugRewriteDeleteTest extends ModificationBase @Test public void testWriteNonPresenceNonEmptyContainerNestedAugWithList() throws DataValidationFailedException, ReactorException { - final TipProducingDataTree dataTree = prepareStateBeforeWithTopContainer(Builders.containerBuilder() + final DataTree dataTree = prepareStateBeforeWithTopContainer(Builders.containerBuilder() .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TOP_CONTAINER_QNAME)) .withChild(getNestedContWithListUnderNestedAug("val")) .build()); @@ -100,7 +100,7 @@ public class ModificationDiffNestedAugRewriteDeleteTest extends ModificationBase @Test public void testWriteNonPresenceNonEmptyContainerNestedAugWithLeaf() throws DataValidationFailedException, ReactorException { - final TipProducingDataTree dataTree = prepareStateBeforeWithTopContainer(Builders.containerBuilder() + final DataTree dataTree = prepareStateBeforeWithTopContainer(Builders.containerBuilder() .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TOP_CONTAINER_QNAME)) .withChild(getNestedContWithLeafUnderNestedAug("val")) .build()); diff --git a/infra/data-impl/src/test/java/io/fd/honeycomb/data/impl/ModificationDiffRewriteDeleteTest.java b/infra/data-impl/src/test/java/io/fd/honeycomb/data/impl/ModificationDiffRewriteDeleteTest.java index a1ede9691..0be681c66 100644 --- a/infra/data-impl/src/test/java/io/fd/honeycomb/data/impl/ModificationDiffRewriteDeleteTest.java +++ b/infra/data-impl/src/test/java/io/fd/honeycomb/data/impl/ModificationDiffRewriteDeleteTest.java @@ -23,8 +23,8 @@ import com.google.common.collect.ImmutableSet; import org.junit.Test; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode; +import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTree; import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateTip; -import org.opendaylight.yangtools.yang.data.api.schema.tree.TipProducingDataTree; import org.opendaylight.yangtools.yang.data.impl.schema.Builders; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -40,7 +40,7 @@ public class ModificationDiffRewriteDeleteTest extends ModificationBaseTest { @Test public void testWriteNonPresenceNonEmptyContainerPreviousDataOverrideByEmpty() throws Exception { final MapEntryNode alreadyPresent = getNestedListEntry("value", "txt"); - final TipProducingDataTree dataTree = prepareStateBeforeWithTopContainer(Builders.containerBuilder() + final DataTree dataTree = prepareStateBeforeWithTopContainer(Builders.containerBuilder() .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TOP_CONTAINER_QNAME)) .withChild(getNestedList(alreadyPresent)) .build()); @@ -66,7 +66,7 @@ public class ModificationDiffRewriteDeleteTest extends ModificationBaseTest { @Test public void testWriteNonPresenceMultipleNonEmptyContainerPreviousDataOverrideByEmpty() throws Exception { final MapEntryNode alreadyPresent = getNestedListInContainerEntry("key"); - final TipProducingDataTree dataTree = prepareStateBeforeWithTopContainer(Builders.containerBuilder() + final DataTree dataTree = prepareStateBeforeWithTopContainer(Builders.containerBuilder() .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TOP_CONTAINER_QNAME)) // another non-presence container with list entry .withChild(Builders.containerBuilder() @@ -97,7 +97,7 @@ public class ModificationDiffRewriteDeleteTest extends ModificationBaseTest { */ @Test public void testWriteNonPresenceNonEmptyContainerLeaf() throws Exception { - final TipProducingDataTree dataTree = prepareStateBeforeWithTopContainer(Builders.containerBuilder() + final DataTree dataTree = prepareStateBeforeWithTopContainer(Builders.containerBuilder() .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TOP_CONTAINER_QNAME)) // another non-presence container with leaf .withChild(Builders.containerBuilder() @@ -127,7 +127,7 @@ public class ModificationDiffRewriteDeleteTest extends ModificationBaseTest { */ @Test public void testWriteNonPresenceNonEmptyContainerLeafList() throws Exception { - final TipProducingDataTree dataTree = prepareStateBeforeWithTopContainer(Builders.containerBuilder() + final DataTree dataTree = prepareStateBeforeWithTopContainer(Builders.containerBuilder() .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TOP_CONTAINER_QNAME)) // another non-presence container with leaf .withChild(getNestedContainerWithLeafList()) @@ -152,7 +152,7 @@ public class ModificationDiffRewriteDeleteTest extends ModificationBaseTest { */ @Test public void testWriteNonPresenceNonEmptyContainerWithChoice() throws Exception { - final TipProducingDataTree dataTree = prepareStateBeforeWithTopContainer(Builders.containerBuilder() + final DataTree dataTree = prepareStateBeforeWithTopContainer(Builders.containerBuilder() .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TOP_CONTAINER_QNAME)) // another non-presence container with leaf .withChild(getNestedContainerWithChoice("val")) diff --git a/infra/data-impl/src/test/java/io/fd/honeycomb/data/impl/ModificationDiffTest.java b/infra/data-impl/src/test/java/io/fd/honeycomb/data/impl/ModificationDiffTest.java index cd980dd1e..546bb05e0 100644 --- a/infra/data-impl/src/test/java/io/fd/honeycomb/data/impl/ModificationDiffTest.java +++ b/infra/data-impl/src/test/java/io/fd/honeycomb/data/impl/ModificationDiffTest.java @@ -22,19 +22,19 @@ import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; -import com.google.common.base.Optional; import com.google.common.collect.ImmutableSet; import java.util.Map; +import java.util.Optional; import org.junit.Test; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode; import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode; import org.opendaylight.yangtools.yang.data.api.schema.MapNode; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; +import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTree; import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateTip; import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification; import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeSnapshot; -import org.opendaylight.yangtools.yang.data.api.schema.tree.TipProducingDataTree; import org.opendaylight.yangtools.yang.data.impl.schema.Builders; import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes; import org.slf4j.Logger; @@ -46,7 +46,7 @@ public class ModificationDiffTest extends ModificationBaseTest { @Test public void testInitialWrite() throws Exception { - final TipProducingDataTree dataTree = getDataTree(); + final DataTree dataTree = getDataTree(); final DataTreeModification dataTreeModification = getModification(dataTree); final NormalizedNode<?, ?> topContainer = getTopContainer("string1"); final YangInstanceIdentifier TOP_CONTAINER_ID = YangInstanceIdentifier.of(TOP_CONTAINER_QNAME); @@ -62,7 +62,7 @@ public class ModificationDiffTest extends ModificationBaseTest { @Test public void testLeafList() throws Exception { - final TipProducingDataTree dataTree = getDataTree(); + final DataTree dataTree = getDataTree(); final DataTreeModification dataTreeModification = getModification(dataTree); final ContainerNode topContainer = getTopContainerWithLeafList("string1", "string2"); final YangInstanceIdentifier TOP_CONTAINER_ID = YangInstanceIdentifier.of(TOP_CONTAINER_QNAME); @@ -80,7 +80,7 @@ public class ModificationDiffTest extends ModificationBaseTest { @Test public void testWritePresenceEmptyContainer() throws Exception { - final TipProducingDataTree dataTree = getDataTree(); + final DataTree dataTree = getDataTree(); final DataTreeModification dataTreeModification = getModification(dataTree); final NormalizedNode<?, ?> presenceContainer = Builders.containerBuilder() .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(PRESENCE_CONTAINER_QNAME)) @@ -104,7 +104,7 @@ public class ModificationDiffTest extends ModificationBaseTest { @Test public void testInitialWriteForContainerWithChoice() throws Exception { - final TipProducingDataTree dataTree = getDataTree(); + final DataTree dataTree = getDataTree(); final DataTreeModification dataTreeModification = getModification(dataTree); final ContainerNode containerWithChoice = Builders.containerBuilder() .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(WITH_CHOICE_CONTAINER_QNAME)) @@ -128,7 +128,7 @@ public class ModificationDiffTest extends ModificationBaseTest { @Test public void testWriteNonPresenceEmptyContainer() throws Exception { - final TipProducingDataTree dataTree = getDataTree(); + final DataTree dataTree = getDataTree(); final DataTreeModification dataTreeModification = getModification(dataTree); final NormalizedNode<?, ?> topContainer = ImmutableNodes.containerNode(TOP_CONTAINER_QNAME); dataTreeModification.write(TOP_CONTAINER_ID, topContainer); @@ -144,7 +144,7 @@ public class ModificationDiffTest extends ModificationBaseTest { */ @Test public void testWriteNonPresenceNonEmptyContainer() throws Exception { - final TipProducingDataTree dataTree = getDataTree(); + final DataTree dataTree = getDataTree(); final DataTreeModification dataTreeModification = getModification(dataTree); // non presence ,but with valid child list final NormalizedNode<?, ?> topContainer = Builders.containerBuilder() @@ -167,7 +167,7 @@ public class ModificationDiffTest extends ModificationBaseTest { */ @Test public void testWriteNonPresenceNonEmptyContainerPreviousData() throws Exception { - final TipProducingDataTree dataTree = getDataTree(); + final DataTree dataTree = getDataTree(); final DataTreeModification dataTreeModificationOriginal = getModification(dataTree); // non presence, but with valid child list final MapEntryNode alreadyPresent = getNestedListEntry("value", "txt"); @@ -200,7 +200,7 @@ public class ModificationDiffTest extends ModificationBaseTest { @Test public void testWriteNonPresenceEmptyNestedContainer() throws Exception { - final TipProducingDataTree dataTree = getDataTree(); + final DataTree dataTree = getDataTree(); final DataTreeModification dataTreeModification = getModification(dataTree); final NormalizedNode<?, ?> topContainer = Builders.containerBuilder() .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TOP_CONTAINER_QNAME)) @@ -220,7 +220,7 @@ public class ModificationDiffTest extends ModificationBaseTest { @Test public void testUpdateWrite() throws Exception { - final TipProducingDataTree dataTree = getDataTree(); + final DataTree dataTree = getDataTree(); final ContainerNode topContainer = getTopContainer("string1"); addNodeToTree(dataTree, topContainer, TOP_CONTAINER_ID); @@ -239,7 +239,7 @@ public class ModificationDiffTest extends ModificationBaseTest { @Test public void testUpdateMerge() throws Exception { - final TipProducingDataTree dataTree = getDataTree(); + final DataTree dataTree = getDataTree(); final ContainerNode topContainer = getTopContainer("string1"); addNodeToTree(dataTree, topContainer, TOP_CONTAINER_ID); @@ -256,7 +256,7 @@ public class ModificationDiffTest extends ModificationBaseTest { @Test public void testUpdateDelete() throws Exception { - final TipProducingDataTree dataTree = getDataTree(); + final DataTree dataTree = getDataTree(); final ContainerNode topContainer = getTopContainer("string1"); addNodeToTree(dataTree, topContainer, TOP_CONTAINER_ID); @@ -272,7 +272,7 @@ public class ModificationDiffTest extends ModificationBaseTest { @Test public void testWriteAndUpdateInnerList() throws Exception { - final TipProducingDataTree dataTree = getDataTree(); + final DataTree dataTree = getDataTree(); DataTreeSnapshot dataTreeSnapshot = dataTree.takeSnapshot(); DataTreeModification dataTreeModification = dataTreeSnapshot.newModification(); @@ -316,7 +316,7 @@ public class ModificationDiffTest extends ModificationBaseTest { @Test public void testWriteTopContainerAndInnerList() throws Exception { - final TipProducingDataTree dataTree = getDataTree(); + final DataTree dataTree = getDataTree(); DataTreeSnapshot dataTreeSnapshot = dataTree.takeSnapshot(); DataTreeModification dataTreeModification = dataTreeSnapshot.newModification(); @@ -353,7 +353,7 @@ public class ModificationDiffTest extends ModificationBaseTest { @Test public void testWriteDeepList() throws Exception { - final TipProducingDataTree dataTree = getDataTree(); + final DataTree dataTree = getDataTree(); DataTreeSnapshot dataTreeSnapshot = dataTree.takeSnapshot(); DataTreeModification dataTreeModification = dataTreeSnapshot.newModification(); @@ -412,7 +412,7 @@ public class ModificationDiffTest extends ModificationBaseTest { @Test public void testDeleteInnerListItem() throws Exception { - final TipProducingDataTree dataTree = getDataTree(); + final DataTree dataTree = getDataTree(); DataTreeSnapshot dataTreeSnapshot = dataTree.takeSnapshot(); DataTreeModification dataTreeModification = dataTreeSnapshot.newModification(); diff --git a/infra/data-impl/src/test/java/io/fd/honeycomb/data/impl/PersistingDataTreeAdapterTest.java b/infra/data-impl/src/test/java/io/fd/honeycomb/data/impl/PersistingDataTreeAdapterTest.java index 7e135a259..dba707785 100644 --- a/infra/data-impl/src/test/java/io/fd/honeycomb/data/impl/PersistingDataTreeAdapterTest.java +++ b/infra/data-impl/src/test/java/io/fd/honeycomb/data/impl/PersistingDataTreeAdapterTest.java @@ -27,10 +27,10 @@ import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -import com.google.common.base.Optional; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; +import java.util.Optional; import org.junit.Before; import org.junit.Test; import org.mockito.Mock; @@ -83,7 +83,7 @@ public class PersistingDataTreeAdapterTest { public void testPersist() throws Exception { persistingDataTreeAdapter = new PersistingDataTreeAdapter(delegatingDataTree, persister); final DataTreeSnapshot snapshot = mock(DataTreeSnapshot.class); - when(snapshot.readNode(any())).thenReturn(Optional.absent()); + when(snapshot.readNode(any())).thenReturn(Optional.empty()); when(delegatingDataTree.takeSnapshot()).thenReturn(snapshot); persistingDataTreeAdapter.commit(mock(DataTreeCandidate.class)); verify(delegatingDataTree).takeSnapshot(); @@ -126,7 +126,7 @@ public class PersistingDataTreeAdapterTest { final PersistingDataTreeAdapter.JsonPersister jsonPersister = new PersistingDataTreeAdapter.JsonPersister(tmpPersistFile, schemaService); // Nothing - jsonPersister.persistCurrentData(Optional.absent()); + jsonPersister.persistCurrentData(Optional.empty()); // Exception jsonPersister.persistCurrentData(Optional.of(ImmutableNodes.leafNode(QName.create("namespace", "leaf"), "value"))); } diff --git a/infra/it/it-test/src/test/java/io/fd/honeycomb/data/impl/AbstractInfraTest.java b/infra/it/it-test/src/test/java/io/fd/honeycomb/data/impl/AbstractInfraTest.java index d34479448..b9ef78d77 100644 --- a/infra/it/it-test/src/test/java/io/fd/honeycomb/data/impl/AbstractInfraTest.java +++ b/infra/it/it-test/src/test/java/io/fd/honeycomb/data/impl/AbstractInfraTest.java @@ -28,13 +28,13 @@ import org.junit.Before; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.opendaylight.controller.md.sal.binding.impl.BindingToNormalizedNodeCodec; +import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer; +import org.opendaylight.mdsal.binding.dom.codec.gen.impl.DataObjectSerializerGenerator; +import org.opendaylight.mdsal.binding.dom.codec.gen.impl.StreamWriterGenerator; +import org.opendaylight.mdsal.binding.dom.codec.impl.BindingNormalizedNodeCodecRegistry; import org.opendaylight.mdsal.binding.generator.impl.ModuleInfoBackedContext; import org.opendaylight.mdsal.binding.generator.util.BindingRuntimeContext; import org.opendaylight.mdsal.binding.generator.util.JavassistUtils; -import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer; -import org.opendaylight.yangtools.binding.data.codec.gen.impl.DataObjectSerializerGenerator; -import org.opendaylight.yangtools.binding.data.codec.gen.impl.StreamWriterGenerator; -import org.opendaylight.yangtools.binding.data.codec.impl.BindingNormalizedNodeCodecRegistry; import org.opendaylight.yangtools.yang.binding.DataObject; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; diff --git a/infra/it/it-test/src/test/java/io/fd/honeycomb/data/impl/HoneycombWriteInfraTest.java b/infra/it/it-test/src/test/java/io/fd/honeycomb/data/impl/HoneycombWriteInfraTest.java index 6d8099c6e..8a5896f5b 100644 --- a/infra/it/it-test/src/test/java/io/fd/honeycomb/data/impl/HoneycombWriteInfraTest.java +++ b/infra/it/it-test/src/test/java/io/fd/honeycomb/data/impl/HoneycombWriteInfraTest.java @@ -74,8 +74,8 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; -import org.opendaylight.yangtools.yang.data.api.schema.tree.TipProducingDataTree; -import org.opendaylight.yangtools.yang.data.api.schema.tree.TreeType; +import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTree; +import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeConfiguration; import org.opendaylight.yangtools.yang.data.impl.schema.tree.InMemoryDataTreeFactory; /** @@ -83,7 +83,7 @@ import org.opendaylight.yangtools.yang.data.impl.schema.tree.InMemoryDataTreeFac */ public class HoneycombWriteInfraTest extends AbstractInfraTest { - private TipProducingDataTree dataTree; + private DataTree dataTree; private WriterRegistry writerRegistry; Writer<SimpleContainer> simpleContainerWriter = mockWriter(Ids.SIMPLE_CONTAINER_ID); @@ -139,7 +139,7 @@ public class HoneycombWriteInfraTest extends AbstractInfraTest { } private void initDataTree() { - dataTree = InMemoryDataTreeFactory.getInstance().create(TreeType.CONFIGURATION); + dataTree = new InMemoryDataTreeFactory().create(DataTreeConfiguration.DEFAULT_CONFIGURATION); dataTree.setSchemaContext(schemaContext); } diff --git a/infra/it/it-test/src/test/java/io/fd/honeycomb/data/impl/NestedAugmentationWriteTest.java b/infra/it/it-test/src/test/java/io/fd/honeycomb/data/impl/NestedAugmentationWriteTest.java index 31ffab292..1043e5581 100644 --- a/infra/it/it-test/src/test/java/io/fd/honeycomb/data/impl/NestedAugmentationWriteTest.java +++ b/infra/it/it-test/src/test/java/io/fd/honeycomb/data/impl/NestedAugmentationWriteTest.java @@ -67,8 +67,8 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; -import org.opendaylight.yangtools.yang.data.api.schema.tree.TipProducingDataTree; -import org.opendaylight.yangtools.yang.data.api.schema.tree.TreeType; +import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTree; +import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeConfiguration; import org.opendaylight.yangtools.yang.data.impl.schema.tree.InMemoryDataTreeFactory; /** @@ -101,7 +101,7 @@ public class NestedAugmentationWriteTest extends AbstractInfraTest { private static final InstanceIdentifier<FromAugmentEntry> FROM_AUGMENT_ENTRY_ID = FROM_AUGMENT_LIST_AUGMENT_ID.child(FromAugmentEntry.class); - private TipProducingDataTree dataTree; + private DataTree dataTree; private WriterRegistry writerRegistry; private final Writer<AugTarget> augTargetWriter = mockWriter(AUG_TARGET_ID); @@ -128,7 +128,7 @@ public class NestedAugmentationWriteTest extends AbstractInfraTest { } private void initDataTree() { - dataTree = InMemoryDataTreeFactory.getInstance().create(TreeType.CONFIGURATION); + dataTree = new InMemoryDataTreeFactory().create(DataTreeConfiguration.DEFAULT_CONFIGURATION); dataTree.setSchemaContext(schemaContext); } diff --git a/infra/it/it-test/src/test/java/io/fd/honeycomb/data/impl/SubtreeWriteTest.java b/infra/it/it-test/src/test/java/io/fd/honeycomb/data/impl/SubtreeWriteTest.java index 3055429fb..5aed6bd1c 100644 --- a/infra/it/it-test/src/test/java/io/fd/honeycomb/data/impl/SubtreeWriteTest.java +++ b/infra/it/it-test/src/test/java/io/fd/honeycomb/data/impl/SubtreeWriteTest.java @@ -45,8 +45,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.hc.subtr import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.hc.subtree.test.rev180116.c1.C4Builder; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; -import org.opendaylight.yangtools.yang.data.api.schema.tree.TipProducingDataTree; -import org.opendaylight.yangtools.yang.data.api.schema.tree.TreeType; +import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTree; +import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeConfiguration; import org.opendaylight.yangtools.yang.data.impl.schema.tree.InMemoryDataTreeFactory; /** @@ -54,14 +54,14 @@ import org.opendaylight.yangtools.yang.data.impl.schema.tree.InMemoryDataTreeFac */ public final class SubtreeWriteTest extends AbstractInfraTest { - private TipProducingDataTree dataTree; + private DataTree dataTree; @Mock private Writer<C1> c1Writer; @Override void postSetup() { - dataTree = InMemoryDataTreeFactory.getInstance().create(TreeType.CONFIGURATION); + dataTree = new InMemoryDataTreeFactory().create(DataTreeConfiguration.DEFAULT_CONFIGURATION); dataTree.setSchemaContext(schemaContext); } diff --git a/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/data/DataTreeProvider.java b/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/data/DataTreeProvider.java index 039a0ad82..34d3916fc 100644 --- a/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/data/DataTreeProvider.java +++ b/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/data/DataTreeProvider.java @@ -21,8 +21,7 @@ import io.fd.honeycomb.binding.init.ProviderTrait; import io.fd.honeycomb.infra.distro.cfgattrs.HoneycombConfiguration; import org.opendaylight.controller.sal.core.api.model.SchemaService; import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTree; -import org.opendaylight.yangtools.yang.data.api.schema.tree.TipProducingDataTree; -import org.opendaylight.yangtools.yang.data.api.schema.tree.TreeType; +import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeConfiguration; import org.opendaylight.yangtools.yang.data.impl.schema.tree.InMemoryDataTreeFactory; public abstract class DataTreeProvider extends ProviderTrait<DataTree> { @@ -33,26 +32,26 @@ public abstract class DataTreeProvider extends ProviderTrait<DataTree> { private HoneycombConfiguration config; @Override - public TipProducingDataTree create() { - TipProducingDataTree delegate = InMemoryDataTreeFactory.getInstance().create(getType()); + public DataTree create() { + DataTree delegate = new InMemoryDataTreeFactory().create(getType()); delegate.setSchemaContext(schemaService.getGlobalContext()); return delegate; } - public abstract TreeType getType(); + public abstract DataTreeConfiguration getType(); public static class ConfigDataTreeProvider extends DataTreeProvider { @Override - public TreeType getType() { - return TreeType.CONFIGURATION; + public DataTreeConfiguration getType() { + return DataTreeConfiguration.DEFAULT_CONFIGURATION; } } public static class ContextDataTreeProvider extends DataTreeProvider { @Override - public TreeType getType() { - return TreeType.OPERATIONAL; + public DataTreeConfiguration getType() { + return DataTreeConfiguration.DEFAULT_OPERATIONAL; } } diff --git a/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/data/InmemoryDOMDataBrokerProvider.java b/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/data/InmemoryDOMDataBrokerProvider.java index 550b9bec5..5f12358a6 100644 --- a/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/data/InmemoryDOMDataBrokerProvider.java +++ b/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/data/InmemoryDOMDataBrokerProvider.java @@ -47,8 +47,9 @@ public final class InmemoryDOMDataBrokerProvider extends ProviderTrait<DOMDataBr protected SerializedDOMDataBroker create() { // This Databroker is dedicated for netconf metadata, not expected to be under heavy load ExecutorService listenableFutureExecutor = - SpecialExecutors.newBlockingBoundedCachedThreadPool(1, 100, "commits"); - ExecutorService commitExecutor = SpecialExecutors.newBoundedSingleThreadExecutor(100, "WriteTxCommit"); + SpecialExecutors.newBlockingBoundedCachedThreadPool(1, 100, "commits", getClass()); + ExecutorService commitExecutor = + SpecialExecutors.newBoundedSingleThreadExecutor(100, "WriteTxCommit", getClass()); // TODO HONEYCOMB-164 try to provide more lightweight implementation of DataBroker Map<LogicalDatastoreType, DOMStore> map = new LinkedHashMap<>(); @@ -56,6 +57,6 @@ public final class InmemoryDOMDataBrokerProvider extends ProviderTrait<DOMDataBr map.put(LogicalDatastoreType.OPERATIONAL, operDataStore); return new SerializedDOMDataBroker(map, new DeadlockDetectingListeningExecutorService(commitExecutor, - TransactionCommitDeadlockException.DEADLOCK_EXCEPTION_SUPPLIER, listenableFutureExecutor)); + TransactionCommitDeadlockException.DEADLOCK_EXCEPTION_SUPPLIER, listenableFutureExecutor)); } } diff --git a/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/schema/SchemaServiceProvider.java b/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/schema/SchemaServiceProvider.java index 4ed3698ec..fe1006df1 100644 --- a/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/schema/SchemaServiceProvider.java +++ b/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/schema/SchemaServiceProvider.java @@ -25,6 +25,7 @@ import org.opendaylight.yangtools.yang.model.api.Module; import org.opendaylight.yangtools.yang.model.api.SchemaContext; import org.opendaylight.yangtools.yang.model.api.SchemaContextListener; +// TODO: provide DOMSchemaService instead, but first Netconf's RestconfProviderImpl should not use it public final class SchemaServiceProvider extends ProviderTrait<SchemaService> { @Inject diff --git a/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/schema/SerializerProvider.java b/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/schema/SerializerProvider.java index dbd08a422..f38e2446d 100644 --- a/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/schema/SerializerProvider.java +++ b/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/schema/SerializerProvider.java @@ -20,12 +20,12 @@ import com.google.inject.Inject; import io.fd.honeycomb.binding.init.ProviderTrait; import javassist.ClassPool; import org.opendaylight.controller.md.sal.binding.impl.BindingToNormalizedNodeCodec; +import org.opendaylight.mdsal.binding.dom.codec.gen.impl.DataObjectSerializerGenerator; +import org.opendaylight.mdsal.binding.dom.codec.gen.impl.StreamWriterGenerator; +import org.opendaylight.mdsal.binding.dom.codec.impl.BindingNormalizedNodeCodecRegistry; import org.opendaylight.mdsal.binding.generator.impl.ModuleInfoBackedContext; import org.opendaylight.mdsal.binding.generator.util.BindingRuntimeContext; import org.opendaylight.mdsal.binding.generator.util.JavassistUtils; -import org.opendaylight.yangtools.binding.data.codec.gen.impl.DataObjectSerializerGenerator; -import org.opendaylight.yangtools.binding.data.codec.gen.impl.StreamWriterGenerator; -import org.opendaylight.yangtools.binding.data.codec.impl.BindingNormalizedNodeCodecRegistry; public class SerializerProvider extends ProviderTrait<BindingToNormalizedNodeCodec> { diff --git a/infra/northbound/bgp-extensions/evpn/src/main/java/io/fd/honeycomb/northbound/bgp/extension/EvpnModule.java b/infra/northbound/bgp-extensions/evpn/src/main/java/io/fd/honeycomb/northbound/bgp/extension/EvpnModule.java index b3bf0af0a..7b24b2ff7 100644 --- a/infra/northbound/bgp-extensions/evpn/src/main/java/io/fd/honeycomb/northbound/bgp/extension/EvpnModule.java +++ b/infra/northbound/bgp-extensions/evpn/src/main/java/io/fd/honeycomb/northbound/bgp/extension/EvpnModule.java @@ -16,25 +16,24 @@ package io.fd.honeycomb.northbound.bgp.extension; +import static io.fd.honeycomb.northbound.bgp.extension.AbstractBgpExtensionModule.TableTypeRegistration.tableType; + import com.google.common.collect.ImmutableSet; import com.google.inject.Provider; import io.fd.honeycomb.translate.write.WriterFactory; +import java.util.Collections; +import java.util.Set; import org.opendaylight.protocol.bgp.evpn.impl.BGPActivator; import org.opendaylight.protocol.bgp.evpn.impl.RIBActivator; import org.opendaylight.protocol.bgp.parser.spi.BGPExtensionProviderActivator; import org.opendaylight.protocol.bgp.rib.spi.RIBExtensionProviderActivator; import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.AfiSafi; import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.types.rev151009.L2VPNEVPN; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev160321.EvpnSubsequentAddressFamily; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev160321.L2vpnAddressFamily; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.EvpnSubsequentAddressFamily; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.L2vpnAddressFamily; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.Collections; -import java.util.Set; - -import static io.fd.honeycomb.northbound.bgp.extension.AbstractBgpExtensionModule.TableTypeRegistration.tableType; - public class EvpnModule extends AbstractBgpExtensionModule { private static final Logger LOG = LoggerFactory.getLogger(EvpnModule.class); diff --git a/infra/northbound/bgp-extensions/evpn/src/main/java/io/fd/honeycomb/northbound/bgp/extension/EvpnWriterFactory.java b/infra/northbound/bgp-extensions/evpn/src/main/java/io/fd/honeycomb/northbound/bgp/extension/EvpnWriterFactory.java index e06c79baa..82567dd26 100644 --- a/infra/northbound/bgp-extensions/evpn/src/main/java/io/fd/honeycomb/northbound/bgp/extension/EvpnWriterFactory.java +++ b/infra/northbound/bgp-extensions/evpn/src/main/java/io/fd/honeycomb/northbound/bgp/extension/EvpnWriterFactory.java @@ -16,19 +16,18 @@ package io.fd.honeycomb.northbound.bgp.extension; +import static io.fd.honeycomb.northbound.bgp.extension.AbstractBgpExtensionModule.TABLES_IID; + import com.google.inject.Inject; import com.google.inject.name.Named; import io.fd.honeycomb.translate.util.write.BindingBrokerWriter; import io.fd.honeycomb.translate.write.WriterFactory; import io.fd.honeycomb.translate.write.registry.ModifiableWriterRegistryBuilder; +import javax.annotation.Nonnull; import org.opendaylight.controller.md.sal.binding.api.DataBroker; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev160321.evpn.routes.EvpnRoutes; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.evpn.routes.EvpnRoutes; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import javax.annotation.Nonnull; - -import static io.fd.honeycomb.northbound.bgp.extension.AbstractBgpExtensionModule.TABLES_IID; - public class EvpnWriterFactory implements WriterFactory { private static final InstanceIdentifier<EvpnRoutes> EVPN_ROUTES_IID = TABLES_IID.child((Class) EvpnRoutes.class); diff --git a/infra/northbound/bgp-extensions/extension-common/src/main/java/io/fd/honeycomb/northbound/bgp/extension/AbstractBgpExtensionModule.java b/infra/northbound/bgp-extensions/extension-common/src/main/java/io/fd/honeycomb/northbound/bgp/extension/AbstractBgpExtensionModule.java index a9540442b..a43885761 100644 --- a/infra/northbound/bgp-extensions/extension-common/src/main/java/io/fd/honeycomb/northbound/bgp/extension/AbstractBgpExtensionModule.java +++ b/infra/northbound/bgp-extensions/extension-common/src/main/java/io/fd/honeycomb/northbound/bgp/extension/AbstractBgpExtensionModule.java @@ -20,20 +20,19 @@ import com.google.inject.AbstractModule; import com.google.inject.Singleton; import com.google.inject.multibindings.Multibinder; import io.fd.honeycomb.translate.write.WriterFactory; +import javax.annotation.Nonnull; import org.opendaylight.protocol.bgp.openconfig.spi.BGPTableTypeRegistryConsumer; import org.opendaylight.protocol.bgp.parser.spi.BGPExtensionProviderActivator; import org.opendaylight.protocol.bgp.rib.spi.RIBExtensionProviderActivator; import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.AfiSafi; import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.types.rev151009.AfiSafiType; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.ApplicationRib; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.rib.Tables; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.rib.Tables; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.ApplicationRib; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.AddressFamily; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.SubsequentAddressFamily; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.slf4j.Logger; -import javax.annotation.Nonnull; - /** * General blueprint for any module that wants to bind new BGP extension */ diff --git a/infra/northbound/bgp-extensions/inet/src/main/java/io/fd/honeycomb/northbound/bgp/extension/InetModule.java b/infra/northbound/bgp-extensions/inet/src/main/java/io/fd/honeycomb/northbound/bgp/extension/InetModule.java index 477d0ec8c..9d798c849 100644 --- a/infra/northbound/bgp-extensions/inet/src/main/java/io/fd/honeycomb/northbound/bgp/extension/InetModule.java +++ b/infra/northbound/bgp-extensions/inet/src/main/java/io/fd/honeycomb/northbound/bgp/extension/InetModule.java @@ -16,11 +16,14 @@ package io.fd.honeycomb.northbound.bgp.extension; +import static io.fd.honeycomb.northbound.bgp.extension.AbstractBgpExtensionModule.TableTypeRegistration.tableType; + import com.google.common.collect.ImmutableSet; import com.google.inject.Inject; import com.google.inject.Provider; import io.fd.honeycomb.infra.bgp.BgpConfiguration; import io.fd.honeycomb.translate.write.WriterFactory; +import java.util.Set; import org.opendaylight.protocol.bgp.inet.BGPActivator; import org.opendaylight.protocol.bgp.inet.RIBActivator; import org.opendaylight.protocol.bgp.parser.spi.BGPExtensionProviderActivator; @@ -29,18 +32,14 @@ import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.r import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.AfiSafiBuilder; import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.types.rev151009.IPV4UNICAST; import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.types.rev151009.IPV6UNICAST; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev160614.AfiSafi2; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev160614.AfiSafi2Builder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev171207.AfiSafi2; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev171207.AfiSafi2Builder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.Ipv4AddressFamily; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.Ipv6AddressFamily; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.UnicastSubsequentAddressFamily; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.Set; - -import static io.fd.honeycomb.northbound.bgp.extension.AbstractBgpExtensionModule.TableTypeRegistration.tableType; - public class InetModule extends AbstractBgpExtensionModule { private static final Logger LOG = LoggerFactory.getLogger(InetModule.class); diff --git a/infra/northbound/bgp-extensions/inet/src/main/java/io/fd/honeycomb/northbound/bgp/extension/InetWriterFactory.java b/infra/northbound/bgp-extensions/inet/src/main/java/io/fd/honeycomb/northbound/bgp/extension/InetWriterFactory.java index cc7064c79..69bda6fe8 100644 --- a/infra/northbound/bgp-extensions/inet/src/main/java/io/fd/honeycomb/northbound/bgp/extension/InetWriterFactory.java +++ b/infra/northbound/bgp-extensions/inet/src/main/java/io/fd/honeycomb/northbound/bgp/extension/InetWriterFactory.java @@ -22,8 +22,8 @@ import io.fd.honeycomb.translate.util.write.BindingBrokerWriter; import io.fd.honeycomb.translate.write.WriterFactory; import io.fd.honeycomb.translate.write.registry.ModifiableWriterRegistryBuilder; import org.opendaylight.controller.md.sal.binding.api.DataBroker; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.ipv4.routes.Ipv4Routes; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.ipv6.routes.Ipv6Routes; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207.ipv4.routes.Ipv4Routes; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207.ipv6.routes.Ipv6Routes; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import javax.annotation.Nonnull; diff --git a/infra/northbound/bgp-extensions/l3-vpn-v4/src/main/java/io/fd/honeycomb/northbound/bgp/extension/L3VpnV4WriterFactory.java b/infra/northbound/bgp-extensions/l3-vpn-v4/src/main/java/io/fd/honeycomb/northbound/bgp/extension/L3VpnV4WriterFactory.java index 255a55d53..01051e2b2 100644 --- a/infra/northbound/bgp-extensions/l3-vpn-v4/src/main/java/io/fd/honeycomb/northbound/bgp/extension/L3VpnV4WriterFactory.java +++ b/infra/northbound/bgp-extensions/l3-vpn-v4/src/main/java/io/fd/honeycomb/northbound/bgp/extension/L3VpnV4WriterFactory.java @@ -16,19 +16,18 @@ package io.fd.honeycomb.northbound.bgp.extension; +import static io.fd.honeycomb.northbound.bgp.extension.AbstractBgpExtensionModule.TABLES_IID; + import com.google.inject.Inject; import com.google.inject.name.Named; import io.fd.honeycomb.translate.util.write.BindingBrokerWriter; import io.fd.honeycomb.translate.write.WriterFactory; import io.fd.honeycomb.translate.write.registry.ModifiableWriterRegistryBuilder; +import javax.annotation.Nonnull; import org.opendaylight.controller.md.sal.binding.api.DataBroker; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.vpn.ipv4.rev160210.l3vpn.ipv4.routes.VpnIpv4Routes; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.vpn.ipv4.rev171207.l3vpn.ipv4.routes.VpnIpv4Routes; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import javax.annotation.Nonnull; - -import static io.fd.honeycomb.northbound.bgp.extension.AbstractBgpExtensionModule.TABLES_IID; - public class L3VpnV4WriterFactory implements WriterFactory { private static final InstanceIdentifier<VpnIpv4Routes> V4_ROUTES_IID = TABLES_IID.child((Class) VpnIpv4Routes.class); diff --git a/infra/northbound/bgp-extensions/l3-vpn-v6/src/main/java/io/fd/honeycomb/northbound/bgp/extension/L3VpnV6WriterFactory.java b/infra/northbound/bgp-extensions/l3-vpn-v6/src/main/java/io/fd/honeycomb/northbound/bgp/extension/L3VpnV6WriterFactory.java index 3e2c3cdf7..65a28173b 100644 --- a/infra/northbound/bgp-extensions/l3-vpn-v6/src/main/java/io/fd/honeycomb/northbound/bgp/extension/L3VpnV6WriterFactory.java +++ b/infra/northbound/bgp-extensions/l3-vpn-v6/src/main/java/io/fd/honeycomb/northbound/bgp/extension/L3VpnV6WriterFactory.java @@ -16,19 +16,18 @@ package io.fd.honeycomb.northbound.bgp.extension; +import static io.fd.honeycomb.northbound.bgp.extension.AbstractBgpExtensionModule.TABLES_IID; + import com.google.inject.Inject; import com.google.inject.name.Named; import io.fd.honeycomb.translate.util.write.BindingBrokerWriter; import io.fd.honeycomb.translate.write.WriterFactory; import io.fd.honeycomb.translate.write.registry.ModifiableWriterRegistryBuilder; +import javax.annotation.Nonnull; import org.opendaylight.controller.md.sal.binding.api.DataBroker; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.vpn.ipv6.rev160331.l3vpn.ipv6.routes.VpnIpv6Routes; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.vpn.ipv6.rev171207.l3vpn.ipv6.routes.VpnIpv6Routes; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import javax.annotation.Nonnull; - -import static io.fd.honeycomb.northbound.bgp.extension.AbstractBgpExtensionModule.TABLES_IID; - public class L3VpnV6WriterFactory implements WriterFactory { private static final InstanceIdentifier<VpnIpv6Routes> V6_ROUTES_IID = TABLES_IID.child((Class) VpnIpv6Routes.class); diff --git a/infra/northbound/bgp-extensions/labeled-unicast/src/main/java/io/fd/honeycomb/northbound/bgp/extension/LabeledUnicastModule.java b/infra/northbound/bgp-extensions/labeled-unicast/src/main/java/io/fd/honeycomb/northbound/bgp/extension/LabeledUnicastModule.java index fd32c5472..9aab1fc28 100644 --- a/infra/northbound/bgp-extensions/labeled-unicast/src/main/java/io/fd/honeycomb/northbound/bgp/extension/LabeledUnicastModule.java +++ b/infra/northbound/bgp-extensions/labeled-unicast/src/main/java/io/fd/honeycomb/northbound/bgp/extension/LabeledUnicastModule.java @@ -16,11 +16,14 @@ package io.fd.honeycomb.northbound.bgp.extension; +import static io.fd.honeycomb.northbound.bgp.extension.AbstractBgpExtensionModule.TableTypeRegistration.tableType; + import com.google.common.collect.ImmutableSet; import com.google.inject.Inject; import com.google.inject.Provider; import io.fd.honeycomb.infra.bgp.BgpConfiguration; import io.fd.honeycomb.translate.write.WriterFactory; +import java.util.Set; import org.opendaylight.protocol.bgp.labeled.unicast.BGPActivator; import org.opendaylight.protocol.bgp.labeled.unicast.RIBActivator; import org.opendaylight.protocol.bgp.parser.spi.BGPExtensionProviderActivator; @@ -29,18 +32,14 @@ import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.r import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.AfiSafiBuilder; import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.types.rev151009.IPV4LABELLEDUNICAST; import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.types.rev151009.IPV6LABELLEDUNICAST; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev150525.LabeledUnicastSubsequentAddressFamily; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev160614.AfiSafi2; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev160614.AfiSafi2Builder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev171207.LabeledUnicastSubsequentAddressFamily; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev171207.AfiSafi2; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev171207.AfiSafi2Builder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.Ipv4AddressFamily; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.Ipv6AddressFamily; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.Set; - -import static io.fd.honeycomb.northbound.bgp.extension.AbstractBgpExtensionModule.TableTypeRegistration.tableType; - public class LabeledUnicastModule extends AbstractBgpExtensionModule { private static final Logger LOG = LoggerFactory.getLogger(LabeledUnicastModule.class); diff --git a/infra/northbound/bgp-extensions/labeled-unicast/src/main/java/io/fd/honeycomb/northbound/bgp/extension/LabeledUnicastWriterFactory.java b/infra/northbound/bgp-extensions/labeled-unicast/src/main/java/io/fd/honeycomb/northbound/bgp/extension/LabeledUnicastWriterFactory.java index 0db8f525f..37bb0fa9b 100644 --- a/infra/northbound/bgp-extensions/labeled-unicast/src/main/java/io/fd/honeycomb/northbound/bgp/extension/LabeledUnicastWriterFactory.java +++ b/infra/northbound/bgp-extensions/labeled-unicast/src/main/java/io/fd/honeycomb/northbound/bgp/extension/LabeledUnicastWriterFactory.java @@ -16,20 +16,19 @@ package io.fd.honeycomb.northbound.bgp.extension; +import static io.fd.honeycomb.northbound.bgp.extension.AbstractBgpExtensionModule.TABLES_IID; + import com.google.inject.Inject; import com.google.inject.name.Named; import io.fd.honeycomb.translate.util.write.BindingBrokerWriter; import io.fd.honeycomb.translate.write.WriterFactory; import io.fd.honeycomb.translate.write.registry.ModifiableWriterRegistryBuilder; +import javax.annotation.Nonnull; import org.opendaylight.controller.md.sal.binding.api.DataBroker; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev150525.labeled.unicast.ipv6.routes.LabeledUnicastIpv6Routes; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev150525.labeled.unicast.routes.LabeledUnicastRoutes; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev171207.labeled.unicast.ipv6.routes.LabeledUnicastIpv6Routes; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev171207.labeled.unicast.routes.LabeledUnicastRoutes; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import javax.annotation.Nonnull; - -import static io.fd.honeycomb.northbound.bgp.extension.AbstractBgpExtensionModule.TABLES_IID; - public class LabeledUnicastWriterFactory implements WriterFactory { diff --git a/infra/northbound/bgp-extensions/linkstate/src/main/java/io/fd/honeycomb/northbound/bgp/extension/LinkstateModule.java b/infra/northbound/bgp-extensions/linkstate/src/main/java/io/fd/honeycomb/northbound/bgp/extension/LinkstateModule.java index 528fe6461..ca98b6d51 100644 --- a/infra/northbound/bgp-extensions/linkstate/src/main/java/io/fd/honeycomb/northbound/bgp/extension/LinkstateModule.java +++ b/infra/northbound/bgp-extensions/linkstate/src/main/java/io/fd/honeycomb/northbound/bgp/extension/LinkstateModule.java @@ -16,29 +16,28 @@ package io.fd.honeycomb.northbound.bgp.extension; +import static io.fd.honeycomb.northbound.bgp.extension.AbstractBgpExtensionModule.TableTypeRegistration.tableType; + import com.google.common.collect.ImmutableSet; import com.google.inject.Inject; import com.google.inject.Provider; import io.fd.honeycomb.infra.bgp.BgpConfiguration; import io.fd.honeycomb.translate.write.WriterFactory; +import java.util.Set; import org.opendaylight.protocol.bgp.linkstate.impl.BGPActivator; import org.opendaylight.protocol.bgp.linkstate.impl.RIBActivator; import org.opendaylight.protocol.bgp.parser.spi.BGPExtensionProviderActivator; import org.opendaylight.protocol.bgp.rib.spi.RIBExtensionProviderActivator; import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.AfiSafi; import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.AfiSafiBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev150210.LinkstateAddressFamily; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev150210.LinkstateSubsequentAddressFamily; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev160614.AfiSafi2; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev160614.AfiSafi2Builder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev160614.LINKSTATE; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.LinkstateAddressFamily; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.LinkstateSubsequentAddressFamily; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev171207.AfiSafi2; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev171207.AfiSafi2Builder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev171207.LINKSTATE; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.Set; - -import static io.fd.honeycomb.northbound.bgp.extension.AbstractBgpExtensionModule.TableTypeRegistration.tableType; - public class LinkstateModule extends AbstractBgpExtensionModule { private static final Logger LOG = LoggerFactory.getLogger(LinkstateModule.class); diff --git a/infra/northbound/bgp-extensions/linkstate/src/main/java/io/fd/honeycomb/northbound/bgp/extension/LinkstateWriterFactory.java b/infra/northbound/bgp-extensions/linkstate/src/main/java/io/fd/honeycomb/northbound/bgp/extension/LinkstateWriterFactory.java index 7f4aaba27..bcb3f684a 100644 --- a/infra/northbound/bgp-extensions/linkstate/src/main/java/io/fd/honeycomb/northbound/bgp/extension/LinkstateWriterFactory.java +++ b/infra/northbound/bgp-extensions/linkstate/src/main/java/io/fd/honeycomb/northbound/bgp/extension/LinkstateWriterFactory.java @@ -16,19 +16,18 @@ package io.fd.honeycomb.northbound.bgp.extension; +import static io.fd.honeycomb.northbound.bgp.extension.AbstractBgpExtensionModule.TABLES_IID; + import com.google.inject.Inject; import com.google.inject.name.Named; import io.fd.honeycomb.translate.util.write.BindingBrokerWriter; import io.fd.honeycomb.translate.write.WriterFactory; import io.fd.honeycomb.translate.write.registry.ModifiableWriterRegistryBuilder; +import javax.annotation.Nonnull; import org.opendaylight.controller.md.sal.binding.api.DataBroker; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev150210.linkstate.routes.LinkstateRoutes; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.linkstate.routes.LinkstateRoutes; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import javax.annotation.Nonnull; - -import static io.fd.honeycomb.northbound.bgp.extension.AbstractBgpExtensionModule.TABLES_IID; - public class LinkstateWriterFactory implements WriterFactory { private static final InstanceIdentifier<LinkstateRoutes> LINKSTATE_ROUTES_IID = TABLES_IID.child((Class) LinkstateRoutes.class); diff --git a/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/ApplicationRibWriterFactory.java b/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/ApplicationRibWriterFactory.java index 00a12e7ac..05a2a9602 100644 --- a/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/ApplicationRibWriterFactory.java +++ b/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/ApplicationRibWriterFactory.java @@ -23,8 +23,8 @@ import io.fd.honeycomb.translate.util.write.BindingBrokerWriter; import io.fd.honeycomb.translate.write.WriterFactory; import io.fd.honeycomb.translate.write.registry.ModifiableWriterRegistryBuilder; import org.opendaylight.controller.md.sal.binding.api.DataBroker; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.ApplicationRib; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.rib.Tables; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.ApplicationRib; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.rib.Tables; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; /** diff --git a/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpRIBProvider.java b/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpRIBProvider.java index 06444ae5b..76b34d5eb 100644 --- a/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpRIBProvider.java +++ b/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpRIBProvider.java @@ -16,9 +16,15 @@ package io.fd.honeycomb.infra.bgp; +import static org.opendaylight.protocol.bgp.rib.impl.config.OpenConfigMappingUtil.toTableTypes; + import com.google.inject.Inject; import io.fd.honeycomb.binding.init.ProviderTrait; import io.fd.honeycomb.data.init.ShutdownHandler; +import java.util.ArrayList; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; import org.opendaylight.controller.md.sal.binding.impl.BindingToNormalizedNodeCodec; import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker; import org.opendaylight.controller.md.sal.dom.broker.impl.PingPongDataBroker; @@ -36,20 +42,13 @@ import org.opendaylight.protocol.bgp.rib.spi.RIBExtensionConsumerContext; import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.AfiSafi; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.RibId; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.rib.TablesKey; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.RibId; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.rib.TablesKey; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpId; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.ClusterIdentifier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.ArrayList; -import java.util.Map; -import java.util.Set; -import java.util.stream.Collectors; - -import static org.opendaylight.protocol.bgp.rib.impl.config.OpenConfigMappingUtil.toTableTypes; - final class BgpRIBProvider extends ProviderTrait<RIB> { private static final Logger LOG = LoggerFactory.getLogger(BgpRIBProvider.class); @@ -89,10 +88,11 @@ final class BgpRIBProvider extends ProviderTrait<RIB> { // based on org.opendaylight.protocol.bgp.rib.impl.config.RibImpl.createRib final PingPongDataBroker pingPongDataBroker = new PingPongDataBroker(domBroker); final RIBImpl rib = - new RIBImpl(new NoopClusterSingletonServiceProvider(), new RibId(cfg.bgpProtocolInstanceName.get()), + new RIBImpl(new RibId(cfg.bgpProtocolInstanceName.get()), asNumber, new BgpId(routerId), clusterId, extensions, dispatcher, codec, pingPongDataBroker, toTableTypes(afiSafiList, tableTypeRegistry), pathSelectionModes, - extensions.getClassLoadingStrategy(), null); + extensions.getClassLoadingStrategy()); + rib.instantiateServiceInstance(); // required for proper RIB's CodecRegistry initialization (based on RIBImpl.start) schemaService.registerSchemaContextListener(rib); diff --git a/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpReaderFactoryProvider.java b/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpReaderFactoryProvider.java index 728bb14e5..6f5bd5066 100644 --- a/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpReaderFactoryProvider.java +++ b/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpReaderFactoryProvider.java @@ -24,8 +24,8 @@ import io.fd.honeycomb.translate.read.registry.ModifiableReaderRegistryBuilder; import io.fd.honeycomb.translate.util.read.BindingBrokerReader; import org.opendaylight.controller.md.sal.binding.api.DataBroker; import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.BgpRib; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.BgpRibBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.BgpRib; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.BgpRibBuilder; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; final class BgpReaderFactoryProvider extends ProviderTrait<ReaderFactory> { diff --git a/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/neighbors/BgpPeerWriterFactory.java b/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/neighbors/BgpPeerWriterFactory.java index 848b4d504..5e924be7e 100644 --- a/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/neighbors/BgpPeerWriterFactory.java +++ b/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/neighbors/BgpPeerWriterFactory.java @@ -21,6 +21,7 @@ import io.fd.honeycomb.infra.bgp.BgpConfiguration; import io.fd.honeycomb.translate.impl.write.GenericListWriter; import io.fd.honeycomb.translate.write.WriterFactory; import io.fd.honeycomb.translate.write.registry.ModifiableWriterRegistryBuilder; +import javax.annotation.Nonnull; import org.opendaylight.protocol.bgp.openconfig.spi.BGPTableTypeRegistryConsumer; import org.opendaylight.protocol.bgp.rib.impl.spi.BGPPeerRegistry; import org.opendaylight.protocol.bgp.rib.impl.spi.RIB; @@ -31,11 +32,9 @@ import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.network.instance.re import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.network.instance.rev151018.network.instance.top.network.instances.NetworkInstance; import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.network.instance.rev151018.network.instance.top.network.instances.network.instance.Protocols; import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.network.instance.rev151018.network.instance.top.network.instances.network.instance.protocols.Protocol; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev160614.Protocol1; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev171207.Protocol1; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import javax.annotation.Nonnull; - /** * Initializes writer for Bgp Neighbors ({@link Neighbor} node) and all its parents required by HC infra. */ diff --git a/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/neighbors/NeighborCustomizer.java b/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/neighbors/NeighborCustomizer.java index baccb9a1c..cdaffb6f6 100644 --- a/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/neighbors/NeighborCustomizer.java +++ b/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/neighbors/NeighborCustomizer.java @@ -88,7 +88,8 @@ final class NeighborCustomizer implements ListWriterCustomizer<Neighbor, Neighbo peer = new BgpPeer(null); } LOG.debug("Starting bgp peer for {}", id); - peer.start(globalRib, neighbor, tableTypeRegistry, null); + peer.start(globalRib, neighbor, tableTypeRegistry); + peer.instantiateServiceInstance(); addPeer(id, peer); } @@ -102,7 +103,8 @@ final class NeighborCustomizer implements ListWriterCustomizer<Neighbor, Neighbo final PeerBean peer = peers.get(id); checkState(peer != null, "Could not find peer bean while updating neighbor {}", id); closePeerBean(peer); - peer.start(globalRib, dataAfter, tableTypeRegistry, null); + peer.start(globalRib, dataAfter, tableTypeRegistry); + peer.instantiateServiceInstance(); LOG.debug("Peer instance updated {}", peer); } diff --git a/infra/northbound/bgp/src/test/java/io/fd/honeycomb/infra/bgp/neighbors/NeighborCustomizerTest.java b/infra/northbound/bgp/src/test/java/io/fd/honeycomb/infra/bgp/neighbors/NeighborCustomizerTest.java index ba71cc90e..64e0b9bd1 100644 --- a/infra/northbound/bgp/src/test/java/io/fd/honeycomb/infra/bgp/neighbors/NeighborCustomizerTest.java +++ b/infra/northbound/bgp/src/test/java/io/fd/honeycomb/infra/bgp/neighbors/NeighborCustomizerTest.java @@ -18,22 +18,29 @@ package io.fd.honeycomb.infra.bgp.neighbors; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import static org.mockito.MockitoAnnotations.initMocks; +import com.google.common.util.concurrent.CheckedFuture; import io.fd.honeycomb.translate.write.WriteContext; import io.fd.honeycomb.translate.write.WriteFailedException; import java.util.Collections; import org.junit.Before; import org.junit.Test; import org.mockito.Mock; -import org.opendaylight.mdsal.singleton.common.api.ServiceGroupIdentifier; +import org.opendaylight.controller.md.sal.dom.api.DOMDataTreeChangeService; +import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction; +import org.opendaylight.controller.md.sal.dom.api.DOMTransactionChain; import org.opendaylight.protocol.bgp.openconfig.spi.BGPTableTypeRegistryConsumer; import org.opendaylight.protocol.bgp.rib.impl.config.PeerBean; +import org.opendaylight.protocol.bgp.rib.impl.spi.BGPDispatcher; import org.opendaylight.protocol.bgp.rib.impl.spi.BGPPeerRegistry; +import org.opendaylight.protocol.bgp.rib.impl.spi.ImportPolicyPeerTracker; import org.opendaylight.protocol.bgp.rib.impl.spi.RIB; +import org.opendaylight.protocol.bgp.rib.impl.spi.RIBSupportContextRegistry; import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.AfiSafiBuilder; import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.AfiSafisBuilder; import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.ConfigBuilder; @@ -45,12 +52,12 @@ import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.types.rev151009 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.types.rev151009.PeerType; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev160614.Config2; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev160614.Config2Builder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.BgpRib; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.RibId; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.bgp.rib.Rib; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.bgp.rib.RibKey; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev171207.Config2; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev171207.Config2Builder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.BgpRib; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.RibId; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.bgp.rib.Rib; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.bgp.rib.RibKey; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; @@ -70,6 +77,12 @@ public class NeighborCustomizerTest { private BGPTableTypeRegistryConsumer tableTypeRegistry; @Mock private WriteContext ctx; + @Mock + private DOMTransactionChain chain; + @Mock + private DOMDataWriteTransaction tx; + @Mock + private BGPDispatcher dispatcher; private NeighborCustomizer customizer; @@ -77,8 +90,15 @@ public class NeighborCustomizerTest { public void setUp() { initMocks(this); when(globalRib.getYangRibId()).thenReturn(YangInstanceIdentifier.EMPTY); - when(globalRib.getRibIServiceGroupIdentifier()).thenReturn(ServiceGroupIdentifier.create("sgid")); when(globalRib.getInstanceIdentifier()).thenReturn(RIB_IID); + when(globalRib.createPeerChain(any())).thenReturn(chain); + when(chain.newWriteOnlyTransaction()).thenReturn(tx); + when(tx.submit()).thenReturn(mock(CheckedFuture.class)); + when(globalRib.getImportPolicyPeerTracker()).thenReturn(mock(ImportPolicyPeerTracker.class)); + when(globalRib.getRibSupportContext()).thenReturn(mock(RIBSupportContextRegistry.class)); + when(globalRib.getService()).thenReturn(mock(DOMDataTreeChangeService.class)); + when(globalRib.getDispatcher()).thenReturn(dispatcher); + when(dispatcher.getBGPPeerRegistry()).thenReturn(peerRegistry); customizer = new NeighborCustomizer(globalRib, peerRegistry, tableTypeRegistry); } @@ -123,7 +143,7 @@ public class NeighborCustomizerTest { customizer.updateCurrentAttributes(ID, before, after, ctx); verify(peer).closeServiceInstance(); verify(peer).close(); - verify(peer).start(globalRib, after, tableTypeRegistry, null); + verify(peer).start(globalRib, after, tableTypeRegistry); } @Test diff --git a/infra/northbound/restconf/pom.xml b/infra/northbound/restconf/pom.xml index 8342e1a87..5cf74d23c 100644 --- a/infra/northbound/restconf/pom.xml +++ b/infra/northbound/restconf/pom.xml @@ -70,7 +70,7 @@ <!-- ODL-Restconf --> <dependency> <groupId>org.opendaylight.netconf</groupId> - <artifactId>sal-rest-connector</artifactId> + <artifactId>restconf-nb-bierman02</artifactId> </dependency> <!-- Jersey + Jetty for RESTCONF --> diff --git a/infra/northbound/restconf/src/main/java/io/fd/honeycomb/northbound/restconf/RestconfProvider.java b/infra/northbound/restconf/src/main/java/io/fd/honeycomb/northbound/restconf/RestconfProvider.java index e924dd751..a3b3fe902 100644 --- a/infra/northbound/restconf/src/main/java/io/fd/honeycomb/northbound/restconf/RestconfProvider.java +++ b/infra/northbound/restconf/src/main/java/io/fd/honeycomb/northbound/restconf/RestconfProvider.java @@ -53,6 +53,7 @@ final class RestconfProvider extends ProviderTrait<RestConnector> { protected RestconfProviderImpl create() { final RestconfProviderImpl instance = new RestconfProviderImpl(domDataBroker, schemaService, rpcService, notificationService, mountPointService, + schemaService, IpAddressBuilder.getDefaultInstance(cfg.restconfWebsocketAddress.get()), new PortNumber(cfg.restconfWebsocketPort.get())); diff --git a/infra/notification/impl/src/main/java/io/fd/honeycomb/notification/impl/TranslationUtil.java b/infra/notification/impl/src/main/java/io/fd/honeycomb/notification/impl/TranslationUtil.java index d03e320fe..9ba43fa0e 100644 --- a/infra/notification/impl/src/main/java/io/fd/honeycomb/notification/impl/TranslationUtil.java +++ b/infra/notification/impl/src/main/java/io/fd/honeycomb/notification/impl/TranslationUtil.java @@ -28,13 +28,13 @@ import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild; import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter; import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeWriter; -import org.opendaylight.yangtools.yang.data.codec.xml.XMLStreamNormalizedNodeStreamWriter; import org.opendaylight.yangtools.yang.model.api.SchemaContext; import org.opendaylight.yangtools.yang.model.api.SchemaPath; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.w3c.dom.Document; import org.w3c.dom.Element; +import org.opendaylight.yangtools.yang.data.codec.xml.XMLStreamNormalizedNodeStreamWriter; public final class TranslationUtil { diff --git a/infra/rpc/impl/src/test/java/io/fd/honeycomb/rpc/HoneycombDOMRpcServiceTest.java b/infra/rpc/impl/src/test/java/io/fd/honeycomb/rpc/HoneycombDOMRpcServiceTest.java index 53d37f375..7b27fec4e 100644 --- a/infra/rpc/impl/src/test/java/io/fd/honeycomb/rpc/HoneycombDOMRpcServiceTest.java +++ b/infra/rpc/impl/src/test/java/io/fd/honeycomb/rpc/HoneycombDOMRpcServiceTest.java @@ -20,6 +20,7 @@ import static org.junit.Assert.assertEquals; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; +import java.net.URI; import java.util.concurrent.CompletableFuture; import org.junit.Before; import org.junit.Test; @@ -49,7 +50,7 @@ public class HoneycombDOMRpcServiceTest { @Before public void setUp() { MockitoAnnotations.initMocks(this); - node = mockContainerNode(QName.create("a")); + node = mockContainerNode(QName.create(URI.create("urn:foo"), "a")); service = new HoneycombDOMRpcService(serializer, registry); when(serializer.fromNormalizedNodeRpcData(ArgumentMatchers.any(), ArgumentMatchers.any())).thenReturn(input); } diff --git a/infra/rpc/impl/src/test/java/io/fd/honeycomb/rpc/RpcRegistryBuilderTest.java b/infra/rpc/impl/src/test/java/io/fd/honeycomb/rpc/RpcRegistryBuilderTest.java index c7d7ce746..d021555b8 100644 --- a/infra/rpc/impl/src/test/java/io/fd/honeycomb/rpc/RpcRegistryBuilderTest.java +++ b/infra/rpc/impl/src/test/java/io/fd/honeycomb/rpc/RpcRegistryBuilderTest.java @@ -19,6 +19,7 @@ package io.fd.honeycomb.rpc; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; +import java.net.URI; import java.util.concurrent.ExecutionException; import org.junit.Before; import org.junit.Test; @@ -37,8 +38,10 @@ public class RpcRegistryBuilderTest { private RpcService service1; @Mock private RpcService service2; - private static final SchemaPath ID1 = SchemaPath.ROOT.createChild(QName.create("a")); - private static final SchemaPath ID2 = SchemaPath.ROOT.createChild(QName.create("b")); + + private static final URI namespace = URI.create("urn:foo"); + private static final SchemaPath ID1 = SchemaPath.ROOT.createChild(QName.create(namespace, "a")); + private static final SchemaPath ID2 = SchemaPath.ROOT.createChild(QName.create(namespace, "b")); @Before public void setUp() { @@ -66,7 +69,7 @@ public class RpcRegistryBuilderTest { @Test public void testServiceNotFound() throws ExecutionException, InterruptedException { - final SchemaPath id = SchemaPath.ROOT.createChild(QName.create("c")); + final SchemaPath id = SchemaPath.ROOT.createChild(QName.create(namespace, "c")); final DataObject request = Mockito.mock(DataObject.class); try { diff --git a/infra/test-utils/test-tools/src/main/java/io/fd/honeycomb/test/tools/YangContextProducer.java b/infra/test-utils/test-tools/src/main/java/io/fd/honeycomb/test/tools/YangContextProducer.java index 802a3ae90..34cc5abd6 100644 --- a/infra/test-utils/test-tools/src/main/java/io/fd/honeycomb/test/tools/YangContextProducer.java +++ b/infra/test-utils/test-tools/src/main/java/io/fd/honeycomb/test/tools/YangContextProducer.java @@ -25,12 +25,13 @@ import java.lang.reflect.Method; import javassist.ClassPool; import org.apache.commons.lang3.reflect.MethodUtils; import org.opendaylight.controller.md.sal.binding.impl.BindingToNormalizedNodeCodec; +import org.opendaylight.mdsal.binding.dom.codec.gen.impl.StreamWriterGenerator; +import org.opendaylight.mdsal.binding.dom.codec.impl.BindingNormalizedNodeCodecRegistry; import org.opendaylight.mdsal.binding.generator.impl.ModuleInfoBackedContext; import org.opendaylight.mdsal.binding.generator.util.BindingRuntimeContext; import org.opendaylight.mdsal.binding.generator.util.JavassistUtils; -import org.opendaylight.yangtools.binding.data.codec.gen.impl.StreamWriterGenerator; -import org.opendaylight.yangtools.binding.data.codec.impl.BindingNormalizedNodeCodecRegistry; import org.opendaylight.yangtools.yang.data.codec.gson.JSONCodecFactory; +import org.opendaylight.yangtools.yang.data.codec.gson.JSONCodecFactorySupplier; import org.opendaylight.yangtools.yang.data.util.AbstractModuleStringInstanceIdentifierCodec; import org.opendaylight.yangtools.yang.model.api.SchemaContext; @@ -59,7 +60,8 @@ interface YangContextProducer { java.lang.reflect.InvocationTargetException { // Reusing codec for JSON ... not public so here goes reflection - final JSONCodecFactory jsonCodecFactory = JSONCodecFactory.create(ctx.getSchemaContext()); + final JSONCodecFactory jsonCodecFactory = JSONCodecFactorySupplier.DRAFT_LHOTKA_NETMOD_YANG_JSON_02 + .getShared(ctx.getSchemaContext()); final Constructor<?> cstr = Class.forName("org.opendaylight.yangtools.yang.data.codec.gson.JSONInstanceIdentifierCodec") .getDeclaredConstructor(SchemaContext.class, JSONCodecFactory.class); diff --git a/infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/JsonUtils.java b/infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/JsonUtils.java index 324efc24c..2f488f443 100644 --- a/infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/JsonUtils.java +++ b/infra/translate-utils/src/main/java/io/fd/honeycomb/translate/util/JsonUtils.java @@ -32,7 +32,7 @@ import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter; import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeWriter; -import org.opendaylight.yangtools.yang.data.codec.gson.JSONCodecFactory; +import org.opendaylight.yangtools.yang.data.codec.gson.JSONCodecFactorySupplier; import org.opendaylight.yangtools.yang.data.codec.gson.JSONNormalizedNodeStreamWriter; import org.opendaylight.yangtools.yang.data.codec.gson.JsonParserStream; import org.opendaylight.yangtools.yang.data.codec.gson.JsonWriterFactory; @@ -62,7 +62,8 @@ public final class JsonUtils { final JsonWriter jsonWriter = createJsonWriter(outputStream, true); final NormalizedNodeStreamWriter streamWriter = JSONNormalizedNodeStreamWriter - .createNestedWriter(JSONCodecFactory.create(schemaContext), SchemaPath.ROOT, null, jsonWriter); + .createNestedWriter(JSONCodecFactorySupplier.DRAFT_LHOTKA_NETMOD_YANG_JSON_02.getShared(schemaContext), + SchemaPath.ROOT, null, jsonWriter); final NormalizedNodeWriter normalizedNodeWriter = NormalizedNodeWriter.forStreamWriter(streamWriter, true); jsonWriter.beginObject(); diff --git a/infra/translate-utils/src/test/java/io/fd/honeycomb/translate/util/JsonUtilsTest.java b/infra/translate-utils/src/test/java/io/fd/honeycomb/translate/util/JsonUtilsTest.java index 70717d2e8..a89760c9a 100644 --- a/infra/translate-utils/src/test/java/io/fd/honeycomb/translate/util/JsonUtilsTest.java +++ b/infra/translate-utils/src/test/java/io/fd/honeycomb/translate/util/JsonUtilsTest.java @@ -52,7 +52,7 @@ public class JsonUtilsTest { public void setUp() throws Exception { MockitoAnnotations.initMocks(this); tmpPersistFile = Files.createTempFile("testing-hc-persistence", "json"); - schemaContext = YangParserTestUtils.parseYangSources(Collections.singletonList("/test-persistence.yang")); + schemaContext = YangParserTestUtils.parseYangResource("/test-persistence.yang"); } @Test |