From 1326e9fa5cffe326b82aeee9d82d008526aff947 Mon Sep 17 00:00:00 2001 From: Maros Marsalek Date: Mon, 5 Sep 2016 12:10:26 +0200 Subject: Cleanup TODOs and FIXMEs - Fix minor ones - Report bigger and include issue number in comment - Pull common dependencies into dependency management of common/parents Change-Id: I06a6ac37c52b603fd73ed42023d6b2e7fa18010f Signed-off-by: Maros Marsalek --- v3po/api/pom.xml | 12 ------ v3po/v3po2vpp/pom.xml | 11 ++---- .../v3po/InterfacesStateReaderFactory.java | 2 - .../translate/v3po/InterfacesWriterFactory.java | 6 +-- .../SubinterfaceAugmentationWriterFactory.java | 2 +- .../io/fd/honeycomb/translate/v3po/V3poModule.java | 1 + .../v3po/VppStateHoneycombReaderFactory.java | 6 +-- .../v3po/initializers/InterfacesInitializer.java | 13 +++---- .../v3po/initializers/VppInitializer.java | 2 - .../v3po/interfaces/EthernetCustomizer.java | 3 -- .../v3po/interfaces/InterconnectionWriteUtils.java | 6 +-- .../v3po/interfaces/InterfaceCustomizer.java | 3 +- .../translate/v3po/interfaces/L2Customizer.java | 2 +- .../v3po/interfaces/RoutingCustomizer.java | 3 +- .../v3po/interfaces/SubInterfaceCustomizer.java | 11 ++---- .../v3po/interfaces/SubInterfaceL2Customizer.java | 2 +- .../v3po/interfaces/VhostUserCustomizer.java | 10 +++-- .../translate/v3po/interfaces/VxlanCustomizer.java | 1 - .../v3po/interfaces/acl/AbstractAceWriter.java | 4 +- .../v3po/interfaces/acl/IetfAClWriter.java | 26 +++++++------ .../v3po/interfaces/ip/Ipv4AddressCustomizer.java | 6 --- .../v3po/interfaces/ip/Ipv4Customizer.java | 11 +++--- .../interfaces/ip/Ipv4NeighbourCustomizer.java | 4 +- .../v3po/interfaces/ip/Ipv4WriteUtils.java | 2 +- .../v3po/interfaces/ip/Ipv6Customizer.java | 2 - .../ip/SubInterfaceIpv4AddressCustomizer.java | 6 --- .../interfacesstate/InterconnectionReadUtils.java | 7 ++-- .../v3po/interfacesstate/InterfaceUtils.java | 2 - .../v3po/interfacesstate/ProxyArpCustomizer.java | 6 +-- .../interfacesstate/SubInterfaceCustomizer.java | 2 +- .../v3po/interfacesstate/ip/Ipv4Customizer.java | 2 +- .../v3po/interfacesstate/ip/Ipv4ReadUtils.java | 2 +- .../v3po/interfacesstate/ip/Ipv6Customizer.java | 10 +++-- .../InterfaceChangeNotificationProducer.java | 4 +- .../vpp/ArpTerminationTableEntryCustomizer.java | 2 +- .../translate/v3po/vpp/BridgeDomainCustomizer.java | 45 +++++++++++++--------- .../v3po/vppclassifier/ClassifySessionReader.java | 2 +- .../v3po/vppstate/BridgeDomainCustomizer.java | 4 +- .../v3po/vppstate/L2FibEntryCustomizer.java | 2 +- .../v3po/interfaces/GreCustomizerTest.java | 2 +- .../interfaces/SubInterfaceCustomizerTest.java | 17 ++------ .../v3po/interfaces/VhostUserCustomizerTest.java | 2 +- .../v3po/interfaces/VxlanCustomizerTest.java | 2 +- .../v3po/interfaces/VxlanGpeCustomizerTest.java | 2 +- .../interfacesstate/InterfaceCustomizerTest.java | 3 +- .../v3po/vpp/BridgeDomainCustomizerTest.java | 4 +- .../translate/v3po/vppstate/VppStateTest.java | 7 ++-- .../translate/v3po/vppstate/VppStateTestUtils.java | 4 -- 48 files changed, 118 insertions(+), 172 deletions(-) (limited to 'v3po') diff --git a/v3po/api/pom.xml b/v3po/api/pom.xml index 46871727d..91102b86e 100644 --- a/v3po/api/pom.xml +++ b/v3po/api/pom.xml @@ -27,18 +27,6 @@ 1.16.12-SNAPSHOT bundle - - - - org.opendaylight.mdsal.model - mdsal-model-artifacts - 0.8.2-Beryllium-SR2 - pom - import - - - - org.opendaylight.mdsal.model diff --git a/v3po/v3po2vpp/pom.xml b/v3po/v3po2vpp/pom.xml index 5ab45c04c..24619a203 100644 --- a/v3po/v3po2vpp/pom.xml +++ b/v3po/v3po2vpp/pom.xml @@ -16,10 +16,10 @@ - io.fd.honeycomb.common - impl-parent + io.fd.honeycomb.vpp + vpp-impl-parent 1.16.12-SNAPSHOT - ../../common/impl-parent + ../../vpp-common/vpp-impl-parent 4.0.0 @@ -68,24 +68,20 @@ io.fd.vpp jvpp-core - 16.12-SNAPSHOT com.google.inject guice - ${guice.version} net.jmob guice.conf - ${guice.config.version} com.google.inject.extensions guice-multibindings - ${guice.version} @@ -105,6 +101,5 @@ 1.0.8 test - diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/InterfacesStateReaderFactory.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/InterfacesStateReaderFactory.java index 163457b2e..69ac8f9b8 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/InterfacesStateReaderFactory.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/InterfacesStateReaderFactory.java @@ -107,7 +107,6 @@ public final class InterfacesStateReaderFactory implements ReaderFactory { final InstanceIdentifier ifc2AugId = ifcId.augmentation(Interface2.class); registry.addStructuralReader(ifc2AugId, Interface2Builder.class); // Ipv4 - // TODO unfinished customizer final InstanceIdentifier ipv4Id = ifc2AugId.child(Ipv4.class); registry.add(new GenericReader<>(ipv4Id, new Ipv4Customizer(jvpp))); // Address @@ -117,7 +116,6 @@ public final class InterfacesStateReaderFactory implements ReaderFactory { final InstanceIdentifier neighborId = ipv4Id.child(Neighbor.class); registry.add(new GenericListReader<>(neighborId, new Ipv4NeighbourCustomizer(jvpp))); // Ipv6 - // TODO unfinished customizer final InstanceIdentifier ipv6Id = ifc2AugId.child(Ipv6.class); registry.add(new GenericReader<>(ipv6Id, new Ipv6Customizer(jvpp, ifcCtx))); } diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/InterfacesWriterFactory.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/InterfacesWriterFactory.java index 6ffe3c30c..bfef255ef 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/InterfacesWriterFactory.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/InterfacesWriterFactory.java @@ -109,14 +109,14 @@ public final class InterfacesWriterFactory implements WriterFactory { addVppInterfaceAgmentationWriters(IFC_ID, registry); // Interface1 (ietf-ip augmentation) addInterface1AugmentationWriters(IFC_ID, registry); - // SubinterfaceAugmentation TODO make dedicated module for subIfc writer factory + // SubinterfaceAugmentation new SubinterfaceAugmentationWriterFactory(jvpp, aclWriter, ifcContext, bdContext, classifyTableContext).init(registry); } private void addInterface1AugmentationWriters(final InstanceIdentifier ifcId, final ModifiableWriterRegistryBuilder registry) { final InstanceIdentifier ifc1AugId = ifcId.augmentation(Interface1.class); - // Ipv6(after interface) TODO unfinished customizer = + // Ipv6(after interface) = registry.addAfter(new GenericWriter<>(ifc1AugId.child(Ipv6.class), new Ipv6Customizer(jvpp)), ifcId); // Ipv4(after interface) @@ -159,7 +159,7 @@ public final class InterfacesWriterFactory implements WriterFactory { final Set> specificIfcTypes = Sets.newHashSet(vhostId, vxlanGpeId, vxlanGpeId, tapId); - // Ethernet(No dependency, customizer not finished TODO) = + // Ethernet = registry.add(new GenericWriter<>(VPP_IFC_AUG_ID.child(Ethernet.class), new EthernetCustomizer(jvpp))); // Routing(Execute only after specific interface customizers) = registry.addAfter( diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/SubinterfaceAugmentationWriterFactory.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/SubinterfaceAugmentationWriterFactory.java index 85c867e9b..4f47f494f 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/SubinterfaceAugmentationWriterFactory.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/SubinterfaceAugmentationWriterFactory.java @@ -86,7 +86,7 @@ public final class SubinterfaceAugmentationWriterFactory implements WriterFactor // Subinterfaces // Subinterface(Handle only after all interface related stuff gets processed) = registry.subtreeAddAfter( - // TODO this customizer covers quite a lot of complex child nodes (maybe refactor ?) + // TODO HONEYCOMB-188 this customizer covers quite a lot of complex child nodes (maybe refactor ?) Sets.newHashSet( InstanceIdentifier.create(SubInterface.class).child(Tags.class), InstanceIdentifier.create(SubInterface.class).child(Tags.class).child(Tag.class), diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/V3poModule.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/V3poModule.java index ada8f9d00..8485519f5 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/V3poModule.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/V3poModule.java @@ -41,6 +41,7 @@ public class V3poModule extends AbstractModule { install(ConfigurationModule.create()); requestInjection(V3poConfiguration.class); + // TODO HONEYCOMB-173 put into constants // Naming contexts bind(NamingContext.class) .annotatedWith(Names.named("interface-context")) diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/VppStateHoneycombReaderFactory.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/VppStateHoneycombReaderFactory.java index ea6b2e460..75779d949 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/VppStateHoneycombReaderFactory.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/VppStateHoneycombReaderFactory.java @@ -70,13 +70,11 @@ public final class VppStateHoneycombReaderFactory implements ReaderFactory { registry.addStructuralReader(vppStateId, VppStateBuilder.class); // Version // Wrap with keepalive reader to detect connection issues - // TODO keepalive reader wrapper relies on VersionReaderCustomizer (to perform timeout on reads) - // Once readers+customizers are asynchronous, pull the timeout to keepalive executor so that keepalive wrapper - // is truly generic + // Relying on VersionCustomizer to provide a "timing out read" registry.add(new KeepaliveReaderWrapper<>( new GenericReader<>(vppStateId.child(Version.class), new VersionCustomizer(jVpp)), keepaliveExecutor, ReadTimeoutException.class, 30, - // FIXME-minimal trigger jvpp reinitialization here + // FIXME HONEYCOMB-78 trigger jvpp reinitialization here () -> LOG.error("Keepalive failed. VPP is probably DOWN!"))); // BridgeDomains(Structural) final InstanceIdentifier bridgeDomainsId = vppStateId.child(BridgeDomains.class); diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/initializers/InterfacesInitializer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/initializers/InterfacesInitializer.java index e9beccfb7..d78f33296 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/initializers/InterfacesInitializer.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/initializers/InterfacesInitializer.java @@ -93,11 +93,9 @@ public class InterfacesInitializer extends AbstractDataTreeConverter { super(bindingDataBroker, InstanceIdentifier.create(VppState.class), InstanceIdentifier.create(Vpp.class)); } - // TODO move to v3po2vpp - @Override protected Vpp convert(final VppState operationalData) { LOG.debug("VppInitializer.convert()"); diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/EthernetCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/EthernetCustomizer.java index 2055e35b5..ebc6874ac 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/EthernetCustomizer.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/EthernetCustomizer.java @@ -39,7 +39,6 @@ public class EthernetCustomizer extends FutureJVppCustomizer implements WriterCu public void writeCurrentAttributes(@Nonnull final InstanceIdentifier id, @Nonnull final Ethernet dataAfter, @Nonnull final WriteContext writeContext) throws WriteFailedException { - // TODO LOG.warn("Unsupported, ignoring configuration {}", dataAfter); // VPP API does not support setting MTU } @@ -48,14 +47,12 @@ public class EthernetCustomizer extends FutureJVppCustomizer implements WriterCu public void updateCurrentAttributes(@Nonnull final InstanceIdentifier id, @Nonnull final Ethernet dataBefore, @Nonnull final Ethernet dataAfter, @Nonnull final WriteContext writeContext) { - // TODO LOG.warn("Unsupported, ignoring configuration {}", dataAfter); } @Override public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier id, @Nonnull final Ethernet dataBefore, @Nonnull final WriteContext writeContext) { - // TODO LOG.warn("Unsupported, ignoring configuration delete {}", id); } } diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/InterconnectionWriteUtils.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/InterconnectionWriteUtils.java index 8ff0da04a..64d262f23 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/InterconnectionWriteUtils.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/InterconnectionWriteUtils.java @@ -70,10 +70,8 @@ final class InterconnectionWriteUtils { } else if (ic instanceof BridgeBased) { setBridgeBasedL2(id, swIfIndex, ifcName, (BridgeBased) ic, writeContext, (byte) 1 /*enable*/); } else { - // FIXME how does choice extensibility work - // FIXME it is not even possible to create a dedicated customizer for Interconnection, since it's not a DataObject - // FIXME we might need a choice customizer - // THis choice is already from augment, so its probably not possible to augment augmented choice + // Choices&cases are not data objects, so they cannot have a dedicated Reader/Writer + // This choice is already from augment, so its not possible to augment augmented choice LOG.error("Unable to handle Interconnection of type {}", ic.getClass()); throw new WriteFailedException(id, "Unable to handle Interconnection of type " + ic.getClass()); } diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/InterfaceCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/InterfaceCustomizer.java index 082cf64e1..be0c4af09 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/InterfaceCustomizer.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/InterfaceCustomizer.java @@ -81,8 +81,7 @@ public class InterfaceCustomizer extends FutureJVppCustomizer implements ListWri public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier id, @Nonnull final Interface dataBefore, @Nonnull final WriteContext writeContext) { - - // TODO Handle deletes + // Nothing to be done here, customizers for specific interface types e.g. vxlan handle the delete } private void setInterface(final InstanceIdentifier id, final Interface swIf, diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/L2Customizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/L2Customizer.java index 7c84186ac..c000f0a1d 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/L2Customizer.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/L2Customizer.java @@ -59,7 +59,7 @@ public class L2Customizer extends FutureJVppCustomizer implements WriterCustomiz final String ifcName = id.firstKeyOf(Interface.class).getName(); final int swIfc = interfaceContext.getIndex(ifcName, writeContext.getMappingContext()); - // TODO handle update properly (if possible) + // No update, again calling set setL2(id, swIfc, ifcName, dataAfter, writeContext); } diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/RoutingCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/RoutingCustomizer.java index 77037a1f2..51bf31d07 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/RoutingCustomizer.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/RoutingCustomizer.java @@ -67,7 +67,6 @@ public class RoutingCustomizer extends FutureJVppCustomizer implements WriterCus final String ifName = id.firstKeyOf(Interface.class).getName(); try { - // TODO handle updates properly setRouting(id, ifName, dataAfter, writeContext); } catch (VppBaseCallException e) { LOG.warn("Failed to update routing for interface: {}, {}, vxlan: {}", ifName, writeContext, dataAfter); @@ -78,7 +77,7 @@ public class RoutingCustomizer extends FutureJVppCustomizer implements WriterCus @Override public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier id, @Nonnull final Routing dataBefore, @Nonnull final WriteContext writeContext) { - // TODO implement delete + // TODO HONEYCOMB-176 implement delete } private void setRouting(final InstanceIdentifier id, final String name, final Routing rt, diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/SubInterfaceCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/SubInterfaceCustomizer.java index bfaa42e44..10dd60841 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/SubInterfaceCustomizer.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/SubInterfaceCustomizer.java @@ -29,7 +29,7 @@ import io.fd.honeycomb.translate.v3po.util.TranslateUtils; import io.fd.honeycomb.translate.v3po.util.WriteTimeoutException; import io.fd.honeycomb.translate.write.WriteContext; import io.fd.honeycomb.translate.write.WriteFailedException; -import java.util.Objects; +import java.util.List; import java.util.concurrent.CompletionStage; import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -102,7 +102,7 @@ public class SubInterfaceCustomizer extends FutureJVppCustomizer } private CreateSubif getCreateSubifRequest(@Nonnull final SubInterface subInterface, final int swIfIndex) { - // TODO add validation + // TODO HONEYCOMB-183 add validation CreateSubif request = new CreateSubif(); request.subId = Math.toIntExact(subInterface.getIdentifier().intValue()); request.swIfIndex = swIfIndex; @@ -121,7 +121,8 @@ public class SubInterfaceCustomizer extends FutureJVppCustomizer } request.dot1Ad = booleanToByte(_802dot1ad.class == subInterface.getVlanType()); - final MatchType matchType = subInterface.getMatch().getMatchType(); // todo match should be mandatory + // TODO HONEYCOMB-183 match should be mandatory + final MatchType matchType = subInterface.getMatch().getMatchType(); request.exactMatch = booleanToByte(matchType instanceof VlanTagged && ((VlanTagged) matchType).isMatchExactTags()); request.defaultSub = booleanToByte(matchType instanceof Default); @@ -167,10 +168,6 @@ public class SubInterfaceCustomizer extends FutureJVppCustomizer @Nonnull final SubInterface dataBefore, @Nonnull final SubInterface dataAfter, @Nonnull final WriteContext writeContext) throws WriteFailedException { - if (Objects.equals(dataBefore.isEnabled(), dataAfter.isEnabled())) { - LOG.debug("No state update will be performed. Ignoring config"); - return; // TODO shouldn't we throw exception here (if there will be dedicated L2 customizer)? - } final String subIfaceName = getSubInterfaceName(id.firstKeyOf(Interface.class).getName(), Math.toIntExact(dataAfter.getIdentifier())); try { diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/SubInterfaceL2Customizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/SubInterfaceL2Customizer.java index 085fa3685..cfb78499a 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/SubInterfaceL2Customizer.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/SubInterfaceL2Customizer.java @@ -72,7 +72,7 @@ public class SubInterfaceL2Customizer extends FutureJVppCustomizer implements Wr final String subInterfaceName = getSubInterfaceName(id); final int subInterfaceIndex = interfaceContext.getIndex(subInterfaceName, writeContext.getMappingContext()); - // TODO handle update properly (if possible) + // Setting L2 to new values setL2(id, subInterfaceIndex, subInterfaceName, dataAfter, writeContext); } diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/VhostUserCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/VhostUserCustomizer.java index 5d10b3730..d4e734da1 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/VhostUserCustomizer.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/VhostUserCustomizer.java @@ -90,8 +90,9 @@ public class VhostUserCustomizer extends AbstractInterfaceTypeCustomizer { private static final Logger LOG = LoggerFactory.getLogger(VxlanCustomizer.class); diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/AbstractAceWriter.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/AbstractAceWriter.java index eeabff4ce..97c1bc031 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/AbstractAceWriter.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/AbstractAceWriter.java @@ -43,14 +43,14 @@ import org.openvpp.jvpp.core.future.FutureJVppCore; /** * Base writer for translation of ietf-acl model ACEs to VPP's classify tables and sessions. - * + *

* Creates one classify table with single session per ACE. * * @param type of access control list entry */ abstract class AbstractAceWriter implements AceWriter { - // TODO: minimise memory used by classify tables (we create a lot of them to make ietf-acl model + // TODO: HONEYCOMB-181 minimise memory used by classify tables (we create a lot of them to make ietf-acl model // mapping more convenient): // according to https://wiki.fd.io/view/VPP/Introduction_To_N-tuple_Classifiers#Creating_a_classifier_table, // classify table needs 16*(1 + match_n_vectors) bytes, but this does not quite work, so setting 8K for now diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/IetfAClWriter.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/IetfAClWriter.java index a25ddac6c..9c1098286 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/IetfAClWriter.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/IetfAClWriter.java @@ -132,9 +132,6 @@ public final class IetfAClWriter { // filter ACE entries and group by AceType final Map> acesByType = acls.stream() .flatMap(acl -> aclToAceStream(acl, writeContext)) - // TODO we should not tolerate nulls, but throw some meaningful exceptions instead - .filter(ace -> ace != null && ace.getMatches() != null && ace.getMatches().getAceType() != null && - ace.getActions() != null && ace.getActions().getPacketHandling() != null) .collect(Collectors.groupingBy(AclType::fromAce)); final InputAclSetInterface request = new InputAclSetInterface(); @@ -170,16 +167,21 @@ public final class IetfAClWriter { @Nonnull private static AclType fromAce(final Ace ace) { AclType result = null; - final AceType aceType = ace.getMatches().getAceType(); - if (aceType instanceof AceEth) { - result = ETH; - } else if (aceType instanceof AceIp) { - final AceIpVersion aceIpVersion = ((AceIp) aceType).getAceIpVersion(); - if (aceIpVersion instanceof AceIpv4) { - result = IP4; - } else { - result = IP6; + final AceType aceType; + try { + aceType = ace.getMatches().getAceType(); + if (aceType instanceof AceEth) { + result = ETH; + } else if (aceType instanceof AceIp) { + final AceIpVersion aceIpVersion = ((AceIp) aceType).getAceIpVersion(); + if (aceIpVersion instanceof AceIpv4) { + result = IP4; + } else { + result = IP6; + } } + } catch (NullPointerException e) { + throw new IllegalArgumentException("Incomplete ACE: " + ace, e); } if (result == null) { throw new IllegalArgumentException(String.format("Not supported ace type %s", aceType)); diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/Ipv4AddressCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/Ipv4AddressCustomizer.java index 4a9a14d09..e7b932ae0 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/Ipv4AddressCustomizer.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/Ipv4AddressCustomizer.java @@ -82,12 +82,6 @@ public class Ipv4AddressCustomizer extends FutureJVppCustomizer implements ListW } else if (subnet instanceof Netmask) { setNetmaskSubnet(add, id, interfaceName, interfaceIndex, address, (Netmask) subnet); } else { - // FIXME how does choice extensibility work - // FIXME it is not even possible to create a dedicated - // customizer for Interconnection, since it's not a DataObject - // FIXME we might need a choice customizer - // THis choice is already from augment, so its probably not - // possible to augment augmented choice LOG.error("Unable to handle subnet of type {}", subnet.getClass()); throw new WriteFailedException(id, "Unable to handle subnet of type " + subnet.getClass()); } diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/Ipv4Customizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/Ipv4Customizer.java index d565e4e59..0e0bba3b0 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/Ipv4Customizer.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/Ipv4Customizer.java @@ -54,14 +54,14 @@ public class Ipv4Customizer extends FutureJVppCustomizer implements WriterCustom throws WriteFailedException { final String ifcName = id.firstKeyOf(Interface.class).getName(); - // TODO handle update in a better way + // TODO HONEYCOMB-180 handle update in a better way setIpv4(id, ifcName, dataAfter, writeContext); } @Override public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier id, @Nonnull final Ipv4 dataBefore, @Nonnull final WriteContext writeContext) { - // TODO implement delete + // TODO HONEYCOMB-180 implement delete } private void setIpv4(final InstanceIdentifier id, final String name, final Ipv4 ipv4, @@ -70,9 +70,10 @@ public class Ipv4Customizer extends FutureJVppCustomizer implements WriterCustom final int swIfc = interfaceContext.getIndex(name, writeContext.getMappingContext()); LOG.warn("Ignoring Ipv4 leaf nodes (create/update is not supported)"); - // TODO add support for enabled leaf - // TODO add support for forwarding leaf - // TODO add support for mtu leaf + // TODO HONEYCOMB-180 add support for: + // enabled leaf + // forwarding leaf + // mtu leaf } } diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/Ipv4NeighbourCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/Ipv4NeighbourCustomizer.java index b866842c1..72d8277fc 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/Ipv4NeighbourCustomizer.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/Ipv4NeighbourCustomizer.java @@ -42,7 +42,7 @@ import org.slf4j.LoggerFactory; /** - * Customizer for writing {@link Neighbor} for {@link Ipv4} + * Customizer for writing {@link Neighbor} for {@link Ipv4}. */ public class Ipv4NeighbourCustomizer extends FutureJVppCustomizer implements ListWriterCustomizer { @@ -126,7 +126,7 @@ public class Ipv4NeighbourCustomizer extends FutureJVppCustomizer request.macAddress = TranslateUtils.parseMac(data.getLinkLayerAddress().getValue()); request.swIfIndex = parentInterfaceIndex; - //TODO if it is necessary for future use ,make adjustments to be able to set vrfid + //TODO HONEYCOMB-182 if it is necessary for future use ,make adjustments to be able to set vrfid //request.vrfId TranslateUtils.getReplyForWrite(getFutureJVpp().ipNeighborAddDel(request).toCompletableFuture(), id); } diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/Ipv4WriteUtils.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/Ipv4WriteUtils.java index f981d0db0..ab31debc9 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/Ipv4WriteUtils.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/Ipv4WriteUtils.java @@ -34,7 +34,7 @@ import org.openvpp.jvpp.core.future.FutureJVppCore; /** * Utility class providing Ipv4 CUD support. */ -// TODO replace with interface with default methods or abstract class +// TODO HONEYCOMB-175 replace with interface with default methods or abstract class final class Ipv4WriteUtils { private static final int DOTTED_QUAD_MASK_LENGTH = 4; diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/Ipv6Customizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/Ipv6Customizer.java index 6ea30899a..192906854 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/Ipv6Customizer.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/Ipv6Customizer.java @@ -37,7 +37,6 @@ public class Ipv6Customizer extends FutureJVppCustomizer implements WriterCustom @Override public void writeCurrentAttributes(@Nonnull final InstanceIdentifier id, @Nonnull final Ipv6 dataAfter, @Nonnull final WriteContext writeContext) { - // TODO LOG.warn("Unsupported, ignoring configuration {}", dataAfter); } @@ -52,6 +51,5 @@ public class Ipv6Customizer extends FutureJVppCustomizer implements WriterCustom public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier id, @Nonnull final Ipv6 dataBefore, @Nonnull final WriteContext writeContext) { LOG.warn("Unsupported, ignoring configuration delete {}", id); - // TODO } } diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/SubInterfaceIpv4AddressCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/SubInterfaceIpv4AddressCustomizer.java index ab1978861..e0fa46335 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/SubInterfaceIpv4AddressCustomizer.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/SubInterfaceIpv4AddressCustomizer.java @@ -89,12 +89,6 @@ public class SubInterfaceIpv4AddressCustomizer extends FutureJVppCustomizer } else if (subnet instanceof Netmask) { setNetmaskSubnet(add, id, interfaceName, subInterfaceIndex, address, (Netmask) subnet); } else { - // FIXME how does choice extensibility work - // FIXME it is not even possible to create a dedicated - // customizer for Interconnection, since it's not a DataObject - // FIXME we might need a choice customizer - // THis choice is already from augment, so its probably not - // possible to augment augmented choice LOG.error("Unable to handle subnet of type {}", subnet.getClass()); throw new WriteFailedException(id, "Unable to handle subnet of type " + subnet.getClass()); } diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/InterconnectionReadUtils.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/InterconnectionReadUtils.java index 19c89237c..5dec9b426 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/InterconnectionReadUtils.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/InterconnectionReadUtils.java @@ -43,7 +43,6 @@ import org.slf4j.LoggerFactory; /** * Utility class providing Interconnection read support. */ -// FIXME this should be customizer, but it is not possible because Interconnection is not a DataObject final class InterconnectionReadUtils { private static final Logger LOG = LoggerFactory.getLogger(InterconnectionReadUtils.class); @@ -93,7 +92,7 @@ final class InterconnectionReadUtils { } return bbBuilder.build(); } - // TODO is there a way to check if interconnection is XconnectBased? + // TODO HONEYCOMB-190 is there a way to check if interconnection is XconnectBased? return null; } @@ -116,8 +115,8 @@ final class InterconnectionReadUtils { throws ReadFailedException { try { // We need to perform full bd dump, because there is no way - // to ask VPP for BD details given interface id/name (TODO add it to vpp.api?) - // TODO cache dump result + // to ask VPP for BD details given interface id/name (TODO HONEYCOMB-190 add it to vpp.api?) + // TODO HONEYCOMB-190 cache dump result final BridgeDomainDump request = new BridgeDomainDump(); request.bdId = -1; diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/InterfaceUtils.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/InterfaceUtils.java index e1f17431e..499f21dea 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/InterfaceUtils.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/InterfaceUtils.java @@ -101,8 +101,6 @@ public final class InterfaceUtils { sb.append(HEX_CHARS[v & 15]); } - // TODO rename and move to V3poUtils - /** * Reads first 6 bytes of supplied byte array and converts to string as Yang dictates

Replace later with * https://git.opendaylight.org/gerrit/#/c/34869/10/model/ietf/ietf-type- util/src/main/ diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/ProxyArpCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/ProxyArpCustomizer.java index 1deb816f6..2d4dbbe17 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/ProxyArpCustomizer.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/ProxyArpCustomizer.java @@ -35,8 +35,7 @@ import org.slf4j.LoggerFactory; public class ProxyArpCustomizer extends FutureJVppCustomizer implements ReaderCustomizer { + org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces.state._interface.ProxyArpBuilder> { private static final Logger LOG = LoggerFactory.getLogger(ProxyArpCustomizer.class); private final NamingContext interfaceContext; @@ -72,8 +71,7 @@ public class ProxyArpCustomizer extends FutureJVppCustomizer .rev150105.interfaces.state._interface.ProxyArpBuilder builder, @Nonnull ReadContext ctx) throws ReadFailedException { - //TODO: Implement fully when VPP Proxy ARP read API is available - // https://jira.fd.io/browse/VPP-225 + //TODO: VPP-225 Implement fully when VPP Proxy ARP read API is available final InterfaceKey key = id.firstKeyOf(Interface.class); final int index = interfaceContext.getIndex(key.getName(), ctx.getMappingContext()); LOG.warn("Reading of ARP data not (yet) supported by VPP API"); diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/SubInterfaceCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/SubInterfaceCustomizer.java index 1ad1758b5..49b53235e 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/SubInterfaceCustomizer.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/SubInterfaceCustomizer.java @@ -96,7 +96,7 @@ public class SubInterfaceCustomizer extends FutureJVppCustomizer final String ifaceName = key.getName(); final int ifaceId = interfaceContext.getIndex(ifaceName, context.getMappingContext()); - // TODO if we know that full dump was already performed we could use cache + // TODO HONEYCOMB-189 if we know that full dump was already performed we could use cache // (checking if getCachedInterfaceDump() returns non empty map is not enough, because // we could be part of particular iface state read final SwInterfaceDump request = new SwInterfaceDump(); diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/ip/Ipv4Customizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/ip/Ipv4Customizer.java index 73e1c7047..77837fc99 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/ip/Ipv4Customizer.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/ip/Ipv4Customizer.java @@ -53,7 +53,7 @@ public class Ipv4Customizer extends FutureJVppCustomizer implements ReaderCustom @Override public void readCurrentAttributes(@Nonnull final InstanceIdentifier id, @Nonnull final Ipv4Builder builder, @Nonnull final ReadContext ctx) throws ReadFailedException { - //TODO add reading of isForwarding flag when there is dump for it + //TODO HONEYCOMB-180 add reading of isForwarding flag when there is dump for it LOG.warn("Operation not supported"); } diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/ip/Ipv4ReadUtils.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/ip/Ipv4ReadUtils.java index 1ccae0aed..c3c5616c9 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/ip/Ipv4ReadUtils.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/ip/Ipv4ReadUtils.java @@ -55,7 +55,7 @@ final class Ipv4ReadUtils { // Many VPP APIs do not provide get operation for single item. Dump requests for all items are used instead. // To improve HC performance, caching dump requests is a common pattern. - // TODO: use more generic caching implementation, once provided + // TODO: HONEYCOMB-102 use more generic caching implementation, once provided static Optional dumpAddresses(@Nonnull final FutureJVppCore futureJVppCore, @Nonnull final InstanceIdentifier id, @Nonnull final String interfaceName, diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/ip/Ipv6Customizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/ip/Ipv6Customizer.java index 1bcc81517..634ae87d1 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/ip/Ipv6Customizer.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/ip/Ipv6Customizer.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package io.fd.honeycomb.translate.v3po.interfacesstate.ip; import io.fd.honeycomb.translate.read.ReadContext; @@ -52,12 +53,13 @@ public class Ipv6Customizer extends FutureJVppCustomizer implements ReaderCustom @Override public void readCurrentAttributes(@Nonnull final InstanceIdentifier id, @Nonnull final Ipv6Builder builder, @Nonnull final ReadContext ctx) throws ReadFailedException { - // TODO implement + // TODO HONEYCOMB-102 implement // final IpAddressDump dumpRequest = new IpAddressDump(); // dumpRequest.isIpv6 = 1; -// dumpRequest.swIfIndex = interfaceContext.getIndex(id.firstKeyOf(Interface.class).getName(), ctx.getMappingContext()); -// final CompletionStage addressDumpFuture = getFutureJVpp().ipAddressDump(dumpRequest); - // TODO consider extracting customizer for address +// dumpRequest.swIfIndex = interfaceContext.getIndex(id.firstKeyOf(Interface.class).getName(), +// ctx.getMappingContext()); +// final CompletionStage addressDumpFuture = getFutureJVpp(). +// ipAddressDump(dumpRequest); // final IpAddressDetailsReplyDump reply = TranslateUtils.getReply(addressDumpFuture.toCompletableFuture()); } diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/notification/InterfaceChangeNotificationProducer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/notification/InterfaceChangeNotificationProducer.java index 305148f47..481a2eac9 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/notification/InterfaceChangeNotificationProducer.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/notification/InterfaceChangeNotificationProducer.java @@ -78,7 +78,7 @@ public final class InterfaceChangeNotificationProducer implements ManagedNotific notificationListenerReg = jvpp.getNotificationRegistry().registerSwInterfaceSetFlagsNotificationCallback( swInterfaceSetFlagsNotification -> { LOG.trace("Interface notification received: {}", swInterfaceSetFlagsNotification); - // TODO this should be lazy + // TODO HONEYCOMB-166 this should be lazy collector.onNotification(transformNotification(swInterfaceSetFlagsNotification)); } ); @@ -101,7 +101,7 @@ public final class InterfaceChangeNotificationProducer implements ManagedNotific * data tree (write transaction is still in progress and context changes have not been committed yet, or * VPP sends the notification before it returns create request(that would store mapping)). *

- * In case mapping is not available, index is used as name. TODO inconsistent behavior, maybe just use indices ? + * In case mapping is not available, index is used as name. */ private InterfaceNameOrIndex getIfcName(final SwInterfaceSetFlagsNotification swInterfaceSetFlagsNotification) { final Optional optionalName = diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vpp/ArpTerminationTableEntryCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vpp/ArpTerminationTableEntryCustomizer.java index e1631695a..488c99bb0 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vpp/ArpTerminationTableEntryCustomizer.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vpp/ArpTerminationTableEntryCustomizer.java @@ -121,7 +121,7 @@ public class ArpTerminationTableEntryCustomizer extends FutureJVppCustomizer final IpAddress ipAddress = entry.getIpAddress(); if (ipAddress.getIpv6Address() != null) { - // FIXME: vpp does not support ipv6 in arp-termination table (based on analysis of l2_bd.c) + // FIXME: HONEYCOMB-187 vpp does not support ipv6 in arp-termination table (based on analysis of l2_bd.c) throw new UnsupportedOperationException("IPv6 address for ARP termination table is not supported yet"); } diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vpp/BridgeDomainCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vpp/BridgeDomainCustomizer.java index 3886d36f4..83be3c62c 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vpp/BridgeDomainCustomizer.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vpp/BridgeDomainCustomizer.java @@ -23,12 +23,13 @@ import static io.fd.honeycomb.translate.v3po.util.TranslateUtils.booleanToByte; import com.google.common.base.Preconditions; import io.fd.honeycomb.translate.spi.write.ListWriterCustomizer; import io.fd.honeycomb.translate.v3po.util.FutureJVppCustomizer; -import io.fd.honeycomb.translate.v3po.util.WriteTimeoutException; -import io.fd.honeycomb.translate.write.WriteContext; import io.fd.honeycomb.translate.v3po.util.NamingContext; import io.fd.honeycomb.translate.v3po.util.TranslateUtils; +import io.fd.honeycomb.translate.v3po.util.WriteTimeoutException; +import io.fd.honeycomb.translate.write.WriteContext; import io.fd.honeycomb.translate.write.WriteFailedException; import javax.annotation.Nonnull; +import javax.annotation.concurrent.GuardedBy; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.bridge.domains.BridgeDomain; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.bridge.domains.BridgeDomainKey; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; @@ -47,6 +48,8 @@ public class BridgeDomainCustomizer private static final byte ADD_OR_UPDATE_BD = (byte) 1; private final NamingContext bdContext; + @GuardedBy("this") + private int bridgeDomainIndexCounter = 1; public BridgeDomainCustomizer(@Nonnull final FutureJVppCore futureJVppCore, @Nonnull final NamingContext bdContext) { super(futureJVppCore); @@ -79,24 +82,30 @@ public class BridgeDomainCustomizer LOG.debug("writeCurrentAttributes: id={}, current={}, ctx={}", id, dataBefore, ctx); final String bdName = dataBefore.getName(); - try { - int index; - if (bdContext.containsIndex(bdName, ctx.getMappingContext())) { - index = bdContext.getIndex(bdName, ctx.getMappingContext()); - } else { - // FIXME we need the bd index to be returned by VPP or we should have a counter field - // (maybe in context similar to artificial name) - // Here we assign the next available ID from bdContext's perspective - index = 1; - while (bdContext.containsName(index, ctx.getMappingContext())) { - index++; + // Invoke 1. check index, 2. increase index 3. create ND 4. store mapping in a synchronized block to prevent + // race conditions in case of concurrent invocation + synchronized (this) { + try { + int index; + if (bdContext.containsIndex(bdName, ctx.getMappingContext())) { + index = bdContext.getIndex(bdName, ctx.getMappingContext()); + } else { + // Critical section due to bridgeDomainIndexCounter read and write access + // TODO HONEYCOMB-199 move this "get next available index" into naming context or an adapter + // or a dedicated object + + // Use counter to assign bridge domain index, but still check naming context if it's not taken there + while (bdContext.containsName(bridgeDomainIndexCounter, ctx.getMappingContext())) { + bridgeDomainIndexCounter++; + } + index = bridgeDomainIndexCounter; } + addOrUpdateBridgeDomain(id, index, dataBefore); + bdContext.addName(index, bdName, ctx.getMappingContext()); + } catch (VppBaseCallException e) { + LOG.warn("Failed to create bridge domain", e); + throw new WriteFailedException.CreateFailedException(id, dataBefore, e); } - addOrUpdateBridgeDomain(id, index, dataBefore); - bdContext.addName(index, bdName, ctx.getMappingContext()); - } catch (VppBaseCallException e) { - LOG.warn("Failed to create bridge domain", e); - throw new WriteFailedException.CreateFailedException(id, dataBefore, e); } } diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppclassifier/ClassifySessionReader.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppclassifier/ClassifySessionReader.java index 590a502fd..f8e94d1e1 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppclassifier/ClassifySessionReader.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppclassifier/ClassifySessionReader.java @@ -118,7 +118,7 @@ public class ClassifySessionReader extends FutureJVppCustomizer private OpaqueIndex readOpaqueIndex(final int opaqueIndex) { // We first try to map the value to a vpp node, if that fails, simply wrap the u32 value - // FIXME: the approach might fail if the opaqueIndex contains small value that collides + // TODO: HONEYCOMB-118 the approach might fail if the opaqueIndex contains small value that collides // with some of the adjacent nodes final VppNode node = readVppNode(opaqueIndex, LOG); if (node != null) { diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppstate/BridgeDomainCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppstate/BridgeDomainCustomizer.java index 4a33e7cae..d254a7912 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppstate/BridgeDomainCustomizer.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppstate/BridgeDomainCustomizer.java @@ -112,7 +112,7 @@ public final class BridgeDomainCustomizer extends FutureJVppCustomizer @Nonnull @Override public List getAllIds(@Nonnull final InstanceIdentifier id, - @Nonnull final ReadContext context) { + @Nonnull final ReadContext context) throws ReadFailedException { final BridgeDomainDump request = new BridgeDomainDump(); request.bdId = -1; // dump call @@ -120,7 +120,7 @@ public final class BridgeDomainCustomizer extends FutureJVppCustomizer try { reply = getFutureJVpp().bridgeDomainDump(request).toCompletableFuture().get(); } catch (Exception e) { - throw new IllegalStateException("Bridge domain dump failed", e); // TODO ReadFailedException? + throw new ReadFailedException(id, e); } if (reply == null || reply.bridgeDomainDetails == null) { diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppstate/L2FibEntryCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppstate/L2FibEntryCustomizer.java index 94c3119ca..2de19a1c1 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppstate/L2FibEntryCustomizer.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppstate/L2FibEntryCustomizer.java @@ -84,7 +84,7 @@ public final class L2FibEntryCustomizer extends FutureJVppCustomizer LOG.debug("Reading L2 FIB entry: key={}. bridgeDomainKey={}, bdId={}", key, bridgeDomainKey, bdId); try { - // TODO use cached l2FibTable + // TODO HONEYCOMB-186 use cached l2FibTable final L2FibTableEntry entry = dumpL2Fibs(id, bdId).stream().filter(e -> key.getPhysAddress() .equals(new PhysAddress(vppPhysAddrToYang(Longs.toByteArray(e.mac), 2)))) .collect(SINGLE_ITEM_COLLECTOR); diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/GreCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/GreCustomizerTest.java index cfb7b3700..58a44d7cf 100644 --- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/GreCustomizerTest.java +++ b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/GreCustomizerTest.java @@ -89,7 +89,7 @@ public class GreCustomizerTest { initMocks(this); InterfaceTypeTestUtils.setupWriteContext(writeContext, org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.GreTunnel.class); - // TODO create base class for tests using vppApi + // TODO HONEYCOMB-116 create base class for tests using vppApi NamingContext namingContext = new NamingContext("generateInterfaceNAme", "test-instance"); final ModificationCache toBeReturned = new ModificationCache(); doReturn(toBeReturned).when(writeContext).getModificationCache(); diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/SubInterfaceCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/SubInterfaceCustomizerTest.java index 2aacc2521..507b43f9c 100644 --- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/SubInterfaceCustomizerTest.java +++ b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/SubInterfaceCustomizerTest.java @@ -22,17 +22,16 @@ import static org.junit.Assert.fail; import static org.mockito.Matchers.any; import static org.mockito.Matchers.eq; import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.never; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.MockitoAnnotations.initMocks; import com.google.common.base.Optional; -import io.fd.honeycomb.translate.v3po.test.ContextTestUtils; -import io.fd.honeycomb.translate.write.WriteContext; import io.fd.honeycomb.translate.MappingContext; +import io.fd.honeycomb.translate.v3po.test.ContextTestUtils; import io.fd.honeycomb.translate.v3po.test.TestHelperUtils; import io.fd.honeycomb.translate.v3po.util.NamingContext; +import io.fd.honeycomb.translate.write.WriteContext; import io.fd.honeycomb.translate.write.WriteFailedException; import java.util.Arrays; import java.util.List; @@ -109,7 +108,7 @@ public class SubInterfaceCustomizerTest { initMocks(this); namingContext = new NamingContext("generatedSubInterfaceName", "test-instance"); doReturn(mappingContext).when(writeContext).getMappingContext(); - // TODO create base class for tests using vppApi + // TODO HONEYCOMB-116 create base class for tests using vppApi customizer = new SubInterfaceCustomizer(api, namingContext); doReturn(ContextTestUtils.getMapping(SUPER_IF_NAME, SUPER_IF_ID)).when(mappingContext) .read(ContextTestUtils.getMappingIid(SUPER_IF_NAME, "test-instance")); @@ -302,16 +301,6 @@ public class SubInterfaceCustomizerTest { verifySwInterfaceSetFlagsWasInvoked(generateSwInterfaceEnableRequest(SUBIF_INDEX)); } - @Test - public void testUpdateNoStateChange() throws Exception { - final List tags = Arrays.asList(STAG_100, CTAG_200); - final SubInterface before = generateSubInterface(false, tags); - final SubInterface after = generateSubInterface(false, tags); - customizer.updateCurrentAttributes(null, before, after, writeContext); - - verify(api, never()).swInterfaceSetFlags(any()); - } - @Test(expected = UnsupportedOperationException.class) public void testDelete() throws Exception { final SubInterface subInterface = generateSubInterface(false, Arrays.asList(STAG_100, CTAG_200)); diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/VhostUserCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/VhostUserCustomizerTest.java index 1d5bcb11a..0bbf04fc0 100644 --- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/VhostUserCustomizerTest.java +++ b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/VhostUserCustomizerTest.java @@ -93,7 +93,7 @@ public class VhostUserCustomizerTest { doReturn(toBeReturned).when(writeContext).getModificationCache(); doReturn(mappingContext).when(writeContext).getMappingContext(); - // TODO create base class for tests using vppApi + // TODO HONEYCOMB-116 create base class for tests using vppApi customizer = new VhostUserCustomizer(api, namingContext); } diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/VxlanCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/VxlanCustomizerTest.java index b61514c13..40a6b53bd 100644 --- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/VxlanCustomizerTest.java +++ b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/VxlanCustomizerTest.java @@ -90,7 +90,7 @@ public class VxlanCustomizerTest { initMocks(this); InterfaceTypeTestUtils.setupWriteContext(writeContext, org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.VxlanTunnel.class); - // TODO create base class for tests using vppApi + // TODO HONEYCOMB-116 create base class for tests using vppApi NamingContext namingContext = new NamingContext("generateInterfaceNAme", "test-instance"); final ModificationCache toBeReturned = new ModificationCache(); doReturn(toBeReturned).when(writeContext).getModificationCache(); diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/VxlanGpeCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/VxlanGpeCustomizerTest.java index e545ef451..09e32ffe9 100644 --- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/VxlanGpeCustomizerTest.java +++ b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/VxlanGpeCustomizerTest.java @@ -90,7 +90,7 @@ public class VxlanGpeCustomizerTest { initMocks(this); InterfaceTypeTestUtils.setupWriteContext(writeContext, org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.VxlanGpeTunnel.class); - // TODO create base class for tests using vppApi + // TODO HONEYCOMB-116 create base class for tests using vppApi NamingContext namingContext = new NamingContext("generateInterfaceNAme", "test-instance"); final ModificationCache toBeReturned = new ModificationCache(); doReturn(toBeReturned).when(writeContext).getModificationCache(); diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/InterfaceCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/InterfaceCustomizerTest.java index 4f9b99b6d..a9a2a3c74 100644 --- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/InterfaceCustomizerTest.java +++ b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfacesstate/InterfaceCustomizerTest.java @@ -92,7 +92,6 @@ public class InterfaceCustomizerTest extends return new InterfaceCustomizer(api, interfacesContext); } - // TODO use reflexion and move to ListReaderCustomizerTest @Test public void testMerge() throws Exception { final InterfacesStateBuilder builder = mock(InterfacesStateBuilder.class); @@ -104,7 +103,7 @@ public class InterfaceCustomizerTest extends private void verifySwInterfaceDumpWasInvoked(final int nameFilterValid, final String ifaceName, final int dumpIfcsInvocationCount) throws VppInvocationException { - // TODO adding equals methods for jvpp DTOs would make ArgumentCaptor usage obsolete + // TODO HONEYCOMB-185 adding equals methods for jvpp DTOs would make ArgumentCaptor usage obsolete ArgumentCaptor argumentCaptor = ArgumentCaptor.forClass(SwInterfaceDump.class); verify(api, times(dumpIfcsInvocationCount)).swInterfaceDump(argumentCaptor.capture()); final SwInterfaceDump actual = argumentCaptor.getValue(); diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vpp/BridgeDomainCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vpp/BridgeDomainCustomizerTest.java index 41b02371f..6851bce22 100644 --- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vpp/BridgeDomainCustomizerTest.java +++ b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vpp/BridgeDomainCustomizerTest.java @@ -67,7 +67,7 @@ public class BridgeDomainCustomizerTest { @Before public void setUp() throws Exception { initMocks(this); - // TODO create base class for tests using vppApi + // TODO HONEYCOMB-116 create base class for tests using vppApi NamingContext namingContext = new NamingContext("generatedBDName", "test-instance"); final ModificationCache toBeReturned = new ModificationCache(); doReturn(toBeReturned).when(ctx).getModificationCache(); @@ -105,7 +105,7 @@ public class BridgeDomainCustomizerTest { final byte learn = BridgeDomainTestUtils.booleanToByte(bd.isLearn()); final byte uuf = BridgeDomainTestUtils.booleanToByte(bd.isUnknownUnicastFlood()); - // TODO adding equals methods for jvpp DTOs would make ArgumentCaptor usage obsolete + // TODO HONEYCOMB-185 adding equals methods for jvpp DTOs would make ArgumentCaptor usage obsolete ArgumentCaptor argumentCaptor = ArgumentCaptor.forClass(BridgeDomainAddDel.class); verify(api).bridgeDomainAddDel(argumentCaptor.capture()); final BridgeDomainAddDel actual = argumentCaptor.getValue(); diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppstate/VppStateTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppstate/VppStateTest.java index cd1384d4a..208fa2d8c 100644 --- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppstate/VppStateTest.java +++ b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppstate/VppStateTest.java @@ -29,12 +29,13 @@ import static org.mockito.MockitoAnnotations.initMocks; import com.google.common.base.Optional; import com.google.common.collect.Iterables; import com.google.common.collect.Multimap; +import io.fd.honeycomb.translate.MappingContext; import io.fd.honeycomb.translate.ModificationCache; import io.fd.honeycomb.translate.impl.read.GenericListReader; import io.fd.honeycomb.translate.read.ReadContext; -import io.fd.honeycomb.translate.v3po.test.ContextTestUtils; -import io.fd.honeycomb.translate.MappingContext; +import io.fd.honeycomb.translate.read.ReadFailedException; import io.fd.honeycomb.translate.read.registry.ReaderRegistry; +import io.fd.honeycomb.translate.v3po.test.ContextTestUtils; import io.fd.honeycomb.translate.v3po.util.NamingContext; import java.util.Arrays; import java.util.Collections; @@ -283,7 +284,7 @@ public class VppStateTest { read.get()); } - @Test(expected = IllegalArgumentException.class) + @Test(expected = ReadFailedException.class) public void testReadBridgeDomainNotExisting() throws Exception { doReturn(Optional.absent()).when(mappingContext).read( ContextTestUtils.getMappingIid("NOT EXISTING", "bd-test-instance")); diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppstate/VppStateTestUtils.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppstate/VppStateTestUtils.java index 5ebc27e8a..d1aea6ef6 100644 --- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppstate/VppStateTestUtils.java +++ b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/vppstate/VppStateTestUtils.java @@ -51,10 +51,6 @@ final class VppStateTestUtils { final InstanceIdentifier vppStateId = InstanceIdentifier.create(VppState.class); registry.addStructuralReader(vppStateId, VppStateBuilder.class); // Version - // Wrap with keepalive reader to detect connection issues - // TODO keepalive reader wrapper relies on VersionReaderCustomizer (to perform timeout on reads) - // Once readers+customizers are asynchronous, pull the timeout to keepalive executor so that keepalive wrapper - // is truly generic registry.add(new GenericReader<>(vppStateId.child(Version.class), new VersionCustomizer(jVpp))); // BridgeDomains(Structural) bridgeDomainsId = vppStateId.child(BridgeDomains.class); -- cgit 1.2.3-korg