diff options
author | Michal Cmarada <mcmarada@cisco.com> | 2019-06-24 13:59:04 +0200 |
---|---|---|
committer | Michal Cmarada <mcmarada@cisco.com> | 2019-06-24 13:59:04 +0200 |
commit | b078f1d28cddc07da5bcad076b872113b9383ab4 (patch) | |
tree | 46b940292bd5f269d569aa5e804422e2e4ddb2a8 /v3po/v3po2vpp/src/test | |
parent | 590fdfed2ae071f731e8795ac7ac80c65d43feb1 (diff) |
- VPP introduced changes to GRE tunnels and ArpTermination
- this updates the api calls for both.
Change-Id: I9dd268a14a88ee701512453ce81d6ae15988832c
Signed-off-by: Michal Cmarada <mcmarada@cisco.com>
Diffstat (limited to 'v3po/v3po2vpp/src/test')
3 files changed, 20 insertions, 15 deletions
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/l2/ArpTerminationTableEntryCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/l2/ArpTerminationTableEntryCustomizerTest.java index c419e5c55..ce6ad9fd6 100644 --- a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/l2/ArpTerminationTableEntryCustomizerTest.java +++ b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/l2/ArpTerminationTableEntryCustomizerTest.java @@ -35,6 +35,7 @@ import io.fd.jvpp.core.dto.BdIpMacAddDelReply; import io.fd.jvpp.core.types.Address; import io.fd.jvpp.core.types.AddressFamily; import io.fd.jvpp.core.types.AddressUnion; +import io.fd.jvpp.core.types.BdIpMac; import io.fd.jvpp.core.types.Ip4Address; import io.fd.jvpp.core.types.MacAddress; import org.junit.Test; @@ -109,16 +110,17 @@ public class ArpTerminationTableEntryCustomizerTest extends WriterCustomizerTest private BdIpMacAddDel generateBdIpMacAddDelRequest(final byte[] ipAddress, final byte[] macAddress, final byte isAdd) { final BdIpMacAddDel request = new BdIpMacAddDel(); + request.entry = new BdIpMac(); Address address = new Address(); address.af = AddressFamily.ADDRESS_IP4; Ip4Address ip4Address = new Ip4Address(); ip4Address.ip4Address = ipAddress; address.un = new AddressUnion(ip4Address); - request.ip = address; + request.entry.ip = address; MacAddress macAddr = new MacAddress(); macAddr.macaddress = macAddress; - request.mac = macAddr; - request.bdId = BD_ID; + request.entry.mac = macAddr; + request.entry.bdId = BD_ID; request.isAdd = isAdd; return request; } @@ -136,9 +138,9 @@ public class ArpTerminationTableEntryCustomizerTest extends WriterCustomizerTest ArgumentCaptor<BdIpMacAddDel> argumentCaptor = ArgumentCaptor.forClass(BdIpMacAddDel.class); verify(api).bdIpMacAddDel(argumentCaptor.capture()); final BdIpMacAddDel actual = argumentCaptor.getValue(); - assertArrayEquals(expected.mac.macaddress, actual.mac.macaddress); - assertArrayEquals(expected.ip.un.getIp4().ip4Address, actual.ip.un.getIp4().ip4Address); - assertEquals(expected.bdId, actual.bdId); + assertArrayEquals(expected.entry.mac.macaddress, actual.entry.mac.macaddress); + assertArrayEquals(expected.entry.ip.un.getIp4().ip4Address, actual.entry.ip.un.getIp4().ip4Address); + assertEquals(expected.entry.bdId, actual.entry.bdId); assertEquals(expected.isAdd, actual.isAdd); } diff --git a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/read/GreCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/read/GreCustomizerTest.java index e29c1f191..d42daf83f 100644 --- a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/read/GreCustomizerTest.java +++ b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/read/GreCustomizerTest.java @@ -38,6 +38,7 @@ import io.fd.jvpp.core.dto.GreTunnelDetailsReplyDump; import io.fd.jvpp.core.dto.GreTunnelDump; import io.fd.jvpp.core.dto.SwInterfaceDetails; import io.fd.jvpp.core.types.GreTunnel; +import io.fd.jvpp.core.types.InterfaceIndex; import org.junit.Test; import org.mockito.Mock; import org.opendaylight.yang.gen.v1.http.fd.io.hc2vpp.yang.v3po.rev190527.VppInterfaceAugmentation; @@ -81,11 +82,11 @@ public class GreCustomizerTest extends ReaderCustomizerTest<Gre, GreBuilder> imp final GreTunnelDetailsReplyDump value = new GreTunnelDetailsReplyDump(); final GreTunnelDetails greTunnelDetails = new GreTunnelDetails(); greTunnelDetails.tunnel = new GreTunnel(); - greTunnelDetails.tunnel.isIpv6 = 0; greTunnelDetails.tunnel.dst = ipv4AddressToAddress(new Ipv4Address("1.2.3.4")); greTunnelDetails.tunnel.src = ipv4AddressToAddress(new Ipv4Address("1.2.3.5")); greTunnelDetails.tunnel.outerFibId = 55; - greTunnelDetails.tunnel.swIfIndex = 0; + greTunnelDetails.tunnel.swIfIndex = new InterfaceIndex(); + greTunnelDetails.tunnel.swIfIndex.interfaceindex = 0; value.greTunnelDetails = Lists.newArrayList(greTunnelDetails); doReturn(future(value)).when(api).greTunnelDump(any(GreTunnelDump.class)); diff --git a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/write/GreCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/write/GreCustomizerTest.java index 9707eb3a1..a88b6c72f 100644 --- a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/write/GreCustomizerTest.java +++ b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/write/GreCustomizerTest.java @@ -18,6 +18,7 @@ package io.fd.hc2vpp.v3po.write; import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import static org.mockito.Matchers.any; @@ -34,6 +35,8 @@ import io.fd.jvpp.VppBaseCallException; import io.fd.jvpp.VppInvocationException; import io.fd.jvpp.core.dto.GreTunnelAddDel; import io.fd.jvpp.core.dto.GreTunnelAddDelReply; +import io.fd.jvpp.core.types.AddressFamily; +import io.fd.jvpp.core.types.InterfaceIndex; import org.junit.Test; import org.mockito.ArgumentCaptor; import org.opendaylight.yang.gen.v1.http.fd.io.hc2vpp.yang.v3po.rev190527.VppInterfaceAugmentation; @@ -49,8 +52,6 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; public class GreCustomizerTest extends WriterCustomizerTest implements AddressTranslator { private static final String IFC_TEST_INSTANCE = "ifc-test-instance"; - private static final byte ADD_GRE = 1; - private static final byte DEL_GRE = 0; private final String IFACE_NAME = "eth0"; private final int IFACE_ID = 1; private InstanceIdentifier<Gre> id = InstanceIdentifier.create(Interfaces.class).child(Interface.class, new InterfaceKey(IFACE_NAME)) @@ -61,7 +62,7 @@ public class GreCustomizerTest extends WriterCustomizerTest implements AddressTr final GreBuilder builder = new GreBuilder(); builder.setSrc(new IpAddressNoZone(new Ipv4AddressNoZone("192.168.20.10"))); builder.setDst(new IpAddressNoZone(new Ipv4AddressNoZone("192.168.20.11"))); - builder.setOuterFibId(Long.valueOf(123)); + builder.setOuterFibId(123L); return builder.build(); } @@ -74,7 +75,8 @@ public class GreCustomizerTest extends WriterCustomizerTest implements AddressTr private void whenGreAddDelTunnelThenSuccess() { final GreTunnelAddDelReply reply = new GreTunnelAddDelReply(); - reply.swIfIndex = IFACE_ID; + reply.swIfIndex = new InterfaceIndex(); + reply.swIfIndex.interfaceindex = IFACE_ID; doReturn(future(reply)).when(api).greTunnelAddDel(any(GreTunnelAddDel.class)); } @@ -86,7 +88,7 @@ public class GreCustomizerTest extends WriterCustomizerTest implements AddressTr ArgumentCaptor<GreTunnelAddDel> argumentCaptor = ArgumentCaptor.forClass(GreTunnelAddDel.class); verify(api).greTunnelAddDel(argumentCaptor.capture()); final GreTunnelAddDel actual = argumentCaptor.getValue(); - assertEquals(0, actual.tunnel.isIpv6); + assertEquals(AddressFamily.ADDRESS_IP4, actual.tunnel.src.af); assertArrayEquals(ipAddressToArray(gre.getSrc()), actual.tunnel.src.un.getIp4().ip4Address); assertArrayEquals(ipAddressToArray(gre.getDst()), actual.tunnel.dst.un.getIp4().ip4Address); assertEquals(gre.getOuterFibId().intValue(), actual.tunnel.outerFibId); @@ -95,12 +97,12 @@ public class GreCustomizerTest extends WriterCustomizerTest implements AddressTr private void verifyGreAddWasInvoked(final Gre gre) throws VppInvocationException { final GreTunnelAddDel actual = verifyGreAddDelTunnelWasInvoked(gre); - assertEquals(ADD_GRE, actual.isAdd); + assertTrue(actual.isAdd); } private void verifyGreDeleteWasInvoked(final Gre gre) throws VppInvocationException { final GreTunnelAddDel actual = verifyGreAddDelTunnelWasInvoked(gre); - assertEquals(DEL_GRE, actual.isAdd); + assertFalse(actual.isAdd); } @Test |