diff options
author | Michal Cmarada <mcmarada@cisco.com> | 2018-11-19 14:59:14 +0100 |
---|---|---|
committer | Michal Cmarada <mcmarada@cisco.com> | 2018-11-19 14:59:14 +0100 |
commit | 718e9a3c7cac01860f3e3fe6174fcc1bd33fb4eb (patch) | |
tree | 34fae7680450e166e845f0c2db84ed8c3215930f /acl/acl-impl/src/main/java/io/fd/hc2vpp/acl/write/factory | |
parent | f9acfac8b701f9903a28edc98db127c36d73384f (diff) |
HC2VPP-291: ACL model bump
- bump ACL yang models
- fix ACL module implementation and validation
- fix ACL Unit tests
- update postman collection
Change-Id: Iaab64e6d92d17babc3ccef7921b41070c3716516
Signed-off-by: Michal Cmarada <mcmarada@cisco.com>
Diffstat (limited to 'acl/acl-impl/src/main/java/io/fd/hc2vpp/acl/write/factory')
4 files changed, 50 insertions, 76 deletions
diff --git a/acl/acl-impl/src/main/java/io/fd/hc2vpp/acl/write/factory/AbstractAclWriterFactory.java b/acl/acl-impl/src/main/java/io/fd/hc2vpp/acl/write/factory/AbstractAclWriterFactory.java index 37a8de2d1..8944e5977 100644 --- a/acl/acl-impl/src/main/java/io/fd/hc2vpp/acl/write/factory/AbstractAclWriterFactory.java +++ b/acl/acl-impl/src/main/java/io/fd/hc2vpp/acl/write/factory/AbstractAclWriterFactory.java @@ -26,10 +26,10 @@ import io.fd.vpp.jvpp.acl.future.FutureJVppAclFacade; /** * Created by jsrnicek on 12.12.2016. */ -class AbstractAclWriterFactory { +abstract class AbstractAclWriterFactory { @Inject - protected FutureJVppAclFacade futureAclFacade; + FutureJVppAclFacade futureAclFacade; @Inject @Named(AclModule.STANDARD_ACL_CONTEXT_NAME) @@ -37,7 +37,7 @@ class AbstractAclWriterFactory { @Inject @Named(AclModule.MAC_IP_ACL_CONTEXT_NAME) - protected AclContextManager macIpAClContext; + protected AclContextManager macIpAclContext; @Inject @Named("interface-context") diff --git a/acl/acl-impl/src/main/java/io/fd/hc2vpp/acl/write/factory/AclWriterFactory.java b/acl/acl-impl/src/main/java/io/fd/hc2vpp/acl/write/factory/AclWriterFactory.java new file mode 100644 index 000000000..faab3023d --- /dev/null +++ b/acl/acl-impl/src/main/java/io/fd/hc2vpp/acl/write/factory/AclWriterFactory.java @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2016 Cisco and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.fd.hc2vpp.acl.write.factory; + +import io.fd.hc2vpp.acl.AclIIds; +import io.fd.hc2vpp.acl.write.AclCustomizer; +import io.fd.hc2vpp.acl.write.AclValidator; +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; + +public class AclWriterFactory extends AbstractAclWriterFactory implements WriterFactory { + + @Override + public void init(@Nonnull final ModifiableWriterRegistryBuilder registry) { + + registry.subtreeAddBefore(AclIIds.vppAclChildren(AclIIds.ACL), + new GenericListWriter<>(AclIIds.ACLS_ACL, + new AclCustomizer(futureAclFacade, standardAclContext, macIpAclContext), + new AclValidator() + ), + AclIIds.aclHandledChildren(AclIIds.IFC_ACL)); + } +} 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 12be40a14..c5144b362 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 @@ -17,46 +17,27 @@ package io.fd.hc2vpp.acl.write.factory; import com.google.common.collect.ImmutableSet; +import io.fd.hc2vpp.acl.AclIIds; import io.fd.hc2vpp.acl.write.InterfaceAclCustomizer; -import io.fd.hc2vpp.acl.write.InterfaceAclMacIpCustomizer; import io.fd.honeycomb.translate.impl.write.GenericWriter; import io.fd.honeycomb.translate.write.WriterFactory; import io.fd.honeycomb.translate.write.registry.ModifiableWriterRegistryBuilder; import java.util.Set; import javax.annotation.Nonnull; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang._interface.acl.rev161214.VppAclInterfaceAugmentation; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang._interface.acl.rev161214._interface.acl.attributes.Acl; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang._interface.acl.rev161214._interface.acl.attributes.acl.Egress; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang._interface.acl.rev161214._interface.acl.attributes.acl.Ingress; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang._interface.acl.rev161214.vpp.acls.base.attributes.VppAcls; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang._interface.acl.rev161214.vpp.macip.acls.base.attributes.VppMacipAcl; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; public class InterfaceAclWriterFactory extends AbstractAclWriterFactory implements WriterFactory { - static final InstanceIdentifier<Acl> ACL_IID = - InstanceIdentifier.create(Interfaces.class).child(Interface.class) - .augmentation(VppAclInterfaceAugmentation.class).child(Acl.class); - private static final InstanceIdentifier<Interface> IFC_ID = - InstanceIdentifier.create(Interfaces.class).child(Interface.class); - - @Override public void init(@Nonnull final ModifiableWriterRegistryBuilder registry) { - registry.subtreeAddAfter(aclHandledChildren(InstanceIdentifier.create(Acl.class)), - new GenericWriter<>(ACL_IID, - new InterfaceAclCustomizer(futureAclFacade, interfaceContext, standardAclContext)), IFC_ID); - - registry.addAfter(new GenericWriter<>(ACL_IID.child(Ingress.class).child(VppMacipAcl.class), - new InterfaceAclMacIpCustomizer(futureAclFacade, macIpAClContext, interfaceContext)), IFC_ID); + registry.subtreeAddAfter(AclIIds.aclHandledChildren(AclIIds.IFC_ACL), + new GenericWriter<>(AclIIds.ACLS_AP_INT, + new InterfaceAclCustomizer(futureAclFacade, interfaceContext, standardAclContext, + macIpAclContext)), + aclRequiredIids()); } - static Set<InstanceIdentifier<?>> aclHandledChildren(final InstanceIdentifier<Acl> parentId) { - return ImmutableSet.of(parentId.child(Ingress.class), - parentId.child(Ingress.class).child(VppAcls.class), - parentId.child(Egress.class), - parentId.child(Egress.class).child(VppAcls.class)); + static Set<InstanceIdentifier<?>> aclRequiredIids() { + return ImmutableSet.of(AclIIds.IFC, AclIIds.IFC_ACL, AclIIds.ACLS_ACL); } } 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 deleted file mode 100644 index 883cf4f1f..000000000 --- a/acl/acl-impl/src/main/java/io/fd/hc2vpp/acl/write/factory/VppAclWriterFactory.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2016 Cisco and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at: - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.fd.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.hc2vpp.acl.write.VppAclValidator; -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.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.AccessLists; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.Acl; -import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; - -public class VppAclWriterFactory extends AbstractAclWriterFactory implements WriterFactory, AclFactory { - - @Override - public void init(@Nonnull final ModifiableWriterRegistryBuilder registry) { - final InstanceIdentifier<AccessLists> rootNode = InstanceIdentifier.create(AccessLists.class); - - registry.subtreeAddBefore(vppAclChildren(InstanceIdentifier.create(Acl.class)), - new GenericListWriter<>(rootNode.child(Acl.class), - new VppAclCustomizer(futureAclFacade, standardAclContext, macIpAClContext), - new VppAclValidator() - ), - aclHandledChildren(ACL_IID)); - } -} |