X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=v3po%2Fv3po2vpp%2Fsrc%2Ftest%2Fjava%2Fio%2Ffd%2Fhoneycomb%2Ftranslate%2Fv3po%2Finterfaces%2FAclCustomizerTest.java;h=53ff77927062cf35e4b2a6bbda945612f12b7652;hb=11e154ab3e09464086cad06376a5da25430cf48b;hp=b55a5ce2bf4ceb1ba66dedf9e822b0b0685dd268;hpb=e7a0775b21c2ea6b7bb8efb63b5384df26e27fbb;p=honeycomb.git diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/AclCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/AclCustomizerTest.java index b55a5ce2b..53ff77927 100644 --- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/AclCustomizerTest.java +++ b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/AclCustomizerTest.java @@ -22,25 +22,26 @@ import static org.mockito.Matchers.any; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.verify; -import io.fd.honeycomb.translate.v3po.test.ContextTestUtils; -import io.fd.honeycomb.translate.v3po.util.NamingContext; +import io.fd.honeycomb.translate.v3po.interfaces.acl.ingress.AclCustomizer; import io.fd.honeycomb.translate.v3po.vppclassifier.VppClassifierContextManager; +import io.fd.honeycomb.translate.vpp.util.NamingContext; import io.fd.honeycomb.translate.write.WriteFailedException; import io.fd.honeycomb.vpp.test.write.WriterCustomizerTest; +import io.fd.vpp.jvpp.VppBaseCallException; +import io.fd.vpp.jvpp.core.dto.InputAclSetInterface; +import io.fd.vpp.jvpp.core.dto.InputAclSetInterfaceReply; import org.junit.Test; import org.mockito.Mock; 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.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.VppInterfaceAugmentation; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.acl.base.attributes.L2Acl; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.acl.base.attributes.L2AclBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces._interface.Acl; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces._interface.AclBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VppInterfaceAugmentation; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.acl.base.attributes.L2Acl; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.acl.base.attributes.L2AclBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.Acl; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.acl.Ingress; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.acl.IngressBuilder; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import org.openvpp.jvpp.VppBaseCallException; -import org.openvpp.jvpp.core.dto.InputAclSetInterface; -import org.openvpp.jvpp.core.dto.InputAclSetInterfaceReply; public class AclCustomizerTest extends WriterCustomizerTest { @@ -58,18 +59,18 @@ public class AclCustomizerTest extends WriterCustomizerTest { @Override public void setUp() { - ContextTestUtils.mockMapping(mappingContext, IF_NAME, IF_INDEX, IFC_TEST_INSTANCE); + defineMapping(mappingContext, IF_NAME, IF_INDEX, IFC_TEST_INSTANCE); customizer = new AclCustomizer(api, new NamingContext("generatedInterfaceName", IFC_TEST_INSTANCE), classifyTableContext); } - private InstanceIdentifier getAclId(final String name) { + private InstanceIdentifier getAclId(final String name) { return InstanceIdentifier.create(Interfaces.class).child(Interface.class, new InterfaceKey(name)).augmentation( - VppInterfaceAugmentation.class).child(Acl.class); + VppInterfaceAugmentation.class).child(Acl.class).child(Ingress.class); } - private Acl generateAcl(final String tableName) { - final AclBuilder builder = new AclBuilder(); + private Ingress generateAcl(final String tableName) { + final IngressBuilder builder = new IngressBuilder(); final L2Acl l2Acl = new L2AclBuilder().setClassifyTable(tableName).build(); builder.setL2Acl(l2Acl); return builder.build(); @@ -97,8 +98,8 @@ public class AclCustomizerTest extends WriterCustomizerTest { @Test public void testCreate() throws Exception { - final Acl acl = generateAcl(ACL_TABLE_NAME); - final InstanceIdentifier id = getAclId(IF_NAME); + final Ingress acl = generateAcl(ACL_TABLE_NAME); + final InstanceIdentifier id = getAclId(IF_NAME); whenInputAclSetInterfaceThenSuccess(); @@ -109,14 +110,14 @@ public class AclCustomizerTest extends WriterCustomizerTest { @Test public void testCreateFailed() throws Exception { - final Acl acl = generateAcl(ACL_TABLE_NAME); - final InstanceIdentifier id = getAclId(IF_NAME); + final Ingress acl = generateAcl(ACL_TABLE_NAME); + final InstanceIdentifier id = getAclId(IF_NAME); whenInputAclSetInterfaceThenFailure(); try { customizer.writeCurrentAttributes(id, acl, writeContext); - } catch (WriteFailedException.CreateFailedException e) { + } catch (WriteFailedException e) { assertTrue(e.getCause() instanceof VppBaseCallException); verify(api).inputAclSetInterface(generateInputAclSetInterface((byte) 1, IF_INDEX, ACL_TABLE_INDEX)); return; @@ -126,8 +127,8 @@ public class AclCustomizerTest extends WriterCustomizerTest { @Test public void testDelete() throws Exception { - final Acl acl = generateAcl(ACL_TABLE_NAME); - final InstanceIdentifier id = getAclId(IF_NAME); + final Ingress acl = generateAcl(ACL_TABLE_NAME); + final InstanceIdentifier id = getAclId(IF_NAME); whenInputAclSetInterfaceThenSuccess(); @@ -138,14 +139,14 @@ public class AclCustomizerTest extends WriterCustomizerTest { @Test public void testDeleteFailed() throws Exception { - final Acl acl = generateAcl(ACL_TABLE_NAME); - final InstanceIdentifier id = getAclId(IF_NAME); + final Ingress acl = generateAcl(ACL_TABLE_NAME); + final InstanceIdentifier id = getAclId(IF_NAME); whenInputAclSetInterfaceThenFailure(); try { customizer.deleteCurrentAttributes(id, acl, writeContext); - } catch (WriteFailedException.DeleteFailedException e) { + } catch (WriteFailedException e) { assertTrue(e.getCause() instanceof VppBaseCallException); verify(api).inputAclSetInterface(generateInputAclSetInterface((byte) 0, IF_INDEX, ACL_TABLE_INDEX)); return;