summaryrefslogtreecommitdiffstats
path: root/acl/acl-impl
diff options
context:
space:
mode:
authorMarek Gradzki <mgradzki@cisco.com>2016-12-23 08:03:10 +0100
committerMarek Gradzki <mgradzki@cisco.com>2016-12-23 09:17:24 +0100
commit7f961994184897bba90003e2d6d324e1041946af (patch)
tree72cdb45545b69368706ff984761acb6da8624bd2 /acl/acl-impl
parentcfcc0585d9801a15ec4b36ac627662dc7f0fe789 (diff)
HONEYCOMB-310: initializers for interface acl assignment
Change-Id: I6dcc1ef1abc9d314906d6d4fcc746dcfd28ec5fc Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
Diffstat (limited to 'acl/acl-impl')
-rw-r--r--acl/acl-impl/src/main/java/io/fd/hc2vpp/acl/read/AbstractVppAclCustomizer.java28
-rw-r--r--acl/acl-impl/src/main/java/io/fd/hc2vpp/acl/read/EgressVppAclCustomizer.java11
-rw-r--r--acl/acl-impl/src/main/java/io/fd/hc2vpp/acl/read/IngressVppAclCustomizer.java11
-rw-r--r--acl/acl-impl/src/main/java/io/fd/hc2vpp/acl/read/VppMacIpAclCustomizer.java22
-rw-r--r--acl/acl-impl/src/main/java/io/fd/hc2vpp/acl/read/factory/InterfaceAclReaderFactory.java10
-rw-r--r--acl/acl-impl/src/test/java/io/fd/hc2vpp/acl/read/AbstractVppAclCustomizerTest.java21
-rw-r--r--acl/acl-impl/src/test/java/io/fd/hc2vpp/acl/read/VppMacIpAclCustomizerTest.java19
7 files changed, 109 insertions, 13 deletions
diff --git a/acl/acl-impl/src/main/java/io/fd/hc2vpp/acl/read/AbstractVppAclCustomizer.java b/acl/acl-impl/src/main/java/io/fd/hc2vpp/acl/read/AbstractVppAclCustomizer.java
index ed853eeea..782c1c007 100644
--- a/acl/acl-impl/src/main/java/io/fd/hc2vpp/acl/read/AbstractVppAclCustomizer.java
+++ b/acl/acl-impl/src/main/java/io/fd/hc2vpp/acl/read/AbstractVppAclCustomizer.java
@@ -24,7 +24,8 @@ import io.fd.hc2vpp.common.translate.util.JvppReplyConsumer;
import io.fd.hc2vpp.common.translate.util.NamingContext;
import io.fd.honeycomb.translate.read.ReadContext;
import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.translate.spi.read.ListReaderCustomizer;
+import io.fd.honeycomb.translate.spi.read.Initialized;
+import io.fd.honeycomb.translate.spi.read.InitializingListReaderCustomizer;
import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager;
import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager.DumpCacheManagerBuilder;
import io.fd.honeycomb.translate.util.read.cache.EntityDumpExecutor;
@@ -41,8 +42,11 @@ import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
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.state.Interface;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.HexString;
+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.vpp.acls.base.attributes.VppAcls;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang._interface.acl.rev161214.vpp.acls.base.attributes.VppAclsBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang._interface.acl.rev161214.vpp.acls.base.attributes.VppAclsKey;
@@ -50,7 +54,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
abstract class AbstractVppAclCustomizer extends FutureJVppAclCustomizer
- implements ListReaderCustomizer<VppAcls, VppAclsKey, VppAclsBuilder>, JvppReplyConsumer, ByteDataTranslator {
+ implements InitializingListReaderCustomizer<VppAcls, VppAclsKey, VppAclsBuilder>, JvppReplyConsumer,
+ ByteDataTranslator {
private final NamingContext interfaceContext;
private final NamingContext standardAclContext;
@@ -79,6 +84,15 @@ abstract class AbstractVppAclCustomizer extends FutureJVppAclCustomizer
.build();
}
+ protected static InstanceIdentifier<Acl> getAclCfgId(
+ final InstanceIdentifier<Acl> id) {
+ return InstanceIdentifier.create(Interfaces.class).child(
+ org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface.class,
+ new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey(
+ id.firstKeyOf(Interface.class).getName())).augmentation(VppAclInterfaceAugmentation.class)
+ .child(Acl.class);
+ }
+
private EntityDumpExecutor<AclDetailsReplyDump, Integer> createAclExecutor() {
return (identifier, params) -> {
AclDump request = new AclDump();
@@ -160,4 +174,14 @@ abstract class AbstractVppAclCustomizer extends FutureJVppAclCustomizer
new IllegalArgumentException(String.format("Acl with name %s not found", aclName)));
}
}
+
+ @Nonnull
+ @Override
+ public Initialized<VppAcls> init(@Nonnull final InstanceIdentifier<VppAcls> id,
+ @Nonnull final VppAcls vppAcls,
+ @Nonnull final ReadContext readContext) {
+ return Initialized.create(getCfgId(id), vppAcls);
+ }
+
+ protected abstract InstanceIdentifier<VppAcls> getCfgId(final InstanceIdentifier<VppAcls> id);
}
diff --git a/acl/acl-impl/src/main/java/io/fd/hc2vpp/acl/read/EgressVppAclCustomizer.java b/acl/acl-impl/src/main/java/io/fd/hc2vpp/acl/read/EgressVppAclCustomizer.java
index 536b27fcc..eaabb0bff 100644
--- a/acl/acl-impl/src/main/java/io/fd/hc2vpp/acl/read/EgressVppAclCustomizer.java
+++ b/acl/acl-impl/src/main/java/io/fd/hc2vpp/acl/read/EgressVppAclCustomizer.java
@@ -17,16 +17,20 @@
package io.fd.hc2vpp.acl.read;
import io.fd.hc2vpp.common.translate.util.NamingContext;
+import io.fd.honeycomb.translate.util.RWUtils;
import io.fd.vpp.jvpp.acl.dto.AclInterfaceListDetails;
import io.fd.vpp.jvpp.acl.future.FutureJVppAclFacade;
import java.util.Arrays;
import java.util.List;
import java.util.stream.IntStream;
import javax.annotation.Nonnull;
+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.EgressBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang._interface.acl.rev161214.vpp.acls.base.attributes.VppAcls;
import org.opendaylight.yangtools.concepts.Builder;
import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
public final class EgressVppAclCustomizer extends AbstractVppAclCustomizer {
@@ -45,4 +49,11 @@ public final class EgressVppAclCustomizer extends AbstractVppAclCustomizer {
public void merge(@Nonnull final Builder<? extends DataObject> builder, @Nonnull final List<VppAcls> readData) {
EgressBuilder.class.cast(builder).setVppAcls(readData);
}
+
+ @Override
+ protected InstanceIdentifier<VppAcls> getCfgId(
+ final InstanceIdentifier<VppAcls> id) {
+ return getAclCfgId(RWUtils.cutId(id, Acl.class)).child(Egress.class)
+ .child(VppAcls.class, id.firstKeyOf(VppAcls.class));
+ }
}
diff --git a/acl/acl-impl/src/main/java/io/fd/hc2vpp/acl/read/IngressVppAclCustomizer.java b/acl/acl-impl/src/main/java/io/fd/hc2vpp/acl/read/IngressVppAclCustomizer.java
index 8a31032d7..e8c79c967 100644
--- a/acl/acl-impl/src/main/java/io/fd/hc2vpp/acl/read/IngressVppAclCustomizer.java
+++ b/acl/acl-impl/src/main/java/io/fd/hc2vpp/acl/read/IngressVppAclCustomizer.java
@@ -17,16 +17,20 @@
package io.fd.hc2vpp.acl.read;
import io.fd.hc2vpp.common.translate.util.NamingContext;
+import io.fd.honeycomb.translate.util.RWUtils;
import io.fd.vpp.jvpp.acl.dto.AclInterfaceListDetails;
import io.fd.vpp.jvpp.acl.future.FutureJVppAclFacade;
import java.util.Arrays;
import java.util.List;
import java.util.stream.IntStream;
import javax.annotation.Nonnull;
+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.Ingress;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang._interface.acl.rev161214._interface.acl.attributes.acl.IngressBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang._interface.acl.rev161214.vpp.acls.base.attributes.VppAcls;
import org.opendaylight.yangtools.concepts.Builder;
import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
public final class IngressVppAclCustomizer extends AbstractVppAclCustomizer {
@@ -45,4 +49,11 @@ public final class IngressVppAclCustomizer extends AbstractVppAclCustomizer {
public void merge(@Nonnull final Builder<? extends DataObject> builder, @Nonnull final List<VppAcls> readData) {
IngressBuilder.class.cast(builder).setVppAcls(readData);
}
+
+ @Override
+ protected InstanceIdentifier<VppAcls> getCfgId(
+ final InstanceIdentifier<VppAcls> id) {
+ return getAclCfgId(RWUtils.cutId(id, Acl.class)).child(Ingress.class)
+ .child(VppAcls.class, id.firstKeyOf(VppAcls.class));
+ }
}
diff --git a/acl/acl-impl/src/main/java/io/fd/hc2vpp/acl/read/VppMacIpAclCustomizer.java b/acl/acl-impl/src/main/java/io/fd/hc2vpp/acl/read/VppMacIpAclCustomizer.java
index 7786afee5..81799e1fa 100644
--- a/acl/acl-impl/src/main/java/io/fd/hc2vpp/acl/read/VppMacIpAclCustomizer.java
+++ b/acl/acl-impl/src/main/java/io/fd/hc2vpp/acl/read/VppMacIpAclCustomizer.java
@@ -16,6 +16,7 @@
package io.fd.hc2vpp.acl.read;
+import static io.fd.hc2vpp.acl.read.AbstractVppAclCustomizer.getAclCfgId;
import static io.fd.honeycomb.translate.util.read.cache.EntityDumpExecutor.NO_PARAMS;
import com.google.common.base.Optional;
@@ -27,7 +28,9 @@ import io.fd.honeycomb.translate.MappingContext;
import io.fd.honeycomb.translate.ModificationCache;
import io.fd.honeycomb.translate.read.ReadContext;
import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.translate.spi.read.ReaderCustomizer;
+import io.fd.honeycomb.translate.spi.read.Initialized;
+import io.fd.honeycomb.translate.spi.read.InitializingReaderCustomizer;
+import io.fd.honeycomb.translate.util.RWUtils;
import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager;
import io.fd.honeycomb.translate.util.read.cache.EntityDumpExecutor;
import io.fd.vpp.jvpp.acl.dto.MacipAclDetails;
@@ -39,6 +42,8 @@ import io.fd.vpp.jvpp.acl.future.FutureJVppAclFacade;
import javax.annotation.Nonnull;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.HexString;
+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.Ingress;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang._interface.acl.rev161214._interface.acl.attributes.acl.IngressBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang._interface.acl.rev161214.vpp.macip.acls.base.attributes.VppMacipAcl;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang._interface.acl.rev161214.vpp.macip.acls.base.attributes.VppMacipAclBuilder;
@@ -49,7 +54,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class VppMacIpAclCustomizer extends FutureJVppAclCustomizer
- implements ReaderCustomizer<VppMacipAcl, VppMacipAclBuilder>, JvppReplyConsumer, ByteDataTranslator {
+ implements InitializingReaderCustomizer<VppMacipAcl, VppMacipAclBuilder>, JvppReplyConsumer, ByteDataTranslator {
private static final Logger LOG = LoggerFactory.getLogger(VppMacIpAclCustomizer.class);
@@ -78,6 +83,11 @@ public class VppMacIpAclCustomizer extends FutureJVppAclCustomizer
this.macIpAclContext = macIpAclContext;
}
+ private static InstanceIdentifier<VppMacipAcl> getCfgId(
+ final InstanceIdentifier<VppMacipAcl> id) {
+ return getAclCfgId(RWUtils.cutId(id, Acl.class)).child(Ingress.class).child(VppMacipAcl.class);
+ }
+
private EntityDumpExecutor<MacipAclDetailsReplyDump, Integer> createMacIpDumpExecutor() {
return (identifier, params) -> {
MacipAclDump request = new MacipAclDump();
@@ -142,4 +152,12 @@ public class VppMacIpAclCustomizer extends FutureJVppAclCustomizer
@Nonnull final VppMacipAcl readValue) {
IngressBuilder.class.cast(parentBuilder).setVppMacipAcl(readValue);
}
+
+ @Nonnull
+ @Override
+ public Initialized<? extends DataObject> init(@Nonnull final InstanceIdentifier<VppMacipAcl> id,
+ @Nonnull final VppMacipAcl readValue,
+ @Nonnull final ReadContext ctx) {
+ return Initialized.create(getCfgId(id), readValue);
+ }
}
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 691479e64..5b627fbc3 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
@@ -23,8 +23,8 @@ import io.fd.hc2vpp.acl.read.EgressVppAclCustomizer;
import io.fd.hc2vpp.acl.read.IngressVppAclCustomizer;
import io.fd.hc2vpp.acl.read.VppMacIpAclCustomizer;
import io.fd.hc2vpp.common.translate.util.NamingContext;
-import io.fd.honeycomb.translate.impl.read.GenericListReader;
-import io.fd.honeycomb.translate.impl.read.GenericReader;
+import io.fd.honeycomb.translate.impl.read.GenericInitListReader;
+import io.fd.honeycomb.translate.impl.read.GenericInitReader;
import io.fd.honeycomb.translate.read.ReaderFactory;
import io.fd.honeycomb.translate.read.registry.ModifiableReaderRegistryBuilder;
import io.fd.vpp.jvpp.acl.future.FutureJVppAclFacade;
@@ -73,14 +73,14 @@ public class InterfaceAclReaderFactory implements ReaderFactory {
final InstanceIdentifier<Ingress> ingressInstanceIdentifier = ACL_IID.child(Ingress.class);
registry.addStructuralReader(ingressInstanceIdentifier, IngressBuilder.class);
- registry.addAfter(new GenericListReader<>(ingressInstanceIdentifier.child(VppAcls.class),
+ registry.addAfter(new GenericInitListReader<>(ingressInstanceIdentifier.child(VppAcls.class),
new IngressVppAclCustomizer(futureAclFacade, interfaceContext, standardAclContext)), IFC_ID);
- registry.addAfter(new GenericReader<>(ingressInstanceIdentifier.child(VppMacipAcl.class),
+ registry.addAfter(new GenericInitReader<>(ingressInstanceIdentifier.child(VppMacipAcl.class),
new VppMacIpAclCustomizer(futureAclFacade, interfaceContext, macIpAClContext)), IFC_ID);
final InstanceIdentifier<Egress> egressInstanceIdentifier = ACL_IID.child(Egress.class);
registry.addStructuralReader(egressInstanceIdentifier, EgressBuilder.class);
- registry.addAfter(new GenericListReader<>(egressInstanceIdentifier.child(VppAcls.class),
+ registry.addAfter(new GenericInitListReader<>(egressInstanceIdentifier.child(VppAcls.class),
new EgressVppAclCustomizer(futureAclFacade, interfaceContext, standardAclContext)), IFC_ID);
}
}
diff --git a/acl/acl-impl/src/test/java/io/fd/hc2vpp/acl/read/AbstractVppAclCustomizerTest.java b/acl/acl-impl/src/test/java/io/fd/hc2vpp/acl/read/AbstractVppAclCustomizerTest.java
index 47e99ebac..e885ef033 100644
--- a/acl/acl-impl/src/test/java/io/fd/hc2vpp/acl/read/AbstractVppAclCustomizerTest.java
+++ b/acl/acl-impl/src/test/java/io/fd/hc2vpp/acl/read/AbstractVppAclCustomizerTest.java
@@ -18,15 +18,17 @@ package io.fd.hc2vpp.acl.read;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
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 io.fd.hc2vpp.common.test.read.ListReaderCustomizerTest;
+import io.fd.hc2vpp.common.test.read.InitializingListReaderCustomizerTest;
import io.fd.hc2vpp.common.translate.util.NamingContext;
import io.fd.honeycomb.translate.read.ReadFailedException;
+import io.fd.honeycomb.translate.spi.read.Initialized;
import io.fd.vpp.jvpp.acl.dto.AclDetails;
import io.fd.vpp.jvpp.acl.dto.AclDetailsReplyDump;
import io.fd.vpp.jvpp.acl.dto.AclInterfaceListDetails;
@@ -51,7 +53,7 @@ import org.opendaylight.yangtools.yang.binding.DataObject;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
public abstract class AbstractVppAclCustomizerTest
- extends ListReaderCustomizerTest<VppAcls, VppAclsKey, VppAclsBuilder> {
+ extends InitializingListReaderCustomizerTest<VppAcls, VppAclsKey, VppAclsBuilder> {
protected static final String IF_NAME = "eth1";
protected static final int IF_ID = 1;
@@ -123,6 +125,21 @@ public abstract class AbstractVppAclCustomizerTest
assertEquals(0, getCustomizer().getAllIds(getWildcardedIid(IF_NAME_NO_ACL), ctx).size());
}
+ @Test
+ public void testInit() {
+ final String aclName = "acl-name";
+ final Class<VppAcl> aclType = VppAcl.class;
+ defineMapping(mappingContext, aclName, 1, ACL_CTX_NAME);
+
+ final VppAcls readValue = new VppAclsBuilder().build();
+ final Initialized<? extends DataObject> cfgValue =
+ getCustomizer().init(getIid(IF_NAME, new VppAclsKey(aclName, aclType)), readValue, ctx);
+ assertEquals(readValue, cfgValue.getData());
+ assertNotNull(cfgValue.getId().firstKeyOf(
+ org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface.class));
+ assertEquals(cfgValue.getId().getTargetType(), VppAcls.class);
+ }
+
protected AclInterfaceListDump aclInterfaceRequest(final int swIfIndex) {
final AclInterfaceListDump request = new AclInterfaceListDump();
request.swIfIndex = swIfIndex;
diff --git a/acl/acl-impl/src/test/java/io/fd/hc2vpp/acl/read/VppMacIpAclCustomizerTest.java b/acl/acl-impl/src/test/java/io/fd/hc2vpp/acl/read/VppMacIpAclCustomizerTest.java
index 97169cf06..29df6ac22 100644
--- a/acl/acl-impl/src/test/java/io/fd/hc2vpp/acl/read/VppMacIpAclCustomizerTest.java
+++ b/acl/acl-impl/src/test/java/io/fd/hc2vpp/acl/read/VppMacIpAclCustomizerTest.java
@@ -17,15 +17,18 @@
package io.fd.hc2vpp.acl.read;
import static io.fd.hc2vpp.acl.read.AbstractVppAclCustomizerTest.getAclId;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.when;
-import io.fd.hc2vpp.common.test.read.ReaderCustomizerTest;
+import io.fd.hc2vpp.common.test.read.InitializingReaderCustomizerTest;
import io.fd.hc2vpp.common.translate.util.NamingContext;
import io.fd.honeycomb.translate.read.ReadFailedException;
+import io.fd.honeycomb.translate.spi.read.Initialized;
import io.fd.vpp.jvpp.acl.dto.MacipAclDetails;
import io.fd.vpp.jvpp.acl.dto.MacipAclDetailsReplyDump;
import io.fd.vpp.jvpp.acl.dto.MacipAclDump;
@@ -35,13 +38,15 @@ import javax.annotation.Nonnull;
import org.junit.Test;
import org.mockito.Mock;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.AclBase;
+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._interface.acl.attributes.acl.Ingress;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang._interface.acl.rev161214._interface.acl.attributes.acl.IngressBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang._interface.acl.rev161214.vpp.macip.acls.base.attributes.VppMacipAcl;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang._interface.acl.rev161214.vpp.macip.acls.base.attributes.VppMacipAclBuilder;
+import org.opendaylight.yangtools.yang.binding.DataObject;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-public class VppMacIpAclCustomizerTest extends ReaderCustomizerTest<VppMacipAcl, VppMacipAclBuilder> {
+public class VppMacIpAclCustomizerTest extends InitializingReaderCustomizerTest<VppMacipAcl, VppMacipAclBuilder> {
protected static final String IF_NAME_NO_ACL = "eth2";
protected static final int IF_ID_NO_ACL = 2;
@@ -104,6 +109,16 @@ public class VppMacIpAclCustomizerTest extends ReaderCustomizerTest<VppMacipAcl,
verifyZeroInteractions(builder);
}
+ @Test
+ public void testInit() {
+ final VppMacipAcl readValue = new VppMacipAclBuilder().build();
+ final Initialized<? extends DataObject> cfgValue = getCustomizer().init(getIid(IF_NAME), readValue, ctx);
+ assertEquals(cfgValue.getData(), readValue);
+ assertNotNull(cfgValue.getId().firstKeyOf(Interface.class));
+ assertEquals(cfgValue.getId().getTargetType(), VppMacipAcl.class);
+
+ }
+
protected InstanceIdentifier<VppMacipAcl> getIid(@Nonnull final String ifName) {
return getAclId(ifName).child(Ingress.class).child(VppMacipAcl.class);
}