From 2c28a58160b7693a1ab11d43def37c41a067eff1 Mon Sep 17 00:00:00 2001 From: Marek Gradzki Date: Fri, 3 Mar 2017 07:36:52 +0100 Subject: HC2VPP-91: fix acl ordering Acl assignment should be added after interface creation (and removed in reverse order). Change-Id: Ieb915b8909ce39549e6f8312a92e065d59303e8d Signed-off-by: Marek Gradzki --- .../io/fd/hc2vpp/acl/read/factory/AclReaderFactory.java | 11 ++--------- .../acl/read/factory/InterfaceAclReaderFactory.java | 2 +- .../acl/write/factory/InterfaceAclWriterFactory.java | 15 +++++++++------ .../fd/hc2vpp/acl/write/factory/VppAclWriterFactory.java | 8 ++++++-- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/acl/acl-impl/src/main/java/io/fd/hc2vpp/acl/read/factory/AclReaderFactory.java b/acl/acl-impl/src/main/java/io/fd/hc2vpp/acl/read/factory/AclReaderFactory.java index 90c4afe83..34352e8f3 100644 --- a/acl/acl-impl/src/main/java/io/fd/hc2vpp/acl/read/factory/AclReaderFactory.java +++ b/acl/acl-impl/src/main/java/io/fd/hc2vpp/acl/read/factory/AclReaderFactory.java @@ -56,15 +56,8 @@ public class AclReaderFactory implements ReaderFactory, AclFactory { public void init(@Nonnull final ModifiableReaderRegistryBuilder registry) { registry.addStructuralReader(ACLS_ID, AccessListsBuilder.class); - // TODO(HONEYCOMB-331): initializer is not registered correctly when subtreeAddBefore is used, - // enable after fixing infra issue: - -// registry.subtreeAddBefore(vppAclChildren(InstanceIdentifier.create(Acl.class)), -// new GenericInitListReader<>(ACL_ID, -// new AclCustomizer(futureAclFacade, standardAclContext, macIpAClContext)), -// ImmutableSet.of(ACL_INGRESS_IID, ACL_EGRESS_IID)); - - registry.addBefore(new GenericInitListReader<>(ACL_ID, + registry.subtreeAddBefore(vppAclChildren(InstanceIdentifier.create(Acl.class)), + new GenericInitListReader<>(ACL_ID, new AclCustomizer(futureAclFacade, standardAclContext, macIpAClContext)), ImmutableSet.of(ACL_INGRESS_IID, ACL_EGRESS_IID)); } diff --git a/acl/acl-impl/src/main/java/io/fd/hc2vpp/acl/read/factory/InterfaceAclReaderFactory.java b/acl/acl-impl/src/main/java/io/fd/hc2vpp/acl/read/factory/InterfaceAclReaderFactory.java index 5b2c45088..173223648 100644 --- a/acl/acl-impl/src/main/java/io/fd/hc2vpp/acl/read/factory/InterfaceAclReaderFactory.java +++ b/acl/acl-impl/src/main/java/io/fd/hc2vpp/acl/read/factory/InterfaceAclReaderFactory.java @@ -65,7 +65,7 @@ public class InterfaceAclReaderFactory implements ReaderFactory { IFC_ID = InstanceIdentifier.create(InterfacesState.class).child(Interface.class); private static final InstanceIdentifier VPP_ACL_AUG_IID = IFC_ID.augmentation(VppAclInterfaceStateAugmentation.class); - private static final InstanceIdentifier ACL_IID = VPP_ACL_AUG_IID.child(Acl.class); + static final InstanceIdentifier ACL_IID = VPP_ACL_AUG_IID.child(Acl.class); static final InstanceIdentifier ACL_INGRESS_IID = ACL_IID.child(Ingress.class); static final InstanceIdentifier ACL_EGRESS_IID = ACL_IID.child(Egress.class); diff --git a/acl/acl-impl/src/main/java/io/fd/hc2vpp/acl/write/factory/InterfaceAclWriterFactory.java b/acl/acl-impl/src/main/java/io/fd/hc2vpp/acl/write/factory/InterfaceAclWriterFactory.java index 6598aae9c..12be40a14 100644 --- a/acl/acl-impl/src/main/java/io/fd/hc2vpp/acl/write/factory/InterfaceAclWriterFactory.java +++ b/acl/acl-impl/src/main/java/io/fd/hc2vpp/acl/write/factory/InterfaceAclWriterFactory.java @@ -36,21 +36,24 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; public class InterfaceAclWriterFactory extends AbstractAclWriterFactory implements WriterFactory { - private static final InstanceIdentifier ACL_IID = + static final InstanceIdentifier ACL_IID = InstanceIdentifier.create(Interfaces.class).child(Interface.class) .augmentation(VppAclInterfaceAugmentation.class).child(Acl.class); + private static final InstanceIdentifier IFC_ID = + InstanceIdentifier.create(Interfaces.class).child(Interface.class); + @Override public void init(@Nonnull final ModifiableWriterRegistryBuilder registry) { - registry.subtreeAdd(aclHandledChildren(InstanceIdentifier.create(Acl.class)), + registry.subtreeAddAfter(aclHandledChildren(InstanceIdentifier.create(Acl.class)), new GenericWriter<>(ACL_IID, - new InterfaceAclCustomizer(futureAclFacade, interfaceContext, standardAclContext))); + new InterfaceAclCustomizer(futureAclFacade, interfaceContext, standardAclContext)), IFC_ID); - registry.add(new GenericWriter<>(ACL_IID.child(Ingress.class).child(VppMacipAcl.class), - new InterfaceAclMacIpCustomizer(futureAclFacade, macIpAClContext, interfaceContext))); + registry.addAfter(new GenericWriter<>(ACL_IID.child(Ingress.class).child(VppMacipAcl.class), + new InterfaceAclMacIpCustomizer(futureAclFacade, macIpAClContext, interfaceContext)), IFC_ID); } - private Set> aclHandledChildren(final InstanceIdentifier parentId) { + static Set> aclHandledChildren(final InstanceIdentifier parentId) { return ImmutableSet.of(parentId.child(Ingress.class), parentId.child(Ingress.class).child(VppAcls.class), parentId.child(Egress.class), diff --git a/acl/acl-impl/src/main/java/io/fd/hc2vpp/acl/write/factory/VppAclWriterFactory.java b/acl/acl-impl/src/main/java/io/fd/hc2vpp/acl/write/factory/VppAclWriterFactory.java index bf855ef26..2b95f0b60 100644 --- a/acl/acl-impl/src/main/java/io/fd/hc2vpp/acl/write/factory/VppAclWriterFactory.java +++ b/acl/acl-impl/src/main/java/io/fd/hc2vpp/acl/write/factory/VppAclWriterFactory.java @@ -16,6 +16,9 @@ package io.fd.hc2vpp.acl.write.factory; +import static io.fd.hc2vpp.acl.write.factory.InterfaceAclWriterFactory.ACL_IID; +import static io.fd.hc2vpp.acl.write.factory.InterfaceAclWriterFactory.aclHandledChildren; + import io.fd.hc2vpp.acl.util.factory.AclFactory; import io.fd.hc2vpp.acl.write.VppAclCustomizer; import io.fd.honeycomb.translate.impl.write.GenericListWriter; @@ -32,8 +35,9 @@ public class VppAclWriterFactory extends AbstractAclWriterFactory implements Wri public void init(@Nonnull final ModifiableWriterRegistryBuilder registry) { final InstanceIdentifier rootNode = InstanceIdentifier.create(AccessLists.class); - registry.subtreeAdd(vppAclChildren(InstanceIdentifier.create(Acl.class)), + registry.subtreeAddBefore(vppAclChildren(InstanceIdentifier.create(Acl.class)), new GenericListWriter<>(rootNode.child(Acl.class), - new VppAclCustomizer(futureAclFacade, standardAclContext, macIpAClContext))); + new VppAclCustomizer(futureAclFacade, standardAclContext, macIpAClContext)), + aclHandledChildren(ACL_IID)); } } -- cgit 1.2.3-korg